Hi all
i want to know the when we want to do Explict casting for a model in mvc with examples.
like var x=linq query with result set
so when we are doing like (student)x
Hi siddangoud,
The default model binder does not try to guess if you are posting a more derived class than it is expecting. So even if you have form has fields for a more derived class, if the action is expecting class Person, it will create Person and you will not be able to cast to Student, since a Student was never created.
Refer below link for more details.
https://www.dotnettricks.com/learn/csharp/understanding-type-casting-or-type-conversion-in-csharp
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.