In c++, when we create an array using dynamic memory allocation, we are able to destroy it later on using:

delete [] array;

is the same thing possible in c#? If i create an array in C#, then how do i delete it when i don't need it?

The beauty of C# is that you don't have to worry about that!
Forget Deletes,Disposes and destructors!
C# has something what is called garbage collection which does most of the work for you.
You can not completly igore these things(heavy stuff by the way), but in most cases you can, and believe me that's a great comfort.
If you have done some C++ programming like me, you know what I mean.

The beauty of C# is that you don't have to worry about that!
Forget Deletes,Disposes and destructors!
C# has something what is called garbage collection which does most of the work for you.
You can not completly igore these things(heavy stuff by the way), but in most cases you can, and believe me that's a great comfort.
If you have done some C++ programming like me, you know what I mean.

I certainly agree!! Going by your reply, I should strike out the destructor from my list of function!! LOL

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.