Fody
Usable is an add-in forUsable adds using statements for local variables that have been created, and implement IDisposable.
The nuget package
https://nuget.org/packages/Usable.Fody/
PM> Install-Package Usable.Fody
Your Code
public void Method()
{
var w = File.CreateText("log.txt");
w.WriteLine("I'm a lumberjack an' I'm ok.");
}
What gets compiled
public void Method()
{
using (var w = File.CreateText("log.txt"))
{
w.WriteLine("I'm a lumberjack an' I'm ok.");
}
}
Contributors
Icon
Trash designed by Shirley Wu from The Noun Project