多くの冗長なアクセサーを持つ生成されたクラスがあるとします。それらは単なるアクセサーであり、フィールドではありません。彼らはどこにも呼ばれません。彼らはただそこに座って冗長で醜いです。
例えば:
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; }
私が考えることができる唯一のオーバーヘッドは、.DLL が大きくなることです。実行時のペナルティがゼロになることを期待しています。
これにより、他のオーバーヘッドが発生しますか? どんな種類の小さなオーバーヘッドでも?