Rewrite the foreach using lambda + C#3.0
I am tryingv the following 

    foreach (DataRow dr in dt.Rows)
                            {
                                if (dr["TABLE_NAME"].ToString().Contains(sheetName))
                                {
                                    tableName = dr["TABLE_NAME"].ToString();
                                }
                            }

by using lambda like

    string tableName = "";
                            DataTableExtensions.AsEnumerable(dt).ToList().ForEach(i =>
                                {
                                    tableName = i["TABLE_NAME"].ToString().Contains(sheetName);
                                }
                            );

but getting compile time error "cannot implicitly bool to string". So how to achieve the same.?

Thanks(C#3.0)


Rewrite the foreach using lambda + C#3.0
===

I am tryingv the following 

    foreach (DataRow dr in dt.Rows)
                            {
                                if (dr["TABLE_NAME"].ToString().Contains(sheetName))
                                {
                                    tableName = dr["TABLE_NAME"].ToString();
                                }
                            }

by using lambda like

    string tableName = "";
                            DataTableExtensions.AsEnumerable(dt).ToList().ForEach(i =>
                                {
                                    tableName = i["TABLE_NAME"].ToString().Contains(sheetName);
                                }
                            );

but getting compile time error "cannot implicitly bool to string". So how to achieve the same.?

Thanks(C#3.0)

