using in the function
Class aa
{
public aa()
public void kk()
{
}
}
class D : IDisposable
{
void IDisposable.Dispose() { }
public void Dispose() { }
public static void Main()
{
using (D d = new D()) { } // D must be Disposable, after this, "d" disappear
aa ttt = new aa();
}
}
------------------------------------------
Dispose some types in a class, after using
using System;
public class C<T>
public class C<T> where T : IDisposable
{
public void F(T t)
{
using (t) {}
}
}