Can a C# named Tuple be used as an MVC page model type? -




in c# 7 can have named tuples:

var foo = (name: "joe", age: 42); 

if pass mvc model using:

return view(foo); 

then syntax should used in cshtml file declare model? although doesn't work, like...

@model (string name, int age); 

as current time can't , need use

@model tuple<string, int> //or @model valuetuple<string, int> 

for difference between 2 options: what's difference between system.valuetuple , system.tuple?

you can follow on github: razor throws compilationfailedexception when iterating on named tuple (i know closed dup name more indicative current case)





wiki

Comments

Popular posts from this blog

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -

Asterisk AGI Python Script to Dialplan does not work -