What is extended method in c#
Answers were Sorted based on User's Feedback
Answer / ashish agrawal
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.
class ExtensionMethods2
{
static void Main()
{
int[] ints = { 10, 45, 15, 39, 21, 26 };
var result = ints.OrderBy(g => g);
foreach (var i in result)
{
System.Console.Write(i + " ");
}
}
}
//Output: 10 15 21 26 39 45
Is This Answer Correct ? | 11 Yes | 5 No |
Answer / ratheesh
The most common extension methods are the LINQ standard query operators that add query functionality to the existing System.Collections.IEnumerable and System.
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / aniket
small information : extension methods are nothing but visitor design pattern.
http://www.codeproject.com/Articles/34209/Extension-Methods-in-C
Is This Answer Correct ? | 1 Yes | 0 No |
Is it possible to inline assembly or il in c# code?
What is the use of 'as' Keyword in C# ?
When you inherit a protected class-level variable, who is it available to?
Are c and c# the same thing?
Is constructor a static method?
What is the difference between array and arraylist in c#?
What is eager and lazy loading in c#?
If a class is having 4 variables namely type double,type integer,type string,type decimal. If we create an instance of that class those variables which gets into this instance are value types or reference types?
What is arraylist?
Describe the overview of clr integration.
Explain copy constructor?
Is visual c# free?