/
XmlArrayItemAttribute.xml
1037 lines (936 loc) · 67.5 KB
/
XmlArrayItemAttribute.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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<Type Name="XmlArrayItemAttribute" FullName="System.Xml.Serialization.XmlArrayItemAttribute">
<TypeSignature Language="C#" Value="public class XmlArrayItemAttribute : Attribute" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit XmlArrayItemAttribute extends System.Attribute" />
<TypeSignature Language="DocId" Value="T:System.Xml.Serialization.XmlArrayItemAttribute" />
<TypeSignature Language="VB.NET" Value="Public Class XmlArrayItemAttribute
Inherits Attribute" />
<TypeSignature Language="F#" Value="type XmlArrayItemAttribute = class
 inherit Attribute" />
<TypeSignature Language="C++ CLI" Value="public ref class XmlArrayItemAttribute : Attribute" />
<AssemblyInfo>
<AssemblyName>System.Xml.XmlSerializer</AssemblyName>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.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>System.Xml</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>
<AssemblyInfo>
<AssemblyName>System.Xml.Serialization</AssemblyName>
</AssemblyInfo>
<TypeForwardingChain>
<TypeForwarding From="System.Xml" FromVersion="4.0.0.0" To="System.Xml.XmlSerializer" ToVersion="0.0.0.0" FrameworkAlternate="dotnet-uwp-10.0" />
<TypeForwarding From="System.Xml.Serialization" FromVersion="4.0.0.0" To="System.Xml.XmlSerializer" ToVersion="0.0.0.0" FrameworkAlternate="dotnet-uwp-10.0" />
<TypeForwarding From="netstandard" FromVersion="2.1.0.0" To="System.Xml.XmlSerializer" ToVersion="5.0.0.0" FrameworkAlternate="net-5.0" />
<TypeForwarding From="netstandard" FromVersion="2.1.0.0" To="System.Xml.XmlSerializer" ToVersion="6.0.0.0" FrameworkAlternate="net-6.0" />
<TypeForwarding From="netstandard" FromVersion="2.1.0.0" To="System.Xml.XmlSerializer" ToVersion="7.0.0.0" FrameworkAlternate="net-7.0" />
<TypeForwarding From="netstandard" FromVersion="2.1.0.0" To="System.Xml.XmlSerializer" ToVersion="8.0.0.0" FrameworkAlternate="net-8.0" />
<TypeForwarding From="netstandard" FromVersion="2.1.0.0" To="System.Xml.XmlSerializer" ToVersion="9.0.0.0" FrameworkAlternate="net-9.0" />
<TypeForwarding From="System.Xml.Serialization" FromVersion="4.0.0.0" To="System.Xml" ToVersion="4.0.0.0" FrameworkAlternate="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" />
</TypeForwardingChain>
<Base>
<BaseTypeName>System.Attribute</BaseTypeName>
</Base>
<Interfaces />
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.AttributeUsage(System.AttributeTargets.Field | System.AttributeTargets.Parameter | System.AttributeTargets.Property | System.AttributeTargets.ReturnValue, AllowMultiple=true)]</AttributeName>
<AttributeName Language="F#">[<System.AttributeUsage(System.AttributeTargets.Field | System.AttributeTargets.Parameter | System.AttributeTargets.Property | System.AttributeTargets.ReturnValue, AllowMultiple=true)>]</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>
</Attributes>
<Docs>
<summary>Represents an attribute that specifies the derived types that the <see cref="T:System.Xml.Serialization.XmlSerializer" /> can place in a serialized array.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Xml.Serialization.XmlArrayItemAttribute> belongs to a family of attributes that controls how the <xref:System.Xml.Serialization.XmlSerializer> serializes or deserializes an object. For a complete list of similar attributes, see [Attributes That Control XML Serialization](/dotnet/standard/serialization/attributes-that-control-xml-serialization).
You can apply the <xref:System.Xml.Serialization.XmlArrayItemAttribute> to any public read/write member that returns an array, or provides access to one. For example, a field that returns an array of objects, a collection, an <xref:System.Collections.ArrayList>, or any class that implements the <xref:System.Collections.IEnumerable> interface.
The <xref:System.Xml.Serialization.XmlArrayItemAttribute> supports polymorphism--in other words, it allows the <xref:System.Xml.Serialization.XmlSerializer> to add derived objects to an array. For example, suppose a class named `Mammal` is derived from a base class named `Animal`. Further suppose that a class named `MyAnimals` contains a field that returns an array of `Animal` objects. To allow the <xref:System.Xml.Serialization.XmlSerializer> to serialize both the `Animal` and `Mammal` type, apply the <xref:System.Xml.Serialization.XmlArrayItemAttribute> to the field twice, each time specifying one of the two acceptable types.
> [!NOTE]
> You can apply multiple instances of the <xref:System.Xml.Serialization.XmlArrayItemAttribute> or <xref:System.Xml.Serialization.XmlElementAttribute> to specify types of objects that can be inserted into the array.
> [!NOTE]
> The serialization of a field or property that returns an interface or array of interfaces is not supported.
For more information about using attributes, see [Attributes](/dotnet/standard/attributes/).
> [!NOTE]
> You can use the word `XmlArrayItem` in your code instead of the longer <xref:System.Xml.Serialization.XmlArrayItemAttribute>.
## Examples
The following example serializes a class named `Group` that contains a field named `Employees` that returns an array of `Employee` objects. The example applies the <xref:System.Xml.Serialization.XmlArrayItemAttribute> to the field, thereby instructing the <xref:System.Xml.Serialization.XmlSerializer> that it can insert objects of both the base class (`Employee`) type and derived class type (`Manager`) into the serialized array.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Xml.Serialization/XmlArrayItemAttribute/Overview/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Classic XmlArrayItemAttribute Example/VB/source.vb" id="Snippet1":::
]]></format>
</remarks>
<altmember cref="T:System.Xml.Serialization.XmlArrayAttribute" />
<altmember cref="T:System.Xml.Serialization.XmlSerializer" />
<altmember cref="P:System.Xml.Serialization.XmlAttributes.XmlArrayItems" />
<altmember cref="T:System.Xml.Serialization.XmlAttributeOverrides" />
<altmember cref="T:System.Xml.Serialization.XmlAttributes" />
<related type="Article" href="/dotnet/standard/serialization/introducing-xml-serialization">Introducing XML Serialization</related>
<related type="Article" href="/dotnet/standard/serialization/how-to-specify-an-alternate-element-name-for-an-xml-stream">How to: Specify an Alternate Element Name for an XML Stream</related>
<related type="Article" href="/dotnet/standard/serialization/controlling-xml-serialization-using-attributes">Controlling XML Serialization Using Attributes</related>
<related type="Article" href="/dotnet/standard/serialization/examples-of-xml-serialization">Examples of XML Serialization</related>
<related type="Article" href="/dotnet/standard/serialization/xml-schema-definition-tool-xsd-exe">XML Schema Definition Tool (Xsd.exe)</related>
</Docs>
<Members>
<MemberGroup MemberName=".ctor">
<AssemblyInfo>
<AssemblyName>System.Xml.XmlSerializer</AssemblyName>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.Xml.Serialization.XmlArrayItemAttribute" /> class.</summary>
</Docs>
</MemberGroup>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public XmlArrayItemAttribute ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.Serialization.XmlArrayItemAttribute.#ctor" />
<MemberSignature Language="VB.NET" Value="Public Sub New ()" />
<MemberSignature Language="C++ CLI" Value="public:
 XmlArrayItemAttribute();" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.XmlSerializer</AssemblyName>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.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>System.Xml</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>
<AssemblyInfo>
<AssemblyName>System.Xml.Serialization</AssemblyName>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<Parameters />
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.Xml.Serialization.XmlArrayItemAttribute" /> class.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Examples
The following example serializes a class named `Transportation` that contains a field named `MyVehicles` that returns an array of `Vehicle` objects. The example applies the <xref:System.Xml.Serialization.XmlArrayItemAttribute> to the field, allowing the <xref:System.Xml.Serialization.XmlSerializer> to insert instances of the `Car` class, which is derived from the `Vehicle` class, into the array.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Xml.Serialization/XmlArrayItemAttribute/.ctor/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute Example/VB/source.vb" id="Snippet1":::
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public XmlArrayItemAttribute (string elementName);" 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;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-2.0;netstandard-2.1" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string elementName) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.Serialization.XmlArrayItemAttribute.#ctor(System.String)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (elementName As String)" />
<MemberSignature Language="F#" Value="new System.Xml.Serialization.XmlArrayItemAttribute : string -> System.Xml.Serialization.XmlArrayItemAttribute" Usage="new System.Xml.Serialization.XmlArrayItemAttribute elementName" />
<MemberSignature Language="C++ CLI" Value="public:
 XmlArrayItemAttribute(System::String ^ elementName);" />
<MemberSignature Language="C#" Value="public XmlArrayItemAttribute (string? elementName);" FrameworkAlternate="net-5.0;net-6.0;net-7.0;net-8.0;net-9.0" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.XmlSerializer</AssemblyName>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.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>System.Xml</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>
<AssemblyInfo>
<AssemblyName>System.Xml.Serialization</AssemblyName>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<Parameters>
<Parameter Name="elementName" Type="System.String" />
</Parameters>
<Docs>
<param name="elementName">The name of the XML element.</param>
<summary>Initializes a new instance of the <see cref="T:System.Xml.Serialization.XmlArrayItemAttribute" /> class and specifies the name of the XML element generated in the XML document.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This overload sets the <xref:System.Xml.Serialization.XmlArrayItemAttribute.ElementName%2A> property.
Use this overload if you want the name of the generated XML element to differ from the member's identifier.
An XML document that includes namespaces can contain more than one version of an element name. For details, see the <xref:System.Xml.Serialization.XmlArrayItemAttribute.ElementName%2A> property.
## Examples
The following example serializes a class named `Transportation` that contains a field named `MyVehicles` that returns an array of `Vehicle` objects. The example applies the <xref:System.Xml.Serialization.XmlArrayItemAttribute> to the field, allowing the <xref:System.Xml.Serialization.XmlSerializer> to insert instances of the `Car` class, which is derived from the `Vehicle` class, into the array. While applying the attribute, the example sets the <xref:System.Xml.Serialization.XmlArrayItemAttribute.ElementName%2A> property using the `elementName` parameter.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute1 Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Xml.Serialization/XmlArrayItemAttribute/.ctor/source1.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute1 Example/VB/source.vb" id="Snippet1":::
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public XmlArrayItemAttribute (Type type);" 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;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-2.0;netstandard-2.1" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Type type) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.Serialization.XmlArrayItemAttribute.#ctor(System.Type)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (type As Type)" />
<MemberSignature Language="F#" Value="new System.Xml.Serialization.XmlArrayItemAttribute : Type -> System.Xml.Serialization.XmlArrayItemAttribute" Usage="new System.Xml.Serialization.XmlArrayItemAttribute type" />
<MemberSignature Language="C++ CLI" Value="public:
 XmlArrayItemAttribute(Type ^ type);" />
<MemberSignature Language="C#" Value="public XmlArrayItemAttribute (Type? type);" FrameworkAlternate="net-5.0;net-6.0;net-7.0;net-8.0;net-9.0" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.XmlSerializer</AssemblyName>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.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>System.Xml</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>
<AssemblyInfo>
<AssemblyName>System.Xml.Serialization</AssemblyName>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<Parameters>
<Parameter Name="type" Type="System.Type" />
</Parameters>
<Docs>
<param name="type">The <see cref="T:System.Type" /> of the object to serialize.</param>
<summary>Initializes a new instance of the <see cref="T:System.Xml.Serialization.XmlArrayItemAttribute" /> class and specifies the <see cref="T:System.Type" /> that can be inserted into the serialized array.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Examples
The following example serializes a class named `Transportation` that contains a field named `MyVehicles` that returns an array of `Vehicle` objects. The example applies the <xref:System.Xml.Serialization.XmlArrayItemAttribute> to the field, allowing the <xref:System.Xml.Serialization.XmlSerializer> to insert instances of the `Car` class, which is derived from the `Vehicle` class, into the array. While applying the attribute, the example sets the <xref:System.Xml.Serialization.XmlArrayItemAttribute.Type%2A> property using the `type` parameter.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute2 Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Xml.Serialization/XmlArrayItemAttribute/.ctor/source2.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute2 Example/VB/source.vb" id="Snippet1":::
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public XmlArrayItemAttribute (string elementName, Type type);" 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;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-2.0;netstandard-2.1" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string elementName, class System.Type type) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.Serialization.XmlArrayItemAttribute.#ctor(System.String,System.Type)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (elementName As String, type As Type)" />
<MemberSignature Language="F#" Value="new System.Xml.Serialization.XmlArrayItemAttribute : string * Type -> System.Xml.Serialization.XmlArrayItemAttribute" Usage="new System.Xml.Serialization.XmlArrayItemAttribute (elementName, type)" />
<MemberSignature Language="C++ CLI" Value="public:
 XmlArrayItemAttribute(System::String ^ elementName, Type ^ type);" />
<MemberSignature Language="C#" Value="public XmlArrayItemAttribute (string? elementName, Type? type);" FrameworkAlternate="net-5.0;net-6.0;net-7.0;net-8.0;net-9.0" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.XmlSerializer</AssemblyName>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.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>System.Xml</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>
<AssemblyInfo>
<AssemblyName>System.Xml.Serialization</AssemblyName>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<Parameters>
<Parameter Name="elementName" Type="System.String" />
<Parameter Name="type" Type="System.Type" />
</Parameters>
<Docs>
<param name="elementName">The name of the XML element.</param>
<param name="type">The <see cref="T:System.Type" /> of the object to serialize.</param>
<summary>Initializes a new instance of the <see cref="T:System.Xml.Serialization.XmlArrayItemAttribute" /> class and specifies the name of the XML element generated in the XML document and the <see cref="T:System.Type" /> that can be inserted into the generated XML document.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This overload sets the <xref:System.Xml.Serialization.XmlArrayItemAttribute.ElementName%2A> and the <xref:System.Xml.Serialization.XmlArrayItemAttribute.Type%2A> properties.
Use this overload if you want the name of the generated XML element to differ from the member's identifier.
An XML document that includes namespaces can contain more than one version of an element name. For details, see the <xref:System.Xml.Serialization.XmlArrayItemAttribute.ElementName%2A> property.
## Examples
The following example serializes a class named `Transportation` that contains a field named `MyVehicles` that returns an array of `Vehicle` objects. The example applies the <xref:System.Xml.Serialization.XmlArrayItemAttribute> to the field, allowing the <xref:System.Xml.Serialization.XmlSerializer> to insert instances of the `Car` class, which is derived from the `Vehicle` class, into the array. While applying the attribute, the example sets the <xref:System.Xml.Serialization.XmlArrayItemAttribute.ElementName%2A> property using the `elementName` parameter, and the <xref:System.Xml.Serialization.XmlArrayItemAttribute.Type%2A> property using the `type` parameter.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute3 Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Xml.Serialization/XmlArrayItemAttribute/.ctor/source3.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute3 Example/VB/source.vb" id="Snippet1":::
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="DataType">
<MemberSignature Language="C#" Value="public string DataType { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance string DataType" />
<MemberSignature Language="DocId" Value="P:System.Xml.Serialization.XmlArrayItemAttribute.DataType" />
<MemberSignature Language="VB.NET" Value="Public Property DataType As String" />
<MemberSignature Language="F#" Value="member this.DataType : string with get, set" Usage="System.Xml.Serialization.XmlArrayItemAttribute.DataType" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::String ^ DataType { System::String ^ get(); void set(System::String ^ value); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.XmlSerializer</AssemblyName>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.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>System.Xml</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>
<AssemblyInfo>
<AssemblyName>System.Xml.Serialization</AssemblyName>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="net-8.0;net-9.0">
<AttributeName Language="C#">[System.Runtime.CompilerServices.Nullable(1)]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.CompilerServices.Nullable(1)>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="net-8.0;net-9.0">
<AttributeName Language="C#">[get: System.Runtime.CompilerServices.NullableContext(1)]</AttributeName>
<AttributeName Language="F#">[<get: System.Runtime.CompilerServices.NullableContext(1)>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="net-8.0;net-9.0">
<AttributeName Language="C#">[set: System.Runtime.CompilerServices.NullableContext(1)]</AttributeName>
<AttributeName Language="F#">[<set: System.Runtime.CompilerServices.NullableContext(1)>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[set: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<set: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the XML data type of the generated XML element.</summary>
<value>An XML schema definition (XSD) data type.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The following table lists the XML Schema simple data types with their .NET equivalents.
For the XML Schema `base64Binary` and `hexBinary` data types, use an array of <xref:System.Byte> objects, and apply an <xref:System.Xml.Serialization.XmlArrayItemAttribute> with the <xref:System.Xml.Serialization.XmlArrayItemAttribute.DataType%2A> property set to "base64Binary" or "hexBinary", as appropriate. For the XML Schema `time` and `date` data types, use the <xref:System.DateTime> type and apply the <xref:System.Xml.Serialization.XmlArrayItemAttribute> with the <xref:System.Xml.Serialization.XmlArrayItemAttribute.DataType%2A> set to "date" or "time".
For every XML Schema type that is mapped to a string, apply the <xref:System.Xml.Serialization.XmlArrayItemAttribute> with its <xref:System.Xml.Serialization.XmlArrayItemAttribute.DataType%2A> property set to the XML Schema type. However, this does not change the serialization format, only the schema for the member.
> [!NOTE]
> The property is case-sensitive, so you must set it exactly to one of the XML Schema data types.
> [!NOTE]
> Passing binary data as an XML element is more efficient then passing it as an XML attribute.
For more information about XML Schema data types, see the World Wide Web Consortium document [XML Schema Part 2: Datatypes](https://www.w3.org/TR/xmlschema-2/).
|XSD data type|.NET data type|
|-------------------|--------------------|
|anyURI|<xref:System.String>|
|base64Binary|Array of <xref:System.Byte> objects|
|boolean|<xref:System.Boolean>|
|byte|<xref:System.SByte>|
|date|<xref:System.DateTime>|
|dateTime|<xref:System.DateTime>|
|decimal|<xref:System.Decimal>|
|double|<xref:System.Double>|
|ENTITY|<xref:System.String>|
|ENTITIES|<xref:System.String>|
|float|<xref:System.Single>|
|gDay|<xref:System.String>|
|gMonth|<xref:System.String>|
|gMonthDay|<xref:System.String>|
|gYear|<xref:System.String>|
|gYearMonth|<xref:System.String>|
|hexBinary|Array of <xref:System.Byte> objects|
|ID|<xref:System.String>|
|IDREF|<xref:System.String>|
|IDREFS|<xref:System.String>|
|int|<xref:System.Int32>|
|integer|<xref:System.String>|
|language|<xref:System.String>|
|long|<xref:System.Int64>|
|Name|<xref:System.String>|
|NCName|<xref:System.String>|
|negativeInteger|<xref:System.String>|
|NMTOKEN|<xref:System.String>|
|NMTOKENS|<xref:System.String>|
|normalizedString|<xref:System.String>|
|nonNegativeInteger|<xref:System.String>|
|nonPositiveInteger|<xref:System.String>|
|NOTATION|<xref:System.String>|
|positiveInteger|<xref:System.String>|
|QName|<xref:System.Xml.XmlQualifiedName>|
|duration|<xref:System.String>|
|string|<xref:System.String>|
|short|<xref:System.Int16>|
|time|<xref:System.DateTime>|
|token|<xref:System.String>|
|unsignedByte|<xref:System.Byte>|
|unsignedInt|<xref:System.UInt32>|
|unsignedLong|<xref:System.UInt64>|
|unsignedShort|<xref:System.UInt16>|
## Examples
The following example serializes a class named `PurchaseOrder`. Several instances of the <xref:System.Xml.Serialization.XmlArrayItemAttribute> class are applied to three members, and the <xref:System.Xml.Serialization.XmlArrayItemAttribute.DataType%2A> property for each instance is set to a type allowed in the array.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/XmlArrayItemAttribute Example/CPP/arrayitem.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Xml.Serialization/XmlArrayItemAttribute/DataType/arrayitem.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/XmlArrayItemAttribute Example/VB/arrayitem.vb" id="Snippet1":::
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="ElementName">
<MemberSignature Language="C#" Value="public string ElementName { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance string ElementName" />
<MemberSignature Language="DocId" Value="P:System.Xml.Serialization.XmlArrayItemAttribute.ElementName" />
<MemberSignature Language="VB.NET" Value="Public Property ElementName As String" />
<MemberSignature Language="F#" Value="member this.ElementName : string with get, set" Usage="System.Xml.Serialization.XmlArrayItemAttribute.ElementName" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::String ^ ElementName { System::String ^ get(); void set(System::String ^ value); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.XmlSerializer</AssemblyName>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.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>System.Xml</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>
<AssemblyInfo>
<AssemblyName>System.Xml.Serialization</AssemblyName>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="net-8.0;net-9.0">
<AttributeName Language="C#">[System.Runtime.CompilerServices.Nullable(1)]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.CompilerServices.Nullable(1)>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="net-8.0;net-9.0">
<AttributeName Language="C#">[get: System.Runtime.CompilerServices.NullableContext(1)]</AttributeName>
<AttributeName Language="F#">[<get: System.Runtime.CompilerServices.NullableContext(1)>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="net-8.0;net-9.0">
<AttributeName Language="C#">[set: System.Runtime.CompilerServices.NullableContext(1)]</AttributeName>
<AttributeName Language="F#">[<set: System.Runtime.CompilerServices.NullableContext(1)>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[set: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<set: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the name of the generated XML element.</summary>
<value>The name of the generated XML element. The default is the member identifier.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Specify an <xref:System.Xml.Serialization.XmlArrayItemAttribute.ElementName%2A> if you want the name of the generated XML element to differ from the member's identifier.
You can set the same <xref:System.Xml.Serialization.XmlArrayAttribute.ElementName%2A> value to more than one class member if the generated XML document uses XML namespaces to distinguish between identically named members. For details about how to use namespaces and prefixed names in the XML document, see the <xref:System.Xml.Serialization.XmlSerializerNamespaces> class.
## Examples
The following example sets the <xref:System.Xml.Serialization.XmlArrayItemAttribute.ElementName%2A> property for the `Vehicle` and `Car` class--thereby changing the names of XML elements that the <xref:System.Xml.Serialization.XmlSerializer> generates for those classes.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.ElementName Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Xml.Serialization/XmlArrayItemAttribute/ElementName/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.ElementName Example/VB/source.vb" id="Snippet1":::
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="Form">
<MemberSignature Language="C#" Value="public System.Xml.Schema.XmlSchemaForm Form { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.Xml.Schema.XmlSchemaForm Form" />
<MemberSignature Language="DocId" Value="P:System.Xml.Serialization.XmlArrayItemAttribute.Form" />
<MemberSignature Language="VB.NET" Value="Public Property Form As XmlSchemaForm" />
<MemberSignature Language="F#" Value="member this.Form : System.Xml.Schema.XmlSchemaForm with get, set" Usage="System.Xml.Serialization.XmlArrayItemAttribute.Form" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::Xml::Schema::XmlSchemaForm Form { System::Xml::Schema::XmlSchemaForm get(); void set(System::Xml::Schema::XmlSchemaForm value); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.XmlSerializer</AssemblyName>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.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>System.Xml</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>
<AssemblyInfo>
<AssemblyName>System.Xml.Serialization</AssemblyName>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[set: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<set: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Xml.Schema.XmlSchemaForm</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets a value that indicates whether the name of the generated XML element is qualified.</summary>
<value>One of the <see cref="T:System.Xml.Schema.XmlSchemaForm" /> values. The default is <see langword="XmlSchemaForm.None" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Xml.Serialization.XmlAttributeAttribute.Form%2A> property determines whether an XML element name is qualified, based on the World Wide Web Consortium specification [Namespaces in XML](https://www.w3.org/TR/xml-names/).
If the <xref:System.Xml.Serialization.XmlAttributeAttribute.Namespace%2A> property is set to any value, attempting to set the <xref:System.Xml.Serialization.XmlElementAttribute.Form%2A> property to `XmlSchemaForm.Unqualified` throws an exception.
The default value, `XmlSchemaForm.None`, instructs the <xref:System.Xml.Serialization.XmlSerializer> to check the schema for the XML document to determine whether the namespace is qualified. For elements, the <xref:System.Xml.Serialization.XmlSerializer> checks the value of the schema-element attribute `elementFormDefault`. For attributes, it checks the value of the schema-element attribute `attributeFormDefault`. For example, the following XML Schema indicates that the `Name` element is qualified, while the `Number` element is unqualified.
```
<schema elementFormDefault="qualified"
attributeFormDefault="unqualified">
<element name="Name"/>
<attribute name="Number"/>
</schema>
```
## Examples
The following example sets the <xref:System.Xml.Serialization.XmlArrayItemAttribute.Form%2A> property for the `Vehicle` class to `XmlSchemaForm.Unqualified`, and the <xref:System.Xml.Serialization.XmlArrayItemAttribute.Form%2A> property for the `Car` class to `XmlSchemaForm.Qualified`.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.Form Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Xml.Serialization/XmlArrayItemAttribute/Form/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.Form Example/VB/source.vb" id="Snippet1":::
]]></format>
</remarks>
<exception cref="T:System.Exception">The <see cref="P:System.Xml.Serialization.XmlArrayItemAttribute.Form" /> property is set to <see langword="XmlSchemaForm.Unqualified" /> and a <see cref="P:System.Xml.Serialization.XmlArrayItemAttribute.Namespace" /> value is specified.</exception>
</Docs>
</Member>
<Member MemberName="IsNullable">
<MemberSignature Language="C#" Value="public bool IsNullable { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool IsNullable" />
<MemberSignature Language="DocId" Value="P:System.Xml.Serialization.XmlArrayItemAttribute.IsNullable" />
<MemberSignature Language="VB.NET" Value="Public Property IsNullable As Boolean" />
<MemberSignature Language="F#" Value="member this.IsNullable : bool with get, set" Usage="System.Xml.Serialization.XmlArrayItemAttribute.IsNullable" />
<MemberSignature Language="C++ CLI" Value="public:
 property bool IsNullable { bool get(); void set(bool value); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.XmlSerializer</AssemblyName>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.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>System.Xml</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>
<AssemblyInfo>
<AssemblyName>System.Xml.Serialization</AssemblyName>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets a value that indicates whether the <see cref="T:System.Xml.Serialization.XmlSerializer" /> must serialize a member as an empty XML tag with the <see langword="xsi:nil" /> attribute set to <see langword="true" />.</summary>
<value>
<see langword="true" /> if the <see cref="T:System.Xml.Serialization.XmlSerializer" /> generates the <see langword="xsi:nil" /> attribute; otherwise, <see langword="false" />, and no instance is generated. The default is <see langword="true" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The XML schema specification for structures allows an XML document to explicitly signal that an element's content is missing. Such an element contains the attribute `xsi:nil` set to `true`. For more information, see the World Wide Web Consortium specification titled [XML Schema Part 1: Structures](https://www.w3.org/TR/xmlschema-1/).
If the <xref:System.Xml.Serialization.XmlArrayItemAttribute.IsNullable%2A> property is `true`, the `xsi:nil` attribute is generated for class members that have been set to `null`. For example, if you set a field named `MyStringArray` to `null`, the <xref:System.Xml.Serialization.XmlSerializer> generates the following XML code.
```
<MyStringArray xsi:nil = "true" />
```
If the <xref:System.Xml.Serialization.XmlArrayItemAttribute.IsNullable%2A> property is `false`, no XML element is generated.
> [!NOTE]
> You cannot apply the <xref:System.Xml.Serialization.XmlArrayItemAttribute.IsNullable%2A> property to a member typed as a value type because a value type cannot contain `null`.
## Examples
The following example serializes a class named `Group`, which contains a field named `Employees` that returns an array of `Employee` objects. A second class named `Manager` derives from `Employee`. An <xref:System.Xml.Serialization.XmlArrayItemAttribute> specifies that the <xref:System.Xml.Serialization.XmlSerializer> can insert both `Employee` and `Manager` objects into the array. The example sets the <xref:System.Xml.Serialization.XmlArrayItemAttribute.IsNullable%2A> property, thereby telling the <xref:System.Xml.Serialization.XmlSerializer> not to generate the `xsi:nil` attribute objects in the array set to `null`.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.IsNullable Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Xml.Serialization/XmlArrayItemAttribute/IsNullable/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.IsNullable Example/VB/source.vb" id="Snippet1":::
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="Namespace">
<MemberSignature Language="C#" Value="public string Namespace { get; set; }" 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;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-2.0;netstandard-2.1" />
<MemberSignature Language="ILAsm" Value=".property instance string Namespace" />
<MemberSignature Language="DocId" Value="P:System.Xml.Serialization.XmlArrayItemAttribute.Namespace" />
<MemberSignature Language="VB.NET" Value="Public Property Namespace As String" />
<MemberSignature Language="F#" Value="member this.Namespace : string with get, set" Usage="System.Xml.Serialization.XmlArrayItemAttribute.Namespace" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::String ^ Namespace { System::String ^ get(); void set(System::String ^ value); };" />
<MemberSignature Language="C#" Value="public string? Namespace { get; set; }" FrameworkAlternate="net-5.0;net-6.0;net-7.0;net-8.0;net-9.0" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.XmlSerializer</AssemblyName>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.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>System.Xml</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>
<AssemblyInfo>
<AssemblyName>System.Xml.Serialization</AssemblyName>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[set: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<set: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the namespace of the generated XML element.</summary>
<value>The namespace of the generated XML element.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Xml.Serialization.XmlArrayItemAttribute.Namespace%2A> property conforms to the World Wide Web Consortium specification [Namespaces in XML](https://www.w3.org/TR/xml-names/).
To create namespaces to use in the XML document and associated prefixes, you must create an <xref:System.Xml.Serialization.XmlSerializerNamespaces> that contains all the prefix and namespace pairs. The namespace you set for each <xref:System.Xml.Serialization.XmlArrayAttribute> must be contained in the <xref:System.Xml.Serialization.XmlSerializerNamespaces>. When the <xref:System.Xml.Serialization.XmlSerializer> generates the document, it correctly prefixes the element name for each array item.
## Examples
The following example applies an <xref:System.Xml.Serialization.XmlArrayItemAttribute> and sets the <xref:System.Xml.Serialization.XmlArrayItemAttribute.Namespace%2A> property.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.Namespace Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Xml.Serialization/XmlArrayItemAttribute/Namespace/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.Namespace Example/VB/source.vb" id="Snippet1":::
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="NestingLevel">
<MemberSignature Language="C#" Value="public int NestingLevel { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance int32 NestingLevel" />
<MemberSignature Language="DocId" Value="P:System.Xml.Serialization.XmlArrayItemAttribute.NestingLevel" />
<MemberSignature Language="VB.NET" Value="Public Property NestingLevel As Integer" />
<MemberSignature Language="F#" Value="member this.NestingLevel : int with get, set" Usage="System.Xml.Serialization.XmlArrayItemAttribute.NestingLevel" />
<MemberSignature Language="C++ CLI" Value="public:
 property int NestingLevel { int get(); void set(int value); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.XmlSerializer</AssemblyName>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.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>System.Xml</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>
<AssemblyInfo>
<AssemblyName>System.Xml.Serialization</AssemblyName>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[set: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<set: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the level in a hierarchy of XML elements that the <see cref="T:System.Xml.Serialization.XmlArrayItemAttribute" /> affects.</summary>
<value>The zero-based index of a set of indexes in an array of arrays.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
An XML document can contain hierarchies of XML elements. To represent such a hierarchy, an array of arrays is used. In such an array, each index represents a level in the hierarchy. Therefore, the <xref:System.Xml.Serialization.XmlArrayItemAttribute.NestingLevel%2A> property is only used when applying an <xref:System.Xml.Serialization.XmlArrayItemAttribute> to a field that returns an array of arrays.
When applying the attribute, specify which hierarchy level the attribute affects by setting the <xref:System.Xml.Serialization.XmlArrayItemAttribute.NestingLevel%2A>. The first index always has the value of 0; therefore it is optional to set its <xref:System.Xml.Serialization.XmlArrayItemAttribute.NestingLevel%2A> --an <xref:System.Xml.Serialization.XmlArrayItemAttribute> without a <xref:System.Xml.Serialization.XmlArrayItemAttribute.NestingLevel%2A> value is applied to the first array index. Only the subsequent <xref:System.Xml.Serialization.XmlArrayItemAttribute> objects require <xref:System.Xml.Serialization.XmlArrayItemAttribute.NestingLevel%2A> values specified (as 1, 2, 3, and so forth).
## Examples
The following example applies three <xref:System.Xml.Serialization.XmlArrayItemAttribute> attributes to an array of arrays. To specify which of the arrays each attribute applies to, the <xref:System.Xml.Serialization.XmlArrayItemAttribute.NestingLevel%2A> property is set to the index of the arrays.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NestingLevel/cpp/nestinglevel.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Xml.Serialization/XmlArrayItemAttribute/NestingLevel/nestinglevel.cs" id="Snippet1":::
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="Type">
<MemberSignature Language="C#" Value="public Type Type { get; set; }" 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;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-2.0;netstandard-2.1" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Type Type" />
<MemberSignature Language="DocId" Value="P:System.Xml.Serialization.XmlArrayItemAttribute.Type" />
<MemberSignature Language="VB.NET" Value="Public Property Type As Type" />
<MemberSignature Language="F#" Value="member this.Type : Type with get, set" Usage="System.Xml.Serialization.XmlArrayItemAttribute.Type" />
<MemberSignature Language="C++ CLI" Value="public:
 property Type ^ Type { Type ^ get(); void set(Type ^ value); };" />
<MemberSignature Language="C#" Value="public Type? Type { get; set; }" FrameworkAlternate="net-5.0;net-6.0;net-7.0;net-8.0;net-9.0" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml.XmlSerializer</AssemblyName>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.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>System.Xml</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>
<AssemblyInfo>
<AssemblyName>System.Xml.Serialization</AssemblyName>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[set: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<set: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Type</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the type allowed in an array.</summary>
<value>A <see cref="T:System.Type" /> that is allowed in the array.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use the <xref:System.Xml.Serialization.XmlElementAttribute.Type%2A> property to specify an overridden type for a public field or public read/write property value.
If a field or property returns an array of type <xref:System.Object>, apply multiple instances of the <xref:System.Xml.Serialization.XmlArrayItemAttribute> to the field or property. For each instance, set the <xref:System.Xml.Serialization.XmlElementAttribute.Type%2A> property to a type of object that can be inserted into the array.
If an array contains only primitive types, you do not need to apply the <xref:System.Xml.Serialization.XmlArrayItemAttribute>. By default, the <xref:System.Xml.Serialization.XmlSerializer> generates a series of elements, each with the same element name, for each value, but the type of each element is set to the XML Schema data type. For example, the following code:
```
' Visual Basic code
Public Class Arrays
Public XSDTypes ()As Object= New Object(){"one", 2, 3.0}
End Class
// C# code
public class MyArray{
// No XmlArrayItemAttribute is applied.
public object[] XSDTypes= new object[]{"one", 2, 3.2};
}
```
results in this XML:
```
<?xml version="1.0" encoding="utf-8"?>
<Arrays xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<XSDTypes>
<Object xsi:type="xsd:string">one</Object>
<Object xsi:type="xsd:int">2</Object>
<Object xsi:type="xsd:double">3</Object>
</XSDTypes>
</Arrays>
```
However, if you specify the <xref:System.Xml.Serialization.XmlArrayItemAttribute.Type%2A> property for each primitive type, the element name for each value is generated using the .NET type name. For example this code:
```
' Visual Basic code
Public Class Arrays
<XmlArrayItem(GetType(String)), _
XmlArrayItem(GetType(Integer)), _
XmlArrayItem(GetType(Double))> _
Public PrimitiveTypes () As Object = New Object(){"one", 2, 3.0}
End Class