Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jul 24, 2012 06:14 AM by Saravanan M
Jul 24, 2012 06:00 AM|LINK
in LINQ to SQL Database, while doing update like below, here my doubt is what is this symbol =>?
AdventureWorksDataContext db = new AdventureWorksDataContext();
db.Log = Console.Out;
// LINQ query to get StateProvince
StateProvince state = (from states in db.StateProvinces
where states.CountryRegionCode == "AU" && states.StateProvinceCode == "NSW"
// LINQ function to get AddressType
AddressType addrType = db.AddressTypes.FirstOrDefault(s => s.Name == "Home");
Customer newCustomer = new Customer()
TerritoryID= state.TerritoryID // Relate record by Keys
Contact newContact = new Contact()
Title = "Mr",
FirstName = "New",
LastName = "Contact",
EmailAddress = "newContact@company.com",
Phone = "(12) 3456789",
rowguid = Guid.NewGuid(),
ModifiedDate = DateTime.Now
Jul 24, 2012 06:08 AM|LINK
the => symbol implies that the word preceding the => is a placeholder variable. For each object in the original collection, a reference to that object will be placed into the placeholder variable, the code
to the right of the => symbol will be executed, and the result will be used to build the new collection or to compute a value.
refer following link for more information :
hi, It's Called Lambda Expression
Refer : http://msdn.microsoft.com/en-us/library/bb397687.aspx
Jul 24, 2012 06:14 AM|LINK
It is lambda operator.
All lambda expressions use the lambda operator =>, which is read as "goes to".