Udostępnij za pośrednictwem


XmlConvert.ToString Metoda

Definicja

Konwertuje silnie typizowane dane na równoważną String reprezentację.

Przeciążenia

ToString(Single)

Konwertuje element Single na .String

ToString(TimeSpan)

Konwertuje element TimeSpan na .String

ToString(UInt16)

Konwertuje element UInt16 na .String

ToString(UInt32)

Konwertuje element UInt32 na .String

ToString(DateTimeOffset, String)

Konwertuje podany element DateTimeOffset na String określony format.

ToString(DateTime, String)

Konwertuje element DateTime na .String

ToString(DateTime, XmlDateTimeSerializationMode)

Konwertuje element DateTime na String przy użyciu określonego XmlDateTimeSerializationMode .

ToString(SByte)

Konwertuje element SByte na .String

ToString(UInt64)

Konwertuje element UInt64 na .String

ToString(Int64)

Konwertuje element Int64 na .String

ToString(Boolean)

Konwertuje element Boolean na .String

ToString(Int16)

Konwertuje element Int16 na .String

ToString(Guid)

Konwertuje element Guid na .String

ToString(Double)

Konwertuje element Double na .String

ToString(Decimal)

Konwertuje element Decimal na .String

ToString(DateTimeOffset)

Konwertuje podany DateTimeOffset element na .String

ToString(DateTime)
Przestarzałe.
Przestarzałe.

Konwertuje element DateTime na .String

ToString(Char)

Konwertuje element Char na .String

ToString(Byte)

Konwertuje element Byte na .String

ToString(Int32)

Konwertuje element Int32 na .String

ToString(Single)

Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs

Konwertuje element Single na .String

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

Parametry

value
Single

Wartość do konwersji.

Zwraca

Reprezentacja ciągu elementu Single.

Uwagi

Jeśli value parametr Single.PositiveInfinity lub Single.NegativeInfinity, ta metoda zwraca odpowiednio ciąg INF lub -INF.

Zobacz też

Dotyczy

ToString(TimeSpan)

Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs

Konwertuje element TimeSpan na .String

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

Parametry

value
TimeSpan

Wartość do konwersji.

Zwraca

Reprezentacja ciągu elementu TimeSpan.

Dotyczy

ToString(UInt16)

Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs

Ważne

Ten interfejs API nie jest zgodny ze specyfikacją CLS.

Konwertuje element UInt16 na .String

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

Parametry

value
UInt16

Wartość do konwersji.

Zwraca

Reprezentacja ciągu elementu UInt16.

Atrybuty

Dotyczy

ToString(UInt32)

Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs

Ważne

Ten interfejs API nie jest zgodny ze specyfikacją CLS.

Konwertuje element UInt32 na .String

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

Parametry

value
UInt32

Wartość do konwersji.

Zwraca

Reprezentacja ciągu elementu UInt32.

Atrybuty

Dotyczy

ToString(DateTimeOffset, String)

Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs

Konwertuje podany element DateTimeOffset na String określony format.

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

Parametry

value
DateTimeOffset

Element DateTimeOffset do konwersji.

format
String

Format, do którego s jest konwertowany. Parametr formatu może być dowolnym podzbiorem zalecenia W3C dla typu data/godzina XML. (Aby uzyskać więcej informacji, zobacz sekcję dateTime specyfikacji schematu XML).)

Zwraca

Reprezentacja String w określonym formacie podanego DateTimeOffsetelementu .

Przykłady

Poniższy przykład konwertuje reprezentację DateTimeOffset bieżącego czasu na określony String format.

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

Dotyczy

ToString(DateTime, String)

Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs

Konwertuje element DateTime na .String

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

Parametry

value
DateTime

Wartość do konwersji.

format
String

Struktura formatu, która definiuje sposób wyświetlania przekonwertowanego ciągu. Prawidłowe formaty obejmują "rrrr-MM-ddTHH:mm:sszzzzzz" i jego podzestawy.

Zwraca

Reprezentacja ciągu DateTime w określonym formacie.

Przykłady

Poniższy przykład konwertuje typy danych na ciąg, a następnie zapisuje informacje w konsoli programu .

#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

Dotyczy

ToString(DateTime, XmlDateTimeSerializationMode)

Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs

Konwertuje element DateTime na String przy użyciu określonego XmlDateTimeSerializationMode .

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

Parametry

value
DateTime

Wartość DateTime do przekonwertowania.

dateTimeOption
XmlDateTimeSerializationMode

Jedna z wartości określających XmlDateTimeSerializationMode sposób traktowania DateTime wartości.

Zwraca

Odpowiednik String elementu DateTime.

Wyjątki

Wartość jest nieprawidłowa dateTimeOption .

Wartość value lub dateTimeOption to null.

Dotyczy

ToString(SByte)

Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs

Ważne

Ten interfejs API nie jest zgodny ze specyfikacją CLS.

Konwertuje element SByte na .String

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

Parametry

value
SByte

Wartość do konwersji.

Zwraca

Reprezentacja ciągu elementu SByte.

Atrybuty

Dotyczy

ToString(UInt64)

Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs

Ważne

Ten interfejs API nie jest zgodny ze specyfikacją CLS.

Konwertuje element UInt64 na .String

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

Parametry

value
UInt64

Wartość do konwersji.

Zwraca

Reprezentacja ciągu elementu UInt64.

Atrybuty

Dotyczy

ToString(Int64)

Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs

Konwertuje element Int64 na .String

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

Parametry

value
Int64

Wartość do konwersji.

Zwraca

Reprezentacja ciągu elementu Int64.

Dotyczy

ToString(Boolean)

Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs

Konwertuje element Boolean na .String

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

Parametry

value
Boolean

Wartość do konwersji.

Zwraca

Reprezentacja Booleanciągu , czyli "true" lub "false".

Dotyczy

ToString(Int16)

Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs

Konwertuje element Int16 na .String

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

Parametry

value
Int16

Wartość do konwersji.

Zwraca

Reprezentacja ciągu elementu Int16.

Przykłady

Poniższy przykład konwertuje typy danych na ciąg, a następnie zapisuje informacje w konsoli programu .

#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

Dotyczy

ToString(Guid)

Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs

Konwertuje element Guid na .String

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

Parametry

value
Guid

Wartość do konwersji.

Zwraca

Reprezentacja ciągu elementu Guid.

Dotyczy

ToString(Double)

Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs

Konwertuje element Double na .String

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

Parametry

value
Double

Wartość do konwersji.

Zwraca

Reprezentacja ciągu elementu Double.

Przykłady

Poniższy przykład konwertuje typy danych na ciąg, a następnie zapisuje informacje w konsoli programu .

#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

Uwagi

Jeśli value parametr Double.PositiveInfinity lub Double.NegativeInfinity, ta metoda zwraca odpowiednio ciąg INF lub -INF.

Zobacz też

Dotyczy

ToString(Decimal)

Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs

Konwertuje element Decimal na .String

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

Parametry

value
Decimal

Wartość do konwersji.

Zwraca

Reprezentacja ciągu elementu Decimal.

Dotyczy

ToString(DateTimeOffset)

Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs

Konwertuje podany DateTimeOffset element na .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

Parametry

value
DateTimeOffset

Element DateTimeOffset do konwersji.

Zwraca

Reprezentacja String podanego DateTimeOffsetelementu .

Przykłady

Poniższy przykład konwertuje reprezentację DateTimeOffset bieżącego czasu na wartość 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

Dotyczy

ToString(DateTime)

Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs

Przestroga

Use XmlConvert.ToString() that takes in XmlDateTimeSerializationMode

Przestroga

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

Konwertuje element DateTime na .String

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

Parametry

value
DateTime

Wartość do konwersji.

Zwraca

Reprezentacja ciągu DateTime w formacie rrrr-MM-ddTHH:mm:ss, gdzie "T" jest stałym literałem.

Atrybuty

Uwagi

Uwaga

Metoda XmlConvert.ToString(DateTime) jest przestarzała w wersji 2.0 .NET Framework i została zastąpiona XmlConvert.ToString(DateTime, XmlDateTimeSerializationMode) metodą . Sugerowany tryb to RoundtripKind. Jeśli oczekiwano dokładnego dopasowania, użyj XmlConvert.ToString(DateTime, String) ciągu formatu yyyy-MM-ddTHH:mm:ss.fffffffzzzzzz.

Dotyczy

ToString(Char)

Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs

Konwertuje element Char na .String

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

Parametry

value
Char

Wartość do konwersji.

Zwraca

Reprezentacja ciągu elementu Char.

Dotyczy

ToString(Byte)

Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs

Konwertuje element Byte na .String

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

Parametry

value
Byte

Wartość do konwersji.

Zwraca

Reprezentacja ciągu elementu Byte.

Dotyczy

ToString(Int32)

Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs
Źródło:
XmlConvert.cs

Konwertuje element Int32 na .String

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

Parametry

value
Int32

Wartość do konwersji.

Zwraca

Reprezentacja ciągu elementu Int32.

Dotyczy