Thursday, June 25, 2009

Things to remember Always

1. If you don't specify the access modifier for a class, by default it is considered as internal. 

2. Interface members are always public. 

3. The need of a private constructor is when we want to make a class not be instantiated. So, this can be only helpful where statics members are there in a class.

4. Static classes are abstract and sealed which prevents them to be instantiated.

Tuesday, June 9, 2009

Deep Copy vs Shallow Copy

A shallow copy creates a new instance of the same type as the originalobject, and then copies the non-static fields of the original object. If thefield is a value type, a bit-by-bit copy of the field is performed. If thefield is a reference type, the reference is copied but the referred objectis not; therefore, the reference in the original object and the reference inthe clone point to the same object. In contrast, a deep copy of an objectduplicates everything directly or indirectly referenced by the fields in theobject.