c# - Class in a list -


i understand in c# class passed reference. mean when store said class in list stored reference well, or better said c# style "pointer" of sorts? mean list n elements of class not take memory n times size of class n times size of reference class?

or thinking wrong?

you're right.

if create n elements of class t, , class t uses, say, 10 bytes, takes on order of 10*n memory.

if store in list<t>, still have 10*n memory objects, plus n times size of c# reference , list overhead. if store same elements in 2 lists, have 10*n objects, plus 2*n references, , 2 times list overhead. they're pointing @ same underlying objects.


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -