How do i get the value of first index in a returned List of array

user3809979

I am using C# windows form

I have a List of arrays from a function in a class and I called the function into the form the function returned a List of arrays, how do i get the value of the arrays?

Here is my List of array code

    public List<string[]> getAccounts()
    {
        List<string[]> account = new List<string[]>();

        while (*condition*)
        {
            string[] users = new string[2];
            users[0] = user["firstname"].ToString();
            users[1] = user["lastname"].ToString();
            account.Add(users);
        }
        return account;
    }

and when i call the function I want to show all the firstname into a listbox as well as the last name into another listbox

        for (int i = 1; i <= acc.getAccounts().Count; i++)
        {
            listBoxFirstname.Items.Add(*all the first name from the list*);
        }
Michael B

Use a lambda expression to iterate through the list and select the first name

account.ForEach(s => listBoxFirstname.Items.Add(s[0]));

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

In Julia, how do I get the index of the first element in a sorted array that exceeds a certain value?

From Dev

How do get returned int value of a list in java?

From Dev

How do i get Object index in an array

From Dev

How do I get the index of an object in this array?

From Dev

How do I get the data of a returned value from a spinner?

From Dev

PHP - How do I unset an array index by value inside that index

From Dev

How do I get the first value from a list of keys in a concrete way in Python?

From Dev

How can I get the iteration of the first array index in a map?

From Dev

Use PostgreSQL xpath function and get the first returned value from the array

From Dev

How can I get the index value of a list comprehension?

From Dev

How do I nest an array of items dividing them by their first value?

From Dev

How do I sort a PHP associative array first by value, then by key?

From Dev

How do I nest an array of items dividing them by their first value?

From Dev

How do I get the first character of a string from a linked list?

From Java

How do I check in JavaScript if a value exists at a certain array index?

From Dev

How do I call elements of an array as their index numerical value

From Dev

how can I get the index of the max value in an array?

From Dev

How do I get the list of all terms in a Whoosh index?

From Dev

How do I get a list item by index in elm?

From Dev

How do I get first table value in Lua

From Dev

How do I get the color value from the List<Feature> list?

From Dev

How do I get the index of an array where it contains a string?

From Dev

How do I convert array to hash, whose key is array value and value is index of the array

From Dev

How do I get typeArguments from a List<T> returned by object.getClass().getDeclaredField("fieldname").getGenericType();

From Dev

How do I get all the children of a table without knowing their type, returned to a list?

From Dev

pthread_create(), how do I get the returned value from the passed function

From Dev

pthread_create(), how do I get the returned value from the passed function

From Dev

How can I get parent name of an element returned by .first()?

From Dev

How can i get sum of the values of an array where array index value starts with same value?

Related Related

  1. 1

    In Julia, how do I get the index of the first element in a sorted array that exceeds a certain value?

  2. 2

    How do get returned int value of a list in java?

  3. 3

    How do i get Object index in an array

  4. 4

    How do I get the index of an object in this array?

  5. 5

    How do I get the data of a returned value from a spinner?

  6. 6

    PHP - How do I unset an array index by value inside that index

  7. 7

    How do I get the first value from a list of keys in a concrete way in Python?

  8. 8

    How can I get the iteration of the first array index in a map?

  9. 9

    Use PostgreSQL xpath function and get the first returned value from the array

  10. 10

    How can I get the index value of a list comprehension?

  11. 11

    How do I nest an array of items dividing them by their first value?

  12. 12

    How do I sort a PHP associative array first by value, then by key?

  13. 13

    How do I nest an array of items dividing them by their first value?

  14. 14

    How do I get the first character of a string from a linked list?

  15. 15

    How do I check in JavaScript if a value exists at a certain array index?

  16. 16

    How do I call elements of an array as their index numerical value

  17. 17

    how can I get the index of the max value in an array?

  18. 18

    How do I get the list of all terms in a Whoosh index?

  19. 19

    How do I get a list item by index in elm?

  20. 20

    How do I get first table value in Lua

  21. 21

    How do I get the color value from the List<Feature> list?

  22. 22

    How do I get the index of an array where it contains a string?

  23. 23

    How do I convert array to hash, whose key is array value and value is index of the array

  24. 24

    How do I get typeArguments from a List<T> returned by object.getClass().getDeclaredField("fieldname").getGenericType();

  25. 25

    How do I get all the children of a table without knowing their type, returned to a list?

  26. 26

    pthread_create(), how do I get the returned value from the passed function

  27. 27

    pthread_create(), how do I get the returned value from the passed function

  28. 28

    How can I get parent name of an element returned by .first()?

  29. 29

    How can i get sum of the values of an array where array index value starts with same value?

HotTag

Archive