gpt4 book ai didi

c# - 了解 FormCollection.AllKeys.Contains

转载 作者:行者123 更新时间:2023-11-30 19:49:41 25 4
gpt4 key购买 nike

我正在查看一个代码块,但无法理解行中发生的事情 - formValues.AllKeys.Contains("Email_"+ i); 看起来应该进行分配地方但是...

public ActionResult EditAdditionalLocations(int ID, int? count, FormCollection formValues)
{
...

for (int i = 0; i < _count; i++)
{
formValues.AllKeys.Contains("Email_" + i);
if (locations.Emails.Count > i)
{
locations.Emails[i] = formValues["Email_" + i];
}
else
{
locations.Emails.Add(formValues["Email_" + i]);
}
}
}

最佳答案

我的猜测是这样的:

if (formValues.AllKeys.Contains("Email_" + i)) {
if (locations.Emails.Count > i)
{
locations.Emails[i] = formValues["Email_" + i];
}
else
{
locations.Emails.Add(formValues["Email_" + i]);
}
}

关于c# - 了解 FormCollection.AllKeys.Contains,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3610032/

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