Wednesday, October 13, 2010

And for today’s cheatsheet, another String Format sheet for ya…

Blackwasp - .NET Formatting Reference Sheet

“Various native .NET framework types include an overloaded version of the ToString method that accepts a format string. This reference sheet provides a list of standard formats and custom format specifiers for numeric types, DateTimes, GUIDs and enums.

Reference Sheet

This reference sheet contains the available standard format codes and custom format specifiers for several standard .NET framework types. Standard and custom formatting codes are provided for the numeric types, with examples for integers and doubles. The standard and custom formats for DateTime values are included, as are the format options for Globally Unique Identifiers and enumerations. All of these format codes are for use with the ToString method.”

I’ve seen this cheatsheet referenced quite a bit in the last couple days, but I thought it a different enough from than the last one I blogged about, Can’t remember the .Net String Formats? Always seem to have to search for them? Here’s a cheatsheet just for you…, so wanted to capture it for future reference.

Note: All the cheat sheets, searching, etc for this information, leads me to think that Microsoft could really help us all a good bit if they made these magic strings easier to find. Or changed the Intellisense, quick tips, etc. to expose them in some way. Now I don’t want hard-coded enums or anything like but, just a simpler method of discovery and usage. No one can remember all these, and everyone searches for them, so there’s an opportunity here to address a very common pain point…

I wonder if this is something that could be addressed via a VS Extension? Hum….

Here’s some snaps of the PDF;

image

image

(via DotNetKicks - .NET Formatting Reference Sheet)

 

Related Past Post XRef:
Can’t remember the .Net String Formats? Always seem to have to search for them? Here’s a cheatsheet just for you…

No comments: