Perhaps you have experience the 'Magic Moment' (to use Disney lingo), when you were coding in C# and you needed a switch statement. If you had an enumeration defined already and the switch statement was using a variable of that enumeration type. Then almost like magic the body of the switch statement was filled out with case statements for each of the enumerations.
Up to that point the Snippets felt like just a cool way to insert common boilerplate code. Well unfortunately that is pretty much still the case. The reason is that in order to get this functionality you must use a xml tag "Function" in your snippet definition. But that is the end of the line. No doubt the "Function" element in the future will support more but right now it supports only the three functions "GenerateSwitchCases", "ClassName" and "SimpleTypeName".
"GenerateSwitchCases" not surprisingly generates the cases for the switch statement.
"ClassName" returns the name of the class that is currently in scope.
"SimpleTypeName" tries to simplify the name subject to the context where the snippet is invoked.
Nothing else is available.
No comments:
Post a Comment