---
title: "LINQ : Dynamic select"  
description: "LINQ : Dynamic select"  
author: "Anonymous User"  
published: 2013-05-13  
updated: 2013-05-13  
canonical: https://www.mindstick.com/forum/878/linq-dynamic-select  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# LINQ : Dynamic select

Hi [Expert](https://www.mindstick.com/articles/13120/an-expert-financial-advice-will-improve-your-finances)!\
Consider we have this [class](https://www.mindstick.com/blog/165/generic-class-in-c-sharp) :\
[public](https://www.mindstick.com/blog/11097/java-access-modifiers-the-public-and-the-private-modifiers) class Data{ public [string](https://www.mindstick.com/articles/1527/string-split-in-c-sharp) Field1 { get; set; } public string Field2 { get; set; } public string Field3 { get; set; } public string Field4 { get; set; } public string Field5 { get; set; }\
}How do I dynamically [select](https://www.mindstick.com/forum/160534/orderby-then-select-vs-select-then-orderby-performance) for specify columns ? something like this :\
var list = new List<Data>();\
var [result](https://www.mindstick.com/blog/12011/advantages-of-getting-result-oriented-seo-from-an-agency)= list.Select("Field1, Field2"); // How ?\
[Selected fields](https://www.mindstick.com/forum/34099/how-to-customize-selected-fields-in-a-list-in-sencha-touch-app) are not known at [compile](https://www.mindstick.com/forum/2316/how-to-views-compile-in-mvc) time. They would be specified at run time\
Thanks in [advance](https://www.mindstick.com/blog/33258/jee-mains-and-jee-advance-exams)!Any help will be appreciated!\

## Replies

### Reply by AVADHESH PATEL

Hi Ashish!\
Try as following\
\
var result = from g in list.AsEnumerable() \
select new {F1 = g.Field1,F2 = g.Field2};\


---

Original Source: https://www.mindstick.com/forum/878/linq-dynamic-select

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
