Export (0) Print
Expand All

XmlConvert.ToString Method (Int32)

Converts the Int32 to a String.

Namespace:  System.Xml
Assembly:  System.Xml (in System.Xml.dll)

public static string ToString(
	int value
)

Parameters

value
Type: System.Int32
The value to convert.

Return Value

Type: System.String
A string representation of the Int32.



//Define the order data.  They will be converted to string 
//before being written out.
Int16 custID = 32632;
String orderID = "367A54";
DateTime orderDate = new DateTime();
orderDate = DateTime.Now;
Double price = 19.95;

StringBuilder output = new StringBuilder();

//Create a writer that outputs to the console.
using (XmlWriter writer = XmlWriter.Create(output))
{
    //Write an element (this one is the root)
    writer.WriteStartElement("order");

    //Write the order date.
    writer.WriteAttributeString("date", XmlConvert.ToString(orderDate, "yyyy-MM-dd"));

    //Write the order time.
    writer.WriteAttributeString("time", XmlConvert.ToString(orderDate, "HH:mm:ss"));

    //Write the order data.
    writer.WriteElementString("orderID", orderID);
    writer.WriteElementString("custID", XmlConvert.ToString(custID));
    writer.WriteElementString("price", XmlConvert.ToString(price));

    //Write the close tag for the root element
    writer.WriteEndElement();

    //Write the XML and close the writer
}

// Display the output to the TextBlock control
OutputTextBlock.Text = output.ToString();


Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2014 Microsoft