title: ASP MVC - Cast ViewModel Object to another type
body: <p>I have a ViewModel like this :  </p>
  
  <pre><code>public class Column {
  
      public string Name;
  
      public string Type;
  
      public object Content;
  
  }
  </code></pre>
  
  <p><strong>Content</strong> can be an <em>int</em>, <em>string</em>... Depending on the <strong>Type</strong> I call the specific EditorTemplate : <em>Column_int</em>, <em>Column_string</em>... no problem.<br>
  I do however have a type <strong>GeoPoint</strong> I want to use too, with the corresponding EditorTemplate <em>Column_GeoPoint</em>. The problem is that in my controller, when the ViewModel gets posted, when I do :  </p>
  
  <pre><code>GeoPoint geoPoint = ((GeoPoint) mViewModel.Content);
  </code></pre>
  
  <p>I get a cast exception.<br>
  Any ideas on how to incorporate an object inside another one in the ViewModel ?</p>