C# String GetType() Method
You are Here:
C# String GetType()
The GetType()
method gets the type of the current instance.
Example
C# Compiler
using System;
namespace myApp
{
class Program
{
static void Main(string[] args)
{
string s = "wikimass";
float fnum = 1.5f;
int inum = 13;
char ch = 'G';
short snum = 56;
Console.WriteLine(s.GetType());
Console.WriteLine(fnum.GetType());
Console.WriteLine(inum.GetType());
Console.WriteLine(ch.GetType());
Console.WriteLine(snum.GetType());
}
}
}
Output
System.String
System.Single
System.Int32
System.Char
System.Int16
Syntax
public Type GetType()
Parameter Values
It does not take any parameter.
Return Value
Value | Explanation |
---|---|
DataType | Returns the exact runtime type of the current instance. |
Reminder
Hi Developers, we almost covered 90% of String functions and Interview Question on C# with examples for quick and easy learning.
We are working to cover every Single Concept in C#.
Please do google search for:
Join Our Channel
Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.
This channel is primarily useful for Full Stack Web Developer.