Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8601611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:53:02+00:00 2026-06-12T01:53:02+00:00

I have a jagged array of strings in C#. How do I bind it

  • 0

I have a jagged array of strings in C#.

How do I bind it to a DataGrid such that I can see the contents of the array?

Currently in the DataGrid, instead of the array’s contents, I see a column that says “Length”, “Long Length”, “Rank”, “SyncRoot”, etc…basically, properties of the array and not the contents of the array.

My code:

string[][] jagged = new string [100][];

//...jagged array is populated...

dataGridView1.DataSource = jagged;  
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T01:53:04+00:00Added an answer on June 12, 2026 at 1:53 am

    Here is an example that you can try following I didn’t do this with String[] but you can get the Idea

    //
    // 1. Create two dimensional array
    //
    
    const int  dim = 1000;
    
    double[,]  array = new double[dim,dim];
    
    Random ran = new Random();
    for(int r = 0; r < dim; r++)
    {
        for(int c = 0; c < dim; c++)
        {
            array[r,c] = (ran.Next(dim)); // fill it with random numbers.
        }
    }
    
    // 2. Create ArrayDataView class in which 
    // constructor you pass the array 
    // and assign it to DataSource property of DataGrid. 
    
     dataGrid1.DataSource = new ArrayDataView(array);
    

    For String[][] here is an example

    string[][] arr = new string[2][];
    
    arr[0] = new String[] {"a","b"};
    arr[1] = new String[] {"c","d"};
    
    DataGrid1.DataSource = arr[0];
    DataGrid1.DataBind();//The result is: a,b in datagrid
    

    using LinQ look at this

    List<string> names = new List<string>(new string[]
    {
        "John",
        "Frank",
        "Bob"
    });
    
    var bindableNames =
        from name in names
        select new {Names=name};
    
    dataGridView1.DataSource = bindableNames.ToList();
    

    USING LINQ for Multi Denensional Array

    string[][] stringRepresentation = ds.Tables[0].Rows  
        .OfType<DataRow>()  
        .Select(r => ds.Tables[0].Columns  
            .OfType<DataColumn>()  
            .Select(c => r[c.ColumnName].ToString())  
            .ToArray())  
        .ToArray();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have seen that declaring a bidimensional array as a jagged array is fine
I have a jagged array that looks like this: string[][] list = new string[d.Rows.Count
So I have a function that looks up values in a jagged array, and
I currently have a jagged array Class[][][] which I want to serialise as a
I have a 2-dimensional jagged array (though it's always rectangular), which I initialize using
How could I accomplish copying one jagged array to another? For instance, I have
Say I have a jagged array, and position 2,3 is taken by int 3.
I have a method which accept jagged array of Objects. public void MyDataBind(object[][] data)
i have a situation, i need to process an jagged array of 20k registers
I have a jagged uint8 array like this in c++: UINT8 ras[2][3] = {{1,2,3},{4,5,6}}

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.