Skip to content

fodyarchived/Usable

Repository files navigation

Chat on Gitter NuGet Status

Usable is an add-in for Fody

Usable Icon - A waste paper basket.

Usable adds using statements for local variables that have been created, and implement IDisposable.

NuGet installation

Install the Usable.Fody NuGet package and update the Fody NuGet package:

PM> Install-Package Fody
PM> Install-Package Usable.Fody

The Install-Package Fody is required since NuGet always defaults to the oldest, and most buggy, version of any dependency.

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