Q:

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))))

A:

You could use FirstOrDefault as Dominic suggested, but it would return null instead of String.Empty if non of items matched. I would use DefaultIfEmpty to return proper default value:
Dim tags = {"FtpHeader","MailHeader","GoogleHeader","NetworkHeader"}
Dim xCheckTag = tags.Where(Function(tag) Sheet1.Rows.Cast(Of Row)().Any(Function(xTag) xTag.Tag = tag)) _
                    .DefaultIfEmpty(String.Empty) _
                    .First()

