Reputation:
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 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.
Upvotes: 3
Views: 126
Reputation: 18068
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.
Upvotes: 6