C#: minor refactoring