title: How do I get an object stored in a variable, from a foreach loop, to be passed into a method?
body: <p>I cannot get my item <code>KartItem</code> to be passed into the parameter. I tried to debug and it shows the data in the item, but then when I try to pass it into the  <code>Deals.BuyOneGetOneFree(item)</code> it doesn't work. </p>
  
  <p>Piece of code from main</p>
  
  <pre><code>Console.WriteLine("Enter Item");
  var inputItem = Console.ReadLine();
  Console.WriteLine("Enter Pounds");
  int inputPound = int.Parse(Console.ReadLine());
  Console.WriteLine("Enter Price");
  double inputCost = double.Parse(Console.ReadLine());
  kart.PutItemInKart(inputItem, inputPound, inputCost);
  Console.WriteLine("your item in the kart");
  foreach (var item in kart.GetKart())
  {
      Deals.BuyOneGetOneFree(item); &lt;--- Here
      Console.WriteLine(item.Item);          
  }
  </code></pre>
  
  <p>The method I need item to be passed into</p>
  
  <pre><code>public static string BuyOneGetOneFree(KartItem inKart)
  {  
      if (inKart.Item == "Lettuce" || inKart.Item == "Pespsi" || inKart.Item == "Water")
      {
          double newCost = inKart.Cost * 2;
          return "Your get one buy one credit applied today ! " + newCost.ToString();
      }
      return "There is no discount for your item at this time";
  }
  </code></pre>
  
  <p>kart item class:</p>
  
  <pre><code>public class KartItem
  {
      public string Item { get; set; }
      public int Pound { get; set; }
      public double Cost { get; set; }
      public KartItem(string item, int pound, double cost)
      {
          Item = item;
          Pound = pound;
          Cost = cost;
      }
      public KartItem()
      {
  
      }
  }
  
  private List&lt;KartItem&gt; kart = new List&lt;KartItem&gt;();
  
  
  public List&lt;KartItem&gt; PutItemInKart(string input = null, int inputNumber = 0, double inputPrice = 0)
  {
  
          kart.Add(new KartItem()
          {
              Item = input,
              Pound = inputNumber,
              Cost = inputPrice
          });;
  
      return kart;
  }
  
  public List&lt;KartItem&gt; GetKart()  
  {
      return kart;
  }
  </code></pre>