Technical Chamber
  • Contact Us
  • Ask Question
  • Login
Search
Question:
Convert a list into a dictionary based on key: .Net

To convert a list into a dictionary based on key with Id, Name, and so on on the list, you should select the Name and combine it into a string.


var dict = lst.ToLookup(x => x.Id)

    .ToDictionary(x => x.Key, x => String.Join(", ", x.Select(y => y.Name)));


.ToList() will return the grouped list of MyData.


Suggested blogs:

>How to create a GCP Cloud Composer V2 instance via Terraform?

>Why You Should Use Google Cloud Vision API in Android Apps

>How to delete duplicate names from Array in Typescript?

>Create data with Typescript Sequelize model without passing in an id?

>Ignore requests by interceptors based on request content in TypeScript?

>How to get the last cell with data for a given column in TypeScript?

>Type key of record in a self-referential manner in TypeScript?

>How to type the values of an object into a spreadsheet in TypeScript?


  • dotnet
Ritu Singh

Ritu Singh

Submit
0 Answers
Top Questions
28-11-2023

How to Debug .NET Blazor MAUI on host Windows machine?

28-11-2023

Convert a list into a dictionary based on key: .Net

18-12-2023

Can't build and run console application solutions in Visual Studio 2023?

28-11-2023

How to use SQLiteBlob when rowId is not an integer?

28-11-2023

How to make Redis cache in .NET 8 work?

Related Questions

  • dotnet
Convert a list into a dictionary based on key: .Net
img
Asked 28-11-2023Ritu Singh
  • dotnet
Why C# (.NET) Build Failed multiple times?
img
Asked 14-12-2023Ritu Singh
  • dotnet
How to use SQLiteBlob when rowId is not an integer?
img
Asked 28-11-2023Ritu Singh
  • dotnet
Can't build and run console application solutions in Visual Studio 2022?
img
Asked 15-12-2023Ritu Singh
  • dotnet
How to Debug .NET Blazor MAUI on host Windows machine?
img
Asked 28-11-2023Ritu Singh
Technical Chamber

We genuinely believe coding is an art, and the Technical Chamber is a platform for all coders to come along. At the Technical Chamber, you will find a variety of resources for all skill levels, including tutorials, articles, and resources for all types of coding languages.

Popular Category
  • Django
  • Typescript
  • Asp.net
  • microservice
  • AWS
Useful Links
  • Write For Us
  • Contact Us
Contact Us
  • The Corenthum, TOWER-A, 2611 , 6th Floor, Sector 62, Noida, Uttar Pradesh 201301
  • contact@adequateinfosoft.com
  • +91- 0120 419 8878

Copyright © 2023 Technical Chamber. All Right Reserved

  • Write For Us
  • Ask Question
  • Contact Us