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. 2 4011
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
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. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Bob |
last post by:
I'm having trouble the string.Format() throwing exceptions and I can't figure
out what I am doing wrong.
Given the following setup code:
string str = { "one", "two", "three", "four" };
double...
|
by: Alpha |
last post by:
Hi, I'm maintaining C# code and am fairly new with C# programming. I'm
looking for codes that's droping the 2nd digit of a nuber printed out and I
suspect it's the code below. Can someone tell me...
|
by: Dominique Vandensteen |
last post by:
after the very small & vs string.format discussion I did some speed tests...
loop of 1.000.000 concatenations of 5 public string variables in a class
gave following results:
result = a & b...
|
by: David Morris |
last post by:
Hi
Could somebody please explain what the following line of code means
String.Format("{0}\{1}.{2:00}", C:\, myfile.txt, 1
It's actually the first argument that I don't understand. What is...
|
by: nobody |
last post by:
I know that given a FormatString and a DateTime you can use
DateTime.ToString(...) to convert the DateTime to a String. My question is
how can you turn that around? Given a String and a...
|
by: L. Scott M. |
last post by:
Have a quick simple question:
dim x as string
x = "1234567890"
-------------------------------------------------------
VB 6
dim y as string
|
by: AMP |
last post by:
Hello,
I want to add some variables to a string and this isnt working.
textBox1.Text="'BSL version='+ bslVerHi+ bslVerLo";
What am I doing wrong?
Thanks
Mike
|
by: Lucky |
last post by:
hi guys!
back again with another query.
the problem is like this.
i want to print a line like this:
"---------------------------------------------"
the easiest way is to simply assign it to...
|
by: shawrie |
last post by:
Hello everyone can anyone please help me?
I basically want to set the length of a string variable to help
spacing my simple report out.
i tried
dim test as string(14)
but it didnt like that
|
by: jpenguin |
last post by:
I'm doing a simple program to learn java. I have the input and math parts right. It just isn't displaying right. It outputs a list of about 11 things-- with the format "string $ xx.xx"
In each...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |