Solved

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

Posted on 2008-10-18
5
200 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

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

733 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