C# Класс Castle.Facilities.NHibernateIntegration.Util.ReflectionUtil

Показать файл Открыть проект

Открытые методы

Метод Описание
AddToArray ( FieldInfo field, object instance, object val ) : void

Adds to array.

ConvertTo ( string text, Type type ) : object

Converts from string to the type. Can covert from string, enums booleans, bytes, int32 and datetime

GetFieldValue ( object obj, FieldInfo field ) : object

Gets the field value from object, and return

GetFieldsDictionary ( object obj ) : IDictionary

Gets the fields names and values. The keys holds the names of the fields. The values hold the value of the field if it's a simple type, or the name of the field's type.

GetFieldsWithAttribute ( Type type, Type attribute ) : FieldInfoCollection

Gets all the fields from the object's type with specified attribute

GetFieldsWithOutAttributes ( Type type ) : FieldInfoCollection

Gets all the fields WITHOUT ANY of the specified attributes.

GetName ( object obj ) : string

Gets the name of an object. The name of the object is it's type name or the value of its Name property or field

GetNameOrEmpty ( object obj ) : string

Gets the value of a property or field name in the object. Or return empty string if there aren't any.

GetProperties ( object obj ) : System.Reflection.PropertyInfo[]

Gets the properties.

GetPropertiesDictionary ( object obj ) : IDictionary

Gets the readable (non indexed) properties names and values. The keys holds the names of the properties. The values are the values of the properties

GetPropertyValue ( PropertyInfo property, object obj ) : object

Gets the property value.

GetPropertyValue ( object obj, string property ) : object

Gets the property value.

GetValue ( object obj ) : string

Gets the value of the object, if the object is simple, the returned string is the object ToString(), otherwise, it's the object name (if it has one) or the object type.

HasValue ( object value ) : bool

An object has value if it's not null, an collection containing elements and a non-empty string

IsSimpleObject ( object obj ) : bool

Determines whether the object is simple. An object is simple if its type is simple or if it's null.

IsSimpleType ( Type type ) : bool

Determines whether type is simple enough to need just ToString() to show its state. (string,int, bool, enums are simple. Anything else is false.

RemoveFromArray ( FieldInfo field, object instance, int index ) : void

Removes from array.

SetName ( object obj, string name ) : void

Sets the name property or value of an object to the value of name. Does nothing if the object doesn't have any fields or properties named 'name'

Приватные методы

Метод Описание
GetField ( object obj, string field ) : FieldInfo

Gets the FieldInfo thus named

GetProperty ( object obj, string property ) : PropertyInfo

Gets the PropertyInfo thus named.

PropertyHasValue ( object obj, PropertyInfo prop ) : bool

Check if the property is not null and can be read and is no indexed. This is done to know if it can be read safely.

Описание методов

AddToArray() публичный статический Метод

Adds to array.
public static AddToArray ( FieldInfo field, object instance, object val ) : void
field System.Reflection.FieldInfo The field.
instance object The instance.
val object The val.
Результат void

ConvertTo() публичный статический Метод

Converts from string to the type. Can covert from string, enums booleans, bytes, int32 and datetime
public static ConvertTo ( string text, Type type ) : object
text string Text.
type System.Type Type.
Результат object

GetFieldValue() публичный статический Метод

Gets the field value from object, and return
public static GetFieldValue ( object obj, FieldInfo field ) : object
obj object
field System.Reflection.FieldInfo
Результат object

GetFieldsDictionary() публичный статический Метод

Gets the fields names and values. The keys holds the names of the fields. The values hold the value of the field if it's a simple type, or the name of the field's type.
public static GetFieldsDictionary ( object obj ) : IDictionary
obj object
Результат IDictionary

GetFieldsWithAttribute() публичный статический Метод

Gets all the fields from the object's type with specified attribute
public static GetFieldsWithAttribute ( Type type, Type attribute ) : FieldInfoCollection
type System.Type
attribute System.Type
Результат FieldInfoCollection

GetFieldsWithOutAttributes() публичный статический Метод

Gets all the fields WITHOUT ANY of the specified attributes.
public static GetFieldsWithOutAttributes ( Type type ) : FieldInfoCollection
type System.Type
Результат FieldInfoCollection

GetName() публичный статический Метод

Gets the name of an object. The name of the object is it's type name or the value of its Name property or field
public static GetName ( object obj ) : string
obj object
Результат string

GetNameOrEmpty() публичный статический Метод

Gets the value of a property or field name in the object. Or return empty string if there aren't any.
public static GetNameOrEmpty ( object obj ) : string
obj object
Результат string

GetProperties() публичный статический Метод

Gets the properties.
public static GetProperties ( object obj ) : System.Reflection.PropertyInfo[]
obj object The obj.
Результат System.Reflection.PropertyInfo[]

GetPropertiesDictionary() публичный статический Метод

Gets the readable (non indexed) properties names and values. The keys holds the names of the properties. The values are the values of the properties
public static GetPropertiesDictionary ( object obj ) : IDictionary
obj object
Результат IDictionary

GetPropertyValue() публичный статический Метод

Gets the property value.
public static GetPropertyValue ( PropertyInfo property, object obj ) : object
property System.Reflection.PropertyInfo The property.
obj object The obj.
Результат object

GetPropertyValue() публичный статический Метод

Gets the property value.
public static GetPropertyValue ( object obj, string property ) : object
obj object obj.
property string Property.
Результат object

GetValue() публичный статический Метод

Gets the value of the object, if the object is simple, the returned string is the object ToString(), otherwise, it's the object name (if it has one) or the object type.
public static GetValue ( object obj ) : string
obj object
Результат string

HasValue() публичный статический Метод

An object has value if it's not null, an collection containing elements and a non-empty string
public static HasValue ( object value ) : bool
value object
Результат bool

IsSimpleObject() публичный статический Метод

Determines whether the object is simple. An object is simple if its type is simple or if it's null.
public static IsSimpleObject ( object obj ) : bool
obj object
Результат bool

IsSimpleType() публичный статический Метод

Determines whether type is simple enough to need just ToString() to show its state. (string,int, bool, enums are simple. Anything else is false.
public static IsSimpleType ( Type type ) : bool
type System.Type
Результат bool

RemoveFromArray() публичный статический Метод

Removes from array.
public static RemoveFromArray ( FieldInfo field, object instance, int index ) : void
field System.Reflection.FieldInfo The field.
instance object The instance.
index int The index.
Результат void

SetName() публичный статический Метод

Sets the name property or value of an object to the value of name. Does nothing if the object doesn't have any fields or properties named 'name'
public static SetName ( object obj, string name ) : void
obj object
name string
Результат void