Thursday, 29 August 2013

multiple condition in single linq

multiple condition in single linq

I am iteration through the control which is having multiple rows and each
row having a tag and just implemented the following linq. Can i optimize
the following queries into single one?
Dim xCheckTag As String = If((From xTag As Row In Sheet1.Rows Where
xTag.Tag = "FtpHeader").ToArray.Length > 0, "FtpHeader", _
If((From xTag As Row In Sheet1.Rows Where
xTag.Tag = "MailHeader").ToArray.Length > 0,
"MailHeader", _
If((From xTag As Row In Sheet1.Rows Where
xTag.Tag = "GoogleHeader").ToArray.Length > 0,
"GoogleHeader", _
If((From xTag As Row In Sheet1.Rows Where
xTag.Tag = "NetworkHeader").ToArray.Length >
0, "NetworkHeader", String.Empty))))

No comments:

Post a Comment