Welcome to MSDN Blogs Sign in | Join | Help

Browse by Tags

All Tags » Reflection   (RSS)
While writing the ILVisualizer for dynamic method late 2005, I'd like to show the local variable information as well; so I started working on the managed signature parser, at least to parse LocalVarSig (Ecma-335 23.2.6). It was 2+ years ago, and never Read More...
Two things related to array type name came to my mind while writing the previous post. Given an one-dimensional non-zero based double array x, x.GetType().ToString() returns "System.Double [*] "; we can use Type.GetType("System.Double[*]") to get hold Read More...
The type " System.Array " provides us a set of API for the late-bound array operations, including array creation ( Array.CreateInstance ), read/write access to array element ( Array.SetValue / Array.GetValue ). They are convenient to use. Let me start Read More...
I was glad to hear many positive feedbacks about the DebuggerVisualizer for DynamicMethod ; on the sad side, it shows our lack of good LCG debugging support (on which, Mike Stall is seeking your opinion ). Recently along with the ILReader update, I made Read More...
Compared to what I posted previously here (or what was used in the DynamicMethod visualizer ), this new version introduced the Visitor pattern . A do-nothing visitor ILInstructionVisitor is included; the users can focus on their domain-specific logic Read More...
As John mentioned in his post , every Reflection user should keep this in mind: our code should not count on the member order returned by GetFields, GetMethods and other similar GetXXXs calls. Given two fields (F1, F2) in one type, I think the compiler Read More...
The GetCustomAttributes scenario ( ICustomAttributeProvider.GetCustomAttributes or Attribute.GetCustomAttributes , referred to as GetCA in this post) involves 3 pieces: a custom attribute type an entity which is decorated with the custom attribute a code Read More...
Type.FullName returns null when the type is not generic type definition but contains generic paramters. The rational behind this design is to ensure Type.FullName (if not null) can uniquely identify a type in an assembly; or given the string returned Read More...
When working on .NET projects, we often need to find the right API or the proper parameters to pass in to a particular method. Usually we search MSDN or turn to other search engines to solve such issue. Some people, however, prefer first-hand experience Read More...
Q : Assume we have 2000 unknown types; (however) we know each type has a constructor with integer as its' only parameter type. How to create objects 10000 times for each type (and make such late-new fast)? Activator.CreateInstance comes to my fingers Read More...
Reflection in .NET 2.0 ships with a new class MethodBody, which "provides access to information about the local variables and exception-handling clauses in a method body, and to the Microsoft intermediate language (MSIL) that makes up the method body". Read More...
In C#, nested types can be defined in generic classes just like they would be in non-generic classes. For example: class G <T> { public class NestedC { } public enum NestedEnum { A, B } } Inside the nested type NestedC, we can still use type parameter Read More...
This was one ladybug in MSDN product feedback center. First of all, thanks to those who filed bugs or suggestions through it, which really help improve our product quality. No Name property in the LocalVariableInfo class is "by design" (possibly forever). Read More...
Yes, reflection can get this done. Assume we have an Enum type - Colors, the following code will print the name and value for each member of it. foreach ( FieldInfo fi in typeof ( Colors ).GetFields( BindingFlags .Public | BindingFlags .Static)) { Console Read More...
You might have already read this : VS2005 made the last-minute DCR related to boxed Nullable<T>. Runtime now treats Nullable<T> differently from other generic value types when boxing: Int32 ? x = null ; object y = x; // y is simply null, not Read More...
More Posts Next page »
 
Page view tracker