c#两个数组对比取出相同的元素输出

 string strNew = "";
        string m = "朱雅君,姚怡尔,涂静,";
        string n = "姚怡尔,涂静,刘刚";

        string[] A = m.Split(',');
        string[] B = n.Split(',');
        //var reNew = (from a in A select a).Intersect(from b in B select b).ToArray();
        var reNew = from s in A where B.Contains(s) select s;

        foreach (var v in reNew)
        {
            strNew+=v.ToString()+",";
        }
        Response.Write(strNew);

posted @ 2012-03-31 17:03  你妹的sb  阅读(684)  评论(0编辑  收藏  举报
百度一下