发布:2023/12/7 15:17:34作者:大数据 来源:大数据 浏览次数:463
Razor视图中写的,其它地方参考即可
@{
ViewData["Title"] = "Index";
var dic = new Dictionary<string, string> { { "key1", "value1" }, { "key2", "value2" }, { "key3", "value3" } };
@dic.SingleOrDefault(o => o.Key == "key1").Value;
@dic.GetValueOrDefault("key2");
dic.TryGetValue("key3", out string x);
@x;
}
© Copyright 2014 - 2024 柏港建站平台 ejk5.com. 渝ICP备16000791号-4