title: C# formatting text (right align)
body: <p>I am a beginner learning C#, I am making a mock shopping list receipt program to manage your shopping. I generate .txt receipt however having problem with right align string here is my code; </p>
  
  <pre><code>public static void GenerateNewReciept(Customer customer)
  {
      List&lt;ShoppingItems&gt; customerPurchaedItems;
      try
      {
          sw = File.AppendText("receipt.txt");
  
          //Customer object
          Customer customers = customer;
          //List of all items in list
          List&lt;ShoppingList&gt; customerItems = customer.CustomerShoppingList;
          DateTime todayDandT = DateTime.Now;
  
          //Making reciept layout
          sw.WriteLine("Date Generated: " + todayDandT.ToString("g", CultureInfo.CreateSpecificCulture("en-us")));
          sw.WriteLine("Customer: " + customer.FName + " " + customer.SName1);
  
          for (int i = 0; i &lt; customerItems.Count; i++)
          {
              customerPurchaedItems = customerItems[i].ShoppingItems;
              foreach (ShoppingItems item in customerPurchaedItems)
              {
                  sw.WriteLine(String.Format("{0,0} {1,25:C2}", item.ItemName, item.Price));  
              }
          }
  
          sw.WriteLine("Total {0,25:C2}", customerItems[0].computeTotalCost());
          sw.Close();
      }
      catch (FileNotFoundException)
      {
          Console.WriteLine("FILE NOT FOUND!");
      }
  }
  </code></pre>
  
  <p><code>sw.WriteLine(String.Format("{0,0} {1,25:C2}", item.ItemName, item.Price));
  sw.WriteLine("Total {0,25:C2}",</code>  - I want the prices of the items to be right aligned however some items have larger names, meaning when 25 spacing is applied they will be out of place.This is the same with total.</p>