Free mag vol1 | Page 644

CHAPTER 15  TYPE REFLECTION, LATE BINDING, AND ATTRIBUTE-BASED PROGRAMMING To do so, simply add the following assembly-level attribute at the very top of any C# source code file. Be very aware that all assembly- or module-level attributes must be listed outside the scope of any namespace scope! If you add assembly- or module-level attributes to your project, here is a recommended file layout to follow: // List "using" statements first. using System; using System.Collections.Generic; using System.Linq; using System.Text; // Now list any assembly- or module-level attributes. // Enforce CLS compliance for all public types in this assembly. [assembly: CLSCompliant(true)] // Now, your namespace(s) and types. namespace AttributedCarLibrary { // Types... } If you now add a bit of code that falls outside the CLS specification (such as an exposed point of unsigned data): // Ulong types don't jibe with the CLS. public class Winnebago { public ulong notCompliant; } you are issued a compiler warning. The Visual Studio AssemblyInfo.cs File By default, Visual Studio projects receive a file named AssemblyInfo.cs, which can be viewed by expandin g the Properties icon of the Solution Explorer (see Figure 15-6). 586