-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect Output #43760
Labels
csharp-linq/subsvc
dotnet-csharp/svc
in-pr
This issue will be closed (fixed) by an active pull request.
okr-freshness
OKR: Freshness of content
okr-quality
Content-quality KR: Concerns article defects (bugs), freshness, or build warnings.
📌 seQUESTered
Identifies that an issue has been imported into Quest.
Comments
BillWagner
added a commit
to BillWagner/docs
that referenced
this issue
Jan 16, 2025
- Fixes dotnet#43760: Update where clause to filter out some values. Update output comment. - Fixes dotnet#43765: Update `let` statement so the query result isn't empty. - Fixes dotnet#43766: Update query parameters so the result set isn't empty. - Fixes dotnet#43768: Add sample data - Fixes dotnet#43790: Audit all samples in this article and ensure all have output. - Fixes dotnet#43809: Update samples to include the data sources. While doing this, update the project to .NET 9
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
csharp-linq/subsvc
dotnet-csharp/svc
in-pr
This issue will be closed (fixed) by an active pull request.
okr-freshness
OKR: Freshness of content
okr-quality
Content-quality KR: Concerns article defects (bugs), freshness, or build warnings.
📌 seQUESTered
Identifies that an issue has been imported into Quest.
Type of issue
Other (describe below)
Description
The second example under "Query variable" produces different results.
`City[] cities = [
new City("Tokyo", 37_833_000),
new City("Delhi", 30_290_000),
new City("Shanghai", 27_110_000),
new City("São Paulo", 22_043_000)
];
//Query syntax
IEnumerable queryMajorCities =
from city in cities
where city.Population > 100000
select city;
// Execute the query to produce the results
foreach (City city in queryMajorCities)
{
Console.WriteLine(city);
}
// Output:
// City { Population = 120000 }
// City { Population = 112000 }
// City { Population = 150340 }
// Method-based syntax
IEnumerable queryMajorCities2 = cities.Where(c => c.Population > 100000);`
Actual output is:
City { Name = Tokyo, Population = 37833000 } City { Name = Delhi, Population = 30290000 } City { Name = Shanghai, Population = 27110000 } City { Name = São Paulo, Population = 22043000 }
Recommend updated the where in queryMajorCities.
[Enter feedback here]
Page URL
https://learn.microsoft.com/en-us/dotnet/csharp/linq/get-started/query-expression-basics
Content source URL
https://github.com/dotnet/docs/blob/main/docs/csharp/linq/get-started/query-expression-basics.md
Document Version Independent Id
4fa6e86d-a790-6933-e0ee-a090e3133f0f
Article author
@BillWagner
Metadata
Related Issues
Associated WorkItem - 350767
The text was updated successfully, but these errors were encountered: