String Gettype()

The C# GetType method serves the purpose of obtaining the type of the current object. It provides back an instance of the Type class, which plays a crucial role in reflection operations.

Signature

Example

public Type GetType()

Parameters

It does not take any parameter.

Return

It returns object of Type class.

C# String GetType Method Example

Example

using System;  
    public class StringExample  
    {  
        public static void Main(string[] args)  
        {  
          string s1 = "Hello C#";
          Console.WriteLine(s1.GetType());
        }  
    }

Output:

Output

System.String

Input Required

This code uses input(). Please provide values below: