Click here to Skip to main content
15,920,053 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Hi guys,

what is the meaning of String.Format("EXEC {1}}....)

thanks in advance!
Posted
Comments
walterhevedeich 28-Jul-11 5:05am    
There's no meaning at all. Post the whole line of code. It might make sense.

How can we tell?


Providing half a line of code, out of context and with no other tell-tale clues will not help.

Is there any more of it, or has your intellisense thrown a wobbly at that point.


Throw us a bone here!
 
Share this answer
 
Full details are on MSDN: String.Format method[^]

But in essence, String.Format takes a variable number of parameters (one or more) and returns a string made up from the various parts you give it.
It you pass it two or more parameters, the first one must be a string, and controls how the others are used. If any part of the string is enclosed in '{' and '}' then it refers to the other parameters, and will be substituted. Normally, the contents of the '{' and '}' pair is a numeric refenece by parameter number, satrtign from zero, but it can also contain formatting information for that parameter.

For example
String.Format("EXEC {0} /INDEX={1}", "ProgramName", 123);
would return a string:
"EXEC ProgramName /INDEX=123"
 
Share this answer
 
I think he's asking about the {1}

If that's the case, then take a look at the String.Format Method (String, Object)[^]

Hope it helps
 
Share this answer
 
Ah sorry, im asking about the EXEC
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900