Microsoft Tips for Dotnet Developers


TIP – 1

Visual Studio 2010 Tip : Set multiple projects as startup
This is not new in Visual Studio 2010. However this could be helpful while creating WCF based application.
You may like to test your application from Visual Studio 2010 by hitting F5. By default, we can make only one project as Startup Project. Select the solution and right click and select “set Startup Projects”

TIP -2
In .NET Framework 4.0 we have String.IsNullOrWhiteSpace.

String sData = ” “;
if (String.IsNullOrWhiteSpace(sData))
{
Console.WriteLine(“Nothing to do”);
}
This would help us to determine whether to work with a string without calling additional Trim() method.

TIP -3
VS 2010 Tip : Recent Projects > Start Page
As Visual Studio 2010 is built using WPF, the new enhanced start page also has some additional features.
>> Recent Projects
>>You can control the Recent Project List by Pin-UnPin the projects from existing list
>>Removing unnecessary projects from the list
>>We can also open the “Containing Folder”

TIP -4
>>Channel 9 Video : Performance Analyzer Tool of Visual Studio 2010

TIP -5

>> Code Analysis Using Visual Studio 2010

TIP -6
VS 2010 Tips : New Extension Manager
In Visual Studio 2010 we can now get all the available extensions from
visualstudiogallery and add to our project from and within Visual Studio. You will
find it under Tools > Extension Manager. Here you can add, search and modify the available extensions(for
eg: Triple Click)

TIP -7
>>Comparing Two SQL Server Schema using Visual Studio 2010

When you have two SQL Sever Databases and need to find the differences, Visual Studio comes really
handy.
Under Visual Studio 2010’s menu Data > Schema Compare. Once you choose New Schema Comparison
Then you choose your databases. After you choose it you can also set the Schema Compare Settings.
Once you press OK. It gives you the report.
Let’s suppose you have one additional column in your database, it shows something,

TIP -8
Zooming in the VS 2010 Editor
** Main Purpose is for presentation of Code.
There are several ways to zoom in and out:
1)Hold down Control and scroll your mouse wheel
2)To zoom your code editor or make your font code bigger user CTRL + SHIFT + >

and for smaller size CTRL + SHIFT + < 3)Type a zoom level directly in the the zoom control(dropdownlist) in the bottom left corner of the editor 4)Select a common zoom level from the dropdown list in the zoom control.

TIP -9
You can remove and sort unnecessary using statements Whenever I finish creating a class, I always
clean up the list of using statements that appear at the top of the class file. I like to remove any unused
using statements to reduce the amount of visual clutter in my classes. You can remove using statements that
are not required by your code by right-clicking the top of your code file, selecting the menu option “Organize
Usings”, and select “Remove and Sort”.

 TIP-10
 >>Indent Guides
If you want to Add the vertical lines at each indent level.
Tools –>Extension Manager–>Indent Guides

TIP – 11
?? operator (C#)(DOUBLE QUESTION MARK operator)
The ?? operator returns the left-hand operand if it is not null, or else it returns the right operand.
For example:
int? x = null;
// y = x, unless x is null, in which case y = -1.
int y = x ?? -1;
The ?? operator also works with reference types:
//message = param, unless param is null
//in which case message = “No message”
string message = param ?? “No message”;
Eg:
int? x = null;
int y = x ?? -1;
int? i = 10;
int j = i ?? -1;
//The ?? operator also works with reference types:
string strMsg = null;

string message = strMsg ?? “N/A”;
string Msg = “Yes”;
string msg = Msg ?? “N/A”;

TIP – 12
Moving code around in application
You observed that some code is frequently used in entire appliation. Then Give some name to that code and
you can drag and drop in ToolBox itself(In Code Behind Itself).Thenafter you can use that code in all pages of your site wherever you required.
Note: keyboard shortcut key to copy a method
Place a cursor inside a method anywhere and press CTRL+M+M and next press CTRL+C to copy a method.

TIP – 13
Visual Studio 2010 : Editor now supports clickable URL
In Visual Studio 2010 you can have URLs which you may click just like MS Word. This ULR clicking supported in
normal String declaration and comments as well.

New features in Visual Studio 2010 Service Pack 1 for the ASP.NET developers:
————————————————————————————————
1)Silverlight 4 support
2)HTML5 and CSS3 support
3)Debugging with IntelliTrace:
When a developer needs a deeper understanding of code execution, IntelliTrace offers a way to “turn up the
dial” to collect the complete execution history of an application.
4)Razor syntax Support:
This new Razor syntax is used by ASP.NET Web Pages and by ASP.NET MVC 3.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s