In C#, there are several ways to convert a decimal to a double. Here are the most common approaches:
1. Explicit Cast (Recommended)
decimal dec = 123.456m;
double dbl = (double)dec;
This is the most straightforward and idiomatic way.
2. Convert.ToDouble()
decimal dec = 123.456m;
double dbl = Convert.ToDouble(dec);
Internally this does the same as the explicit cast, but it is useful if you re working with object or IConvertible types.
3. decimal.ToDouble() (static method)
decimal dec = 123.456m;
double dbl = decimal.ToDouble(dec);
This is the most explicit and readable option. it clearly states the source and target types.