From e44d902374a156ed0a710ee99ecfab1696cd4ec6 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Wed, 26 Oct 2022 11:53:13 +0200 Subject: [PATCH] Remove unneeded method. --- src/Avalonia.Base/PropertyStore/BindingEntryBase.cs | 7 ------- src/Avalonia.Base/PropertyStore/IValueEntry.cs | 12 ------------ .../PropertyStore/ImmediateValueEntry.cs | 6 ------ .../Styling/PropertySetterTemplateInstance.cs | 12 +----------- src/Avalonia.Base/Styling/Setter.cs | 6 ------ 5 files changed, 1 insertion(+), 42 deletions(-) diff --git a/src/Avalonia.Base/PropertyStore/BindingEntryBase.cs b/src/Avalonia.Base/PropertyStore/BindingEntryBase.cs index 9df8bca447..4ddab46b13 100644 --- a/src/Avalonia.Base/PropertyStore/BindingEntryBase.cs +++ b/src/Avalonia.Base/PropertyStore/BindingEntryBase.cs @@ -79,13 +79,6 @@ namespace Avalonia.PropertyStore return _value!; } - bool IValueEntry.TryGetValue(out object? value) - { - Start(produceValue: false); - value = _value; - return _hasValue; - } - protected abstract BindingValue ConvertAndValidate(TSource value); protected abstract BindingValue ConvertAndValidate(BindingValue value); diff --git a/src/Avalonia.Base/PropertyStore/IValueEntry.cs b/src/Avalonia.Base/PropertyStore/IValueEntry.cs index 3dd9497c14..271d85f8bc 100644 --- a/src/Avalonia.Base/PropertyStore/IValueEntry.cs +++ b/src/Avalonia.Base/PropertyStore/IValueEntry.cs @@ -22,18 +22,6 @@ namespace Avalonia.PropertyStore /// object? GetValue(); - /// - /// Tries to get the value associated with the entry. - /// - /// - /// When this method returns, contains the value associated with the entry if a value is - /// present; otherwise, returns null. - /// - /// - /// true if the entry has an associated value; otherwise false. - /// - bool TryGetValue(out object? value); - /// /// Called when the value entry is removed from the value store. /// diff --git a/src/Avalonia.Base/PropertyStore/ImmediateValueEntry.cs b/src/Avalonia.Base/PropertyStore/ImmediateValueEntry.cs index 57060f203c..6040a7a328 100644 --- a/src/Avalonia.Base/PropertyStore/ImmediateValueEntry.cs +++ b/src/Avalonia.Base/PropertyStore/ImmediateValueEntry.cs @@ -21,12 +21,6 @@ namespace Avalonia.PropertyStore public bool HasValue => true; AvaloniaProperty IValueEntry.Property => Property; - public bool TryGetValue(out object? value) - { - value = _value; - return true; - } - public void Unsubscribe() { } public void Dispose() => _owner.OnEntryDisposed(this); diff --git a/src/Avalonia.Base/Styling/PropertySetterTemplateInstance.cs b/src/Avalonia.Base/Styling/PropertySetterTemplateInstance.cs index 465dc21b57..7a39407ba2 100644 --- a/src/Avalonia.Base/Styling/PropertySetterTemplateInstance.cs +++ b/src/Avalonia.Base/Styling/PropertySetterTemplateInstance.cs @@ -17,17 +17,7 @@ namespace Avalonia.Styling public bool HasValue => true; public AvaloniaProperty Property { get; } - public object? GetValue() - { - TryGetValue(out var value); - return value; - } - - public bool TryGetValue(out object? value) - { - value = _value ??= _template.Build(); - return value != AvaloniaProperty.UnsetValue; - } + public object? GetValue() => _value ??= _template.Build(); void IValueEntry.Unsubscribe() { } } diff --git a/src/Avalonia.Base/Styling/Setter.cs b/src/Avalonia.Base/Styling/Setter.cs index fdee64a0de..92b35c9300 100644 --- a/src/Avalonia.Base/Styling/Setter.cs +++ b/src/Avalonia.Base/Styling/Setter.cs @@ -88,12 +88,6 @@ namespace Avalonia.Styling object? IValueEntry.GetValue() => Value; - bool IValueEntry.TryGetValue(out object? value) - { - value = Value; - return true; - } - private AvaloniaProperty EnsureProperty() { return Property ?? throw new InvalidOperationException("Setter.Property must be set.");