S
senfo
I'm trying to pass a Nullable type as a parameter to the TryParse()
method (both int and float types) and I'm not having any luck. I've
tried casting as well as passing just the T.Value property; however,
doing this generated a compiler error indicating that it's not possible
to pass a property as an out or ref parameter.
Other than using a temporary (non-nullable) variable, I haven't been
able to come up with a solution.
Example:
int? MyInt;
if (!TryParse("123", out MyInt))
[...]
Any ideas?
Thank you in advance,
method (both int and float types) and I'm not having any luck. I've
tried casting as well as passing just the T.Value property; however,
doing this generated a compiler error indicating that it's not possible
to pass a property as an out or ref parameter.
Other than using a temporary (non-nullable) variable, I haven't been
able to come up with a solution.
Example:
int? MyInt;
if (!TryParse("123", out MyInt))
[...]
Any ideas?
Thank you in advance,