Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mcs / class / corlib / Documentation / en / System.Runtime.InteropServices.WindowsRuntime / ReadOnlyArrayAttribute.xml
1 <?xml version="1.0" encoding="utf-8"?>
2 <Type Name="ReadOnlyArrayAttribute" FullName="System.Runtime.InteropServices.WindowsRuntime.ReadOnlyArrayAttribute">
3   <TypeSignature Language="C#" Value="public sealed class ReadOnlyArrayAttribute : Attribute" />
4   <TypeSignature Language="ILAsm" Value=".class public auto ansi sealed beforefieldinit ReadOnlyArrayAttribute extends System.Attribute" />
5   <AssemblyInfo>
6     <AssemblyName>mscorlib</AssemblyName>
7     <AssemblyVersion>4.0.0.0</AssemblyVersion>
8   </AssemblyInfo>
9   <Base>
10     <BaseTypeName>System.Attribute</BaseTypeName>
11   </Base>
12   <Interfaces />
13   <Attributes>
14     <Attribute>
15       <AttributeName>System.AttributeUsage(System.AttributeTargets.Parameter, AllowMultiple=false, Inherited=false)</AttributeName>
16     </Attribute>
17   </Attributes>
18   <Docs>
19     <remarks>
20       <attribution license="cc4" from="Microsoft" modified="false" />
21       <para>If an array parameter in your wrt component is passed by value (ByVal in Visual Basic), you must apply one of the following attributes to it: </para>
22       <list type="bullet">
23         <item>
24           <para>Apply the <see cref="T:System.Runtime.InteropServices.WindowsRuntime.ReadOnlyArrayAttribute" /> attribute if you intend the contents of the array to be used for input only. </para>
25         </item>
26         <item>
27           <para>Apply the <see cref="T: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).</para>
28         </item>
29       </list>
30       <para>Applying both attributes to a parameter causes an error. For more information, including the standard pattern for making changes to an array, see <see cref="http://go.microsoft.com/fwlink/?LinkId=251026">Passing arrays to a Windows Runtime component</see> in the Windows Dev Center.</para>
31       <block subset="none" type="note">
32         <para>Parameters that have the <see cref="T: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 cppwrt), 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. </para>
33         <para>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 wrt component. If the tests are written in managed code, the contents of an array will appear to be mutable during testing. </para>
34       </block>
35       <para>Applying this attribute to a parameter that has the <see cref="T:System.Runtime.InteropServices.InAttribute" /> or <see cref="T:System.Runtime.InteropServices.OutAttribute" /> attribute causes an error when the module is exported. Applying the attribute to an out parameter also causes an error. </para>
36     </remarks>
37     <summary>
38       <attribution license="cc4" from="Microsoft" modified="false" />
39       <para>When applied to an array parameter in a wrt 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. See the Remarks section for important information about callers that are written using managed code. </para>
40     </summary>
41   </Docs>
42   <Members>
43     <Member MemberName=".ctor">
44       <MemberSignature Language="C#" Value="public ReadOnlyArrayAttribute ();" />
45       <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
46       <MemberType>Constructor</MemberType>
47       <AssemblyInfo>
48         <AssemblyVersion>4.0.0.0</AssemblyVersion>
49       </AssemblyInfo>
50       <Parameters />
51       <Docs>
52         <remarks>To be added.</remarks>
53         <summary>
54           <attribution license="cc4" from="Microsoft" modified="false" />
55           <para>Initializes a new instance of the <see cref="T:System.Runtime.InteropServices.WindowsRuntime.ReadOnlyArrayAttribute" /> class. </para>
56         </summary>
57       </Docs>
58     </Member>
59   </Members>
60 </Type>