Professional Web Applications Themes

how do i declare const array? - ASP.NET General

I need to declare const 2 dimensional array something like string[][2] topmenu = { {"menu1", "aaa"}, {"menu2", "bbb"} } Thanks. George....

  1. #1

    Default how do i declare const array?

    I need to declare const 2 dimensional array

    something like
    string[][2] topmenu = { {"menu1", "aaa"}, {"menu2", "bbb"} }

    Thanks.
    George.


    George Guest

  2. #2

    Default Re: how do i declare const array?

    string[][] topmenu = {new string[] {"menu1", "aaa"},new string[]{"menu2",
    "bbb"}};

    "George Ter-Saakov" <com> wrote in message
    news:%phx.gbl... 


    MS Guest

  3. #3

    Default Re: how do i declare const array?

    string[,] siblings = new string[2, 2] { {"Mike","Amy"}, {"Mary","Albert"} };

    "George Ter-Saakov" <com> wrote in message
    news:%phx.gbl... 


    MS Guest

  4. #4

    Default how do i declare const array?

    George,

    Hope following code helps you.....

    // Single-dimensional arrays.
    int[] myArray1 = new int [5];
    string[] myArray2 = new string[6];

    // Multidimensional arrays.
    int[,] myArray3 = new int[4,2];
    int[,,] myArray4 = new int [4,2,3];

    // Jagged array.
    int[][] myArray5 = new int[3][];

    Thanks,

    Tap 
    {"menu2", "bbb"} } 
    Tap Guest

  5. #5

    Default Re: how do i declare const array?

    None of it works with const.

    const string[,] siblings = { {"Gus", "Amy"}, {"Mary", "Albert"} }; - error

    Array initializers can only be used in a variable or field initializer. Try
    using a new expression instead.


    George.

    "MS News (MS ILM)" <com> wrote in message
    news:phx.gbl... 
    >
    >[/ref]


    George Guest

Similar Threads

  1. Replies: 0
    Last Post: October 23rd, 08:36 PM
  2. #39242 [NEW]: Cannot declare a static array with an index
    By z_rules55 at hotmail dot com in forum PHP Bugs
    Replies: 0
    Last Post: October 23rd, 08:30 PM
  3. #26050 [Opn->Bgs]: Unable to use CONST vars in other CONST vars
    By sniper@php.net in forum PHP Development
    Replies: 0
    Last Post: October 31st, 01:41 PM
  4. #26050 [NEW]: Unable to use CONST vars in other CONST vars
    By kris dot hofmans at pandora dot be in forum PHP Development
    Replies: 0
    Last Post: October 31st, 10:24 AM
  5. Replies: 0
    Last Post: July 5th, 06:13 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139