Coffeehouse Post

Single Post Permalink

View Thread: Why does C# not support this?
  • User profile image
    Maddus Mattus

    public class Worker { 
    public int DoWork() { return 10; } 
    public string DoWork() { return "Work"; } 
    } 
    public class Program 
    { 
    public Program() 
    { 
    Worker worker = new Worker; 
    int workInt = worker.DoWork(); 
    string workString = worker.DoWork(); 
    }} 

     

     I know I know

     

    But in 2010 a compiler should be intelligent enough, right?

     

    Maybe I should put this in the c# 5.0 wishlist.