Solved

how do change the attach code snippet to become a 2 or 3 dimensioned variable array?

Posted on 2008-10-18
5
180 Views
Last Modified: 2013-12-17
how do change the attach code snippet to become a 3 dimensioned variable array?

i.e.   string, bool  & int values per entry
private static string[] inputWords;
 

        public static string[] _inputWords

        {

            get { return inputWords; }

            set { inputWords = value; }

        }

Open in new window

0
Comment
Question by:amillyard
  • 3
  • 2
5 Comments
 
LVL 16

Expert Comment

by:CuteBug
ID: 22749338
A three dimensional array can be declared the following way

private static string[,,] inputWords;

public static string[,,] _inputWords
{
     get { return inputWords; }
     set { inputWords = value; }
}

0
 

Author Comment

by:amillyard
ID: 22749354
CuteBug: thanks -- but I am not quite understanding the changes (..)

value
  [0] -- should contain a string, bool and int value
  [1] -- should contain a string, bool and int value etc....
0
 
LVL 16

Accepted Solution

by:
CuteBug earned 500 total points
ID: 22749371
In that case you should define a array of a struct.


struct MyData

{

   string StringValue;

   bool BoolValue;

   int IntValue;

}
 

private static MyData[] inputData;
 

public static MyData[] _inputData

{

     get { return inputData; }

     set { inputData= value; }

}

Open in new window

0
 

Author Comment

by:amillyard
ID: 22749641
I am getting the following compile error


Error      1      Inconsistent accessibility: property type 'GlobalVars.MyData[]' is less accessible than property 'MENTOR_AI.GlobalVars._inputData
0
 

Author Comment

by:amillyard
ID: 22749888
it's ok -- I had a 'public' as follows:

public struct MyData

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now