Click here to Skip to main content
15,662,906 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Share this answer
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)

Share this answer
Hi, Try using object serialization, check this site:
Object serialization using C#[^]
Share this answer
CPallini 26-Sep-13 5:15am    
What has to do Serialization with the OP question?
raju dasa 26-Sep-13 6:07am    
He wanted to save memory (object be serialized), so that he can later recreate it on demand, thats what i understood. If thats not the case, it atleast gives him an idea.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900