Advertisement
Guest User

spoulson

a guest
Oct 14th, 2008
1,848
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.58 KB | None | 0 0
  1. // Re: http://stackoverflow.com/questions/194930/how-do-i-use-linq-containsstring-instead-of-containsstring#194939
  2.  
  3. static void Main(string[] args) {
  4.    
  5.    var table = new[] {
  6.       new { uid = 1 },
  7.       new { uid = 2 },
  8.       new { uid = 3 },
  9.       new { uid = 4 },
  10.       new { uid = 5 }
  11.    };
  12.  
  13.    var stringarray = new[] { "1", "5", "10" };
  14.  
  15.    var results = from xx in table
  16.                  where stringarray.Contains(xx.uid.ToString())
  17.                  select xx;
  18.  
  19.    foreach (var result in results) {
  20.       Console.WriteLine("Result: " + result.uid.ToString());
  21.    }
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement