[Serializable] |
One or more modules deployed as a unit compose an assembly.
FilterTypeName | A TypeFilter object that filters the list of types defined in this module based upon the name. This field is case-sensitive and read-only. |
FilterTypeNameIgnoreCase | A TypeFilter object that filters the list of types defined in this module based upon the name. This field is case-insensitive and read-only. |
Assembly | Read-only Gets the appropriate Assembly for this instance of Module. |
FullyQualifiedName | Read-only Gets a string representing the fully qualified name and path to this module. |
Name | Read-only Gets a String representing the name of the module with the path removed. |
ScopeName | Read-only Gets a string representing the name of the module. |
Equals (inherited from System.Object) |
See base class member description: System.Object.Equals Derived from System.Object, the primary base class for all objects. |
FindTypes | Returns an array of classes accepted by the given filter and filter criteria. |
GetCustomAttributes | Overloaded:GetCustomAttributes(bool inherit) Returns all custom attributes. |
GetCustomAttributes | Overloaded:GetCustomAttributes(Type attributeType, bool inherit) Gets custom attributes of the specified type. |
GetField | Overloaded:GetField(string name) Returns a field having the specified name. |
GetField | Overloaded:GetField(string name, BindingFlags bindingAttr) Returns a field having the specified name and binding attributes. |
GetFields | Returns an array of fields implemented by a class. |
GetHashCode (inherited from System.Object) |
See base class member description: System.Object.GetHashCode Derived from System.Object, the primary base class for all objects. |
GetMethod | Overloaded:GetMethod(string name) Returns a method having the specified name. |
GetMethod | Overloaded:GetMethod(string name, Type[] types) Returns a method having the specified name and parameter types. |
GetMethod | Overloaded:GetMethod(string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) Returns a method having the specified name, binding information, calling convention, and parameter types and modifiers. |
GetMethods | Returns an array of all the global methods defined on the module. |
GetObjectData | Provides an ISerializable implementation for serialized objects. |
GetType (inherited from System.Object) |
Overloaded:GetType() See base class member description: System.Object.GetTypeDerived from System.Object, the primary base class for all objects. |
GetType | Overloaded:GetType(string className) Returns the specified class, performing a case-sensitive search. |
GetType | Overloaded:GetType(string className, bool ignoreCase) Returns the specified class, searching the module with the specified case sensitivity. |
GetType | Overloaded:GetType(string className, bool throwOnError, bool ignoreCase) Returns the specified class, searching the module with the specified case sensitivity and specifying whether to throw an exception if an error occurs while loading the Type. |
GetTypes | Returns all the classes defined within this module. |
IsDefined | Determines if the specified attributeType is defined on this module. |
IsResource | Gets a value indicating whether the object is a resource. |
ToString | Overridden: Returns the name of the module. |
Finalize (inherited from System.Object) |
See base class member description: System.Object.Finalize Derived from System.Object, the primary base class for all objects. |
GetMethodImpl | Returns the method implementation in accordance with the specified criteria. |
MemberwiseClone (inherited from System.Object) |
See base class member description: System.Object.MemberwiseClone Derived from System.Object, the primary base class for all objects. |
Hierarchy:
public static readonly TypeFilter FilterTypeName;
|
public static readonly TypeFilter FilterTypeNameIgnoreCase;
|
public Assembly Assembly {get;}
|
public virtual string FullyQualifiedName {get;}
|
Exception Type | Condition |
---|---|
SecurityException | The caller does not have the required permissions. |
If the assembly for this module was loaded from a byte array then the FullyQualifiedName for the module will be: <Unknown>.
using System.Reflection; using System; public class Simple { public static void Main () { Module mod = Assembly.GetExecutingAssembly().GetModules () [0]; Console.WriteLine ("Module Name is " + mod.Name); Console.WriteLine ("Module FullyQualifiedName is " + mod.FullyQualifiedName); Console.WriteLine ("Module ScopeName is " + mod.ScopeName); } } /* Produces this output: Module Name is modname.exe Module FullyQualifiedName is C:\Bin\modname.exe Module ScopeName is modname.exe */
public string Name {get;}
|
To get the name and the path, use Module.FullyQualifiedName.
using System.Reflection; using System; public class Simple { public static void Main () { Module mod = Assembly.GetExecutingAssembly().GetModules () [0]; Console.WriteLine ("Module Name is " + mod.Name); Console.WriteLine ("Module FullyQualifiedName is " + mod.FullyQualifiedName); Console.WriteLine ("Module ScopeName is " + mod.ScopeName); } } /* This code produces the following output: Module Name is modname.exe Module FullyQualifiedName is C:\Bin\modname.exe Module ScopeName is modname.exe */
public string ScopeName {get;}
|
using System.Reflection; using System; public class Simple { public static void Main () { Module mod = Assembly.GetExecutingAssembly().GetModules () [0]; Console.WriteLine ("Module Name is " + mod.Name); Console.WriteLine ("Module FullyQualifiedName is " + mod.FullyQualifiedName); Console.WriteLine ("Module ScopeName is " + mod.ScopeName); } } /* Produces this output: Module Name is modname.exe Module FullyQualifiedName is C:\Bin\modname.exe Module ScopeName is modname.exe */
~Module(); |
public virtual Type[] FindTypes( |
filter
filterCriteria
Exception Type | Condition |
---|---|
ReflectionTypeLoadException | One or more classes in a module could not be loaded. |
The delegate given by filter is called for each class in the module, passing along the Type object representing the class as well as the given filterCriteria. If filter returns a particular class, that class will be included in the returned array. If filter returns null, all classes are returned and filterCriteria is ignored.
FindTypes cannot be used to look up parameterized types such as arrays.
inherit
attributeType
inherit
Exception Type | Condition |
---|---|
ArgumentNullException | attributeType is null. |
name
Exception Type | Condition |
---|---|
ArgumentException | The name parameter is null. |
public FieldInfo GetField( |
name
bindingAttr
Exception Type | Condition |
---|---|
ArgumentException | The name parameter is null. |
public FieldInfo[] GetFields(); |
public virtual int GetHashCode(); |
public MethodInfo GetMethod( |
name
Exception Type | Condition |
---|---|
ArgumentNullException | name is null. |
public MethodInfo GetMethod( |
name
types
Exception Type | Condition |
---|---|
ArgumentNullException | name is null, types is null, or types (i) is null. |
public MethodInfo GetMethod( |
name
bindingAttr
binder
callConvention
types
modifiers
Exception Type | Condition |
---|---|
ArgumentNullException | name is null, types is null, or types (i) is null. |
protected virtual MethodInfo GetMethodImpl( |
name
bindingAttr
binder
callConvention
types
modifiers
Exception Type | Condition |
---|---|
AmbiguousMatchException | types is null. |
public MethodInfo[] GetMethods(); |
public virtual void GetObjectData( |
info
context
Exception Type | Condition |
---|---|
ArgumentNullException | info is null. |
public Type GetType(); |
className
Exception Type | Condition |
---|---|
ArgumentNullException | className is null. |
TargetInvocationException | The class initializers are invoked and an exception is thrown. |
ArgumentException | className is invalid, such as if it is greater than 1023 characters or if it is a zero-length string. |
SecurityException | The caller does not have the required reflection permissions and attempts to reflect on a type that is not public. |
className
ignoreCase
Exception Type | Condition |
---|---|
ArgumentNullException | className is null. |
TargetInvocationException | The class initializers are invoked and an exception is thrown. |
ArgumentException | className is invalid, such as if it is greater than 1023 characters or if it is a zero-length string. |
SecurityException | The caller does not have the required reflection permissions and attempts to reflect on a type that is not public. |
className
throwOnError
-or-
false to ignore errors while loading the Type.
true to throw a TypeLoadException if an error occurs while loading the Type.-or-
false to ignore errors while loading the Type.
ignoreCase
Exception Type | Condition |
---|---|
ArgumentNullException | className is null. |
TargetInvocationException | The class initializers are invoked and an exception is thrown. |
ArgumentException | className is invalid, such as if it is greater than 1023 characters or if it is a zero-length string. |
TypeLoadException | An error occurred while loading the type. |
SecurityException | The caller does not have the required reflection permissions and attempts to reflect on a type that is not public. |
public virtual Type[] GetTypes(); |
Exception Type | Condition |
---|---|
ReflectionTypeLoadException | One or more classes in a module could not be loaded. |
SecurityException | The caller does not have the required permission. |
For example, if the class initializers of one of the classes throws an exception while it is being loaded, a TargetInvocationException is stored in the corresponding element of the LoaderExceptions array.
attributeType
inherit
Exception Type | Condition |
---|---|
ArgumentNullException | attributeType is null. |
public bool IsResource(); |
protected object MemberwiseClone(); |
public override string ToString(); |