Extension Methods in CSharp

Have you ever wanted to add a method to a sealed class, like string?  Or, have you ever wished you could provide more than a signature for a method in an interface?

Well now you can.  Today we are going to look at extension methods which will allow you to do both of these.

Like this Article? Subscribe to get every article sent to your email.

Related Post

  • Forcing Extension Methods to Be UsedForcing Extension Methods to Be Used I received the following question: Is it possible to force a namespace to be included so that the extension methods in it will be used in it instead of the methods in the main class? I […]
  • Using Sealed in CSharpUsing Sealed in CSharp Another potentially useful but not very popular keyword in CSharp is the sealed keyword.  While not a keyword that you will need to use often, it is a critical keyword for framework […]
  • Extension Methods in VB.NETExtension Methods in VB.NET Last week we took a look at Extension Methods in CSharp.  Today we will continue looking at Extension methods using VB.NET syntax.  It's obvious by comparing the syntax in VB.NET to the […]
  • How to code LINQHow to code LINQ Today we finally put all the code we've been looking at for the last couple of weeks into practice and take a look at LINQ.  Today's example will be relatively brief but once you […]
  • Reflection -The ConstructorReflection -The Constructor Remember, last week we started a series on using Reflection in our .NET applications.  We've loaded the assembly already, so the next step is creating the object.  Today's tutorial will […]

About Dave Bush

Dave Bush is a Full Stack ASP.NET developer. His commitment to quality through test driven development, vast knowledge of C#, HTML, CSS and JavaScript as well as his ability to mentor younger programmers and his passion for Agile/Scrum as defined by the Agile Manifesto and the Scrum Alliance will certainly be an asset to your organization.