I want to create a Blazor(wasm) InputNumber<T>
component where T : INumber<T>
.
Inside this component I have a simple function to set the Value:
this compiles good
void SetValue(T? value)
{
if (value is null)
{
....
}
....
}
but when I try to call SetValue(null)
the compiler says:
CS1503: "cannot convert from
<null>
toT?
"
I was expecting that if the method parameter is T?
then I should be able to pass null
to it.
e.g.
void SetDecimal(decimal? value)
{
if (value is null)
{
...
}
}
This of course works: SetDecimal(null);
What am I missing?