IQueryable OfType where T is a runtime Type

后端 未结 7 608
旧巷少年郎
旧巷少年郎 2020-12-14 01:52

I need to be able to get something similar to the following to work:

Type type = ??? // something decided at runtime with .GetType or typeof;
object[] entity         


        
相关标签:
7条回答
  • 2020-12-14 02:52
    Resource[] entityList = context.Resources
                                  .Where(t => t.GetType() == typeof(HumanResource))
                                  .ToArray();
    
    0 讨论(0)
提交回复
热议问题