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
Post a Comment