class T
{ public int Key; pubic List<int> ints ;//长度可变
}
///// List<T> list = new List<T>();
要求:根据用户输入的字符串值得到结果 如 select * from list where ints[0]>10 && ints[0] <20 && ints[500] >9 && ints[500] <100 order by Key desc 输出满足条件的对象
{ public int Key; pubic List<int> ints ;//长度可变
}
///// List<T> list = new List<T>();
要求:根据用户输入的字符串值得到结果 如 select * from list where ints[0]>10 && ints[0] <20 && ints[500] >9 && ints[500] <100 order by Key desc 输出满足条件的对象
解决方案 »
- 关于C# Active网页插件事件问题
- 获取硬盘物理序号的解决方案?
- 在执行此操作前必须先调用 Bind 方法?
- <注意>问题已解决! 200分开贴回报! Shinaterry请进来接分大利 (一)
- 还是 哪个线程的问题
- 怎样判断一个字符是数字?
- 关于listview的显示问题!!!请教!!
- 困惑:为何dataSet的表的RemoveAt的结果不能保存到数据库,而“添加”或“修改”的记录却可以保存至数据库呢?
- 我在客户机上安装了.net框架和ie6.0和mdac,但是在打印报表时提醒错误:大概是“非法的KeyCodeV20.dll”怎么回事呀,急
- 用C#程序怎么读出的数据保存到excel中,高手请指点!!!
- C#在做大批量数据导入的时候如何实现等待效果 在线等!急急急!
- 有比timer刷新还快的办法么
where l.ints[0]>10 && l.ints[0] <20 && l.ints[500] >9 && l.ints[500] <100
order by Key descending
select ;
where l.ints[0]>10 && l.ints[0] <20 && l.ints[500] >9 && l.ints[500] <100
order by Key descending
select l;
// 以这条为准:
var query= from l in list
where l.ints[0]>10 && l.ints[0] <20 && l.ints[500] >9 && l.ints[500] <100
order by l.Key descending
select l;
//也可以这么写:
var query= list.Where(l=>l.ints[0]>10 && l.ints[0] <20 && l.ints[500] >9 && l.ints[500] <100).OrderByDescending(l=>l.Key);
{
List<item> list=new List<item>();
//for添加item到list
Random random = new Random();
for (int i = 0; i < 30; i++)
{
item ii = new item();
ii.Key = random.Next(0, 600);
for (int j = 0; j < ii.Key; j++)
{
ii.ints.Add(random.Next(0,50));
}
list.Add(ii);
}
list.Sort(new MyComparer());//利用iComparer接口排序 List<item> ret = list.FindAll(new Predicate<item>(select));//查询结果
}
bool select(item ii)
{
if (ii.ints.Count == 0|ii.ints.Count<500)
return false;
if (ii.ints[0] > 10 && ii.ints[0] < 20 && ii.ints[500] > 9 && ii.ints[500] < 100)
return true;
return false; }
}
class item
{
public int Key;
public List<int> ints=new List<int>();//长度可变
}
class MyComparer : IComparer<item>
{
int IComparer<item>.Compare(item x, item y)
{
return x.Key > y.Key ? -1 : 1;
}
}至于怎么输入字符串自己改改吧