static void Main(string[] args) { using (CrucialConnection c = new CrucialConnection()) { // do something with the crucial connection } Console.ReadKey(); }
static void Main(string[] args) { //CTO: There are two ways to make sure that Dispose is called correctly; you can call the //method yourself in your application, or you can make use of the C# "using" construction. //CTO: quando o using acaba é chamado o dispose do objeto ao qual esta sendo usado using (CrucialConnection c = new CrucialConnection()) { // do something with the crucial connection } Console.ReadKey(); }