In C #, the Assembly information can be accessed through the Assembly class.
1. allow access to the element of a given assembly, including methods for loading and executing the Assembly;
2. Load the Assembly: Use the static method Assembly. Load (Assembly name) or Assembly. LoadFrom (complete Assembly path name );
3. attributes:
FullName: indicates the Assembly display name;
3. Method:
GetTypes (): gets the type defined in the dataset.
TestAssembly. cs:
View plaincopy to clipboardprint?
Using System; using System. Reflection;
Namespace Magci. Test. Reflection
{Public class TestAssembly
{Public static void Main ()
{// Load the assembly to the running process
Assembly ass = Assembly. Load ("TestCustomAttributes ");
Assembly ass1 = Assembly. LoadFrom (@ "E: \ CODE \ dotNet \ C # \ 9-Reflection \ TestCustomAttributes. dll ");
// Obtain the Assembly display name
Console. WriteLine (ass1.FullName );
// Obtain the type defined in the Set
Type [] types = ass. GetTypes ();
Foreach (Type t in types)
{Console. WriteLine (t. FullName );
}}}}