字符串格式覆盖 [英] string Format overrides

查看:68
本文介绍了字符串格式覆盖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么String.Format有覆盖:


格式(字符串,对象)

格式(字符串,对象,对象)

格式(字符串,对象,对象,对象)

格式(字符串,参数对象[])


不是最后一个覆盖前三个?

Why does String.Format have overrides of:

Format(string, object)
Format(string, object, object)
Format(string, object, object, object)
Format(string, params object[])

doesn''t the last one cover the first three?

推荐答案

你好约翰,


在最后一个案例中你需要迭代对象列表。这可以

有点烦人


JVWy为什么String.Format有覆盖:

JV>

JVFormat(字符串,对象)

JVFormat(字符串,对象,对象)

JVFormat(字符串,对象,对象,对象)

JVFormat(字符串,params对象[])

JVdoesn不是最后一个覆盖前三个?

JV>

- -

WBR,Michael Nemtsev [C#MVP]。

我的博客: http://spaces.live.com/laflour

团队博客: http://devkids.blogspot.com/

我们大多数人面临的最大危险不是我们的目标太高了,我们想念它,但它太低了,我们就达不到它了。 (c)米开朗基罗
Hello John,

in the last case u need to iterate throught the list of objects. This can
be a little annoying

JVWhy does String.Format have overrides of:
JV>
JVFormat(string, object)
JVFormat(string, object, object)
JVFormat(string, object, object, object)
JVFormat(string, params object[])
JVdoesn''t the last one cover the first three?
JV>
---
WBR, Michael Nemtsev [C# MVP].
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


John Vottero写道:
John Vottero wrote:

为什么String.Format有覆盖:


格式(字符串,对象)

格式(字符串,对象,对象)

格式(字符串,对象,对象,对象)

格式(字符串,参数对象[])


不是最后一个覆盖前三个吗?
Why does String.Format have overrides of:

Format(string, object)
Format(string, object, object)
Format(string, object, object, object)
Format(string, params object[])

doesn''t the last one cover the first three?



前三个用于表现原因。要调用第四个

,代码必须创建一个Array对象来处理属性。


-

G?跑了安德森

_____
http://www.guffa.com


" Michael Nemtsev" < ne ***** @ msn.com写信息

新闻:a2 ************************* **@msnews.microsof t.com ...
"Michael Nemtsev" <ne*****@msn.comwrote in message
news:a2***************************@msnews.microsof t.com...

你好约翰,


在最后一种情况下你需要迭代对象列表。这可以

有点讨厌
Hello John,

in the last case u need to iterate throught the list of objects. This can
be a little annoying



你的意思是Format必须迭代对象吗?如果是这样的话,无论如何它都有

因为前三个只是创建一个数组并将其传递给

第四个。

Do you mean that Format has to iterate through the objects? If so, it has
to anyway because the first three just create an array and pass it to the
fourth one.


>

JVWhy String.Format是否覆盖:

JVJVFormat(字符串,对象)

JVFormat(字符串,对象,对象)

JVFormat(字符串,对象,对象,对象)

JVFormat(字符串,参数对象[])

JVdoesn''最后一个覆盖前三个?

JV ---

WBR,Michael Nemtsev [C#MVP]。我的博客: http://spaces.live.com/laflour

团队博客: http://devkids.blogspot.com/


对我们大多数人来说,最大的危险并不是我们的目标太高而且我们错过了b
错过了它,但它太低了我们达到了它 ; (c)米开朗基罗

>
JVWhy does String.Format have overrides of:
JVJVFormat(string, object)
JVFormat(string, object, object)
JVFormat(string, object, object, object)
JVFormat(string, params object[])
JVdoesn''t the last one cover the first three?
JV---
WBR, Michael Nemtsev [C# MVP]. My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo



这篇关于字符串格式覆盖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆