Freigeben über


String.GetTypeCode-Methode

Gibt den TypeCode für die Klasse String zurück.

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Function GetTypeCode As TypeCode
'Usage
Dim instance As String
Dim returnValue As TypeCode

returnValue = instance.GetTypeCode
public TypeCode GetTypeCode ()
public:
virtual TypeCode GetTypeCode () sealed
public final TypeCode GetTypeCode ()
public final function GetTypeCode () : TypeCode

Rückgabewert

Die Enumerationskonstante TypeCode.String.

Beispiel

Im folgenden Codebeispiel wird die TypeCode-Enumerationskonstante für den String-Typ angezeigt.

' Sample for String.GetTypeCode()
Imports System

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 'Main
End Class 'Sample
'
'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.
*/
// 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()
import System.*;

class Sample
{
    public static void main(String[] args)
    {
        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"));
    } //main
} //Sample
/*
This example produces the following results:
The type code for 'abc' is 18, which represents String.
*/

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0, 1.0

Siehe auch

Referenz

String-Klasse
String-Member
System-Namespace