简体   繁体   English

从列表中获取值<IEnumerable>

[英]Getting Values out of List<IEnumerable>

I want to extract the two independent results set from a stored procedure execution into variables.我想从存储过程执行中提取两个独立的结果集到变量中。 I am using the following code to execute the stored procedure.我正在使用以下代码来执行存储过程。

         var results = new RulesEngine2()
         .MultipleResults("[re].[spShift]", Params)
         .With<ResidentShift>()
         .With<ResidentHours>()
         .Execute();

What I want is to take results[0] and store it in a variable defined as ResidentShift.我想要的是获取 results[0] 并将其存储在定义为 ResidentShift 的变量中。 I also want to take results[1] and store it in a variable defined as ResidentHours.我还想获取 results[1] 并将其存储在定义为 ResidentHours 的变量中。

Help is definitely appreciated!绝对感谢帮助!

(ResidentShift temp, ResidentHours temp2) = results.Select(t => (t[0], t[1]));

Try this.尝试这个。

Its hard to know how to extract information if the type of results is unknown.如果结果类型未知,很难知道如何提取信息。 But something similar to this will also work.但与此类似的事情也将起作用。

(ResidentShift temp, ResidentHours temp2) = (results[0], results[1]);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM