Browse Source
* Extract EffectiveValue notification methods to reduce code size * Extract non-generic members from frequently used generic typesrelease/11.2.0-beta2
committed by
GitHub
11 changed files with 165 additions and 77 deletions
@ -0,0 +1,14 @@ |
|||
using System; |
|||
using Avalonia.Reactive; |
|||
|
|||
namespace Avalonia.PropertyStore; |
|||
|
|||
/// <summary>
|
|||
/// Contains fields for <see cref="BindingEntryBase{TValue,TSource}"/> that aren't using generic arguments.
|
|||
/// Separated to avoid unnecessary generic instantiations.
|
|||
/// </summary>
|
|||
internal static class BindingEntryBaseNonGenericHelper |
|||
{ |
|||
public static readonly IDisposable Creating = Disposable.Empty; |
|||
public static readonly IDisposable CreatingQuiet = Disposable.Create(() => { }); |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
using System; |
|||
|
|||
namespace Avalonia.Reactive; |
|||
|
|||
/// <summary>
|
|||
/// Contains fields for <see cref="AnonymousObserver{T}"/> that aren't using generic arguments.
|
|||
/// Separated to avoid unnecessary generic instantiations.
|
|||
/// </summary>
|
|||
internal static class AnonymousObserverNonGenericHelper |
|||
{ |
|||
public static readonly Action<Exception> ThrowsOnError = ex => throw ex; |
|||
public static readonly Action NoOpCompleted = () => { }; |
|||
} |
|||
@ -0,0 +1,30 @@ |
|||
using System; |
|||
using System.Diagnostics.CodeAnalysis; |
|||
using System.Runtime.CompilerServices; |
|||
|
|||
namespace Avalonia; |
|||
|
|||
/// <summary>
|
|||
/// Contains methods for <see cref="StyledProperty{TValue}"/> that aren't using generic arguments.
|
|||
/// Separated to avoid unnecessary generic instantiations.
|
|||
/// </summary>
|
|||
internal static class StyledPropertyNonGenericHelper |
|||
{ |
|||
[DoesNotReturn] |
|||
[MethodImpl(MethodImplOptions.NoInlining)] |
|||
public static void ThrowInvalidValue(string propertyName, object? value, string paramName) |
|||
{ |
|||
var type = value?.GetType().FullName ?? "(null)"; |
|||
|
|||
throw new ArgumentException( |
|||
$"Invalid value for Property '{propertyName}': '{value}' ({type})", |
|||
paramName); |
|||
} |
|||
|
|||
public static void ThrowInvalidDefaultValue(string propertyName, object? defaultValue, string paramName) |
|||
{ |
|||
throw new ArgumentException( |
|||
$"'{defaultValue}' is not a valid default value for '{propertyName}'.", |
|||
paramName); |
|||
} |
|||
} |
|||
Loading…
Reference in new issue