UrbanPro

Learn .Net Training from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

What are extension methods in C#?

Asked by Last Modified  

1 Answer

Learn .Net

Follow 1
Answer

Please enter your answer

Trainer

Extension methods are methods added to an existing type without modifying it or deriving from it. These methods enable to extend the functionalty of existing types. They are implemented as static methods but are invoked as if they were instance methods on the extended type. For client code there is no...
read more

Extension methods are methods added to an existing type without modifying it or deriving from it. These methods enable to extend the functionalty of existing types. They are implemented as static methods but are invoked as if they were instance methods on the extended type. For client code there is no difference between calling an extension method and the methods defined within the type.
To define and call the extension method
1. Define a static class to contain the extension method.
2. The class must be visible to client code (most probably a public class).
3. Include a static method in this class to implement the extension method.
4. The first parameter of this method specifies the type that the method is about to extend; it must be preceded with the "this" modifier.
5. In the calling code, add a using directive to specify the namespace that contains the extension method class.
6. Call the extension methods in the client code as if they were instance methods on the type.

read less
Comments

Related Questions

What is data?
Data is distinct pieces of information. All software is divided into two categories: data and programs. Programs are collections of instructions for manipulating data.
Madan Lal
what time(period) will take to learn/speaking english
For me, i will teach in 2 months
Himanshi
0 0
6
What is the usage of .net WCF?
Windows Communication Foundation (WCF) is a framework for building service-oriented applications. Using WCF, you can send data as asynchronous messages from one service endpoint to another. A service endpoint...
Anu
Is it possible of hacked a website into asp.net?
Yes. if developer not handle Cross-site scripting (XSS) .
Appin

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Read CSV data using ODBC Connection
Codes to read the CSV data using ODBC Connection- Input File: File's Encoding format should be ANSI as below class Student{ public string CollegeId { get; set; } public string AdmissionDate...

Trends in .Net Platform
.NET Framework is a software framework developed by Microsoft. It includes a large class library named Framework Class Library (FCL) and provides language interoperability (each language can use code written...

Difference between App services,Cloud Service and Virtual Machine in Microsoft Azure
App Services :When you want to deploy your application to Azure IIS conatainers without requiring any control,web apps should be preferred.It's a part of Azure Paas.1) When you need IIS.2) Satisfy with...

Roll up your sleeves and get knee deep into coding!
Practise, make mistakes, learn to search for solutions,seek help when stuck badly! Just attending classes won't make you good at coding!!!

Understanding Delegate in C# .NET
C# Delegate technique Delegate is one of the fantastic tool & technique in C#.NET. Using deleagte technique the following benefits could be avaialed One can define a method without name (Anonymous...

Recommended Articles

Business Process outsourcing (BPO) services can be considered as a kind of outsourcing which involves subletting of specific functions associated with any business to a third party service provider. BPO is usually administered as a cost-saving procedure for functions which an organization needs but does not rely upon to...

Read full article >

Information technology consultancy or Information technology consulting is a specialized field in which one can set their focus on providing advisory services to business firms on finding ways to use innovations in information technology to further their business and meet the objectives of the business. Not only does...

Read full article >

Software Development has been one of the most popular career trends since years. The reason behind this is the fact that software are being used almost everywhere today.  In all of our lives, from the morning’s alarm clock to the coffee maker, car, mobile phone, computer, ATM and in almost everything we use in our daily...

Read full article >

Applications engineering is a hot trend in the current IT market.  An applications engineer is responsible for designing and application of technology products relating to various aspects of computing. To accomplish this, he/she has to work collaboratively with the company’s manufacturing, marketing, sales, and customer...

Read full article >

Looking for .Net Training ?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for .Net Training Classes?

The best tutors for .Net Training Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn .Net Training with the Best Tutors

The best Tutors for .Net Training Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more