- 
                Notifications
    You must be signed in to change notification settings 
- Fork 90
Create disposal function
        CodingUnit edited this page Apr 11, 2012 
        ·
        6 revisions
      
    - 
Category: Disposal 
- 
Description: Create disposal function 
- 
Comment: For use this example you must include NewObjectMacro.dll reference (from Nemerle program directory) 
- 
Code: 
 using System; 
 using System.Console; 
 using Nemerle; 
 using Snippets;
def DisposalSample2() 
{
    def disposed() { WriteLine("disposed") }
    def disposable = newobj { IDisposable : { Dispose = disposed } };
         
    using (disposable) 
      WriteLine("inside");
    WriteLine("finished");
}
DisposalSample2() - Execution Result:
 inside 
 disposed 
 finished 
[Copyright ©](Terms of use, legal notice)