C# 클래스 Rolcore.Reflection.ObjectExtensions

Extensions for Object.
파일 보기 프로젝트 열기: Rollins/Rolcore

공개 메소드들

메소드 설명
ChangeType ( this obj, Type toType ) : object

Use this instead of Convert.ChangeType to support Nullable<> types. Returns an Object with the specified Type of which the value is equivalent to the specified object.

CopyMatchingObjectPropertiesTo ( this source, object dest, bool shallow = false ) : void

Copies value type properties with matching names and compatible types from the current instance to the specified destination, even if the source and destination are not in the same inheritance family. Incompatible and missing properties are ignored. If both the source and the destination have a complex property, the method will recurse if shallow is false.

GetPropertiesWithAttribute ( this obj, Type attributeType, bool inherit ) : System.Reflection.PropertyInfo[]
GetPropertyValue ( this obj, string propertyName ) : object

Gets the value of a property of a given object.

IsNullableType ( this obj ) : bool

Determines if the given object is Nullable<>.

SetPropertyValue ( this obj, string propertyName, object propertyValue ) : void

Sets value of a property of a given object.

SetPropertyValues ( this obj, NameValueCollection propertyValues ) : void

Sets value of multiple properties of a given object.

비공개 메소드들

메소드 설명
GetMethodsWithAttribute ( this obj, Type attributeType, bool inherit ) : System.Reflection.MethodInfo[]

메소드 상세

ChangeType() 공개 정적인 메소드

Use this instead of Convert.ChangeType to support Nullable<> types. Returns an Object with the specified Type of which the value is equivalent to the specified object.
public static ChangeType ( this obj, Type toType ) : object
obj this Specifies the object for which the type should change.
toType System.Type Specifies the type to change the specified object to.
리턴 object

CopyMatchingObjectPropertiesTo() 공개 정적인 메소드

Copies value type properties with matching names and compatible types from the current instance to the specified destination, even if the source and destination are not in the same inheritance family. Incompatible and missing properties are ignored. If both the source and the destination have a complex property, the method will recurse if shallow is false.
public static CopyMatchingObjectPropertiesTo ( this source, object dest, bool shallow = false ) : void
source this Specifies the source object to copy from.
dest object Specifies the destination object to copy to.
shallow bool Specifies if the copy should be shallow.
리턴 void

GetPropertiesWithAttribute() 공개 정적인 메소드

public static GetPropertiesWithAttribute ( this obj, Type attributeType, bool inherit ) : System.Reflection.PropertyInfo[]
obj this
attributeType System.Type
inherit bool
리턴 System.Reflection.PropertyInfo[]

GetPropertyValue() 공개 정적인 메소드

Gets the value of a property of a given object.
public static GetPropertyValue ( this obj, string propertyName ) : object
obj this Specifies the object from which to retrieve the property value.
propertyName string Specifies the name of the property to be returned. This /// value can be specified using "dot syntax", e.g. "FirstProperty.SecondProperty".
리턴 object

IsNullableType() 공개 정적인 메소드

Determines if the given object is Nullable<>.
public static IsNullableType ( this obj ) : bool
obj this Specifies the object instance.
리턴 bool

SetPropertyValue() 공개 정적인 메소드

Sets value of a property of a given object.
public static SetPropertyValue ( this obj, string propertyName, object propertyValue ) : void
obj this Specifies the object on which to act.
propertyName string Specifies the name of the property to be changed. This value /// can be specified using "dot syntax", e.g. "FirstProperty.SecondProperty".
propertyValue object Specifies the new value of the property.
리턴 void

SetPropertyValues() 공개 정적인 메소드

Sets value of multiple properties of a given object.
public static SetPropertyValues ( this obj, NameValueCollection propertyValues ) : void
obj this Specifies the object on which to act.
propertyValues System.Collections.Specialized.NameValueCollection Specifies the names and values of the properties to set.
리턴 void