"I can have two methods both have just one parameter, both parameters are generic, but two different types."
Method parameters and generic arguments are different. Either way their names don't matter. Here's a summary of the various cases you may encounter:
public class Class1 {
void OutputResult<TListType>(List<TListType> list) {
}
// this doesn't work, it's really the same method as above
void OutputResult<TListType2>(List<TListType2> list) {
}
// this works, overloading on parameter types
// this is what GetParameters[0].ParameterType == typeof(List<>) is for
void OutputResult<TListType>(Queue<TListType> list) {
}
// this works too, overloading on number of generic arguments
// for this you have GetGenericArguments().Length == 1
void OutputResult<TListType, T2>(List<TListType> list) {
}
}
No comments:
Post a Comment