String.IConvertible.GetTypeCode Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
virtual TypeCode System.IConvertible.GetTypeCode() = IConvertible::GetTypeCode;
TypeCode IConvertible.GetTypeCode ();
abstract member System.IConvertible.GetTypeCode : unit -> TypeCode
override this.System.IConvertible.GetTypeCode : unit -> TypeCode
Function GetTypeCode () As TypeCode Implements IConvertible.GetTypeCode
Retours
Constante énumérée, String.
Implémente
Exemples
L’exemple suivant affiche la TypeCode constante énumérée pour le String type.
// Sample for String.GetTypeCode()
using namespace System;
int main()
{
String^ str = "abc";
TypeCode tc = str->GetTypeCode();
Console::WriteLine( "The type code for '{0}' is {1}, which represents {2}.", str, tc.ToString( "D" ), tc.ToString( "F" ) );
}
/*
This example produces the following results:
The type code for 'abc' is 18, which represents String.
*/
// Sample for String.GetTypeCode()
using System;
class Sample
{
public static void Main()
{
String str = "abc";
TypeCode tc = str.GetTypeCode();
Console.WriteLine("The type code for '{0}' is {1}, which represents {2}.",
str, tc.ToString("D"), tc.ToString("F"));
}
}
/*
This example produces the following results:
The type code for 'abc' is 18, which represents String.
*/
let str = "abc"
let tc = str.GetTypeCode()
printfn $"""The type code for '{str}' is {tc.ToString "D"}, which represents {tc.ToString "F"}."""
// This example produces the following results:
// The type code for 'abc' is 18, which represents String.
' Sample for String.GetTypeCode()
Class Sample
Public Shared Sub Main()
Dim str As [String] = "abc"
Dim tc As TypeCode = str.GetTypeCode()
Console.WriteLine("The type code for '{0}' is {1}, which represents {2}.", _
str, tc.ToString("D"), tc.ToString("F"))
End Sub
End Class
'
'This example produces the following results:
'The type code for 'abc' is 18, which represents String.
'
S’applique à
Collaborer avec nous sur GitHub
La source de ce contenu se trouve sur GitHub, où vous pouvez également créer et examiner les problèmes et les demandes de tirage. Pour plus d’informations, consultez notre guide du contributeur.