.NET Tip: Where Is Your Data Coming From? Brea CA

LINQ can be used for much more than just accessing data stored in your database. Learn how you can use the from clause with other types of data.

Local Companies

etelligence technologies inc.
626-810-9262
17700 castleton st. #383
city of industry, CA
JNC Solutions, Inc
714.590.9017
12192 Brookhurst St. Suite 375
Garden Grove, CA
Applied Knowledge, Inc.
714) 751-3480
1502 Brookhollow, Suite A
Santa Ana, CA
Acrosser U.S.A Inc
714-827-9938
10564 progress way. Unit D
Cypress , CA
Ignify Inc
+562 483 2448
12440 Firestone Blvd, Suite 225
Norwalk, CA
ADM Systems
(323) 646-1317
17375 Brookhurst Street
Fountain Valley, CA
digital solutions
(909) 898-0940
809-898-0940
corona, CA
DezTech Consulting, LLC
714.778.2078
6521 Peggy Circle
Huntington Beach, CA
Foldera
714-766-8700
17011 Beach Blvd.
Huntington Beach, CA
PreScreened Consultants
1-888-242-0777
660 Baker Street Suite 277
Costa Mesa, CA

.NET Tip: Where Is Your Data Coming From?

provided by: 
Originally published at Internet.com


LINQ to Objects allows you to use LINQ queries with any object that support IEnumerable or IEnumerable(T). This means that you can use LINQ to acccess data in arrays, lists, dictionaries, and other collections. You also can use LINQ with any of your own classes that implement or inherit IEnumerable. Let me start with a very simple introduction using an array of integers. This following example uses LINQ to find all of the even integers in an array of integers: // Array of data int[] Data = { 17, 32, 51, 98, 87, 4, 63, 26, 75, 40 }; // Create the variable to store the query var EvenNumbers = from Num in Data where Num % 2 == 0 select Num; // Run the query and output the results foreach (int i in EvenNumbers) Debug.Print(i.ToString());

Data is simply an integer array. The only thing important about it is that arrays implement IEnumerable so LINQ can be used with them. The statement of interest in this example is the definition of EvenNumbers. The from clause is used to define a subset of the elements in Data. Num is called the range variable and is used to represent each element from the data source. The where clause is used here to include only those numbers that are evenly divisible by 2, eliminating all odd numbers. The select clause indicates what information about each Num should be included for each matching element. In this case, the number itself is being selected. One point to note is that at this point the query has not been executed. EvenNumbers is simply a definition of the query. The query is not actually processed until it is used in the foreach loop that follows. The piece is the foreach loop that iterates over the EvenNumbers query and prints out each included element. The result is the following: 32 98 4 26 40

I hope this whets your appetite for what LINQ can do and will help you to think about where you can use LINQ in your application. LINQ allows you to use a SQL-like syntax for working with your data outside of the database.

About the Author

Jay Miller is a Software Engineer with Electronic Tracking Systems, a company dedicated to robbery prevention, apprehension, and recovery based in Carrollton, Texas. Jay has been working with .NET since the release of the first beta and is co-author of Learn Microsoft Visual Basic.Net In a Weekend. Jay can be reached via email at jmiller@sm-ets.com.

Author: Jay Miller

Read article at Internet.com site

Featured Local Company

etelligence technologies inc.

626-810-9262
17700 castleton st. #383
city of industry, CA
http://etiusa.net

Related Articles
- Data Secure Encryption Platform Brea CA
A centrally managed encryption platform that protects confidential data. The encryption keys are handled from a central component that includes key generation and deletion.
- Data Profiler Brea CA
- GURA Object Director and Data Gate Brea CA
- Sybase Data Integration Suite Brea CA
- ADRC Data Recovery Tools Brea CA
- Attunity Stream Client/Server Platform Brea CA
- Downloaded Data Guard Brea CA
- DB Data Generator Brea CA
- Purisma Data Hub Brea CA
Related Articles
- Data Secure Encryption Platform Brea CA
A centrally managed encryption platform that protects confidential data. The encryption keys are handled from a central component that includes key generation and deletion.
- Data Profiler Brea CA
- GURA Object Director and Data Gate Brea CA
- Sybase Data Integration Suite Brea CA
- ADRC Data Recovery Tools Brea CA
- Attunity Stream Client/Server Platform Brea CA
- Downloaded Data Guard Brea CA
- DB Data Generator Brea CA
- Purisma Data Hub Brea CA
Related Local Events
Windows Hardware Engineering Conference
Dates: 11/5/2008 - 11/7/2008
Location: Los Angeles Convention Center
Los Angeles CA
View Details

Digital Video Expo
Dates: 11/4/2008 - 11/6/2008
Location: Los Angeles Convention Center
Los Angeles CA
View Details

IT ChannelVision Fall 2008
Dates: 10/4/2008 - 10/8/2008
Location: Hyatt Regency Los Angeles
Los Angeles CA
View Details

IT ChannelVision Fall 2008
Dates: 10/4/2008 - 10/8/2008
Location: Hyatt Regency Los Angeles
Los Angeles CA
View Details

Biotechnology Vendor Showcase - University of California, Los Angeles
Dates: 10/2/2008 - 10/2/2008
Location: UCLA
Los Angeles CA
View Details
Rate Article
     
Articles Insider

Rss   Delicious   Digg   Add To My Yahoo   Add To My Google   Bookmark   Search Plugin

Topics:
Advertising Engineering Home Services Retail & Consumer Services
Business Services Entertainment Industrial Goods & Services Software
Career Family Insurance Technology
Cars Financial Services Internet Telecommunications
Computer Hardware Food & Beverage Legal Transportation & Logistics
Construction Health Pets Travel
Education Home Electronics Real Estate Wedding