Class ReflectionExtensions
- Namespace
- MADE.Runtime.Extensions
- Assembly
- MADE.Runtime.dll
Defines a collection of extensions for object reflection.
public static class ReflectionExtensions
- Inheritance
-
ReflectionExtensions
- Inherited Members
Methods
GetPropertyNames(object)
Gets all the property names declared for the specified object.
public static IEnumerable<string> GetPropertyNames(this object obj)
Parameters
objobjectThe object to retrieve property names from.
Returns
- IEnumerable<string>
A collection of object property names as a string.
GetPropertyValue<T>(object, string)
Gets a value for a property of the obj based on the property.
public static T? GetPropertyValue<T>(this object obj, string property) where T : class
Parameters
objobjectThe object to retrieve the property value from.
propertystringThe name of the property to retrieve a value for.
Returns
- T
The value of the property.
Type Parameters
TThe type of expected value.
Exceptions
- AmbiguousMatchException
More than one property is found with the specified name.