When we want to have new objects for some class, and if we already have one, should we use clone() or instantiate using new keyword?
Yes, clone() will have all the members copied as well, but I am curious for a case when this won't matter.
ClassType foo = new ClassType();
ClassType bar = new ClassType(); // here, will foo.clone() be better choice?
I need this in one of my current task as I am working with generic lists (List<
T>
), which get huge at times and are passed through a 'n' tiers before actually being used for UI.(they in between get converted to Array and back to list as well for serialization purpose). So, I was just thinking to better the performance.