Tuple solves the problem of returning an error when the controller is passed to an anonymous object in the view through razor, tuplerazor
C # 'S Compiler always compiles the anonymous type into internal, and an error is reported when an anonymous object passed by the Controller is directly used in the view.
Error code:
Controller code
View code
Execution result:
**************************************** **************************************** **************************************** ***********************************
**************************************** **************************************** **************************************** ***********************************
**************************************** **************************************** **************************************** ***********************************
**************************************** **************************************** **************************************** ***********************************
**************************************** **************************************** **************************************** ***********************************
**************************************** **************************************** **************************************** ***********************************
**************************************** **************************************** **************************************** ***********************************
**************************************** **************************************** **************************************** ***********************************
Solution: Use Tuple
Control Code after correction:
View code after correction:
Execution result: