Solved

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

Posted on 2008-10-18
5
171 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
it's ok -- I had a 'public' as follows:

public struct MyData

0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

772 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

9 Experts available now in Live!

Get 1:1 Help Now