Skip to content

Instead of for Loop , i would like to written in LINQ

Preethi

Asked Nov 30, 2017, 11:44 PM EST1 answer
Share
LinkedInX
Code
for (int a = 0; a < dtResourceDetails.Rows.Count; a++)
{
 string ResourceId = dtResourceDetails.Rows[a]["ResourceId"].ToString();
 rcbInstruments.Items.Remove(rcbInstruments.FindItemIndexByValue(ResourceId));
}
 
I written this for loop same thing i have to written using LINQ.
Any one Please help me... it's very urgent for me 

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    I written something like this...
     
     
    Code
    var results = (from myRow in dtResourceDetails.AsEnumerable()
                                       select myRow.Field<string>("ResourceId")).ToString();
                        rcbInstruments.Items.Remove(rcbInstruments.FindItemIndexByValue(results));
     
     
    But it is not working...while executing it is showing like  "System.Data.EnumerableRowCollection`1[System.String]"
    0