Array with keys ASPNET/Razor

Skythrust

Member
Jul 9, 2019
122
6
Goodafternoon all!

I am trying to rebuild one of my application from PHP to ASP with Razor.
When I pick up the array plain from my Postman output and I paste this VS is not able to read this.

I have searched on Google to find a fix for this what I am doing wrong, but I can't really find a solution for this.

There a 2 lines, one of them is working (Members), the other one (MembersWithKeys) is not working.
Does anyone have an idea what's going wrong over here?

C#:
@page
@model IndexModel

@{
    string[] Members = {"John", "Jane", "Jhon"};
    string[] MembersWithKey = [{ "Firstname":"John","Lastname":"Doe","Age":"37"},{ "Firstname":"Jane","Lastname":"Doe","Age":"27"},{ "Firstname":"Jhon","Lastname":"Doe","Age":"41"}];
}

@foreach (var Person in Members)
{
    <button>@Person</button>
}
 

Users who are viewing this thread

Top