Skip to main content

Posts

Showing posts from January, 2009

Default Constructors

A default constructor is one with no parameters. If you don't provide one for your class, the compiler will create on default constructor for your class. However if you do provide a constructor with or without any parameters then the compiler doesn't create a default constructor for you.

Implicit Dispose and using statement

In C# you can make sure Dispose is always called for an object, if the object is created within using statment for e.g using(Font onefont = new Font("Courier") { //do something } When the using blocks end, Dispose on the Font will be called automatically. Even if there is exception while creating the object or within the using block, Dispose method will still be called. An implicit finallt block is created for you.