解决方案 »

  1.   


    static bool ContainsAllChars(string str, string chars)
    {
        var distinctChars = chars.Distinct().ToList();
        return str.Intersect(distinctChars).Count() == distinctChars.Count;
    }
    static  void Main(string[] args)
    {
        bool b = ContainsAllChars("abcde", "aecc");  // true
    }
      

  2.   


    // even better :)
    static bool ContainsAllChars(string str, string chars)
    {
        return new HashSet<char>(chars).IsSubsetOf(str);
    }
      

  3.   

    给个更简单的:            string a = "abcde";
                string b = "affa";
                IEnumerable<char> temp = a.Intersect(b);
                bool isExist =  b.Except(temp).Count() == 0;