Extract index position from List<object[]>

ankit goel 766 Reputation points
2022-12-14T11:36:20.89+00:00

@Jack J Jun , I am trying to extract index position and from that, extract string from list of objects but the value is returning always -1 . The purpose is to create a list of strings which will be used to create another list of strings
what my data in the list of objects is
270469-image.png
what i am trying to achieve
![270500-image.png]3

270545-query1-14dec.txt

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,465 questions
0 comments No comments
{count} votes

Accepted answer
  1. P a u l 10,756 Reputation points
    2022-12-14T12:02:25.717+00:00

    I think this is because you're .ToString() on the object[] as you're looping through a List<object[]>. If you access the first element of the array and then .ToString() that then it should work:

    i.e. if you change this:

       listnew[i].ToString()  
    

    To this:

       listnew[i][0].ToString()  
    
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.