Class TypeUtil
Inheritance
System.Object
TypeUtil
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Assembly: cs.temp.dll.dll
Syntax
public static class TypeUtil
Fields
BackingFieldNameRegex
BackingFieldの名前からプロパティ名を取得する
Declaration
public static readonly Regex BackingFieldNameRegex
Field Value
Methods
GetAllMembersRecursively(Object, Type, BindingFlags)
Declaration
public static IEnumerable<Tuple<FieldInfo, object>> GetAllMembersRecursively(object obj, Type targetType, BindingFlags flags)
Parameters
Type |
Name |
Description |
System.Object |
obj |
|
Type |
targetType |
|
BindingFlags |
flags |
|
Returns
Type |
Description |
IEnumerable<Tuple<FieldInfo, System.Object>> |
|
GetAllMembersRecursively<T>(Object, BindingFlags)
Declaration
public static IEnumerable<Tuple<FieldInfo, T>> GetAllMembersRecursively<T>(object obj, BindingFlags flags = null)
Parameters
Type |
Name |
Description |
System.Object |
obj |
|
BindingFlags |
flags |
|
Returns
Type |
Description |
IEnumerable<Tuple<FieldInfo, T>> |
|
Type Parameters
GetBaseTypes(Type, Boolean)
Declaration
public static IEnumerable<Type> GetBaseTypes(this Type self, bool containsSelf = false)
Parameters
Type |
Name |
Description |
Type |
self |
|
System.Boolean |
containsSelf |
|
Returns
Type |
Description |
IEnumerable<Type> |
|
GetMemberType(MemberInfo)
FieldInfo or PropertyInfoどっちかの場合にMemberTypeを取得する
Declaration
public static Type GetMemberType(MemberInfo m)
Parameters
Type |
Name |
Description |
MemberInfo |
m |
|
Returns
GetPropertyBackingField(PropertyInfo)
Declaration
public static FieldInfo GetPropertyBackingField(PropertyInfo propertyInfo)
Parameters
Type |
Name |
Description |
PropertyInfo |
propertyInfo |
|
Returns
Type |
Description |
FieldInfo |
|
GetPropertyBackingField(Type, PropertyInfo)
自動生成されたプロパティが内部で持っているフィールドのFieldInfoを取得する
Declaration
public static FieldInfo GetPropertyBackingField(Type type, PropertyInfo propertyInfo)
Parameters
Type |
Name |
Description |
Type |
type |
|
PropertyInfo |
propertyInfo |
|
Returns
Type |
Description |
FieldInfo |
|
GetValue(MemberInfo, Object)
FieldInfo or PropertyInfoどっちかの場合に値を取得する
Declaration
public static object GetValue(MemberInfo m, object obj)
Parameters
Type |
Name |
Description |
MemberInfo |
m |
|
System.Object |
obj |
|
Returns
Type |
Description |
System.Object |
|
IsSimpleType(Type)
Declaration
public static bool IsSimpleType(Type type)
Parameters
Type |
Name |
Description |
Type |
type |
|
Returns
Type |
Description |
System.Boolean |
|
SetValue(MemberInfo, Object, Object)
FieldInfo or PropertyInfoどっちかの場合に値を設定する
Declaration
public static void SetValue(MemberInfo m, object obj, object v)
Parameters
Type |
Name |
Description |
MemberInfo |
m |
|
System.Object |
obj |
|
System.Object |
v |
|