Thursday, January 21, 2010

Assembly One line defination

Metadata

• The name of the object
• The names of all the fields of the object and their types
• The names of all member functions, including parameter types and names

Runtime code can query the metadata—in a process called reflection—to find out what objects are available and what functions and fields are present on the class.

Manifest

Each assembly contains a manifest that enumerates the files contained in the assembly, controls what types and resources are exposed outside the assembly, and maps references from those types and resources to the files that contain the types and resources. The manifest also lists the other assemblies that an assembly depends upon.

Assemblies are self-contained; enough information exists in the assembly for it to be self-describing.

When defining an assembly, the assembly can be contained in a single file, or it can be split amongst several files. Using several files will enable a scenario where sections of the assembly are downloaded only as needed.

mscorlib.dll - which contains the core functions for the CLR


Enums - Enumerators declare a set of related constants—such as the colors that a control can take in a clear and type-safe manner.

Delegates are a type-safe, object-oriented implementation of function pointers and are used in many situations where a component needs to call back to the component that’s using it. They’re used most heavily as the basis for events, which allow a delegate to easily be registered for an event.

ILDASM can open an assembly, show all the types in the assembly, show what methods are defined for those types, and show the IL that was generated for that method.

checked/unchecked  The checked and unchecked statements control whether exceptions are thrown if conversions or expressions overflow.

as

The as operator is similar to the is operator, but instead of just determining whether an object is a specific type or interface, it also performs the explicit conversion to that type. If the object can’t be converted to that type, the operator returns null. Using as is more efficient than the is operator, since the as operator needs to check the type of the object only once



No comments: