次の方法で共有


String.GetTypeCode メソッド

String クラスの TypeCode を返します。

Public Overridable Function GetTypeCode() As TypeCode Implements _   IConvertible.GetTypeCode
[C#]
public virtual TypeCode GetTypeCode();
[C++]
public: virtual TypeCode GetTypeCode();
[JScript]
public function GetTypeCode() : TypeCode;

戻り値

列挙型定数 TypeCode.String

実装

IConvertible.GetTypeCode

使用例

 
' 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.
'

[C#] 
// 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.
*/

[C++] 
// Sample for String.GetTypeCode()
#using <mscorlib.dll>
using namespace System;

int main() 
{
    String* str = S"abc";
    TypeCode tc = str->GetTypeCode();
    Console::WriteLine(S"The type code for '{0}' is {1}, which represents {2}.", 
        str, __box(tc)->ToString(S"D"), __box(tc)->ToString(S"F"));
}
/*
This example produces the following results:
The type code for 'abc' is 18, which represents String.
*/

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET

参照

String クラス | String メンバ | System 名前空間