DataContractSerializer 생성자
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
DataContractSerializer 클래스의 새 인스턴스를 초기화합니다.
오버로드
| Name | Description |
|---|---|
| DataContractSerializer(Type) |
지정된 형식의 DataContractSerializer 개체를 직렬화하거나 역직렬화하는 클래스의 새 인스턴스를 초기화합니다. |
| DataContractSerializer(Type, XmlDictionaryString, XmlDictionaryString, IEnumerable<Type>, Int32, Boolean, Boolean, IDataContractSurrogate, DataContractResolver) |
지정된 형식의 DataContractSerializer 개체를 직렬화하거나 역직렬화하는 클래스의 새 인스턴스를 초기화합니다. 또한 이 메서드는 개체 그래프에 있을 수 있는 알려진 형식 목록, 직렬화할 최대 그래프 항목 수, 예기치 않은 데이터를 무시할 매개 변수, 비표준 XML 구문을 사용하여 그래프의 개체 참조 데이터를 유지할지 여부, 사용자 지정 serialization에 대한 서로게이트, 콘텐츠를 포함하는 XML 요소 및 네임스페이스를 지정하는 매개 변수 XmlDictionaryString 를 지정합니다. 런타임에 매핑 |
| DataContractSerializer(Type, String, String, IEnumerable<Type>, Int32, Boolean, Boolean, IDataContractSurrogate, DataContractResolver) |
지정된 형식의 DataContractSerializer 개체를 직렬화하거나 역직렬화하는 클래스의 새 인스턴스를 초기화합니다. 또한 이 메서드는 개체 그래프에 있을 수 있는 알려진 형식 목록, 직렬화할 최대 그래프 항목 수, 예기치 않은 데이터를 무시할 매개 변수, 비표준 XML 구문을 사용하여 그래프에서 개체 참조 데이터를 유지할지 여부, 사용자 지정 serialization을 위한 서로게이트, 콘텐츠를 포함하는 XML 요소 및 네임스페이스도 지정합니다. 런타임에 매핑 |
| DataContractSerializer(Type, XmlDictionaryString, XmlDictionaryString, IEnumerable<Type>, Int32, Boolean, Boolean, IDataContractSurrogate) |
지정된 형식의 DataContractSerializer 개체를 직렬화하거나 역직렬화하는 클래스의 새 인스턴스를 초기화합니다. 또한 이 메서드는 개체 그래프에 있을 수 있는 알려진 형식 목록, 직렬화할 최대 그래프 항목 수, 예기치 않은 데이터를 무시할 매개 변수, 비표준 XML 구문을 사용하여 그래프에서 개체 참조 데이터를 유지할지 여부, 사용자 지정 serialization에 대한 서로게이트 및 콘텐츠를 포함하는 XML 요소 및 네임스페이스를 지정하는 매개 변수 XmlDictionaryString 를 지정합니다. |
| DataContractSerializer(Type, String, String, IEnumerable<Type>, Int32, Boolean, Boolean, IDataContractSurrogate) |
지정된 형식의 DataContractSerializer 개체를 직렬화하거나 역직렬화하는 클래스의 새 인스턴스를 초기화합니다. 또한 이 메서드는 개체 그래프에 있을 수 있는 알려진 형식의 목록, 직렬화할 최대 그래프 항목 수, 예기치 않은 데이터를 무시할 매개 변수, 비표준 XML 구문을 사용하여 그래프의 개체 참조 데이터를 유지할지 여부, 사용자 지정 serialization의 서로게이트 및 콘텐츠를 포함하는 XML 요소 및 네임스페이스를 지정합니다. |
| DataContractSerializer(Type, IEnumerable<Type>, Int32, Boolean, Boolean, IDataContractSurrogate) |
지정된 형식의 DataContractSerializer 개체를 직렬화하거나 역직렬화하는 클래스의 새 인스턴스를 초기화합니다. 또한 이 메서드는 개체 그래프에 있을 수 있는 알려진 형식 목록, 직렬화할 최대 그래프 항목 수, 예기치 않은 데이터를 무시할 매개 변수, 비표준 XML 구문을 사용하여 그래프에 개체 참조 데이터를 유지할지 여부 및 사용자 지정 serialization을 위한 서로게이트를 지정합니다. |
| DataContractSerializer(Type, IEnumerable<Type>, Int32, Boolean, Boolean, IDataContractSurrogate, DataContractResolver) |
지정된 형식의 DataContractSerializer 개체를 직렬화하거나 역직렬화하는 클래스의 새 인스턴스를 초기화합니다. 또한 이 메서드는 개체 그래프에 있을 수 있는 알려진 형식 목록, 직렬화할 최대 그래프 항목 수, 예기치 않은 데이터를 무시하는 매개 변수, 비표준 XML 구문을 사용하여 그래프에서 개체 참조 데이터를 유지할지 여부, 사용자 지정 serialization을 위한 서로게이트 및 런타임에 매핑 |
| DataContractSerializer(Type, String, String, IEnumerable<Type>) |
지정된 형식의 DataContractSerializer 개체를 직렬화하거나 역직렬화하는 클래스의 새 인스턴스를 초기화합니다. 또한 이 메서드는 두 문자열 매개 변수의 루트 XML 요소와 네임스페이스뿐만 아니라 개체 그래프에 있을 수 있는 알려진 형식 목록을 지정합니다. |
| DataContractSerializer(Type, XmlDictionaryString, XmlDictionaryString) |
XML 루트 요소 및 형식의 DataContractSerializer 매개 변수를 통해 지정된 네임스페이스를 사용하여 지정된 형식의 개체를 직렬화하거나 역직렬화하는 클래스의 XmlDictionaryString새 인스턴스를 초기화합니다. |
| DataContractSerializer(Type, String, String) |
제공된 XML 루트 요소 및 네임스페이 DataContractSerializer 스를 사용하여 지정된 형식의 개체를 직렬화하거나 역직렬화하는 클래스의 새 인스턴스를 초기화합니다. |
| DataContractSerializer(Type, DataContractSerializerSettings) |
지정된 형식 및 설정의 DataContractSerializer 개체를 직렬화하거나 역직렬화하는 클래스의 새 인스턴스를 초기화합니다. |
| DataContractSerializer(Type, IEnumerable<Type>) |
지정된 형식의 DataContractSerializer 개체와 개체 그래프에 있을 수 있는 알려진 형식의 컬렉션을 직렬화하거나 역직렬화하는 클래스의 새 인스턴스를 초기화합니다. |
| DataContractSerializer(Type, XmlDictionaryString, XmlDictionaryString, IEnumerable<Type>) |
지정된 형식의 DataContractSerializer 개체를 직렬화하거나 역직렬화하는 클래스의 새 인스턴스를 초기화합니다. 또한 이 메서드는 두 XmlDictionaryString 매개 변수의 루트 XML 요소와 네임스페이스뿐만 아니라 개체 그래프에 있을 수 있는 알려진 형식 목록을 지정합니다. |
DataContractSerializer(Type)
- Source:
- DataContractSerializer.cs
- Source:
- DataContractSerializer.cs
- Source:
- DataContractSerializer.cs
- Source:
- DataContractSerializer.cs
- Source:
- DataContractSerializer.cs
지정된 형식의 DataContractSerializer 개체를 직렬화하거나 역직렬화하는 클래스의 새 인스턴스를 초기화합니다.
public:
DataContractSerializer(Type ^ type);
public DataContractSerializer(Type type);
new System.Runtime.Serialization.DataContractSerializer : Type -> System.Runtime.Serialization.DataContractSerializer
Public Sub New (type As Type)
매개 변수
- type
- Type
직렬화되거나 역직렬화된 인스턴스의 형식입니다.
예제
다음 예제에서는 직렬화 또는 역직렬화할 형식을 지정하는 인스턴스 DataContractSerializer 를 만듭니다.
public static void Constructor1()
{
// Create an instance of the DataContractSerializer.
DataContractSerializer ser =
new DataContractSerializer(typeof(Person));
// Other code not shown.
}
Public Shared Sub Constructor1()
' Create an instance of the DataContractSerializer.
Dim ser As New DataContractSerializer(GetType(Person))
' Other code not shown.
End Sub
적용 대상
DataContractSerializer(Type, XmlDictionaryString, XmlDictionaryString, IEnumerable<Type>, Int32, Boolean, Boolean, IDataContractSurrogate, DataContractResolver)
지정된 형식의 DataContractSerializer 개체를 직렬화하거나 역직렬화하는 클래스의 새 인스턴스를 초기화합니다. 또한 이 메서드는 개체 그래프에 있을 수 있는 알려진 형식 목록, 직렬화할 최대 그래프 항목 수, 예기치 않은 데이터를 무시할 매개 변수, 비표준 XML 구문을 사용하여 그래프의 개체 참조 데이터를 유지할지 여부, 사용자 지정 serialization에 대한 서로게이트, 콘텐츠를 포함하는 XML 요소 및 네임스페이스를 지정하는 매개 변수 XmlDictionaryString 를 지정합니다. 런타임에 매핑 xsi:type 선언을 위한 대안입니다.
public:
DataContractSerializer(Type ^ type, System::Xml::XmlDictionaryString ^ rootName, System::Xml::XmlDictionaryString ^ rootNamespace, System::Collections::Generic::IEnumerable<Type ^> ^ knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, bool preserveObjectReferences, System::Runtime::Serialization::IDataContractSurrogate ^ dataContractSurrogate, System::Runtime::Serialization::DataContractResolver ^ dataContractResolver);
public DataContractSerializer(Type type, System.Xml.XmlDictionaryString rootName, System.Xml.XmlDictionaryString rootNamespace, System.Collections.Generic.IEnumerable<Type> knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, bool preserveObjectReferences, System.Runtime.Serialization.IDataContractSurrogate dataContractSurrogate, System.Runtime.Serialization.DataContractResolver dataContractResolver);
new System.Runtime.Serialization.DataContractSerializer : Type * System.Xml.XmlDictionaryString * System.Xml.XmlDictionaryString * seq<Type> * int * bool * bool * System.Runtime.Serialization.IDataContractSurrogate * System.Runtime.Serialization.DataContractResolver -> System.Runtime.Serialization.DataContractSerializer
Public Sub New (type As Type, rootName As XmlDictionaryString, rootNamespace As XmlDictionaryString, knownTypes As IEnumerable(Of Type), maxItemsInObjectGraph As Integer, ignoreExtensionDataObject As Boolean, preserveObjectReferences As Boolean, dataContractSurrogate As IDataContractSurrogate, dataContractResolver As DataContractResolver)
매개 변수
- type
- Type
직렬화되거나 역직렬화된 인스턴스의 형식입니다.
- rootName
- XmlDictionaryString
직렬화 또는 역직렬화할 콘텐츠를 묶는 XML 요소입니다.
- rootNamespace
- XmlDictionaryString
직렬화 또는 역직렬화할 콘텐츠를 묶는 XML 요소의 네임스페이스입니다.
- knownTypes
- IEnumerable<Type>
IEnumerable<T> 그 중 Type 개체 그래프에 있을 수 있는 알려진 형식을 포함합니다.
- maxItemsInObjectGraph
- Int32
직렬화 또는 역직렬화할 그래프의 최대 항목 수입니다.
- ignoreExtensionDataObject
- Boolean
trueserialization 및 deserialization 시 형식의 확장에서 제공하는 데이터를 무시합니다. 그렇지 않으면 . false
- preserveObjectReferences
- Boolean
true비표준 XML 구문을 사용하여 개체 참조 데이터를 유지하려면 그렇지 않으면 . false
- dataContractSurrogate
- IDataContractSurrogate
serialization 프로세스를 사용자 지정하는 구현 IDataContractSurrogate 입니다.
- dataContractResolver
- DataContractResolver
선언을 데이터 계약 형식에 DataContractResolver 매핑 xsi:type 하는 구현입니다.
적용 대상
DataContractSerializer(Type, String, String, IEnumerable<Type>, Int32, Boolean, Boolean, IDataContractSurrogate, DataContractResolver)
지정된 형식의 DataContractSerializer 개체를 직렬화하거나 역직렬화하는 클래스의 새 인스턴스를 초기화합니다. 또한 이 메서드는 개체 그래프에 있을 수 있는 알려진 형식 목록, 직렬화할 최대 그래프 항목 수, 예기치 않은 데이터를 무시할 매개 변수, 비표준 XML 구문을 사용하여 그래프에서 개체 참조 데이터를 유지할지 여부, 사용자 지정 serialization을 위한 서로게이트, 콘텐츠를 포함하는 XML 요소 및 네임스페이스도 지정합니다. 런타임에 매핑 xsi:type 선언을 위한 대안입니다.
public:
DataContractSerializer(Type ^ type, System::String ^ rootName, System::String ^ rootNamespace, System::Collections::Generic::IEnumerable<Type ^> ^ knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, bool preserveObjectReferences, System::Runtime::Serialization::IDataContractSurrogate ^ dataContractSurrogate, System::Runtime::Serialization::DataContractResolver ^ dataContractResolver);
public DataContractSerializer(Type type, string rootName, string rootNamespace, System.Collections.Generic.IEnumerable<Type> knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, bool preserveObjectReferences, System.Runtime.Serialization.IDataContractSurrogate dataContractSurrogate, System.Runtime.Serialization.DataContractResolver dataContractResolver);
new System.Runtime.Serialization.DataContractSerializer : Type * string * string * seq<Type> * int * bool * bool * System.Runtime.Serialization.IDataContractSurrogate * System.Runtime.Serialization.DataContractResolver -> System.Runtime.Serialization.DataContractSerializer
Public Sub New (type As Type, rootName As String, rootNamespace As String, knownTypes As IEnumerable(Of Type), maxItemsInObjectGraph As Integer, ignoreExtensionDataObject As Boolean, preserveObjectReferences As Boolean, dataContractSurrogate As IDataContractSurrogate, dataContractResolver As DataContractResolver)
매개 변수
- type
- Type
직렬화되거나 역직렬화된 인스턴스의 형식입니다.
- rootName
- String
직렬화 또는 역직렬화할 콘텐츠를 묶는 XML 요소입니다.
- rootNamespace
- String
직렬화 또는 역직렬화할 콘텐츠를 묶는 XML 요소의 네임스페이스입니다.
- knownTypes
- IEnumerable<Type>
IEnumerable<T> 그 중 Type 개체 그래프에 있을 수 있는 알려진 형식을 포함합니다.
- maxItemsInObjectGraph
- Int32
직렬화 또는 역직렬화할 그래프의 최대 항목 수입니다.
- ignoreExtensionDataObject
- Boolean
trueserialization 및 deserialization 시 형식의 확장에서 제공하는 데이터를 무시합니다. 그렇지 않으면 . false
- preserveObjectReferences
- Boolean
true비표준 XML 구문을 사용하여 개체 참조 데이터를 유지하려면 그렇지 않으면 . false
- dataContractSurrogate
- IDataContractSurrogate
serialization 프로세스를 사용자 지정하는 구현 IDataContractSurrogate 입니다.
- dataContractResolver
- DataContractResolver
선언을 데이터 계약 형식에 DataContractResolver 매핑 xsi:type 하는 구현입니다.
적용 대상
DataContractSerializer(Type, XmlDictionaryString, XmlDictionaryString, IEnumerable<Type>, Int32, Boolean, Boolean, IDataContractSurrogate)
지정된 형식의 DataContractSerializer 개체를 직렬화하거나 역직렬화하는 클래스의 새 인스턴스를 초기화합니다. 또한 이 메서드는 개체 그래프에 있을 수 있는 알려진 형식 목록, 직렬화할 최대 그래프 항목 수, 예기치 않은 데이터를 무시할 매개 변수, 비표준 XML 구문을 사용하여 그래프에서 개체 참조 데이터를 유지할지 여부, 사용자 지정 serialization에 대한 서로게이트 및 콘텐츠를 포함하는 XML 요소 및 네임스페이스를 지정하는 매개 변수 XmlDictionaryString 를 지정합니다.
public:
DataContractSerializer(Type ^ type, System::Xml::XmlDictionaryString ^ rootName, System::Xml::XmlDictionaryString ^ rootNamespace, System::Collections::Generic::IEnumerable<Type ^> ^ knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, bool preserveObjectReferences, System::Runtime::Serialization::IDataContractSurrogate ^ dataContractSurrogate);
public DataContractSerializer(Type type, System.Xml.XmlDictionaryString rootName, System.Xml.XmlDictionaryString rootNamespace, System.Collections.Generic.IEnumerable<Type> knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, bool preserveObjectReferences, System.Runtime.Serialization.IDataContractSurrogate dataContractSurrogate);
new System.Runtime.Serialization.DataContractSerializer : Type * System.Xml.XmlDictionaryString * System.Xml.XmlDictionaryString * seq<Type> * int * bool * bool * System.Runtime.Serialization.IDataContractSurrogate -> System.Runtime.Serialization.DataContractSerializer
Public Sub New (type As Type, rootName As XmlDictionaryString, rootNamespace As XmlDictionaryString, knownTypes As IEnumerable(Of Type), maxItemsInObjectGraph As Integer, ignoreExtensionDataObject As Boolean, preserveObjectReferences As Boolean, dataContractSurrogate As IDataContractSurrogate)
매개 변수
- type
- Type
직렬화되거나 역직렬화된 인스턴스의 형식입니다.
- rootName
- XmlDictionaryString
XmlDictionaryString 직렬화 또는 역직렬화할 콘텐츠를 묶는 XML 요소를 지정하는 요소입니다.
- rootNamespace
- XmlDictionaryString
XmlDictionaryString 루트의 XML 네임스페이스를 지정하는 형식입니다.
- knownTypes
- IEnumerable<Type>
IEnumerable<T> Type A는 개체 그래프에 있을 수 있는 알려진 형식을 포함합니다.
- maxItemsInObjectGraph
- Int32
직렬화 또는 역직렬화할 그래프의 최대 항목 수입니다.
- ignoreExtensionDataObject
- Boolean
trueserialization 및 deserialization 시 형식의 확장에서 제공하는 데이터를 무시합니다. 그렇지 않으면 . false
- preserveObjectReferences
- Boolean
true비표준 XML 구문을 사용하여 개체 참조 데이터를 유지하려면 그렇지 않으면 . false
- dataContractSurrogate
- IDataContractSurrogate
serialization 프로세스를 사용자 지정하는 구현 IDataContractSurrogate 입니다.
예외
항목 수가 최대값을 초과합니다.
예제
다음 예제에서는 직렬화 또는 역직렬화할 형식, 루트 XML 요소 및 네임스페이스(매개 변수) DataContractSerializer 및 역직렬화 중에 사용되는 형식을 포함하는 인스턴스를 지정하는 인스턴스 XmlDictionaryString 를 만듭니 IEnumerable<T> 다. 또한 코드는 및 매개 변수를 ignoreExtensionDataObject설정하고 preserveObjectReferencestrue 레거시 형식(특성이 적용되지 않은 형식)을 처리하는 인터페이스의 IDataContractSurrogate 구현을 DataContractAttribute 지정합니다. 자세한 내용은 설명서를 참조하세요 IDataContractSurrogate .
public static void Constructor9()
{
// Create a generic List of types and add the known types
// to the collection.
List<Type> knownTypeList = new List<Type>();
knownTypeList.Add(typeof(PurchaseOrder));
knownTypeList.Add(typeof(PurchaseOrderV3));
// Create an XmlDictionary and add values to it.
XmlDictionary d = new XmlDictionary();
XmlDictionaryString name_value = d.Add("Customer");
XmlDictionaryString ns_value = d.Add("http://www.contoso.com");
// Create an instance of a class that
// implements the IDataContractSurrogate interface.
// The implementation code is not shown here.
DCSurrogate mySurrogate = new DCSurrogate();
DataContractSerializer ser =
new DataContractSerializer(
typeof(Person),
name_value,
ns_value,
knownTypeList,
64 * 1024,
true,
true,
mySurrogate);
// Other code not shown.
}
Public Shared Sub Constructor9()
' Create a generic List of types and add the known types
' to the collection.
Dim knownTypeList As New List(Of Type)
knownTypeList.Add(GetType(PurchaseOrder))
knownTypeList.Add(GetType(PurchaseOrderV3))
' Create an XmlDictionary and add values to it.
Dim d As New XmlDictionary()
Dim name_value As XmlDictionaryString = d.Add("Customer")
Dim ns_value As XmlDictionaryString = d.Add("http://www.contoso.com")
' Create an instance of a class that
' implements the IDataContractSurrogate interface.
' The implementation code is not shown here.
Dim mySurrogate As New DCSurrogate()
Dim ser As New DataContractSerializer(GetType(Person), _
name_value, _
ns_value, _
knownTypeList, _
64 * 1064, _
True, _
True, _
mySurrogate)
' Other code not shown.
End Sub
추가 정보
- MaxItemsInObjectGraph
- PreserveObjectReferences
- IgnoreExtensionDataObject
- IExtensibleDataObject
- ExtensionDataObject
- IDataContractSurrogate
적용 대상
DataContractSerializer(Type, String, String, IEnumerable<Type>, Int32, Boolean, Boolean, IDataContractSurrogate)
지정된 형식의 DataContractSerializer 개체를 직렬화하거나 역직렬화하는 클래스의 새 인스턴스를 초기화합니다. 또한 이 메서드는 개체 그래프에 있을 수 있는 알려진 형식의 목록, 직렬화할 최대 그래프 항목 수, 예기치 않은 데이터를 무시할 매개 변수, 비표준 XML 구문을 사용하여 그래프의 개체 참조 데이터를 유지할지 여부, 사용자 지정 serialization의 서로게이트 및 콘텐츠를 포함하는 XML 요소 및 네임스페이스를 지정합니다.
public:
DataContractSerializer(Type ^ type, System::String ^ rootName, System::String ^ rootNamespace, System::Collections::Generic::IEnumerable<Type ^> ^ knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, bool preserveObjectReferences, System::Runtime::Serialization::IDataContractSurrogate ^ dataContractSurrogate);
public DataContractSerializer(Type type, string rootName, string rootNamespace, System.Collections.Generic.IEnumerable<Type> knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, bool preserveObjectReferences, System.Runtime.Serialization.IDataContractSurrogate dataContractSurrogate);
new System.Runtime.Serialization.DataContractSerializer : Type * string * string * seq<Type> * int * bool * bool * System.Runtime.Serialization.IDataContractSurrogate -> System.Runtime.Serialization.DataContractSerializer
Public Sub New (type As Type, rootName As String, rootNamespace As String, knownTypes As IEnumerable(Of Type), maxItemsInObjectGraph As Integer, ignoreExtensionDataObject As Boolean, preserveObjectReferences As Boolean, dataContractSurrogate As IDataContractSurrogate)
매개 변수
- type
- Type
직렬화되거나 역직렬화된 인스턴스의 형식입니다.
- rootName
- String
직렬화 또는 역직렬화할 콘텐츠를 묶는 XML 요소입니다.
- rootNamespace
- String
직렬화 또는 역직렬화할 콘텐츠를 묶는 XML 요소의 네임스페이스입니다.
- knownTypes
- IEnumerable<Type>
IEnumerable<T> 그 중 Type 개체 그래프에 있을 수 있는 알려진 형식을 포함합니다.
- maxItemsInObjectGraph
- Int32
직렬화 또는 역직렬화할 그래프의 최대 항목 수입니다.
- ignoreExtensionDataObject
- Boolean
trueserialization 및 deserialization 시 형식의 확장에서 제공하는 데이터를 무시합니다. 그렇지 않으면 . false
- preserveObjectReferences
- Boolean
true비표준 XML 구문을 사용하여 개체 참조 데이터를 유지하려면 그렇지 않으면 . false
- dataContractSurrogate
- IDataContractSurrogate
serialization 프로세스를 사용자 지정하는 구현 IDataContractSurrogate 입니다.
예외
항목 수가 최대값을 초과합니다.
예제
다음 예제에서는 직렬화 또는 역직렬화할 형식, 루트 XML 요소 및 네임스페이스 및 역직렬화 중에 사용되는 형식을 포함하는 인스턴스를 지정하는 인스턴스 DataContractSerializer 를 만듭니다IEnumerable<T>. 또한 코드는 및 매개 변수를 ignoreExtensionDataObject설정하고 preserveObjectReferencestrue 레거시 형식(특성이 적용되지 않은 형식)을 처리하는 인터페이스의 IDataContractSurrogate 구현을 DataContractAttribute 지정합니다. 자세한 내용은 설명서를 참조하세요 IDataContractSurrogate .
public static void Constructor8()
{
// Create a generic List of types and add the known types
// to the collection.
List<Type> knownTypeList = new List<Type>();
knownTypeList.Add(typeof(PurchaseOrder));
knownTypeList.Add(typeof(PurchaseOrderV3));
// Create an instance of a class that
// implements the IDataContractSurrogate interface.
// The implementation code is not shown here.
DCSurrogate mySurrogate = new DCSurrogate();
DataContractSerializer ser =
new DataContractSerializer(
typeof(Person),
"Customer",
@"http://www.contoso.com",
knownTypeList,
64 * 1024,
true,
true,
mySurrogate);
// Other code not shown.
}
Public Shared Sub Constructor8()
' Create a generic List of types and add the known types
' to the collection.
Dim knownTypeList As New List(Of Type)
knownTypeList.Add(GetType(PurchaseOrder))
knownTypeList.Add(GetType(PurchaseOrderV3))
' Create an instance of a class that
' implements the IDataContractSurrogate interface.
' The implementation code is not shown here.
Dim mySurrogate As New DCSurrogate()
Dim ser As New DataContractSerializer(GetType(Person), _
"Customer", _
"http://www.contoso.com", _
knownTypeList, _
64 * 1064, _
True, _
True, _
mySurrogate)
' Other code not shown.
End Sub
추가 정보
- MaxItemsInObjectGraph
- PreserveObjectReferences
- IgnoreExtensionDataObject
- IExtensibleDataObject
- ExtensionDataObject
- KnownTypeAttribute
- IDataContractSurrogate
적용 대상
DataContractSerializer(Type, IEnumerable<Type>, Int32, Boolean, Boolean, IDataContractSurrogate)
지정된 형식의 DataContractSerializer 개체를 직렬화하거나 역직렬화하는 클래스의 새 인스턴스를 초기화합니다. 또한 이 메서드는 개체 그래프에 있을 수 있는 알려진 형식 목록, 직렬화할 최대 그래프 항목 수, 예기치 않은 데이터를 무시할 매개 변수, 비표준 XML 구문을 사용하여 그래프에 개체 참조 데이터를 유지할지 여부 및 사용자 지정 serialization을 위한 서로게이트를 지정합니다.
public:
DataContractSerializer(Type ^ type, System::Collections::Generic::IEnumerable<Type ^> ^ knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, bool preserveObjectReferences, System::Runtime::Serialization::IDataContractSurrogate ^ dataContractSurrogate);
public DataContractSerializer(Type type, System.Collections.Generic.IEnumerable<Type> knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, bool preserveObjectReferences, System.Runtime.Serialization.IDataContractSurrogate dataContractSurrogate);
new System.Runtime.Serialization.DataContractSerializer : Type * seq<Type> * int * bool * bool * System.Runtime.Serialization.IDataContractSurrogate -> System.Runtime.Serialization.DataContractSerializer
Public Sub New (type As Type, knownTypes As IEnumerable(Of Type), maxItemsInObjectGraph As Integer, ignoreExtensionDataObject As Boolean, preserveObjectReferences As Boolean, dataContractSurrogate As IDataContractSurrogate)
매개 변수
- type
- Type
직렬화되거나 역직렬화된 인스턴스의 형식입니다.
- knownTypes
- IEnumerable<Type>
IEnumerable<T> 그 중 Type 개체 그래프에 있을 수 있는 알려진 형식을 포함합니다.
- maxItemsInObjectGraph
- Int32
직렬화 또는 역직렬화할 그래프의 최대 항목 수입니다. 기본값은 Int32.MaxValue 속성에서 반환되는 값입니다.
- ignoreExtensionDataObject
- Boolean
trueserialization 및 deserialization 시 형식의 확장에서 제공하는 데이터를 무시합니다. 그렇지 않으면 . false
- preserveObjectReferences
- Boolean
true비표준 XML 구문을 사용하여 개체 참조 데이터를 유지하려면 그렇지 않으면 . false
- dataContractSurrogate
- IDataContractSurrogate
serialization 프로세스를 사용자 지정하는 구현 IDataContractSurrogate 입니다.
예외
항목 수가 최대값을 초과합니다.
예제
다음 예제에서는 직렬화 또는 역직렬화할 형식을 지정하는 인스턴스 DataContractSerializer 와 serialization 또는 역직렬화 중에 사용되는 알려진 형식을 포함하는 인스턴스 IEnumerable<T> 를 만듭니다. 또한 코드는 및 매개 변수를 ignoreExtensionDataObject설정하고 preserveObjectReferencestrue 레거시 형식(특성이 적용되지 않은 형식)을 처리하는 인터페이스의 IDataContractSurrogate 구현을 DataContractAttribute 지정합니다. 자세한 내용은 설명서를 참조하세요 IDataContractSurrogate .
public static void Constructor7()
{
// Create a generic List of types and add the known types
// to the collection.
List<Type> knownTypeList = new List<Type>();
knownTypeList.Add(typeof(PurchaseOrder));
knownTypeList.Add(typeof(PurchaseOrderV3));
// Create an instance of a class that
// implements the IDataContractSurrogate interface.
// The implementation code is not shown here.
DCSurrogate mySurrogate = new DCSurrogate();
DataContractSerializer ser =
new DataContractSerializer(
typeof(Person),
knownTypeList,
64 * 1024,
true,
true,
mySurrogate);
// Other code not shown.
}
Public Shared Sub Constructor7()
' Create a generic List of types and add the known types
' to the collection.
Dim knownTypeList As New List(Of Type)
knownTypeList.Add(GetType(PurchaseOrder))
knownTypeList.Add(GetType(PurchaseOrderV3))
' Create an instance of a class that
' implements the IDataContractSurrogate interface.
' The implementation code is not shown here.
Dim mySurrogate As New DCSurrogate()
Dim ser As New DataContractSerializer(GetType(Person), _
knownTypeList, _
64 * 1064, _
True, _
True, _
mySurrogate)
' Other code not shown.
End Sub
추가 정보
- MaxItemsInObjectGraph
- PreserveObjectReferences
- IgnoreExtensionDataObject
- IExtensibleDataObject
- ExtensionDataObject
- KnownTypeAttribute
- IDataContractSurrogate
적용 대상
DataContractSerializer(Type, IEnumerable<Type>, Int32, Boolean, Boolean, IDataContractSurrogate, DataContractResolver)
지정된 형식의 DataContractSerializer 개체를 직렬화하거나 역직렬화하는 클래스의 새 인스턴스를 초기화합니다. 또한 이 메서드는 개체 그래프에 있을 수 있는 알려진 형식 목록, 직렬화할 최대 그래프 항목 수, 예기치 않은 데이터를 무시하는 매개 변수, 비표준 XML 구문을 사용하여 그래프에서 개체 참조 데이터를 유지할지 여부, 사용자 지정 serialization을 위한 서로게이트 및 런타임에 매핑 xsi:type 선언에 대한 대안을 지정합니다.
public:
DataContractSerializer(Type ^ type, System::Collections::Generic::IEnumerable<Type ^> ^ knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, bool preserveObjectReferences, System::Runtime::Serialization::IDataContractSurrogate ^ dataContractSurrogate, System::Runtime::Serialization::DataContractResolver ^ dataContractResolver);
public DataContractSerializer(Type type, System.Collections.Generic.IEnumerable<Type> knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, bool preserveObjectReferences, System.Runtime.Serialization.IDataContractSurrogate dataContractSurrogate, System.Runtime.Serialization.DataContractResolver dataContractResolver);
new System.Runtime.Serialization.DataContractSerializer : Type * seq<Type> * int * bool * bool * System.Runtime.Serialization.IDataContractSurrogate * System.Runtime.Serialization.DataContractResolver -> System.Runtime.Serialization.DataContractSerializer
Public Sub New (type As Type, knownTypes As IEnumerable(Of Type), maxItemsInObjectGraph As Integer, ignoreExtensionDataObject As Boolean, preserveObjectReferences As Boolean, dataContractSurrogate As IDataContractSurrogate, dataContractResolver As DataContractResolver)
매개 변수
- type
- Type
직렬화되거나 역직렬화된 인스턴스의 형식입니다.
- knownTypes
- IEnumerable<Type>
IEnumerable<T> 그 중 Type 개체 그래프에 있을 수 있는 알려진 형식을 포함합니다.
- maxItemsInObjectGraph
- Int32
직렬화 또는 역직렬화할 그래프의 최대 항목 수입니다. 기본값은 Int32.MaxValue 속성에서 반환되는 값입니다.
- ignoreExtensionDataObject
- Boolean
trueserialization 및 deserialization 시 형식의 확장에서 제공하는 데이터를 무시합니다. 그렇지 않으면 . false
- preserveObjectReferences
- Boolean
true비표준 XML 구문을 사용하여 개체 참조 데이터를 유지하려면 그렇지 않으면 . false
- dataContractSurrogate
- IDataContractSurrogate
serialization 프로세스를 사용자 지정하는 구현 IDataContractSurrogate 입니다.
- dataContractResolver
- DataContractResolver
선언을 데이터 계약 형식에 DataContractResolver 매핑 xsi:type 하는 구현입니다.
설명
Warning
이 메서드는 Windows 스토어 앱에서 사용할 수 없습니다.
적용 대상
DataContractSerializer(Type, String, String, IEnumerable<Type>)
- Source:
- DataContractSerializer.cs
- Source:
- DataContractSerializer.cs
- Source:
- DataContractSerializer.cs
- Source:
- DataContractSerializer.cs
- Source:
- DataContractSerializer.cs
지정된 형식의 DataContractSerializer 개체를 직렬화하거나 역직렬화하는 클래스의 새 인스턴스를 초기화합니다. 또한 이 메서드는 두 문자열 매개 변수의 루트 XML 요소와 네임스페이스뿐만 아니라 개체 그래프에 있을 수 있는 알려진 형식 목록을 지정합니다.
public:
DataContractSerializer(Type ^ type, System::String ^ rootName, System::String ^ rootNamespace, System::Collections::Generic::IEnumerable<Type ^> ^ knownTypes);
public DataContractSerializer(Type type, string rootName, string rootNamespace, System.Collections.Generic.IEnumerable<Type> knownTypes);
public DataContractSerializer(Type type, string rootName, string rootNamespace, System.Collections.Generic.IEnumerable<Type>? knownTypes);
new System.Runtime.Serialization.DataContractSerializer : Type * string * string * seq<Type> -> System.Runtime.Serialization.DataContractSerializer
Public Sub New (type As Type, rootName As String, rootNamespace As String, knownTypes As IEnumerable(Of Type))
매개 변수
- type
- Type
직렬화되거나 역직렬화된 인스턴스의 형식입니다.
- rootName
- String
콘텐츠의 루트 요소 이름입니다.
- rootNamespace
- String
루트 요소의 네임스페이스입니다.
- knownTypes
- IEnumerable<Type>
IEnumerable<T> 그 중 Type 개체 그래프에 있을 수 있는 형식이 포함됩니다.
예제
다음 예제에서는 XML 문서에서 읽거나 쓸 XML 이름 및 네임스페이스뿐만 아니라 직렬화 또는 역직렬화할 형식을 지정하는 인스턴스 DataContractSerializer 를 만듭니다. 또한 이 코드는 serialization 또는 역직렬화 중에 사용되는 알려진 형식을 포함하는 인스턴스 IEnumerable<T> 를 만듭니다.
public static void Constructor5()
{
// Create a generic List of types and add the known types
// to the collection.
List<Type> knownTypeList = new List<Type>();
knownTypeList.Add(typeof(PurchaseOrder));
knownTypeList.Add(typeof(PurchaseOrderV3));
DataContractSerializer ser =
new DataContractSerializer(
typeof(Person),
"Customer",
@"http://www.contoso.com",
knownTypeList);
// Other code not shown.
}
Public Shared Sub Constructor5()
' Create a generic List of types and add the known types
' to the collection.
Dim knownTypeList As New List(Of Type)
knownTypeList.Add(GetType(PurchaseOrder))
knownTypeList.Add(GetType(PurchaseOrderV3))
Dim ser As New DataContractSerializer(GetType(Person), _
"Customer", _
"http://www.contoso.com", _
knownTypeList)
' Other code not shown.
End Sub
추가 정보
적용 대상
DataContractSerializer(Type, XmlDictionaryString, XmlDictionaryString)
- Source:
- DataContractSerializer.cs
- Source:
- DataContractSerializer.cs
- Source:
- DataContractSerializer.cs
- Source:
- DataContractSerializer.cs
- Source:
- DataContractSerializer.cs
XML 루트 요소 및 형식의 DataContractSerializer 매개 변수를 통해 지정된 네임스페이스를 사용하여 지정된 형식의 개체를 직렬화하거나 역직렬화하는 클래스의 XmlDictionaryString새 인스턴스를 초기화합니다.
public:
DataContractSerializer(Type ^ type, System::Xml::XmlDictionaryString ^ rootName, System::Xml::XmlDictionaryString ^ rootNamespace);
public DataContractSerializer(Type type, System.Xml.XmlDictionaryString rootName, System.Xml.XmlDictionaryString rootNamespace);
new System.Runtime.Serialization.DataContractSerializer : Type * System.Xml.XmlDictionaryString * System.Xml.XmlDictionaryString -> System.Runtime.Serialization.DataContractSerializer
Public Sub New (type As Type, rootName As XmlDictionaryString, rootNamespace As XmlDictionaryString)
매개 변수
- type
- Type
직렬화되거나 역직렬화된 인스턴스의 형식입니다.
- rootName
- XmlDictionaryString
XmlDictionaryString 콘텐츠의 루트 요소 이름을 포함하는 항목입니다.
- rootNamespace
- XmlDictionaryString
XmlDictionaryString 루트 요소의 네임스페이스를 포함하는 항목입니다.
예제
다음 예제에서는 XML 문서에서 읽거나 쓸 XML 이름 및 네임스페이스(개체)DataContractSerializer뿐만 아니라 직렬화 또는 역직렬화할 형식을 지정하는 인스턴스 XmlDictionaryString 를 만듭니다.
public static void Constructor4()
{
// Create an instance of the DataContractSerializer
// specifying the type, and name and
// namespace as XmlDictionaryString objects.
// Create an XmlDictionary and add values to it.
XmlDictionary d = new XmlDictionary();
XmlDictionaryString name_value = d.Add("Customer");
XmlDictionaryString ns_value = d.Add("http://www.contoso.com");
// Create the serializer.
DataContractSerializer ser =
new DataContractSerializer(
typeof(Person),
name_value,
ns_value);
// Other code not shown.
}
Public Shared Sub Constructor4()
' Create an instance of the DataContractSerializer
' specifying the type, and name and
' namespace as XmlDictionaryString objects.
' Create an XmlDictionary and add values to it.
Dim d As New XmlDictionary()
Dim name_value As XmlDictionaryString = d.Add("Customer")
Dim ns_value As XmlDictionaryString = d.Add("http://www.contoso.com")
' Create the serializer.
Dim ser As New DataContractSerializer(GetType(Person), _
name_value, _
ns_value)
' Other code not shown.
End Sub
적용 대상
DataContractSerializer(Type, String, String)
- Source:
- DataContractSerializer.cs
- Source:
- DataContractSerializer.cs
- Source:
- DataContractSerializer.cs
- Source:
- DataContractSerializer.cs
- Source:
- DataContractSerializer.cs
제공된 XML 루트 요소 및 네임스페이 DataContractSerializer 스를 사용하여 지정된 형식의 개체를 직렬화하거나 역직렬화하는 클래스의 새 인스턴스를 초기화합니다.
public:
DataContractSerializer(Type ^ type, System::String ^ rootName, System::String ^ rootNamespace);
public DataContractSerializer(Type type, string rootName, string rootNamespace);
new System.Runtime.Serialization.DataContractSerializer : Type * string * string -> System.Runtime.Serialization.DataContractSerializer
Public Sub New (type As Type, rootName As String, rootNamespace As String)
매개 변수
- type
- Type
직렬화되거나 역직렬화된 인스턴스의 형식입니다.
- rootName
- String
직렬화 또는 역직렬화할 콘텐츠를 묶는 XML 요소의 이름입니다.
- rootNamespace
- String
직렬화 또는 역직렬화할 콘텐츠를 묶는 XML 요소의 네임스페이스입니다.
예제
다음 예제에서는 XML 문서에서 읽거나 쓸 XML 이름 및 네임스페이스뿐만 아니라 직렬화 또는 역직렬화할 형식을 지정하는 인스턴스 DataContractSerializer 를 만듭니다.
public static void Constructor3()
{
// Create an instance of the DataContractSerializer
// specifying the type, and name and
// namespace as strings.
DataContractSerializer ser =
new DataContractSerializer(
typeof(Person),
"Customer",
"http://www.contoso.com");
// Other code not shown.
}
Public Shared Sub Constructor3()
' Create an instance of the DataContractSerializer
' specifying the type, and name and
' namespace as strings.
Dim ser As New DataContractSerializer(GetType(Person), _
"Customer", _
"http://www.contoso.com")
' Other code not shown.
End Sub
적용 대상
DataContractSerializer(Type, DataContractSerializerSettings)
- Source:
- DataContractSerializer.cs
- Source:
- DataContractSerializer.cs
- Source:
- DataContractSerializer.cs
- Source:
- DataContractSerializer.cs
- Source:
- DataContractSerializer.cs
지정된 형식 및 설정의 DataContractSerializer 개체를 직렬화하거나 역직렬화하는 클래스의 새 인스턴스를 초기화합니다.
public:
DataContractSerializer(Type ^ type, System::Runtime::Serialization::DataContractSerializerSettings ^ settings);
public DataContractSerializer(Type type, System.Runtime.Serialization.DataContractSerializerSettings settings);
public DataContractSerializer(Type type, System.Runtime.Serialization.DataContractSerializerSettings? settings);
new System.Runtime.Serialization.DataContractSerializer : Type * System.Runtime.Serialization.DataContractSerializerSettings -> System.Runtime.Serialization.DataContractSerializer
Public Sub New (type As Type, settings As DataContractSerializerSettings)
매개 변수
- type
- Type
직렬화하거나 역직렬화할 인스턴스의 형식입니다.
- settings
- DataContractSerializerSettings
serializer 설정입니다.
적용 대상
DataContractSerializer(Type, IEnumerable<Type>)
- Source:
- DataContractSerializer.cs
- Source:
- DataContractSerializer.cs
- Source:
- DataContractSerializer.cs
- Source:
- DataContractSerializer.cs
- Source:
- DataContractSerializer.cs
지정된 형식의 DataContractSerializer 개체와 개체 그래프에 있을 수 있는 알려진 형식의 컬렉션을 직렬화하거나 역직렬화하는 클래스의 새 인스턴스를 초기화합니다.
public:
DataContractSerializer(Type ^ type, System::Collections::Generic::IEnumerable<Type ^> ^ knownTypes);
public DataContractSerializer(Type type, System.Collections.Generic.IEnumerable<Type> knownTypes);
public DataContractSerializer(Type type, System.Collections.Generic.IEnumerable<Type>? knownTypes);
new System.Runtime.Serialization.DataContractSerializer : Type * seq<Type> -> System.Runtime.Serialization.DataContractSerializer
Public Sub New (type As Type, knownTypes As IEnumerable(Of Type))
매개 변수
- type
- Type
직렬화되거나 역직렬화된 인스턴스의 형식입니다.
- knownTypes
- IEnumerable<Type>
IEnumerable<T> 그 중 Type 개체 그래프에 있을 수 있는 형식이 포함됩니다.
예제
다음 예제에서는 직렬화 또는 역직렬화할 형식을 지정하는 인스턴스 DataContractSerializer 와 개체 그래프에서 사용할 수 있는 알려진 형식의 컬렉션을 만듭니다.
public static void Constructor2()
{
// Create a generic List of types and add the known types
// to the collection.
List<Type> knownTypeList = new List<Type>();
knownTypeList.Add(typeof(PurchaseOrder));
knownTypeList.Add(typeof(PurchaseOrderV3));
// Create a DatatContractSerializer with the collection.
DataContractSerializer ser2 = new DataContractSerializer(
typeof(Orders), knownTypeList);
// Other code not shown.
}
Public Shared Sub Constructor2()
' Create a generic List of types and add the known types
' to the collection.
Dim knownTypeList As New List(Of Type)
knownTypeList.Add(GetType(PurchaseOrder))
knownTypeList.Add(GetType(PurchaseOrderV3))
' Create a DatatContractSerializer with the collection.
Dim ser2 As New DataContractSerializer(GetType(Orders), knownTypeList)
' Other code not shown.
End Sub
추가 정보
적용 대상
DataContractSerializer(Type, XmlDictionaryString, XmlDictionaryString, IEnumerable<Type>)
- Source:
- DataContractSerializer.cs
- Source:
- DataContractSerializer.cs
- Source:
- DataContractSerializer.cs
- Source:
- DataContractSerializer.cs
- Source:
- DataContractSerializer.cs
지정된 형식의 DataContractSerializer 개체를 직렬화하거나 역직렬화하는 클래스의 새 인스턴스를 초기화합니다. 또한 이 메서드는 두 XmlDictionaryString 매개 변수의 루트 XML 요소와 네임스페이스뿐만 아니라 개체 그래프에 있을 수 있는 알려진 형식 목록을 지정합니다.
public:
DataContractSerializer(Type ^ type, System::Xml::XmlDictionaryString ^ rootName, System::Xml::XmlDictionaryString ^ rootNamespace, System::Collections::Generic::IEnumerable<Type ^> ^ knownTypes);
public DataContractSerializer(Type type, System.Xml.XmlDictionaryString rootName, System.Xml.XmlDictionaryString rootNamespace, System.Collections.Generic.IEnumerable<Type> knownTypes);
public DataContractSerializer(Type type, System.Xml.XmlDictionaryString rootName, System.Xml.XmlDictionaryString rootNamespace, System.Collections.Generic.IEnumerable<Type>? knownTypes);
new System.Runtime.Serialization.DataContractSerializer : Type * System.Xml.XmlDictionaryString * System.Xml.XmlDictionaryString * seq<Type> -> System.Runtime.Serialization.DataContractSerializer
Public Sub New (type As Type, rootName As XmlDictionaryString, rootNamespace As XmlDictionaryString, knownTypes As IEnumerable(Of Type))
매개 변수
- type
- Type
직렬화되거나 역직렬화된 인스턴스의 형식입니다.
- rootName
- XmlDictionaryString
XmlDictionaryString 콘텐츠의 루트 요소 이름을 포함하는 항목입니다.
- rootNamespace
- XmlDictionaryString
XmlDictionaryString 루트 요소의 네임스페이스를 포함하는 항목입니다.
- knownTypes
- IEnumerable<Type>
IEnumerable<T> Type A는 개체 그래프에 있을 수 있는 알려진 형식을 포함합니다.
예제
다음 예제에서는 XML 문서에서 읽거나 쓸 XML 이름 및 네임스페이스(개체)DataContractSerializer뿐만 아니라 직렬화 또는 역직렬화할 형식을 지정하는 인스턴스 XmlDictionaryString 를 만듭니다. 또한 이 코드는 serialization 또는 역직렬화 중에 사용되는 알려진 형식을 포함하는 인스턴스 IEnumerable<T> 를 만듭니다.
public static void Constructor6()
{
// Create a generic List of types and add the known types
// to the collection.
List<Type> knownTypeList = new List<Type>();
knownTypeList.Add(typeof(PurchaseOrder));
knownTypeList.Add(typeof(PurchaseOrderV3));
// Create an XmlDictionary and add values to it.
XmlDictionary d = new XmlDictionary();
XmlDictionaryString name_value = d.Add("Customer");
XmlDictionaryString ns_value = d.Add("http://www.contoso.com");
DataContractSerializer ser =
new DataContractSerializer(
typeof(Person),
name_value,
ns_value,
knownTypeList);
// Other code not shown.
}
Public Shared Sub Constructor6()
' Create a generic List of types and add the known types
' to the collection.
Dim knownTypeList As New List(Of Type)
knownTypeList.Add(GetType(PurchaseOrder))
knownTypeList.Add(GetType(PurchaseOrderV3))
' Create an XmlDictionary and add values to it.
Dim d As New XmlDictionary()
Dim name_value As XmlDictionaryString = d.Add("Customer")
Dim ns_value As XmlDictionaryString = d.Add("http://www.contoso.com")
Dim ser As New DataContractSerializer(GetType(Person), _
name_value, _
ns_value, _
knownTypeList)
' Other code not shown.
End Sub