Skip to content
InfinityKnow

InfinityKnow

Infinity Knowledge (IK) : Technology, Articles, Topics, Facts or many More.

  • Home
  • Education
    • yttags
    • Make Money
    • Jobs
    • Programming
      • Technology
      • Web Design
      • WEB HOSTING
      • Interview
  • Entertainment
    • pakainfo
    • Sports
    • Tips and Tricks
      • Law
      • Photography
      • Travel
  • Health
    • Insurance
    • Lifestyle
      • Clothing
      • Fashion
      • Food
  • News
    • Insurance
      • Auto Car Insurance
      • Business Insurance
    • Donate
    • California
  • News
    • Political
  • Home Improvement
  • Trading
    • Marketing
    • Top Tranding
    • Business
    • Real Estate
  • Full Form
  • Contact Us
  • Angular Application Folder Structure Technology
  • car
    Basic Guide for Selling Car Online Business
  • Vuejs Form Validation Example – vue validation
    Vuejs Form Validation Example – vue validation Technology
  • PHP Laravel 6 Get base url Examples Technology
  • Angular ng repeat events Technology
  • Include common header and footer using Vuejs - router-view
    Include common header and footer using Vuejs – router-view Technology
  • Llipozene
    Llipozene- Diet Pill for Faster Obesity Management – An Overview Tips and Tricks
  • happy birthday Status

C# Extension Methods Tutorial with Examples

Posted on June 25, 2019 By admin No Comments on C# Extension Methods Tutorial with Examples

C# Extension Methods Tutorial with Examples

Today, We want to share with you C# Extension Methods Tutorial with Examples.
In this post we will show you Extension method in c#, hear for C# Extension Methods we will give you demo and example for implement.In this post, we will learn about C Sharp Extension method with an example.

Extension method in c#

In this post,we will learn about Extension method in c# an example.

Now in this post, I will explain about Extension method in c# with appropriate example.

Extension methods make it possible to add methods to existing types without creating a new derived type, recompiling, or otherwise modifying the original type. An extension method is a special type of static method, but they are called as if they were instance methods on the extended type.

READ :  Angular check all and uncheck all checkbox

An extension method is a static method of a static class, where the “this” modifier is supplied to the first parameter. The type of the first parameter will be the type which is extended.

Now create Console Application in Visual Studio and write below lines of code in it.

[php]public class Class1 {
public string Count() {
return (“I m in Count”);
}

public string PrintCount() {
return (“I m in PrintCount”);
}
}[/php]

Now it is required to extend the definition of this class so  create a static class to create an extinction method like:

[php]public static class AAA {
public static void NewMethod(this Class1 ob) {
Console.WriteLine(“Hello I m extended method”);
}
}
[/php]

READ :  Angularjs Multiple Image Slider - Thumbnails Slider Example

In the above code I just create a method that name is NewMethod with a parameter using this to define which type of data I need to be extend, now let’s see how to use this function.

[php]
class Program {
static void Main(string[] args) {
Class1 ob = new Class1();
ob.Count();
ob.PrintCount();
ob.NewMethod();
Console.ReadKey();
}
}
[/php]

Read :

  • Technology
  • Google Adsense
  • Articles

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about c# extension methods tutorial.
I would like to have feedback on my Infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

READ :  Check Uncheck All Selectboxes using Vuejs

Related posts:

  1. Vuejs Simple Navigation Menu vue router-link params
  2. Responsive Navigation Menu CSS Free download
  3. vuejs toggle class – vue js v-class – Dynamic Components in Vuejs
  4. Vuejs Simple Tooltip Plugin v-tooltip Example
Technology, Asp.Net Tags:advantages of extension methods in c#, c# extension methods tutorial, c# extension properties, c# generic extension methods, c# static extension methods, extension method in c# real time example, extension methods in c# interview questions, why we use extension method in c#

Post navigation

Previous Post: AngularJS forEach() Function Example
Next Post: Angular Access Nested JSON object using Ng Repeat

Related Posts

  • AngularJS Custom Directives example – Angular Directives
    AngularJS Custom Directives example – Angular Directives Technology
  • WordPress $wpdb Insert Multiple Records PHP
  • Angular Get Values Bind Multiple Checkbox Selected Technology
  • C# LinkedList Tutorial with Examples Technology
  • C# reverse number Program Tutorial with Examples Technology
  • VueJS Dynamic v-model value directive Technology

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Categories

  • Account web hosting (1)
  • AngularJs (277)
  • Articles (143)
  • Asp.Net (49)
  • Astrology (2)
  • Attorney (7)
  • Auto Car Insurance (4)
  • Biography (2)
  • Business (9)
  • Business Insurance (3)
  • California (4)
  • Choose the web hosting (1)
  • Clothing (6)
  • cloud (8)
  • Cloud data storage (2)
  • Credit (1)
  • Dedicated hosting server web (1)
  • Dedicated server web hosting (1)
  • Dedicated web hosting (1)
  • Degree (11)
  • Design (9)
  • Differences shared hosting (1)
  • Donate (2)
  • Education (37)
  • Energy web hosting (1)
  • Entertainment (6)
  • Facts (12)
  • Fashion (3)
  • Finance (3)
  • Food (5)
  • full form (90)
  • Google Adsense (22)
  • Health (21)
  • Home Improvement (5)
  • Insurance (7)
  • Interview (2)
  • Jobs (6)
  • jquery (2)
  • jQuery (2)
  • Laravel (164)
  • Lawyer (4)
  • Lifestyle (6)
  • Loans (6)
  • Make Money (31)
  • Managed dedicated server (1)
  • Managed hosting solution (1)
  • Managed servers (1)
  • Marketing (8)
  • Mortgage (2)
  • Movies (21)
  • MySQL (180)
  • News (5)
  • Photography (1)
  • PHP (250)
  • Programming (18)
  • Quotes (75)
  • Real Estate (2)
  • SEO (9)
  • Shared web hosting (1)
  • Shayari (67)
  • Sports (5)
  • Status (34)
  • Stories (45)
  • suvichar (8)
  • Tech (3)
  • Technology (675)
  • Tips and Tricks (43)
  • Top Tranding (36)
  • Trading (28)
  • Travel (12)
  • Uncategorized (8)
  • VueJs (179)
  • Web Design (2)
  • WEB HOSTING (1)
  • Web hosting company (1)
  • Web hosting really (1)
  • Web hosting windows (1)
  • Which website hosting (1)
  • Wishes (13)
  • wordpress (15)

Categories

AngularJs (277) Articles (143) Asp.Net (49) Attorney (7) Business (9) Clothing (6) cloud (8) Degree (11) Design (9) Education (37) Entertainment (6) Facts (12) Food (5) full form (90) Google Adsense (22) Health (21) Home Improvement (5) Insurance (7) Jobs (6) Laravel (164) Lifestyle (6) Loans (6) Make Money (31) Marketing (8) Movies (21) MySQL (180) News (5) PHP (250) Programming (18) Quotes (75) SEO (9) Shayari (67) Sports (5) Status (34) Stories (45) suvichar (8) Technology (675) Tips and Tricks (43) Top Tranding (36) Trading (28) Travel (12) Uncategorized (8) VueJs (179) Wishes (13) wordpress (15)
  • what is Angular 2 and Difference between Angular 1 VS Angular 2 Technology
  • Dynamically DropDownList from JSON Array using jQuery Technology
  • Vue js Axios PHP File Upload Example
    Vue js Axios PHP File Upload Example VueJs
  • AngularJS access parent scope from child controller Example
    AngularJS access parent scope from child controller Example Technology
  • Ruth bader ginsburg quotes Quotes
  • JavaScript Read XML File local Example
    JavaScript Read XML File local Example Technology
  • Dynamic Attribute vuejs 2 Class and Style Bindings
    Dynamic Attribute vuejs 2 Class and Style Bindings Technology
  • MoviezWap 2021 Live Link: Latest HD Telugu, Tamil & Hollywood Movies Download Movies

Copyright © 2022 InfinityKnow.

Powered by PressBook News WordPress theme