Suppress the warning messages in Visual Studio

Sometimes we might have seen the warning message when we build the solution. These warning won't stop your application execution in fact these are most useful to preventing the defects.
In order to suppress this warning message we need to use the pre-processor directives i.e., "#pragma warning".
Example : As shown in the below image , the variable count is assigned and didn't used that value any where. When we build the project able to see a warning in the Error List window.

To overcome this warning we need to define the pragma warning pre-processor directive to the variable as shown below.

#pragma warning disable
  int count = 1;
#pragma warning resotre

Hope this article helped you to supress the warnings in visual studio :-)


Popular posts from this blog

How to hide bootStrap popover when user click(s) outside the popover?

Exporting to excel from a custom class object using C#.NET

Get the Clicked Cell Value and Column Name of GridView in ASP.NET