tags:

views:

40

answers:

2
   var yCols = from t in flowPath
                select new {checkPoint = t["CheckPoint"]};
    var test = from x in operations
               where x["Ops"] = "test" && x["check"].Contains(yCols.Select(y=>y.Variable))

Somehow the contains in where clause part is not right.yCols returns Collection of Checkpoints and if x["Check"] contains any of the values then retrieve the value.Whats the best way to do this.

A: 
].Contains(yCols.Select(y=>y.checkPoint)) .It's not "y.Variable" but "y.checkPoint"
DeveloperCSharp
A: 
IEnumerable<string> yCols =
  from t in flowPath 
  select t["CheckPoint"];

IEnumerable<Operation> test =
  from x in operations 
  where x["Ops"] == "test" && yCols.Contains(x["check"])
  select x;
  • Your code is more clear if you don't use var.
  • Use == to compare and = to assign. Don't use = in where.
  • Items don't contain collections. Collections contain items.
David B