惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

量子位
T
The Blog of Author Tim Ferriss
U
Unit 42
Microsoft Security Blog
Microsoft Security Blog
WordPress大学
WordPress大学
Vercel News
Vercel News
MongoDB | Blog
MongoDB | Blog
P
Proofpoint News Feed
D
DataBreaches.Net
The GitHub Blog
The GitHub Blog
大猫的无限游戏
大猫的无限游戏
C
Check Point Blog
Blog — PlanetScale
Blog — PlanetScale
I
InfoQ
Y
Y Combinator Blog
F
Full Disclosure
B
Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
G
Google Developers Blog
博客园_首页
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
月光博客
月光博客
博客园 - 三生石上(FineUI控件)
博客园 - 叶小钗
S
SegmentFault 最新的问题
腾讯CDC
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
V
Visual Studio Blog
Apple Machine Learning Research
Apple Machine Learning Research
人人都是产品经理
人人都是产品经理
Recent Commits to openclaw:main
Recent Commits to openclaw:main
The Register - Security
The Register - Security
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Microsoft Azure Blog
Microsoft Azure Blog
云风的 BLOG
云风的 BLOG
Last Week in AI
Last Week in AI
F
Fortinet All Blogs
C
CXSECURITY Database RSS Feed - CXSecurity.com
Hugging Face - Blog
Hugging Face - Blog
T
Threatpost
GbyAI
GbyAI
G
GRAHAM CLULEY
L
Lohrmann on Cybersecurity
T
The Exploit Database - CXSecurity.com
P
Palo Alto Networks Blog
L
LangChain Blog
T
Tenable Blog
C
Cisco Blogs
T
Threat Research - Cisco Blogs
Google Online Security Blog
Google Online Security Blog

博客园 - 挑战

从存储过程中读取相关信息 Blend Step by Step书籍笔记(第一章) WPF非轮询方式实时更新数据库变化SqlDependency 动态解析XAML文本构建WPF的UI 解决为'*********' 的游标已存在问题 数据表死锁查询和处理 SQL Server操作XML(六)XML FLOWR SQL Server操作XML(五)XML Query-XQuery SQL Server操作XML(四)XML数据类型 SQL Server操作XML(三)OPENXML函数功能 SQL Server操作XML(二)XML子句实例 SQL Server操作XML(一)XML子句 数据绑定 最为详尽的WPF类继承关系 WPF Diagram Designer Part 3:连接Item 照猫画虎WPF之二数据绑定 照猫画虎WPF之一:命名空间 解决WPF部署后客户端访问安全性问题 C#读取文本播放相应语音
LinQ数据访问
挑战 · 2012-05-28 · via 博客园 - 挑战

(1)利用Linq访问数组

  string[] s = new string[5]{"Leo","BackHam","David","Ronaldo","Roony"};
  var result = from s1 in s    //从数组S中选取
  where s1.Length > 3         //筛选条件是长度大于3
  orderby s1.ToString()        //根据内容排序
  select s1.ToString();         //展示内容

(2)利用Linq访问集合

    private List<Employee> GetEmploeeCollection()
        {
            List<Employee> e = new List<Employee>
           {
               new Employee(){ID="e1",Name="Tom",Age=23,Salary=34540},
               new Employee(){ID="e2",Name="Jim",Age=25,Salary=12230},
               new Employee(){ID="e3",Name="Bob",Age=33,Salary=87540},
               new Employee(){ID="e4",Name="Neo",Age=47,Salary=22112},
               new Employee(){ID="e5",Name="Leo",Age=54,Salary=52123},
               new Employee(){ID="e6",Name="David",Age=23,Salary=21222},
           };
           return e;
        }

    

       var result = from ep in GetEmploeeCollection()
                         where ep.Salary > 30000
                         orderby ep.Salary
                         select ep.Name;

(3)查询列的选取和格式化

var result = from ep in GetEmploeeCollection()
                         where ep.Salary > 30000
                         orderby ep.Salary
                         select new
                         {
                           name=ep.Name,               //显示员工名称
                           tax=ep.Salary*0.012        //显示个人所得税
                         };