// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Linq; namespace E { public class Program { public static void Main(string[] args) { string[] allowed = { "gif", "jpg", "jpeg", "bmp", "png" }; Console.WriteLine(allowed.Contains("bmp")); Console.WriteLine(allowed.Contains("foo")); Console.WriteLine(Array.IndexOf(allowed, "bmp")>0); Console.WriteLine(Array.IndexOf(allowed, "foo")>0); Console.WriteLine(Array.Exists(allowed, (string s) => s == "bmp")); Console.WriteLine(Array.Exists(allowed, (string s) => s == "foo")); } } }