LINQ查询ArrayList

Console.WriteLine("查询ArrayList\r\n");
            ArrayList alist = new ArrayList();
            alist.Add("say");
            alist.Add(123);
            alist.Add("hear");
            alist.Add("look");

            //指定过滤类型 ofType<数据类型>()
            var childarr = from st in alist.OfType<int>() select st;
            foreach (var item in childarr)
            {
                Console.WriteLine(item);
            }

你可能感兴趣的:(LINQ查询ArrayList)