Count Columns in jagged Array - CSharp System

CSharp examples for System:Array Dimension

Description

Count Columns in jagged Array

Demo Code


using System.Text;
using System.Linq;

public class Main{
        public static int CountColumns<T>(this T[][] jaggedArray)
        {// w ww  .j  a  v a2s  . com
            return jaggedArray.Max(arg => arg.Length);
        }
        public static int CountColumns<T>(this T[,] multiArray)
        {
            return multiArray.GetLength(1);
        }
}

Related Tutorials