Skip to content

GetProperty Method ​

Definition ​

  • Namespace: JASE.Extensions
  • Assembly: JASE.dll

Overloads ​

NameDescription
T GetProperty(ExpandoObject eo, string key)Retrieves the value of a property from an ExpandoObject using the specified key. Returns the value cast to the specified type, or default if not found or type mismatch.
object GetProperty(T obj, string name)Retrieves the value of a property from either a POCO or an ExpandoObject using the specified name.

T GetProperty(ExpandoObject eo, string key) ​

csharp
T GetProperty(ExpandoObject eo, string key)

Retrieves the value of a property from an ExpandoObject using the specified key. Returns the value cast to the specified type, or default if not found or type mismatch.

Type parameters ​

NameDescription
TThe expected type of the property value.

Parameters ​

NameDescription
eoThe ExpandoObject instance.
keyThe name of the property to retrieve.

Returns ​

The property value if present and of type T; otherwise, default.

object GetProperty(T obj, string name) ​

csharp
object GetProperty(T obj, string name)

Retrieves the value of a property from either a POCO or an ExpandoObject using the specified name.

Type parameters ​

NameDescription
TThe type of the object.

Parameters ​

NameDescription
nameThe name of the property to retrieve.
objThe object instance (POCO or ExpandoObject).

Returns ​

The value of the property, or null if not found.