title: Whats the difference with this razor?
body: <p>I have a view with the following razor...</p>
  
  <pre><code>foreach (var result in @Model.Results)
  {
      if (result.Location != null &amp;&amp; result.Location.Lat != null &amp;&amp; result.Location.Long != null)
      {                   
          &lt;script type="text/javascript" language="javascript"&gt;
  
              var MapDataObj = (function () {
                  mapDataObj = new Object();
                  mapDataObj.Lat = @result.Location.Lat;
                  mapDataObj.Long = @result.Location.Long;
                  mapDataObj.BasedInArea = 'True';
                  SearchMapDataProperties.searchResultsArray.push(mapDataObj);
                  return {
  
                  };
              }());
          &lt;/script&gt;
      }
  </code></pre>
  
  <p>But when I change it to...</p>
  
  <pre><code>foreach (var result in @Model.Results)
  {
      if (result.Location != null &amp;&amp; result.Location.Lat != null &amp;&amp; result.Location.Long != null)
      {                   
          &lt;script type="text/javascript" language="javascript"&gt;
  
              var MapDataObj = (function () {
                  mapDataObj = new Object();
                  mapDataObj.Lat = result.Location.Lat;
                  mapDataObj.Long = result.Location.Long;
                  mapDataObj.BasedInArea = 'True';
                  SearchMapDataProperties.searchResultsArray.push(mapDataObj);
                  return {
  
                  };
              }());
          &lt;/script&gt;
      }
  </code></pre>
  
  <p>(I have removed the '@' symbol from the result.Location object) I get a null reference exception on the result.Location. </p>
  
  <p>I'm really confused about the difference. Its obviously still treating it as c# because I get a YSOD. I just cant fathom what the difference is...</p>
  
  <p>Pete</p>