---
title: "what is an  extension methods in c#"  
description: "what is an  extension methods in c#"  
author: "Manoj Bhatt"  
published: 2016-02-02  
updated: 2020-09-17  
canonical: https://www.mindstick.com/interview/22976/what-is-an-extension-methods-in-c-sharp  
category: "c#"  
tags: ["c#", "asp.net"]  
reading_time: 2 minutes  

---

# what is an  extension methods in c#

Extension methods enable you to "add" methods to existing types without creating a new derived type, recompiling, or otherwise modifying the original type. Extension methods are a special kind of static method, but they are called as if they were instance methods on the extended type. For client code written in C# and Visual Basic, there is no apparent difference between calling an extension method and the methods that are actually defined in a type.

```
public static void Method1(this anotherclass ob) {             Console.WriteLine("Hello I m extended method");}  
```

you can access this Extension Method '**Method1**' with using object of another class.

## Answers

### Answer by Manoj Bhatt

Extension methods enable you to "add" methods to existing types without creating a new derived type, recompiling, or otherwise modifying the original type. Extension methods are a special kind of static method, but they are called as if they were instance methods on the extended type. For client code written in C# and Visual Basic, there is no apparent difference between calling an extension method and the methods that are actually defined in a type.

```
public static void Method1(this anotherclass ob) {             Console.WriteLine("Hello I m extended method");}  
```

you can access this Extension Method '**Method1**' with using object of another class.


---

Original Source: https://www.mindstick.com/interview/22976/what-is-an-extension-methods-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
