zhshqzyc
asked on
Dynamic Linq
Hello, please look at my code, I want to set a condition on the linq.
If column[0].StartsWith("Cont rl") then add 1,
If column[0].StartsWith("Case ") then add 2,
otherwise add -9
How to set where clause here?
Thanks.
var dict = (from line in dataNoDups
let columns=line.Split ('\t')
select new
{
key=columns[0],
value = columns[0]+'\t'+columns[0]+'\t'+"0"+'\t'+"0"+'\t'+ 1 or 2 or -9 }).ToDictionary (p=>p.key ,p=>p.value );
Please note the value needs add "1" or "2" in the last part.If column[0].StartsWith("Cont
If column[0].StartsWith("Case
otherwise add -9
How to set where clause here?
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.