Generics and type inference - C#