这个问题是寻求技术帮助来投影可枚举以满足指定条件。
说,
一个球包含两个红球和三个蓝球。根据以下条件,我必须选择球。
(i) Each pair should contain one blue ball and one red ball
(ii) if the ball is "Blue1" ignore it
预期的结果是
{"Blue2","Red1" }
{"Blue2","Red2" }
{"Blue3","Red1" }
{"Blue3","Red2" }
只是我想完成以下代码来投影结果。
var bag = new[] { "Red1", "Red2", "Blue1", "Blue2", "Blue3" };
var BallsProjection =
from blueball in bag
from redball in bag
**(What is the condition required here to select the balls)**
select new { ball1 = blueball, ball2 = redball };