MessagePart.Type Property
Gets or sets the XML data type of the MessagePart.
[Visual Basic] Public Property Type As XmlQualifiedName [C#] public XmlQualifiedName Type {get; set;} [C++] public: __property XmlQualifiedName* get_Type(); public: __property void set_Type(XmlQualifiedName*); [JScript] public function get Type() : XmlQualifiedName; public function set Type(XmlQualifiedName);
Property Value
An XmlQualifiedName.
Remarks
This property corresponds to the type attribute of the <part> tag for which the MessagePart class serves as a wrapper. In general, it refers to a data type defined in the XSD schema, but it can also be extended, as long as the XML namespace used is different from that of Web Services Description Language (WSDL).
Example
[Visual Basic, C#, C++] The following example demonstrates a use of the Type property.
[Visual Basic] Dim i As Integer For i = 0 To myMessageCollection.Count - 1 Console.WriteLine("Message : " + myMessageCollection(i).Name) ' Get Message Part Collection. Dim myMessagePartCollection As MessagePartCollection = myMessageCollection(i).Parts ' Display type for each part in Message. Dim k As Integer For k = 0 To myMessagePartCollection.Count - 1 If myMessagePartCollection(k).Type.Name = "" Then Console.WriteLine _ (ControlChars.Tab + " MessagePart does not contain type information") Else Console.WriteLine _ (ControlChars.Tab + " TypeName : " + myMessagePartCollection(k).Type.Name) Console.WriteLine _ (ControlChars.Tab + " Namespace : " + myMessagePartCollection(k).Type.Namespace) End If Next k Console.WriteLine("") Next i [C#] for(int i =0; i < myMessageCollection.Count; ++i) { Console.WriteLine("Message : " + myMessageCollection[i].Name); // Get Message Part Collection. MessagePartCollection myMessagePartCollection = myMessageCollection[i].Parts; // Display type for each part in Message. for(int k = 0; k < myMessagePartCollection.Count;k++) { if(myMessagePartCollection[k].Type.Name == "") { Console.WriteLine("\t MessagePart does not contain type information"); } else { Console.WriteLine("\t TypeName : " + myMessagePartCollection[k].Type.Name); Console.WriteLine("\t Namespace : " + myMessagePartCollection[k].Type.Namespace); } } Console.WriteLine(""); } [C++] for (int i =0; i < myMessageCollection->Count; ++i) { Console::WriteLine(S"Message : {0}", myMessageCollection->Item[i]->Name); // Get Message Part Collection. MessagePartCollection* myMessagePartCollection = myMessageCollection->Item[i]->Parts; // Display type for each part in Message. for (int k = 0; k < myMessagePartCollection->Count; k++) { if (myMessagePartCollection->Item[k]->Type->Name->Equals(S"")) Console::WriteLine(S"\t MessagePart does not contain type information"); else { Console::WriteLine(S"\t TypeName : {0}", myMessagePartCollection->Item[k]->Type->Name); Console::WriteLine(S"\t Namespace : {0}", myMessagePartCollection->Item[k]->Type->Namespace); } } Console::WriteLine(S""); }
[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
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also
MessagePart Class | MessagePart Members | System.Web.Services.Description Namespace