C # Assembly class access Assembly information C # The Assembly class can access Assembly information.
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 );
}}}}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.