C# not inferring overloaded method via return type

前端 未结 6 1696
我在风中等你
我在风中等你 2021-01-21 05:17

I\'m writing a C# programlet to crawl a directory and give me a listing of files whose date in the last CSV line is less than the current date. Since this is a programlet, I\'m

6条回答
  •  無奈伤痛
    2021-01-21 05:40

    No, C# (like C++ before it) does not allow an overload where the only difference is in the return type.

    The big problem here is which one do you call if you don't assign the return value? Which one do you call if both types are castable to the return value assignment? Its highly ambiguous, and so not allowed.

提交回复
热议问题