Use ContainsKey for Dictionaries. O(1)

This commit is contained in:
Chad Currie
2021-05-15 20:23:24 +12:00
committed by Nathan Woulfe
parent 980d9ad5cf
commit 474a76fd2b

View File

@@ -29,7 +29,7 @@ namespace Umbraco.Core.Models.Entities
/// <inheritdoc />
public virtual bool IsPropertyDirty(string propertyName)
{
return _currentChanges != null && _currentChanges.Any(x => x.Key == propertyName);
return _currentChanges != null && _currentChanges.ContainsKey(propertyName);
}
/// <inheritdoc />
@@ -61,7 +61,7 @@ namespace Umbraco.Core.Models.Entities
/// <inheritdoc />
public virtual bool WasPropertyDirty(string propertyName)
{
return _savedChanges != null && _savedChanges.Any(x => x.Key == propertyName);
return _savedChanges != null && _savedChanges.ContainsKey(propertyName);
}
/// <inheritdoc />