---
title: "what is extension method in c#"  
description: "what is extension method in c#"  
author: "Pawan Shukla"  
published: 2017-11-13  
canonical: https://answers.mindstick.com/qa/30456/what-is-extension-method-in-c-sharp  
category: "programming"  
tags: ["c#", "asp.net mvc"]  
reading_time: 1 minute  

---

# what is extension method in c#

what is [extension method](https://www.mindstick.com/articles/22/extension-method) in c#

## Answers

### Answer by Arti Mishra

**"Extension Methods in C# "**An extension method is special types of **static method of a static class**, where the **"this" keyword is used as a first parameter** of this method. And Extension methods allow existing classes to be **extended without inheritance** or also allow to change the source code of existing class. You can also use an extension method, in whole project by **including the namespace of an extension method.** \
**Here is the simple example where we demonstrate the example of an extension method-** **ClassTest.dll** **\**using System; using System.Text; namespace ClassTest { public class Class1 { public string Display() { return ("Display Method Called"); } } } \
**ExtensionMethod.dll****\**using System; using System.Text; using ClassTest; namespace ExtensionMethod { public static class ABCD { public static void NewExtensionMethod(this Class1 ob) { Console.WriteLine("Hello!...E xtended method called"); } } class Program { static void Main(string[] args) { Class1 obj = new Class1(); obj.Display(); obj.NewMethod(); Console.ReadKey(); } } } \


---

Original Source: https://answers.mindstick.com/qa/30456/what-is-extension-method-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
