Are unused properties causing overhead?

Suppose we had a generated class with a lot of redundant accessories. They are just accessors, they are not fields. They are not called anywhere. They just sit being redundant and ugly.

For instance:

public class ContrivedExample
{
    public int ThisOneIsUsed { get; set; }

    public int ThisOneIsNeverCalled0 { get { /* Large amounts of logic go here, but is never called. */ } }
    public int ThisOneIsNeverCalled1 { get { /* Large amounts of logic go here, but is never called. */ } }
    public int ThisOneIsNeverCalled2 { get { /* Large amounts of logic go here, but is never called. */ } }
    //...
    public int ThisOneIsNeverCalled99 { get { /* Large amounts of logic go here, but is never called.*/ } }
}

ContrivedExample c = new ContrivedExample() { ThisOneIsUsed = 5; }

The only costs I can think of is that this will make the DLL bigger. I expect there will be penalties during execution time.

Does this cause other overhead? Even tiny overhead of any kind?

+3
source share
1 answer

, . , - , .

JIT .

( , ).

, , , , , , .

+7

All Articles