Class DynamicObjectExtensions
Dynamic extension methods for objects.
Inheritance
Inherited Members
Namespace: Kephas
Assembly: Kephas.Core.dll
Syntax
public static class DynamicObjectExtensions
Methods
| Improve this Doc View SourceGetPropertyValue(Object, String)
Dynamically gets the property value.
Declaration
public static object GetPropertyValue(this object obj, string propertyName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | obj | The object. |
| System.String | propertyName | Name of the property. |
Returns
| Type | Description |
|---|---|
| System.Object | The property value. |
GetRuntimeTypeInfo(Object)
Gets a runtime type information out of the provided instance.
Declaration
public static IRuntimeTypeInfo GetRuntimeTypeInfo(this object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | obj | The object. |
Returns
| Type | Description |
|---|---|
| IRuntimeTypeInfo | A dynamic type information for the provided object. |
SetPropertyValue(Object, String, Object)
Dynamically sets the property value.
Declaration
public static void SetPropertyValue(this object obj, string propertyName, object value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | obj | The object. |
| System.String | propertyName | Name of the property. |
| System.Object | value | The value. |
ToDynamic(Object)
Gets a dynamic object out of the provided instance.
Declaration
public static dynamic ToDynamic(this object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | obj | The object. |
Returns
| Type | Description |
|---|---|
| System.Object | A dynamic object wrapping the provided object. |
ToExpando(Object)
Gets an IExpando object out of the provided instance.
Declaration
public static IExpando ToExpando(this object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | obj | The object. |
Returns
| Type | Description |
|---|---|
| IExpando | An IExpando wrapping the provided object. If the provided object is an expando, that object is returned. |
TryGetPropertyValue(Object, String, out Object)
Dynamically gets the property value.
Declaration
public static bool TryGetPropertyValue(this object obj, string propertyName, out object value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | obj | The object. |
| System.String | propertyName | Name of the property. |
| System.Object | value | The property value. |
Returns
| Type | Description |
|---|---|
| System.Boolean | A boolean value indicating whether the property is found. |
TrySetPropertyValue(Object, String, Object)
Dynamically sets the property value.
Declaration
public static bool TrySetPropertyValue(this object obj, string propertyName, object value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | obj | The object. |
| System.String | propertyName | Name of the property. |
| System.Object | value | The value. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
Remarks
If the object passed is null, then false is returned.