简体   繁体   中英

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. I also want to take results[1] and store it in a variable defined as 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]);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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