Home > Article > Backend Development > assemblyinfo.cs C# Assembly class accesses assembly information
Assembly information can be accessed through the Assembly class in C#.
1. Allows access to meta elements of a given assembly, including methods that can load and execute the assembly;
2. Load an assembly: Use the static method Assembly.Load(assembly name) or Assembly.LoadFrom (assembly full path name);
3. Attributes:
FullName: Assembly display name;
3. Methods:
GetTypes(): Get the types defined in the assembly.
TestAssembly.cs:
view plaincopy to clipboardprint?
using System; using System.Reflection;
namespace Magci.Test.Reflection
{ public class TestAssembly
{ public static void Main()
{ //Load assembly into runtime In the process
Assembly ass = Assembly.Load("TestCustomAttributes");
Assembly ass1 = Assembly.LoadFrom(@"E:CODEdotNetC#9-ReflectionTestCustomAttributes.dll");
//Get the assembly display name
Console.WriteLine( ass1.FullName);
//Get the types defined in the assembly
Type[] types = ass.GetTypes();
foreach (Type t in types)
{ Console.WriteLine(t.FullName);
} } } }
The above introduces assemblyinfo.cs C# Assembly class to access assembly information, including the content of assemblyinfo.cs. I hope it will be helpful to friends who are interested in PHP tutorials.