读取List中内容 List<T_Kind> tk_father;(该List里有T_Kind对象)我想判断 int i==这个List中每个T_Kind对象的K_ID属性不知道怎么写,求教大神~~ 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 for(int i = 0; i < tk_father.Count; i++){ //to do}//=====================//foreach(T_Kind tk in tk_father){ //to do} 直接把List里面的T_Kind对象给取出来这样;for(i=0;i<th_father.count;I++){ t_Kind kind = tk_father[i]; kind.k_id; } for(int i=0;i<father.Count();i++){ father[i].T_Kind.K_ID //你要的属性} for(int j=0;j<tk_father.count;j++){ if(i==tk_father[i].k_ID) { ........ }} List<T_Kind> tk_father=new List<T_Kind>();foreach(T_Kind t in tk_father){ if(t.K_ID==i){}} 楼上的正解。遍历list,foreach 或者for循环取值即可。 (where(T_Products p) { return p.P_Kind == Convert.ToInt32(i) || p.P_Kind==tk_father[对象的K_ID属性] });我这2个是在一起的,我尝试把循环写到这里面,但是写都写错了,出不来。 foreach(T_Kind tk in tk_father) //用 foreach遍历List{ if(tk.K_ID==i) { //这里写你的处理代码 }} 不是,你可能还没弄清我的意思。我是想p.P_Kind==(这个地方遍历出list中对象的每个K_ID属性) 直接把List里面的T_Kind对象给取出来这样;for(i=0;i<th_father.count;I++){ t_Kind kind = tk_father[i]; kind.k_id; } p.P_Kind==(或者可以理解成是:list中T_Kind对象的K_ID) 是一个意思 你们可能没明白我的意思吧!p.P_Kind==(或者可以理解成是:list中T_Kind对象的K_ID)这里就是引用的后面那个判断条件,tk_father是list。我是想让他在这个做判断的条件里面:(where(T_Products p) { return p.P_Kind == Convert.ToInt32(i) || p.P_Kind==【就是在这里判断是否等于List<T_K>中T_K对象的K_ID】 ;});这样你们明白了吗? session 问题 ASP.NET中用怎么用C#换行 csdn登录源码问题 用ASP.NET做个像CSDN这样的留言板! C# TabControl 全部动态并且每个TabPanel里动态绑定数目不定的GridView 有难度的字符截取,都来看看 求1个sql语句 不难也不容易 菜鸟问:有不显示“打开”的下载方法吗? 紧急!!怎样使用C#-Asp.net来做FTP文件上传??? 关于asp.net页面生命周期的问题,重新描述了一下,希望能说清楚 为什么要跨页面提交哟 服务端控制客户端
{
//to do
}
//=====================//
foreach(T_Kind tk in tk_father)
{
//to do
}
这样;for(i=0;i<th_father.count;I++)
{
t_Kind kind = tk_father[i];
kind.k_id;
}
for(int i=0;i<father.Count();i++){ father[i].T_Kind.K_ID //你要的属性}
{
if(i==tk_father[i].k_ID)
{
........
}
}
foreach(T_Kind t in tk_father)
{
if(t.K_ID==i){}
}
遍历list,foreach 或者for循环取值即可。
foreach(T_Kind tk in tk_father) //用 foreach遍历List
{
if(tk.K_ID==i)
{
//这里写你的处理代码
}
}
我是想p.P_Kind==(这个地方遍历出list中对象的每个K_ID属性)
这样;for(i=0;i<th_father.count;I++)
{
t_Kind kind = tk_father[i];
kind.k_id;
}
你们可能没明白我的意思吧!p.P_Kind==(或者可以理解成是:list中T_Kind对象的K_ID)这里就是引用的后面那个判断条件,tk_father是list。我是想让他在这个做判断的条件里面:
(where(T_Products p) { return p.P_Kind == Convert.ToInt32(i) || p.P_Kind==【就是在这里判断是否等于List<T_K>中T_K对象的K_ID】 ;});这样你们明白了吗?