Solved

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

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

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 document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

832 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