When to dispose and why?

后端 未结 12 1061
臣服心动
臣服心动 2020-12-10 14:20

I asked a question about this method:

// Save an object out to the disk
public static void SerializeObject(this T toSerialize, String filename)
{
           


        
12条回答
  •  鱼传尺愫
    2020-12-10 14:49

    Garbage collector releases all resources, but the time when it does this is undefined. Dispose method provides a way to release unmanaged resources immediately.

提交回复
热议问题