Skip to content

Instantly share code, notes, and snippets.

@mitiko
Created May 19, 2019 19:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mitiko/c1f361affeb9ac9b4698dbb04b3a8611 to your computer and use it in GitHub Desktop.
Save mitiko/c1f361affeb9ac9b4698dbb04b3a8611 to your computer and use it in GitHub Desktop.
public void A(Func<string> x)
{
for (int i = 0; i < 10; i++)
{
var data = x.Invoke();
Console.WriteLine(data);
Console.WriteLine(i);
}
}
public Func<string> B(string fileName)
{
// process fileName
var data = File.ReadAllText(fileName);
return () => data;
}
public void Main()
{
A(B("/home/user1/a.txt"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment