关于全球化Convert.ToString方法和Object.ToString()之间的区别 [英] Difference between Convert.ToString Method and Object.ToString() with regard to Globalization

查看:298
本文介绍了关于全球化Convert.ToString方法和Object.ToString()之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有用C#.net以外的其他如何将这些处理空值Convert.ToString方法和Object.ToString()之间的差异。 有可能是在全球化视野下,两者之间存在差异。

Is there any difference between Convert.ToString Method and Object.ToString() in C#.net other than how these handle null value. There could be some difference between the two in Globalization Perspective.

推荐答案

YES和NO。

例如, Convert.ToString(INT)的方法,是相同的 Int32.ToString()方法,如在备注部分 MSDN规定:这个实现是相同的Int32.ToString()。的不过,转换类还提供覆盖其采取的IFormatProvider 作为第二个参数(如 转换。的ToString(整型,IFormatProvider的) 的),并且这可以用来调整输出格式,例如通过传递的CultureInfo 实例。

For example, the Convert.ToString(int) method, is identical to the Int32.ToString() method, as MSDN states in the 'Remarks' section: "This implementation is identical to Int32.ToString()." However, the Convert class also offers overrides which take an IFormatProvider as a second parameter (e.g. Convert.ToString(int, IFormatProvider)), and this can be used to adjust the output format, e.g. by passing a CultureInfo instance.

这篇关于关于全球化Convert.ToString方法和Object.ToString()之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆