Fix parsing nullable parameters
This commit is contained in:
Родитель
90c5ac3a13
Коммит
86b652ec45
|
@ -13,6 +13,7 @@
|
|||
<Button Text="Navigate with float" OnClick="NavigateWithFloat"></Button>
|
||||
<Button Text="Navigate with decimal" OnClick="NavigateWithDecimal"></Button>
|
||||
<Button Text="Navigate with Guid" OnClick="NavigateWithGuid"></Button>
|
||||
<Button Text="Navigate with Nullable<Guid>" OnClick="NavigateWithNullableGuid"></Button>
|
||||
<Button Text="Navigate with Bool" OnClick="NavigateWithBool"></Button>
|
||||
</StackLayout>
|
||||
</ScrollView>
|
||||
|
@ -29,5 +30,6 @@
|
|||
async Task NavigateWithFloat() => await NavigationManager.NavigateToAsync("/float/55.43");
|
||||
async Task NavigateWithDecimal() => await NavigationManager.NavigateToAsync("/decimal/55.43");
|
||||
async Task NavigateWithGuid() => await NavigationManager.NavigateToAsync($"/guid/{Guid.NewGuid()}");
|
||||
async Task NavigateWithNullableGuid() => await NavigationManager.NavigateToAsync($"/nullable-guid/{Guid.NewGuid()}");
|
||||
async Task NavigateWithBool() => await NavigationManager.NavigateToAsync("/bool/true");
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
@page "/float/{Float}"
|
||||
@page "/decimal/{Decimal}"
|
||||
@page "/guid/{Guid}"
|
||||
@page "/nullable-guid/{NullableGuid}"
|
||||
@page "/bool/{Bool}"
|
||||
|
||||
<ContentPage>
|
||||
|
@ -23,6 +24,7 @@
|
|||
<Label Text="@($"Float = {Float}")"></Label>
|
||||
<Label Text="@($"Decimal = {Decimal}")"></Label>
|
||||
<Label Text="@($"Guid = {Guid}")"></Label>
|
||||
<Label Text="@($"Guid? = {NullableGuid}")"></Label>
|
||||
<Label Text="@($"Bool = {Bool}")"></Label>
|
||||
</StackLayout>
|
||||
</ContentPage>
|
||||
|
@ -37,6 +39,7 @@
|
|||
[Parameter] public float Float { get; set; }
|
||||
[Parameter] public decimal Decimal { get; set; }
|
||||
[Parameter] public Guid Guid { get; set; }
|
||||
[Parameter] public Guid? NullableGuid { get; set; }
|
||||
[Parameter] public bool Bool { get; set; }
|
||||
|
||||
|
||||
|
|
|
@ -199,6 +199,8 @@ namespace Microsoft.MobileBlazorBindings.Core
|
|||
{
|
||||
bool success;
|
||||
|
||||
type = Nullable.GetUnderlyingType(type) ?? type;
|
||||
|
||||
if (type == typeof(string))
|
||||
{
|
||||
result = s;
|
||||
|
|
Загрузка…
Ссылка в новой задаче