AddressHeader.GetValue Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Deserializes the information item from the current address header object.
GetValue<T>(XmlObjectSerializer) |
Deserializes the information item from the current address header to an object of a specified type that uses a specified formatter to serialize this information. |
GetValue<T>() |
Deserializes the information item from the current address header to an object of a specified type. |
Use the GetValue<T>(XmlObjectSerializer) overload if you want to use a customized XML formatter; otherwise use the GetValue<T>() overload.
- Source:
- AddressHeader.cs
- Source:
- AddressHeader.cs
Deserializes the information item from the current address header to an object of a specified type that uses a specified formatter to serialize this information.
public:
generic <typename T>
T GetValue(System::Runtime::Serialization::XmlObjectSerializer ^ serializer);
public T GetValue<T> (System.Runtime.Serialization.XmlObjectSerializer serializer);
member this.GetValue : System.Runtime.Serialization.XmlObjectSerializer -> 'T
Public Function GetValue(Of T) (serializer As XmlObjectSerializer) As T
Type Parameters
- T
A class of type T
with its fields and properties set to the values supplied by the current address header object.
Parameters
- serializer
- XmlObjectSerializer
The XmlObjectSerializer used to deserialize the information item from the current address header object.
Returns
An instance of a class of type T
with its fields and properties set to the values supplied by the current address header object.
Exceptions
The serializer
is null
.
Examples
The following example shows how to call this method.
Remarks
When using this overload, you must supply a type for the generic parameter T
. The type of the return value is determined by the generic type parameter.
Use this overload only if you want to use a customized XML formatter; otherwise use the GetValue<T>() overload.
Applies to
.NET 8 (package-provided) and other versions
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, 8 (package-provided) |
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
UWP | 10.0 |
- Source:
- AddressHeader.cs
- Source:
- AddressHeader.cs
Deserializes the information item from the current address header to an object of a specified type.
public:
generic <typename T>
T GetValue();
public T GetValue<T> ();
member this.GetValue : unit -> 'T
Public Function GetValue(Of T) () As T
Type Parameters
- T
A class of type T
with its fields and properties set to the values supplied by the current address header object.
Returns
An instance of a class of type T
with its fields and properties set to the values supplied by the current address header object.
Examples
The following example shows how to call this method.
//Create address headers with XmlObjectSerializer specified
XmlObjectSerializer serializer = new DataContractSerializer(typeof(int));
AddressHeader addressHeaderWithObjSer = AddressHeader.CreateAddressHeader("MyServiceName", "http://localhost:8000/service", 1, serializer);
int value = addressHeaderWithObjSer.GetValue<int>();
//Create address headers with XmlObjectSerializer specified
XmlObjectSerializer serializer = new DataContractSerializer(typeof(int));
AddressHeader addressHeaderWithObjSer = AddressHeader.CreateAddressHeader("MyServiceName", "http://localhost:8000/service", 1, serializer);
int value = addressHeaderWithObjSer.GetValue<int>();
'Create address headers with XmlObjectSerializer specified
Dim serializer As XmlObjectSerializer = New DataContractSerializer(GetType(Integer))
Dim addressHeaderWithObjSer As AddressHeader = AddressHeader.CreateAddressHeader("MyServiceName", "http://localhost:8000/service", 1, serializer)
Dim value As Integer = addressHeaderWithObjSer.GetValue(Of Integer)()
'Create address headers with XmlObjectSerializer specified
Dim serializer As XmlObjectSerializer = New DataContractSerializer(GetType(Integer))
Dim addressHeaderWithObjSer As AddressHeader = AddressHeader.CreateAddressHeader("MyServiceName", "http://localhost:8000/service", 1, serializer)
Dim value As Integer = addressHeaderWithObjSer.GetValue(Of Integer)()
Remarks
When using this overload, you must supply a type for the generic parameter T
. The type of the return value is determined by the generic type parameter.
Use the GetValue<T>(XmlObjectSerializer) overload if you want to use a customized XML formatter.
Applies to
.NET 8 (package-provided) and other versions
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, 8 (package-provided) |
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
UWP | 10.0 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: