本文介绍了将多个列表添加到单个列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好朋友,
我有3个清单.我想将该3个列表添加到1个列表中.
我可以这样做吗?
我的代码如下.
Hello Friends,
I have 3 List. I want to add that 3 List into 1 list.
Can i do this?
My Code is as below.
List<SMS> _sms = new List<SMS>();
List<Contacts> _contacts = new List<Contacts>();
List<PinCode> _pinCode = new List<PinCode>();
我想将此3个列表添加到
i want to add this 3 list into
List<PhysicalResult> _PhysicalResult = new List<PhysicalResult>();
我尝试过
I tried
_PhysicalResult.AddRange(_contacts);
但它不起作用.
你能帮我吗?
谢谢,
Viprat
But its not working.
Can you please help me?
Thanks,
Viprat
推荐答案
List<dynamic> _PhysicalResult = new List<dynamic>();
_PhysicalResult.AddRange(_contacts);
如果您使用Framework 4.0,则上面的代码将起作用.
如果您希望使用旧版本,则可以使用 List< object> 代替 List< dynamic>
谢谢
Above code will work if you are using Framework 4.0.
If you want it in older version then you can use List<object> instead List<dynamic>
Thanks
这篇关于将多个列表添加到单个列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!