How can I convert decimal? to decimal
问题 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 回答1: Try using the ?? operator: decimal? value=12; decimal value2=value??0; 0 is the value you want when the decimal? is null. 回答2: There's plenty of options... decimal? x = ... decimal a = (decimal)x; // works; throws if x was null decimal b = x ?? 123M; // works; defaults to 123M if x was null decimal c = x.Value; // works; throws if x was