protected override void Dispose( bool disposing )
        {
            if( disposing )
            {
                if(components != null)
                {
                    components.Dispose();
                }
            }
            base.Dispose( disposing );
        }

I new nothing, what this code is doing in this project. I am familiarizing myself with am application to send and receive SMS from GSM modem. Meanwhile I encountered this code. Don't know what is effect of this code. Any help..please
Thanks

Recommended Answers

All 2 Replies

Basically (if I remember my C# theory right) that's basically just the deconstructor for classes within your project.

Essentially when you drop something (close a form, exit the application, anything that ends the use of objects within the project) it calls for a disposal of that object.

The code snippet you've supplied basically says that when you call Dispose on an object it checks to see if there are any components active within the object. If there are it disposes of them first and then disposes of the object itself.

Basically just trash management :)

I could be completely wrong tho, been a couple years since I bothered reading the code theory part of my texts and that particular snippet is usually buried in the code-behind-the-code-behind :P

Thanks buddy.. It helped me a lot.

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.