public static int InvokePropertySet(this IDispatch dispatch, string name, object value) { int hr = NativeMethods.S_OK; int dispid = 0; if (MarshalEx.Succeeded(dispatch.GetIdOfName(name, out dispid))) { hr = dispatch.InvokePropertySet(dispid, value); } return(hr); }
public static int InvokeMethod(this IDispatch dispatch, string name, object[] args, out object returnValue) { int hr = NativeMethods.S_OK; int id = 0; returnValue = null; if (MarshalEx.Succeeded(hr = dispatch.GetIdOfName(name, out id))) { hr = InvokeMethod(dispatch, id, args, out returnValue); } return(hr); }