C
C#12mo ago
r2

✅ :white_check_mark: Compiler/ReSharper/something is telling lies (this is about overloads)

Sorry for this. Only engage if you're bored. I've got
c#
// ...
public static IEnumerable<T> GetUserInput<T>(...) {...};
public static T GetUserInput<T>(...) {...};
// ...
c#
// ...
public static IEnumerable<T> GetUserInput<T>(...) {...};
public static T GetUserInput<T>(...) {...};
// ...
and something is screaming
Member with the same signature is already declared
at me. Well, a member with the same signature is not declared! So, what gives?
6 Replies
r2
r2OP12mo ago
The params are identical tho
Jimmacle
Jimmacle12mo ago
return type doesn't count as part of the signature for purposes of overload resolution
r2
r2OP12mo ago
Grteat just great Thank you. That clears it up
Jimmacle
Jimmacle12mo ago
$close
MODiX
MODiX12mo ago
Use the /close command to mark a forum thread as answered
r2
r2OP12mo ago
Two's better than one anyways

Did you find this page helpful?