String.GetTypeCode Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
public:
virtual TypeCode GetTypeCode();
public TypeCode GetTypeCode ();
abstract member GetTypeCode : unit -> TypeCode
override this.GetTypeCode : unit -> TypeCode
Public Function GetTypeCode () As TypeCode
Returns
The enumerated constant, String.
Implements
Examples
The following example displays the TypeCode enumerated constant for the String type.
// 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()
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.
*/
let str = "abc"
let tc = str.GetTypeCode()
printfn $"""The type code for '{str}' is {tc.ToString "D"}, which represents {tc.ToString "F"}."""
// This example produces the following results:
// The type code for 'abc' is 18, which represents String.
' Sample for String.GetTypeCode()
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
End Class
'
'This example produces the following results:
'The type code for 'abc' is 18, which represents String.
'
Applies to
Sodelujte z nami v storitvi GitHub
Vir za to vsebino najdete v storitvi GitHub, kjer lahko tudi ustvarite in pregledate težave in zahtevke za uveljavitev sprememb. Če želite več informacij, glejte naš vodnik za sodelavce.