Is it possible to use "implicit" type type parameters in C #
If you use a generic type, you tell the compiler that you are going to provide the actual type when creating a particular instance. With your code, if you tried to do
Source<string> s = new Source<string>(); the compiler would know that T is actually a string in the class, but you are not giving the compiler any information about what X will be. However, depending on what you want to do, you can use the has connection with a bare-type interface instead of using inheritance. The following code compiles, for example:
public interface ISomeInterface<X> { void SomeMethod(X someparam); } public class Source<T> { public void MyMethod<X>(ISomeInterface<X> someConcreteInstance) where X:T { } }