Last active
September 11, 2018 07:26
-
-
Save idg10/d515cefe134d80831b1b7dafce434cb5 to your computer and use it in GitHub Desktop.
Incorrect resource handling with Func-based deferred execution
This file contains 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
// This doesn't work. | |
public static Func<string> GetContentGetter(string configPath) | |
{ | |
using (var reader = new StreamReader(configPath)) | |
{ | |
return () => reader.ReadToEnd(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment