Both the class and every method it contains are static.
Extension methods must be defined in a non-generic static class
using System; using System.Linq; class Program/*ww w . j av a 2 s . c om*/ { static void Main(string[] args) { double pi = "3.1415926535".ToDouble(); Console.WriteLine(pi); } } public static class StringConversions { public static double ToDouble(this string s) { return Double.Parse(s); } public static bool ToBool(this string s) { return Boolean.Parse(s); } }