Edit

Share via


String.GetTypeCode Method

Definition

Returns the TypeCode for the String class.

C#
public TypeCode GetTypeCode();

Returns

The enumerated constant, String.

Implements

Examples

The following example displays the TypeCode enumerated constant for the String type.

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.
*/

Applies to