Articles → CSHARP → Use Pragma To Supress Complier Warning In C#Use Pragma To Supress Complier Warning In C#At some point of time or other, a programmer encounters compiler warning. For example if I create a property and add an attribute ‘Obsolete’ above the property then a compiler issues a warning (see the following screen shot)Click to EnlargePragma By using pragma, you can suppress compiler warning. You can use following syntax#pragma warning disableIn the similar way, we can restore the warning using following syntax#pragma warning restoreNow with the following code, warning is suppressed.Click to EnlargePosted By - Karan Gupta Posted On - Monday, June 22, 2015 Query/Feedback Your Email Id** Subject* Query/Feedback Characters remaining 250**
#pragma warning disable
#pragma warning restore
Query/Feedback