---
title: "How can I convert IEnumerable<T> to List<T> in C#?"  
description: "How can I convert IEnumerable<T> to List<T> in C#?"  
author: "Anonymous User"  
published: 2013-11-14  
updated: 2013-11-14  
canonical: https://www.mindstick.com/forum/1733/how-can-i-convert-ienumerable-t-to-list-t-in-c-sharp  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# How can I convert IEnumerable<T> to List<T> in C#?

I am using [LINQ](https://www.mindstick.com/articles/12007/language-integrated-query-linq-queries) to [query](https://www.mindstick.com/blog/202/sub-query-in-sqlserver) a generic [dictionary](https://www.mindstick.com/articles/1500/hashtable-and-dictionary-in-c-sharp) and then use the [result](https://www.mindstick.com/blog/12011/advantages-of-getting-result-oriented-seo-from-an-agency) as the [datasource](https://www.mindstick.com/blog/447/listing-the-databases-connected-to-the-datasource) for my ListView.

Dictionary<[Guid](https://www.mindstick.com/forum/12585/cast-the-value-returned-from-user-identity-getuserid-to-make-it-a-guid), Record> dict = GetAllRecords();

List<Record> searchResults = new List<Record>();

[var](https://www.mindstick.com/forum/33920/what-is-different-var-and-dynamic-types-in-c-sharp) matches = dict.Values.Where(rec => rec.Name == "foo");

[foreach](https://www.mindstick.com/forum/33870/how-parallel-foreach-works-internally) (Record rec in matches)

searchResults.Add(rec);

myListView.DataSource = searchResults;

myListView.DataBind();

## Replies

### Reply by Pravesh Singh

Hi Ben,

Try this:

var matches = dict.Values.Where(rec => rec.Name == "foo").ToList();\
\


---

Original Source: https://www.mindstick.com/forum/1733/how-can-i-convert-ienumerable-t-to-list-t-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
