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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:52:31+00:00 2026-05-26T12:52:31+00:00

I am new to asp.net with C#. Now I need a solution for one

  • 0

I am new to asp.net with C#. Now I need a solution for one issue.

In PHP I can create an array like this:

$arr[] = array('product_id' => 12, 'process_id' => 23, 'note' => 'This is Note');

//Example
Array
(
    [0] => Array
        (
            [product_id] => 12
            [process_id] => 23
            [note] => This is Note
        )

    [1] => Array
        (
            [product_id] => 5
            [process_id] => 19
            [note] => Hello
        )

    [2] => Array
        (
            [product_id] => 8
            [process_id] => 17
            [note] => How to Solve this Issue
        )

)

I want to create the same array structure in asp.net with C#.

Please help me to solve this issue.

  • 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-05-26T12:52:31+00:00Added an answer on May 26, 2026 at 12:52 pm

    Use a Dictionary<TKey, TValue> for quick lookups of a value (your object) based on a key (your string).

    var dictionary = new Dictionary<string, object>();
    dictionary.Add("product_id", 12);
    // etc.
    
    object productId = dictionary["product_id"];
    

    To simplify the Add operation, you could use collection initialization syntax such as

    var dictionary = new Dictionary<string, int> { { "product_id", 12 }, { "process_id", 23 }, /* etc */ };
    

    Edit

    With your update, I would go ahead and define a proper type to encapsulate your data

    class Foo
    {
        public int ProductId { get; set; }
        public int ProcessId { get; set; }
        public string Note { get; set; } 
    }
    

    And then create an array or list of that type.

    var list = new List<Foo>
               {
                    new Foo { ProductId = 1, ProcessId = 2, Note = "Hello" },
                    new Foo { ProductId = 3, ProcessId = 4, Note = "World" },
                    /* etc */
               };
    

    And then you have a list of strongly-typed objects you can iterate over, bind to controls, etc.

    var firstFoo = list[0];
    someLabel.Text = firstFoo.ProductId.ToString();
    anotherLabel.Text = firstFoo.Note;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to ASP.NET MVC so this could have an obvious answer. Right now
When I start a new ASP.NET project in Visual Studio, I can create an
I'm building a new Asp.Net MVC3 solution and would like to have all the
I'm new to asp.net and now following through the http://nerddinnerbook.s3.amazonaws.com/Part1.htm howto. All is fine
I create new ASP.NET web application that use SMTP to send message. The problem
I have an asp.net mvc application and now I need to add a web
Have been stuck with this issue for a few days now, and really need,
I'm developing a website in asp.net and now I need to convert it to
I am quite new to asp.net,I am building an application where I need to
I am new to asp.net & IIS. Now I am deploying a web site

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.