Partager via


XmlConvert.ToString Méthode

Définition

Convertit des données fortement typées en une représentation String équivalente.

Surcharges

ToString(Single)

Convertit le Single en String.

ToString(TimeSpan)

Convertit le TimeSpan en String.

ToString(UInt16)

Convertit le UInt16 en String.

ToString(UInt32)

Convertit le UInt32 en String.

ToString(DateTimeOffset, String)

Convertit l'élément DateTimeOffset fourni en une chaîne String dans le format spécifié.

ToString(DateTime, String)

Convertit le DateTime en String.

ToString(DateTime, XmlDateTimeSerializationMode)

Convertit l'élément DateTime en une chaîne String en utilisant le mode XmlDateTimeSerializationMode spécifié.

ToString(SByte)

Convertit le SByte en String.

ToString(UInt64)

Convertit le UInt64 en String.

ToString(Int64)

Convertit le Int64 en String.

ToString(Boolean)

Convertit le Boolean en String.

ToString(Int16)

Convertit le Int16 en String.

ToString(Guid)

Convertit le Guid en String.

ToString(Double)

Convertit le Double en String.

ToString(Decimal)

Convertit le Decimal en String.

ToString(DateTimeOffset)

Convertit l'élément DateTimeOffset fourni en une chaîne String.

ToString(DateTime)
Obsolète.
Obsolète.

Convertit le DateTime en String.

ToString(Char)

Convertit le Char en String.

ToString(Byte)

Convertit le Byte en String.

ToString(Int32)

Convertit le Int32 en String.

ToString(Single)

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

Convertit le Single en 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

Paramètres

value
Single

Valeur à convertir.

Retours

Représentation sous forme de chaîne de Single.

Remarques

Si value est Single.PositiveInfinity ou Single.NegativeInfinity, cette méthode retourne respectivement la chaîne INF ou -INF.

Voir aussi

S’applique à

ToString(TimeSpan)

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

Convertit le TimeSpan en 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

Paramètres

value
TimeSpan

La valeur à convertir.

Retours

Représentation sous forme de chaîne de TimeSpan.

S’applique à

ToString(UInt16)

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

Important

Cette API n’est pas conforme CLS.

Convertit le UInt16 en 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

Paramètres

value
UInt16

La valeur à convertir.

Retours

Représentation sous forme de chaîne de UInt16.

Attributs

S’applique à

ToString(UInt32)

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

Important

Cette API n’est pas conforme CLS.

Convertit le UInt32 en 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

Paramètres

value
UInt32

La valeur à convertir.

Retours

Représentation sous forme de chaîne de UInt32.

Attributs

S’applique à

ToString(DateTimeOffset, String)

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

Convertit l'élément DateTimeOffset fourni en une chaîne String dans le format spécifié.

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

Paramètres

value
DateTimeOffset

DateTimeOffset à convertir.

format
String

Format vers lequel s est convertie. Le paramètre de format peut correspondre à un sous-ensemble de recommandations du W3C pour le type XML dateTime. (Pour plus d’informations, consultez la section dateTime de la spécification XML Schema.)

Retours

Représentation String dans le format spécifié de l'élément DateTimeOffset.

Exemples

L’exemple suivant convertit une DateTimeOffset représentation de l’heure actuelle en un String dans le format spécifié.

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

S’applique à

ToString(DateTime, String)

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

Convertit le DateTime en 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

Paramètres

value
DateTime

Valeur à convertir.

format
String

Structure du format qui définit comment afficher la chaîne convertie. Les formats valides sont "yyyy-MM-ddTHH:mm:sszzzzzz" et ses sous-ensembles.

Retours

Représentation sous forme de chaîne de DateTime au format spécifié.

Exemples

L’exemple suivant convertit les types de données en chaîne, puis écrit les informations dans la console.

#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

S’applique à

ToString(DateTime, XmlDateTimeSerializationMode)

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

Convertit l'élément DateTime en une chaîne String en utilisant le mode XmlDateTimeSerializationMode spécifié.

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

Paramètres

value
DateTime

Valeur DateTime à convertir.

dateTimeOption
XmlDateTimeSerializationMode

Une des valeurs de XmlDateTimeSerializationMode qui spécifient comment traiter la valeur DateTime.

Retours

Équivalent String de l'élément DateTime.

Exceptions

La valeur dateTimeOption n'est pas valide.

La valeur de value ou de dateTimeOption est null.

S’applique à

ToString(SByte)

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

Important

Cette API n’est pas conforme CLS.

Convertit le SByte en 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

Paramètres

value
SByte

La valeur à convertir.

Retours

Représentation sous forme de chaîne de SByte.

Attributs

S’applique à

ToString(UInt64)

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

Important

Cette API n’est pas conforme CLS.

Convertit le UInt64 en 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

Paramètres

value
UInt64

La valeur à convertir.

Retours

Représentation sous forme de chaîne de UInt64.

Attributs

S’applique à

ToString(Int64)

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

Convertit le Int64 en 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

Paramètres

value
Int64

La valeur à convertir.

Retours

Représentation sous forme de chaîne de Int64.

S’applique à

ToString(Boolean)

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

Convertit le Boolean en 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

Paramètres

value
Boolean

La valeur à convertir.

Retours

Une représentation sous forme de chaîne de l'élément Boolean, c'est-à-dire "true" ou "false".

S’applique à

ToString(Int16)

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

Convertit le Int16 en 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

Paramètres

value
Int16

Valeur à convertir.

Retours

Représentation sous forme de chaîne de Int16.

Exemples

L’exemple suivant convertit les types de données en chaîne, puis écrit les informations dans la console.

#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

S’applique à

ToString(Guid)

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

Convertit le Guid en 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

Paramètres

value
Guid

La valeur à convertir.

Retours

Représentation sous forme de chaîne de Guid.

S’applique à

ToString(Double)

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

Convertit le Double en 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

Paramètres

value
Double

Valeur à convertir.

Retours

Représentation sous forme de chaîne de Double.

Exemples

L’exemple suivant convertit les types de données en chaîne, puis écrit les informations dans la console.

#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

Remarques

Si value est Double.PositiveInfinity ou Double.NegativeInfinity, cette méthode retourne respectivement la chaîne INF ou -INF.

Voir aussi

S’applique à

ToString(Decimal)

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

Convertit le Decimal en 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

Paramètres

value
Decimal

La valeur à convertir.

Retours

Représentation sous forme de chaîne de Decimal.

S’applique à

ToString(DateTimeOffset)

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

Convertit l'élément DateTimeOffset fourni en une chaîne 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

Paramètres

value
DateTimeOffset

DateTimeOffset à convertir.

Retours

Représentation String de l'élément DateTimeOffset fourni.

Exemples

L’exemple suivant convertit une DateTimeOffset représentation de l’heure actuelle 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

S’applique à

ToString(DateTime)

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

Attention

Use XmlConvert.ToString() that takes in XmlDateTimeSerializationMode

Attention

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

Convertit le DateTime en 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

Paramètres

value
DateTime

La valeur à convertir.

Retours

Représentation sous forme de chaîne de DateTime au format yyyy-MM-ddTHH:mm:ss, où 'T' est une constante littérale.

Attributs

Remarques

Notes

La XmlConvert.ToString(DateTime) méthode est obsolète dans la version 2.0 du .NET Framework et a été remplacée par la XmlConvert.ToString(DateTime, XmlDateTimeSerializationMode) méthode . Le mode suggéré est RoundtripKind. Si une correspondance exacte est attendue, utilisez XmlConvert.ToString(DateTime, String) avec la chaîne yyyy-MM-ddTHH:mm:ss.fffffffzzzzzzde format .

S’applique à

ToString(Char)

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

Convertit le Char en 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

Paramètres

value
Char

La valeur à convertir.

Retours

Représentation sous forme de chaîne de Char.

S’applique à

ToString(Byte)

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

Convertit le Byte en 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

Paramètres

value
Byte

La valeur à convertir.

Retours

Représentation sous forme de chaîne de Byte.

S’applique à

ToString(Int32)

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

Convertit le Int32 en 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

Paramètres

value
Int32

La valeur à convertir.

Retours

Représentation sous forme de chaîne de Int32.

S’applique à