|
by gavin via elephantsintheroom.org on 12/19/2007 1:15:00 AM
Extension methods allow you to create new public methods for a type without having to edit the type's code. They have been used by Microsoft in the implementation of Linq. The following example shows how int[] has been extended with a Min() method. using System.Linq;//without this, the int.Min extension will not be available
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int[] intArray = { 12, 24, 45 };
... [ read more ]
|