当前位置: 首页>>代码示例>>C#>>正文


C# Item.Equals方法代码示例

本文整理汇总了C#中Item.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Item.Equals方法的具体用法?C# Item.Equals怎么用?C# Item.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Item的用法示例。


在下文中一共展示了Item.Equals方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RemoveItem

 ///<summary>
 ///Удаляет Item из списка ItemsInInventory
 ///</summary>
 public void RemoveItem(Item item)
 {
     for(int i = 0; i < ItemsInInventory.Count; i++)
     {
         if(item.Equals(ItemsInInventory[i]))
         {
             ItemsInInventory.RemoveAt(item.ItemStartNumber);
         }
     }
 }
开发者ID:gjrfytn,项目名称:planet-survival,代码行数:13,代码来源:Inventory.cs

示例2: deleteItemFromInventoryWithGameObject

    public void deleteItemFromInventoryWithGameObject(Item item)
    {
        for (int i = 0; i < ItemsInInventory.Count; i++)
        {
            if (item.Equals(ItemsInInventory[i]))
            {
                ItemsInInventory.RemoveAt(i);
            }
        }

        for (int k = 0; k < SlotContainer.transform.childCount; k++)
        {
            if (SlotContainer.transform.GetChild(k).childCount != 0)
            {
                GameObject itemGameObject = SlotContainer.transform.GetChild(k).GetChild(0).gameObject;
                Item itemObject = itemGameObject.GetComponent<ItemOnObject>().item;
                if (itemObject.Equals(item))
                {
                    Destroy(itemGameObject);
                    break;
                }
            }
        }
    }
开发者ID:MadBanny,项目名称:planet-survival,代码行数:24,代码来源:Inventory.cs

示例3: getPositionOfItem

 public int getPositionOfItem(Item item)
 {
     for (int i = 0; i < SlotContainer.transform.childCount; i++)
     {
         if (SlotContainer.transform.GetChild(i).childCount != 0)
         {
             Item item2 = SlotContainer.transform.GetChild(i).GetChild(0).GetComponent<ItemOnObject>().item;
             if (item.Equals(item2))
                 return i;
         }
     }
     return -1;
 }
开发者ID:MadBanny,项目名称:planet-survival,代码行数:13,代码来源:Inventory.cs

示例4: deleteItem

 public void deleteItem(Item item)
 {
     for (int i = 0; i < ItemsInInventory.Count; i++)
     {
         if (item.Equals(ItemsInInventory[i]))
             ItemsInInventory.RemoveAt(item.indexItemInList);
     }
 }
开发者ID:MadBanny,项目名称:planet-survival,代码行数:8,代码来源:Inventory.cs

示例5: deleteItemFromInventory

 public void deleteItemFromInventory(Item item)
 {
     for (int i = 0; i < ItemsInInventory.Count; i++)
     {
         if (item.Equals(ItemsInInventory[i]))
             ItemsInInventory.RemoveAt(i);
     }
 }
开发者ID:MadBanny,项目名称:planet-survival,代码行数:8,代码来源:Inventory.cs

示例6: Equals_caseInsensitive_returnsTrue

 public void Equals_caseInsensitive_returnsTrue() {
     Item item = new Item("Apple");
     Assert.IsTrue(item.Equals(new Item("APPLE")));
 }
开发者ID:mtqtran8182,项目名称:checkout,代码行数:4,代码来源:ItemTests.cs

示例7: Equals_compareWithNull_returnsFalse

 public void Equals_compareWithNull_returnsFalse() {
     Item item = new Item("Apple");
     Assert.IsFalse(item.Equals(null));
 }
开发者ID:mtqtran8182,项目名称:checkout,代码行数:4,代码来源:ItemTests.cs

示例8: Equals_compareWithNotEqual_returnsFalse

 public void Equals_compareWithNotEqual_returnsFalse() {
     Item item = new Item("Apple");
     Assert.IsFalse(item.Equals(new Item("Bananas")));
 }
开发者ID:mtqtran8182,项目名称:checkout,代码行数:4,代码来源:ItemTests.cs

示例9: Equals_notSameObject_returnsFalse

 public void Equals_notSameObject_returnsFalse() {
     Item item = new Item("Apple");
     Assert.IsFalse(item.Equals("Apple"));
 }
开发者ID:mtqtran8182,项目名称:checkout,代码行数:4,代码来源:ItemTests.cs

示例10: Item2Path

		// 由item得到path
        // parameters:
		//      itemRoot    根item
		//      item        给定的item
		//      strPath     out参数,返回item的path
        // return:
        //      -1  出错
        //      0   成功
		public static int Item2Path(ElementItem itemRoot,
			Item item,
			out string strPath)
		{
			strPath = "";
			if (itemRoot == null)
				return -1;
			if (item == null)
				return -1;


			Item itemMyself;
			Item itemTemp;

			int nIndex;


			//当为属性节点时,加了属性path字符串
			string strAttr = "";
			if (item is AttrItem )  
			{
				strAttr = "/@" + item.Name;
				item = item.parent ;
			}

			while(item != null)
			{
				//与根节点相等
				if (item.Equals(itemRoot) == true)
					break;

				itemMyself = item;
				item = item.parent;

				if (item == null)
					break;
				
				itemTemp = null;
				if (item is ElementItem 
					&& ((ElementItem)item).children != null)
				{
					itemTemp = ((ElementItem)item).children[0];
				}

				nIndex = 1;

				while(itemTemp != null)
				{
					if (itemTemp.Equals(itemMyself) == true)
					{
						if (strPath != "")
							strPath = "/" + strPath;

						strPath = itemMyself.Name + "[" + System.Convert.ToString(nIndex) + "]" + strPath;
						
						break;
					}

					if (itemTemp.Name == itemMyself.Name)
						nIndex += 1;
					
					itemTemp = itemTemp.GetNextSibling();
				}
			}

			strPath = strPath + strAttr;

			if (strPath == "")
				return 0;
			else
				return 1;
		}
开发者ID:renyh1013,项目名称:dp2,代码行数:80,代码来源:ItemUtil.cs

示例11: DropToItem

 public override bool DropToItem( Mobile from, Item target, Point3D p, byte gridloc )
 {
     //Comprobamos si el cachivache está colocado
     if ( ( m_brain != BrainTypes.Brain_None ) && ( target.Equals( Bolsa ) ) )
     {
         PlagueBeastLord PBL = Bolsa.Parent as PlagueBeastLord;
         Point3D p2 = BrainSlot[(int) m_brain];
         if ( ( ( p2.X ) <= p.X ) && ( p.X <= ( p2.X + 5 ) )
              && ( ( p2.Y ) <= p.Y ) && ( p.Y <= ( p2.Y + 5 ) ) )
         {
             PBL.ColocarCerebro( (int) m_brain - 1, true );
             Movable = false;
             from.LocalOverheadMessage( MessageType.Regular, 0x66B, false, Plague_Texts.Line[7] );
         }
         else { PBL.ColocarCerebro( (int) m_brain - 1, false ); }
     }
     return ( ( target.Equals( Bolsa ) ) && p.X != -1 && p.Y != -1 && base.DropToItem( from, target, p, gridloc ) );
 }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:18,代码来源:PlagueBrain.cs

示例12: Update

        /// <summary>
        /// Update Item data to Item Table according to the Item Parameter
        /// Return Constants.DB_STATUS
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public Constants.DB_STATUS Update(Item item)
        {
            Constants.DB_STATUS status = Constants.DB_STATUS.UNKNOWN;

            try
            {
                itemObj = inventory.Items.Where(iObj => iObj.Id == item.Id).First();
                if(!itemObj.Equals(null))
                {
                    Employee createdBy = inventory.Employees.Where(eObj => eObj.Id == item.CreatedBy.Id).First();
                    itemObj.ItemCategoryId = item.ItemCategoryId;
                    itemObj.Description = item.Description;
                    itemObj.ReorderLevel = item.ReorderLevel;
                    itemObj.ReorderQty = item.ReorderQty;
                    itemObj.Cost = item.Cost;
                    itemObj.UnitOfMeasureId = item.UnitOfMeasureId;
                    itemObj.CreatedDate = item.CreatedDate;
                    itemObj.CreatedBy = createdBy;
                    inventory.SaveChanges();
                    status = Constants.DB_STATUS.SUCCESSFULL;
                }
            }
            catch (Exception e)
            {
                status = Constants.DB_STATUS.FAILED;
            }

            return status;
        }
开发者ID:Soulrequiem,项目名称:final-project-whereever-whatever,代码行数:35,代码来源:ItemBroker.cs


注:本文中的Item.Equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。