嗨,大家好,String.Format(" EXEC {1}",...)的含义是什么 [英] hi guys what is the meaning of String.Format("EXEC {1}",...)
本文介绍了嗨,大家好,String.Format(" EXEC {1}",...)的含义是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
String.Format("EXEC {1}} .....)
是什么意思
Hi guys,
what is the meaning of String.Format("EXEC {1}}....)
thanks in advance!
推荐答案
我们怎么知道?
在没有上下文的情况下仅提供半行代码,并且没有其他任何有说服力的线索将无济于事.
还有更多的东西了吗?或者您的智商在这一点上摇摆不定.
在这里给我们扔个骨头!
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!
有关MSDN的完整详细信息: ^ ]
但本质上,String.Format接受可变数量的参数(一个或多个),并返回由您提供的各个部分组成的字符串.
您向它传递两个或多个参数,第一个必须是字符串,并控制如何使用其他参数.如果字符串的任何部分包含在"{"和}"中,则它引用其他参数,并将被替换.通常,"{"和}"对的内容是由参数编号(从零开始饱和)的数字引用,但是它也可以包含该参数的格式信息.
例如
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);
将返回一个字符串:
"EXEC ProgramName /INDEX=123"
我认为他正在询问{1}
在这种情况下,请查看 String.Format方法(字符串,对象) [ ^ ]
希望对您有帮助
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
这篇关于嗨,大家好,String.Format(" EXEC {1}",...)的含义是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文