Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Commit

Permalink
Fix ConvertValue in QueryStringParameterExtensions (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
ligowsky authored Apr 24, 2024
1 parent 27490e4 commit 678cabe
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.WebUtilities;
using Microsoft.Extensions.Primitives;
using System.Globalization;
using System.ComponentModel;
using System.Reflection;

namespace BitzArt.Blazor.MVVM;
Expand Down Expand Up @@ -35,9 +35,9 @@ public static void SetParametersFromQueryString<T>(this T component, NavigationM
}
}

private static object ConvertValue(StringValues value, Type type)
private static object? ConvertValue(StringValues value, Type type)
{
return Convert.ChangeType(value[0], type, CultureInfo.InvariantCulture)!;
return TypeDescriptor.GetConverter(type).ConvertFromString(value[0]!);
}

private static PropertyInfo[] GetProperties<T>()
Expand Down

0 comments on commit 678cabe

Please sign in to comment.