String Gettype() - C# Tutorial
C# Course / Strings / String Gettype()

String Gettype()

BLUF: Mastering String Gettype() is essential for building robust applications with the .NET ecosystem. This tutorial provides clear explanations and practical examples to help you understand and apply this C# concept.
Enterprise Development Tip: String Gettype()

C# is a powerful, modern language for enterprise solutions. Discover how String Gettype() enhances your development workflow in the guide below.

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:

Logic Practice
Install Logic Practice
Add to home screen for a faster app-like experience