の実例がありDictionary<string, int>
ます。を a に設定しDictionary
てprivate Dictionary
値を確認する必要があります。
現在私は持っています:
protected void btnSubmit_Click(object sender, EventArgs e)
{
Dictionary<string, int> docTypeValue = new Dictionary<string, int>();
docTypeValue.Add("OSD", 1);
docTypeValue.Add("POD", 2);
docTypeValue.Add("REC", 3);
docTypeValue.Add("CLAINF", 4);
docTypeValue.Add("RATE", 5);
docTypeValue.Add("OTHER", 6);
docTypeValue.Add("CARINV", 7);
docTypeValue.Add("PODDET", 8);
docTypeValue.Add("BOLPO", 9);
litText.Text = docTypeValue[txtDocType.Text].ToString();
}
これは期待どおりに機能します。プロパティを使用する必要がありますか? すなわち下
private Dictionary<string, int> DocTypeValue
{
get;
set;
}
上記のものをリファクタリングして、提案されたものを作成するにはどうすればよいprivate Dictionary
ですか?