、私は次のサンプルのキーと値のペアでIEnumerable<KeyValuePair<string, string>>
オブジェクトを作成する必要があります。C#でIEnumerable <KeyValuePair <文字列、文字列>>オブジェクトを作成しますか?テスト目的のために
Key = Name | Value : John
Key = City | Value : NY
これを行うための最も簡単な方法は何ですか?
values = new Dictionary<string,string> { {"Name", "John"}, {"City", "NY"} };
又は
values = new [] {
new KeyValuePair<string,string>("Name","John"),
new KeyValuePair<string,string>("City","NY")
};
または:の
を、あなたは 'のIEnumerable>'を作成しますか?どのデータソースからですか? –
初期のデータ構造は問題ではありません。任意のデータソースを使用できます。唯一の要件は、上記のキー値のペアでIEnumerableを持つことです。 –