August, 2005

  • Haibo Luo's weblog

    Get Names and Values of Enum Members

    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...
  • Haibo Luo's weblog

    Reflection and Nullable<T>

    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; ...
  • Haibo Luo's weblog

    Type.GetType(string typeName) returns null !?

    Type.GetType gives us the ability to get type back from a string. We pass a well-written type name string to it, and expect it return that type. Sometimes, to your surprise, it returns null. For example, Type.GetType("System.Data.SqlClient.SqlException...
Page 1 of 1 (3 items)