---
title: "Type Class in C#"  
description: "In this blog I am trying to explain the concept of Type Class in C#.Type ClassThe C# typeof operator returns a Type object. A Type object that represe"  
author: "Vijay Shukla"  
published: 2013-06-17  
updated: 2014-09-18  
canonical: https://www.mindstick.com/blog/536/type-class-in-c-sharp  
category: "c#"  
tags: ["c#"]  
reading_time: 2 minutes  

---

# Type Class in C#

In this blog I [am trying](https://answers.mindstick.com/qa/36834/which-two-programming-languages-should-i-master-in-if-i-am-trying-to-get-into-google-or-facebook) to [explain the concept](https://www.mindstick.com/forum/159605/explain-the-concept-of-unique-key-violation-error) of Type [Class in C#](https://www.mindstick.com/forum/160399/how-to-create-a-custom-generic-class-in-c-sharp-provide-an-example).

Type Class

The C# typeof operator returns a Type object. A Type object that represents a type is unique; that is, two Type object references refer to the same object if and only if they represent the same type. Represents type declarations: class types, [interface](https://www.mindstick.com/articles/12101/interfaces-in-java-extending-interfaces) types, array types, value types, [enumeration](https://www.mindstick.com/blog/88/enumeration-in-c-sharp) types, type [parameters](https://www.mindstick.com/articles/87/passing-parameters-in-c-sharp), generic type definitions, and open or closed constructed generic types. This allows for [comparison](https://www.mindstick.com/articles/23182/comparison-maruti-suzuki-celerio-v-s-tata-tiago) of Type objects using reference equality. Type is the root of the System.Reflection [functionality](https://www.mindstick.com/blog/136/using-watermark-functionality-in-textbox-by-jquery) and is the primary way to access metadata. Use the members of Type to get information about a type declaration, such as the constructors, methods, fields, [properties](https://www.mindstick.com/articles/23331/nootropics-7-different-types-and-their-unique-properties), and events of a class, [as well as](https://www.mindstick.com/interview/2481/can-you-write-a-java-class-that-could-be-used-both-as-an-applet-as-well-as-an-application) the module and the assembly in which the class is deployed.

##### Example: -

```
using System;using System.Reflection;
class ExampleType{
    static void Main(string[] args)    {        Type task = typeof(String);        MethodInfo substr = task.GetMethod("Substring", new Type[] { typeof(int), typeof(int) });
        Object result = substr.Invoke("Hello, mindstick!", new Object[] { 7, 9 });
        Console.WriteLine("{0} returned \"{1}\".", substr, result);
        Console.ReadKey();
    }
}
```

Output: -

![Type Class in C#](https://www.mindstick.com/blogs/fd29aea8-2b76-4828-9cb1-6b09a4122659/images/41d2869c-0ae5-4616-b296-e1ecf606af33.png)

---

Original Source: https://www.mindstick.com/blog/536/type-class-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
