© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
10 replies
Ronnie

✅ help with 2D arrays

using System;
using System.Collections.Generic;


namespace CSharp
{
    class Program
    {
        static void Main(string[] args)
        {       
            
           int[,] arr = { {1, 2, 3}, {4, 5, 6} };

           foreach (int i in arr){
                Console.WriteLine(arr[i]);
           }
        }
    }
}
using System;
using System.Collections.Generic;


namespace CSharp
{
    class Program
    {
        static void Main(string[] args)
        {       
            
           int[,] arr = { {1, 2, 3}, {4, 5, 6} };

           foreach (int i in arr){
                Console.WriteLine(arr[i]);
           }
        }
    }
}
How would i loop thorugh a 2d array and print their values instead of their index? this is hat i have so far
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ input and output file help with 2d arrays
C#CC# / help
3y ago
❔ Working w/ 2D Arrays
C#CC# / help
3y ago
Reading in a File 2D Arrays
C#CC# / help
2y ago