C# Assembly class accesses assembly information_PHP tutorial

WBOY
Release: 2016-07-21 15:46:08
Original
1107 people have browsed it

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. Method:
GetTypes(): Get 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 the assembly into the running 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);
} } } }

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/320219.htmlTechArticleIn C#, assembly information can be accessed through the Assembly class. 1. Allows access to meta elements of a given assembly, including Methods that can load and execute an assembly; 2. Load an assembly: Use static methods...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!