In
public static bool In<T>(this T value, IEnumerable<T> values) { if(values == null) throw new ArgumentNullException("values"); return values.Contains(value); }Example:
int[] numbers = {1, 2, 3, 4 }; int a = 3; if(a.In(numbers)) { ... }
Description
Determines whether a IEnumerable<T> contains a specific value
Details
- Author: Lucas
- Submitted on: 7-3-2008 21:07:19
- Language: C#
- Type: System.Object
- Views: 2426
Double click on the code to select all.