Skip to content

Instantly share code, notes, and snippets.

@georgebearden
Created September 21, 2015 14:51
Show Gist options
  • Select an option

  • Save georgebearden/527fc6c147dfc56ec4d4 to your computer and use it in GitHub Desktop.

Select an option

Save georgebearden/527fc6c147dfc56ec4d4 to your computer and use it in GitHub Desktop.
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