gpt4 book ai didi

c# - 从数组创建选择列表

转载 作者:行者123 更新时间:2023-11-30 18:51:03 26 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
how to find the index particular items in the list using linq?

我正在尝试创建一个 IEnumerable<SelectListItem>来自字符串数组。

string[] months = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };

model.month = months
.Select(r => new SelectListItem{Text = r, Value = ???});

有没有办法在这个查询中访问他们的索引?

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com