Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道标题中的两种方法之间是否有任何区别?
string str = "14.75"; Console.WriteLine(Decimal.Parse(str)); Console.WriteLine(Convert.ToDecimal(str));
谁能告诉我?谢谢。
Decimal.Parse只支持解析字符串值,同时Convert也接受其他类型,如对象int、、byte等DateTime。
Decimal.Parse
Convert
int
byte
DateTime