Code guard in c#