非托管资源应该是不由framework run tiem管理的资源吧

解决方案 »

  1.   

    楼主理解的应该没什么大偏差
    c#的任何类型都是类,包括int,double。。所以它们当然也有析构函数
    析构函数本身并不能释放,它你给你一个和对象吻别的机会罢了
      

  2.   

    你所指的被系统回收,应该是指被GC回收吧!但GC只能回收Managed资源
    不可能回收UnManaged资源。
    对于int, doulbe类型. .NET会Box成为System.Int32 成为Managed 
    最后由GC回收。
      

  3.   

    楼上的回答显然不对吧,BOX后的引用类型是另外分配的,对它的任何修改不影响原来的值类型的值,因为装箱后的引用类型作用只是调用而已,不能修改,这可是<<C#高级编程>>上描述的
      

  4.   

    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.
      

  5.   

    上面说的倒是和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 ???
      

  6.   

    you normally call those resource objects' Close() method