日期:2014-05-19  浏览次数:21429 次

c#2.0 Type.GetType()问题,急啊,请高手帮忙
Order   or   =   new   Order();
Type   t   =   Type.GetType(or);
string   sName   =   t.Name;
为什么sName取得的值为 "RunTimeType ",我跟踪t时发现:

+ t {Name   =   "Order "   FullName   =   "Test.Order "} System.Type   {System.RuntimeType}
- entity.GetType() {Name   =   "RuntimeType "   FullName   =   "System.RuntimeType "} System.Type   {System.RuntimeType}
+ [System.RuntimeType] {Name   =   "RuntimeType "   FullName   =   "System.RuntimeType "} System.RuntimeType
+ base {Name   =   "RuntimeType "   FullName   =   "System.RuntimeType "} System.Reflection.MemberInfo   {System.RuntimeType}
+ Assembly {mscorlib,   Version=2.0.0.0,   Culture=neutral,   PublicKeyToken=b77a5c561934e089} System.Reflection.Assembly
AssemblyQualifiedName "System.RuntimeType,   mscorlib,   Version=2.0.0.0,   Culture=neutral,   PublicKeyToken=b77a5c561934e089 " string
Attributes Serializable   |   BeforeFieldInit System.Reflection.TypeAttributes
+ BaseType {Name   =   "Type "   FullName   =   "System.Type "} System.Type   {System.RuntimeType}
ContainsGenericParameters false bool
+ DeclaringMethod “entity.GetType().DeclaringMethod”引发了“System.InvalidOperationException”类型的异常 System.Reflection.MethodBase   {System.InvalidOperationException}
+ DeclaringType null System.Type
FullName "System.RuntimeType " string
+ GenericParameterAttributes “entity.GetType().GenericParameterAttributes”引发了“System.InvalidOperationException”类型的异常 System.Reflection.GenericParameterAttributes   {System.InvalidOperationException}
+ GenericParameterPosition “entity.GetType().GenericParameterPosition”引发了“System.InvalidOperationException”类型的异常 int   {System.InvalidOperationException}
+ GUID {97e69551-7329-39c5-ba61-2ca4b573e0e5} System.Guid
HasElementType false bool
IsAbstract false bool
IsAnsiClass true bool
IsArray false bool
IsAutoClass false bool
IsAutoLayout true bool
IsByRef false bool
IsClass true bool
IsCOMObject false bool
IsContextful false bool
IsEnum false bool
IsExplicitLayout false bool
IsGenericParameter false bool
IsGenericType false bool
IsGenericTypeDefinition false bool
IsImport false bool
IsInterface false bool
IsLayoutSequential false bool
IsMarshalByRef false bool
IsNested false bool
IsNestedAssembly false bool
IsNestedFamANDAssem false bool
IsNestedFamily false bool
IsNestedFamORAssem false bool
IsNestedPrivate false bool
IsNestedPublic false bool
IsNotPublic true bool
IsPointer false bool
IsPrimitive false bool
IsPublic false bool
IsSealed false bool
IsSerializable true bool
IsSpecialName false bool
IsUnicodeClass false bool
IsValueType false bool
IsVisible false bool
MemberType TypeInfo System.Reflection.MemberTypes
+ Module {CommonLanguageRuntimeLibrary} System.Reflection.Module
Namespace "System " string
+ ReflectedType null System.Type
+ StructLayoutAttribute {System.Runtime.InteropServices.StructLayoutAttribute} System.Runtime.InteropServices.StructLayoutAttribute
+ TypeHandle {System.RuntimeTypeHandle} System.RuntimeTypeHandle
+ TypeInitializer {Void   .cctor()} System.Reflection.ConstructorInfo   {System.Reflection.RuntimeConstructorInfo}
+ UnderlyingSystemType {Name   =   "RuntimeType "   FullName   =   "System.RuntimeType "} System.Type   {System.RuntimeType}