468,554 Members | 1,056 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,554 developers. It's quick & easy.

String.Format

san
Hello, all! I have question about String.Format method.

There are two variants: public static string Format(string, params
object[]); and public static string Format(IFormatProvider, string, params
object[]);

What happens if i will use String.Format("{0} and {1}", "one", "two")
instead of String.Format(System.Globalization.CultureInfo.Cur rentCulture,
"{0} and {1}", "one", "two")?

What differense between these two methods?

Then i use FxCop i have a lot of errors with this resolution: "The call to
'String.Format(String format, Object arg0)' does not explicitly provide
IFormatProvider. This should be replaced with a call to an overload that
does: String.Format(IFormatProvider provider, String format, Object[] args)"

Is this really Critical?

Thanks alot, Alex.
Aug 11 '05 #1
2 3759
san wrote:
There are two variants: public static string Format(string, params
object[]); and public static string Format(IFormatProvider, string, params
object[]);

What happens if i will use String.Format("{0} and {1}", "one", "two")
instead of String.Format(System.Globalization.CultureInfo.Cur rentCulture,
"{0} and {1}", "one", "two")?

What differense between these two methods?
None :-)
Then i use FxCop i have a lot of errors with this resolution: "The call to
'String.Format(String format, Object arg0)' does not explicitly provide
IFormatProvider. This should be replaced with a call to an overload that
does: String.Format(IFormatProvider provider, String format, Object[] args)"

Is this really Critical?


It may not be critical, but it's nevertheless an important thing to
understand. I have searched Google and found an article for you that
explains things quite nicely:

http://www.boyet.com/Articles/Specif...tProvider.html

Oliver Sturm
--
omnibus ex nihilo ducendis sufficit unum
Spaces inserted to prevent google email destruction:
MSN oliver @ sturmnet.org Jabber sturm @ amessage.de
ICQ 27142619 http://www.sturmnet.org/blog
Aug 11 '05 #2
Hi,

The IFormatProvider should be used when your application uses globalization
and different cultures.

In FXCop, you can disable this rule, so that it does not give any error if
you are not providing this parameter.
--
Saravanan K V
"san" wrote:
Hello, all! I have question about String.Format method.

There are two variants: public static string Format(string, params
object[]); and public static string Format(IFormatProvider, string, params
object[]);

What happens if i will use String.Format("{0} and {1}", "one", "two")
instead of String.Format(System.Globalization.CultureInfo.Cur rentCulture,
"{0} and {1}", "one", "two")?

What differense between these two methods?

Then i use FxCop i have a lot of errors with this resolution: "The call to
'String.Format(String format, Object arg0)' does not explicitly provide
IFormatProvider. This should be replaced with a call to an overload that
does: String.Format(IFormatProvider provider, String format, Object[] args)"

Is this really Critical?

Thanks alot, Alex.

Aug 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Bob | last post: by
7 posts views Thread by Alpha | last post: by
3 posts views Thread by Dominique Vandensteen | last post: by
4 posts views Thread by David Morris | last post: by
38 posts views Thread by nobody | last post: by
7 posts views Thread by L. Scott M. | last post: by
5 posts views Thread by AMP | last post: by
8 posts views Thread by Lucky | last post: by
3 posts views Thread by shawrie | last post: by
5 posts views Thread by jpenguin | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by UniDue | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.