C#反射
2017-05-09 22:36:32 27 举报
AI智能生成
C# 反射
作者其他创作
大纲/内容
反射
反射相关类
System.Reflection.Assembly
反射单个程序集
ReflectionOnlyLoad
LoadFrom(assemblyName)
LoadFile(assemblyPath)
Load
常用属性
DefinedTypes \u00A0获取定义在此程序集中的类型的集合。
FullName 获取程序集的显示名称。
IsDynamic 当前程序集是否是通过使用反射发出在当前进程中动态生成的
常用方法
CreateInstance(String)
GetAssembly(Type)
GetCallingAssembly
GetName()
GetCustomAttributes(Boolean)
GetExecutingAssembly()
GetTypes()
CustomAttributeExtensions(扩展方法)
GetCustomAttribute(Type)GetCustomAttribute<T>()
GetCustomAttributes(Type)
GetCustomAttributes()
IsDefined(Type)
System.Reflection.MemberInfo
属性
CustomAttributes
DeclaringType
MemberType
All
Constructor
Custom
Event
Field
Method
NestedType
Property
TypeInfo
Module
Name
ReflectedType
方法
GetType()
System.Reflection.EventInfo
RaiseMethod
RemoveMethod
AddMethod
System.Reflection.FieldInfo
FieldType
IsAssembly
IsFamily
IsFamilyAndAssembly
IsFamilyOrAssembly
IsInitOnly
IsLiteral
IsNotSerialized
IsPrivate
IsPublic
IsStatic
GetValue(Object)
System.Reflection.MethodBase
IsAbstract
IsConstructor
IsFinal
IsGenericMethod
IsGenericMethodDefinition
IsVirtual
ContainsGenericParameters
GetGenericArguments()
GetParameters()
GetCurrentMethod()
System.Reflection.MethodInfo
ReturnParameter
ReturnType
ReturnTypeCustomAttributes
System.Reflection.ConstructorInfo
Invoke(Object[])
System.Reflection.PropertyInfo
CanRead
CanWrite
GetMethod
SetMethod
Attributes
GetMethod
PropertyType
GetAccessors
GetConstantValue()
GetGetMethod()
GetSetMethod()
System.Type
Name 数据类型名
FullName 数据类型的完全限定名(包括命名空间名)
Namespace 定义数据类型的命名空间名
IsAbstract 指示该类型是否是抽象类型
IsArray 指示该类型是否是数组
IsClass \u00A0 指示该类型是否是类
IsEnum 指示该类型是否是枚举
IsInterface \u00A0 \u00A0指示该类型是否是接口
IsPublic 指示该类型是否是公有的
IsSealed 指示该类型是否是密封类
IsValueType 指示该类型是否是值类型
BaseType
ContainsGenericParameters
DeclaringMethod
GenericParameterAttributes
GenericParameterPosition
GenericTypeArguments
HasElementType
IsAnsiClass
IsAutoClass
IsByRef
IsCOMObject
IsConstructedGenericType
IsGenericType
IsGenericTypeDefinition
IsImport
IsMarshalByRef
IsNestedAssembly
IsNestedFamANDAssem
IsNestedFamily
IsNestedFamORAssem
IsNestedPrivate
IsNestedPublic
IsNotPublic
IsPointer
IsPrimitive
IsSerializable
IsUnicodeClass
IsValueType
IsVisible
所有方法
GetArrayRank()
GetConstructor
GetConstructor(Type[])
GetConstructors()
GetConstructors(BindingFlags)
GetElementType
Enum相关
GetEnumName(Object)
GetEnumNames()
GetEnumUnderlyingType()
GetEnumValues()
IsEnumDefined(Object)
Event相关
GetEvents()
GetEvents(BindingFlags)
Field相关
GetField(String)
GetFields()
GetFields(BindingFlags)
Generic相关
GetGenericParameterConstraints()
GetGenericTypeDefinition()
Interface相关
GetInterface(String)
GetInterfaceMap(Type)
GetInterfaces()
Member相关
GetMember(String)
GetMembers()
GetMembers(BindingFlags)
Method相关
GetMethod(String)
GetMethods()
GetMethods(BindingFlags)
NestedType相关
GetNestedType(String)
GetNestedTypes()
GetNestedTypes(BindingFlags)
Property相关
GetProperties()
GetProperties(BindingFlags)
GetProperty(String)
GetType相关
GetType(String)
InvokeMember
IsArrayImpl()
IsByRefImpl()
继承关系判断
IsAssignableFrom(Type)
IsInstanceOfType(Object)
IsSubclassOf(Type)
MakeArrayType()
MakeArrayType(Int32)
MakeByRefType()
MakeGenericType(Type[])
获取Type方法
Type t = typeof(string);
使用对象GetType()方法。 string s = \"grayworm\"; Type t = s.GetType();
Type t = Type.GetType(\"System.String\");
System.Reflection.AppDomain
System.Reflection.Module
反射创建实例方法
System.Activator
System.AppDomain
CreateInstance
CreateInstanceAndUnwrap
CreateInstanceFrom
CreateInstanceFromAndUnwrap
Type.InvokerMember
ConstructorInfo.Invoke
数组,委托和泛型类型的创建
Delegate.CreateDelegate
Generic span style=\
运算符
is
子主题
BindingFlags
DeclaredOnly
Default
ExactBinding
FlattenHierarchy
GetField
IgnoreCase
IgnoreReturn
Instance
InvokeMethod
NonPublic
OptionalParamBinding
Public
PutDispProperty
PutRefDispProperty
SetField
SetProperty
Static
SuppressChangeType
TypeFilter
基元类型
CallingConventions
Any
ExplicitThis
HasThis
Standard
VarArgs
泛型类型定义
0 条评论
回复 删除
下一页