Working with generic types in C#