Advertisement
m1o2

Miky Lestat s+= s = s + challenge

Jul 2nd, 2013
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.65 KB | None | 0 0
  1.  class Test
  2.     {
  3.         public static string operator +( Test self, string s )
  4.         {
  5.             return s.Length.ToString() + "Miky";
  6.         }
  7.  
  8.         public static string operator +(string s, Test self)
  9.         {
  10.             return s.Length.ToString() + "Miky";
  11.         }
  12.     }
  13.  
  14.     class Program
  15.     {
  16.         public static void Main(string[] args)
  17.         {
  18.             Test t = new Test();
  19.  
  20.             string s = string.Empty;
  21.             s += t + "Lestat";
  22.  
  23.             Console.WriteLine(s);
  24.  
  25.             s = string.Empty;
  26.             s = s + t + "Lestat";
  27.            
  28.             Console.WriteLine(s);
  29.         }
  30.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement