Browse Source
Further reduces allocated memory in the common case of only a local value being set.pull/3287/head
2 changed files with 41 additions and 20 deletions
@ -0,0 +1,19 @@ |
|||
using Avalonia.Data; |
|||
|
|||
#nullable enable |
|||
|
|||
namespace Avalonia.PropertyStore |
|||
{ |
|||
internal class LocalValueEntry<T> : IValue<T> |
|||
{ |
|||
public LocalValueEntry(T value) => Value = value; |
|||
public Optional<T> Value { get; set; } |
|||
public BindingPriority ValuePriority => BindingPriority.LocalValue; |
|||
Optional<object> IValue.Value => Value.ToObject(); |
|||
|
|||
public ConstantValueEntry<T> ToConstantValueEntry(StyledPropertyBase<T> property) |
|||
{ |
|||
return new ConstantValueEntry<T>(property, Value.Value, BindingPriority.LocalValue); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue