
asp.net 4.5 练习~test13-2 linq
发布日期:2021-05-06 21:16:20
浏览次数:37
分类:精选文章
本文共 1517 字,大约阅读时间需要 5 分钟。
webform1.aspx
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;namespace test13_2{ public partial class WebForm1 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { ListdataM = new List { new News { title="冬奥会开幕了!",id=4888,categories="国际新闻"}, new News { title="中国第一艘航母下水!",id=4580,categories="中国新闻"}, new News { title="IPHONE 5S上市了!",id=4688,categories="国际新闻"}, new News { title="发行新股将实行注册制度!",id=3888,categories="中国新闻"}, new News { title="美国政府暂时停止工作!",id=2888,categories="国际新闻"}, new News { title="新兴市场股票大涨!",id=4568,categories="国际新闻"} }; var query1 = from str in dataM where str.categories == "国际新闻" orderby str.id descending select str.title; // select str; Response.Write(" 热点新闻包括: "); foreach (var news in query1) { Response.Write(news + " "); //Response.Write(news.title + " "); } } }}
news.cs 类
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace test13_2{ class News { public int id { get; set; } public string title { get; set; } public string categories { get; set; } }}
发表评论
最新留言
路过按个爪印,很不错,赞一个!
[***.219.124.196]2025年04月01日 01时59分01秒
关于作者

喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
Spring security OAuth2.0认证授权学习第二天(基础概念-RBAC)
2021-05-09
ORA-00904: "FILED_TYPE": 标识符无效
2021-05-09
数据仓库系列之维度建模
2021-05-09
Scala教程之:函数式的Scala
2021-05-09
java中DelayQueue的使用
2021-05-09
线程stop和Interrupt
2021-05-09
Android中定时执行任务的3种实现方法
2021-05-09
nodejs中npm常用命令
2021-05-09
基于Vue2.0+Vue-router构建一个简单的单页应用
2021-05-09
基于vue2.0实现仿百度前端分页效果(二)
2021-05-09
JS魔法堂:函数重载 之 获取变量的数据类型
2021-05-09
时间序列神器之争:Prophet VS LSTM
2021-05-09
SpringBoot中关于Mybatis使用的三个问题
2021-05-09
MapReduce实验
2021-05-09
Leaflet 带箭头轨迹以及沿轨迹带方向的动态marker
2021-05-09
java大数据最全课程学习笔记(1)--Hadoop简介和安装及伪分布式
2021-05-09
java大数据最全课程学习笔记(2)--Hadoop完全分布式运行模式
2021-05-09
大部分程序员还不知道的 Servelt3 异步请求,原来这么简单?
2021-05-09
[apue] popen/pclose 疑点解惑
2021-05-09