Steps for a beginner to run very basic linq to sql query using Linqpad

前端 未结 4 1961
长情又很酷
长情又很酷 2021-02-04 04:36

Trying to learn Linq using LinqPad and getting frustated with how to start on it. Let\'s say I want to write a C# Expression and a C# statment where I have a table in SQL server

4条回答
  •  情话喂你
    2021-02-04 05:00

    Check out: http://msdn.microsoft.com/en-us/library/bb397933(v=vs.90).aspx which will give you an introduction to Linq and using lambda expressions.

    Then have a look at http://msdn.microsoft.com/en-us/library/bb386927.aspx which will give you the basics, but to answer your specific question:

    var products = db.Products.Where(prod => prod.Price > 50);
    foreach(var product in products)
    {
         //do something
    }
    

提交回复
热议问题