Created
September 21, 2015 14:51
-
-
Save georgebearden/527fc6c147dfc56ec4d4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| namespace FuncOverloads | |
| { | |
| public class Program | |
| { | |
| public static void Main( string[] args ) | |
| { | |
| Func<int> funcReturnsInt = () => { return 0; }; | |
| Parse( funcReturnsInt ); // Works | |
| funcReturnsInt = MethodReturnsInt; // Works | |
| Parse( funcReturnsInt ); // Works | |
| Parse( (Func<int>)MethodReturnsInt ); // Works | |
| Parse( MethodReturnsInt ); // Does not work | |
| } | |
| public static int MethodReturnsInt() { return 0; } | |
| public static void Parse(Func<int> func) { } | |
| public static void Parse( Func<string> func ) { } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment