zondag, september 24, 2006


VS2005 - template versus snippets

I'm using codesnippets a lot, also for instant building of our own custom classes (inheritance, bunch of overloads and methods) Now I remembered that it is also possible to create custom templates. For class templates this is a bit more faster because by selecting your custom template (add new item...) you can modify your template so it will fill in the namespace and class name automatically.

Class structure - > use templates
properties/methods -> use snippets

Possible parameters (put into your template like this: $myparam$)
The user-provided name from the dialog. This value is often used for naming classes and files.
The same as itemname but with all unsafe characters removed.
The name of the root item, which can be used for multi-item templates. For example, if you have partial classes, or a code-beside or code-behind scenario, you can use this item in the secondary files when you need the safeitemname of the main item being created.
The user-provided name of the project for a project template.
The user-provided name of the project for a project template with all unsafe characters removed.
The root namespace of the project for an item template, which can be used to replace the namespace in a project item source file.
A GUID that can be used as a unique identifier for uses such as project GUID in the project file. You can specify up to 10 different GUID parameters using the syntax: guidx, where x is a number between 1 and 10.
The current time in the format DD/MM/YYYY HH:MM:SS.
The current four-digit year.
The Windows username of the logged-in user.
The Windows domain of the logged-in user.
The name of the machine where the template is being used.
The version of the common language runtime being used.
The registered organization of the user based on the system settings.
A single string that can be any XML or string data included in the WizardData element in a template metadata file.

how to refs:

Comments: Een reactie posten

Links to this post:

Een link maken

<< Home