Is Code of methods for different object of same class present in executable?

If I create an array of 10 objects of class A, will the object methods be present (in the assembly) 10 times for each object or just single instance of the method code which will work for the different data of the different objects?

Jon Skeet
people
quotationmark

No, the code belongs to the class, and will only be represented once. The array and the objects don't even exist until execution time - given that the size of the array could vary, the executable file couldn't possibly contain the code duplicated "enough" times.

Bear in mind that the code itself stays the same for all objects - it would be pointless to duplicate the code even in memory, let alone in the file. (There are some cases where JITted code could potentially vary to take account of inlining differences between base classes and derived classes, but that doesn't happen with the Microsoft CLR as far as I'm aware.)

people

See more on this question at Stackoverflow