may be it is a simple question but I\'m try all of conversion method! and it still has error! would you help me?
decimal? (nullable decimal) to decimal
You don't need to convert a nullable type to obtain its value.
You simply take advantage of the HasValue and Value properties exposed by Nullable
.
For example:
Decimal? largeValue = 5830.25M;
if (largeValue.HasValue)
{
Console.WriteLine("The value of largeNumber is {0:C}.", largeValue.Value);
}
else
{
Console.WriteLine("The value of largeNumber is not defined.");
}
Alternatively, you can use the null coalescing operator in C# 2.0 or later as a shortcut.