| |
GeekInterview.com > Interview Questions > Microsoft > Basics
| Print | |
Question: Creating list of objects
Answer: Which is better one to follow
1.Creating object every time passing values as a parameters to constructor and add to the list or 2.Create it once i.e, default constructor and assign values to properties and add it to the list
|
| August 08, 2009 07:41:40 |
#1 |
| crazystar |
Member Since: August 2009 Total Comments: 1 |
RE: Creating list of objects |
Supplying parameters to the constructor at the time of object creation to initialize the object fields wil incur lesser cost compared to initialising fields through properties. Reason: Properties are nothing but 'get_' and 'set_' METHODS and therefore incur the method invocation cost wen called. |
| |
Back To Question | |