public static PropVariant Create(ref object value, ComInterfaceType interfaceType) { if (value == null) { throw new ArgumentNullException(nameof(value)); } var result = new PropVariant(); switch (interfaceType) { case ComInterfaceType.InterfaceIsIDispatch: result.SetByRefValue(Marshal.GetIDispatchForObject(value), VarType.Dispatch); break; case ComInterfaceType.InterfaceIsIUnknown: result.SetByRefValue(Marshal.GetIUnknownForObject(value), VarType.Unknown); break; default: throw new NotSupportedException("Only IDispatch and IUnknown objects are supported."); } return(result); }
internal void DecodeInterfaceTypeAttribute(AttributeSyntax node, DiagnosticBag diagnostics) { Debug.Assert(!this.HasErrors); TypedConstant ctorArgument = this.CommonConstructorArguments[0]; Debug.Assert(ctorArgument.Kind == TypedConstantKind.Enum || ctorArgument.Kind == TypedConstantKind.Primitive); ComInterfaceType interfaceType = ctorArgument.Kind == TypedConstantKind.Enum ? ctorArgument.DecodeValue <ComInterfaceType>(SpecialType.System_Enum) : (ComInterfaceType)ctorArgument.DecodeValue <short>(SpecialType.System_Int16); switch (interfaceType) { case Cci.Constants.ComInterfaceType_InterfaceIsDual: case Cci.Constants.ComInterfaceType_InterfaceIsIDispatch: case ComInterfaceType.InterfaceIsIInspectable: case ComInterfaceType.InterfaceIsIUnknown: break; default: // CS0591: Invalid value for argument to '{0}' attribute CSharpSyntaxNode attributeArgumentSyntax = this.GetAttributeArgumentSyntax(0, node); diagnostics.Add(ErrorCode.ERR_InvalidAttributeArgument, attributeArgumentSyntax.Location, node.GetErrorDisplayName()); break; } }
public static CustomAttributeBuilder GetBuilderForInterfaceType(ComInterfaceType interfaceType) { ConstructorInfo ctorInterfaceType = typeof(InterfaceTypeAttribute).GetConstructor( BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[] { typeof(ComInterfaceType) }, null); return(new CustomAttributeBuilder(ctorInterfaceType, new Object[] { interfaceType })); }
private ComInterfaceType GetInterfaceTypeAndProcs(NdrComProxyDefinition proxy, List <NdrProcedureDefinition> procs) { ComInterfaceType type = ComInterfaceType.InterfaceIsIUnknown; if (proxy.BaseIid == COMInterfaceEntry.IID_IDispatch) { type = ComInterfaceType.InterfaceIsIDispatch; } else if (proxy.BaseIid == COMInterfaceEntry.IID_IInspectable) { type = ComInterfaceType.InterfaceIsIInspectable; } else if (m_proxies.ContainsKey(proxy.BaseIid)) { type = GetInterfaceTypeAndProcs(m_proxies[proxy.BaseIid], procs); } procs.AddRange(proxy.Procedures); return(type); }
// Constructors public InterfaceTypeAttribute(ComInterfaceType interfaceType) { }
public void Ctor_ComInterfaceType(ComInterfaceType interfaceType) { var attribute = new InterfaceTypeAttribute(interfaceType); Assert.Equal(interfaceType, attribute.Value); }
public InterfaceTypeAttribute(ComInterfaceType interfaceType) { _val = interfaceType; }
public InterfaceTypeAttribute(short interfaceType) { _val = (ComInterfaceType)interfaceType; }
public InterfaceTypeAttribute(short interfaceType) { this.type=(ComInterfaceType)interfaceType; }
// Constructors public InterfaceTypeAttribute(ComInterfaceType interfaceType) {}
public static CustomAttributeBuilder GetBuilderForInterfaceType(ComInterfaceType interfaceType) { ConstructorInfo ctorInterfaceType = typeof(InterfaceTypeAttribute).GetConstructor( BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[] { typeof(ComInterfaceType) }, null); return new CustomAttributeBuilder(ctorInterfaceType, new Object[] { interfaceType }); }
public InterfaceTypeAttribute(ComInterfaceType interfaceType) { this.type=interfaceType; }
public InterfaceTypeAttribute(ComInterfaceType interfaceType) { this._val = interfaceType; }
internal InterfaceTypeAttribute(ComInterfaceType interfaceType) { _val = interfaceType; }
public InterfaceTypeAttribute (ComInterfaceType interfaceType){ intType = interfaceType; }
public InterfaceTypeAttribute(short interfaceType) { intType = (ComInterfaceType)interfaceType; }
public InterfaceTypeAttribute(ComInterfaceType interfaceType) { intType = interfaceType; }
/// <summary>Initializes a new instance of the <see cref="T:System.Runtime.InteropServices.InterfaceTypeAttribute" /> class with the specified <see cref="T:System.Runtime.InteropServices.ComInterfaceType" /> enumeration member.</summary><param name="interfaceType">One of the <see cref="T:System.Runtime.InteropServices.ComInterfaceType" /> values that describes how the interface should be exposed to COM clients. </param> public InterfaceTypeAttribute(ComInterfaceType interfaceType) { throw new NotImplementedException(); }
internal InterfaceTypeAttribute(short interfaceType) { _val = (ComInterfaceType)interfaceType; }
public InterfaceTypeAttribute(short interfaceType) { this._val = (ComInterfaceType)interfaceType; }
public InterfaceTypeAttribute(ComInterfaceType interfaceType) { Value = interfaceType; }