I created an array and tried to get the length of this array, but

This is my code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] arr = {1,2,3,4,5,6,7,8,9,10};
            Console.WriteLine("first dimension length", arr.Length);

        }
    }
}

This is the screenshot of the output:
[IMG]http://a.imageshack.us/img530/3566/arry.jpg[/IMG]

Please tell me where I did wrong.
Thanks.

Recommended Answers

All 2 Replies

You forgot to add the place holder for the value.

Console.WriteLine("first dimension length {0}", arr.Length);
commented: Too fast for me :P That's what I get for going out and stuff +1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.