Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

String.GetTypeCode Method ()

 

Returns the TypeCode for class String.

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

public TypeCode GetTypeCode()

Return Value

Type: System.TypeCode

The enumerated constant, TypeCode.String.

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

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

.NET Framework
Available since 1.1
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show:
© 2017 Microsoft