@model (Dictionary Items, int Level) @functions{ void DisplayValue(object value) { if (value is string str && str.StartsWith("http")) { @str } else { @value } } } @foreach (var (key, value) in Model.Items) { @if (value is string) { if (!string.IsNullOrEmpty(key)) { } } else if (value is DictionarysubItems) { @* This is the array case *@ if (subItems.Count == 1 && subItems.First().Value is string) { } else { } } }
@key @{ DisplayValue(value); } @key @{ DisplayValue(subItems.First().Value); } @Html.Raw($"{key}")