开发者

Do these formatting conventions mean something?

开发者 https://www.devze.com 2023-02-08 01:59 出处:网络
String.Format(\"{0:d}\", item.ReleaseDate) In the above code \'d\' is used for location holder for item.ReleaseDate
String.Format("{0:d}", item.ReleaseDate)

In the above code 'd' is used for location holder for item.ReleaseDate

Whereas in

String.Format("{0:c}", item.Price)

'c' is used for开发者_StackOverflow社区 placeholder for item.Price.

Are there any constraints that only d should be used for DateTime and c should be used for price?

Pardon me am a noob in technical conventions. Please correct me in the conventions too.


d for decimal, c for currency in your example. Meaning can be changed depending on the variable that will be used in place of the placeholder

http://sharpertutorials.com/string-formatting/

And, these conventions are very much language specific. Rules of one language may not be valid for others.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号