|
62 | 62 | <Docs> |
63 | 63 | <summary>Indicates whether a managed interface is dual, dispatch-only, or <see langword="IUnknown" /> -only when exposed to COM.</summary> |
64 | 64 | <remarks> |
65 | | - <format type="text/markdown">< exposes a managed interface to COM as a dual interface, giving you the flexibility of late binding or the performance of early binding. The <xref:System.Runtime.InteropServices.ComInterfaceType> enumeration enables you to override the default behavior and specify late binding only or early binding only. For example, you can apply `InterfaceType (ComInterfaceType.InterfaceIsIDispatch)` to an interface to produce metadata to restrict callers to late binding only. Although interfaces that derive from the `IDispatch` interface are often dual, the `InterfaceIsIDispatch` enumeration member allows only late-bound calls to the interface methods. This attribute has no effect on the managed view of the interface. For additional information on how interfaces are exposed to COM, see [Exported Type Conversion](https://learn.microsoft.com/en-us/)). |
71 | | - |
72 | | - The [Tlbimp.exe (Type Library Importer)](/dotnet/framework/tools/tlbimp-exe-type-library-importer) also applies this attribute to imported, nondual interfaces; it applies the appropriate enumeration member to indicate that the interface is dispatch-only or `IUnknown` -only. |
73 | | - |
74 | | - |
75 | | - |
76 | | -## Examples |
77 | | - The following example shows how `InterfaceTypeAttribute` controls how the interface is exposed to COM. |
78 | | - |
| 65 | + <format type="text/markdown">< exposes a managed interface to COM as a dual interface, giving you the flexibility of late binding or the performance of early binding. The <xref:System.Runtime.InteropServices.ComInterfaceType> enumeration enables you to override the default behavior and specify late binding only or early binding only. For example, you can apply `InterfaceType (ComInterfaceType.InterfaceIsIDispatch)` to an interface to produce metadata to restrict callers to late binding only. Although interfaces that derive from the `IDispatch` interface are often dual, the `InterfaceIsIDispatch` enumeration member allows only late-bound calls to the interface methods. This attribute has no effect on the managed view of the interface. |
| 71 | +
|
| 72 | + The [Tlbimp.exe (Type Library Importer)](/dotnet/framework/tools/tlbimp-exe-type-library-importer) also applies this attribute to imported, nondual interfaces; it applies the appropriate enumeration member to indicate that the interface is dispatch-only or `IUnknown` -only. |
| 73 | +
|
| 74 | +## Examples |
| 75 | + The following example shows how `InterfaceTypeAttribute` controls how the interface is exposed to COM. |
| 76 | +
|
79 | 77 | :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic InterfaceTypeAttribute Example/CPP/source.cpp" id="Snippet1"::: |
80 | 78 | :::code language="csharp" source="~/snippets/csharp/System.Runtime.InteropServices/InterfaceTypeAttribute/Overview/source.cs" id="Snippet1"::: |
81 | | - :::code language="vb" source="~/snippets/visualbasic/System.Runtime.InteropServices/InterfaceTypeAttribute/Overview/source.vb" id="Snippet1"::: |
82 | | - |
| 79 | + :::code language="vb" source="~/snippets/visualbasic/System.Runtime.InteropServices/InterfaceTypeAttribute/Overview/source.vb" id="Snippet1"::: |
| 80 | +
|
83 | 81 | ]]></format> |
84 | 82 | </remarks> |
85 | 83 | <altmember cref="T:System.Runtime.InteropServices.ComInterfaceType" /> |
|
146 | 144 | <param name="interfaceType">Describes how the interface should be exposed to COM clients.</param> |
147 | 145 | <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> |
148 | 146 | <remarks> |
149 | | - <format type="text/markdown">< uses this constructor. |
153 | | - |
| 147 | + <format type="text/markdown">< uses this constructor. |
| 151 | +
|
154 | 152 | ]]></format> |
155 | 153 | </remarks> |
156 | 154 | <related type="Article" href="/dotnet/framework/tools/tlbimp-exe-type-library-importer">Tlbimp.exe (Type Library Importer)</related> |
|
201 | 199 | <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> |
202 | 200 | <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> |
203 | 201 | <remarks> |
204 | | - <format type="text/markdown"><![CDATA[ |
205 | | - |
206 | | -## Remarks |
207 | | - For readable code that is less prone to error, always use this constructor. |
208 | | - |
| 202 | + <format type="text/markdown"><![CDATA[ |
| 203 | +
|
| 204 | +## Remarks |
| 205 | + For readable code that is less prone to error, always use this constructor. |
| 206 | +
|
209 | 207 | ]]></format> |
210 | 208 | </remarks> |
211 | 209 | </Docs> |
|
0 commit comments