C#数组例子

一段C#的数组示例,看得我头大

using System;
 
    class Program
    {
        public static  void Main()
        {
            int[] myInts ={ 5, 10, 15 };
            bool[][] myBools = new bool[2] [];
            myBools[0] = new bool[2];
            myBools[1] = new bool[1];
            double[,] myDoubles = new double[2, 2];
            string[] myString = new string[3];
            Console.WriteLine("myInts[0]:{0}, myInts[1]:{1}, myInts[2]:{2}", myInts[0], myInts[1], myInts[2]);
 
            myBools[0][0]=true;
            myBools[0][1] = false;
            myBools[1][0]=true;
            Console.WriteLine("myBools[0][0]: {0}, myBools[1][0]:{1}", myBools[0][0], myBools[1][0]);
 
            myDoubles[0, 0] = 3.147;
            myDoubles[0, 1] = 7.157;
            myDoubles[1, 1] = 2.117;
            myDoubles[1, 0] = 56.000123234234;
            Console.WriteLine("myDoubles[0,0]:{0}, myDoubles[1,0]:{1}", myDoubles[0,0], myDoubles[1,0]);
 
            myString[0] = "Joe";
            myString[1] = "Matt";
            myString[2] = "Robert";
            Console.WriteLine("myString[0]:{0}, myString[1]:{1}, myString[2]:{2}", myString[0], myString[1], myString[2]);
        }
    }

暧昧帖

Tags : ,

Google Reader Yahoo Facebook Twitter Digg FriendFeed Delicious Google Translate
This entry was posted onJuly 6th, 2009 at 17:27. You can follow any responses to this entry through the RSS 2.0. You can Leave a response, or Trackback.

One Response

Comments(1)Trackbacks(0)

  1. onyx

    интересно читать, спасибо

    2009/08/31 18:51 | #1 @

Leave a Reply

(Ctrl+Enter)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

27 queries. 0.398 seconds