Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9308675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T00:41:09+00:00 2026-06-19T00:41:09+00:00

I have a static array which uses a static variable called Variables.rows to define

  • 0

I have a static array which uses a static variable called Variables.rows to define the number of rows in the array. Variables.rows is defined in another static class called Variables.

public static class TheArrayClass
{
    public static double[,] HiThere = new double[Variables.rows, 6];
}

My problem is that the static array is created as soon as the project in run (I believe). This means that the methods needed to assign the correct value to Variables.Rows are not executed in time. This means that I get an index error when populating the array because the array does not have the correct size.

I need a way around this so that I can access the array from anywhere in my code please.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-19T00:41:10+00:00Added an answer on June 19, 2026 at 12:41 am

    It’s interesting that you didn’t show where Variables.Rows was defined. Either way, you can perform whatever initialization you want in the classe’s constructor.

    public static class TheArrayClass
    {
        public static double[,] HiThere;
    
        static TheArrayClass()
        {
             HiThere = new double[Variables.rows, 6];
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a two dimensional array public class TwoDimensions { public static void main(String[]
I have a class which has a static const array, it has to be
Assume I have an array which holds some struct defined as follows: static struct
Suppose I have some pointer, which I want to reinterpret as static dimension array
I have a class with a static char array. The size of the array
I have an array defined as; static double Temp_data[TABLE_SIZE]; I want to change the
I have a piece of C code which with a chunk of memory(static array)
If I have a static array which does not change after being populated. Multiple
I have the following code which uses one of the JTextAreas from an array
Possible Duplicate: recursive array_diff()? I have a static multidimensional array which is always going

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.