according to http://msdn.microsoft.com/library/en-us/cpguide/html/cpconautomaticmemorymanagement.asp?frame=true非托管资源:The most common type of unmanaged resource is an object that wraps an operating system resource, such as a file handle, window handle, or network connection. Although the garbage collector is able to track the lifetime of a managed object that encapsulates an unmanaged resource, it does not have specific knowledge about how to clean up the resource. When you create an object that encapsulates an unmanaged resource, it is recommended that you provide the necessary code to clean up the unmanaged resource in a public Dispose method.
上面说的倒是和VS.NET中文版的MSDN一样,不过没有实际例子啊,如何回收还不是非常清楚, 我现在的理解是: the instance of object(unmanaged resource's) how to dispose? i guess it will be disposed automatically(when come out the function),it's right or false ?and ... how to close unmanaged resource ? who can give me a example ???
you normally call those resource objects' Close() method
c#的任何类型都是类,包括int,double。。所以它们当然也有析构函数
析构函数本身并不能释放,它你给你一个和对象吻别的机会罢了
不可能回收UnManaged资源。
对于int, doulbe类型. .NET会Box成为System.Int32 成为Managed
最后由GC回收。
我现在的理解是:
the instance of object(unmanaged resource's) how to dispose? i guess it will be disposed automatically(when come out the function),it's right or false ?and ... how to close unmanaged resource ? who can give me a example ???