Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / April 2008

Tip: Looking for answers? Try searching our database.

LINQ examples

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mike P - 29 Apr 2008 12:59 GMT
I am running through the LINQ examples on the Microsoft site and I am
wondering where the List object below is coming from?  What classes do I
need to add to my page to be able to use this List object?

public void Linq3() {
   List products = GetProductList();

   var expensiveInStockProducts =
       from p in products
       where p.UnitsInStock > 0 && p.UnitPrice > 3.00M
       select p;
   
   Console.WriteLine("In-stock products that cost more than 3.00:");
   foreach (var product in expensiveInStockProducts) {
       Console.WriteLine("{0} is in stock and costs more than 3.00.",
product.ProductName);
   }
}
Marc Gravell - 29 Apr 2008 13:32 GMT
Can you give a url to that?

I suspect that should be List<Product> or similar (i.e.
System.Collections.Generic.List<T>)... but perhaps the <Product> got
treated as html and hidden... a common issue between generics and
html...

Marc
Marc Gravell - 29 Apr 2008 13:46 GMT
This? http://msdn2.microsoft.com/en-us/vcsharp/aa336746.aspx

Yes - looks like the generics got lost... that isn't going to make it
very easy to follow. I tried "Contact Us", but the link is dead...
unusually sloppy for msdn.

It is hit'n'miss which samples work (unfortunately) - i.e. it is fine
here:
http://msdn2.microsoft.com/en-us/vcsharp/aa336754.aspx
but broken here:
http://msdn2.microsoft.com/en-us/vcsharp/aa336760.aspx

Marc

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.