SoapFieldAttribute Class
Customizes SOAP generation and processing for a field. This class cannot be inherited.
For a list of all members of this type, see SoapFieldAttribute Members.
System.Object
System.Attribute
System.Runtime.Remoting.Metadata.SoapAttribute
System.Runtime.Remoting.Metadata.SoapFieldAttribute
[Visual Basic] <AttributeUsage(AttributeTargets.Field)> NotInheritable Public Class SoapFieldAttribute Inherits SoapAttribute [C#] [AttributeUsage(AttributeTargets.Field)] public sealed class SoapFieldAttribute : SoapAttribute [C++] [AttributeUsage(AttributeTargets::Field)] public __gc __sealed class SoapFieldAttribute : public SoapAttribute [JScript] public AttributeUsage(AttributeTargets.Field) class SoapFieldAttribute extends SoapAttribute
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Remarks
The target objects for the SoapFieldAttribute attribute are object fields. The SoapFieldAttribute attribute is used to specify information that controls how the .NET Framework generates the SOAP XML wire format for target fields.
Example
[Visual Basic, C#, C++] The following code example demonstrates customization of SOAP generated for a field of a class with the SoapFieldAttribute. The SOAP can be produced by the code shown in the SerializableAttribute class example.
[Visual Basic] <Serializable(), SoapTypeAttribute(XmlNamespace := "MyXmlNamespace")> Public Class TestSimpleObject Public member1 As Integer <SoapFieldAttribute(XmlElementName := "MyXmlElement")> Public member2 As String Public member3 As String Public member4 As Double ' A field that is not serialized. <NonSerialized()> Public member5 As String Public Sub New() member1 = 11 member2 = "hello" member3 = "hello" member4 = 3.14159265 member5 = "hello world!" End Sub 'New End Class 'TestSimpleObject [C#] [Serializable()] [SoapTypeAttribute(XmlNamespace="MyXmlNamespace")] public class TestSimpleObject { public int member1; [SoapFieldAttribute(XmlElementName="MyXmlElement")] public string member2; public string member3; public double member4; // A field that is not serialized. [NonSerialized()] public string member5; public TestSimpleObject() { member1 = 11; member2 = "hello"; member3 = "hello"; member4 = 3.14159265; member5 = "hello world!"; } } [C++] [Serializable] [SoapTypeAttribute(XmlNamespace=S"MyXmlNamespace")] public __gc class TestSimpleObject { public: int member1; [SoapFieldAttribute(XmlElementName=S"MyXmlElement")] String* member2; String* member3; double member4; // A field that is not serialized. [NonSerialized] String* member5; public: TestSimpleObject() { member1 = 11; member2 = S"hello"; member3 = S"hello"; member4 = 3.14159265; member5 = S"hello world!"; } };
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Namespace: System.Runtime.Remoting.Metadata
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
Assembly: Mscorlib (in Mscorlib.dll)
See Also
SoapFieldAttribute Members | System.Runtime.Remoting.Metadata Namespace