Archive for category Visual Studio 2015

How to find the installed location of svcutil.exe of VisualStudio in your machine

In this article I am going to explain an option to find the installer location of svcutil.exe in each machine. Usually the location of svcutil.exe depends on the Visual Studio installation location and Visual Studio version which you installed. So normally the links which you will find in one machine may or may not work for other machines.

Your best option to get the location of svcutil.exe is to use the VisualStudio Command Prompt and then use the command “where svcutil.exe”

Please follow the below steps for Visual Studio 2010( Mostly the path will be same for other versions of visual studio)

  • Start
  • All Programs
  • Select Microsoft Visual Studio 2010
  • Visual  Studio Tools
  • Visual Studio Command Prompt(2010)

when you select the above option you will get a window like given below and to that you need to type “where svcutil.exe

Press Enter after putting in the command and you will get the details listed out in command prompt.


, ,


Null Conditional Operator in C# 6.0


In this article I am going to explain about one of the new feature introduced with C# 6.0 – Null Conditional Operator.


Null reference is one of the common exception which normally faced by most of the developers if you didn’t handled by adding proper checking for null values in code.

To resolve this null reference exception till now what we did was to add proper check condition for null values in code like given below

string firstname = null;
//Check if Firstname is null or not 
if(firstname != null)
     string res = firstname.Substring(0, 4);

Even though above code will works fine, we need to add additional code like if condition and all to safeguard the code from null reference exception. Wouldn’t it be nice if you have a single line of code which actually checks for null condition and the handles it.

With C# 6.0 they introduced a new operator called Null Conditional Operator (?). This will handles the above line of code in a single statement like given below

string firstname = null;
//Handle the null case using the operator(?) this wont throw null reference exception
string res = firstname?.Substring(0, 4);

Internally what the null conditional operator do is it will check for null before calling the following methods and if there is any null value the code execution will won’t proceed further and return the null value which subsequently stop the null reference exception from occurring.

Ex: In below code

string res = firstname?.Substring(0, 4);

Null conditional operator first check for null values in firstname and it will call the following method Substring method only if firstname is not null.

A word of caution while using null conditional operator is that you need to ensure that the variable you are assigning the result will be of nullable type


The below code will throw an exception

DataTable dttable = new DataTable();
dttable = null;
int rowcount = dttable?.Rows.Count;

You need to make it nullable using nullableint to resolve the issue

DataTable dttable = new DataTable();
dttable = null;
int? rowcount = dttable?.Rows.Count;

, , , ,

Leave a comment