Assembly Members
Represents an assembly, which is a reusable, versionable, and self-describing building block of a common language runtime application.
The following tables list the members exposed by the Assembly type.
| Name | Description | |
|---|---|---|
| CodeBase | Gets the location of the assembly as specified originally, for example, in an AssemblyName object. |
| EntryPoint | Gets the entry point of this assembly. |
| EscapedCodeBase | Gets the URI, including escape characters, that represents the codebase. |
| Evidence | Gets the evidence for this assembly. |
| FullName | Gets the display name of the assembly. |
| GlobalAssemblyCache | Gets a value indicating whether the assembly was loaded from the global assembly cache. |
| HostContext | Gets the host context with which the assembly was loaded. |
| ImageRuntimeVersion | Gets a string representing the version of the common language runtime (CLR) saved in the file containing the manifest. |
| Location | Gets the path or UNC location of the loaded file that contains the manifest. |
| ManifestModule | Gets the module that contains the manifest for the current assembly. |
| ReflectionOnly | Gets a Boolean value indicating whether this assembly was loaded into the reflection-only context. |
(see also
Protected Methods
)
Top
| Name | Description | |
|---|---|---|
| CreateInstance | Overloaded. Locates a type from this assembly and creates an instance of it using the system activator. |
| CreateQualifiedName | Creates the name of a type qualified by the display name of its assembly. |
| Equals | Overloaded. Determines whether two Object instances are equal. (inherited from Object) |
| GetAssembly | Gets the currently loaded assembly in which the specified class is defined. |
| GetCallingAssembly | Returns the Assembly of the method that invoked the currently executing method. |
| GetCustomAttributes | Overloaded. Gets the custom attributes for this assembly. |
| GetEntryAssembly | Gets the process executable in the default application domain. In other application domains, this is the first executable that was executed by AppDomain.ExecuteAssembly. |
| GetExecutingAssembly | Gets the assembly that contains the code that is currently executing. |
| GetExportedTypes | Gets the public types defined in this assembly that are visible outside the assembly. |
| GetFile | Gets a FileStream for the specified file in the file table of the manifest of this assembly. |
| GetFiles | Overloaded. Gets the files in the file table of an assembly manifest. |
| GetHashCode | Serves as a hash function for a particular type. (inherited from Object) |
| GetLoadedModules | Overloaded. Gets all the loaded modules that are part of this assembly. |
| GetManifestResourceInfo | Returns information about how the given resource has been persisted. |
| GetManifestResourceNames | Returns the names of all the resources in this assembly. |
| GetManifestResourceStream | Overloaded. Loads the specified manifest resource from this assembly. |
| GetModule | Gets the specified module in this assembly. |
| GetModules | Overloaded. Gets all the modules that are part of this assembly. |
| GetName | Overloaded. Gets an AssemblyName for this assembly. |
| GetObjectData | Gets serialization information with all of the data needed to reinstantiate this assembly. |
| GetReferencedAssemblies | Gets the AssemblyName objects for all the assemblies referenced by this assembly. |
| GetSatelliteAssembly | Overloaded. Gets the satellite assembly. |
| GetType | Overloaded. Gets the Type object that represents the specified type. |
| GetTypes | Gets the types defined in this assembly. |
| IsDefined | Indicates whether or not a specified attribute has been applied to the assembly. |
| Load | Overloaded. Loads an assembly. |
| LoadFile | Overloaded. Loads the contents of an assembly file. |
| LoadFrom | Overloaded. Loads an assembly. |
| LoadModule | Overloaded. Loads the module internal to this assembly. |
| LoadWithPartialName | Overloaded. Loads an assembly from the application directory or from the global assembly cache using a partial name. |
| ReferenceEquals | Determines whether the specified Object instances are the same instance. (inherited from Object) |
| ReflectionOnlyLoad | Overloaded. Loads an assembly into the reflection-only context, where it can be examined but not executed. |
| ReflectionOnlyLoadFrom | Loads an assembly into the reflection-only context, given its path. |
| ToString | Overridden. Returns the full name of the assembly, also known as the display name. |
| Name | Description | |
|---|---|---|
| Finalize | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (inherited from Object) |
| MemberwiseClone | Creates a shallow copy of the current Object. (inherited from Object) |
| Name | Description | |
|---|---|---|
| ModuleResolve | Occurs when the common language runtime class loader cannot resolve a reference to an internal module of an assembly through normal means. |
Reference
Assembly ClassSystem.Reflection Namespace
AppDomain
AssemblyName
Other Resources
Application Domains and Assemblies
C# Example
private static void PostMartomAssembly()
{
try
{
Assembly sampleAsm =
Assembly.LoadFrom(@"D:\Clear Case Convertor\Trials\TfsTesterApp\MyClassLibrary\bin\Debug\MyClassLibrary.dll");
//Assembly.LoadFrom(@"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll");
Object obj = sampleAsm.CreateInstance(sampleAsm.FullName);
MethodInfo entryPoint = sampleAsm.EntryPoint;
//Console.WriteLine("EntryPoint: " + entryPoint.ToString());
Object[] custAttrAssm = sampleAsm.GetCustomAttributes(true);
Type[] expType = sampleAsm.GetExportedTypes();
FileStream[] fs =
sampleAsm.GetFiles(true);
MethodInfo[] methods = sampleAsm.GetTypes()[0].GetMethods();
Module[] loadedModules =sampleAsm.GetLoadedModules(true);
//ManifestResourceInfo manifestResInfo = sampleAsm.GetManifestResourceInfo("");
string[] maifestResNames = sampleAsm.GetManifestResourceNames();
//Stream str = sampleAsm.GetManifestResourceStream("");
Module[] modules = sampleAsm.GetModules(true);
AssemblyName asmName=sampleAsm.GetName();
//sampleAsm.GetObjectData(
AssemblyName[] refAsm=
sampleAsm.GetReferencedAssemblies();
Console.WriteLine("Referenced Assmeblies: ");
foreach (AssemblyName a in refAsm)
{
Console.Write(a.Name + ", ");
}
bool IsLoadedfromGAC = sampleAsm.GlobalAssemblyCache;
if (IsLoadedfromGAC)
Console.WriteLine("This assembly is loaded from GAC");
else
Console.WriteLine("This assembly is NOT loaded from GAC");
}
}
catch (Exception ex)
{
Console.WriteLine("Exception: " + ex.Message);
}
}
Mahesh Lambe
http://mahiways.spaces.live.com/
http://ssmaoracle.blogspot.com/