Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to write the entry code for LINQ

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "how to write the entry code for LINQ". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to write the entry code for LINQ.

Language Integrated query (LINQ) is a breakthrough innovation in Visual Studio 2008 and .NET Framework version 3.5. it builds a bridge between the object domain and the data domain.

Traditionally, queries against data are expressed as simple strings without compile-time type checking or IntelliSense support. In addition, you must learn different query languages for the following various data sources: SQL databases, XML documents, various Web services, and so on. LINQ makes queries a first-class language construct in C # and Visual Basic. Syntax query feature with multiple uses (general-purpose) applied to all information sources (all sources of information) (query facilities). Query statements for all information sources, similar to database sql statements, xml xpath.

LINQ getting started Code:

Using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace HelloVS2008 {public partial class LinqFrm: Form {public LinqFrm () {InitializeComponent ();} private void btnLinq_Click (object sender, EventArgs e) {int [] arr = new int [] {8,5,89,3,56,4,1,58} / / Information source / / var requested an untyped variable. N is used without definition, similar to javascript syntax / / normal order: select item from item in items where item > 5 orderby item is the difference between select item and sql: select col1 from table here seems to be select col1 from col1 in table somehow var m = from n in arr where n < 5 orderby n select n; foreach (var n in m) {txtLinq.Text + = n } at this point, I believe you have a deeper understanding of "how to write the entry code for LINQ". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report