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

GetStaticProperty() public method

Retrieves a value from a static property by specifying a type full name and property
public GetStaticProperty ( string TypeName, string Property ) : object
TypeName string Full type name (namespace.class)
Property string Property to get value from
return object
        public object GetStaticProperty(string TypeName, string Property)
        {
            SetError();

            Type type = GetTypeFromName(TypeName);
            if (type == null)
            {
                SetError("Type is not loaded. Please make sure you call LoadAssembly first.");
                return null;
            }

            object val = null;
            try
            {
                val = type.InvokeMember(Property, BindingFlags.Static | BindingFlags.Public | BindingFlags.GetField | BindingFlags.GetProperty, null, type, null);
                val = FixupReturnValue(val);
            }
            catch (Exception ex)
            {
                SetError(ex.GetBaseException(), true);
                throw ex.GetBaseException();
            }
            return val;
        }

Usage Example

 public void SetValueFromEnum(string enumType, string enumName)
 {
     wwDotNetBridge bridge = new wwDotNetBridge();
     Value = bridge.GetStaticProperty(enumType, enumName);
 }
All Usage Examples Of Westwind.WebConnection.wwDotNetBridge::GetStaticProperty
wwDotNetBridge