public static void BuildSelectBox() { Dispose.Using <Stream, byte[]> (() => GetStream(), (stream) => new byte[stream.Length].Tee((b) => stream.Read(b, 0, (int)stream.Length))) .Map(Encoding.UTF8.GetString) .Split(new [] { Environment.NewLine, }, StringSplitOptions.RemoveEmptyEntries) .Select((s, ix) => Tuple.Create(ix, s)) .ToDictionary(k => k.Item1, v => v.Item2) .Map(BuildSelectBox("theDoctors", true)) .Tee((s) => Console.WriteLine(s)); }