/
ReadOnlyArrayAttribute.xml
86 lines (79 loc) · 6.24 KB
/
ReadOnlyArrayAttribute.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
<Type Name="ReadOnlyArrayAttribute" FullName="System.Runtime.InteropServices.WindowsRuntime.ReadOnlyArrayAttribute">
<TypeSignature Language="C#" Value="public sealed class ReadOnlyArrayAttribute : Attribute" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi sealed beforefieldinit ReadOnlyArrayAttribute extends System.Attribute" />
<TypeSignature Language="DocId" Value="T:System.Runtime.InteropServices.WindowsRuntime.ReadOnlyArrayAttribute" />
<TypeSignature Language="VB.NET" Value="Public NotInheritable Class ReadOnlyArrayAttribute
Inherits Attribute" />
<TypeSignature Language="F#" Value="type ReadOnlyArrayAttribute = class
 inherit Attribute" />
<TypeSignature Language="C++ CLI" Value="public ref class ReadOnlyArrayAttribute sealed : Attribute" />
<AssemblyInfo>
<AssemblyName>System.Runtime.InteropServices.WindowsRuntime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<AssemblyVersion>4.0.4.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<TypeForwardingChain>
<TypeForwarding From="mscorlib" FromVersion="4.0.0.0" To="System.Runtime.InteropServices.WindowsRuntime" ToVersion="0.0.0.0" FrameworkAlternate="dotnet-uwp-10.0" />
</TypeForwardingChain>
<Base>
<BaseTypeName>System.Attribute</BaseTypeName>
</Base>
<Interfaces />
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.AttributeUsage(System.AttributeTargets.Parameter, AllowMultiple=false, Inherited=false)]</AttributeName>
<AttributeName Language="F#">[<System.AttributeUsage(System.AttributeTargets.Parameter, AllowMultiple=false, Inherited=false)>]</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>When applied to an array parameter in a Windows Runtime component, specifies that the contents of the array that is passed to that parameter are used only for input. The caller expects the array to be unchanged by the call.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
If an array parameter in your Windows Runtime component is passed by value (`ByVal` in Visual Basic), you must apply one of the following attributes to it:
- Apply the <xref:System.Runtime.InteropServices.WindowsRuntime.ReadOnlyArrayAttribute> attribute if you intend the contents of the array to be used for input only.
- Apply the <xref:System.Runtime.InteropServices.WindowsRuntime.WriteOnlyArrayAttribute> attribute if you intend the contents of the array to be used for output only (that is, the method sets the contents of the array but does not read them).
Applying both attributes to a parameter causes an error. For more information, including the standard pattern for making changes to an array, see [Passing arrays to a Windows Runtime component](https://go.microsoft.com/fwlink/?LinkId=251026) in the Windows Dev Center.
> [!IMPORTANT]
> Parameters that have the <xref:System.Runtime.InteropServices.WindowsRuntime.ReadOnlyArrayAttribute> attribute behave differently depending on whether the caller is written in native code or managed code. If the caller is native code (JavaScript or Visual C++ component extensions), the array is copied when the call crosses the application binary interface (ABI) boundary. Elements are converted if necessary. Therefore, any accidental changes the method makes to an input-only array are not visible to the caller.
>
> If the caller is managed code, the array is not copied. The original array is available to the called method, as it would be in any method call in the .NET Framework. Array contents are mutable in .NET Framework code, so any changes the method makes to the array are visible to the caller. This is important to remember because it affects unit tests written for a Windows Runtime component. If the tests are written in managed code, the contents of an array will appear to be mutable during testing.
Applying this attribute to a parameter that has the <xref:System.Runtime.InteropServices.InAttribute> or <xref:System.Runtime.InteropServices.OutAttribute> attribute causes an error when the module is exported. Applying the attribute to an `out` parameter also causes an error.
]]></format>
</remarks>
<altmember cref="T:System.Runtime.InteropServices.WindowsRuntime.WriteOnlyArrayAttribute" />
<related type="Article" href="/dotnet/framework/tools/winmdexp-exe-windows-runtime-metadata-export-tool">Winmdexp.exe (Windows Runtime Metadata Export Tool)</related>
<related type="ExternalDocumentation" href="https://go.microsoft.com/fwlink/p/?LinkId=238313">Creating Windows Runtime Components in C# and Visual Basic</related>
<related type="ExternalDocumentation" href="https://go.microsoft.com/fwlink/?LinkId=251026">Passing arrays to a Windows Runtime component</related>
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public ReadOnlyArrayAttribute ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Runtime.InteropServices.WindowsRuntime.ReadOnlyArrayAttribute.#ctor" />
<MemberSignature Language="VB.NET" Value="Public Sub New ()" />
<MemberSignature Language="C++ CLI" Value="public:
 ReadOnlyArrayAttribute();" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Runtime.InteropServices.WindowsRuntime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<AssemblyVersion>4.0.4.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters />
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.Runtime.InteropServices.WindowsRuntime.ReadOnlyArrayAttribute" /> class.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
</Members>
</Type>