Westwind.WebConnection.wwDotNetBridge.SetProperty C# (CSharp) Method

SetProperty() public method

Sets a property of a .NET object with a value
public SetProperty ( object Instance, string Property, object Value ) : void
Instance object
Property string
Value object
return void
        public void SetProperty(object Instance, string Property, object Value)
        {
            LastException = null;

            if (Value is DBNull)
                Value = null;

            Value = FixupParameter(Value);
            try
            {
                if (Property.Contains(".") || Property.Contains("["))
                    ReflectionUtils.SetPropertyEx(Instance, Property, Value);
                else
                    ReflectionUtils.SetPropertyCom(Instance, Property, Value);
            }
            catch (Exception ex)
            {
                SetError(ex.GetBaseException(), true);
                throw ex.GetBaseException();
            }
        }

Usage Example

Beispiel #1
0
 /// <summary>
 /// Method that sets the Value property by fixing up any
 /// values based on GetProperty() rules. This means if you pass 
 /// an ComArray the raw array will be unpacked and stored for example.
 /// </summary>
 public void SetValue(object value)
 {
     object obj = this;
     wwDotNetBridge bridge = new wwDotNetBridge();
     bridge.SetProperty(obj,"Value",value);
 }
wwDotNetBridge