/
VariantWrapper.xml
201 lines (189 loc) · 15.3 KB
/
VariantWrapper.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<Type Name="VariantWrapper" FullName="System.Runtime.InteropServices.VariantWrapper">
<TypeSignature Language="C#" Value="public sealed class VariantWrapper" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi sealed beforefieldinit VariantWrapper extends System.Object" FrameworkAlternate="dotnet-uwp-10.0;net-5.0;net-6.0;net-7.0;net-8.0;net-9.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netcore-3.1;netframework-1.1;netstandard-1.1;netstandard-1.2;netstandard-1.3;netstandard-1.4;netstandard-1.5;netstandard-1.6;netstandard-2.0;netstandard-2.1" />
<TypeSignature Language="DocId" Value="T:System.Runtime.InteropServices.VariantWrapper" />
<TypeSignature Language="VB.NET" Value="Public NotInheritable Class VariantWrapper" />
<TypeSignature Language="F#" Value="type VariantWrapper = class" />
<TypeSignature Language="C++ CLI" Value="public ref class VariantWrapper sealed" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi serializable sealed beforefieldinit VariantWrapper extends System.Object" FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1" />
<AssemblyInfo>
<AssemblyName>System.Runtime.InteropServices</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<TypeForwardingChain>
<TypeForwarding From="mscorlib" FromVersion="4.0.0.0" To="System.Runtime.InteropServices" ToVersion="0.0.0.0" FrameworkAlternate="dotnet-uwp-10.0" />
<TypeForwarding From="netstandard" FromVersion="2.1.0.0" To="System.Runtime.InteropServices" ToVersion="5.0.0.0" FrameworkAlternate="net-5.0" />
<TypeForwarding From="netstandard" FromVersion="2.1.0.0" To="System.Runtime.InteropServices" ToVersion="6.0.0.0" FrameworkAlternate="net-6.0" />
<TypeForwarding From="netstandard" FromVersion="2.1.0.0" To="System.Runtime.InteropServices" ToVersion="7.0.0.0" FrameworkAlternate="net-7.0" />
<TypeForwarding From="netstandard" FromVersion="2.1.0.0" To="System.Runtime.InteropServices" ToVersion="8.0.0.0" FrameworkAlternate="net-8.0" />
<TypeForwarding From="netstandard" FromVersion="2.1.0.0" To="System.Runtime.InteropServices" ToVersion="9.0.0.0" FrameworkAlternate="net-9.0" />
<TypeForwarding From="System.Runtime.InteropServices" FromVersion="4.1.0.0" To="mscorlib" ToVersion="4.0.0.0" FrameworkAlternate="netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1" />
</TypeForwardingChain>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces />
<Attributes>
<Attribute FrameworkAlternate="dotnet-uwp-10.0;net-5.0;net-6.0;net-7.0;net-8.0;net-9.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netcore-3.1;netstandard-1.2;netstandard-1.3;netstandard-1.4;netstandard-1.5;netstandard-1.6;netstandard-2.1">
<AttributeName Language="C#">[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="dotnet-uwp-10.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netcore-3.1;netstandard-1.2;netstandard-1.3;netstandard-1.4;netstandard-1.5;netstandard-1.6;netstandard-2.1">
<AttributeName Language="C#">[System.Obsolete("VariantWrapper and support for marshalling to the VARIANT type may be unavailable in future releases.")]</AttributeName>
<AttributeName Language="F#">[<System.Obsolete("VariantWrapper and support for marshalling to the VARIANT type may be unavailable in future releases.")>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="net-8.0;net-9.0">
<AttributeName Language="C#">[System.Runtime.CompilerServices.Nullable(0)]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.CompilerServices.Nullable(0)>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="net-8.0;net-9.0">
<AttributeName Language="C#">[System.Runtime.CompilerServices.NullableContext(2)]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.CompilerServices.NullableContext(2)>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1">
<AttributeName Language="C#">[System.Serializable]</AttributeName>
<AttributeName Language="F#">[<System.Serializable>]</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>Marshals data of type <see langword="VT_VARIANT | VT_BYREF" /> from managed to unmanaged code. This class cannot be inherited.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The purpose of <xref:System.Runtime.InteropServices.VariantWrapper> is to add one level of indirection when marshaling a managed type to the corresponding `VARIANT` type.
You can use this class to wrap an <xref:System.Object> that the interop marshaler passes as `VT_VARIANT | VT_BYREF`. In versions 1.0 and 1.1 of the .NET Framework, it was not possible to marshal variant data of type `VT_VARIANT | VT_BYREF` to unmanaged code. The interop marshaler passed a variant of the managed type (for example, `VT_BSTR | VT_BYREF` for <xref:System.String>, or `VT_I4 | VT_BYREF` for <xref:System.Int32>), but not `VT_VARIANT | VT_BYREF`.
One advantage of using `VT_VARIANT | VT_BYREF` variant types is that the type of data can be changed during a method call. For example, you can pass a `VT_VARIANT | VT_BYREF` variant type that contains a `VT_BSTR` and get a variant returned that contains a `VT_I4` after a method call. Because the COM interop marshaler has no way of knowing when to pass `VT_BSTR | VT_BYREF` and when to pass `VT_VARIANT | VT_BYREF`, which points to a variant that contains a `BSTR` for parameters declared as `VARIANT *`, you can instruct the marshaler by using <xref:System.Runtime.InteropServices.VariantWrapper>.
Note that early binding is not supported; you can use <xref:System.Runtime.InteropServices.VariantWrapper> only when calling <xref:System.Type.InvokeMember%2A> or with a Dispatch-only interface called in an early bound fashion. In C#, you must also use the `ref` keyword to specify `ByRef` semantics for any parameter of type <xref:System.Runtime.InteropServices.VariantWrapper>. In Visual Basic, `ByRef` semantics are added automatically for every implicit late binding call. Also note that nesting <xref:System.Runtime.InteropServices.VariantWrapper> objects and arrays of <xref:System.Runtime.InteropServices.VariantWrapper> objects is not supported.
## Examples
The following code example demonstrates how to use the <xref:System.Runtime.InteropServices.VariantWrapper> class to wrap an <xref:System.Object> that the interop marshaler passes as `VT_VARIANT | VT_BYREF`.
:::code language="csharp" source="~/snippets/csharp/System.Runtime.InteropServices/VariantWrapper/Overview/sample.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Runtime.InteropServices.VariantWrapper/vb/sample.vb" id="Snippet1":::
]]></format>
</remarks>
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public VariantWrapper (object obj);" FrameworkAlternate="dotnet-uwp-10.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;netstandard-1.1;netstandard-1.2;netstandard-1.3;netstandard-1.4;netstandard-1.5;netstandard-1.6;netstandard-2.0;netstandard-2.1" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(object obj) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Runtime.InteropServices.VariantWrapper.#ctor(System.Object)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (obj As Object)" />
<MemberSignature Language="F#" Value="new System.Runtime.InteropServices.VariantWrapper : obj -> System.Runtime.InteropServices.VariantWrapper" Usage="new System.Runtime.InteropServices.VariantWrapper obj" />
<MemberSignature Language="C++ CLI" Value="public:
 VariantWrapper(System::Object ^ obj);" />
<MemberSignature Language="C#" Value="public VariantWrapper (object? obj);" FrameworkAlternate="net-5.0;net-6.0;net-7.0;net-8.0;net-9.0;netcore-3.0;netcore-3.1" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Runtime.InteropServices</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="obj" Type="System.Object" />
</Parameters>
<Docs>
<param name="obj">The object to marshal.</param>
<summary>Initializes a new instance of the <see cref="T:System.Runtime.InteropServices.VariantWrapper" /> class for the specified <see cref="T:System.Object" /> parameter.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Examples
The following code example demonstrates how to use the <xref:System.Runtime.InteropServices.VariantWrapper> class to wrap an <xref:System.Object> that the interop marshaler passes as `VT_VARIANT | VT_BYREF`.
:::code language="csharp" source="~/snippets/csharp/System.Runtime.InteropServices/VariantWrapper/Overview/sample.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Runtime.InteropServices.VariantWrapper/vb/sample.vb" id="Snippet1":::
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="WrappedObject">
<MemberSignature Language="C#" Value="public object WrappedObject { get; }" FrameworkAlternate="dotnet-uwp-10.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;netstandard-1.1;netstandard-1.2;netstandard-1.3;netstandard-1.4;netstandard-1.5;netstandard-1.6;netstandard-2.0;netstandard-2.1" />
<MemberSignature Language="ILAsm" Value=".property instance object WrappedObject" />
<MemberSignature Language="DocId" Value="P:System.Runtime.InteropServices.VariantWrapper.WrappedObject" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property WrappedObject As Object" />
<MemberSignature Language="F#" Value="member this.WrappedObject : obj" Usage="System.Runtime.InteropServices.VariantWrapper.WrappedObject" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::Object ^ WrappedObject { System::Object ^ get(); };" />
<MemberSignature Language="C#" Value="public object? WrappedObject { get; }" FrameworkAlternate="net-5.0;net-6.0;net-7.0;net-8.0;net-9.0;netcore-3.0;netcore-3.1" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Runtime.InteropServices</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Object</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the object wrapped by the <see cref="T:System.Runtime.InteropServices.VariantWrapper" /> object.</summary>
<value>The object wrapped by the <see cref="T:System.Runtime.InteropServices.VariantWrapper" /> object.</value>
<remarks>To be added.</remarks>
</Docs>
</Member>
</Members>
</Type>