クラスにハッシュテーブル内にまったく同じ値が含まれていることを確認する方法を知っている人はいますか? 以下のコード例のように、アイテム1とアイテム2をハッシュテーブルと同じに設定しても、「見つかりません」というメッセージが返されます。
public class WebService2 : System.Web.Services.WebService
{
public class Good
{
public string item1="address";
public string item2 ="postcode";
}
[WebMethod]
public string findhome()
{
Dictionary<Color, string> hash = new Dictionary<Color, string>();
Good good = new Good();
hash.Add(new Good() { item1 = "address", item2 = "postcode" },"home");
if (hash.ContainsKey(good))
{
return (string)hash[good];
}
return "not supported";
}
}