if (cookieId != null)
{
AgencyModel model2 = AgencyLogic.Get(59);
string IsQuoShow = model2.IsMaster;
ModelCollection cuPMModel = ProductMenuLogic.GetProductByidr(IsQuoShow);
ModelCollection cQPMModel = new ModelCollection();
string isQShow = AgencyInfo.IsQuoShow;
for (int i = 0; i < cuPMModel.Count; i++)
{
string[] arrQs = isQShow.Split(',');
for (int j = 0; j < arrQs.Length; j++)
{
if (!string.IsNullOrEmpty(arrQs[j]) && cuPMModel[i].ProductMenuId == Convert.ToInt32(arrQs[j]))
{
cQPMModel.Add(cuPMModel[i]);
}
}
}
rptNews.DataSource = cQPMModel;
rptNews.DataBind();
}
代码如上,想要读出cQPMModel这个model里面的第一条数据,有大神有方法解决吗
求助大神!!asp.net读ModelCollection<ProductMenuModel> cuPMModel 查询出来的结果的第一条数据
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
1条回答 默认 最新
- Go 旅城通票 2018-10-10 07:37关注
你查找到第一条后直接break掉不就行了
for (int i = 0; i < cuPMModel.Count; i++) { string[] arrQs = isQShow.Split(','); bool find=false;////////////// for (int j = 0; j < arrQs.Length; j++) { if (!string.IsNullOrEmpty(arrQs[j]) && cuPMModel[i].ProductMenuId == Convert.ToInt32(arrQs[j])) { cQPMModel.Add(cuPMModel[i]); find=true;break;////////////// } } if(find)break;////////////// }
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 素材场景中光线烘焙后灯光失效
- ¥15 请教一下各位,为什么我这个没有实现模拟点击
- ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
- ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
- ¥20 有关区间dp的问题求解
- ¥15 多电路系统共用电源的串扰问题
- ¥15 slam rangenet++配置
- ¥15 有没有研究水声通信方面的帮我改俩matlab代码
- ¥15 ubuntu子系统密码忘记
- ¥15 保护模式-系统加载-段寄存器