Check if two generic types are equal
问题 I need to find if a type is a certain generic type. class MyType<T> {} var instance = new MyType<int>(); var type = instance.GetType(); This check does not work, but this is what I want to check. If the type is of that generic type, regardless of what T is. type == typeof( MyType<> ) This does work, but feels dirty. It could also be wrong since it's not the FullName . type.Name == typeof( MyType<> ).Name I'm assuming there is a way to do this, but I haven't found one. Using IsAssignableFrom