Category Archives: Attributes

C# Suppress Compilation Warnings with #pragma or the SuppressMessage Attribute

Although one would hope that you wouldn’t have to do so very often, sometimes it is useful to explicitly disable code analysis warnings within your application. For example, you could suppress warnings around references to obsolete methods that must be … Continue reading

Posted in Attributes, C#, MSBuild, Visual Studio | Leave a comment

ASP.Net MVC: Simple Custom Authorization by Inheriting from the AuthorizeAttribute

Implementing custom authorization to a ASP.Net MVC site can be quite simple if you take advantage of the built-in ActionFilter authorization framework. Here’s how to do it. First, this enumeration describing four levels of access to the site.   // … Continue reading

Posted in ASP.Net, Attributes, C#, MVC | Leave a comment

C#: Export a List of Objects to CSV with LINQ, Attributes, and Generics

Have you ever needed to transform data from in-memory C# objects to a CSV flat-file of a specific format?  Here’s an easy way to get the job done with C#, LINQ, and Generics. First you need the Attribute you will … Continue reading

Posted in Attributes, C#, Generics, LINQ | Leave a comment