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


C# Vegetable类代码示例

本文整理汇总了C#中Vegetable的典型用法代码示例。如果您正苦于以下问题:C# Vegetable类的具体用法?C# Vegetable怎么用?C# Vegetable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Main

        static void Main(string[] args)
        {
            var produce = new List<object>();

            var f1 = new Fruit("Apple",8.5,3);
           // f1.Name = "Apple";
           // f1.Weight = 4.6;
           // f1.Quantity = 3;
            produce.Add(f1);

            var f2 = new Vegetable();
            f2.Name = "Bananna";
            f2.Weight = 4.9;
            f2.Quantity = 7;
            produce.Add(f2);

            produce.Add(new Vegetable());
            ((Vegetable)produce[2]).Name = "Carrot";
            ((Vegetable)produce[2]).Weight = 9.6;
            ((Vegetable)produce[2]).Quantity = 14;

            Console.WriteLine("There are "+produce.Count+" items");

            foreach (var item in produce)
            {
                Console.WriteLine(item);
            }

        }
开发者ID:asenAce,项目名称:Software_University_Bulgaria,代码行数:29,代码来源:Program.cs

示例2: Add

 /// <summary>
 /// Puts the vegetable in the <see cref="Kitchen.Utensil"/>.
 /// </summary>
 /// <param name="vegetable">The vegetable.</param>
 /// <returns>The result of the action.</returns>
 public string Add(Vegetable vegetable)
 {
     return string.Format(
         "Put the {0} in the {1}.\r\n" +
         "(\"Double, double toil and trouble;\r\nFire burn, and cauldron bubble.\")",
         vegetable,
         this);
 }
开发者ID:Nottyy,项目名称:TelerikAcademy,代码行数:13,代码来源:Utensil.cs

示例3: Cut

        private void Cut(Vegetable vegetable)
        {
            if (vegetable == null)
            {
                throw new ArgumentNullException("Vegetable cannot be null");
            }

            vegetable.IsCut = true;
        }
开发者ID:antonpopov,项目名称:HighQualityCode,代码行数:9,代码来源:Chef.cs

示例4: Add

 public void Add(Vegetable vegetable)
 {
     if (vegetable.IsPeeled && vegetable.IsCut)
     {
         this.Content.Add(vegetable);
     }
     else
     {
         throw new ArgumentException("The vegetable shoud be peeled and cut.");
     }
 }
开发者ID:vasilkrvasilev,项目名称:QualityCode,代码行数:11,代码来源:Bowl.cs

示例5: Cook

    public void Cook(Vegetable vegetable)
    {
        vegetable = this.GetVegetable();

        this.Peel(vegetable);

        this.Cut(vegetable);

        Bowl bowl = this.GetBowl();
        bowl.BowlList.Add(vegetable);
    }
开发者ID:veselaparvanova,项目名称:HighQualityCode,代码行数:11,代码来源:Chef.cs

示例6: Cook

    // Methods
    public void Cook(Vegetable item)
    {
        this.Peel(item);
        this.Cut(item);

        // Creating bowl
        Bowl bowl = this.GetBowl();

        // Adding the peeled and cut vegies
        // to the bowl
        bowl.AddVegetables(item);
    }
开发者ID:RamiAmaire,项目名称:TelerikAcademy,代码行数:13,代码来源:Chef.cs

示例7: AddVegetable

 public void AddVegetable(Vegetable veg,Vector2 vegPosition)
 {
     if (vegPosition.x < 0 || vegPosition.x > 2 || vegPosition.y < 0 || vegPosition.y > 2) {
         Debug.LogError ("<color=green>WRONG VEGETABLE POSITION</color>");
         return;
     }
     else {
         VegetableBoard[(int)vegPosition.x,(int)vegPosition.y] = (Vegetable)Instantiate(veg);
         VegetableBoard[(int)vegPosition.x,(int)vegPosition.y].transform.SetParent(this.gameObject.transform);
         VegetableBoard[(int)vegPosition.x,(int)vegPosition.y].transform.localPosition = new Vector3(vegPosition.x * 3, 0, vegPosition.y * 3);
     }
 }
开发者ID:j3lackfire,项目名称:AnimalTown,代码行数:12,代码来源:FarmStack.cs

示例8: Cook

        public void Cook(Vegetable vegetable)
        {
            Potato potato = new Potato();
            potato.Peel();
            potato.Cut();

            Carrot carrot = new Carrot();
            carrot.Peel();
            carrot.Cut();

            Bowl bowl = new Bowl();
            bowl.Add(potato);
            bowl.Add(carrot);
        }
开发者ID:svetlilaloli,项目名称:High-Quality-Code,代码行数:14,代码来源:Chef.cs

示例9: Cook

        public void Cook(Vegetable vegetable)
        {
            Potato potato = this.GetPotato();
            Carrot carrot = this.GetCarrot();

            this.Peel(potato);
            this.Peel(carrot);

            this.Cut(potato);
            this.Cut(carrot);

            Bowl bowl = this.GetBowl();
            bowl.Add(carrot);
            bowl.Add(potato);
        }
开发者ID:Vyara,项目名称:Telerik-High-Quality-Code-Homeworks,代码行数:15,代码来源:Chef.cs

示例10: Cut

 private void Cut(Vegetable potato)
 {
     // ...
 }
开发者ID:GenoGenov,项目名称:TelerikAcademyAssignments,代码行数:4,代码来源:Program.cs

示例11: Peel

 private void Peel(Vegetable vegetable)
 {
     // TODO: Implement this method
     throw new NotImplementedException();
 }
开发者ID:GenoGenov,项目名称:TelerikAcademyAssignments,代码行数:5,代码来源:Program.cs

示例12: Add

 internal void Add(Vegetable carrot)
 {
     throw new NotImplementedException();
 }
开发者ID:Rostech,项目名称:TelerikAcademyHomeworks,代码行数:4,代码来源:Bowl.cs

示例13: Peel

 private void Peel(Vegetable vegetable)
 {
     // some vegetable peeling logic
     vegetable.IsPeeled = true;
 }
开发者ID:g-yonchev,项目名称:HQCode,代码行数:5,代码来源:Chef.cs

示例14: Cut

 private void Cut(Vegetable vegetable)
 {
     // some vegetable cutting logic
     vegetable.IsCut = true;
 }
开发者ID:g-yonchev,项目名称:HQCode,代码行数:5,代码来源:Chef.cs

示例15: Cut

 public void Cut(Vegetable potato)
 {
     //...
 }
开发者ID:aleks-todorov,项目名称:HomeWorks,代码行数:4,代码来源:CookingApp.cs


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