标签:c#
public class ShopItem { public string name; public int count; public int buyPrice; public int sellPrice; public float price; public ShopItem() { } public ShopItem(string _name, int _count, int _buyPrice, int _sellPrice, float _price) { // TODO: Complete member initialization this.name = _name; this.count = _count; this.buyPrice = _buyPrice; this.sellPrice = _sellPrice; this.price = _price; } public override bool Equals(object obj) { if (obj.GetType().Equals(this.GetType()) == false) { return false; } ShopItem tempObj = (ShopItem)obj; return (name.Equals(tempObj.name)) && (count == tempObj.count) && (buyPrice == tempObj.buyPrice) && (sellPrice == tempObj.sellPrice) && (Mathf.Abs(price - tempObj.price) < 0.0001); } }
标签:c#
原文地址:http://blog.csdn.net/lihuozhiling0101/article/details/42963999