Created
April 6, 2015 16:32
-
-
Save AmazingTurtle/dc4c20c5d2c170553796 to your computer and use it in GitHub Desktop.
c# not disposing new parameter
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
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