dotnet / dotnet/dotnet-api-docs

Queryable.Min misleading comment

Open
#1,077 0 comments 0 reactions 0 assignees View on GitHub
area-System.Linq dotnet-api/prod Pri2 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

The comment in the code example is misleading:
```
// Get the Pet object that has the smallest Age value.
int min = pets.AsQueryable().Min(pet => pet.Age);
```
The following line does not get the `Pet` object, instead, it gets the `Age` of the `Pet` object that has the minimum `Age`.

Note: I was looking for a method that would return the Pet object corresponding to the minimum projected value.

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: 85e2552e-beea-e14a-d379-5662ea934012
* Version Independent ID: 846fa5ca-1271-e1a9-2f48-4d85c76e35b2
* Content: [Queryable.Min Method (System.Linq)](https://docs.microsoft.com/en-us/dotnet/api/system.linq.queryable.min?view=netframework-4.7.2)
* Content Source: [xml/System.Linq/Queryable.xml](https://github.com/dotnet/dotnet-api-docs/blob/master/xml/System.Linq/Queryable.xml)
* Product: **dotnet-api**
* GitHub Login: @dotnet-bot
* Microsoft Alias: **dotnetcontent**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.