如何处置mYClass [英] how to dispose mYClass
本文介绍了如何处置mYClass的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用C#进行编程。
我想节省内存,所以我想在runnig期间处理不必要的类,并在需要时创建它。
你能帮忙吗?我
解决方案
关于IDisposable的代码项目文章:
正确实现IDisposable和Dispose模式 [ ^ ]
您将找到所有需求。
从IDisposable接口继承您的类并实现其Dispose()函数之后您创建类的对象/实例然后使用像这样使用Block
使用(myclass ob = new myclass)
{
}
您好,请尝试使用ob ject序列化,请检查此站点:
对象使用C#进行序列化 [ ^ ]
I use C# for programming.
I want to save memory so i want to dispose unnecessary class during runnig and create it when I need it.
can you help me
解决方案
A code project article about IDisposable :
Implementing IDisposable and the Dispose Pattern Properly[^]
You will find all your needs.
Inherit you class from IDisposable interface and implements its Dispose() function after that you ever you create object/instance of your class then make use of Using Block like this
Using(myclass ob=new myclass)
{
}
Hi, Try using object serialization, check this site:
Object serialization using C#[^]
这篇关于如何处置mYClass的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文