Link to home
Start Free TrialLog in
Avatar of zhshqzyc
zhshqzyc

asked on

Dynamic Linq

Hello, please look at my code, I want to set a condition on the linq.
                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 );

Open in new window

Please note the value needs add "1" or "2" in the last part.
If column[0].StartsWith("Contrl")  then add 1,
If column[0].StartsWith("Case")   then add 2,
otherwise add -9

How to set where clause here?
Thanks.
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial