Table of Contents

Class DynamicObject

Namespace
ZapLib
Assembly
ZapLib.dll

允許在執行期間才新增成員的實體物件,等價實體的 Class,而非 dynamic。因此可適應全部 reflaction 功能

public class DynamicObject
Inheritance
DynamicObject
Inherited Members

Constructors

DynamicObject(string)

建構子,定義全新物件類別

public DynamicObject(string TypeName)

Parameters

TypeName string

類別名稱

Properties

Core

實體物件

public object Core { get; }

Property Value

object

CoreType

實體物件的 Type 物件

public Type CoreType { get; }

Property Value

Type

Methods

CreateObject()

將類別建立實例 (new 出來)

public object CreateObject()

Returns

object

建立的實體物件

CreateProperty(string, Type, object)

定義並新增實體類別的成員

public void CreateProperty(string PropertyName, Type PropertyType, object DefaultValue = null)

Parameters

PropertyName string

成員名稱

PropertyType Type

成員類型,例如: typeof(string)

DefaultValue object

成員的預設數值

SetProperty(string, object)

設定實體物件的成員數值

public void SetProperty(string PropertyName, object Value)

Parameters

PropertyName string

成員名稱

Value object

成員數值