473,800 Members | 2,413 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

LINQ examples

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 expensiveInStoc kProducts =
from p in products
where p.UnitsInStock 0 && p.UnitPrice 3.00M
select p;

Console.WriteLi ne("In-stock products that cost more than 3.00:");
foreach (var product in expensiveInStoc kProducts) {
Console.WriteLi ne("{0} is in stock and costs more than 3.00.",
product.Product Name);
}
}

*** Sent via Developersdex http://www.developersdex.com ***
Jun 27 '08 #1
2 3283
Can you give a url to that?

I suspect that should be List<Productor similar (i.e.
System.Collecti ons.Generic.Lis t<T>)... but perhaps the <Productgot
treated as html and hidden... a common issue between generics and
html...

Marc
Jun 27 '08 #2
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
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1263
by: shapper | last post by:
Hello, I have been reading a few articles about LINQ and I have a few questions: 1. What do I need to start using it in my ASP.NET 2.0 / SQL 2005 / Visual Studio 2005 web sites? 2. Is there a way to convert my existing SQL Stored Procedures to LINQ code?
1
1171
by: Tem | last post by:
I'm new to ASP.NET. But I'm not new to c# and programming in general. Need some suggestions on whether I should learned the traditional way first or just learn LINQ? Would that be sufficient for most web development needs? Does anyone know of a sample of whole website written with c# 3.5 and linq? I found a lot of examples and code snippets but not a whole website using MS's latest technologies. Thanks
2
3707
by: shapper | last post by:
Hello, I have the following LINQ: List<Tagtags = (from t in database.Tags select t).ToList(); I need to restrict my results and for that I have two parameters: StartWidth and N
2
1736
by: Neil Chambers | last post by:
All, I have a class describing various actions to take against a LINQ to SQL datasource. What are the pros/cons of instantiating the LINQ object either in the root of the class (for lack of a better description) or within each of the methods? I am naturally drawn to instantiating the LINQ object in the root but some examples I've seen preffer to keep this local to the methods. Is there a compelling reason for this? It seems that garbage...
13
1810
by: Dan Tallent | last post by:
I have a query which I would like to convert to LINQ. I am having problems finding good examples or references that cover more complex queries. Here is the SQL command I would like to rewrite into C# LINQ. Notice that one of the returned fields "XrefID" is coming from the second table. This information is very important but its complicating the query expression in C# The DataContext has the two classes for the two tables...
9
2264
by: Cirene | last post by:
I'm about to begin a brand new, big, ASP.NET project (using 3.5 .net fw), VS 2008. I'm using MySQL as the backend (customer request.) I have absolutely no experience with LINQ and/or the Entity Framework. Though I am quite comfortable with ADO.NET and VB.NET. In your opinion, should I take a few days and learn it and utilize these technologies in this new project (I'm starting from scratch)? Are the benefits worth it in your opinion?...
20
2911
by: raylopez99 | last post by:
Inspired by Chapter 8 of Albahari's excellent C#3.0 in a Nutshell (this book is amazing, you must get it if you have to buy but one C# book) as well as Appendix A of Jon Skeet's book, I am going through some LINQ queries. But how to cast? ( See the below, modified from somebody else's code. The problem is the query 'stops' (throws a cast exception) at "3", and never gets to "violet".
1
2777
by: hrishy | last post by:
Hi Well wouldn't it be a lot easier to query and join a xml source with a relational source with LINQ capabilites in Python. Hmm what am i missing here is there a site that takes all LINQ examples anddoes them using list comprehensions and makes them sound easy ? wasn't python supposed to make everything easy ? regards Hrishy
2
2401
by: shapper | last post by:
Hello, I have the following Linq query: List<PostsTaginsert = (from t in (from t in database.Tags join p in paper.Tags on t.Name equals p.Name select t).ToList() select new PostsTag {
4
5101
by: CSharper | last post by:
I have following XML <root> <Person id="1"> <Name>a</Name> </Person> <Person id="2"> <Name>b</Name> </Person> </root>
0
9690
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10275
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10253
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9085
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5471
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.