Add nullable annotations to Microsoft.AspNetCore.Components (#22944)

* Add nullable for Microsoft.AspNetCore.Components
Contributes to https://github.com/dotnet/aspnetcore/issues/5680

* Fixup
This commit is contained in:
Pranav K 2020-06-19 11:38:37 -07:00 committed by GitHub
parent 52de5ee4df
commit 724c2e75a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
49 changed files with 550 additions and 495 deletions

View File

@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFrameworks>netstandard2.0;$(DefaultNetCoreTargetFramework)</TargetFrameworks>
<TargetFrameworks Condition="'$(DotNetBuildFromSource)' == 'true'">$(DefaultNetCoreTargetFramework)</TargetFrameworks>
<Nullable>annotations</Nullable>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<Compile Include="Microsoft.AspNetCore.Components.netstandard2.0.cs" />

View File

@ -5,69 +5,69 @@ namespace Microsoft.AspNetCore.Components
{
public static partial class BindConverter
{
public static bool FormatValue(bool value, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(System.DateTime value, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(System.DateTime value, string format, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(System.DateTimeOffset value, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(System.DateTimeOffset value, string format, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(decimal value, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(double value, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(short value, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(int value, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(long value, System.Globalization.CultureInfo culture = null) { throw null; }
public static bool? FormatValue(bool? value, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(System.DateTimeOffset? value, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(System.DateTimeOffset? value, string format, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(System.DateTime? value, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(System.DateTime? value, string format, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(decimal? value, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(double? value, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(short? value, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(int? value, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(long? value, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(float? value, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(float value, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(string value, System.Globalization.CultureInfo culture = null) { throw null; }
public static object FormatValue<T>(T value, System.Globalization.CultureInfo culture = null) { throw null; }
public static bool TryConvertToBool(object obj, System.Globalization.CultureInfo culture, out bool value) { throw null; }
public static bool TryConvertToDateTime(object obj, System.Globalization.CultureInfo culture, out System.DateTime value) { throw null; }
public static bool TryConvertToDateTime(object obj, System.Globalization.CultureInfo culture, string format, out System.DateTime value) { throw null; }
public static bool TryConvertToDateTimeOffset(object obj, System.Globalization.CultureInfo culture, out System.DateTimeOffset value) { throw null; }
public static bool TryConvertToDateTimeOffset(object obj, System.Globalization.CultureInfo culture, string format, out System.DateTimeOffset value) { throw null; }
public static bool TryConvertToDecimal(object obj, System.Globalization.CultureInfo culture, out decimal value) { throw null; }
public static bool TryConvertToDouble(object obj, System.Globalization.CultureInfo culture, out double value) { throw null; }
public static bool TryConvertToFloat(object obj, System.Globalization.CultureInfo culture, out float value) { throw null; }
public static bool TryConvertToInt(object obj, System.Globalization.CultureInfo culture, out int value) { throw null; }
public static bool TryConvertToLong(object obj, System.Globalization.CultureInfo culture, out long value) { throw null; }
public static bool TryConvertToNullableBool(object obj, System.Globalization.CultureInfo culture, out bool? value) { throw null; }
public static bool TryConvertToNullableDateTime(object obj, System.Globalization.CultureInfo culture, out System.DateTime? value) { throw null; }
public static bool TryConvertToNullableDateTime(object obj, System.Globalization.CultureInfo culture, string format, out System.DateTime? value) { throw null; }
public static bool TryConvertToNullableDateTimeOffset(object obj, System.Globalization.CultureInfo culture, out System.DateTimeOffset? value) { throw null; }
public static bool TryConvertToNullableDateTimeOffset(object obj, System.Globalization.CultureInfo culture, string format, out System.DateTimeOffset? value) { throw null; }
public static bool TryConvertToNullableDecimal(object obj, System.Globalization.CultureInfo culture, out decimal? value) { throw null; }
public static bool TryConvertToNullableDouble(object obj, System.Globalization.CultureInfo culture, out double? value) { throw null; }
public static bool TryConvertToNullableFloat(object obj, System.Globalization.CultureInfo culture, out float? value) { throw null; }
public static bool TryConvertToNullableInt(object obj, System.Globalization.CultureInfo culture, out int? value) { throw null; }
public static bool TryConvertToNullableLong(object obj, System.Globalization.CultureInfo culture, out long? value) { throw null; }
public static bool TryConvertToNullableShort(object obj, System.Globalization.CultureInfo culture, out short? value) { throw null; }
public static bool TryConvertToShort(object obj, System.Globalization.CultureInfo culture, out short value) { throw null; }
public static bool TryConvertToString(object obj, System.Globalization.CultureInfo culture, out string value) { throw null; }
public static bool TryConvertTo<T>(object obj, System.Globalization.CultureInfo culture, out T value) { throw null; }
public static bool FormatValue(bool value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string FormatValue(System.DateTime value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string FormatValue(System.DateTime value, string format, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string FormatValue(System.DateTimeOffset value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string FormatValue(System.DateTimeOffset value, string format, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string FormatValue(decimal value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string? FormatValue(double value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string FormatValue(short value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string? FormatValue(int value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string FormatValue(long value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static bool? FormatValue(bool? value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string? FormatValue(System.DateTimeOffset? value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string? FormatValue(System.DateTimeOffset? value, string format, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string? FormatValue(System.DateTime? value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string? FormatValue(System.DateTime? value, string? format, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string? FormatValue(decimal? value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string? FormatValue(double? value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string? FormatValue(short? value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string? FormatValue(int? value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string? FormatValue(long? value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string? FormatValue(float? value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string FormatValue(float value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string FormatValue(string value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static object? FormatValue<T>(T value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static bool TryConvertToBool(object? obj, System.Globalization.CultureInfo? culture, out bool value) { throw null; }
public static bool TryConvertToDateTime(object? obj, System.Globalization.CultureInfo? culture, out System.DateTime value) { throw null; }
public static bool TryConvertToDateTime(object? obj, System.Globalization.CultureInfo? culture, string format, out System.DateTime value) { throw null; }
public static bool TryConvertToDateTimeOffset(object? obj, System.Globalization.CultureInfo? culture, out System.DateTimeOffset value) { throw null; }
public static bool TryConvertToDateTimeOffset(object? obj, System.Globalization.CultureInfo? culture, string format, out System.DateTimeOffset value) { throw null; }
public static bool TryConvertToDecimal(object? obj, System.Globalization.CultureInfo? culture, out decimal value) { throw null; }
public static bool TryConvertToDouble(object? obj, System.Globalization.CultureInfo? culture, out double value) { throw null; }
public static bool TryConvertToFloat(object? obj, System.Globalization.CultureInfo? culture, out float value) { throw null; }
public static bool TryConvertToInt(object? obj, System.Globalization.CultureInfo? culture, out int value) { throw null; }
public static bool TryConvertToLong(object? obj, System.Globalization.CultureInfo? culture, out long value) { throw null; }
public static bool TryConvertToNullableBool(object? obj, System.Globalization.CultureInfo? culture, out bool? value) { throw null; }
public static bool TryConvertToNullableDateTime(object? obj, System.Globalization.CultureInfo? culture, out System.DateTime? value) { throw null; }
public static bool TryConvertToNullableDateTime(object? obj, System.Globalization.CultureInfo? culture, string format, out System.DateTime? value) { throw null; }
public static bool TryConvertToNullableDateTimeOffset(object? obj, System.Globalization.CultureInfo? culture, out System.DateTimeOffset? value) { throw null; }
public static bool TryConvertToNullableDateTimeOffset(object? obj, System.Globalization.CultureInfo? culture, string format, out System.DateTimeOffset? value) { throw null; }
public static bool TryConvertToNullableDecimal(object? obj, System.Globalization.CultureInfo? culture, out decimal? value) { throw null; }
public static bool TryConvertToNullableDouble(object? obj, System.Globalization.CultureInfo? culture, out double? value) { throw null; }
public static bool TryConvertToNullableFloat(object? obj, System.Globalization.CultureInfo? culture, out float? value) { throw null; }
public static bool TryConvertToNullableInt(object? obj, System.Globalization.CultureInfo? culture, out int? value) { throw null; }
public static bool TryConvertToNullableLong(object? obj, System.Globalization.CultureInfo? culture, out long? value) { throw null; }
public static bool TryConvertToNullableShort(object? obj, System.Globalization.CultureInfo? culture, out short? value) { throw null; }
public static bool TryConvertToShort(object? obj, System.Globalization.CultureInfo? culture, out short value) { throw null; }
public static bool TryConvertToString(object? obj, System.Globalization.CultureInfo? culture, out string? value) { throw null; }
public static bool TryConvertTo<T>(object? obj, System.Globalization.CultureInfo? culture, out T value) { throw null; }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class, AllowMultiple=true, Inherited=true)]
public sealed partial class BindElementAttribute : System.Attribute
{
public BindElementAttribute(string element, string suffix, string valueAttribute, string changeAttribute) { }
public BindElementAttribute(string element, string? suffix, string valueAttribute, string changeAttribute) { }
public string ChangeAttribute { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public string Element { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public string Suffix { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public string? Suffix { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public string ValueAttribute { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Property, AllowMultiple=false, Inherited=true)]
public sealed partial class CascadingParameterAttribute : System.Attribute
{
public CascadingParameterAttribute() { }
public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public string? Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
}
public partial class CascadingValue<TValue> : Microsoft.AspNetCore.Components.IComponent
{
@ -77,7 +77,7 @@ namespace Microsoft.AspNetCore.Components
[Microsoft.AspNetCore.Components.ParameterAttribute]
public bool IsFixed { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
[Microsoft.AspNetCore.Components.ParameterAttribute]
public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public string? Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
[Microsoft.AspNetCore.Components.ParameterAttribute]
public TValue Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public void Attach(Microsoft.AspNetCore.Components.RenderHandle renderHandle) { }
@ -86,7 +86,7 @@ namespace Microsoft.AspNetCore.Components
public partial class ChangeEventArgs : System.EventArgs
{
public ChangeEventArgs() { }
public object Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public object? Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
}
public abstract partial class ComponentBase : Microsoft.AspNetCore.Components.IComponent, Microsoft.AspNetCore.Components.IHandleAfterRender, Microsoft.AspNetCore.Components.IHandleEvent
{
@ -96,7 +96,7 @@ namespace Microsoft.AspNetCore.Components
protected System.Threading.Tasks.Task InvokeAsync(System.Func<System.Threading.Tasks.Task> workItem) { throw null; }
void Microsoft.AspNetCore.Components.IComponent.Attach(Microsoft.AspNetCore.Components.RenderHandle renderHandle) { }
System.Threading.Tasks.Task Microsoft.AspNetCore.Components.IHandleAfterRender.OnAfterRenderAsync() { throw null; }
System.Threading.Tasks.Task Microsoft.AspNetCore.Components.IHandleEvent.HandleEventAsync(Microsoft.AspNetCore.Components.EventCallbackWorkItem callback, object arg) { throw null; }
System.Threading.Tasks.Task Microsoft.AspNetCore.Components.IHandleEvent.HandleEventAsync(Microsoft.AspNetCore.Components.EventCallbackWorkItem callback, object? arg) { throw null; }
protected virtual void OnAfterRender(bool firstRender) { }
protected virtual System.Threading.Tasks.Task OnAfterRenderAsync(bool firstRender) { throw null; }
protected virtual void OnInitialized() { }
@ -134,7 +134,7 @@ namespace Microsoft.AspNetCore.Components
private readonly int _dummyPrimitive;
public static readonly Microsoft.AspNetCore.Components.EventCallback Empty;
public static readonly Microsoft.AspNetCore.Components.EventCallbackFactory Factory;
public EventCallback(Microsoft.AspNetCore.Components.IHandleEvent receiver, System.MulticastDelegate @delegate) { throw null; }
public EventCallback(Microsoft.AspNetCore.Components.IHandleEvent? receiver, System.MulticastDelegate? @delegate) { throw null; }
public bool HasDelegate { get { throw null; } }
public System.Threading.Tasks.Task InvokeAsync(object arg) { throw null; }
}
@ -162,30 +162,30 @@ namespace Microsoft.AspNetCore.Components
}
public static partial class EventCallbackFactoryBinderExtensions
{
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<bool> setter, bool existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTimeOffset> setter, System.DateTimeOffset existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTimeOffset> setter, System.DateTimeOffset existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTime> setter, System.DateTime existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTime> setter, System.DateTime existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<decimal> setter, decimal existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<double> setter, double existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<short> setter, short existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<int> setter, int existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<long> setter, long existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<bool?> setter, bool? existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTimeOffset?> setter, System.DateTimeOffset? existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTimeOffset?> setter, System.DateTimeOffset? existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTime?> setter, System.DateTime? existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTime?> setter, System.DateTime? existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<decimal?> setter, decimal? existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<double?> setter, double? existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<short?> setter, short? existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<int?> setter, int? existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<long?> setter, long? existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<float?> setter, float? existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<float> setter, float existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<string> setter, string existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder<T>(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<T> setter, T existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<bool> setter, bool existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTimeOffset> setter, System.DateTimeOffset existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTimeOffset> setter, System.DateTimeOffset existingValue, string format, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTime> setter, System.DateTime existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTime> setter, System.DateTime existingValue, string format, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<decimal> setter, decimal existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<double> setter, double existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<short> setter, short existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<int> setter, int existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<long> setter, long existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<bool?> setter, bool? existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTimeOffset?> setter, System.DateTimeOffset? existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTimeOffset?> setter, System.DateTimeOffset? existingValue, string format, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTime?> setter, System.DateTime? existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTime?> setter, System.DateTime? existingValue, string format, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<decimal?> setter, decimal? existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<double?> setter, double? existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<short?> setter, short? existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<int?> setter, int? existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<long?> setter, long? existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<float?> setter, float? existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<float> setter, float existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<string?> setter, string existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder<T>(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<T> setter, T existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
}
public static partial class EventCallbackFactoryEventArgsExtensions
{
@ -200,8 +200,8 @@ namespace Microsoft.AspNetCore.Components
private readonly object _dummy;
private readonly int _dummyPrimitive;
public static readonly Microsoft.AspNetCore.Components.EventCallbackWorkItem Empty;
public EventCallbackWorkItem(System.MulticastDelegate @delegate) { throw null; }
public System.Threading.Tasks.Task InvokeAsync(object arg) { throw null; }
public EventCallbackWorkItem(System.MulticastDelegate? @delegate) { throw null; }
public System.Threading.Tasks.Task InvokeAsync(object? arg) { throw null; }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct EventCallback<TValue>
@ -209,7 +209,7 @@ namespace Microsoft.AspNetCore.Components
private readonly object _dummy;
private readonly int _dummyPrimitive;
public static readonly Microsoft.AspNetCore.Components.EventCallback<TValue> Empty;
public EventCallback(Microsoft.AspNetCore.Components.IHandleEvent receiver, System.MulticastDelegate @delegate) { throw null; }
public EventCallback(Microsoft.AspNetCore.Components.IHandleEvent? receiver, System.MulticastDelegate? @delegate) { throw null; }
public bool HasDelegate { get { throw null; } }
public System.Threading.Tasks.Task InvokeAsync(TValue arg) { throw null; }
}
@ -234,7 +234,7 @@ namespace Microsoft.AspNetCore.Components
}
public partial interface IHandleEvent
{
System.Threading.Tasks.Task HandleEventAsync(Microsoft.AspNetCore.Components.EventCallbackWorkItem item, object arg);
System.Threading.Tasks.Task HandleEventAsync(Microsoft.AspNetCore.Components.EventCallbackWorkItem item, object? arg);
}
[System.AttributeUsageAttribute(System.AttributeTargets.Property, AllowMultiple=false, Inherited=true)]
public sealed partial class InjectAttribute : System.Attribute
@ -251,7 +251,7 @@ namespace Microsoft.AspNetCore.Components
{
protected LayoutComponentBase() { }
[Microsoft.AspNetCore.Components.ParameterAttribute]
public Microsoft.AspNetCore.Components.RenderFragment Body { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public Microsoft.AspNetCore.Components.RenderFragment? Body { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
}
public partial class LayoutView : Microsoft.AspNetCore.Components.IComponent
{
@ -304,7 +304,7 @@ namespace Microsoft.AspNetCore.Components
protected virtual void Dispose(bool disposing) { }
void System.IDisposable.Dispose() { }
}
public abstract partial class OwningComponentBase<TService> : Microsoft.AspNetCore.Components.OwningComponentBase, System.IDisposable
public abstract partial class OwningComponentBase<TService> : Microsoft.AspNetCore.Components.OwningComponentBase, System.IDisposable where TService : notnull
{
protected OwningComponentBase() { }
protected TService Service { get { throw null; } }
@ -332,11 +332,12 @@ namespace Microsoft.AspNetCore.Components
public static Microsoft.AspNetCore.Components.ParameterView Empty { get { throw null; } }
public static Microsoft.AspNetCore.Components.ParameterView FromDictionary(System.Collections.Generic.IDictionary<string, object> parameters) { throw null; }
public Microsoft.AspNetCore.Components.ParameterView.Enumerator GetEnumerator() { throw null; }
[return: System.Diagnostics.CodeAnalysis.MaybeNullAttribute]
public TValue GetValueOrDefault<TValue>(string parameterName) { throw null; }
public TValue GetValueOrDefault<TValue>(string parameterName, TValue defaultValue) { throw null; }
public void SetParameterProperties(object target) { }
public System.Collections.Generic.IReadOnlyDictionary<string, object> ToDictionary() { throw null; }
public bool TryGetValue<TValue>(string parameterName, out TValue result) { throw null; }
public bool TryGetValue<TValue>(string parameterName, [System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false)] out TValue result) { throw null; }
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public partial struct Enumerator
{

View File

@ -5,69 +5,69 @@ namespace Microsoft.AspNetCore.Components
{
public static partial class BindConverter
{
public static bool FormatValue(bool value, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(System.DateTime value, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(System.DateTime value, string format, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(System.DateTimeOffset value, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(System.DateTimeOffset value, string format, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(decimal value, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(double value, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(short value, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(int value, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(long value, System.Globalization.CultureInfo culture = null) { throw null; }
public static bool? FormatValue(bool? value, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(System.DateTimeOffset? value, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(System.DateTimeOffset? value, string format, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(System.DateTime? value, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(System.DateTime? value, string format, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(decimal? value, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(double? value, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(short? value, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(int? value, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(long? value, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(float? value, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(float value, System.Globalization.CultureInfo culture = null) { throw null; }
public static string FormatValue(string value, System.Globalization.CultureInfo culture = null) { throw null; }
public static object FormatValue<T>(T value, System.Globalization.CultureInfo culture = null) { throw null; }
public static bool TryConvertToBool(object obj, System.Globalization.CultureInfo culture, out bool value) { throw null; }
public static bool TryConvertToDateTime(object obj, System.Globalization.CultureInfo culture, out System.DateTime value) { throw null; }
public static bool TryConvertToDateTime(object obj, System.Globalization.CultureInfo culture, string format, out System.DateTime value) { throw null; }
public static bool TryConvertToDateTimeOffset(object obj, System.Globalization.CultureInfo culture, out System.DateTimeOffset value) { throw null; }
public static bool TryConvertToDateTimeOffset(object obj, System.Globalization.CultureInfo culture, string format, out System.DateTimeOffset value) { throw null; }
public static bool TryConvertToDecimal(object obj, System.Globalization.CultureInfo culture, out decimal value) { throw null; }
public static bool TryConvertToDouble(object obj, System.Globalization.CultureInfo culture, out double value) { throw null; }
public static bool TryConvertToFloat(object obj, System.Globalization.CultureInfo culture, out float value) { throw null; }
public static bool TryConvertToInt(object obj, System.Globalization.CultureInfo culture, out int value) { throw null; }
public static bool TryConvertToLong(object obj, System.Globalization.CultureInfo culture, out long value) { throw null; }
public static bool TryConvertToNullableBool(object obj, System.Globalization.CultureInfo culture, out bool? value) { throw null; }
public static bool TryConvertToNullableDateTime(object obj, System.Globalization.CultureInfo culture, out System.DateTime? value) { throw null; }
public static bool TryConvertToNullableDateTime(object obj, System.Globalization.CultureInfo culture, string format, out System.DateTime? value) { throw null; }
public static bool TryConvertToNullableDateTimeOffset(object obj, System.Globalization.CultureInfo culture, out System.DateTimeOffset? value) { throw null; }
public static bool TryConvertToNullableDateTimeOffset(object obj, System.Globalization.CultureInfo culture, string format, out System.DateTimeOffset? value) { throw null; }
public static bool TryConvertToNullableDecimal(object obj, System.Globalization.CultureInfo culture, out decimal? value) { throw null; }
public static bool TryConvertToNullableDouble(object obj, System.Globalization.CultureInfo culture, out double? value) { throw null; }
public static bool TryConvertToNullableFloat(object obj, System.Globalization.CultureInfo culture, out float? value) { throw null; }
public static bool TryConvertToNullableInt(object obj, System.Globalization.CultureInfo culture, out int? value) { throw null; }
public static bool TryConvertToNullableLong(object obj, System.Globalization.CultureInfo culture, out long? value) { throw null; }
public static bool TryConvertToNullableShort(object obj, System.Globalization.CultureInfo culture, out short? value) { throw null; }
public static bool TryConvertToShort(object obj, System.Globalization.CultureInfo culture, out short value) { throw null; }
public static bool TryConvertToString(object obj, System.Globalization.CultureInfo culture, out string value) { throw null; }
public static bool TryConvertTo<T>(object obj, System.Globalization.CultureInfo culture, out T value) { throw null; }
public static bool FormatValue(bool value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string FormatValue(System.DateTime value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string FormatValue(System.DateTime value, string format, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string FormatValue(System.DateTimeOffset value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string FormatValue(System.DateTimeOffset value, string format, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string FormatValue(decimal value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string? FormatValue(double value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string FormatValue(short value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string? FormatValue(int value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string FormatValue(long value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static bool? FormatValue(bool? value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string? FormatValue(System.DateTimeOffset? value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string? FormatValue(System.DateTimeOffset? value, string format, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string? FormatValue(System.DateTime? value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string? FormatValue(System.DateTime? value, string? format, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string? FormatValue(decimal? value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string? FormatValue(double? value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string? FormatValue(short? value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string? FormatValue(int? value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string? FormatValue(long? value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string? FormatValue(float? value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string FormatValue(float value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static string FormatValue(string value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static object? FormatValue<T>(T value, System.Globalization.CultureInfo? culture = null) { throw null; }
public static bool TryConvertToBool(object? obj, System.Globalization.CultureInfo? culture, out bool value) { throw null; }
public static bool TryConvertToDateTime(object? obj, System.Globalization.CultureInfo? culture, out System.DateTime value) { throw null; }
public static bool TryConvertToDateTime(object? obj, System.Globalization.CultureInfo? culture, string format, out System.DateTime value) { throw null; }
public static bool TryConvertToDateTimeOffset(object? obj, System.Globalization.CultureInfo? culture, out System.DateTimeOffset value) { throw null; }
public static bool TryConvertToDateTimeOffset(object? obj, System.Globalization.CultureInfo? culture, string format, out System.DateTimeOffset value) { throw null; }
public static bool TryConvertToDecimal(object? obj, System.Globalization.CultureInfo? culture, out decimal value) { throw null; }
public static bool TryConvertToDouble(object? obj, System.Globalization.CultureInfo? culture, out double value) { throw null; }
public static bool TryConvertToFloat(object? obj, System.Globalization.CultureInfo? culture, out float value) { throw null; }
public static bool TryConvertToInt(object? obj, System.Globalization.CultureInfo? culture, out int value) { throw null; }
public static bool TryConvertToLong(object? obj, System.Globalization.CultureInfo? culture, out long value) { throw null; }
public static bool TryConvertToNullableBool(object? obj, System.Globalization.CultureInfo? culture, out bool? value) { throw null; }
public static bool TryConvertToNullableDateTime(object? obj, System.Globalization.CultureInfo? culture, out System.DateTime? value) { throw null; }
public static bool TryConvertToNullableDateTime(object? obj, System.Globalization.CultureInfo? culture, string format, out System.DateTime? value) { throw null; }
public static bool TryConvertToNullableDateTimeOffset(object? obj, System.Globalization.CultureInfo? culture, out System.DateTimeOffset? value) { throw null; }
public static bool TryConvertToNullableDateTimeOffset(object? obj, System.Globalization.CultureInfo? culture, string format, out System.DateTimeOffset? value) { throw null; }
public static bool TryConvertToNullableDecimal(object? obj, System.Globalization.CultureInfo? culture, out decimal? value) { throw null; }
public static bool TryConvertToNullableDouble(object? obj, System.Globalization.CultureInfo? culture, out double? value) { throw null; }
public static bool TryConvertToNullableFloat(object? obj, System.Globalization.CultureInfo? culture, out float? value) { throw null; }
public static bool TryConvertToNullableInt(object? obj, System.Globalization.CultureInfo? culture, out int? value) { throw null; }
public static bool TryConvertToNullableLong(object? obj, System.Globalization.CultureInfo? culture, out long? value) { throw null; }
public static bool TryConvertToNullableShort(object? obj, System.Globalization.CultureInfo? culture, out short? value) { throw null; }
public static bool TryConvertToShort(object? obj, System.Globalization.CultureInfo? culture, out short value) { throw null; }
public static bool TryConvertToString(object? obj, System.Globalization.CultureInfo? culture, out string? value) { throw null; }
public static bool TryConvertTo<T>(object? obj, System.Globalization.CultureInfo? culture, out T value) { throw null; }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class, AllowMultiple=true, Inherited=true)]
public sealed partial class BindElementAttribute : System.Attribute
{
public BindElementAttribute(string element, string suffix, string valueAttribute, string changeAttribute) { }
public BindElementAttribute(string element, string? suffix, string valueAttribute, string changeAttribute) { }
public string ChangeAttribute { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public string Element { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public string Suffix { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public string? Suffix { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public string ValueAttribute { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Property, AllowMultiple=false, Inherited=true)]
public sealed partial class CascadingParameterAttribute : System.Attribute
{
public CascadingParameterAttribute() { }
public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public string? Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
}
public partial class CascadingValue<TValue> : Microsoft.AspNetCore.Components.IComponent
{
@ -77,7 +77,7 @@ namespace Microsoft.AspNetCore.Components
[Microsoft.AspNetCore.Components.ParameterAttribute]
public bool IsFixed { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
[Microsoft.AspNetCore.Components.ParameterAttribute]
public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public string? Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
[Microsoft.AspNetCore.Components.ParameterAttribute]
public TValue Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public void Attach(Microsoft.AspNetCore.Components.RenderHandle renderHandle) { }
@ -86,7 +86,7 @@ namespace Microsoft.AspNetCore.Components
public partial class ChangeEventArgs : System.EventArgs
{
public ChangeEventArgs() { }
public object Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public object? Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
}
public abstract partial class ComponentBase : Microsoft.AspNetCore.Components.IComponent, Microsoft.AspNetCore.Components.IHandleAfterRender, Microsoft.AspNetCore.Components.IHandleEvent
{
@ -96,7 +96,7 @@ namespace Microsoft.AspNetCore.Components
protected System.Threading.Tasks.Task InvokeAsync(System.Func<System.Threading.Tasks.Task> workItem) { throw null; }
void Microsoft.AspNetCore.Components.IComponent.Attach(Microsoft.AspNetCore.Components.RenderHandle renderHandle) { }
System.Threading.Tasks.Task Microsoft.AspNetCore.Components.IHandleAfterRender.OnAfterRenderAsync() { throw null; }
System.Threading.Tasks.Task Microsoft.AspNetCore.Components.IHandleEvent.HandleEventAsync(Microsoft.AspNetCore.Components.EventCallbackWorkItem callback, object arg) { throw null; }
System.Threading.Tasks.Task Microsoft.AspNetCore.Components.IHandleEvent.HandleEventAsync(Microsoft.AspNetCore.Components.EventCallbackWorkItem callback, object? arg) { throw null; }
protected virtual void OnAfterRender(bool firstRender) { }
protected virtual System.Threading.Tasks.Task OnAfterRenderAsync(bool firstRender) { throw null; }
protected virtual void OnInitialized() { }
@ -134,7 +134,7 @@ namespace Microsoft.AspNetCore.Components
private readonly int _dummyPrimitive;
public static readonly Microsoft.AspNetCore.Components.EventCallback Empty;
public static readonly Microsoft.AspNetCore.Components.EventCallbackFactory Factory;
public EventCallback(Microsoft.AspNetCore.Components.IHandleEvent receiver, System.MulticastDelegate @delegate) { throw null; }
public EventCallback(Microsoft.AspNetCore.Components.IHandleEvent? receiver, System.MulticastDelegate? @delegate) { throw null; }
public bool HasDelegate { get { throw null; } }
public System.Threading.Tasks.Task InvokeAsync(object arg) { throw null; }
}
@ -162,30 +162,30 @@ namespace Microsoft.AspNetCore.Components
}
public static partial class EventCallbackFactoryBinderExtensions
{
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<bool> setter, bool existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTimeOffset> setter, System.DateTimeOffset existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTimeOffset> setter, System.DateTimeOffset existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTime> setter, System.DateTime existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTime> setter, System.DateTime existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<decimal> setter, decimal existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<double> setter, double existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<short> setter, short existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<int> setter, int existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<long> setter, long existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<bool?> setter, bool? existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTimeOffset?> setter, System.DateTimeOffset? existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTimeOffset?> setter, System.DateTimeOffset? existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTime?> setter, System.DateTime? existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTime?> setter, System.DateTime? existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<decimal?> setter, decimal? existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<double?> setter, double? existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<short?> setter, short? existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<int?> setter, int? existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<long?> setter, long? existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<float?> setter, float? existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<float> setter, float existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<string> setter, string existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder<T>(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<T> setter, T existingValue, System.Globalization.CultureInfo culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<bool> setter, bool existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTimeOffset> setter, System.DateTimeOffset existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTimeOffset> setter, System.DateTimeOffset existingValue, string format, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTime> setter, System.DateTime existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTime> setter, System.DateTime existingValue, string format, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<decimal> setter, decimal existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<double> setter, double existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<short> setter, short existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<int> setter, int existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<long> setter, long existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<bool?> setter, bool? existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTimeOffset?> setter, System.DateTimeOffset? existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTimeOffset?> setter, System.DateTimeOffset? existingValue, string format, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTime?> setter, System.DateTime? existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<System.DateTime?> setter, System.DateTime? existingValue, string format, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<decimal?> setter, decimal? existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<double?> setter, double? existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<short?> setter, short? existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<int?> setter, int? existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<long?> setter, long? existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<float?> setter, float? existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<float> setter, float existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<string?> setter, string existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
public static Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.ChangeEventArgs> CreateBinder<T>(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action<T> setter, T existingValue, System.Globalization.CultureInfo? culture = null) { throw null; }
}
public static partial class EventCallbackFactoryEventArgsExtensions
{
@ -200,8 +200,8 @@ namespace Microsoft.AspNetCore.Components
private readonly object _dummy;
private readonly int _dummyPrimitive;
public static readonly Microsoft.AspNetCore.Components.EventCallbackWorkItem Empty;
public EventCallbackWorkItem(System.MulticastDelegate @delegate) { throw null; }
public System.Threading.Tasks.Task InvokeAsync(object arg) { throw null; }
public EventCallbackWorkItem(System.MulticastDelegate? @delegate) { throw null; }
public System.Threading.Tasks.Task InvokeAsync(object? arg) { throw null; }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct EventCallback<TValue>
@ -209,7 +209,7 @@ namespace Microsoft.AspNetCore.Components
private readonly object _dummy;
private readonly int _dummyPrimitive;
public static readonly Microsoft.AspNetCore.Components.EventCallback<TValue> Empty;
public EventCallback(Microsoft.AspNetCore.Components.IHandleEvent receiver, System.MulticastDelegate @delegate) { throw null; }
public EventCallback(Microsoft.AspNetCore.Components.IHandleEvent? receiver, System.MulticastDelegate? @delegate) { throw null; }
public bool HasDelegate { get { throw null; } }
public System.Threading.Tasks.Task InvokeAsync(TValue arg) { throw null; }
}
@ -234,7 +234,7 @@ namespace Microsoft.AspNetCore.Components
}
public partial interface IHandleEvent
{
System.Threading.Tasks.Task HandleEventAsync(Microsoft.AspNetCore.Components.EventCallbackWorkItem item, object arg);
System.Threading.Tasks.Task HandleEventAsync(Microsoft.AspNetCore.Components.EventCallbackWorkItem item, object? arg);
}
[System.AttributeUsageAttribute(System.AttributeTargets.Property, AllowMultiple=false, Inherited=true)]
public sealed partial class InjectAttribute : System.Attribute
@ -251,7 +251,7 @@ namespace Microsoft.AspNetCore.Components
{
protected LayoutComponentBase() { }
[Microsoft.AspNetCore.Components.ParameterAttribute]
public Microsoft.AspNetCore.Components.RenderFragment Body { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public Microsoft.AspNetCore.Components.RenderFragment? Body { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
}
public partial class LayoutView : Microsoft.AspNetCore.Components.IComponent
{
@ -304,7 +304,7 @@ namespace Microsoft.AspNetCore.Components
protected virtual void Dispose(bool disposing) { }
void System.IDisposable.Dispose() { }
}
public abstract partial class OwningComponentBase<TService> : Microsoft.AspNetCore.Components.OwningComponentBase, System.IDisposable
public abstract partial class OwningComponentBase<TService> : Microsoft.AspNetCore.Components.OwningComponentBase, System.IDisposable where TService : notnull
{
protected OwningComponentBase() { }
protected TService Service { get { throw null; } }

View File

@ -4,6 +4,7 @@
using System;
using System.Collections.Concurrent;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Reflection;
@ -18,14 +19,14 @@ namespace Microsoft.AspNetCore.Components
// to allocate.
public static class BindConverter
{
private static object BoxedTrue = true;
private static object BoxedFalse = false;
private static readonly object BoxedTrue = true;
private static readonly object BoxedFalse = false;
private delegate object BindFormatter<T>(T value, CultureInfo culture);
private delegate object BindFormatterWithFormat<T>(T value, CultureInfo culture, string format);
private delegate object? BindFormatter<T>(T value, CultureInfo? culture);
private delegate object BindFormatterWithFormat<T>(T value, CultureInfo? culture, string format);
internal delegate bool BindParser<T>(object obj, CultureInfo culture, out T value);
internal delegate bool BindParserWithFormat<T>(object obj, CultureInfo culture, string format, out T value);
internal delegate bool BindParser<T>(object? obj, CultureInfo? culture, out T value);
internal delegate bool BindParserWithFormat<T>(object? obj, CultureInfo? culture, string? format, out T value);
/// <summary>
/// Formats the provided <paramref name="value"/> as a <see cref="System.String"/>.
@ -35,9 +36,9 @@ namespace Microsoft.AspNetCore.Components
/// The <see cref="CultureInfo"/> to use while formatting. Defaults to <see cref="CultureInfo.CurrentCulture"/>.
/// </param>
/// <returns>The formatted value.</returns>
public static string FormatValue(string value, CultureInfo culture = null) => FormatStringValueCore(value, culture);
public static string FormatValue(string value, CultureInfo? culture = null) => FormatStringValueCore(value, culture);
private static string FormatStringValueCore(string value, CultureInfo culture)
private static string FormatStringValueCore(string value, CultureInfo? culture)
{
return value;
}
@ -50,7 +51,7 @@ namespace Microsoft.AspNetCore.Components
/// The <see cref="CultureInfo"/> to use while formatting. Defaults to <see cref="CultureInfo.CurrentCulture"/>.
/// </param>
/// <returns>The formatted value.</returns>
public static bool FormatValue(bool value, CultureInfo culture = null)
public static bool FormatValue(bool value, CultureInfo? culture = null)
{
// Formatting for bool is special-cased. We need to produce a boolean value for conditional attributes
// to work.
@ -58,7 +59,7 @@ namespace Microsoft.AspNetCore.Components
}
// Used with generics
private static object FormatBoolValueCore(bool value, CultureInfo culture)
private static object FormatBoolValueCore(bool value, CultureInfo? culture)
{
// Formatting for bool is special-cased. We need to produce a boolean value for conditional attributes
// to work.
@ -73,7 +74,7 @@ namespace Microsoft.AspNetCore.Components
/// The <see cref="CultureInfo"/> to use while formatting. Defaults to <see cref="CultureInfo.CurrentCulture"/>.
/// </param>
/// <returns>The formatted value.</returns>
public static bool? FormatValue(bool? value, CultureInfo culture = null)
public static bool? FormatValue(bool? value, CultureInfo? culture = null)
{
// Formatting for bool is special-cased. We need to produce a boolean value for conditional attributes
// to work.
@ -81,7 +82,7 @@ namespace Microsoft.AspNetCore.Components
}
// Used with generics
private static object FormatNullableBoolValueCore(bool? value, CultureInfo culture)
private static object? FormatNullableBoolValueCore(bool? value, CultureInfo? culture)
{
// Formatting for bool is special-cased. We need to produce a boolean value for conditional attributes
// to work.
@ -96,9 +97,9 @@ namespace Microsoft.AspNetCore.Components
/// The <see cref="CultureInfo"/> to use while formatting. Defaults to <see cref="CultureInfo.CurrentCulture"/>.
/// </param>
/// <returns>The formatted value.</returns>
public static string FormatValue(int value, CultureInfo culture = null) => FormatIntValueCore(value, culture);
public static string? FormatValue(int value, CultureInfo? culture = null) => FormatIntValueCore(value, culture);
private static string FormatIntValueCore(int value, CultureInfo culture)
private static string? FormatIntValueCore(int value, CultureInfo? culture)
{
return value.ToString(culture ?? CultureInfo.CurrentCulture);
}
@ -111,9 +112,9 @@ namespace Microsoft.AspNetCore.Components
/// The <see cref="CultureInfo"/> to use while formatting. Defaults to <see cref="CultureInfo.CurrentCulture"/>.
/// </param>
/// <returns>The formatted value.</returns>
public static string FormatValue(int? value, CultureInfo culture = null) => FormatNullableIntValueCore(value, culture);
public static string? FormatValue(int? value, CultureInfo? culture = null) => FormatNullableIntValueCore(value, culture);
private static string FormatNullableIntValueCore(int? value, CultureInfo culture)
private static string? FormatNullableIntValueCore(int? value, CultureInfo? culture)
{
if (value == null)
{
@ -131,9 +132,9 @@ namespace Microsoft.AspNetCore.Components
/// The <see cref="CultureInfo"/> to use while formatting. Defaults to <see cref="CultureInfo.CurrentCulture"/>.
/// </param>
/// <returns>The formatted value.</returns>
public static string FormatValue(long value, CultureInfo culture = null) => FormatLongValueCore(value, culture);
public static string FormatValue(long value, CultureInfo? culture = null) => FormatLongValueCore(value, culture);
private static string FormatLongValueCore(long value, CultureInfo culture)
private static string FormatLongValueCore(long value, CultureInfo? culture)
{
return value.ToString(culture ?? CultureInfo.CurrentCulture);
}
@ -146,9 +147,9 @@ namespace Microsoft.AspNetCore.Components
/// The <see cref="CultureInfo"/> to use while formatting. Defaults to <see cref="CultureInfo.CurrentCulture"/>.
/// </param>
/// <returns>The formatted value.</returns>
public static string FormatValue(long? value, CultureInfo culture = null) => FormatNullableLongValueCore(value, culture);
public static string? FormatValue(long? value, CultureInfo? culture = null) => FormatNullableLongValueCore(value, culture);
private static string FormatNullableLongValueCore(long? value, CultureInfo culture)
private static string? FormatNullableLongValueCore(long? value, CultureInfo? culture)
{
if (value == null)
{
@ -166,9 +167,9 @@ namespace Microsoft.AspNetCore.Components
/// The <see cref="CultureInfo"/> to use while formatting. Defaults to <see cref="CultureInfo.CurrentCulture"/>.
/// </param>
/// <returns>The formatted value.</returns>
public static string FormatValue(short value, CultureInfo culture = null) => FormatShortValueCore(value, culture);
public static string FormatValue(short value, CultureInfo? culture = null) => FormatShortValueCore(value, culture);
private static string FormatShortValueCore(short value, CultureInfo culture)
private static string FormatShortValueCore(short value, CultureInfo? culture)
{
return value.ToString(culture ?? CultureInfo.CurrentCulture);
}
@ -181,9 +182,9 @@ namespace Microsoft.AspNetCore.Components
/// The <see cref="CultureInfo"/> to use while formatting. Defaults to <see cref="CultureInfo.CurrentCulture"/>.
/// </param>
/// <returns>The formatted value.</returns>
public static string FormatValue(short? value, CultureInfo culture = null) => FormatNullableShortValueCore(value, culture);
public static string? FormatValue(short? value, CultureInfo? culture = null) => FormatNullableShortValueCore(value, culture);
private static string FormatNullableShortValueCore(short? value, CultureInfo culture)
private static string? FormatNullableShortValueCore(short? value, CultureInfo? culture)
{
if (value == null)
{
@ -201,9 +202,9 @@ namespace Microsoft.AspNetCore.Components
/// The <see cref="CultureInfo"/> to use while formatting. Defaults to <see cref="CultureInfo.CurrentCulture"/>.
/// </param>
/// <returns>The formatted value.</returns>
public static string FormatValue(float value, CultureInfo culture = null) => FormatFloatValueCore(value, culture);
public static string FormatValue(float value, CultureInfo? culture = null) => FormatFloatValueCore(value, culture);
private static string FormatFloatValueCore(float value, CultureInfo culture)
private static string FormatFloatValueCore(float value, CultureInfo? culture)
{
return value.ToString(culture ?? CultureInfo.CurrentCulture);
}
@ -216,9 +217,9 @@ namespace Microsoft.AspNetCore.Components
/// The <see cref="CultureInfo"/> to use while formatting. Defaults to <see cref="CultureInfo.CurrentCulture"/>.
/// </param>
/// <returns>The formatted value.</returns>
public static string FormatValue(float? value, CultureInfo culture = null) => FormatNullableFloatValueCore(value, culture);
public static string? FormatValue(float? value, CultureInfo? culture = null) => FormatNullableFloatValueCore(value, culture);
private static string FormatNullableFloatValueCore(float? value, CultureInfo culture)
private static string? FormatNullableFloatValueCore(float? value, CultureInfo? culture)
{
if (value == null)
{
@ -236,9 +237,9 @@ namespace Microsoft.AspNetCore.Components
/// The <see cref="CultureInfo"/> to use while formatting. Defaults to <see cref="CultureInfo.CurrentCulture"/>.
/// </param>
/// <returns>The formatted value.</returns>
public static string FormatValue(double value, CultureInfo culture = null) => FormatDoubleValueCore(value, culture);
public static string? FormatValue(double value, CultureInfo? culture = null) => FormatDoubleValueCore(value, culture);
private static string FormatDoubleValueCore(double value, CultureInfo culture)
private static string FormatDoubleValueCore(double value, CultureInfo? culture)
{
return value.ToString(culture ?? CultureInfo.CurrentCulture);
}
@ -251,9 +252,9 @@ namespace Microsoft.AspNetCore.Components
/// The <see cref="CultureInfo"/> to use while formatting. Defaults to <see cref="CultureInfo.CurrentCulture"/>.
/// </param>
/// <returns>The formatted value.</returns>
public static string FormatValue(double? value, CultureInfo culture = null) => FormatNullableDoubleValueCore(value, culture);
public static string? FormatValue(double? value, CultureInfo? culture = null) => FormatNullableDoubleValueCore(value, culture);
private static string FormatNullableDoubleValueCore(double? value, CultureInfo culture)
private static string? FormatNullableDoubleValueCore(double? value, CultureInfo? culture)
{
if (value == null)
{
@ -271,9 +272,9 @@ namespace Microsoft.AspNetCore.Components
/// The <see cref="CultureInfo"/> to use while formatting. Defaults to <see cref="CultureInfo.CurrentCulture"/>.
/// </param>
/// <returns>The formatted value.</returns>
public static string FormatValue(decimal value, CultureInfo culture = null) => FormatDecimalValueCore(value, culture);
public static string FormatValue(decimal value, CultureInfo? culture = null) => FormatDecimalValueCore(value, culture);
private static string FormatDecimalValueCore(decimal value, CultureInfo culture)
private static string FormatDecimalValueCore(decimal value, CultureInfo? culture)
{
return value.ToString(culture ?? CultureInfo.CurrentCulture);
}
@ -286,9 +287,9 @@ namespace Microsoft.AspNetCore.Components
/// The <see cref="CultureInfo"/> to use while formatting. Defaults to <see cref="CultureInfo.CurrentCulture"/>.
/// </param>
/// <returns>The formatted value.</returns>
public static string FormatValue(decimal? value, CultureInfo culture = null) => FormatNullableDecimalValueCore(value, culture);
public static string? FormatValue(decimal? value, CultureInfo? culture = null) => FormatNullableDecimalValueCore(value, culture);
private static string FormatNullableDecimalValueCore(decimal? value, CultureInfo culture)
private static string? FormatNullableDecimalValueCore(decimal? value, CultureInfo? culture)
{
if (value == null)
{
@ -306,7 +307,7 @@ namespace Microsoft.AspNetCore.Components
/// The <see cref="CultureInfo"/> to use while formatting. Defaults to <see cref="CultureInfo.CurrentCulture"/>.
/// </param>
/// <returns>The formatted value.</returns>
public static string FormatValue(DateTime value, CultureInfo culture = null) => FormatDateTimeValueCore(value, format: null, culture);
public static string FormatValue(DateTime value, CultureInfo? culture = null) => FormatDateTimeValueCore(value, format: null, culture);
/// <summary>
/// Formats the provided <paramref name="value"/> as a <see cref="System.String"/>.
@ -317,9 +318,9 @@ namespace Microsoft.AspNetCore.Components
/// The <see cref="CultureInfo"/> to use while formatting. Defaults to <see cref="CultureInfo.CurrentCulture"/>.
/// </param>
/// <returns>The formatted value.</returns>
public static string FormatValue(DateTime value, string format, CultureInfo culture = null) => FormatDateTimeValueCore(value, format, culture);
public static string FormatValue(DateTime value, string format, CultureInfo? culture = null) => FormatDateTimeValueCore(value, format, culture);
private static string FormatDateTimeValueCore(DateTime value, string format, CultureInfo culture)
private static string FormatDateTimeValueCore(DateTime value, string? format, CultureInfo? culture)
{
if (format != null)
{
@ -329,7 +330,7 @@ namespace Microsoft.AspNetCore.Components
return value.ToString(culture ?? CultureInfo.CurrentCulture);
}
private static string FormatDateTimeValueCore(DateTime value, CultureInfo culture)
private static string FormatDateTimeValueCore(DateTime value, CultureInfo? culture)
{
return value.ToString(culture ?? CultureInfo.CurrentCulture);
}
@ -342,7 +343,7 @@ namespace Microsoft.AspNetCore.Components
/// The <see cref="CultureInfo"/> to use while formatting. Defaults to <see cref="CultureInfo.CurrentCulture"/>.
/// </param>
/// <returns>The formatted value.</returns>
public static string FormatValue(DateTime? value, CultureInfo culture = null) => FormatNullableDateTimeValueCore(value, format: null, culture);
public static string? FormatValue(DateTime? value, CultureInfo? culture = null) => FormatNullableDateTimeValueCore(value, format: null, culture);
/// <summary>
/// Formats the provided <paramref name="value"/> as a <see cref="System.String"/>.
@ -353,9 +354,9 @@ namespace Microsoft.AspNetCore.Components
/// The <see cref="CultureInfo"/> to use while formatting. Defaults to <see cref="CultureInfo.CurrentCulture"/>.
/// </param>
/// <returns>The formatted value.</returns>
public static string FormatValue(DateTime? value, string format, CultureInfo culture = null) => FormatNullableDateTimeValueCore(value, format, culture);
public static string? FormatValue(DateTime? value, string? format, CultureInfo? culture = null) => FormatNullableDateTimeValueCore(value, format, culture);
private static string FormatNullableDateTimeValueCore(DateTime? value, string format, CultureInfo culture)
private static string? FormatNullableDateTimeValueCore(DateTime? value, string? format, CultureInfo? culture)
{
if (value == null)
{
@ -370,7 +371,7 @@ namespace Microsoft.AspNetCore.Components
return value.Value.ToString(culture ?? CultureInfo.CurrentCulture);
}
private static string FormatNullableDateTimeValueCore(DateTime? value, CultureInfo culture)
private static string? FormatNullableDateTimeValueCore(DateTime? value, CultureInfo? culture)
{
if (value == null)
{
@ -388,7 +389,7 @@ namespace Microsoft.AspNetCore.Components
/// The <see cref="CultureInfo"/> to use while formatting. Defaults to <see cref="CultureInfo.CurrentCulture"/>.
/// </param>
/// <returns>The formatted value.</returns>
public static string FormatValue(DateTimeOffset value, CultureInfo culture = null) => FormatDateTimeOffsetValueCore(value, format: null, culture);
public static string FormatValue(DateTimeOffset value, CultureInfo? culture = null) => FormatDateTimeOffsetValueCore(value, format: null, culture);
/// <summary>
@ -400,9 +401,9 @@ namespace Microsoft.AspNetCore.Components
/// The <see cref="CultureInfo"/> to use while formatting. Defaults to <see cref="CultureInfo.CurrentCulture"/>.
/// </param>
/// <returns>The formatted value.</returns>
public static string FormatValue(DateTimeOffset value, string format, CultureInfo culture = null) => FormatDateTimeOffsetValueCore(value, format, culture);
public static string FormatValue(DateTimeOffset value, string format, CultureInfo? culture = null) => FormatDateTimeOffsetValueCore(value, format, culture);
private static string FormatDateTimeOffsetValueCore(DateTimeOffset value, string format, CultureInfo culture)
private static string FormatDateTimeOffsetValueCore(DateTimeOffset value, string? format, CultureInfo? culture)
{
if (format != null)
{
@ -412,7 +413,7 @@ namespace Microsoft.AspNetCore.Components
return value.ToString(culture ?? CultureInfo.CurrentCulture);
}
private static string FormatDateTimeOffsetValueCore(DateTimeOffset value, CultureInfo culture)
private static string FormatDateTimeOffsetValueCore(DateTimeOffset value, CultureInfo? culture)
{
return value.ToString(culture ?? CultureInfo.CurrentCulture);
}
@ -425,7 +426,7 @@ namespace Microsoft.AspNetCore.Components
/// The <see cref="CultureInfo"/> to use while formatting. Defaults to <see cref="CultureInfo.CurrentCulture"/>.
/// </param>
/// <returns>The formatted value.</returns>
public static string FormatValue(DateTimeOffset? value, CultureInfo culture = null) => FormatNullableDateTimeOffsetValueCore(value, format: null, culture);
public static string? FormatValue(DateTimeOffset? value, CultureInfo? culture = null) => FormatNullableDateTimeOffsetValueCore(value, format: null, culture);
/// <summary>
/// Formats the provided <paramref name="value"/> as a <see cref="System.String"/>.
@ -436,9 +437,9 @@ namespace Microsoft.AspNetCore.Components
/// The <see cref="CultureInfo"/> to use while formatting. Defaults to <see cref="CultureInfo.CurrentCulture"/>.
/// </param>
/// <returns>The formatted value.</returns>
public static string FormatValue(DateTimeOffset? value, string format, CultureInfo culture = null) => FormatNullableDateTimeOffsetValueCore(value, format, culture);
public static string? FormatValue(DateTimeOffset? value, string format, CultureInfo? culture = null) => FormatNullableDateTimeOffsetValueCore(value, format, culture);
private static string FormatNullableDateTimeOffsetValueCore(DateTimeOffset? value, string format, CultureInfo culture)
private static string? FormatNullableDateTimeOffsetValueCore(DateTimeOffset? value, string? format, CultureInfo? culture)
{
if (value == null)
{
@ -453,7 +454,7 @@ namespace Microsoft.AspNetCore.Components
return value.Value.ToString(culture ?? CultureInfo.CurrentCulture);
}
private static string FormatNullableDateTimeOffsetValueCore(DateTimeOffset? value, CultureInfo culture)
private static string? FormatNullableDateTimeOffsetValueCore(DateTimeOffset? value, CultureInfo? culture)
{
if (value == null)
{
@ -463,12 +464,12 @@ namespace Microsoft.AspNetCore.Components
return value.Value.ToString(culture ?? CultureInfo.CurrentCulture);
}
private static string FormatEnumValueCore<T>(T value, CultureInfo culture) where T : struct, Enum
private static string FormatEnumValueCore<T>(T value, CultureInfo? culture) where T : struct, Enum
{
return value.ToString(); // The overload that accepts a culture is [Obsolete]
}
private static string FormatNullableEnumValueCore<T>(T? value, CultureInfo culture) where T : struct, Enum
private static string? FormatNullableEnumValueCore<T>(T? value, CultureInfo? culture) where T : struct, Enum
{
if (value == null)
{
@ -486,7 +487,7 @@ namespace Microsoft.AspNetCore.Components
/// The <see cref="CultureInfo"/> to use while formatting. Defaults to <see cref="CultureInfo.CurrentCulture"/>.
/// </param>
/// <returns>The formatted value.</returns>
public static object FormatValue<T>(T value, CultureInfo culture = null)
public static object? FormatValue<T>(T value, CultureInfo? culture = null)
{
var formatter = FormatterDelegateCache.Get<T>();
return formatter(value, culture);
@ -499,17 +500,17 @@ namespace Microsoft.AspNetCore.Components
/// <param name="culture">The <see cref="CultureInfo"/> to use for conversion.</param>
/// <param name="value">The converted value.</param>
/// <returns><c>true</c> if conversion is successful, otherwise <c>false</c>.</returns>
public static bool TryConvertToString(object obj, CultureInfo culture, out string value)
public static bool TryConvertToString(object? obj, CultureInfo? culture, out string? value)
{
return ConvertToStringCore(obj, culture, out value);
}
internal readonly static BindParser<string> ConvertToString = ConvertToStringCore;
internal readonly static BindParser<string?> ConvertToString = ConvertToStringCore;
private static bool ConvertToStringCore(object obj, CultureInfo culture, out string value)
private static bool ConvertToStringCore(object? obj, CultureInfo? culture, out string? value)
{
// We expect the input to already be a string.
value = (string)obj;
value = (string?)obj;
return true;
}
@ -520,7 +521,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="culture">The <see cref="CultureInfo"/> to use for conversion.</param>
/// <param name="value">The converted value.</param>
/// <returns><c>true</c> if conversion is successful, otherwise <c>false</c>.</returns>
public static bool TryConvertToBool(object obj, CultureInfo culture, out bool value)
public static bool TryConvertToBool(object? obj, CultureInfo? culture, out bool value)
{
return ConvertToBoolCore(obj, culture, out value);
}
@ -532,7 +533,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="culture">The <see cref="CultureInfo"/> to use for conversion.</param>
/// <param name="value">The converted value.</param>
/// <returns><c>true</c> if conversion is successful, otherwise <c>false</c>.</returns>
public static bool TryConvertToNullableBool(object obj, CultureInfo culture, out bool? value)
public static bool TryConvertToNullableBool(object? obj, CultureInfo? culture, out bool? value)
{
return ConvertToNullableBoolCore(obj, culture, out value);
}
@ -540,14 +541,14 @@ namespace Microsoft.AspNetCore.Components
internal readonly static BindParser<bool> ConvertToBool = ConvertToBoolCore;
internal readonly static BindParser<bool?> ConvertToNullableBool = ConvertToNullableBoolCore;
private static bool ConvertToBoolCore(object obj, CultureInfo culture, out bool value)
private static bool ConvertToBoolCore(object? obj, CultureInfo? culture, out bool value)
{
// We expect the input to already be a bool.
value = (bool)obj;
value = (bool)obj!;
return true;
}
private static bool ConvertToNullableBoolCore(object obj, CultureInfo culture, out bool? value)
private static bool ConvertToNullableBoolCore(object? obj, CultureInfo? culture, out bool? value)
{
// We expect the input to already be a bool.
value = (bool?)obj;
@ -561,7 +562,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="culture">The <see cref="CultureInfo"/> to use for conversion.</param>
/// <param name="value">The converted value.</param>
/// <returns><c>true</c> if conversion is successful, otherwise <c>false</c>.</returns>
public static bool TryConvertToInt(object obj, CultureInfo culture, out int value)
public static bool TryConvertToInt(object? obj, CultureInfo? culture, out int value)
{
return ConvertToIntCore(obj, culture, out value);
}
@ -573,7 +574,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="culture">The <see cref="CultureInfo"/> to use for conversion.</param>
/// <param name="value">The converted value.</param>
/// <returns><c>true</c> if conversion is successful, otherwise <c>false</c>.</returns>
public static bool TryConvertToNullableInt(object obj, CultureInfo culture, out int? value)
public static bool TryConvertToNullableInt(object? obj, CultureInfo? culture, out int? value)
{
return ConvertToNullableIntCore(obj, culture, out value);
}
@ -581,9 +582,9 @@ namespace Microsoft.AspNetCore.Components
internal static BindParser<int> ConvertToInt = ConvertToIntCore;
internal static BindParser<int?> ConvertToNullableInt = ConvertToNullableIntCore;
private static bool ConvertToIntCore(object obj, CultureInfo culture, out int value)
private static bool ConvertToIntCore(object? obj, CultureInfo? culture, out int value)
{
var text = (string)obj;
var text = (string?)obj;
if (string.IsNullOrEmpty(text))
{
value = default;
@ -600,9 +601,9 @@ namespace Microsoft.AspNetCore.Components
return true;
}
private static bool ConvertToNullableIntCore(object obj, CultureInfo culture, out int? value)
private static bool ConvertToNullableIntCore(object? obj, CultureInfo? culture, out int? value)
{
var text = (string)obj;
var text = (string?)obj;
if (string.IsNullOrEmpty(text))
{
value = default;
@ -626,7 +627,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="culture">The <see cref="CultureInfo"/> to use for conversion.</param>
/// <param name="value">The converted value.</param>
/// <returns><c>true</c> if conversion is successful, otherwise <c>false</c>.</returns>
public static bool TryConvertToLong(object obj, CultureInfo culture, out long value)
public static bool TryConvertToLong(object? obj, CultureInfo? culture, out long value)
{
return ConvertToLongCore(obj, culture, out value);
}
@ -638,7 +639,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="culture">The <see cref="CultureInfo"/> to use for conversion.</param>
/// <param name="value">The converted value.</param>
/// <returns><c>true</c> if conversion is successful, otherwise <c>false</c>.</returns>
public static bool TryConvertToNullableLong(object obj, CultureInfo culture, out long? value)
public static bool TryConvertToNullableLong(object? obj, CultureInfo? culture, out long? value)
{
return ConvertToNullableLongCore(obj, culture, out value);
}
@ -646,9 +647,9 @@ namespace Microsoft.AspNetCore.Components
internal static BindParser<long> ConvertToLong = ConvertToLongCore;
internal static BindParser<long?> ConvertToNullableLong = ConvertToNullableLongCore;
private static bool ConvertToLongCore(object obj, CultureInfo culture, out long value)
private static bool ConvertToLongCore(object? obj, CultureInfo? culture, out long value)
{
var text = (string)obj;
var text = (string?)obj;
if (string.IsNullOrEmpty(text))
{
value = default;
@ -665,9 +666,9 @@ namespace Microsoft.AspNetCore.Components
return true;
}
private static bool ConvertToNullableLongCore(object obj, CultureInfo culture, out long? value)
private static bool ConvertToNullableLongCore(object? obj, CultureInfo? culture, out long? value)
{
var text = (string)obj;
var text = (string?)obj;
if (string.IsNullOrEmpty(text))
{
value = default;
@ -691,7 +692,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="culture">The <see cref="CultureInfo"/> to use for conversion.</param>
/// <param name="value">The converted value.</param>
/// <returns><c>true</c> if conversion is successful, otherwise <c>false</c>.</returns>
public static bool TryConvertToShort(object obj, CultureInfo culture, out short value)
public static bool TryConvertToShort(object? obj, CultureInfo? culture, out short value)
{
return ConvertToShortCore(obj, culture, out value);
}
@ -703,7 +704,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="culture">The <see cref="CultureInfo"/> to use for conversion.</param>
/// <param name="value">The converted value.</param>
/// <returns><c>true</c> if conversion is successful, otherwise <c>false</c>.</returns>
public static bool TryConvertToNullableShort(object obj, CultureInfo culture, out short? value)
public static bool TryConvertToNullableShort(object? obj, CultureInfo? culture, out short? value)
{
return ConvertToNullableShort(obj, culture, out value);
}
@ -711,9 +712,9 @@ namespace Microsoft.AspNetCore.Components
internal static BindParser<short> ConvertToShort = ConvertToShortCore;
internal static BindParser<short?> ConvertToNullableShort = ConvertToNullableShortCore;
private static bool ConvertToShortCore(object obj, CultureInfo culture, out short value)
private static bool ConvertToShortCore(object? obj, CultureInfo? culture, out short value)
{
var text = (string)obj;
var text = (string?)obj;
if (string.IsNullOrEmpty(text))
{
value = default;
@ -730,9 +731,9 @@ namespace Microsoft.AspNetCore.Components
return true;
}
private static bool ConvertToNullableShortCore(object obj, CultureInfo culture, out short? value)
private static bool ConvertToNullableShortCore(object? obj, CultureInfo? culture, out short? value)
{
var text = (string)obj;
var text = (string?)obj;
if (string.IsNullOrEmpty(text))
{
value = default;
@ -756,7 +757,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="culture">The <see cref="CultureInfo"/> to use for conversion.</param>
/// <param name="value">The converted value.</param>
/// <returns><c>true</c> if conversion is successful, otherwise <c>false</c>.</returns>
public static bool TryConvertToFloat(object obj, CultureInfo culture, out float value)
public static bool TryConvertToFloat(object? obj, CultureInfo? culture, out float value)
{
return ConvertToFloatCore(obj, culture, out value);
}
@ -768,7 +769,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="culture">The <see cref="CultureInfo"/> to use for conversion.</param>
/// <param name="value">The converted value.</param>
/// <returns><c>true</c> if conversion is successful, otherwise <c>false</c>.</returns>
public static bool TryConvertToNullableFloat(object obj, CultureInfo culture, out float? value)
public static bool TryConvertToNullableFloat(object? obj, CultureInfo? culture, out float? value)
{
return ConvertToNullableFloatCore(obj, culture, out value);
}
@ -776,9 +777,9 @@ namespace Microsoft.AspNetCore.Components
internal static BindParser<float> ConvertToFloat = ConvertToFloatCore;
internal static BindParser<float?> ConvertToNullableFloat = ConvertToNullableFloatCore;
private static bool ConvertToFloatCore(object obj, CultureInfo culture, out float value)
private static bool ConvertToFloatCore(object? obj, CultureInfo? culture, out float value)
{
var text = (string)obj;
var text = (string?)obj;
if (string.IsNullOrEmpty(text))
{
value = default;
@ -801,9 +802,9 @@ namespace Microsoft.AspNetCore.Components
return true;
}
private static bool ConvertToNullableFloatCore(object obj, CultureInfo culture, out float? value)
private static bool ConvertToNullableFloatCore(object? obj, CultureInfo? culture, out float? value)
{
var text = (string)obj;
var text = (string?)obj;
if (string.IsNullOrEmpty(text))
{
value = default;
@ -833,7 +834,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="culture">The <see cref="CultureInfo"/> to use for conversion.</param>
/// <param name="value">The converted value.</param>
/// <returns><c>true</c> if conversion is successful, otherwise <c>false</c>.</returns>
public static bool TryConvertToDouble(object obj, CultureInfo culture, out double value)
public static bool TryConvertToDouble(object? obj, CultureInfo? culture, out double value)
{
return ConvertToDoubleCore(obj, culture, out value);
}
@ -845,7 +846,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="culture">The <see cref="CultureInfo"/> to use for conversion.</param>
/// <param name="value">The converted value.</param>
/// <returns><c>true</c> if conversion is successful, otherwise <c>false</c>.</returns>
public static bool TryConvertToNullableDouble(object obj, CultureInfo culture, out double? value)
public static bool TryConvertToNullableDouble(object? obj, CultureInfo? culture, out double? value)
{
return ConvertToNullableDoubleCore(obj, culture, out value);
}
@ -853,9 +854,9 @@ namespace Microsoft.AspNetCore.Components
internal static BindParser<double> ConvertToDoubleDelegate = ConvertToDoubleCore;
internal static BindParser<double?> ConvertToNullableDoubleDelegate = ConvertToNullableDoubleCore;
private static bool ConvertToDoubleCore(object obj, CultureInfo culture, out double value)
private static bool ConvertToDoubleCore(object? obj, CultureInfo? culture, out double value)
{
var text = (string)obj;
var text = (string?)obj;
if (string.IsNullOrEmpty(text))
{
value = default;
@ -878,9 +879,9 @@ namespace Microsoft.AspNetCore.Components
return true;
}
private static bool ConvertToNullableDoubleCore(object obj, CultureInfo culture, out double? value)
private static bool ConvertToNullableDoubleCore(object? obj, CultureInfo? culture, out double? value)
{
var text = (string)obj;
var text = (string?)obj;
if (string.IsNullOrEmpty(text))
{
value = default;
@ -910,7 +911,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="culture">The <see cref="CultureInfo"/> to use for conversion.</param>
/// <param name="value">The converted value.</param>
/// <returns><c>true</c> if conversion is successful, otherwise <c>false</c>.</returns>
public static bool TryConvertToDecimal(object obj, CultureInfo culture, out decimal value)
public static bool TryConvertToDecimal(object? obj, CultureInfo? culture, out decimal value)
{
return ConvertToDecimalCore(obj, culture, out value);
}
@ -922,7 +923,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="culture">The <see cref="CultureInfo"/> to use for conversion.</param>
/// <param name="value">The converted value.</param>
/// <returns><c>true</c> if conversion is successful, otherwise <c>false</c>.</returns>
public static bool TryConvertToNullableDecimal(object obj, CultureInfo culture, out decimal? value)
public static bool TryConvertToNullableDecimal(object? obj, CultureInfo? culture, out decimal? value)
{
return ConvertToNullableDecimalCore(obj, culture, out value);
}
@ -930,9 +931,9 @@ namespace Microsoft.AspNetCore.Components
internal static BindParser<decimal> ConvertToDecimal = ConvertToDecimalCore;
internal static BindParser<decimal?> ConvertToNullableDecimal = ConvertToNullableDecimalCore;
private static bool ConvertToDecimalCore(object obj, CultureInfo culture, out decimal value)
private static bool ConvertToDecimalCore(object? obj, CultureInfo? culture, out decimal value)
{
var text = (string)obj;
var text = (string?)obj;
if (string.IsNullOrEmpty(text))
{
value = default;
@ -949,9 +950,9 @@ namespace Microsoft.AspNetCore.Components
return true;
}
private static bool ConvertToNullableDecimalCore(object obj, CultureInfo culture, out decimal? value)
private static bool ConvertToNullableDecimalCore(object? obj, CultureInfo? culture, out decimal? value)
{
var text = (string)obj;
var text = (string?)obj;
if (string.IsNullOrEmpty(text))
{
value = default;
@ -975,7 +976,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="culture">The <see cref="CultureInfo"/> to use for conversion.</param>
/// <param name="value">The converted value.</param>
/// <returns><c>true</c> if conversion is successful, otherwise <c>false</c>.</returns>
public static bool TryConvertToDateTime(object obj, CultureInfo culture, out DateTime value)
public static bool TryConvertToDateTime(object? obj, CultureInfo? culture, out DateTime value)
{
return ConvertToDateTimeCore(obj, culture, out value);
}
@ -988,7 +989,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="format">The format string to use in conversion.</param>
/// <param name="value">The converted value.</param>
/// <returns><c>true</c> if conversion is successful, otherwise <c>false</c>.</returns>
public static bool TryConvertToDateTime(object obj, CultureInfo culture, string format, out DateTime value)
public static bool TryConvertToDateTime(object? obj, CultureInfo? culture, string format, out DateTime value)
{
return ConvertToDateTimeCore(obj, culture, format, out value);
}
@ -1000,7 +1001,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="culture">The <see cref="CultureInfo"/> to use for conversion.</param>
/// <param name="value">The converted value.</param>
/// <returns><c>true</c> if conversion is successful, otherwise <c>false</c>.</returns>
public static bool TryConvertToNullableDateTime(object obj, CultureInfo culture, out DateTime? value)
public static bool TryConvertToNullableDateTime(object? obj, CultureInfo? culture, out DateTime? value)
{
return ConvertToNullableDateTimeCore(obj, culture, out value);
}
@ -1013,7 +1014,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="format">The format string to use in conversion.</param>
/// <param name="value">The converted value.</param>
/// <returns><c>true</c> if conversion is successful, otherwise <c>false</c>.</returns>
public static bool TryConvertToNullableDateTime(object obj, CultureInfo culture, string format, out DateTime? value)
public static bool TryConvertToNullableDateTime(object? obj, CultureInfo? culture, string format, out DateTime? value)
{
return ConvertToNullableDateTimeCore(obj, culture, format, out value);
}
@ -1023,14 +1024,14 @@ namespace Microsoft.AspNetCore.Components
internal static BindParser<DateTime?> ConvertToNullableDateTime = ConvertToNullableDateTimeCore;
internal static BindParserWithFormat<DateTime?> ConvertToNullableDateTimeWithFormat = ConvertToNullableDateTimeCore;
private static bool ConvertToDateTimeCore(object obj, CultureInfo culture, out DateTime value)
private static bool ConvertToDateTimeCore(object? obj, CultureInfo? culture, out DateTime value)
{
return ConvertToDateTimeCore(obj, culture, format: null, out value);
}
private static bool ConvertToDateTimeCore(object obj, CultureInfo culture, string format, out DateTime value)
private static bool ConvertToDateTimeCore(object? obj, CultureInfo? culture, string? format, out DateTime value)
{
var text = (string)obj;
var text = (string?)obj;
if (string.IsNullOrEmpty(text))
{
value = default;
@ -1052,14 +1053,14 @@ namespace Microsoft.AspNetCore.Components
return false;
}
private static bool ConvertToNullableDateTimeCore(object obj, CultureInfo culture, out DateTime? value)
private static bool ConvertToNullableDateTimeCore(object? obj, CultureInfo? culture, out DateTime? value)
{
return ConvertToNullableDateTimeCore(obj, culture, format: null, out value);
}
private static bool ConvertToNullableDateTimeCore(object obj, CultureInfo culture, string format, out DateTime? value)
private static bool ConvertToNullableDateTimeCore(object? obj, CultureInfo? culture, string? format, out DateTime? value)
{
var text = (string)obj;
var text = (string?)obj;
if (string.IsNullOrEmpty(text))
{
value = default;
@ -1088,7 +1089,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="culture">The <see cref="CultureInfo"/> to use for conversion.</param>
/// <param name="value">The converted value.</param>
/// <returns><c>true</c> if conversion is successful, otherwise <c>false</c>.</returns>
public static bool TryConvertToDateTimeOffset(object obj, CultureInfo culture, out DateTimeOffset value)
public static bool TryConvertToDateTimeOffset(object? obj, CultureInfo? culture, out DateTimeOffset value)
{
return ConvertToDateTimeOffsetCore(obj, culture, out value);
}
@ -1101,7 +1102,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="format">The format string to use in conversion.</param>
/// <param name="value">The converted value.</param>
/// <returns><c>true</c> if conversion is successful, otherwise <c>false</c>.</returns>
public static bool TryConvertToDateTimeOffset(object obj, CultureInfo culture, string format, out DateTimeOffset value)
public static bool TryConvertToDateTimeOffset(object? obj, CultureInfo? culture, string format, out DateTimeOffset value)
{
return ConvertToDateTimeOffsetCore(obj, culture, format, out value);
}
@ -1113,7 +1114,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="culture">The <see cref="CultureInfo"/> to use for conversion.</param>
/// <param name="value">The converted value.</param>
/// <returns><c>true</c> if conversion is successful, otherwise <c>false</c>.</returns>
public static bool TryConvertToNullableDateTimeOffset(object obj, CultureInfo culture, out DateTimeOffset? value)
public static bool TryConvertToNullableDateTimeOffset(object? obj, CultureInfo? culture, out DateTimeOffset? value)
{
return ConvertToNullableDateTimeOffsetCore(obj, culture, out value);
}
@ -1126,7 +1127,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="format">The format string to use in conversion.</param>
/// <param name="value">The converted value.</param>
/// <returns><c>true</c> if conversion is successful, otherwise <c>false</c>.</returns>
public static bool TryConvertToNullableDateTimeOffset(object obj, CultureInfo culture, string format, out DateTimeOffset? value)
public static bool TryConvertToNullableDateTimeOffset(object? obj, CultureInfo? culture, string format, out DateTimeOffset? value)
{
return ConvertToNullableDateTimeOffsetCore(obj, culture, format, out value);
}
@ -1136,14 +1137,14 @@ namespace Microsoft.AspNetCore.Components
internal static BindParser<DateTimeOffset?> ConvertToNullableDateTimeOffset = ConvertToNullableDateTimeOffsetCore;
internal static BindParserWithFormat<DateTimeOffset?> ConvertToNullableDateTimeOffsetWithFormat = ConvertToNullableDateTimeOffsetCore;
private static bool ConvertToDateTimeOffsetCore(object obj, CultureInfo culture, out DateTimeOffset value)
private static bool ConvertToDateTimeOffsetCore(object? obj, CultureInfo? culture, out DateTimeOffset value)
{
return ConvertToDateTimeOffsetCore(obj, culture, format: null, out value);
}
private static bool ConvertToDateTimeOffsetCore(object obj, CultureInfo culture, string format, out DateTimeOffset value)
private static bool ConvertToDateTimeOffsetCore(object? obj, CultureInfo? culture, string? format, out DateTimeOffset value)
{
var text = (string)obj;
var text = (string?)obj;
if (string.IsNullOrEmpty(text))
{
value = default;
@ -1165,14 +1166,14 @@ namespace Microsoft.AspNetCore.Components
return false;
}
private static bool ConvertToNullableDateTimeOffsetCore(object obj, CultureInfo culture, out DateTimeOffset? value)
private static bool ConvertToNullableDateTimeOffsetCore(object? obj, CultureInfo? culture, out DateTimeOffset? value)
{
return ConvertToNullableDateTimeOffsetCore(obj, culture, format: null, out value);
}
private static bool ConvertToNullableDateTimeOffsetCore(object obj, CultureInfo culture, string format, out DateTimeOffset? value)
private static bool ConvertToNullableDateTimeOffsetCore(object? obj, CultureInfo? culture, string? format, out DateTimeOffset? value)
{
var text = (string)obj;
var text = (string?)obj;
if (string.IsNullOrEmpty(text))
{
value = default;
@ -1194,9 +1195,9 @@ namespace Microsoft.AspNetCore.Components
return false;
}
private static bool ConvertToEnum<T>(object obj, CultureInfo culture, out T value) where T : struct, Enum
private static bool ConvertToEnum<T>(object? obj, CultureInfo? culture, out T value) where T : struct, Enum
{
var text = (string)obj;
var text = (string?)obj;
if (string.IsNullOrEmpty(text))
{
value = default;
@ -1219,9 +1220,9 @@ namespace Microsoft.AspNetCore.Components
return true;
}
private static bool ConvertToNullableEnum<T>(object obj, CultureInfo culture, out T? value) where T : struct, Enum
private static bool ConvertToNullableEnum<T>(object? obj, CultureInfo? culture, out T? value) where T : struct, Enum
{
var text = (string)obj;
var text = (string?)obj;
if (string.IsNullOrEmpty(text))
{
value = default;
@ -1251,7 +1252,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="culture">The <see cref="CultureInfo"/> to use for conversion.</param>
/// <param name="value">The converted value.</param>
/// <returns><c>true</c> if conversion is successful, otherwise <c>false</c>.</returns>
public static bool TryConvertTo<T>(object obj, CultureInfo culture, out T value)
public static bool TryConvertTo<T>(object? obj, CultureInfo? culture, out T value)
{
var converter = ParserDelegateCache.Get<T>();
return converter(obj, culture, out value);
@ -1261,8 +1262,8 @@ namespace Microsoft.AspNetCore.Components
{
private readonly static ConcurrentDictionary<Type, Delegate> _cache = new ConcurrentDictionary<Type, Delegate>();
private static MethodInfo _formatEnumValue;
private static MethodInfo _formatNullableEnumValue;
private static MethodInfo? _formatEnumValue;
private static MethodInfo? _formatNullableEnumValue;
public static BindFormatter<T> Get<T>()
{
@ -1349,13 +1350,13 @@ namespace Microsoft.AspNetCore.Components
else if (typeof(T).IsEnum)
{
// We have to deal invoke this dynamically to work around the type constraint on Enum.TryParse.
var method = _formatEnumValue ??= typeof(BindConverter).GetMethod(nameof(FormatEnumValueCore), BindingFlags.NonPublic | BindingFlags.Static);
var method = _formatEnumValue ??= typeof(BindConverter).GetMethod(nameof(FormatEnumValueCore), BindingFlags.NonPublic | BindingFlags.Static)!;
formatter = method.MakeGenericMethod(typeof(T)).CreateDelegate(typeof(BindFormatter<T>), target: null);
}
else if (Nullable.GetUnderlyingType(typeof(T)) is Type innerType && innerType.IsEnum)
{
// We have to deal invoke this dynamically to work around the type constraint on Enum.TryParse.
var method = _formatNullableEnumValue ??= typeof(BindConverter).GetMethod(nameof(FormatNullableEnumValueCore), BindingFlags.NonPublic | BindingFlags.Static);
var method = _formatNullableEnumValue ??= typeof(BindConverter).GetMethod(nameof(FormatNullableEnumValueCore), BindingFlags.NonPublic | BindingFlags.Static)!;
formatter = method.MakeGenericMethod(innerType).CreateDelegate(typeof(BindFormatter<T>), target: null);
}
else
@ -1382,7 +1383,7 @@ namespace Microsoft.AspNetCore.Components
return FormatWithTypeConverter;
string FormatWithTypeConverter(T value, CultureInfo culture)
string FormatWithTypeConverter(T value, CultureInfo? culture)
{
// We intentionally close-over the TypeConverter to cache it. The TypeDescriptor infrastructure is slow.
return typeConverter.ConvertToString(context: null, culture ?? CultureInfo.CurrentCulture, value);
@ -1394,8 +1395,8 @@ namespace Microsoft.AspNetCore.Components
{
private readonly static ConcurrentDictionary<Type, Delegate> _cache = new ConcurrentDictionary<Type, Delegate>();
private static MethodInfo _convertToEnum;
private static MethodInfo _convertToNullableEnum;
private static MethodInfo? _convertToEnum;
private static MethodInfo? _convertToNullableEnum;
public static BindParser<T> Get<T>()
{
@ -1482,13 +1483,13 @@ namespace Microsoft.AspNetCore.Components
else if (typeof(T).IsEnum)
{
// We have to deal invoke this dynamically to work around the type constraint on Enum.TryParse.
var method = _convertToEnum ??= typeof(BindConverter).GetMethod(nameof(ConvertToEnum), BindingFlags.NonPublic | BindingFlags.Static);
var method = _convertToEnum ??= typeof(BindConverter).GetMethod(nameof(ConvertToEnum), BindingFlags.NonPublic | BindingFlags.Static)!;
parser = method.MakeGenericMethod(typeof(T)).CreateDelegate(typeof(BindParser<T>), target: null);
}
else if (Nullable.GetUnderlyingType(typeof(T)) is Type innerType && innerType.IsEnum)
{
// We have to deal invoke this dynamically to work around the type constraint on Enum.TryParse.
var method = _convertToNullableEnum ??= typeof(BindConverter).GetMethod(nameof(ConvertToNullableEnum), BindingFlags.NonPublic | BindingFlags.Static);
var method = _convertToNullableEnum ??= typeof(BindConverter).GetMethod(nameof(ConvertToNullableEnum), BindingFlags.NonPublic | BindingFlags.Static)!;
parser = method.MakeGenericMethod(innerType).CreateDelegate(typeof(BindParser<T>), target: null);
}
else
@ -1515,13 +1516,13 @@ namespace Microsoft.AspNetCore.Components
return ConvertWithTypeConverter;
bool ConvertWithTypeConverter(object obj, CultureInfo culture, out T value)
bool ConvertWithTypeConverter(object? obj, CultureInfo? culture, out T value)
{
// We intentionally close-over the TypeConverter to cache it. The TypeDescriptor infrastructure is slow.
var converted = typeConverter.ConvertFrom(context: null, culture ?? CultureInfo.CurrentCulture, obj);
if (converted == null)
{
value = default;
value = default!;
return true;
}

View File

@ -18,7 +18,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="suffix">The suffix value. For example, set this to <c>value</c> for <c>bind-value</c>, or set this to <see langword="null" /> for <c>bind</c>.</param>
/// <param name="valueAttribute">The name of the value attribute to be bound.</param>
/// <param name="changeAttribute">The name of an attribute that will register an associated change event.</param>
public BindElementAttribute(string element, string suffix, string valueAttribute, string changeAttribute)
public BindElementAttribute(string element, string? suffix, string valueAttribute, string changeAttribute)
{
if (element == null)
{
@ -38,6 +38,7 @@ namespace Microsoft.AspNetCore.Components
Element = element;
ValueAttribute = valueAttribute;
ChangeAttribute = changeAttribute;
Suffix = suffix;
}
/// <summary>
@ -49,7 +50,7 @@ namespace Microsoft.AspNetCore.Components
/// Gets the suffix value.
/// For example, this will be <c>value</c> to mean <c>bind-value</c>, or <see langword="null" /> to mean <c>bind</c>.
/// </summary>
public string Suffix { get; }
public string? Suffix { get; }
/// <summary>
/// Gets the name of the value attribute to be bound.

View File

@ -22,6 +22,6 @@ namespace Microsoft.AspNetCore.Components
/// <see cref="CascadingValue{T}"/> that supplies a value with a compatible
/// type.
/// </summary>
public string Name { get; set; }
public string? Name { get; set; }
}
}

View File

@ -30,14 +30,14 @@ namespace Microsoft.AspNetCore.Components
var infos = GetReflectedCascadingParameterInfos(componentType);
// For components known not to have any cascading parameters, bail out early
if (infos == null)
if (infos.Length == 0)
{
return null;
return Array.Empty<CascadingParameterState>();
}
// Now try to find matches for each of the cascading parameters
// Defer instantiation of the result list until we know there's at least one
List<CascadingParameterState> resultStates = null;
List<CascadingParameterState>? resultStates = null;
var numInfos = infos.Length;
for (var infoIndex = 0; infoIndex < numInfos; infoIndex++)
@ -56,10 +56,10 @@ namespace Microsoft.AspNetCore.Components
}
}
return resultStates;
return resultStates ?? (IReadOnlyList<CascadingParameterState>)Array.Empty<CascadingParameterState>();
}
private static ICascadingValueComponent GetMatchingCascadingValueSupplier(in ReflectedCascadingParameterInfo info, ComponentState componentState)
private static ICascadingValueComponent? GetMatchingCascadingValueSupplier(in ReflectedCascadingParameterInfo info, ComponentState componentState)
{
do
{
@ -89,7 +89,7 @@ namespace Microsoft.AspNetCore.Components
private static ReflectedCascadingParameterInfo[] CreateReflectedCascadingParameterInfos(Type componentType)
{
List<ReflectedCascadingParameterInfo> result = null;
List<ReflectedCascadingParameterInfo>? result = null;
var candidateProps = ComponentProperties.GetCandidateBindableProperties(componentType);
foreach (var prop in candidateProps)
{
@ -108,17 +108,17 @@ namespace Microsoft.AspNetCore.Components
}
}
return result?.ToArray();
return result?.ToArray() ?? Array.Empty<ReflectedCascadingParameterInfo>();
}
readonly struct ReflectedCascadingParameterInfo
{
public string ConsumerValueName { get; }
public string SupplierValueName { get; }
public string? SupplierValueName { get; }
public Type ValueType { get; }
public ReflectedCascadingParameterInfo(
string consumerValueName, Type valueType, string supplierValueName)
string consumerValueName, Type valueType, string? supplierValueName)
{
ConsumerValueName = consumerValueName;
SupplierValueName = supplierValueName;

View File

@ -1,6 +1,8 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#nullable disable warnings
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
@ -34,7 +36,7 @@ namespace Microsoft.AspNetCore.Components
/// If no name is specified, then descendant components will receive the
/// value based the type of value they are requesting.
/// </summary>
[Parameter] public string Name { get; set; }
[Parameter] public string? Name { get; set; }
/// <summary>
/// If true, indicates that <see cref="Value"/> will not change. This is a

View File

@ -17,8 +17,8 @@ namespace Microsoft.AspNetCore.Components
}
else if (oldIsNotNull) // i.e., both are not null (considering previous check)
{
var oldValueType = oldValue.GetType();
var newValueType = newValue.GetType();
var oldValueType = oldValue!.GetType();
var newValueType = newValue!.GetType();
if (oldValueType != newValueType // Definitely different
|| !IsKnownImmutableType(oldValueType) // Maybe different
|| !oldValue.Equals(newValue)) // Somebody says they are different

View File

@ -13,7 +13,6 @@ namespace Microsoft.AspNetCore.Components
/// <summary>
/// Gets or sets the new value.
/// </summary>
public object Value { get; set; }
public object? Value { get; set; }
}
}

View File

@ -301,7 +301,7 @@ namespace Microsoft.AspNetCore.Components
StateHasChanged();
}
Task IHandleEvent.HandleEventAsync(EventCallbackWorkItem callback, object arg)
Task IHandleEvent.HandleEventAsync(EventCallbackWorkItem callback, object? arg)
{
var task = callback.InvokeAsync(arg);
var shouldAwaitTask = task.Status != TaskStatus.RanToCompletion &&

View File

@ -22,7 +22,7 @@ namespace Microsoft.AspNetCore.Components
/// <summary>
/// Provides notifications of unhandled exceptions that occur within the dispatcher.
/// </summary>
internal event UnhandledExceptionEventHandler UnhandledException;
internal event UnhandledExceptionEventHandler? UnhandledException;
/// <summary>
/// Validates that the currently executing code is running inside the dispatcher.

View File

@ -21,15 +21,15 @@ namespace Microsoft.AspNetCore.Components
/// </summary>
public static readonly EventCallback Empty = new EventCallback(null, (Action)(() => { }));
internal readonly MulticastDelegate Delegate;
internal readonly IHandleEvent Receiver;
internal readonly MulticastDelegate? Delegate;
internal readonly IHandleEvent? Receiver;
/// <summary>
/// Creates the new <see cref="EventCallback"/>.
/// </summary>
/// <param name="receiver">The event receiver.</param>
/// <param name="delegate">The delegate to bind.</param>
public EventCallback(IHandleEvent receiver, MulticastDelegate @delegate)
public EventCallback(IHandleEvent? receiver, MulticastDelegate? @delegate)
{
Receiver = receiver;
Delegate = @delegate;
@ -61,7 +61,7 @@ namespace Microsoft.AspNetCore.Components
return Receiver.HandleEventAsync(new EventCallbackWorkItem(Delegate), arg);
}
object IEventCallback.UnpackForRenderTree()
object? IEventCallback.UnpackForRenderTree()
{
return RequiresExplicitReceiver ? (object)this : Delegate;
}

View File

@ -34,11 +34,11 @@ namespace Microsoft.AspNetCore.Components
public static EventCallback<ChangeEventArgs> CreateBinder(
this EventCallbackFactory factory,
object receiver,
Action<string> setter,
Action<string?> setter,
string existingValue,
CultureInfo culture = null)
CultureInfo? culture = null)
{
return CreateBinderCore<string>(factory, receiver, setter, culture, ConvertToString);
return CreateBinderCore<string?>(factory, receiver, setter, culture, ConvertToString);
}
/// <summary>
@ -55,7 +55,7 @@ namespace Microsoft.AspNetCore.Components
object receiver,
Action<bool> setter,
bool existingValue,
CultureInfo culture = null)
CultureInfo? culture = null)
{
return CreateBinderCore<bool>(factory, receiver, setter, culture, ConvertToBool);
}
@ -74,7 +74,7 @@ namespace Microsoft.AspNetCore.Components
object receiver,
Action<bool?> setter,
bool? existingValue,
CultureInfo culture = null)
CultureInfo? culture = null)
{
return CreateBinderCore<bool?>(factory, receiver, setter, culture, ConvertToNullableBool);
}
@ -93,7 +93,7 @@ namespace Microsoft.AspNetCore.Components
object receiver,
Action<int> setter,
int existingValue,
CultureInfo culture = null)
CultureInfo? culture = null)
{
return CreateBinderCore<int>(factory, receiver, setter, culture, ConvertToInt);
}
@ -112,7 +112,7 @@ namespace Microsoft.AspNetCore.Components
object receiver,
Action<int?> setter,
int? existingValue,
CultureInfo culture = null)
CultureInfo? culture = null)
{
return CreateBinderCore<int?>(factory, receiver, setter, culture, ConvertToNullableInt);
}
@ -131,7 +131,7 @@ namespace Microsoft.AspNetCore.Components
object receiver,
Action<long> setter,
long existingValue,
CultureInfo culture = null)
CultureInfo? culture = null)
{
return CreateBinderCore<long>(factory, receiver, setter, culture, ConvertToLong);
}
@ -150,7 +150,7 @@ namespace Microsoft.AspNetCore.Components
object receiver,
Action<short> setter,
short existingValue,
CultureInfo culture = null)
CultureInfo? culture = null)
{
return CreateBinderCore<short>(factory, receiver, setter, culture, ConvertToShort);
}
@ -169,7 +169,7 @@ namespace Microsoft.AspNetCore.Components
object receiver,
Action<long?> setter,
long? existingValue,
CultureInfo culture = null)
CultureInfo? culture = null)
{
return CreateBinderCore<long?>(factory, receiver, setter, culture, ConvertToNullableLong);
}
@ -188,7 +188,7 @@ namespace Microsoft.AspNetCore.Components
object receiver,
Action<short?> setter,
short? existingValue,
CultureInfo culture = null)
CultureInfo? culture = null)
{
return CreateBinderCore<short?>(factory, receiver, setter, culture, ConvertToNullableShort);
}
@ -207,7 +207,7 @@ namespace Microsoft.AspNetCore.Components
object receiver,
Action<float> setter,
float existingValue,
CultureInfo culture = null)
CultureInfo? culture = null)
{
return CreateBinderCore<float>(factory, receiver, setter, culture, ConvertToFloat);
}
@ -226,7 +226,7 @@ namespace Microsoft.AspNetCore.Components
object receiver,
Action<float?> setter,
float? existingValue,
CultureInfo culture = null)
CultureInfo? culture = null)
{
return CreateBinderCore<float?>(factory, receiver, setter, culture, ConvertToNullableFloat);
}
@ -245,7 +245,7 @@ namespace Microsoft.AspNetCore.Components
object receiver,
Action<double> setter,
double existingValue,
CultureInfo culture = null)
CultureInfo? culture = null)
{
return CreateBinderCore<double>(factory, receiver, setter, culture, ConvertToDoubleDelegate);
}
@ -264,7 +264,7 @@ namespace Microsoft.AspNetCore.Components
object receiver,
Action<double?> setter,
double? existingValue,
CultureInfo culture = null)
CultureInfo? culture = null)
{
return CreateBinderCore<double?>(factory, receiver, setter, culture, ConvertToNullableDoubleDelegate);
}
@ -283,7 +283,7 @@ namespace Microsoft.AspNetCore.Components
object receiver,
Action<decimal> setter,
decimal existingValue,
CultureInfo culture = null)
CultureInfo? culture = null)
{
return CreateBinderCore<decimal>(factory, receiver, setter, culture, ConvertToDecimal);
}
@ -302,7 +302,7 @@ namespace Microsoft.AspNetCore.Components
object receiver,
Action<decimal?> setter,
decimal? existingValue,
CultureInfo culture = null)
CultureInfo? culture = null)
{
return CreateBinderCore<decimal?>(factory, receiver, setter, culture, ConvertToNullableDecimal);
}
@ -321,7 +321,7 @@ namespace Microsoft.AspNetCore.Components
object receiver,
Action<DateTime> setter,
DateTime existingValue,
CultureInfo culture = null)
CultureInfo? culture = null)
{
return CreateBinderCore<DateTime>(factory, receiver, setter, culture, ConvertToDateTime);
}
@ -342,7 +342,7 @@ namespace Microsoft.AspNetCore.Components
Action<DateTime> setter,
DateTime existingValue,
string format,
CultureInfo culture = null)
CultureInfo? culture = null)
{
return CreateBinderCore<DateTime>(factory, receiver, setter, culture, format, ConvertToDateTimeWithFormat);
}
@ -361,7 +361,7 @@ namespace Microsoft.AspNetCore.Components
object receiver,
Action<DateTime?> setter,
DateTime? existingValue,
CultureInfo culture = null)
CultureInfo? culture = null)
{
return CreateBinderCore<DateTime?>(factory, receiver, setter, culture, ConvertToNullableDateTime);
}
@ -382,7 +382,7 @@ namespace Microsoft.AspNetCore.Components
Action<DateTime?> setter,
DateTime? existingValue,
string format,
CultureInfo culture = null)
CultureInfo? culture = null)
{
return CreateBinderCore<DateTime?>(factory, receiver, setter, culture, format, ConvertToNullableDateTimeWithFormat);
}
@ -401,7 +401,7 @@ namespace Microsoft.AspNetCore.Components
object receiver,
Action<DateTimeOffset> setter,
DateTimeOffset existingValue,
CultureInfo culture = null)
CultureInfo? culture = null)
{
return CreateBinderCore<DateTimeOffset>(factory, receiver, setter, culture, ConvertToDateTimeOffset);
}
@ -422,7 +422,7 @@ namespace Microsoft.AspNetCore.Components
Action<DateTimeOffset> setter,
DateTimeOffset existingValue,
string format,
CultureInfo culture = null)
CultureInfo? culture = null)
{
return CreateBinderCore<DateTimeOffset>(factory, receiver, setter, culture, format, ConvertToDateTimeOffsetWithFormat);
}
@ -441,7 +441,7 @@ namespace Microsoft.AspNetCore.Components
object receiver,
Action<DateTimeOffset?> setter,
DateTimeOffset? existingValue,
CultureInfo culture = null)
CultureInfo? culture = null)
{
return CreateBinderCore<DateTimeOffset?>(factory, receiver, setter, culture, ConvertToNullableDateTimeOffset);
}
@ -462,7 +462,7 @@ namespace Microsoft.AspNetCore.Components
Action<DateTimeOffset?> setter,
DateTimeOffset? existingValue,
string format,
CultureInfo culture = null)
CultureInfo? culture = null)
{
return CreateBinderCore<DateTimeOffset?>(factory, receiver, setter, culture, format, ConvertToNullableDateTimeOffsetWithFormat);
}
@ -482,7 +482,7 @@ namespace Microsoft.AspNetCore.Components
object receiver,
Action<T> setter,
T existingValue,
CultureInfo culture = null)
CultureInfo? culture = null)
{
return CreateBinderCore<T>(factory, receiver, setter, culture, ParserDelegateCache.Get<T>());
}
@ -491,7 +491,7 @@ namespace Microsoft.AspNetCore.Components
this EventCallbackFactory factory,
object receiver,
Action<T> setter,
CultureInfo culture,
CultureInfo? culture,
BindConverter.BindParser<T> converter)
{
Action<ChangeEventArgs> callback = e =>
@ -520,11 +520,11 @@ namespace Microsoft.AspNetCore.Components
// know that the data they are submitting is different from what they think they've typed
if (converted)
{
setter(value);
setter(value!);
}
else if (string.Empty.Equals(e.Value))
{
setter(default);
setter(default!);
}
};
return factory.Create<ChangeEventArgs>(receiver, callback);
@ -534,7 +534,7 @@ namespace Microsoft.AspNetCore.Components
this EventCallbackFactory factory,
object receiver,
Action<T> setter,
CultureInfo culture,
CultureInfo? culture,
string format,
BindConverter.BindParserWithFormat<T> converter)
{
@ -564,11 +564,11 @@ namespace Microsoft.AspNetCore.Components
// know that the data they are submitting is different from what they think they've typed
if (converted)
{
setter(value);
setter(value!);
}
else if (string.Empty.Equals(e.Value))
{
setter(default);
setter(default!);
}
};
return factory.Create<ChangeEventArgs>(receiver, callback);

View File

@ -16,15 +16,15 @@ namespace Microsoft.AspNetCore.Components
/// </summary>
public static readonly EventCallback<TValue> Empty = new EventCallback<TValue>(null, (Action)(() => { }));
internal readonly MulticastDelegate Delegate;
internal readonly IHandleEvent Receiver;
internal readonly MulticastDelegate? Delegate;
internal readonly IHandleEvent? Receiver;
/// <summary>
/// Creates the new <see cref="EventCallback{TValue}"/>.
/// </summary>
/// <param name="receiver">The event receiver.</param>
/// <param name="delegate">The delegate to bind.</param>
public EventCallback(IHandleEvent receiver, MulticastDelegate @delegate)
public EventCallback(IHandleEvent? receiver, MulticastDelegate? @delegate)
{
Receiver = receiver;
Delegate = @delegate;
@ -61,7 +61,7 @@ namespace Microsoft.AspNetCore.Components
return new EventCallback(Receiver ?? Delegate?.Target as IHandleEvent, Delegate);
}
object IEventCallback.UnpackForRenderTree()
object? IEventCallback.UnpackForRenderTree()
{
return RequiresExplicitReceiver ? (object)AsUntyped() : Delegate;
}

View File

@ -17,13 +17,13 @@ namespace Microsoft.AspNetCore.Components
/// </summary>
public static readonly EventCallbackWorkItem Empty = new EventCallbackWorkItem(null);
private readonly MulticastDelegate _delegate;
private readonly MulticastDelegate? _delegate;
/// <summary>
/// Creates a new <see cref="EventCallbackWorkItem"/> with the provided <paramref name="delegate"/>.
/// </summary>
/// <param name="delegate">The callback delegate.</param>
public EventCallbackWorkItem(MulticastDelegate @delegate)
public EventCallbackWorkItem(MulticastDelegate? @delegate)
{
_delegate = @delegate;
}
@ -33,12 +33,12 @@ namespace Microsoft.AspNetCore.Components
/// </summary>
/// <param name="arg">The argument to provide to the delegate. May be <c>null</c>.</param>
/// <returns>A <see cref="Task"/> then will complete asynchronously once the delegate has completed.</returns>
public Task InvokeAsync(object arg)
public Task InvokeAsync(object? arg)
{
return InvokeAsync<object>(_delegate, arg);
return InvokeAsync<object?>(_delegate, arg);
}
internal static Task InvokeAsync<T>(MulticastDelegate @delegate, T arg)
internal static Task InvokeAsync<T>(MulticastDelegate? @delegate, T arg)
{
switch (@delegate)
{
@ -70,7 +70,7 @@ namespace Microsoft.AspNetCore.Components
// Since we fell into the DynamicInvoke case, any exception will be wrapped
// in a TIE. We can expect this to be thrown synchronously, so it's low overhead
// to unwrap it.
return Task.FromException(e.InnerException);
return Task.FromException(e.InnerException!);
}
}
}

View File

@ -11,9 +11,9 @@ namespace Microsoft.AspNetCore.Components
// This interface exists only so that CascadingParameterState has a way
// to work with all CascadingValue<T> types regardless of T.
bool CanSupplyValue(Type valueType, string valueName);
bool CanSupplyValue(Type valueType, string? valueName);
object CurrentValue { get; }
object? CurrentValue { get; }
bool CurrentValueIsFixed { get; }

View File

@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNetCore.Components
@ -8,6 +8,6 @@ namespace Microsoft.AspNetCore.Components
{
bool HasDelegate { get; }
object UnpackForRenderTree();
object? UnpackForRenderTree();
}
}

View File

@ -18,6 +18,6 @@ namespace Microsoft.AspNetCore.Components
/// <returns>
/// A <see cref="Task"/> that completes once the component has processed the state change.
/// </returns>
Task HandleEventAsync(EventCallbackWorkItem item, object arg);
Task HandleEventAsync(EventCallbackWorkItem item, object? arg);
}
}

View File

@ -16,6 +16,6 @@ namespace Microsoft.AspNetCore.Components
/// Gets the content to be rendered inside the layout.
/// </summary>
[Parameter]
public RenderFragment Body { get; set; }
public RenderFragment? Body { get; set; }
}
}

View File

@ -21,14 +21,14 @@ namespace Microsoft.AspNetCore.Components
/// Gets or sets the content to display.
/// </summary>
[Parameter]
public RenderFragment ChildContent { get; set; }
public RenderFragment ChildContent { get; set; } = default!;
/// <summary>
/// Gets or sets the type of the layout in which to display the content.
/// The type must implement <see cref="IComponent"/> and accept a parameter named <see cref="LayoutComponentBase.Body"/>.
/// </summary>
[Parameter]
public Type Layout { get; set; }
public Type Layout { get; set; } = default!;
/// <inheritdoc />
public void Attach(RenderHandle renderHandle)
@ -71,7 +71,7 @@ namespace Microsoft.AspNetCore.Components
};
}
private static Type GetParentLayoutType(Type type)
private static Type? GetParentLayoutType(Type type)
=> type.GetCustomAttribute<LayoutAttribute>()?.LayoutType;
}
}

View File

@ -6,6 +6,7 @@
<Description>Components feature for ASP.NET Core.</Description>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<IsAspNetCoreApp>true</IsAspNetCoreApp>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>

View File

@ -28,14 +28,14 @@ namespace Microsoft.AspNetCore.Components
}
}
private EventHandler<LocationChangedEventArgs> _locationChanged;
private EventHandler<LocationChangedEventArgs>? _locationChanged;
// For the baseUri it's worth storing as a System.Uri so we can do operations
// on that type. System.Uri gives us access to the original string anyway.
private Uri _baseUri;
private Uri? _baseUri;
// The URI. Always represented an absolute URI.
private string _uri;
private string? _uri;
private bool _isInitialized;
@ -51,7 +51,7 @@ namespace Microsoft.AspNetCore.Components
get
{
AssertInitialized();
return _baseUri.OriginalString;
return _baseUri!.OriginalString;
}
protected set
{
@ -60,7 +60,7 @@ namespace Microsoft.AspNetCore.Components
value = NormalizeBaseUri(value);
}
_baseUri = new Uri(value, UriKind.Absolute);
_baseUri = new Uri(value!, UriKind.Absolute);
}
}
@ -75,7 +75,7 @@ namespace Microsoft.AspNetCore.Components
get
{
AssertInitialized();
return _uri;
return _uri!;
}
protected set
{
@ -150,7 +150,7 @@ namespace Microsoft.AspNetCore.Components
public Uri ToAbsoluteUri(string relativeUri)
{
AssertInitialized();
return new Uri(_baseUri, relativeUri);
return new Uri(_baseUri!, relativeUri);
}
/// <summary>
@ -161,7 +161,7 @@ namespace Microsoft.AspNetCore.Components
/// <returns>A relative URI path.</returns>
public string ToBaseRelativePath(string uri)
{
if (uri.StartsWith(_baseUri.OriginalString, StringComparison.Ordinal))
if (uri.StartsWith(_baseUri!.OriginalString, StringComparison.Ordinal))
{
// The absolute URI must be of the form "{baseUri}something" (where
// baseUri ends with a slash), and from that we return "something"
@ -203,7 +203,7 @@ namespace Microsoft.AspNetCore.Components
{
try
{
_locationChanged?.Invoke(this, new LocationChangedEventArgs(_uri, isInterceptedLink));
_locationChanged?.Invoke(this, new LocationChangedEventArgs(_uri!, isInterceptedLink));
}
catch (Exception ex)
{
@ -252,7 +252,7 @@ namespace Microsoft.AspNetCore.Components
return false;
}
private static void Validate(Uri baseUri, string uri)
private static void Validate(Uri? baseUri, string uri)
{
if (baseUri == null || uri == null)
{

View File

@ -17,9 +17,9 @@ namespace Microsoft.AspNetCore.Components
/// </remarks>
public abstract class OwningComponentBase : ComponentBase, IDisposable
{
private IServiceScope _scope;
private IServiceScope? _scope;
[Inject] IServiceScopeFactory ScopeFactory { get; set; }
[Inject] IServiceScopeFactory ScopeFactory { get; set; } = default!;
/// <summary>
/// Gets a value determining if the component and associated services have been disposed.
@ -75,9 +75,9 @@ namespace Microsoft.AspNetCore.Components
/// requires disposal such as a repository or database abstraction. Using <see cref="OwningComponentBase{TService}"/>
/// as a base class ensures that the service and relates services that share its scope are disposed with the component.
/// </remarks>
public abstract class OwningComponentBase<TService> : OwningComponentBase, IDisposable
public abstract class OwningComponentBase<TService> : OwningComponentBase, IDisposable where TService : notnull
{
private TService _item;
private TService _item = default!;
/// <summary>
/// Gets the <typeparamref name="TService"/> that is associated with this component.

View File

@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Microsoft.AspNetCore.Components.Reflection;
using Microsoft.AspNetCore.Components.Rendering;
using Microsoft.AspNetCore.Components.RenderTree;
@ -21,24 +22,24 @@ namespace Microsoft.AspNetCore.Components
RenderTreeFrame.Element(0, string.Empty).WithComponentSubtreeLength(1)
};
private static readonly ParameterView _empty = new ParameterView(ParameterViewLifetime.Unbound, _emptyFrames, 0, null);
private static readonly ParameterView _empty = new ParameterView(ParameterViewLifetime.Unbound, _emptyFrames, 0, Array.Empty<CascadingParameterState>());
private readonly ParameterViewLifetime _lifetime;
private readonly RenderTreeFrame[] _frames;
private readonly int _ownerIndex;
private readonly IReadOnlyList<CascadingParameterState> _cascadingParametersOrNull;
private readonly IReadOnlyList<CascadingParameterState> _cascadingParameters;
internal ParameterView(in ParameterViewLifetime lifetime, RenderTreeFrame[] frames, int ownerIndex)
: this(lifetime, frames, ownerIndex, null)
: this(lifetime, frames, ownerIndex, Array.Empty<CascadingParameterState>())
{
}
private ParameterView(in ParameterViewLifetime lifetime, RenderTreeFrame[] frames, int ownerIndex, IReadOnlyList<CascadingParameterState> cascadingParametersOrNull)
private ParameterView(in ParameterViewLifetime lifetime, RenderTreeFrame[] frames, int ownerIndex, IReadOnlyList<CascadingParameterState> cascadingParameters)
{
_lifetime = lifetime;
_frames = frames;
_ownerIndex = ownerIndex;
_cascadingParametersOrNull = cascadingParametersOrNull;
_cascadingParameters = cascadingParameters;
}
/// <summary>
@ -55,7 +56,7 @@ namespace Microsoft.AspNetCore.Components
public Enumerator GetEnumerator()
{
_lifetime.AssertNotExpired();
return new Enumerator(_frames, _ownerIndex, _cascadingParametersOrNull);
return new Enumerator(_frames, _ownerIndex, _cascadingParameters);
}
/// <summary>
@ -65,7 +66,7 @@ namespace Microsoft.AspNetCore.Components
/// <param name="parameterName">The name of the parameter.</param>
/// <param name="result">Receives the result, if any.</param>
/// <returns>True if a matching parameter was found; false otherwise.</returns>
public bool TryGetValue<TValue>(string parameterName, out TValue result)
public bool TryGetValue<TValue>(string parameterName, [MaybeNullWhen(false)] out TValue result)
{
foreach (var entry in this)
{
@ -87,8 +88,9 @@ namespace Microsoft.AspNetCore.Components
/// <typeparam name="TValue">The type of the value.</typeparam>
/// <param name="parameterName">The name of the parameter.</param>
/// <returns>The parameter value if found; otherwise the default value for the specified type.</returns>
[return: MaybeNull]
public TValue GetValueOrDefault<TValue>(string parameterName)
=> GetValueOrDefault<TValue>(parameterName, default);
=> GetValueOrDefault<TValue>(parameterName, default!);
/// <summary>
/// Gets the value of the parameter with the specified name, or a specified default value
@ -350,19 +352,13 @@ namespace Microsoft.AspNetCore.Components
public bool MoveNext()
{
// Bail out early if there are no cascading parameters
if (_cascadingParameters == null)
{
return false;
}
var nextIndex = _currentIndex + 1;
if (nextIndex < _cascadingParameters.Count)
{
_currentIndex = nextIndex;
var state = _cascadingParameters[_currentIndex];
_current = new ParameterValue(state.LocalValueName, state.ValueSupplier.CurrentValue, true);
_current = new ParameterValue(state.LocalValueName, state.ValueSupplier.CurrentValue!, true);
return true;
}
else

View File

@ -4,7 +4,7 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
@ -73,7 +73,7 @@ namespace Microsoft.AspNetCore.Components.Reflection
{
// Logic with components with a CaptureUnmatchedValues parameter
var isCaptureUnmatchedValuesParameterSetExplicitly = false;
Dictionary<string, object> unmatched = null;
Dictionary<string, object>? unmatched = null;
foreach (var parameter in parameters)
{
var parameterName = parameter.Name;
@ -82,33 +82,47 @@ namespace Microsoft.AspNetCore.Components.Reflection
isCaptureUnmatchedValuesParameterSetExplicitly = true;
}
var isUnmatchedValue = !writers.WritersByName.TryGetValue(parameterName, out var writer);
if ((isUnmatchedValue && parameter.Cascading) || (writer != null && !writer.Cascading && parameter.Cascading))
if (writers.WritersByName.TryGetValue(parameterName, out var writer))
{
// Don't allow an "extra" cascading value to be collected - or don't allow a non-cascading
// parameter to be set with a cascading value.
//
// This is likely a bug in our infrastructure or an attempt to deliberately do something unsupported.
ThrowForSettingParameterWithCascadingValue(targetType, parameterName);
throw null; // Unreachable
}
else if (isUnmatchedValue ||
// Allow unmatched parameters to collide with the names of cascading parameters. This is
// valid because cascading parameter names are not part of the public API. There's no
// way for the user of a component to know what the names of cascading parameters
// are.
(writer.Cascading && !parameter.Cascading))
{
unmatched ??= new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);
unmatched[parameterName] = parameter.Value;
if (!writer.Cascading && parameter.Cascading)
{
// Don't allow an "extra" cascading value to be collected - or don't allow a non-cascading
// parameter to be set with a cascading value.
//
// This is likely a bug in our infrastructure or an attempt to deliberately do something unsupported.
ThrowForSettingParameterWithCascadingValue(targetType, parameterName);
throw null; // Unreachable
}
else if (writer.Cascading && !parameter.Cascading)
{
// Allow unmatched parameters to collide with the names of cascading parameters. This is
// valid because cascading parameter names are not part of the public API. There's no
// way for the user of a component to know what the names of cascading parameters
// are.
unmatched ??= new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);
unmatched[parameterName] = parameter.Value;
}
else
{
SetProperty(target, writer, parameterName, parameter.Value);
}
}
else
{
Debug.Assert(writer != null);
SetProperty(target, writer, parameterName, parameter.Value);
if (parameter.Cascading)
{
// Don't allow an "extra" cascading value to be collected - or don't allow a non-cascading
// parameter to be set with a cascading value.
//
// This is likely a bug in our infrastructure or an attempt to deliberately do something unsupported.
ThrowForSettingParameterWithCascadingValue(targetType, parameterName);
throw null; // Unreachable
}
else
{
unmatched ??= new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);
unmatched[parameterName] = parameter.Value;
}
}
}
@ -120,13 +134,13 @@ namespace Microsoft.AspNetCore.Components.Reflection
// 2. We also don't want to implicitly copy a value the user gives us.
//
// Either one of those implementation choices would do something unexpected.
ThrowForCaptureUnmatchedValuesConflict(targetType, writers.CaptureUnmatchedValuesPropertyName, unmatched);
ThrowForCaptureUnmatchedValuesConflict(targetType, writers.CaptureUnmatchedValuesPropertyName!, unmatched);
throw null; // Unreachable
}
else if (unmatched != null)
{
// We had some unmatched values, set the CaptureUnmatchedValues property
SetProperty(target, writers.CaptureUnmatchedValuesWriter, writers.CaptureUnmatchedValuesPropertyName, unmatched);
SetProperty(target, writers.CaptureUnmatchedValuesWriter, writers.CaptureUnmatchedValuesPropertyName!, unmatched);
}
}
@ -148,6 +162,7 @@ namespace Microsoft.AspNetCore.Components.Reflection
internal static IEnumerable<PropertyInfo> GetCandidateBindableProperties(Type targetType)
=> MemberAssignment.GetPropertiesIncludingInherited(targetType, _bindablePropertyFlags);
[DoesNotReturn]
private static void ThrowForUnknownIncomingParameterName(Type targetType, string parameterName)
{
// We know we're going to throw by this stage, so it doesn't matter that the following
@ -176,6 +191,7 @@ namespace Microsoft.AspNetCore.Components.Reflection
}
}
[DoesNotReturn]
private static void ThrowForSettingCascadingParameterWithNonCascadingValue(Type targetType, string parameterName)
{
throw new InvalidOperationException(
@ -183,6 +199,7 @@ namespace Microsoft.AspNetCore.Components.Reflection
$"but it does not have [{nameof(ParameterAttribute)}] applied.");
}
[DoesNotReturn]
private static void ThrowForSettingParameterWithCascadingValue(Type targetType, string parameterName)
{
throw new InvalidOperationException(
@ -190,6 +207,7 @@ namespace Microsoft.AspNetCore.Components.Reflection
$"using a cascading value.");
}
[DoesNotReturn]
private static void ThrowForCaptureUnmatchedValuesConflict(Type targetType, string parameterName, Dictionary<string, object> unmatched)
{
throw new InvalidOperationException(
@ -198,6 +216,7 @@ namespace Microsoft.AspNetCore.Components.Reflection
string.Join(Environment.NewLine, unmatched.Keys.OrderBy(k => k)));
}
[DoesNotReturn]
private static void ThrowForMultipleCaptureUnmatchedValuesParameters(Type targetType)
{
// We don't care about perf here, we want to report an accurate and useful error.
@ -215,6 +234,7 @@ namespace Microsoft.AspNetCore.Components.Reflection
string.Join(Environment.NewLine, propertyNames));
}
[DoesNotReturn]
private static void ThrowForInvalidCaptureUnmatchedValuesParameterType(Type targetType, PropertyInfo propertyInfo)
{
throw new InvalidOperationException(
@ -280,9 +300,9 @@ namespace Microsoft.AspNetCore.Components.Reflection
public Dictionary<string, IPropertySetter> WritersByName { get; }
public IPropertySetter CaptureUnmatchedValuesWriter { get; }
public IPropertySetter? CaptureUnmatchedValuesWriter { get; }
public string CaptureUnmatchedValuesPropertyName { get; }
public string? CaptureUnmatchedValuesPropertyName { get; }
}
}
}

View File

@ -15,10 +15,12 @@ namespace Microsoft.AspNetCore.Components.Reflection
{
var dictionary = new Dictionary<string, List<PropertyInfo>>();
while (type != null)
Type? currentType = type;
while (currentType != null)
{
var properties = type.GetProperties(bindingFlags)
.Where(prop => prop.DeclaringType == type);
var properties = currentType.GetProperties(bindingFlags)
.Where(prop => prop.DeclaringType == currentType);
foreach (var property in properties)
{
if (!dictionary.TryGetValue(property.Name, out var others))
@ -37,7 +39,7 @@ namespace Microsoft.AspNetCore.Components.Reflection
others.Add(property);
}
type = type.BaseType;
currentType = currentType.BaseType;
}
return dictionary.Values.SelectMany(p => p);
@ -55,10 +57,10 @@ namespace Microsoft.AspNetCore.Components.Reflection
return (IPropertySetter)Activator.CreateInstance(
typeof(PropertySetter<,>).MakeGenericType(targetType, property.PropertyType),
property.SetMethod,
cascading);
cascading)!;
}
class PropertySetter<TTarget, TValue> : IPropertySetter
class PropertySetter<TTarget, TValue> : IPropertySetter where TTarget : notnull
{
private readonly Action<TTarget, TValue> _setterDelegate;
@ -75,7 +77,7 @@ namespace Microsoft.AspNetCore.Components.Reflection
{
if (value == null)
{
_setterDelegate((TTarget)target, default);
_setterDelegate((TTarget)target, default!);
}
else
{

View File

@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Diagnostics.CodeAnalysis;
using Microsoft.AspNetCore.Components.RenderTree;
namespace Microsoft.AspNetCore.Components
@ -16,7 +17,7 @@ namespace Microsoft.AspNetCore.Components
internal RenderHandle(Renderer renderer, int componentId)
{
_renderer = renderer ?? throw new System.ArgumentNullException(nameof(renderer));
_renderer = renderer ?? throw new ArgumentNullException(nameof(renderer));
_componentId = componentId;
}
@ -57,6 +58,7 @@ namespace Microsoft.AspNetCore.Components
_renderer.AddToRenderQueue(_componentId, renderFragment);
}
[DoesNotReturn]
private static void ThrowNotInitialized()
{
throw new InvalidOperationException("The render handle is not yet assigned.");

View File

@ -1,6 +1,8 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#nullable enable
using System;
using System.Collections;
using System.Collections.Generic;
@ -21,7 +23,7 @@ namespace Microsoft.AspNetCore.Components.RenderTree
public readonly struct ArrayBuilderSegment<T> : IEnumerable<T>
{
// The following fields are memory mapped to the WASM client. Do not re-order or use auto-properties.
private readonly ArrayBuilder<T> _builder;
private readonly ArrayBuilder<T>? _builder;
private readonly int _offset;
private readonly int _count;
@ -35,7 +37,7 @@ namespace Microsoft.AspNetCore.Components.RenderTree
/// <summary>
/// Gets the current underlying array holding the segment's elements.
/// </summary>
public T[] Array => _builder?.Buffer;
public T[] Array => _builder?.Buffer ?? System.Array.Empty<T>();
/// <summary>
/// Gets the offset into the underlying array holding the segment's elements.
@ -53,13 +55,13 @@ namespace Microsoft.AspNetCore.Components.RenderTree
/// <param name="index">The index into the segment.</param>
/// <returns>The array entry at the specified index within the segment.</returns>
public T this[int index]
=> _builder.Buffer[_offset + index];
=> Array[_offset + index];
IEnumerator<T> IEnumerable<T>.GetEnumerator()
=> ((IEnumerable<T>)new ArraySegment<T>(_builder.Buffer, _offset, _count)).GetEnumerator();
=> ((IEnumerable<T>)new ArraySegment<T>(Array, _offset, _count)).GetEnumerator();
IEnumerator IEnumerable.GetEnumerator()
=> ((IEnumerable)new ArraySegment<T>(_builder.Buffer, _offset, _count)).GetEnumerator();
=> ((IEnumerable)new ArraySegment<T>(Array, _offset, _count)).GetEnumerator();
// TODO: If this assembly later moves to netstandard2.1, consider adding a public
// GetEnumerator method that returns ArraySegment.Enumerator to avoid boxing.

View File

@ -21,6 +21,6 @@ namespace Microsoft.AspNetCore.Components.RenderTree
/// <summary>
/// Specifies the form field's new value.
/// </summary>
public object FieldValue { get; set; }
public object FieldValue { get; set; } = default!;
}
}

View File

@ -1,6 +1,8 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#nullable disable warnings
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Components.Rendering;

View File

@ -1,6 +1,8 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#nullable disable warnings
using System;
using System.Runtime.InteropServices;
#if !IGNITOR

View File

@ -1,6 +1,8 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#nullable disable warnings
using System;
using Microsoft.AspNetCore.Components.Rendering;
using Microsoft.Extensions.Logging;

View File

@ -1,6 +1,8 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#nullable disable warnings
using System;
using System.Collections.Generic;
using System.Diagnostics;

View File

@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components.RenderTree;
@ -17,9 +18,10 @@ namespace Microsoft.AspNetCore.Components.Rendering
{
private readonly Renderer _renderer;
private readonly IReadOnlyList<CascadingParameterState> _cascadingParameters;
private readonly bool _hasCascadingParameters;
private readonly bool _hasAnyCascadingParameterSubscriptions;
private RenderTreeBuilder _renderTreeBuilderPrevious;
private ArrayBuilder<RenderTreeFrame> _latestDirectParametersSnapshot; // Lazily instantiated
private ArrayBuilder<RenderTreeFrame>? _latestDirectParametersSnapshot; // Lazily instantiated
private bool _componentWasDisposed;
/// <summary>
@ -39,8 +41,9 @@ namespace Microsoft.AspNetCore.Components.Rendering
CurrentRenderTree = new RenderTreeBuilder();
_renderTreeBuilderPrevious = new RenderTreeBuilder();
if (_cascadingParameters != null)
if (_cascadingParameters.Count != 0)
{
_hasCascadingParameters = true;
_hasAnyCascadingParameterSubscriptions = AddCascadingParameterSubscriptions();
}
}
@ -76,7 +79,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
batchBuilder.InvalidateParameterViews();
}
public bool TryDisposeInBatch(RenderBatchBuilder batchBuilder, out Exception exception)
public bool TryDisposeInBatch(RenderBatchBuilder batchBuilder, [NotNullWhen(false)] out Exception? exception)
{
_componentWasDisposed = true;
exception = null;
@ -149,7 +152,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
parameters.CaptureSnapshot(_latestDirectParametersSnapshot);
}
if (_cascadingParameters != null)
if (_hasCascadingParameters)
{
parameters = parameters.WithCascadingParameters(_cascadingParameters);
}
@ -162,7 +165,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
var directParams = _latestDirectParametersSnapshot != null
? new ParameterView(lifetime, _latestDirectParametersSnapshot.Buffer, 0)
: ParameterView.Empty;
var allParams = directParams.WithCascadingParameters(_cascadingParameters);
var allParams = directParams.WithCascadingParameters(_cascadingParameters!);
var task = Component.SetParametersAsync(allParams);
_renderer.AddToPendingTasks(task);
}
@ -170,7 +173,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
private bool AddCascadingParameterSubscriptions()
{
var hasSubscription = false;
var numCascadingParameters = _cascadingParameters.Count;
var numCascadingParameters = _cascadingParameters!.Count;
for (var i = 0; i < numCascadingParameters; i++)
{
@ -187,7 +190,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
private void RemoveCascadingParameterSubscriptions()
{
var numCascadingParameters = _cascadingParameters.Count;
var numCascadingParameters = _cascadingParameters!.Count;
for (var i = 0; i < numCascadingParameters; i++)
{
var supplier = _cascadingParameters[i].ValueSupplier;

View File

@ -1,6 +1,8 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#nullable disable warnings
using System;
using System.Collections.Generic;
using System.Diagnostics;

View File

@ -1,6 +1,8 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#nullable disable warnings
using System;
using System.Diagnostics;
using System.Threading;

View File

@ -1,6 +1,8 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#nullable disable warnings
using System;
using System.Reflection;
using System.Threading.Tasks;

View File

@ -19,7 +19,7 @@ namespace Microsoft.AspNetCore.Components.Routing
_parser = parser;
}
public override bool Match(string pathSegment, out object convertedValue)
public override bool Match(string pathSegment, out object? convertedValue)
{
// Unset values are set to null in the Parameters object created in
// the RouteContext. To match this pattern, unset optional parmeters

View File

@ -17,7 +17,7 @@ namespace Microsoft.AspNetCore.Components.Routing
private static readonly ConcurrentDictionary<string, RouteConstraint> _cachedConstraints
= new ConcurrentDictionary<string, RouteConstraint>();
public abstract bool Match(string pathSegment, out object convertedValue);
public abstract bool Match(string pathSegment, out object? convertedValue);
public static RouteConstraint Parse(string template, string segment, string constraint)
{
@ -57,7 +57,7 @@ namespace Microsoft.AspNetCore.Components.Routing
/// </summary>
/// <param name="constraint">String representation of the constraint</param>
/// <returns>Type-specific RouteConstraint object</returns>
private static RouteConstraint CreateRouteConstraint(string constraint)
private static RouteConstraint? CreateRouteConstraint(string constraint)
{
switch (constraint)
{

View File

@ -8,7 +8,7 @@ namespace Microsoft.AspNetCore.Components.Routing
{
internal class RouteContext
{
private static char[] Separator = new[] { '/' };
private static readonly char[] Separator = new[] { '/' };
public RouteContext(string path)
{
@ -24,8 +24,8 @@ namespace Microsoft.AspNetCore.Components.Routing
public string[] Segments { get; }
public Type Handler { get; set; }
public Type? Handler { get; set; }
public IReadOnlyDictionary<string, object> Parameters { get; set; }
public IReadOnlyDictionary<string, object>? Parameters { get; set; }
}
}

View File

@ -1,6 +1,8 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#nullable disable warnings
using System;
using System.Linq;
using System.Collections.Generic;

View File

@ -188,7 +188,7 @@ namespace Microsoft.AspNetCore.Components
Assemblies = assemblies;
}
public override bool Equals(object obj)
public override bool Equals(object? obj)
{
return obj is Key other ? base.Equals(other) : false;
}
@ -199,7 +199,7 @@ namespace Microsoft.AspNetCore.Components
{
return true;
}
else if (Assemblies == null ^ other.Assemblies == null)
else if ((Assemblies == null) || (other.Assemblies == null))
{
return false;
}

View File

@ -1,6 +1,8 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#nullable disable warnings
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;

View File

@ -66,7 +66,7 @@ namespace Microsoft.AspNetCore.Components.Routing
public RouteConstraint[] Constraints { get; }
public bool Match(string pathSegment, out object matchedParameterValue)
public bool Match(string pathSegment, out object? matchedParameterValue)
{
if (IsParameter)
{

View File

@ -1,6 +1,8 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Diagnostics.CodeAnalysis;
namespace Microsoft.AspNetCore.Components.Routing
{
/// <summary>
@ -9,7 +11,7 @@ namespace Microsoft.AspNetCore.Components.Routing
/// <typeparam name="T">The type to which the value must be parseable.</typeparam>
internal class TypeRouteConstraint<T> : RouteConstraint
{
public delegate bool TryParseDelegate(string str, out T result);
public delegate bool TryParseDelegate(string str, [MaybeNullWhen(false)] out T result);
private readonly TryParseDelegate _parser;
@ -18,7 +20,7 @@ namespace Microsoft.AspNetCore.Components.Routing
_parser = parser;
}
public override bool Match(string pathSegment, out object convertedValue)
public override bool Match(string pathSegment, out object? convertedValue)
{
if (_parser(pathSegment, out var result))
{

View File

@ -15,7 +15,7 @@ namespace Microsoft.AspNetCore.Components.Test
public class CascadingParameterStateTest
{
[Fact]
public void FindCascadingParameters_IfHasNoParameters_ReturnsNull()
public void FindCascadingParameters_IfHasNoParameters_ReturnsEmpty()
{
// Arrange
var componentState = CreateComponentState(new ComponentWithNoParams());
@ -24,11 +24,11 @@ namespace Microsoft.AspNetCore.Components.Test
var result = CascadingParameterState.FindCascadingParameters(componentState);
// Assert
Assert.Null(result);
Assert.Empty(result);
}
[Fact]
public void FindCascadingParameters_IfHasNoCascadingParameters_ReturnsNull()
public void FindCascadingParameters_IfHasNoCascadingParameters_ReturnsEmpty()
{
// Arrange
var componentState = CreateComponentState(new ComponentWithNoCascadingParams());
@ -37,11 +37,11 @@ namespace Microsoft.AspNetCore.Components.Test
var result = CascadingParameterState.FindCascadingParameters(componentState);
// Assert
Assert.Null(result);
Assert.Empty(result);
}
[Fact]
public void FindCascadingParameters_IfHasNoAncestors_ReturnsNull()
public void FindCascadingParameters_IfHasNoAncestors_ReturnsEmpty()
{
// Arrange
var componentState = CreateComponentState(new ComponentWithCascadingParams());
@ -50,11 +50,11 @@ namespace Microsoft.AspNetCore.Components.Test
var result = CascadingParameterState.FindCascadingParameters(componentState);
// Assert
Assert.Null(result);
Assert.Empty(result);
}
[Fact]
public void FindCascadingParameters_IfHasNoMatchesInAncestors_ReturnsNull()
public void FindCascadingParameters_IfHasNoMatchesInAncestors_ReturnsEmpty()
{
// Arrange: Build the ancestry list
var states = CreateAncestry(
@ -67,7 +67,7 @@ namespace Microsoft.AspNetCore.Components.Test
var result = CascadingParameterState.FindCascadingParameters(states.Last());
// Assert
Assert.Null(result);
Assert.Empty(result);
}
[Fact]
@ -178,7 +178,7 @@ namespace Microsoft.AspNetCore.Components.Test
}
[Fact]
public void FindCascadingParameters_ComponentRequestsDerivedType_ReturnsNull()
public void FindCascadingParameters_ComponentRequestsDerivedType_ReturnsEmpty()
{
// Arrange
var states = CreateAncestry(
@ -189,7 +189,7 @@ namespace Microsoft.AspNetCore.Components.Test
var result = CascadingParameterState.FindCascadingParameters(states.Last());
// Assert
Assert.Null(result);
Assert.Empty(result);
}
[Fact]
@ -211,7 +211,7 @@ namespace Microsoft.AspNetCore.Components.Test
}
[Fact]
public void FindCascadingParameters_TypeAssignmentIsInvalidForNullValue_ReturnsNull()
public void FindCascadingParameters_TypeAssignmentIsInvalidForNullValue_ReturnsEmpty()
{
// Arrange
var states = CreateAncestry(
@ -222,11 +222,11 @@ namespace Microsoft.AspNetCore.Components.Test
var result = CascadingParameterState.FindCascadingParameters(states.Last());
// Assert
Assert.Null(result);
Assert.Empty(result);
}
[Fact]
public void FindCascadingParameters_SupplierSpecifiesNameButConsumerDoesNot_ReturnsNull()
public void FindCascadingParameters_SupplierSpecifiesNameButConsumerDoesNot_ReturnsEmpty()
{
// Arrange
var states = CreateAncestry(
@ -237,11 +237,11 @@ namespace Microsoft.AspNetCore.Components.Test
var result = CascadingParameterState.FindCascadingParameters(states.Last());
// Assert
Assert.Null(result);
Assert.Empty(result);
}
[Fact]
public void FindCascadingParameters_ConsumerSpecifiesNameButSupplierDoesNot_ReturnsNull()
public void FindCascadingParameters_ConsumerSpecifiesNameButSupplierDoesNot_ReturnsEmpty()
{
// Arrange
var states = CreateAncestry(
@ -252,11 +252,11 @@ namespace Microsoft.AspNetCore.Components.Test
var result = CascadingParameterState.FindCascadingParameters(states.Last());
// Assert
Assert.Null(result);
Assert.Empty(result);
}
[Fact]
public void FindCascadingParameters_MismatchingNameButMatchingType_ReturnsNull()
public void FindCascadingParameters_MismatchingNameButMatchingType_ReturnsEmpty()
{
// Arrange
var states = CreateAncestry(
@ -267,11 +267,11 @@ namespace Microsoft.AspNetCore.Components.Test
var result = CascadingParameterState.FindCascadingParameters(states.Last());
// Assert
Assert.Null(result);
Assert.Empty(result);
}
[Fact]
public void FindCascadingParameters_MatchingNameButMismatchingType_ReturnsNull()
public void FindCascadingParameters_MatchingNameButMismatchingType_ReturnsEmpty()
{
// Arrange
var states = CreateAncestry(
@ -282,7 +282,7 @@ namespace Microsoft.AspNetCore.Components.Test
var result = CascadingParameterState.FindCascadingParameters(states.Last());
// Assert
Assert.Null(result);
Assert.Empty(result);
}
[Fact]

View File

@ -1,6 +1,8 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#nullable disable warnings
using System;
using System.Buffers;
using System.Diagnostics;

View File

@ -1,6 +1,8 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#nullable enable
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
@ -33,7 +35,7 @@ namespace Microsoft.Extensions.Internal
else
{
var count = 0;
foreach (object o in e)
foreach (object? o in e)
{
Add(o);
count++;
@ -55,14 +57,14 @@ namespace Microsoft.Extensions.Internal
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Add(string s)
public void Add(string? s)
{
var hashCode = (s != null) ? s.GetHashCode() : 0;
Add(hashCode);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Add(object o)
public void Add(object? o)
{
var hashCode = (o != null) ? o.GetHashCode() : 0;
Add(hashCode);