Free mag vol1 | Page 726

CHAPTER 18  UNDERSTANDING CIL AND THE ROLE OF DYNAMIC ASSEMBLIES Notice that you are issued errors, given that all your types are completely empty. Here is some partial output: Microsoft (R) .NET Framework PE Verifier. Version 4.0.21006.1 Copyright (c) Microsoft Corporation. All rights reserved. [MD]: Error: Value class has neither fields nor size parameter. [token:0x02000005] [MD]: Error: Enum has no instance field. [token:0x02000006] ... To understand how to populate a type with content, you first need to examine the fundamental data types of CIL. .NET Base Class Library, C#, and CIL Data Type Mappings Table 18-4 illustrates how a .NET base class type maps to the corresponding C# keyword, and how each C# keyword maps into raw CIL. As well, Table 18-4 documents the shorthand constant notations used for each CIL type. As you will see in just a moment, these constants are often referenced by numerous CIL opcodes. Table 18-4. Mapping .NET Base Class Types to C# Keywords, and C# Keywords to CIL .NET Base Class Type C# Keyword CIL Representation CIL Constant Notation System.SByte sbyte int8 System.Byte byte unsigned int8 1U 1 System.Int 6 short 1I 1 int 6 I2 1 System.UInt 6 ushort unsigned 1 int 6 U2 System.Int32 int int32 I4 System.UInt32 uint unsigned int32 U4 System.Int64 long int64 I8 System.UInt64 ulong unsigned int64 U8 System.Char char char CHAR System.Single float float32 R4 System.Double double float64 R8 669