Helper class to perform property introspection and dynamic reading and writing.
More...
|
static bool | HasProperty (object obj, string name) |
| Checks if object has a property with specified name. More...
|
|
static object | GetProperty (object obj, string name) |
| Gets value of object property specified by its name. More...
|
|
static List< string > | GetPropertyNames (object obj) |
| Gets names of all properties implemented in specified object. More...
|
|
static Dictionary< string, object > | GetProperties (object obj) |
| Get values of all properties in specified object and returns them as a map. More...
|
|
static void | SetProperty (object obj, string name, object value) |
| Sets value of object property specified by its name. If the property does not exist or introspection fails this method doesn't do anything and doesn't any throw errors. More...
|
|
static void | SetProperties (object obj, Dictionary< string, object > values) |
| Sets values of some (all) object properties. If some properties do not exist or introspection fails they are just silently skipped and no errors thrown. More...
|
|
Helper class to perform property introspection and dynamic reading and writing.
This class has symmetric implementation across all languages supported by Pip.Services toolkit and used to support dynamic data processing.
Because all languages have different casing and case sensitivity rules, this PropertyReflector treats all property names as case insensitive.
var myObj = new MyObject();
var properties = PropertyReflector.GetPropertyNames();
PropertyReflector.HasProperty(myObj, "myProperty");
var value = PropertyReflector.GetProperty(myObj, "myProperty");
PropertyReflector.SetProperty(myObj, "myProperty", 123);