2

エラー Error 52 Argument 1: cannot convert from 'System.Collections.Generic.Dictionary>' to 'System.Collections.Generic.IDictionary>' があるのはなぜですか

Dictionary<string, List<string>> tempResultIDList = new Dictionary<string,List<string>>();
test(tempResultIDList);

public bool test(IDictionary<string,IList<string>> a)
  {
            return true;
    }
4

1 に答える 1

2

Dictionary<string, List<string>>IDictionary<string, List<string>>にキャストしようとしているときに実装しますIDictionary<string, *I*List<string>>。のインスタンスを受け入れるメソッドIDictionary<string, IList<string>>などがあるため、許可されていませんが、あなたのメソッドはその入力として受け入れられません。AddIList<string>AddDictionary<string, List<string>>IList<string>

于 2012-02-17T20:35:20.493 に答える