Posted By

mattcasto on 04/30/10



Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


In & NotIn extension methods

 / Published in: C#

I love creating simple little extension methods like this to make my code read more better.

  1. public static bool In<T>(this T value, params T[] values)
  2. {
  3. return values.Contains(value);
  4. }
  6. public static bool NotIn<T>(this T value, params T[] values)
  7. {
  8. return !In(value, values);
  9. }

Report this snippet  

You need to login to post a comment.