C# improvement