Skip to content

Instantly share code, notes, and snippets.

@AmazingTurtle
Created April 6, 2015 16:32
Show Gist options
  • Save AmazingTurtle/dc4c20c5d2c170553796 to your computer and use it in GitHub Desktop.
Save AmazingTurtle/dc4c20c5d2c170553796 to your computer and use it in GitHub Desktop.
c# not disposing new parameter
namespace Disposetest
{
class test : IDisposable
{
public void Dispose()
{
Console.WriteLine("disposing");
}
}
class Program
{
static void magic(test instance)
{ }
static void Main(string[] args)
{
Console.WriteLine("first run");
magic(new test());
Console.WriteLine("second run");
using (var instance = new test())
magic(instance);
Console.ReadLine();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment