Get the column details within a for loop

List<Access> Accesses = _context.Accesses.ToList();
List<Agent> Agents = _context.Agents.ToList();
List<Requisition> Requisitions = _context.Requisitions.ToList();
                string[] ar = { d.AccessId };
                string[] arr = ar[0].Split(',');
                int size = arr.Length;
                int[] arr1 = new int[size];
                for (int i = 0; i < size; i++)
                    arr1[i] = Int32.Parse(arr[i]);
                    //Console.WriteLine(arr1[i]);//OutPut Int
                    //Console.WriteLine(arr[i]);//OutPut String
                    int v = arr1[i];
                    IEnumerable<Access> a = from acc in Accesses
                            where acc.IsValid == true
                            && acc.AccessID == v
                            select acc;

I have this piece of code that getting the data from the database that has the data like 1,2,3 I am converting this array to single int inside the for loop. Each time the variable V has a int. Is there a way that we can only retrieve the AccessName from the a variable

Any help is appreciated

Read more here:

Content Attribution

This content was originally published by rrrrTTTyyy at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: