-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: Anand_2004
Message 1 in Discussion
Hi Folks , In today's session I am talking about LINQ .This article split
into 2 part , here is the first part This is one of the most interesting and
great feature of C# 3.0 , it also know as LINQ (Language INtegrated Query) .
This provides the facility to access the NET objects or collection class
data the way we use structure query language to communicate with relational
database ( like select, where from etc..) .The main purpose of LINQ is to
bring the .NET programming language model to SQL programming model platform
.Earlier we use C#/VB.NET to interact with .NET framework and SQL statements
to interacts with database the main problem is .NET compiler unable to checking
the query statements embedded in quotes, no type checking of return values and
so on but through LINQ its possible now .The other advantages of LINQ is we can
filter our collection data the way we want without writing additional loops.
The query expression ( LINQ) begins with form clause and ends with select
clause .Have a look at the example below
using System;
using System.Collections.Generic;
using System.Text;
using System.Query;
using System.Xml.XLinq;
using System.Data.DLinq;
namespace QueryExpression
{
class Program
{
static void Main(string[] args)
{
string[] companyNames = { "Microsoft", "Oracle", "Motorola",
"Sun", "Google", "Borland",
"Sony","Nokia","Samsung","GM" };
var finalResult =
from company in companyNames
where company.Length > 6
select company;
foreach (string CoName in finalResult)
Console.WriteLine(CoName);
Console.ReadLine();
}
}
} In this example I was trying to demonstrate to display the list of
companies whose length is great than 6 characters by using query expression.
The form clause generates one or more iteration variables , where clause used
to filters the data ( restricted operator ) and select clause used to
capture the required output .In my next article I will cover few more core
features of LINQ with some example. Please post your queries on C# 2.0 or
C# 3.0 @ [EMAIL PROTECTED] Cheers Anand
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you
received this message by mistake, please click the "Remove" link below. On the
pre-addressed e-mail message that opens, simply click "Send". Your e-mail
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]