C# 3.0 - 拡張メソッド

C# 3.0で唯一いらないもの

既存のクラスにメソッドを追加できる

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Program
{
    // intにHogeメソッドを追加
    public static class IntExtention
    {
        public static void Hoge(this int value)
        {
            Console.WriteLine(value);
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            int n = 3;

            n.Hoge();
        }
    }
}

少なくても私は使いません