Keon said:
When you create an instance of a class, do you have to delete the
instance after you are finished with it? I can't seem to find any
information dealing with that. All I see is create the instance and
thats it.
Thanks
Keon
This is a very important and interesting question.
From the annals and history of computing,
memory allocation comes in different flavors.
1. Direct allocation. (remember malloc(int), anyone? *s*)
2. Reference Counting (The horrors of COM and IUnknown *s*)
3. Garbage Collecting (meow!)
4. GC + IDisposable (meow?)
Typically in .NET, all your references are fire-and-forget.
But not always. You really need to learn about reference types (classes) and
value types (structs) and why the latter is never/can't be Garbage
Collected.
Then you really must understand the IDisposable.Dispose() method and its
use. And the C# syntactic suggar using using.
Sit Vis Nobiscum
- Michael Starberg