Answer Posted / 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 |
Post New Answer View All Answers
What is bitwise operator in c#?
Can we declare class as protected?
What do you mean by a windows process in regards to memory allocation?
What is a thread? What is multithreading?
How Is The Dll Hell Problem Solved In .net?
What are virtual destructors?
What are the Features in .net framework 1.1
What is a Jagged Array in C#?
What is xor operation?
What is ildasm and obfuscator in net?
What is the difference between interface and inheritance in c#?
What is the difference between early binding and late binding in c#?
How do you implement thread synchronization in c#?
What are winforms in c#?
What is a dictionary in c#?