title: String.Format in linq query
body: <p>I am stuck on a weird problem. I have a <code>CashGameGeneralViewModel</code> class which looks like this</p>
  <pre><code>public class CashGameGeneralViewModel
  {
      public string Limit { get; set; }
      public int HandsPlayed { get; set; }
  
      public float AmountWon { get; set; }
  }
  </code></pre>
  <p>Here is the method that should return all hands played by a certain player:</p>
  <pre><code>public List&lt;CashGameGeneralViewModel&gt; GetAllHands(string playerToFind)
      {
          HoldemHandContext db = new HoldemHandContext();
          int playerId = GetPlayerId(playerToFind);
          var holdemHandResult = (from phh in db.PlayersInHoldemHands
                                  from hh in db.HoldemHands
                                  where hh.Id == phh.HandPlayed &amp;&amp; phh.PlayerId == playerId
                                  select new CashGameGeneralViewModel()
                                             {
                                                 Limit = //&quot;some text&quot;,
                                                 String.Format(&quot;{0:0.00}&quot;, hh.SBlindAmount) + &quot;/&quot; +
                                                 String.Format(&quot;{0:0.00}&quot;, hh.BBlindAmount),
                                                 HandsPlayed = db.HoldemHands.Distinct().Count(),
                                                 AmountWon = 0
                                             }
                                  ).ToList();
  
          return holdemHandResult;
      }
  
      public int GetPlayerId(string playerToFind)
      {
          HoldemHandContext db = new HoldemHandContext();
          int playerId = (from p in db.Players
                          where p.ScreenName == playerToFind
                          select p.Id).FirstOrDefault();
  
          return playerId;
      }
  </code></pre>
  <p>The problem now is the</p>
  <pre><code>Limit = //&quot;some text&quot;,
  String.Format(&quot;{0:0.00}&quot;, hh.SBlindAmount) + &quot;/&quot; +
  String.Format(&quot;{0:0.00}&quot;, hh.BBlindAmount)
  </code></pre>
  <p>part. <code>hh.SBlindAmount</code> and <code>hh.BBlindAmount</code> are float values. I wanted to use <code>String.Format</code> because <code>0.10</code> is shortened to <code>0.1</code> and with the string format I got it like I want it. But I am getting an exception which says:</p>
  <blockquote>
  <p>'The invocation of the constructor on type 'PokerRecord.View.CashGameGeneralUC' that matches the specified binding constraints threw an exception.' Line number '60' and line position '18'.</p>
  </blockquote>
  <p>When I remove the string.format and put in some &quot;regular&quot; string everything works fine... Anyone knows why?</p>