I mean, I want to convert this:
string a = 24;
Convert.ChangeType(a, typeof(decimal?))
But it throws me an error.
UPDATE 1:
I’ve got a Type object where can be decimal?, int?, .. many nullable types. Then with the Type object, I need to convert the string value in type object.
You can’t do this since
Nullable<T>don’t implementIConvertable.You can do this although.
Might I also interest you in
TryParse?