私は次のようなインターフェースIDictionary
(文字列キーとリスト値を含む)を返そうとしています:
IDictionary<string, ICollection<ValueSet>> method( ...) {
}
メソッドの内部から、Dictionaryオブジェクトを作成します。
var dic = new Dictionary <string, List <ValueSet> >();
すべてうまくいきますが、dic
ここでオブジェクトを返すことはできません。暗黙的に変換することはできません。
どうすればこれを機能させることができますか?
public IDictionary < string, ICollection < ValueSet > > GetValueSets(ICollection < string > contentSetGuids)
{
var dic = new Dictionary < string, List < ValueSet > > ();
using (SqlCommand command = new SqlCommand())
{
StringBuilder sb = new StringBuilder(ValueSet.ValueSetQueryText);
sb.Append(" where contentsetguid ");
sb.Append(CreateInClause(contentSetGuids));
command.CommandText = sb.ToString();
dic = GetObjects(command).GroupBy(vs => vs.ContentSetGuid).ToDictionary(grp => grp.Key, grp => grp.ToList());
}
return dic;
}
エラー:エラー46タイプ'System.Collections.Generic.IDictionary>'を'System.Collections.Generic.IDictionary>'に暗黙的に変換できません。明示的な変換が存在します(キャストがありませんか?)