public GetProperty ( object Instance, string Property ) : object | ||
Instance | object | |
Property | string | |
return | object |
public object GetProperty(object Instance, string Property)
{
LastException = null;
try
{
object val;
if (Property.Contains(".") || Property.Contains("["))
val = ReflectionUtils.GetPropertyEx(Instance, Property);
else
val = ReflectionUtils.GetPropertyCom(Instance, Property);
val = FixupReturnValue(val);
return val;
}
catch (Exception ex)
{
SetError(ex.GetBaseException(), true);
throw ex.GetBaseException();
}
}
/// <summary> /// Sets the Value property from a property retrieved from .NET /// Useful to transfer value in .NET that are marshalled incorrectly /// in FoxPro such as Enum values (that are marshalled as numbers) /// </summary> /// <param name="objectRef">An object reference to the base object</param> /// <param name="property">Name of the property</param> public void SetValueFromProperty(object objectRef,string property) { wwDotNetBridge bridge = new wwDotNetBridge(); Value = bridge.GetProperty(objectRef,property); }