Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 8th, 2012  |  syntax: None  |  size: 0.63 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Extension methods and static methods mismatch prototype matching in c# [closed]
  2. using System;
  3.  
  4. namespace Test
  5. {
  6.     static class EM
  7.     {
  8.         public static string To(this object o)
  9.         {
  10.             return "2222";
  11.         }
  12.     }
  13.     class A
  14.     {
  15.         public static string To() { return "1111"; }
  16.     }
  17.     class B { }
  18.  
  19.     class Program
  20.     {
  21.         public static void Main(string[] args)
  22.         {
  23.             Console.WriteLine("Hello World!");
  24.             object o = null;
  25.             o.To();
  26.             B b = null;
  27.             b.To();
  28.             A a = null;
  29.             a.To();
  30.             A.To();
  31.         }
  32.     }
  33. }