如何将列表转换为列表 [英] How Do I Cast A List To List
本文介绍了如何将列表转换为列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想这样做。
I want to do this.
List <object> GetAllFoo()
{
List <Customer> abc = new List <Customer>();
abc = _dataObject.SelectAllFoo();
return abc as List<object>;
}
我可以返回List< object>代替列表< foo>?
提前感谢您的帮助
Ho can i will be able to return a List<object> instead of List<foo>?
Thanks in advance for help
推荐答案
参考:
http://stackoverflow.com/questions/588524 / return-unknown-generic-listt [ ^ ]
http://stackoverflow.com/questions/8016233/in-c-how-do-i-call-a-function-that-is-returning-a-list [ ^ ]
这可能会有所帮助。
Refer:
http://stackoverflow.com/questions/588524/return-unknown-generic-listt[^]
http://stackoverflow.com/questions/8016233/in-c-how-do-i-call-a-function-that-is-returning-a-list[^]
This may help.
而不是list< object>尝试列表< customer>并返回相同,因为它已经是已知对象
instead list<object> try list<customer> and return the same because it is already known object
这篇关于如何将列表转换为列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文