Bagikan melalui


XmlConvert.ToString Metode

Definisi

Mengonversi data yang ditik dengan kuat menjadi representasi yang setara String .

Overload

ToString(Single)

Mengonversi ke SingleString.

ToString(TimeSpan)

Mengonversi ke TimeSpanString.

ToString(UInt16)

Mengonversi ke UInt16String.

ToString(UInt32)

Mengonversi ke UInt32String.

ToString(DateTimeOffset, String)

Mengonversi yang disediakan DateTimeOffset ke String dalam format yang ditentukan.

ToString(DateTime, String)

Mengonversi ke DateTimeString.

ToString(DateTime, XmlDateTimeSerializationMode)

Mengonversi ke DateTimeString menggunakan yang XmlDateTimeSerializationMode ditentukan.

ToString(SByte)

Mengonversi ke SByteString.

ToString(UInt64)

Mengonversi ke UInt64String.

ToString(Int64)

Mengonversi ke Int64String.

ToString(Boolean)

Mengonversi ke BooleanString.

ToString(Int16)

Mengonversi ke Int16String.

ToString(Guid)

Mengonversi ke GuidString.

ToString(Double)

Mengonversi ke DoubleString.

ToString(Decimal)

Mengonversi ke DecimalString.

ToString(DateTimeOffset)

Mengonversi yang disediakan DateTimeOffset menjadi String.

ToString(DateTime)
Kedaluwarsa.
Kedaluwarsa.

Mengonversi ke DateTimeString.

ToString(Char)

Mengonversi ke CharString.

ToString(Byte)

Mengonversi ke ByteString.

ToString(Int32)

Mengonversi ke Int32String.

ToString(Single)

Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs

Mengonversi ke SingleString.

public:
 static System::String ^ ToString(float value);
public static string ToString (float value);
static member ToString : single -> string
Public Shared Function ToString (value As Single) As String

Parameter

value
Single

Nilai yang akan dikonversi.

Mengembalikan

Representasi string dari Single.

Keterangan

Jika value adalah Single.PositiveInfinity atau Single.NegativeInfinity, metode ini mengembalikan string INF atau -INF masing-masing.

Lihat juga

Berlaku untuk

ToString(TimeSpan)

Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs

Mengonversi ke TimeSpanString.

public:
 static System::String ^ ToString(TimeSpan value);
public static string ToString (TimeSpan value);
static member ToString : TimeSpan -> string
Public Shared Function ToString (value As TimeSpan) As String

Parameter

value
TimeSpan

Nilai yang akan dikonversi.

Mengembalikan

Representasi string dari TimeSpan.

Berlaku untuk

ToString(UInt16)

Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs

Penting

API ini bukan kompatibel CLS.

Mengonversi ke UInt16String.

public:
 static System::String ^ ToString(System::UInt16 value);
[System.CLSCompliant(false)]
public static string ToString (ushort value);
[<System.CLSCompliant(false)>]
static member ToString : uint16 -> string
Public Shared Function ToString (value As UShort) As String

Parameter

value
UInt16

Nilai yang akan dikonversi.

Mengembalikan

Representasi string dari UInt16.

Atribut

Berlaku untuk

ToString(UInt32)

Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs

Penting

API ini bukan kompatibel CLS.

Mengonversi ke UInt32String.

public:
 static System::String ^ ToString(System::UInt32 value);
[System.CLSCompliant(false)]
public static string ToString (uint value);
[<System.CLSCompliant(false)>]
static member ToString : uint32 -> string
Public Shared Function ToString (value As UInteger) As String

Parameter

value
UInt32

Nilai yang akan dikonversi.

Mengembalikan

Representasi string dari UInt32.

Atribut

Berlaku untuk

ToString(DateTimeOffset, String)

Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs

Mengonversi yang disediakan DateTimeOffset ke String dalam format yang ditentukan.

public:
 static System::String ^ ToString(DateTimeOffset value, System::String ^ format);
public static string ToString (DateTimeOffset value, string format);
static member ToString : DateTimeOffset * string -> string
Public Shared Function ToString (value As DateTimeOffset, format As String) As String

Parameter

value
DateTimeOffset

yang DateTimeOffset akan dikonversi.

format
String

Format yang s dikonversi. Parameter format dapat menjadi subset apa pun dari Rekomendasi W3C untuk jenis DateTime XML. (Untuk informasi selengkapnya, lihat bagian dateTime dari spesifikasi Skema XML..)

Mengembalikan

Representasi String dalam format yang ditentukan dari yang disediakan DateTimeOffset.

Contoh

Contoh berikut mengonversi DateTimeOffset representasi waktu saat ini menjadi String dalam format yang ditentukan.

using System;
using System.Xml;

class Example
{
    static void Main()
    {
        // Create the DateTimeOffset object and set the time to the current time.
        DateTimeOffset dto;
        dto = DateTimeOffset.Now;

        // Convert the DateTimeObject to a string in a specified format and display the result.
        // The specified format must be a subset of the W3C Recommendation for the XML dateTime type.
        String timeAsString = XmlConvert.ToString(dto, "yyyy-MM-ddTHH:mm:sszzzzzzz");
        Console.WriteLine(timeAsString);
    }
}
Imports System.Xml

Module Module1
    Sub Main()

        ' Create the DateTimeOffset object and set the time to the current time.
        Dim dto As DateTimeOffset
        dto = DateTimeOffset.Now

        ' Convert the DateTimeObject to a string in a specified format and display the result.
        ' The specified format must be a subset of the W3C Recommendation for the XML dateTime type.
        Dim timeAsString As [String] = XmlConvert.ToString(dto, "yyyy-MM-ddTHH:mm:sszzzzzzz")
        Console.WriteLine(timeAsString)

    End Sub
End Module

Berlaku untuk

ToString(DateTime, String)

Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs

Mengonversi ke DateTimeString.

public:
 static System::String ^ ToString(DateTime value, System::String ^ format);
public static string ToString (DateTime value, string format);
static member ToString : DateTime * string -> string
Public Shared Function ToString (value As DateTime, format As String) As String

Parameter

value
DateTime

Nilai yang akan dikonversi.

format
String

Struktur format yang menentukan cara menampilkan string yang dikonversi. Format yang valid termasuk "yyyy-MM-ddTHH:mm:sszzzzzz" dan subsetnya.

Mengembalikan

Representasi string dari DateTime dalam format yang ditentukan.

Contoh

Contoh berikut, mengonversi jenis data menjadi string lalu menulis informasi ke konsol.

#using <System.Xml.dll>

using namespace System;
using namespace System::IO;
using namespace System::Xml;
int main()
{
   
   //Define the order data.  They will be converted to string 
   //before being written out.
   Int16 custID = 32632;
   String^ orderID = "367A54";
   DateTime orderDate = DateTime::Now;
   Double price = 19.95;
   
   //Create a writer that outputs to the console.
   XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out );
   writer->Formatting = Formatting::Indented;
   
   //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
   writer->Close();
}
using System;
using System.IO;
using System.Xml;

public class Sample
{
  public static void Main()
  {

    //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;

    //Create a writer that outputs to the console.
    XmlTextWriter writer = new XmlTextWriter (Console.Out);
    writer.Formatting = Formatting.Indented;

    //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
    writer.Close();
  }
}
Imports System.IO
Imports System.Xml

public class Sample

  public shared sub Main()

    'Define the order data.  They will be converted to string
    'before being written out.
    Dim custID as Int16 = 32632
    Dim orderID as String = "367A54"
    Dim orderDate as DateTime 
    orderDate = DateTime.Now
    Dim price as Double = 19.95

    'Create a writer that outputs to the console.
    Dim writer as XmlTextWriter = new XmlTextWriter (Console.Out)
    'Use indenting for readability
    writer.Formatting = Formatting.Indented
    
    '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
    writer.Flush()
    writer.Close()  

  end sub
end class

Berlaku untuk

ToString(DateTime, XmlDateTimeSerializationMode)

Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs

Mengonversi ke DateTimeString menggunakan yang XmlDateTimeSerializationMode ditentukan.

public:
 static System::String ^ ToString(DateTime value, System::Xml::XmlDateTimeSerializationMode dateTimeOption);
public static string ToString (DateTime value, System.Xml.XmlDateTimeSerializationMode dateTimeOption);
static member ToString : DateTime * System.Xml.XmlDateTimeSerializationMode -> string
Public Shared Function ToString (value As DateTime, dateTimeOption As XmlDateTimeSerializationMode) As String

Parameter

value
DateTime

Nilai yang DateTime akan dikonversi.

dateTimeOption
XmlDateTimeSerializationMode

Salah XmlDateTimeSerializationMode satu nilai yang menentukan cara memperlakukan DateTime nilai.

Mengembalikan

Setara String dengan DateTime.

Pengecualian

Nilai dateTimeOption tidak valid.

Nilai value atau dateTimeOption adalah null.

Berlaku untuk

ToString(SByte)

Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs

Penting

API ini bukan kompatibel CLS.

Mengonversi ke SByteString.

public:
 static System::String ^ ToString(System::SByte value);
[System.CLSCompliant(false)]
public static string ToString (sbyte value);
[<System.CLSCompliant(false)>]
static member ToString : sbyte -> string
Public Shared Function ToString (value As SByte) As String

Parameter

value
SByte

Nilai yang akan dikonversi.

Mengembalikan

Representasi string dari SByte.

Atribut

Berlaku untuk

ToString(UInt64)

Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs

Penting

API ini bukan kompatibel CLS.

Mengonversi ke UInt64String.

public:
 static System::String ^ ToString(System::UInt64 value);
[System.CLSCompliant(false)]
public static string ToString (ulong value);
[<System.CLSCompliant(false)>]
static member ToString : uint64 -> string
Public Shared Function ToString (value As ULong) As String

Parameter

value
UInt64

Nilai yang akan dikonversi.

Mengembalikan

Representasi string dari UInt64.

Atribut

Berlaku untuk

ToString(Int64)

Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs

Mengonversi ke Int64String.

public:
 static System::String ^ ToString(long value);
public static string ToString (long value);
static member ToString : int64 -> string
Public Shared Function ToString (value As Long) As String

Parameter

value
Int64

Nilai yang akan dikonversi.

Mengembalikan

Representasi string dari Int64.

Berlaku untuk

ToString(Boolean)

Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs

Mengonversi ke BooleanString.

public:
 static System::String ^ ToString(bool value);
public static string ToString (bool value);
static member ToString : bool -> string
Public Shared Function ToString (value As Boolean) As String

Parameter

value
Boolean

Nilai yang akan dikonversi.

Mengembalikan

Representasi string dari Boolean, yaitu, "true" atau "false".

Berlaku untuk

ToString(Int16)

Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs

Mengonversi ke Int16String.

public:
 static System::String ^ ToString(short value);
public static string ToString (short value);
static member ToString : int16 -> string
Public Shared Function ToString (value As Short) As String

Parameter

value
Int16

Nilai yang akan dikonversi.

Mengembalikan

Representasi string dari Int16.

Contoh

Contoh berikut, mengonversi jenis data menjadi string lalu menulis informasi ke konsol.

#using <System.Xml.dll>

using namespace System;
using namespace System::IO;
using namespace System::Xml;
int main()
{
   
   //Define the order data.  They will be converted to string 
   //before being written out.
   Int16 custID = 32632;
   String^ orderID = "367A54";
   DateTime orderDate = DateTime::Now;
   Double price = 19.95;
   
   //Create a writer that outputs to the console.
   XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out );
   writer->Formatting = Formatting::Indented;
   
   //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
   writer->Close();
}
using System;
using System.IO;
using System.Xml;

public class Sample
{
  public static void Main()
  {

    //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;

    //Create a writer that outputs to the console.
    XmlTextWriter writer = new XmlTextWriter (Console.Out);
    writer.Formatting = Formatting.Indented;

    //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
    writer.Close();
  }
}
Imports System.IO
Imports System.Xml

public class Sample

  public shared sub Main()

    'Define the order data.  They will be converted to string
    'before being written out.
    Dim custID as Int16 = 32632
    Dim orderID as String = "367A54"
    Dim orderDate as DateTime 
    orderDate = DateTime.Now
    Dim price as Double = 19.95

    'Create a writer that outputs to the console.
    Dim writer as XmlTextWriter = new XmlTextWriter (Console.Out)
    'Use indenting for readability
    writer.Formatting = Formatting.Indented
    
    '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
    writer.Flush()
    writer.Close()  

  end sub
end class

Berlaku untuk

ToString(Guid)

Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs

Mengonversi ke GuidString.

public:
 static System::String ^ ToString(Guid value);
public static string ToString (Guid value);
static member ToString : Guid -> string
Public Shared Function ToString (value As Guid) As String

Parameter

value
Guid

Nilai yang akan dikonversi.

Mengembalikan

Representasi string dari Guid.

Berlaku untuk

ToString(Double)

Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs

Mengonversi menjadi DoubleString.

public:
 static System::String ^ ToString(double value);
public static string ToString (double value);
static member ToString : double -> string
Public Shared Function ToString (value As Double) As String

Parameter

value
Double

Nilai yang akan dikonversi.

Mengembalikan

Representasi string dari Double.

Contoh

Contoh berikut, mengonversi jenis data menjadi string lalu menulis informasi ke konsol.

#using <System.Xml.dll>

using namespace System;
using namespace System::IO;
using namespace System::Xml;
int main()
{
   
   //Define the order data.  They will be converted to string 
   //before being written out.
   Int16 custID = 32632;
   String^ orderID = "367A54";
   DateTime orderDate = DateTime::Now;
   Double price = 19.95;
   
   //Create a writer that outputs to the console.
   XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out );
   writer->Formatting = Formatting::Indented;
   
   //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
   writer->Close();
}
using System;
using System.IO;
using System.Xml;

public class Sample
{
  public static void Main()
  {

    //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;

    //Create a writer that outputs to the console.
    XmlTextWriter writer = new XmlTextWriter (Console.Out);
    writer.Formatting = Formatting.Indented;

    //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
    writer.Close();
  }
}
Imports System.IO
Imports System.Xml

public class Sample

  public shared sub Main()

    'Define the order data.  They will be converted to string
    'before being written out.
    Dim custID as Int16 = 32632
    Dim orderID as String = "367A54"
    Dim orderDate as DateTime 
    orderDate = DateTime.Now
    Dim price as Double = 19.95

    'Create a writer that outputs to the console.
    Dim writer as XmlTextWriter = new XmlTextWriter (Console.Out)
    'Use indenting for readability
    writer.Formatting = Formatting.Indented
    
    '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
    writer.Flush()
    writer.Close()  

  end sub
end class

Keterangan

Jika value Double.PositiveInfinity atau Double.NegativeInfinity, metode ini mengembalikan string INF atau -INF masing-masing.

Lihat juga

Berlaku untuk

ToString(Decimal)

Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs

Mengonversi menjadi DecimalString.

public:
 static System::String ^ ToString(System::Decimal value);
public static string ToString (decimal value);
static member ToString : decimal -> string
Public Shared Function ToString (value As Decimal) As String

Parameter

value
Decimal

Nilai yang akan dikonversi.

Mengembalikan

Representasi string dari Decimal.

Berlaku untuk

ToString(DateTimeOffset)

Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs

Mengonversi yang disediakan DateTimeOffset menjadi String.

public:
 static System::String ^ ToString(DateTimeOffset value);
public static string ToString (DateTimeOffset value);
static member ToString : DateTimeOffset -> string
Public Shared Function ToString (value As DateTimeOffset) As String

Parameter

value
DateTimeOffset

yang DateTimeOffset akan dikonversi.

Mengembalikan

Representasi String dari yang disediakan DateTimeOffset.

Contoh

Contoh berikut mengonversi DateTimeOffset representasi waktu saat ini menjadi String.

using System;
using System.Xml;

class Example
{
    static void Main()
    {
        // Create the DateTimeOffset object and set the time to the current time
        DateTimeOffset dto;
        dto = DateTimeOffset.Now;

        // Convert the DateTimeOffset object to a string and display the result
        string timeAsString = XmlConvert.ToString(dto);
        Console.WriteLine(timeAsString);
    }
}
Imports System.Xml

Module Module1
    Sub Main()

        ' Create the DateTimeOffset object and set the time to the current time
        Dim dto As DateTimeOffset
        dto = DateTimeOffset.Now

        ' Convert the DateTimeOffset object to a string and display the result
        Dim timeAsString As String = XmlConvert.ToString(dto)
        Console.WriteLine(timeAsString)

    End Sub
End Module

Berlaku untuk

ToString(DateTime)

Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs

Perhatian

Use XmlConvert.ToString() that takes in XmlDateTimeSerializationMode

Perhatian

Use XmlConvert.ToString() that accepts an XmlDateTimeSerializationMode instead.

Mengonversi menjadi DateTimeString.

public:
 static System::String ^ ToString(DateTime value);
[System.Obsolete("Use XmlConvert.ToString() that takes in XmlDateTimeSerializationMode")]
public static string ToString (DateTime value);
[System.Obsolete("Use XmlConvert.ToString() that accepts an XmlDateTimeSerializationMode instead.")]
public static string ToString (DateTime value);
public static string ToString (DateTime value);
[<System.Obsolete("Use XmlConvert.ToString() that takes in XmlDateTimeSerializationMode")>]
static member ToString : DateTime -> string
[<System.Obsolete("Use XmlConvert.ToString() that accepts an XmlDateTimeSerializationMode instead.")>]
static member ToString : DateTime -> string
static member ToString : DateTime -> string
Public Shared Function ToString (value As DateTime) As String

Parameter

value
DateTime

Nilai yang akan dikonversi.

Mengembalikan

Representasi DateTime string dari dalam format yyyy-MM-ddTHH:mm:ss di mana 'T' adalah literal konstanta.

Atribut

Keterangan

Catatan

Metode XmlConvert.ToString(DateTime) ini usang dalam versi 2.0 dari .NET Framework dan telah diganti dengan XmlConvert.ToString(DateTime, XmlDateTimeSerializationMode) metode . Mode yang disarankan adalah RoundtripKind. Jika kecocokan persis diharapkan, silakan gunakan XmlConvert.ToString(DateTime, String) dengan string yyyy-MM-ddTHH:mm:ss.fffffffzzzzzzformat .

Berlaku untuk

ToString(Char)

Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs

Mengonversi menjadi CharString.

public:
 static System::String ^ ToString(char value);
public static string ToString (char value);
static member ToString : char -> string
Public Shared Function ToString (value As Char) As String

Parameter

value
Char

Nilai yang akan dikonversi.

Mengembalikan

Representasi string dari Char.

Berlaku untuk

ToString(Byte)

Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs

Mengonversi menjadi ByteString.

public:
 static System::String ^ ToString(System::Byte value);
public static string ToString (byte value);
static member ToString : byte -> string
Public Shared Function ToString (value As Byte) As String

Parameter

value
Byte

Nilai yang akan dikonversi.

Mengembalikan

Representasi string dari Byte.

Berlaku untuk

ToString(Int32)

Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs
Sumber:
XmlConvert.cs

Mengonversi menjadi Int32String.

public:
 static System::String ^ ToString(int value);
public static string ToString (int value);
static member ToString : int -> string
Public Shared Function ToString (value As Integer) As String

Parameter

value
Int32

Nilai yang akan dikonversi.

Mengembalikan

Representasi string dari Int32.

Berlaku untuk