How to compare two strings in same column using Linq?

I have two string which i have to iterate through linq ?

I have status as column and its having row value of

     Status
    --------
    Int
    String
    Boolean
    Char
    Float

LINQ

 var result = from desc in result
 where desc.Status == "string" && desc .Status == "Int"
 select desc ;

How to achieve this .. I have tried but it returns empty. If i try with single check its working correctly.

Upvotes: 0

Views: 867

Answers (2)

nevra
nevra

Reputation: 428

var result = from desc in result
             where new[] {"Int","String","Boolean","Char","Float"}.Contains(desc.Status)
                         select desc ;

Upvotes: 1

Satpal
Satpal

Reputation: 133403

You need to use || operator

where desc.Status == "string" || desc .Status == "Int"

Upvotes: 5

Related Questions