BlackWaspTM

This web site uses cookies. By using the site you accept the cookie policy.This message is for compliance with the UK ICO law.

<< Previous | 1 | 2 | 3 | 4 | Next >> |
Checking if Types are CompatibleChecking if Types are Compatible
Sometimes is it necessary to determine if an object of one type can be assigned to a variable of another, this being possible either due to inheritance or because of the implementation of an interface. You can make such determinations using reflection.
Raising Events Using ReflectionRaising Events Using Reflection
Sometimes it is necessary to raise an object's events using reflection. This can be achieved by obtaining the event's multicast delegate and invoking each of its child delegates in turn.
Identifying all Types that Implement an InterfaceIdentifying all Types that Implement an Interface
Sometimes it is useful to find the list of classes in an assembly that implement a given interface. These implementers cannot be obtained directly from an interface but can be found indirectly using reflection.
Identifying all Subclasses of a ClassIdentifying all Subclasses of a Class
In some situations it may be necessary to identify all of the subtypes of a given class that exist within an assembly. Subclasses cannot be read directly from a base class but can be easily determined using a simple query.
Reflecting ref and out Parameter InformationReflecting ref and out Parameter Information
Methods and their parameters can be examined using reflection to obtain detailed information about their use. When reflecting method parameters, it may be necessary to determine if they are reference or output parameters.
Creating Objects with Assembly.CreateInstanceCreating Objects with Assembly.CreateInstance
Late binding is a useful technique that permits the type of an object to be determined at run-time, rather than being set at compile time via early binding. One way to achieve late binding is through the use of the Assembly type's CreateInstance method.
Invoking Overloaded Methods Using ReflectionInvoking Overloaded Methods Using Reflection
Static and instance methods can be invoked via reflection by obtaining a MethodInfo object for the desired member and calling the Type class's Invoke method. When invoking overloaded methods, the call to obtain the method information must be modified.
Identifying the Namespaces in an AssemblyIdentifying the Namespaces in an Assembly
Sometimes it is necessary to find the names of all of the namespaces that are defined in a .NET assembly. Although reflection does not provide a method for this purpose, it is possible to get this information indirectly.
Detecting a Parameter ArrayDetecting a Parameter Array
Reflection permits .NET developers to interrogate type metadata and obtain information relating to items such as classes, structures and their members. When reflecting methods it may be necessary to check if the final argument is a parameter array.
Obtaining a List of Loaded AssembliesObtaining a List of Loaded Assemblies
.NET applications are built by combining code from multiple assemblies, including custom executables and dynamic link libraries, and the assemblies provided by the .NET framework. Sometimes it can be useful to obtain a list of the loaded assemblies.
<< Previous | 1 | 2 | 3 | 4 | Next >> |