c# - How can I make DataTable enumerable? -


I can not use asEnumerable () on DataTable, I am using C # 3 but I'm just targeting 2.0 framework (LINQ capacity). ) Is there any way I can make dataable calculable without using the selection ()?

  bool isExisting = (Datasource as DATATAS). Choose (). Any (xxx => (string) dr ["filename"] == file name);  

Update:

I wanted to show it like this:

  bool isExisting = (bdsAttachments.DataSource as DataTable ) .Asnumerable (). Any (xx = & gt; (string) dr ["filename"] == filename); I'm getting a hint that the DataTable selection method copies, I'm just thinking about using AsEnumerable, the problem is that I'm just 2.0 frameworks, the system . I'm targeting data. Dataset extension is not available  

BTW, I tried to do this :, but there are compilation errors in it.

public static IEnumerable & lt; DataRow & gt; Enemerate RO (this datatable table) {foreach (rows in table .ro) {returns the row of returns; }}

allows you to call:

  bool isExisting = (bdsAttachments.DataSource as DataTable). Any (dr = & gt; (string) dr ["filename"] == file name);  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -