私はKeyValuePairを返すWCF Webサービスを持っています。すなわち:WCFのKeyValuePair - ASP.Net経由でのコンバージョンエラー
System.Collections.Generic.KeyValuePair<System.Collections.Generic.KeyValuePair<System.String,System.Int32>>
そうthatsの良いとダンディ:私はWCFテストクライアントでこれをテストする場合
List<KeyVauePair<string,int>>
それが返されるタイプがあると言います。私はその後を経由してASP.NetでこのWebメソッドを消費するために行く:
List<KeyValuePair<string, int>> testkv = WCF.GetOptionSetValues("contact", "types");
しかし、これは動作しないと、コンパイラは言う:
が暗黙的に[]型System.Collections.Generic.KeyValuePairを変換できません。 System.Collections.Generic.List System.Collections.Generic.KeyValuePair
コンパイラがWebメソッドからの戻り値の型があると考えているようだいくつかの理由:
System.Collections.Generic.KeyValuePair[]
しかし、配列ではありません。そのA:コンパイラは[]の代わりにKeyValuePairのKeyValuePairとしてWebメソッドを解釈している理由
System.Collections.Generic.KeyValuePair
私は疑問に思って?