-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Expand file tree
/
Copy pathXmlSerializer.xml
More file actions
3378 lines (3182 loc) · 278 KB
/
XmlSerializer.xml
File metadata and controls
3378 lines (3182 loc) · 278 KB
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="XmlSerializer" FullName="System.Xml.Serialization.XmlSerializer">
<TypeSignature Language="C#" Value="public class XmlSerializer" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit XmlSerializer extends System.Object" FrameworkAlternate="dotnet-uwp-10.0;net-10.0;net-11.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-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" />
<TypeSignature Language="DocId" Value="T:System.Xml.Serialization.XmlSerializer" />
<TypeSignature Language="VB.NET" Value="Public Class XmlSerializer" />
<TypeSignature Language="F#" Value="type XmlSerializer = class" />
<TypeSignature Language="C++ CLI" Value="public ref class XmlSerializer" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi XmlSerializer extends System.Object" FrameworkAlternate="netframework-1.1" />
<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>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
<AssemblyVersion>11.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="10.0.0.0" FrameworkAlternate="net-10.0" />
<TypeForwarding From="netstandard" FromVersion="2.1.0.0" To="System.Xml.XmlSerializer" ToVersion="11.0.0.0" FrameworkAlternate="net-11.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.Object</BaseTypeName>
</Base>
<Interfaces />
<Attributes>
<Attribute FrameworkAlternate="net-10.0;net-11.0;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>
</Attributes>
<Docs>
<summary>Serializes and deserializes objects into and from XML documents. The <see cref="T:System.Xml.Serialization.XmlSerializer" /> enables you to control how objects are encoded into XML.</summary>
<remarks>For more information about this API, see <see href="/dotnet/fundamentals/runtime-libraries/system-xml-serialization-xmlserializer">Supplemental API remarks for XmlSerializer</see>.</remarks>
<example>
<format type="text/markdown"><![CDATA[
The following example contains two main classes: `PurchaseOrder` and `Test`. The `PurchaseOrder` class contains information about a single purchase. The `Test` class contains the methods that create the purchase order, and that read the created purchase order.
:::code language="csharp" source="~/snippets/csharp/System.Xml.Serialization/XmlSerializer/Overview/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/System.Xml.Serialization/XmlSerializer/Overview/source.vb" id="Snippet1":::
]]></format>
</example>
<threadsafe>This type is thread safe.</threadsafe>
<altmember cref="T:System.Xml.Serialization.XmlAttributeOverrides" />
<altmember cref="T:System.Xml.Serialization.XmlAttributes" />
<altmember cref="P:System.Xml.Serialization.XmlAttributes.XmlText" />
<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>
<related type="Article" href="/dotnet/standard/serialization/how-to-control-serialization-of-derived-classes">How to: Control Serialization of Derived Classes</related>
<related type="Article" href="/dotnet/standard/serialization/datetimeserialization-element"><dateTimeSerialization>Element</related>
<related type="Article" href="/dotnet/standard/serialization/xmlserializer-element"><xmlSerializer> Element</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.XmlSerializer" /> class.</summary>
</Docs>
</MemberGroup>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="protected XmlSerializer ();" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.Serialization.XmlSerializer.#ctor" />
<MemberSignature Language="VB.NET" Value="Protected Sub New ()" />
<MemberSignature Language="C++ CLI" Value="protected:
 XmlSerializer();" />
<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>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
<AssemblyVersion>11.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>
<Parameters />
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.Xml.Serialization.XmlSerializer" /> class.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public XmlSerializer (Type type);" />
<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.XmlSerializer.#ctor(System.Type)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (type As Type)" />
<MemberSignature Language="F#" Value="new System.Xml.Serialization.XmlSerializer : Type -> System.Xml.Serialization.XmlSerializer" Usage="new System.Xml.Serialization.XmlSerializer type" />
<MemberSignature Language="C++ CLI" Value="public:
 XmlSerializer(Type ^ type);" />
<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>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
<AssemblyVersion>11.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-10.0;net-11.0">
<AttributeName Language="C#">[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("XML serializer relies on dynamic code generation which is not available with Ahead of Time compilation")]</AttributeName>
<AttributeName Language="F#">[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("XML serializer relies on dynamic code generation which is not available with Ahead of Time compilation")>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="net-10.0;net-11.0;net-6.0;net-7.0;net-8.0;net-9.0">
<AttributeName Language="C#">[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")]</AttributeName>
<AttributeName Language="F#">[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")>]</AttributeName>
</Attribute>
<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 type of the object that this <see cref="T:System.Xml.Serialization.XmlSerializer" /> can serialize.</param>
<summary>Initializes a new instance of the <see cref="T:System.Xml.Serialization.XmlSerializer" /> class that can serialize objects of the specified type into XML documents, and deserialize XML documents into objects of the specified type.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Commonly, an application defines several classes that the <xref:System.Xml.Serialization.XmlSerializer> converts into a single XML-instance document. However, the <xref:System.Xml.Serialization.XmlSerializer> must know only one type--the type of the class that represents the XML root element. The <xref:System.Xml.Serialization.XmlSerializer> automatically serializes all subordinate class instances. Similarly, only the type of the XML root element is required for deserialization.
## Examples
The following example constructs an <xref:System.Xml.Serialization.XmlSerializer> that serializes an object named `Widget`. The example sets various properties of the object before calling the <xref:System.Xml.Serialization.XmlSerializer.Serialize%2A> method.
:::code language="csharp" source="~/snippets/csharp/System.Xml.Serialization/XmlSerializer/.ctor/source5.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/System.Xml.Serialization/XmlSerializer/.ctor/source5.vb" id="Snippet1":::
]]></format>
</remarks>
<altmember cref="M:System.Xml.Serialization.XmlSerializer.Serialize(System.IO.TextWriter,System.Object)" />
<altmember cref="M:System.Xml.Serialization.XmlSerializer.Deserialize(System.IO.Stream)" />
<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>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public XmlSerializer (System.Xml.Serialization.XmlTypeMapping xmlTypeMapping);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Xml.Serialization.XmlTypeMapping xmlTypeMapping) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.Serialization.XmlSerializer.#ctor(System.Xml.Serialization.XmlTypeMapping)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (xmlTypeMapping As XmlTypeMapping)" />
<MemberSignature Language="F#" Value="new System.Xml.Serialization.XmlSerializer : System.Xml.Serialization.XmlTypeMapping -> System.Xml.Serialization.XmlSerializer" Usage="new System.Xml.Serialization.XmlSerializer xmlTypeMapping" />
<MemberSignature Language="C++ CLI" Value="public:
 XmlSerializer(System::Xml::Serialization::XmlTypeMapping ^ xmlTypeMapping);" />
<MemberType>Constructor</MemberType>
<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.XmlSerializer</AssemblyName>
<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>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
<AssemblyVersion>11.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml.Serialization</AssemblyName>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="net-10.0;net-11.0">
<AttributeName Language="C#">[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("XML serializer relies on dynamic code generation which is not available with Ahead of Time compilation")]</AttributeName>
<AttributeName Language="F#">[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("XML serializer relies on dynamic code generation which is not available with Ahead of Time compilation")>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="net-10.0;net-11.0;net-6.0;net-7.0;net-8.0;net-9.0">
<AttributeName Language="C#">[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")]</AttributeName>
<AttributeName Language="F#">[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")>]</AttributeName>
</Attribute>
</Attributes>
<Parameters>
<Parameter Name="xmlTypeMapping" Type="System.Xml.Serialization.XmlTypeMapping" Index="0" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;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;netstandard-2.0;netstandard-2.1;netcore-3.1;net-5.0;net-6.0;net-7.0;netframework-4.8.1;net-8.0;net-9.0;net-10.0;net-11.0" />
</Parameters>
<Docs>
<param name="xmlTypeMapping">An <see cref="T:System.Xml.Serialization.XmlTypeMapping" /> that maps one type to another.</param>
<summary>Initializes an instance of the <see cref="T:System.Xml.Serialization.XmlSerializer" /> class using an object that maps one type to another.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This constructor is used to create an <xref:System.Xml.Serialization.XmlSerializer> when you serialize an object into a SOAP message. To control the SOAP messages generated, use the special attributes (beginning with the word "Soap") found in the <xref:System.Xml.Serialization> namespace.
## Examples
The following example serializes a class named `Group`. The serialization of the `GroupName`, `IgnoreThis` fields, and the members of the `GroupType` enumeration are overridden. In the `CreateOverrideSerializer` method, a <xref:System.Xml.Serialization.SoapAttributeOverrides> object is created, and for each overridden member or enumeration, a <xref:System.Xml.Serialization.SoapAttributes> object is created with the appropriate property set and added to the <xref:System.Xml.Serialization.SoapAttributeOverrides> object. An <xref:System.Xml.Serialization.XmlMapping> object is created using the <xref:System.Xml.Serialization.SoapAttributeOverrides> object, and that <xref:System.Xml.Serialization.XmlMapping> object is used to create the <xref:System.Xml.Serialization.XmlSerializer> that overrides the default serialization.
:::code language="csharp" source="~/snippets/csharp/System.Xml.Serialization/SoapAttributeOverrides/Overview/soapover.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/System.Xml.Serialization/SoapAttributeOverrides/Overview/SoapOver.vb" id="Snippet1":::
]]></format>
</remarks>
<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>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public XmlSerializer (Type type, string defaultNamespace);" 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, string defaultNamespace) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.Serialization.XmlSerializer.#ctor(System.Type,System.String)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (type As Type, defaultNamespace As String)" />
<MemberSignature Language="F#" Value="new System.Xml.Serialization.XmlSerializer : Type * string -> System.Xml.Serialization.XmlSerializer" Usage="new System.Xml.Serialization.XmlSerializer (type, defaultNamespace)" />
<MemberSignature Language="C++ CLI" Value="public:
 XmlSerializer(Type ^ type, System::String ^ defaultNamespace);" />
<MemberSignature Language="C#" Value="public XmlSerializer (Type type, string? defaultNamespace);" FrameworkAlternate="net-10.0;net-11.0;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>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
<AssemblyVersion>11.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-10.0;net-11.0">
<AttributeName Language="C#">[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("XML serializer relies on dynamic code generation which is not available with Ahead of Time compilation")]</AttributeName>
<AttributeName Language="F#">[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("XML serializer relies on dynamic code generation which is not available with Ahead of Time compilation")>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="net-10.0;net-11.0;net-6.0;net-7.0;net-8.0;net-9.0">
<AttributeName Language="C#">[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")]</AttributeName>
<AttributeName Language="F#">[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")>]</AttributeName>
</Attribute>
</Attributes>
<Parameters>
<Parameter Name="type" Type="System.Type" />
<Parameter Name="defaultNamespace" Type="System.String">
<Attributes>
<Attribute FrameworkAlternate="net-10.0;net-11.0;net-8.0;net-9.0">
<AttributeName Language="C#">[System.Runtime.CompilerServices.Nullable(2)]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.CompilerServices.Nullable(2)>]</AttributeName>
</Attribute>
</Attributes>
</Parameter>
</Parameters>
<Docs>
<param name="type">The type of the object that this <see cref="T:System.Xml.Serialization.XmlSerializer" /> can serialize.</param>
<param name="defaultNamespace">The default namespace to use for all the XML elements.</param>
<summary>Initializes a new instance of the <see cref="T:System.Xml.Serialization.XmlSerializer" /> class that can serialize objects of the specified type into XML documents, and deserialize XML documents into objects of the specified type. Specifies the default namespace for all the XML elements.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Examples
The following example constructs an <xref:System.Xml.Serialization.XmlSerializer> that serializes an object named `Widget`. The example sets various properties of the object before calling the <xref:System.Xml.Serialization.XmlSerializer.Serialize%2A> method.
:::code language="csharp" source="~/snippets/csharp/System.Xml.Serialization/XmlSerializer/.ctor/source1.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/System.Xml.Serialization/XmlSerializer/.ctor/source1.vb" id="Snippet1":::
]]></format>
</remarks>
<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>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public XmlSerializer (Type type, Type[] extraTypes);" 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, class System.Type[] extraTypes) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.Serialization.XmlSerializer.#ctor(System.Type,System.Type[])" />
<MemberSignature Language="VB.NET" Value="Public Sub New (type As Type, extraTypes As Type())" />
<MemberSignature Language="F#" Value="new System.Xml.Serialization.XmlSerializer : Type * Type[] -> System.Xml.Serialization.XmlSerializer" Usage="new System.Xml.Serialization.XmlSerializer (type, extraTypes)" />
<MemberSignature Language="C++ CLI" Value="public:
 XmlSerializer(Type ^ type, cli::array <Type ^> ^ extraTypes);" />
<MemberSignature Language="C#" Value="public XmlSerializer (Type type, Type[]? extraTypes);" FrameworkAlternate="net-10.0;net-11.0;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>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
<AssemblyVersion>11.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-10.0;net-11.0">
<AttributeName Language="C#">[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("XML serializer relies on dynamic code generation which is not available with Ahead of Time compilation")]</AttributeName>
<AttributeName Language="F#">[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("XML serializer relies on dynamic code generation which is not available with Ahead of Time compilation")>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="net-10.0;net-11.0;net-6.0;net-7.0;net-8.0;net-9.0">
<AttributeName Language="C#">[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")]</AttributeName>
<AttributeName Language="F#">[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")>]</AttributeName>
</Attribute>
<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" />
<Parameter Name="extraTypes" Type="System.Type[]">
<Attributes>
<Attribute FrameworkAlternate="net-10.0;net-11.0;net-8.0;net-9.0">
<AttributeName Language="C#">[System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1 })]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1 })>]</AttributeName>
</Attribute>
</Attributes>
</Parameter>
</Parameters>
<Docs>
<param name="type">The type of the object that this <see cref="T:System.Xml.Serialization.XmlSerializer" /> can serialize.</param>
<param name="extraTypes">A <see cref="T:System.Type" /> array of additional object types to serialize.</param>
<summary>Initializes a new instance of the <see cref="T:System.Xml.Serialization.XmlSerializer" /> class that can serialize objects of the specified type into XML documents, and deserialize XML documents into object of a specified type. If a property or field returns an array, the <paramref name="extraTypes" /> parameter specifies objects that can be inserted into the array.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
By default, if a public property or field returns an object, or array of objects, the object types are automatically serialized. However, if a class contains a field or property that returns an array of type <xref:System.Object>, any object can be inserted into that array. In that case, the <xref:System.Xml.Serialization.XmlSerializer> must be instructed to expect all the possible object types that are inserted into the <xref:System.Object> array. To do this, use the `extraTypes` parameter to specify the extra object types to serialize or deserialize.
You can also use the `extraTypes` parameter to specify types derived from a base class. For example, suppose a base class named `Phone` exists, and a class named `InternationalPhone` derives from it. Use the `extraTypes` parameter to specify the derived type as well.
## Examples
The following example serializes an instance of a class that contains a public field that returns an array of objects. The `extraTypes` parameter of the <xref:System.Xml.Serialization.XmlSerializer> constructor specifies the types of the objects that can be serialized in the array.
:::code language="csharp" source="~/snippets/csharp/System.Xml.Serialization/XmlSerializer/.ctor/source3.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/System.Xml.Serialization/XmlSerializer/.ctor/source3.vb" id="Snippet1":::
]]></format>
</remarks>
<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>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public XmlSerializer (Type type, System.Xml.Serialization.XmlAttributeOverrides overrides);" 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, class System.Xml.Serialization.XmlAttributeOverrides overrides) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.Serialization.XmlSerializer.#ctor(System.Type,System.Xml.Serialization.XmlAttributeOverrides)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (type As Type, overrides As XmlAttributeOverrides)" />
<MemberSignature Language="F#" Value="new System.Xml.Serialization.XmlSerializer : Type * System.Xml.Serialization.XmlAttributeOverrides -> System.Xml.Serialization.XmlSerializer" Usage="new System.Xml.Serialization.XmlSerializer (type, overrides)" />
<MemberSignature Language="C++ CLI" Value="public:
 XmlSerializer(Type ^ type, System::Xml::Serialization::XmlAttributeOverrides ^ overrides);" />
<MemberSignature Language="C#" Value="public XmlSerializer (Type type, System.Xml.Serialization.XmlAttributeOverrides? overrides);" FrameworkAlternate="net-10.0;net-11.0;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>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
<AssemblyVersion>11.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-10.0;net-11.0">
<AttributeName Language="C#">[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("XML serializer relies on dynamic code generation which is not available with Ahead of Time compilation")]</AttributeName>
<AttributeName Language="F#">[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("XML serializer relies on dynamic code generation which is not available with Ahead of Time compilation")>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="net-10.0;net-11.0;net-6.0;net-7.0;net-8.0;net-9.0">
<AttributeName Language="C#">[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")]</AttributeName>
<AttributeName Language="F#">[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")>]</AttributeName>
</Attribute>
</Attributes>
<Parameters>
<Parameter Name="type" Type="System.Type" />
<Parameter Name="overrides" Type="System.Xml.Serialization.XmlAttributeOverrides">
<Attributes>
<Attribute FrameworkAlternate="net-10.0;net-11.0;net-8.0;net-9.0">
<AttributeName Language="C#">[System.Runtime.CompilerServices.Nullable(2)]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.CompilerServices.Nullable(2)>]</AttributeName>
</Attribute>
</Attributes>
</Parameter>
</Parameters>
<Docs>
<param name="type">The type of the object to serialize.</param>
<param name="overrides">An <see cref="T:System.Xml.Serialization.XmlAttributeOverrides" />.</param>
<summary>Initializes a new instance of the <see cref="T:System.Xml.Serialization.XmlSerializer" /> class that can serialize objects of the specified type into XML documents, and deserialize XML documents into objects of the specified type. Each object to be serialized can itself contain instances of classes, which this overload can override with other classes.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The `overrides` parameter can be used to control how fields and properties are encoded in XML. These settings override any attributes that already exist on the objects. This can be useful when the source code cannot be modified or multiple encodings are required for the same classes.
## Examples
The following example serializes an instance of a class that is defined in a DLL and to do so, overrides the public members found in the DLL.
:::code language="csharp" source="~/snippets/csharp/System.Xml.Serialization/XmlSerializer/.ctor/source4.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/System.Xml.Serialization/XmlSerializer/.ctor/source4.vb" id="Snippet1":::
]]></format>
</remarks>
<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>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public XmlSerializer (Type type, System.Xml.Serialization.XmlRootAttribute root);" 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, class System.Xml.Serialization.XmlRootAttribute root) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.Serialization.XmlSerializer.#ctor(System.Type,System.Xml.Serialization.XmlRootAttribute)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (type As Type, root As XmlRootAttribute)" />
<MemberSignature Language="F#" Value="new System.Xml.Serialization.XmlSerializer : Type * System.Xml.Serialization.XmlRootAttribute -> System.Xml.Serialization.XmlSerializer" Usage="new System.Xml.Serialization.XmlSerializer (type, root)" />
<MemberSignature Language="C++ CLI" Value="public:
 XmlSerializer(Type ^ type, System::Xml::Serialization::XmlRootAttribute ^ root);" />
<MemberSignature Language="C#" Value="public XmlSerializer (Type type, System.Xml.Serialization.XmlRootAttribute? root);" FrameworkAlternate="net-10.0;net-11.0;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>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
<AssemblyVersion>11.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-10.0;net-11.0">
<AttributeName Language="C#">[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("XML serializer relies on dynamic code generation which is not available with Ahead of Time compilation")]</AttributeName>
<AttributeName Language="F#">[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("XML serializer relies on dynamic code generation which is not available with Ahead of Time compilation")>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="net-10.0;net-11.0;net-6.0;net-7.0;net-8.0;net-9.0">
<AttributeName Language="C#">[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")]</AttributeName>
<AttributeName Language="F#">[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")>]</AttributeName>
</Attribute>
</Attributes>
<Parameters>
<Parameter Name="type" Type="System.Type" />
<Parameter Name="root" Type="System.Xml.Serialization.XmlRootAttribute">
<Attributes>
<Attribute FrameworkAlternate="net-10.0;net-11.0;net-8.0;net-9.0">
<AttributeName Language="C#">[System.Runtime.CompilerServices.Nullable(2)]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.CompilerServices.Nullable(2)>]</AttributeName>
</Attribute>
</Attributes>
</Parameter>
</Parameters>
<Docs>
<param name="type">The type of the object that this <see cref="T:System.Xml.Serialization.XmlSerializer" /> can serialize.</param>
<param name="root">An <see cref="T:System.Xml.Serialization.XmlRootAttribute" /> that represents the XML root element.</param>
<summary>Initializes a new instance of the <see cref="T:System.Xml.Serialization.XmlSerializer" /> class that can serialize objects of the specified type into XML documents, and deserialize an XML document into object of the specified type. It also specifies the class to use as the XML root element.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The root element of an XML document encloses all the other elements. By default, the object specified by the `type` parameter is serialized as the root element. Properties, such as the XML element name of the root element, are taken from the `type` object. However, the `root` parameter allows you to replace the default object's information by specifying an <xref:System.Xml.Serialization.XmlRootAttribute>; the object allows you to set a different namespace, element name, and so on.
## Examples
The following example constructs an <xref:System.Xml.Serialization.XmlSerializer> that uses an <xref:System.Xml.Serialization.XmlRootAttribute> that contains various properties of the XML root element, such as its namespace and element name.
:::code language="csharp" source="~/snippets/csharp/System.Xml.Serialization/XmlSerializer/.ctor/source2.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/System.Xml.Serialization/XmlSerializer/.ctor/source2.vb" id="Snippet1":::
]]></format>
</remarks>
<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>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public XmlSerializer (Type type, System.Xml.Serialization.XmlAttributeOverrides overrides, Type[] extraTypes, System.Xml.Serialization.XmlRootAttribute root, string defaultNamespace);" 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, class System.Xml.Serialization.XmlAttributeOverrides overrides, class System.Type[] extraTypes, class System.Xml.Serialization.XmlRootAttribute root, string defaultNamespace) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.Serialization.XmlSerializer.#ctor(System.Type,System.Xml.Serialization.XmlAttributeOverrides,System.Type[],System.Xml.Serialization.XmlRootAttribute,System.String)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (type As Type, overrides As XmlAttributeOverrides, extraTypes As Type(), root As XmlRootAttribute, defaultNamespace As String)" />
<MemberSignature Language="F#" Value="new System.Xml.Serialization.XmlSerializer : Type * System.Xml.Serialization.XmlAttributeOverrides * Type[] * System.Xml.Serialization.XmlRootAttribute * string -> System.Xml.Serialization.XmlSerializer" Usage="new System.Xml.Serialization.XmlSerializer (type, overrides, extraTypes, root, defaultNamespace)" />
<MemberSignature Language="C++ CLI" Value="public:
 XmlSerializer(Type ^ type, System::Xml::Serialization::XmlAttributeOverrides ^ overrides, cli::array <Type ^> ^ extraTypes, System::Xml::Serialization::XmlRootAttribute ^ root, System::String ^ defaultNamespace);" />
<MemberSignature Language="C#" Value="public XmlSerializer (Type type, System.Xml.Serialization.XmlAttributeOverrides? overrides, Type[]? extraTypes, System.Xml.Serialization.XmlRootAttribute? root, string? defaultNamespace);" FrameworkAlternate="net-10.0;net-11.0;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>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
<AssemblyVersion>11.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-10.0;net-11.0">
<AttributeName Language="C#">[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("XML serializer relies on dynamic code generation which is not available with Ahead of Time compilation")]</AttributeName>
<AttributeName Language="F#">[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("XML serializer relies on dynamic code generation which is not available with Ahead of Time compilation")>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="net-10.0;net-11.0;net-6.0;net-7.0;net-8.0;net-9.0">
<AttributeName Language="C#">[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")]</AttributeName>
<AttributeName Language="F#">[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")>]</AttributeName>
</Attribute>
<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">
<Attributes>
<Attribute FrameworkAlternate="net-10.0;net-11.0;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>
</Attributes>
</Parameter>
<Parameter Name="overrides" Type="System.Xml.Serialization.XmlAttributeOverrides" />
<Parameter Name="extraTypes" Type="System.Type[]">
<Attributes>
<Attribute FrameworkAlternate="net-10.0;net-11.0;net-8.0;net-9.0">
<AttributeName Language="C#">[System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1 })]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1 })>]</AttributeName>
</Attribute>
</Attributes>
</Parameter>
<Parameter Name="root" Type="System.Xml.Serialization.XmlRootAttribute" />
<Parameter Name="defaultNamespace" Type="System.String" />
</Parameters>
<Docs>
<param name="type">The type of the object that this <see cref="T:System.Xml.Serialization.XmlSerializer" /> can serialize.</param>
<param name="overrides">An <see cref="T:System.Xml.Serialization.XmlAttributeOverrides" /> that extends or overrides the behavior of the class specified in the <paramref name="type" /> parameter.</param>
<param name="extraTypes">A <see cref="T:System.Type" /> array of additional object types to serialize.</param>
<param name="root">An <see cref="T:System.Xml.Serialization.XmlRootAttribute" /> that defines the XML root element properties.</param>
<param name="defaultNamespace">The default namespace of all XML elements in the XML document.</param>
<summary>Initializes a new instance of the <see cref="T:System.Xml.Serialization.XmlSerializer" /> class that can serialize objects of type <see cref="T:System.Object" /> into XML document instances, and deserialize XML document instances into objects of type <see cref="T:System.Object" />. Each object to be serialized can itself contain instances of classes, which this overload overrides with other classes. This overload also specifies the default namespace for all the XML elements and the class to use as the XML root element.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The `overrides` parameter allows for the creation of an <xref:System.Xml.Serialization.XmlSerializer> that serializes a class that extends or overrides the behavior of a base class. For example, given a DLL, it is possible to create a class that inherits or extends a class contained in the DLL. To serialize such a class, you must use an instance of the <xref:System.Xml.Serialization.XmlAttributeOverrides> class when constructing the <xref:System.Xml.Serialization.XmlSerializer>. For more details, see <xref:System.Xml.Serialization.XmlAttributeOverrides>.
By default, if a public property or field returns an object, or array of objects, the object types are automatically serialized. However, if a class contains a field or property that returns an array of type <xref:System.Object>, any object can be inserted into that array. In that case, the <xref:System.Xml.Serialization.XmlSerializer> must be instructed to expect all the possible object types that are inserted into the <xref:System.Object> array. To do this, use the `extraTypes` parameter to specify the extra object types to serialize or deserialize.
The root element of an XML document encloses all the other elements. By default, the object specified by the `type` parameter is serialized as the root element. Properties, such as the XML element name of the root element are taken from the `type` object. However, the `root` parameter allows you to replace the default object's information by specifying an <xref:System.Xml.Serialization.XmlRootAttribute>; the object allows you to set a different namespace, element name, and so on.
Use the `defaultName` parameter to specify the default namespace of all XML elements generated by the <xref:System.Xml.Serialization.XmlSerializer>.
## Examples
The following example serializes an instance of a class that is defined in a DLL and to do so, overrides the public members found in the class. The example also specifies an array of extra types, the default namespace for all XML elements, and the class to use that provides the XML root element information. The example assumes that the code at the beginning has been compiled into a DLL named `HighSchool`.
:::code language="csharp" source="~/snippets/csharp/System.Xml.Serialization/XmlSerializer/.ctor/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/System.Xml.Serialization/XmlSerializer/.ctor/source.vb" id="Snippet1":::
]]></format>
</remarks>
<altmember cref="T:System.Xml.Serialization.XmlAttributeOverrides" />
<altmember cref="T:System.Xml.Serialization.XmlRootAttribute" />
<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>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public XmlSerializer (Type type, System.Xml.Serialization.XmlAttributeOverrides? overrides, Type[]? extraTypes, System.Xml.Serialization.XmlRootAttribute? root, string? defaultNamespace, string? location);" FrameworkAlternate="net-10.0;net-11.0;net-5.0;net-6.0;net-7.0;net-8.0;net-9.0" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Type type, class System.Xml.Serialization.XmlAttributeOverrides overrides, class System.Type[] extraTypes, class System.Xml.Serialization.XmlRootAttribute root, string defaultNamespace, string location) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.Serialization.XmlSerializer.#ctor(System.Type,System.Xml.Serialization.XmlAttributeOverrides,System.Type[],System.Xml.Serialization.XmlRootAttribute,System.String,System.String)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (type As Type, overrides As XmlAttributeOverrides, extraTypes As Type(), root As XmlRootAttribute, defaultNamespace As String, location As String)" />
<MemberSignature Language="F#" Value="new System.Xml.Serialization.XmlSerializer : Type * System.Xml.Serialization.XmlAttributeOverrides * Type[] * System.Xml.Serialization.XmlRootAttribute * string * string -> System.Xml.Serialization.XmlSerializer" Usage="new System.Xml.Serialization.XmlSerializer (type, overrides, extraTypes, root, defaultNamespace, location)" />
<MemberSignature Language="C++ CLI" Value="public:
 XmlSerializer(Type ^ type, System::Xml::Serialization::XmlAttributeOverrides ^ overrides, cli::array <Type ^> ^ extraTypes, System::Xml::Serialization::XmlRootAttribute ^ root, System::String ^ defaultNamespace, System::String ^ location);" />
<MemberSignature Language="C#" Value="public XmlSerializer (Type type, System.Xml.Serialization.XmlAttributeOverrides overrides, Type[] extraTypes, System.Xml.Serialization.XmlRootAttribute root, string defaultNamespace, string location);" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netcore-3.1;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" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<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.XmlSerializer</AssemblyName>
<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>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
<AssemblyVersion>11.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml.Serialization</AssemblyName>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="net-10.0;net-11.0">
<AttributeName Language="C#">[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("XML serializer relies on dynamic code generation which is not available with Ahead of Time compilation")]</AttributeName>
<AttributeName Language="F#">[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("XML serializer relies on dynamic code generation which is not available with Ahead of Time compilation")>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="net-10.0;net-11.0;net-6.0;net-7.0;net-8.0;net-9.0">
<AttributeName Language="C#">[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")]</AttributeName>
<AttributeName Language="F#">[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")>]</AttributeName>
</Attribute>
<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" Index="0" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;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;netstandard-2.0;netstandard-2.1;netcore-3.1;net-5.0;net-6.0;net-7.0;netframework-4.8.1;net-8.0;net-9.0;net-10.0;net-11.0">
<Attributes>
<Attribute FrameworkAlternate="net-10.0;net-11.0;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>
</Attributes>
</Parameter>
<Parameter Name="overrides" Type="System.Xml.Serialization.XmlAttributeOverrides" Index="1" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;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;netstandard-2.0;netstandard-2.1;netcore-3.1;net-5.0;net-6.0;net-7.0;netframework-4.8.1;net-8.0;net-9.0;net-10.0;net-11.0" />
<Parameter Name="extraTypes" Type="System.Type[]" Index="2" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;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;netstandard-2.0;netstandard-2.1;netcore-3.1;net-5.0;net-6.0;net-7.0;netframework-4.8.1;net-8.0;net-9.0;net-10.0;net-11.0">
<Attributes>
<Attribute FrameworkAlternate="net-10.0;net-11.0;net-8.0;net-9.0">
<AttributeName Language="C#">[System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1 })]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1 })>]</AttributeName>
</Attribute>
</Attributes>
</Parameter>
<Parameter Name="root" Type="System.Xml.Serialization.XmlRootAttribute" Index="3" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;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;netstandard-2.0;netstandard-2.1;netcore-3.1;net-5.0;net-6.0;net-7.0;netframework-4.8.1;net-8.0;net-9.0;net-10.0;net-11.0" />
<Parameter Name="defaultNamespace" Type="System.String" Index="4" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;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;netstandard-2.0;netstandard-2.1;netcore-3.1;net-5.0;net-6.0;net-7.0;netframework-4.8.1;net-8.0;net-9.0;net-10.0;net-11.0" />
<Parameter Name="location" Type="System.String" Index="5" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;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;netstandard-2.0;netstandard-2.1;netcore-3.1;net-5.0;net-6.0;net-7.0;netframework-4.8.1;net-8.0;net-9.0;net-10.0;net-11.0" />
</Parameters>
<Docs>
<param name="type">The type of the object that this <see cref="T:System.Xml.Serialization.XmlSerializer" /> can serialize.</param>
<param name="overrides">An <see cref="T:System.Xml.Serialization.XmlAttributeOverrides" /> that extends or overrides the behavior of the class specified in the <paramref name="type" /> parameter.</param>
<param name="extraTypes">A <see cref="T:System.Type" /> array of additional object types to serialize.</param>
<param name="root">An <see cref="T:System.Xml.Serialization.XmlRootAttribute" /> that defines the XML root element properties.</param>
<param name="defaultNamespace">The default namespace of all XML elements in the XML document.</param>
<param name="location">The location of the types.</param>
<summary>Initializes a new instance of the <see cref="T:System.Xml.Serialization.XmlSerializer" /> class that can serialize objects of type <see cref="T:System.Object" /> into XML document instances, and deserialize XML document instances into objects of type <see cref="T:System.Object" />. Each object to be serialized can itself contain instances of classes, which this overload overrides with other classes. This overload also specifies the default namespace for all the XML elements and the class to use as the XML root element.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public XmlSerializer (Type type, System.Xml.Serialization.XmlAttributeOverrides overrides, Type[] extraTypes, System.Xml.Serialization.XmlRootAttribute root, string defaultNamespace, string location, System.Security.Policy.Evidence evidence);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Type type, class System.Xml.Serialization.XmlAttributeOverrides overrides, class System.Type[] extraTypes, class System.Xml.Serialization.XmlRootAttribute root, string defaultNamespace, string location, class System.Security.Policy.Evidence evidence) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.Serialization.XmlSerializer.#ctor(System.Type,System.Xml.Serialization.XmlAttributeOverrides,System.Type[],System.Xml.Serialization.XmlRootAttribute,System.String,System.String,System.Security.Policy.Evidence)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (type As Type, overrides As XmlAttributeOverrides, extraTypes As Type(), root As XmlRootAttribute, defaultNamespace As String, location As String, evidence As Evidence)" />
<MemberSignature Language="F#" Value="new System.Xml.Serialization.XmlSerializer : Type * System.Xml.Serialization.XmlAttributeOverrides * Type[] * System.Xml.Serialization.XmlRootAttribute * string * string * System.Security.Policy.Evidence -> System.Xml.Serialization.XmlSerializer" Usage="new System.Xml.Serialization.XmlSerializer (type, overrides, extraTypes, root, defaultNamespace, location, evidence)" />
<MemberSignature Language="C++ CLI" Value="public:
 XmlSerializer(Type ^ type, System::Xml::Serialization::XmlAttributeOverrides ^ overrides, cli::array <Type ^> ^ extraTypes, System::Xml::Serialization::XmlRootAttribute ^ root, System::String ^ defaultNamespace, System::String ^ location, System::Security::Policy::Evidence ^ evidence);" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml.XmlSerializer</AssemblyName>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml.Serialization</AssemblyName>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="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.Obsolete("This method is obsolete and will be removed in a future release of the .NET Framework. Please use a XmlSerializer constructor overload which does not take an Evidence parameter. See http://go2.microsoft.com/fwlink/?LinkId=131738 for more information.")]</AttributeName>
<AttributeName Language="F#">[<System.Obsolete("This method is obsolete and will be removed in a future release of the .NET Framework. Please use a XmlSerializer constructor overload which does not take an Evidence parameter. See http://go2.microsoft.com/fwlink/?LinkId=131738 for more information.")>]</AttributeName>
</Attribute>
</Attributes>
<Parameters>
<Parameter Name="type" Type="System.Type" Index="0" 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" />
<Parameter Name="overrides" Type="System.Xml.Serialization.XmlAttributeOverrides" Index="1" 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" />
<Parameter Name="extraTypes" Type="System.Type[]" Index="2" 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" />
<Parameter Name="root" Type="System.Xml.Serialization.XmlRootAttribute" Index="3" 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" />
<Parameter Name="defaultNamespace" Type="System.String" Index="4" 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" />
<Parameter Name="location" Type="System.String" Index="5" 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" />
<Parameter Name="evidence" Type="System.Security.Policy.Evidence" Index="6" 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" />
</Parameters>
<Docs>
<param name="type">The type of the object that this <see cref="T:System.Xml.Serialization.XmlSerializer" /> can serialize.</param>
<param name="overrides">An <see cref="T:System.Xml.Serialization.XmlAttributeOverrides" /> that extends or overrides the behavior of the class specified in the <paramref name="type" /> parameter.</param>
<param name="extraTypes">A <see cref="T:System.Type" /> array of additional object types to serialize.</param>
<param name="root">An <see cref="T:System.Xml.Serialization.XmlRootAttribute" /> that defines the XML root element properties.</param>
<param name="defaultNamespace">The default namespace of all XML elements in the XML document.</param>
<param name="location">The location of the types.</param>
<param name="evidence">An instance of the <see cref="T:System.Security.Policy.Evidence" /> class that contains credentials required to access types.</param>
<summary>Initializes a new instance of the <see cref="T:System.Xml.Serialization.XmlSerializer" /> class that can serialize objects of the specified type into XML document instances, and deserialize XML document instances into objects of the specified type. This overload allows you to supply other types that can be encountered during a serialization or deserialization operation, as well as a default namespace for all XML elements, the class to use as the XML root element, its location, and credentials required for access.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Allows more precise control over access to a temporary directory and prevents code injection and exploitation. To use this method, specify a location and give access only to specific users. Administrators can set up policies with evidence lists that match evidence to permissions.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="CanDeserialize">
<MemberSignature Language="C#" Value="public virtual bool CanDeserialize (System.Xml.XmlReader xmlReader);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance bool CanDeserialize(class System.Xml.XmlReader xmlReader) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.Serialization.XmlSerializer.CanDeserialize(System.Xml.XmlReader)" />
<MemberSignature Language="VB.NET" Value="Public Overridable Function CanDeserialize (xmlReader As XmlReader) As Boolean" />
<MemberSignature Language="F#" Value="abstract member CanDeserialize : System.Xml.XmlReader -> bool
override this.CanDeserialize : System.Xml.XmlReader -> bool" Usage="xmlSerializer.CanDeserialize xmlReader" />
<MemberSignature Language="C++ CLI" Value="public:
 virtual bool CanDeserialize(System::Xml::XmlReader ^ xmlReader);" />
<MemberType>Method</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>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
<AssemblyVersion>11.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>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="xmlReader" Type="System.Xml.XmlReader" />
</Parameters>
<Docs>
<param name="xmlReader">An <see cref="T:System.Xml.XmlReader" /> that points to the document to deserialize.</param>
<summary>Gets a value that indicates whether this <see cref="T:System.Xml.Serialization.XmlSerializer" /> can deserialize a specified XML document.</summary>
<returns>
<see langword="true" /> if this <see cref="T:System.Xml.Serialization.XmlSerializer" /> can deserialize the object that the <see cref="T:System.Xml.XmlReader" /> points to; otherwise, <see langword="false" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Examples
The following example calls the <xref:System.Xml.Serialization.XmlSerializer.CanDeserialize%2A> method to check whether an XML document can be deserialized.
:::code language="csharp" source="~/snippets/csharp/System.Xml.Serialization/XmlSerializer/CanDeserialize/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/System.Xml.Serialization/XmlSerializer/CanDeserialize/source.vb" id="Snippet1":::
]]></format>
</remarks>
<altmember cref="M:System.Xml.Serialization.XmlSerializer.Deserialize(System.IO.Stream)" />
</Docs>
</Member>
<Member MemberName="CreateReader">
<MemberSignature Language="C#" Value="protected virtual System.Xml.Serialization.XmlSerializationReader CreateReader ();" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance class System.Xml.Serialization.XmlSerializationReader CreateReader() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Xml.Serialization.XmlSerializer.CreateReader" />
<MemberSignature Language="VB.NET" Value="Protected Overridable Function CreateReader () As XmlSerializationReader" />
<MemberSignature Language="F#" Value="abstract member CreateReader : unit -> System.Xml.Serialization.XmlSerializationReader
override this.CreateReader : unit -> System.Xml.Serialization.XmlSerializationReader" Usage="xmlSerializer.CreateReader " />
<MemberSignature Language="C++ CLI" Value="protected:
 virtual System::Xml::Serialization::XmlSerializationReader ^ CreateReader();" />
<MemberType>Method</MemberType>
<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.XmlSerializer</AssemblyName>
<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>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
<AssemblyVersion>11.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml.Serialization</AssemblyName>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Xml.Serialization.XmlSerializationReader</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Returns an object used to read the XML document to be serialized.</summary>
<returns>An <see cref="T:System.Xml.Serialization.XmlSerializationReader" /> used to read the XML document.</returns>
<remarks>To be added.</remarks>
<exception cref="T:System.NotImplementedException">Any attempt is made to access the method when the method is not overridden in a descendant class.</exception>