【发布时间】:2014-08-22 13:26:30
【问题描述】:
我相当肯定这是可能的,而且我认为这很简单,只是我不知道在 Google 中提问的正确方法。我想要做的是将type 传递给一个方法并返回该类型的对象列表。像这样:
public List<T> GetComponentsOfType(Type thisType)
{
return Components.OfType<thisType>().ToList();
}
这当然不会编译,因为我不知道自己在做什么。
【问题讨论】: