C# 클래스 Westwind.Utilities.Expando

상속: System.Dynamic.DynamicObject, IDynamicMetaObjectProvider
파일 보기 프로젝트 열기: RickStrahl/WestwindToolkit 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
Properties PropertyBag

Private Properties

프로퍼티 타입 설명

공개 메소드들

메소드 설명
Contains ( object>.KeyValuePair item, bool includeInstanceProperties = false ) : bool

Checks whether a property exists in the Property collection or as a property on the instance

Expando ( ) : System

This constructor just works off the internal dictionary and any public properties of this object. Note you can subclass Expando.

Expando ( object>.IDictionary dict ) : System

Create an Expando from a dictionary

Expando ( object instance ) : System

Allows passing in an existing instance variable to 'extend'.

You can pass in null here if you don't want to check native properties and only check the Dictionary!

GetDynamicMemberNames ( ) : IEnumerable

Return both instance and dynamic names. Important to return both so JSON serialization with Json.NET works.

GetProperties ( bool includeInstanceProperties = false ) : object>>.IEnumerable

Returns and the properties of

TryGetMember ( GetMemberBinder binder, object &result ) : bool

Try to retrieve a member by name first from instance properties followed by the collection entries.

TryInvokeMember ( InvokeMemberBinder binder, object args, object &result ) : bool

Dynamic invocation method. Currently allows only for Reflection based operation (no ability to add methods dynamically).

TrySetMember ( SetMemberBinder binder, object value ) : bool

Property setter implementation tries to retrieve value from instance first then into this object

this ( string key ) : object

Convenience method that provides a string Indexer to the Properties collection AND the strongly typed properties of the object by name. // dynamic exp["Address"] = "112 nowhere lane"; // strong var name = exp["StronglyTypedProperty"] as string;

The getter checks the Properties dictionary first then looks in PropertyInfo for properties. The setter checks the instance properties before checking the Properties dictionary.

보호된 메소드들

메소드 설명
GetProperty ( object instance, string name, object &result ) : bool

Reflection Helper method to retrieve a property

Initialize ( object instance ) : void
InvokeMethod ( object instance, string name, object args, object &result ) : bool

Reflection helper method to invoke a method

SetProperty ( object instance, string name, object value ) : bool

Reflection helper method to set a property value

메소드 상세

Contains() 공개 메소드

Checks whether a property exists in the Property collection or as a property on the instance
public Contains ( object>.KeyValuePair item, bool includeInstanceProperties = false ) : bool
item object>.KeyValuePair
includeInstanceProperties bool
리턴 bool

Expando() 공개 메소드

This constructor just works off the internal dictionary and any public properties of this object. Note you can subclass Expando.
public Expando ( ) : System
리턴 System

Expando() 공개 메소드

Create an Expando from a dictionary
public Expando ( object>.IDictionary dict ) : System
dict object>.IDictionary
리턴 System

Expando() 공개 메소드

Allows passing in an existing instance variable to 'extend'.
You can pass in null here if you don't want to check native properties and only check the Dictionary!
public Expando ( object instance ) : System
instance object
리턴 System

GetDynamicMemberNames() 공개 메소드

Return both instance and dynamic names. Important to return both so JSON serialization with Json.NET works.
public GetDynamicMemberNames ( ) : IEnumerable
리턴 IEnumerable

GetProperties() 공개 메소드

Returns and the properties of
public GetProperties ( bool includeInstanceProperties = false ) : object>>.IEnumerable
includeInstanceProperties bool
리턴 object>>.IEnumerable

GetProperty() 보호된 메소드

Reflection Helper method to retrieve a property
protected GetProperty ( object instance, string name, object &result ) : bool
instance object
name string
result object
리턴 bool

Initialize() 보호된 메소드

protected Initialize ( object instance ) : void
instance object
리턴 void

InvokeMethod() 보호된 메소드

Reflection helper method to invoke a method
protected InvokeMethod ( object instance, string name, object args, object &result ) : bool
instance object
name string
args object
result object
리턴 bool

SetProperty() 보호된 메소드

Reflection helper method to set a property value
protected SetProperty ( object instance, string name, object value ) : bool
instance object
name string
value object
리턴 bool

TryGetMember() 공개 메소드

Try to retrieve a member by name first from instance properties followed by the collection entries.
public TryGetMember ( GetMemberBinder binder, object &result ) : bool
binder System.Dynamic.GetMemberBinder
result object
리턴 bool

TryInvokeMember() 공개 메소드

Dynamic invocation method. Currently allows only for Reflection based operation (no ability to add methods dynamically).
public TryInvokeMember ( InvokeMemberBinder binder, object args, object &result ) : bool
binder System.Dynamic.InvokeMemberBinder
args object
result object
리턴 bool

TrySetMember() 공개 메소드

Property setter implementation tries to retrieve value from instance first then into this object
public TrySetMember ( SetMemberBinder binder, object value ) : bool
binder System.Dynamic.SetMemberBinder
value object
리턴 bool

this() 공개 메소드

Convenience method that provides a string Indexer to the Properties collection AND the strongly typed properties of the object by name. // dynamic exp["Address"] = "112 nowhere lane"; // strong var name = exp["StronglyTypedProperty"] as string;
The getter checks the Properties dictionary first then looks in PropertyInfo for properties. The setter checks the instance properties before checking the Properties dictionary.
public this ( string key ) : object
key string
리턴 object

프로퍼티 상세

Properties 공개적으로 프로퍼티

String Dictionary that contains the extra dynamic values stored on this object/instance
Using PropertyBag to support XML Serialization of the dictionary
public PropertyBag Properties
리턴 PropertyBag