Compartir vía


XmlConvert.ToString Método

Definición

Convierte los datos fuertemente tipados en la representación de un String equivalente.

Sobrecargas

ToString(Single)

Convierte la clase Single en una clase String.

ToString(TimeSpan)

Convierte la clase TimeSpan en una clase String.

ToString(UInt16)

Convierte la clase UInt16 en una clase String.

ToString(UInt32)

Convierte la clase UInt32 en una clase String.

ToString(DateTimeOffset, String)

Convierte el DateTimeOffset proporcionado en una String con el formato especificado.

ToString(DateTime, String)

Convierte la clase DateTime en una clase String.

ToString(DateTime, XmlDateTimeSerializationMode)

Convierte DateTime en String mediante el XmlDateTimeSerializationMode especificado.

ToString(SByte)

Convierte la clase SByte en una clase String.

ToString(UInt64)

Convierte la clase UInt64 en una clase String.

ToString(Int64)

Convierte la clase Int64 en una clase String.

ToString(Boolean)

Convierte la clase Boolean en una clase String.

ToString(Int16)

Convierte la clase Int16 en una clase String.

ToString(Guid)

Convierte la clase Guid en una clase String.

ToString(Double)

Convierte la clase Double en una clase String.

ToString(Decimal)

Convierte la clase Decimal en una clase String.

ToString(DateTimeOffset)

Convierte el DateTimeOffset proporcionado en una String.

ToString(DateTime)
Obsoletos.
Obsoletos.

Convierte la clase DateTime en una clase String.

ToString(Char)

Convierte la clase Char en una clase String.

ToString(Byte)

Convierte la clase Byte en una clase String.

ToString(Int32)

Convierte la clase Int32 en una clase String.

ToString(Single)

Source:
XmlConvert.cs
Source:
XmlConvert.cs
Source:
XmlConvert.cs

Convierte la clase Single en una clase 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

Parámetros

value
Single

Valor que se va a convertir.

Devoluciones

Representación de cadena de Single.

Comentarios

Si value es Single.PositiveInfinity o Single.NegativeInfinity, este método devuelve la cadena INF o -INF respectivamente.

Consulte también

Se aplica a

ToString(TimeSpan)

Source:
XmlConvert.cs
Source:
XmlConvert.cs
Source:
XmlConvert.cs

Convierte la clase TimeSpan en una clase 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

Parámetros

value
TimeSpan

Valor que se va a convertir.

Devoluciones

Representación de cadena de TimeSpan.

Se aplica a

ToString(UInt16)

Source:
XmlConvert.cs
Source:
XmlConvert.cs
Source:
XmlConvert.cs

Importante

Esta API no es conforme a CLS.

Convierte la clase UInt16 en una clase 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

Parámetros

value
UInt16

Valor que se va a convertir.

Devoluciones

Representación de cadena de UInt16.

Atributos

Se aplica a

ToString(UInt32)

Source:
XmlConvert.cs
Source:
XmlConvert.cs
Source:
XmlConvert.cs

Importante

Esta API no es conforme a CLS.

Convierte la clase UInt32 en una clase 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

Parámetros

value
UInt32

Valor que se va a convertir.

Devoluciones

Representación de cadena de UInt32.

Atributos

Se aplica a

ToString(DateTimeOffset, String)

Source:
XmlConvert.cs
Source:
XmlConvert.cs
Source:
XmlConvert.cs

Convierte el DateTimeOffset proporcionado en una String con el formato especificado.

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

Parámetros

value
DateTimeOffset

DateTimeOffset que va a convertirse.

format
String

Formato al que se convierte s. El parámetro de formato puede ser cualquier subconjunto de la recomendación del Consorcio W3C relativa al tipo XML dateTime. Para obtener más información, consulte la sección dateTime de la especificación del esquema XML.

Devoluciones

Representación String con el formato especificado del DateTimeOffset proporcionado.

Ejemplos

En el ejemplo siguiente se convierte una DateTimeOffset representación de la hora actual en un String en el formato especificado.

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

Se aplica a

ToString(DateTime, String)

Source:
XmlConvert.cs
Source:
XmlConvert.cs
Source:
XmlConvert.cs

Convierte la clase DateTime en una clase 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

Parámetros

value
DateTime

Valor que se va a convertir.

format
String

Estructura de formato que define cómo se muestra la cadena convertida. Entre los formatos válidos se incluyen "yyyy-MM-ddTHH:mm:sszzzzzz" y sus subconjuntos.

Devoluciones

Representación de cadena de DateTime en el formato especificado.

Ejemplos

En el ejemplo siguiente, se convierten los tipos de datos en una cadena y, a continuación, se escribe la información en la consola.

#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

Se aplica a

ToString(DateTime, XmlDateTimeSerializationMode)

Source:
XmlConvert.cs
Source:
XmlConvert.cs
Source:
XmlConvert.cs

Convierte DateTime en String mediante el XmlDateTimeSerializationMode especificado.

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

Parámetros

value
DateTime

Valor DateTime que se va a convertir.

dateTimeOption
XmlDateTimeSerializationMode

Uno de los valores de XmlDateTimeSerializationMode que especifica cómo tratar el valor DateTime.

Devoluciones

String equivalente de la DateTime.

Excepciones

El valor dateTimeOption no es válido.

El valor de value o dateTimeOption es null.

Se aplica a

ToString(SByte)

Source:
XmlConvert.cs
Source:
XmlConvert.cs
Source:
XmlConvert.cs

Importante

Esta API no es conforme a CLS.

Convierte la clase SByte en una clase 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

Parámetros

value
SByte

Valor que se va a convertir.

Devoluciones

Representación de cadena de SByte.

Atributos

Se aplica a

ToString(UInt64)

Source:
XmlConvert.cs
Source:
XmlConvert.cs
Source:
XmlConvert.cs

Importante

Esta API no es conforme a CLS.

Convierte la clase UInt64 en una clase 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

Parámetros

value
UInt64

Valor que se va a convertir.

Devoluciones

Representación de cadena de UInt64.

Atributos

Se aplica a

ToString(Int64)

Source:
XmlConvert.cs
Source:
XmlConvert.cs
Source:
XmlConvert.cs

Convierte la clase Int64 en una clase 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

Parámetros

value
Int64

Valor que se va a convertir.

Devoluciones

Representación de cadena de Int64.

Se aplica a

ToString(Boolean)

Source:
XmlConvert.cs
Source:
XmlConvert.cs
Source:
XmlConvert.cs

Convierte la clase Boolean en una clase 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

Parámetros

value
Boolean

Valor que se va a convertir.

Devoluciones

Representación de cadena de Boolean; es decir, "true" o "false".

Se aplica a

ToString(Int16)

Source:
XmlConvert.cs
Source:
XmlConvert.cs
Source:
XmlConvert.cs

Convierte la clase Int16 en una clase 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

Parámetros

value
Int16

Valor que se va a convertir.

Devoluciones

Representación de cadena de Int16.

Ejemplos

En el ejemplo siguiente, se convierten los tipos de datos en una cadena y, a continuación, se escribe la información en la consola.

#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

Se aplica a

ToString(Guid)

Source:
XmlConvert.cs
Source:
XmlConvert.cs
Source:
XmlConvert.cs

Convierte la clase Guid en una clase 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

Parámetros

value
Guid

Valor que se va a convertir.

Devoluciones

Representación de cadena de Guid.

Se aplica a

ToString(Double)

Source:
XmlConvert.cs
Source:
XmlConvert.cs
Source:
XmlConvert.cs

Convierte la clase Double en una clase 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

Parámetros

value
Double

Valor que se va a convertir.

Devoluciones

Representación de cadena de Double.

Ejemplos

En el ejemplo siguiente, se convierten los tipos de datos en una cadena y, a continuación, se escribe la información en la consola.

#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

Comentarios

Si value es Double.PositiveInfinity o Double.NegativeInfinity, este método devuelve la cadena INF o -INF respectivamente.

Consulte también

Se aplica a

ToString(Decimal)

Source:
XmlConvert.cs
Source:
XmlConvert.cs
Source:
XmlConvert.cs

Convierte la clase Decimal en una clase 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

Parámetros

value
Decimal

Valor que se va a convertir.

Devoluciones

Representación de cadena de Decimal.

Se aplica a

ToString(DateTimeOffset)

Source:
XmlConvert.cs
Source:
XmlConvert.cs
Source:
XmlConvert.cs

Convierte el DateTimeOffset proporcionado en una 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

Parámetros

value
DateTimeOffset

DateTimeOffset que va a convertirse.

Devoluciones

Representación de tipo String del DateTimeOffset proporcionado.

Ejemplos

En el ejemplo siguiente se convierte una DateTimeOffset representación de la hora actual en .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

Se aplica a

ToString(DateTime)

Source:
XmlConvert.cs
Source:
XmlConvert.cs
Source:
XmlConvert.cs

Precaución

Use XmlConvert.ToString() that takes in XmlDateTimeSerializationMode

Precaución

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

Convierte la clase DateTime en una clase 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

Parámetros

value
DateTime

Valor que se va a convertir.

Devoluciones

Representación de cadena de DateTime con el formato yyyy-MM-ddTHH:mm:ss donde "T" es una constante literal.

Atributos

Comentarios

Nota

El XmlConvert.ToString(DateTime) método está obsoleto en la versión 2.0 de .NET Framework y se ha reemplazado por el XmlConvert.ToString(DateTime, XmlDateTimeSerializationMode) método . El modo sugerido es RoundtripKind. Si se espera una coincidencia exacta, use XmlConvert.ToString(DateTime, String) con la cadena yyyy-MM-ddTHH:mm:ss.fffffffzzzzzzde formato .

Se aplica a

ToString(Char)

Source:
XmlConvert.cs
Source:
XmlConvert.cs
Source:
XmlConvert.cs

Convierte la clase Char en una clase 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

Parámetros

value
Char

Valor que se va a convertir.

Devoluciones

Representación de cadena de Char.

Se aplica a

ToString(Byte)

Source:
XmlConvert.cs
Source:
XmlConvert.cs
Source:
XmlConvert.cs

Convierte la clase Byte en una clase 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

Parámetros

value
Byte

Valor que se va a convertir.

Devoluciones

Representación de cadena de Byte.

Se aplica a

ToString(Int32)

Source:
XmlConvert.cs
Source:
XmlConvert.cs
Source:
XmlConvert.cs

Convierte la clase Int32 en una clase 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

Parámetros

value
Int32

Valor que se va a convertir.

Devoluciones

Representación de cadena de Int32.

Se aplica a