String.IConvertible.GetTypeCode Method

Definition

Returns the TypeCode for the String class.

C#
TypeCode IConvertible.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

Product Versions
.NET Core 1.0, Core 1.1
.NET Standard 1.3, 1.4, 1.5, 1.6
UWP 10.0