> For the complete documentation index, see [llms.txt](https://docs.dot-net.uz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dot-net.uz/c-.net/linq/selectmany.md).

# SelectMany

To’plam elementlarini **IEnumerable** ga o’zlashtiradi va hosil bo’lgan ketma – ketlikni bitta kesamdek tasvirlaydi.

Method ko’rinishi:

```csharp
 static void Main(string[] args)
        {
            List<string> strList = new List<string>() { "Jasurbek", "Xasanboyev" };
            var methodResult = strList.SelectMany(x => x).ToList();
            foreach (var item in methodResult)
            {
                Console.Write(item + " ");
            }
            //Output: J a s u r b e k X a s a n b o y e v 
 }
```

Query ko’rinishi o\`zi aslida vajud emas lekin quydagi ko’rinishda ifodalash mumkin:

```csharp
 static void Main(string[] args)
        {
            List<string> strList = new List<string>() { "Jasurbek", "Xasanboyev" };
            var methodResult = from res in strList
                               from ch in res
                               select ch;
            foreach (var item in methodResult)
            {
                Console.Write(item + " ");
            }
            //Output: J a s u r b e k X a s a n b o y e v 
 }
```

Asosan quydagi holatlar uchun ko’proq ishlatiladi:

```csharp
class Program
    {
        static void Main(string[] args)
        {
            List<Employee> employees = new List<Employee>()
            {
                new Employee(){Id = 1, Name = "Muhammadkarim", Email = "muhammadkarim@gmail.com", Programming = new List<string>(){"PHP", "C#", "SQL"} },
                new Employee(){Id = 2, Name = "Jasurbek", Email = "jasur@gmail.com", Programming = new List<string>(){"C++", "C#", "Arduino"}},
                new Employee(){Id = 3, Name = "Xondamir", Email = "xondamir", Programming = new List<string>(){"C#", "Python", "MVC"}}
            };
            var MethodSyntax = employees.SelectMany(x => x.Programming);
            foreach (var item in MethodSyntax)
            {
                Console.WriteLine(item);
            }
            //Output: PHP, C#, SQL, C++, C#, Arduino, C#, Python, MVC
        }
    }
    class Employee
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public string Email { get; set; }
        public List<String> Programming { get; set; }
    }
```

SelectMany bizga asosan ichma – ich ro’yhatlar bilan ishlashda qo’l keladi. Query syntaxdan ko’ra method syntaxdan foydalanishni tavsiya beraman chunki query uchun SelectMany yo’q ichma ich tanlab kirishga to’g’ri keladi.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.dot-net.uz/c-.net/linq/selectmany.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
