title: Formatting decimal xamarin
body: <p>I am new to c# and I couldn't find a way to format my numbers. I want to show only 2 digits after decimal.</p>
  
  <pre><code>namespace Dolar
  {
      public partial class MainPage : ContentPage
      {
          public MainPage()
          {
              InitializeComponent();
          }
  
          private void Button_Clicked(object sender, EventArgs e)
          {
              XmlDocument doc1 = new XmlDocument();
              doc1.Load("http://www.tcmb.gov.tr/kurlar/today.xml");
              XmlElement root = doc1.DocumentElement;
              XmlNodeList nodes = root.SelectNodes("Currency");
  
              foreach (XmlNode node in nodes)
              {
                  var attributeKod = node.Attributes["Kod"].Value;
                  if (attributeKod.Equals("USD"))
                  {
                      var a = node.SelectNodes("BanknoteSelling")[0].InnerText;
                      var b = node.SelectNodes("BanknoteBuying")[0].InnerText;
                      float c = float.Parse(a);
                      float d = float.Parse(b);                 
                      label2.Text = a;
                      label3.Text = b;
  
  
                  }
  
                  var attributeKod1 = node.Attributes["Kod"].Value;
                  if(attributeKod1.Equals("EUR"))
                  {
                      var a = node.SelectNodes("BanknoteSelling")[0].InnerText;
                      var b = node.SelectNodes("BanknoteBuying")[0].InnerText;
                      float c = float.Parse(a);
                      float d = float.Parse(b);
                      label4.Text = a;
                      label5.Text = b;
                  }
                  }
              }
      }
  }
  </code></pre>
  
  <p>outputs are;</p>
  
  <pre><code>4.5173 //4.51
  4.4992 //4.49
  5.3131 //5.31
  5.2919 //5.29
  </code></pre>