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 Cancel reply
Top Posts
- LINQ To SQL Tutorial
- LINQ To SQL Join On Multiple Conditions
- Code Sample: Programmatically Download File Using C#
- Windows 7 Control Panel In Classic Mode
- More Details Emerge On Microsoft Master Certification
- Use SqlConnection With LINQ To SQL
- Free Icons And Images With Visual Studio 2008
- Capture XML In WCF Service
- Dynamic Sort With LINQ
- StyleCop Tutorial
Tags
.Net 2010 ADO.NET ASP.NET Azure Blogging Books Browsers C# Certification Cloud Computing Code Snippets Community Data Services Eclipse Entity Framework Google IDE Java LINQ Mac Microsoft Museum NetBeans Office Oracle REST SharePoint Silverlight SQL Server T-SQL Tips Tools Training Visual Studio Visual Studio 2010 WCF Web Windows Windows 7 Windows Forms Windows Live WMI WPF XAML



yeah that’s neat, another little time saver….”Add to existing File” shouldn’t be an option though :-)