Don't like ads? PRO users don't see any ads ;-)

c# strings

By: om_gan on Mar 25th, 2012  |  syntax: None  |  size: 0.38 KB  |  hits: 20  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. x = {1,2,3,4,5,6}
  2. y = {3,4}
  3. z = {6,7}
  4.        
  5. var x = new HashSet<int>(Enumerable.Range(1,6)); // [1,2,3,4,5,6]
  6. var y = Enumerable.Range(1,3); // [1,2,3]
  7. var z = Enumerable.Range(6,2); // [6,7]
  8. x.IsSupersetOf(y); // true
  9. x.IsSupersetOf(z); // false
  10.        
  11. if(y[0] <= x[x.length-1])
  12.     //binary search in array x for y[y.length-1]
  13.     //if that is true u can say that y in x else false.