static void SetLevel(Guitar guitar) { // Possible race const int MaxLevel = 11; if (guitar.Amp.Level < MaxLevel) { guitar.Amp.Level = MaxLevel; } }
static void SetLevel2(Guitar guitar) { const int MaxLevel = 11; // Better var amp = guitar.Amp; if (amp.Level < MaxLevel) { amp.Level = MaxLevel; } }