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 9188071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:55:35+00:00 2026-06-17T19:55:35+00:00

Is there a way in c# to have an array of multiple variables? for

  • 0

Is there a way in c# to have an array of multiple variables?

for instance, I have data for a stock:

Date |Open |High |Low |Close

10-01-2012| 10.00| 11.01| 9.56| 10.56

10-02-2012| 10.56| 10.99| 9.21| 9.99

10-03-2012| 9.99 | 10.12| 9.78| 10.11


What I would like to do, is create an array which takes a DateTime and a String variable, and outputs a double/string.

So, if I wanted to get the Open price of the stock on 10-01-2012, I could say

DateTime Day = Convert.ToDateTime(“10-01-2012″);
double openPrice = MyArray[Day,”Open”];

and it would return 10.00, as either a double or a string.

What is the best way to do this? Is this even possible with an array? If not, what other methods can I use? I have been thinking about this for a while, and I’m not sure the best way to structure this array/object

Thanks for any help!

  • 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-17T19:55:35+00:00Added an answer on June 17, 2026 at 7:55 pm

    Possibly better to make a single class to contain your data, and create an array or List of those;

    class DailyPrice
    {
        DateTime Date { get; set; }
        decimal Open { get; set; }
        decimal Close { get; set; }
        decimal High { get; set; }
        decimal Low { get; set; }
    }
    
    
    static class Program
    {
        static void Main()
        {
            List<DailyPrice> prices = new List<DailyPrice>();
            prices.Add(new DailyPrice() { Date = DateTime.Today, Open = 11.11M, Close=... });
            prices.Add(new DailyPrice() { Date = DateTime.Today, Open = 12.14M, High=... });
            ...
        }
    }
    

    Incidentally, due to precision problems when performing arithmetic with the double type in C#, it’s safer to user decimal for monetary values (which I assume is what you have here).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have an array of data and a variable (or multiple variables)
I have an array containing multiple integers, is there a common way for sorting
Say I have an array of number a <- c(1,2,3,6,7,8,9,10,20) if there a way
Does anyone know do there have any way that I can encrypt the array
Is there any way to obtain Object array of Java Bean fields? I have
Is there a way to access/store multiple arrays or data which could be compared
I have an array of structures that contain multiple variables: struct test_case { const
I have two arrays : name[] and roll[] Is there a way to traverse
Is there a way to have setup/teardown code automagically run before/after each test? Something
Is there a way to have a template specialization based on a range of

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.