Browse Source

Remove expensive Contract calls from the hot path.

pull/3203/head
Dariusz Komosinski 6 years ago
parent
commit
d0d4bec96b
  1. 11
      src/Avalonia.Base/AvaloniaObject.cs

11
src/Avalonia.Base/AvaloniaObject.cs

@ -210,7 +210,11 @@ namespace Avalonia
/// <returns>The value.</returns>
public object GetValue(AvaloniaProperty property)
{
Contract.Requires<ArgumentNullException>(property != null);
if (property is null)
{
throw new ArgumentNullException(nameof(property));
}
VerifyAccess();
if (property.IsDirect)
@ -231,7 +235,10 @@ namespace Avalonia
/// <returns>The value.</returns>
public T GetValue<T>(AvaloniaProperty<T> property)
{
Contract.Requires<ArgumentNullException>(property != null);
if (property is null)
{
throw new ArgumentNullException(nameof(property));
}
return (T)GetValue((AvaloniaProperty)property);
}

Loading…
Cancel
Save