|
Visual Studio 2010 Code Generation With Intellisense
Visual Studio 2010 provides a nifty little feature which let’s you generate code from within the editor. In this post I will show you how to use this feature. Imagine that you are having a fantastic coding day and you are coding at 100mph. You have just realised that you need a class called car and you want to do it ninja style. Just type in this.
Visual studio displays Car in red because it cannot find a Type named Car. Put your cursor on Car and hit Ctrl + .
The smart tag gives you two options:
- Generate class for ‘Car’
- Generate new type…
If you select the first option, a new class is created for you in a new file and appropriately named Car.
The second option which is “Generate new type…” gives you more control over the code which will be generated.
In the dialog box you can choose Access (public or private) and you can also select if you’d like to generate a class, struct, interface or an enum. An option also exists down below to either add the newly generated code to an existing file or create a new file.
Pretty neat I think.
One Response to “Visual Studio 2010 Code Generation With Intellisense”
Leave a Reply
Get Updates By Email
Popular Post
- LINQ To SQL Tutorial
- LINQ To SQL Join On Multiple Conditions
- Code Sample: Programmatically Download File Using C#
- Free Icons And Images With Visual Studio 2008
- Windows 7 Control Panel In Classic Mode
- Dynamic Sort With LINQ
- Use SqlConnection With LINQ To SQL
- StyleCop Tutorial
- Write To Vista Event Log Using C#
- More Details Emerge On Microsoft Master Certification
Tag Cloud
Code Snippets
- Get Current Windows User In C#
- Get Width And Height Of Image In C#
- Get Windows Registry Size With WMI And C#
- Reverse Array Elements Using C#
- Convert Hexadecimal To Number In C#
- Get Free Disk Space Using T-SQL
- SQL Server 2008 – Get All Indexes In A Database
- Get Name Of Current Executing Assembly In C#
- Get CD Or DVD Drive Information Using WMI And C#
- Get Last Row From Table Using LINQ To SQL



May 28th, 2010 at 8:46 am
yeah that’s neat, another little time saver….”Add to existing File” shouldn’t be an option though :-)