Hi.
How do I add conditional commands (if then structure) to a chain of LINQ vb.net code?
[Sample if then code]
if TextArray.contains("c") then
TextArrayResult = TextArray.AsEnumerable().Takewhile(Function(x) NOT x.contains("c")).ToArray()
elseif TextArray.contains("d") then
TextArrayResult = TextArray.AsEnumerable().Takewhile(Function(y) NOT y.contains("d")).ToArray()
else
TextArrayResult = TextArray
end if
[Test variables with results to the sample code]
1. Inputing TextArray ={"a","b","c","d","e"} gives TextArrayResult = {"a","b"}
2. Inputing TextArray ={"a","d","e"} gives TextArrayResult = {"a"}
3. Inputing TextArray ={"a","b","e"} gives TextArrayResult = {"a","b","e"}
[Desired: an equlivalent 1-line vb.net code preferably in LINQ style]
TextArrayResult = TextArray.AsEnumerable()...