diff --git a/csharp/Platform.Reflection.Tests/NumericTypeTests.cs b/csharp/Platform.Reflection.Tests/NumericTypeTests.cs index 739b055..82c2f35 100644 --- a/csharp/Platform.Reflection.Tests/NumericTypeTests.cs +++ b/csharp/Platform.Reflection.Tests/NumericTypeTests.cs @@ -9,5 +9,23 @@ public void UInt64IsNumericTest() { Assert.True(NumericType.IsNumeric); } + + [Fact] + public void NullableIntCanBeNumericTest() + { + Assert.True(NumericType.CanBeNumeric); + } + + [Fact] + public void NullableDoubleCanBeNumericTest() + { + Assert.True(NumericType.CanBeNumeric); + } + + [Fact] + public void NullableBoolCanBeNumericTest() + { + Assert.True(NumericType.CanBeNumeric); + } } } diff --git a/csharp/experiments/NullableTest.cs b/csharp/experiments/NullableTest.cs new file mode 100644 index 0000000..b5a2b93 --- /dev/null +++ b/csharp/experiments/NullableTest.cs @@ -0,0 +1,22 @@ +using System; +using Platform.Reflection; + +class Program +{ + static void Main() + { + Console.WriteLine($"int? CanBeNumeric: {NumericType.CanBeNumeric}"); + Console.WriteLine($"int? IsNumeric: {NumericType.IsNumeric}"); + Console.WriteLine($"int? IsNullable: {NumericType.IsNullable}"); + Console.WriteLine($"int? UnderlyingType: {NumericType.UnderlyingType}"); + + Console.WriteLine($"double? CanBeNumeric: {NumericType.CanBeNumeric}"); + Console.WriteLine($"double? IsNumeric: {NumericType.IsNumeric}"); + + Console.WriteLine($"bool? CanBeNumeric: {NumericType.CanBeNumeric}"); + Console.WriteLine($"bool? IsNumeric: {NumericType.IsNumeric}"); + + Console.WriteLine($"string? CanBeNumeric: {NumericType.CanBeNumeric}"); + Console.WriteLine($"string? IsNumeric: {NumericType.IsNumeric}"); + } +} \ No newline at end of file diff --git a/csharp/experiments/NullableTypeTest/NullableTypeTest.csproj b/csharp/experiments/NullableTypeTest/NullableTypeTest.csproj new file mode 100644 index 0000000..eca2e86 --- /dev/null +++ b/csharp/experiments/NullableTypeTest/NullableTypeTest.csproj @@ -0,0 +1,14 @@ + + + + + + + + Exe + net8.0 + enable + enable + + + diff --git a/csharp/experiments/NullableTypeTest/Program.cs b/csharp/experiments/NullableTypeTest/Program.cs new file mode 100644 index 0000000..40ad1b7 --- /dev/null +++ b/csharp/experiments/NullableTypeTest/Program.cs @@ -0,0 +1,16 @@ +using System; +using Platform.Reflection; + +Console.WriteLine($"int? CanBeNumeric: {NumericType.CanBeNumeric}"); +Console.WriteLine($"int? IsNumeric: {NumericType.IsNumeric}"); +Console.WriteLine($"int? IsNullable: {NumericType.IsNullable}"); +Console.WriteLine($"int? UnderlyingType: {NumericType.UnderlyingType}"); + +Console.WriteLine($"double? CanBeNumeric: {NumericType.CanBeNumeric}"); +Console.WriteLine($"double? IsNumeric: {NumericType.IsNumeric}"); + +Console.WriteLine($"bool? CanBeNumeric: {NumericType.CanBeNumeric}"); +Console.WriteLine($"bool? IsNumeric: {NumericType.IsNumeric}"); + +Console.WriteLine($"string? CanBeNumeric: {NumericType.CanBeNumeric}"); +Console.WriteLine($"string? IsNumeric: {NumericType.IsNumeric}");