Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
DamianEdwards committed Mar 24, 2022
1 parent 0a43280 commit 9a70e9e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/MinimalApis.Extensions/Binding/FormOfT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,13 @@ private static void Transform(IFormCollection form, Utf8JsonWriter jsonWriter)
jsonWriter.WriteNullValue();
}
// TODO: Handle different number types, e.g. long, double, etc.
else if (char.IsDigit(values, 0) && int.TryParse(values, out var number))
else if (int.TryParse(values, out var number))
{
jsonWriter.WriteNumberValue(number);
}
else if (string.Equals(values, bool.TrueString, StringComparison.OrdinalIgnoreCase)
|| string.Equals(values, bool.FalseString, StringComparison.OrdinalIgnoreCase))
else if (bool.TryParse(values, out var boolean))
{
jsonWriter.WriteBooleanValue(bool.Parse(values));
jsonWriter.WriteBooleanValue(boolean);
}
else if (DateTime.TryParseExact(values, "O", CultureInfo.InvariantCulture, DateTimeStyles.None, out var dateTime))
{
Expand Down

0 comments on commit 9a70e9e

Please sign in to comment.