hi friends,
i got a problem
when i do the following operation.
String.Format("{CN={1}}","hello");
this is giving error while execution.String not in proper format.
but the following thing works, fine
String.Format("{0}CN={1}(2}","{","hello","}");
Is, their any better way to do the above operation.Like, is their any escape sequence for {.
Any suggestions,
Ranu.

problem with String.Format function.
Ananda Ganesh
Thanks for your reply.
its working fine with my application.
can you explain more on this.
Thanks and Ragrds
Ranadheer
daydreamsy2k
String.Format("{CN={1}}","hello");
failed because of two things - firstly a missing { bracket, and secondly it is using {1} it should use {0} as there wasnt a second string paramater - it would fail on an array out of bounds exception if you like!
Hope that helps
Ross
Kris Nye
try this:
String
.Format("{{CN={0}}}", "hello");while you're at it, pass in a format provider.
String
.Format(System.Globalization.CultureInfo.CurrentCulture, "{{CN={0}}}", "hello"); // culture specific StringString.Format(System.Globalization.CultureInfo.InvariantCulture, "{{CN={0}}}", "hello"); // invariant string
Hope that helps.
shitbhar
Hi, ranadheer
Here I found two useful links about how to use String.Format method: http://blogs.msdn.com/kathykam/archive/2006/03/29/564426.aspx
http://blog.stevex.net/index.php/string-formatting-in-csharp/
Enjoy it!
Thanks
mobigital