J
J2EE Convert
Hello,
Sorry if this has already been beaten to death. However, I was not
able to find the answer in my searches. Is there any performance trade
off between creating and using a generic list of a Class Type and a
generic list of a Struct Type assuming both types are the same save
for one being a structure and one being a class. See below.
List<StructA> mList;
List<ClassA> mList;
Assuming that ClassA and StructA are exactly the same see below.
//Each type has 2 strings and a getter property for each string.
string mFirstName;
string mLastName;
My initial thought was this is a good use for a structure however I am
not sure what the implications of adding such a structure to a generic
list is. Is there any overhead with moving the structure from the
stack to heap since it is now contained within a reference type etc..
I know it may be a crappy example but I am trying to get my head
around it.
PD
Sorry if this has already been beaten to death. However, I was not
able to find the answer in my searches. Is there any performance trade
off between creating and using a generic list of a Class Type and a
generic list of a Struct Type assuming both types are the same save
for one being a structure and one being a class. See below.
List<StructA> mList;
List<ClassA> mList;
Assuming that ClassA and StructA are exactly the same see below.
//Each type has 2 strings and a getter property for each string.
string mFirstName;
string mLastName;
My initial thought was this is a good use for a structure however I am
not sure what the implications of adding such a structure to a generic
list is. Is there any overhead with moving the structure from the
stack to heap since it is now contained within a reference type etc..
I know it may be a crappy example but I am trying to get my head
around it.
PD