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

  • Home
  • SEARCH
  • 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 3932930
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T23:32:39+00:00 2026-05-19T23:32:39+00:00

I want to dynamically add items to a class, but someone may have to

  • 0

I want to dynamically add items to a class, but someone may have to help me with my syntax here.

I’ve got a ContainerTank class like this:

class ContainerTank {
  double radius;
  public ContainerTank(int diameter) {
    radius = (double)diameter / 2;
  }
  public int Gauge {get;set;}
  public double Volume { get { return (3.1415)*(radius*radius)*Gauge; } }
}

Each of our Sites can have anything from none to an absurd value of 10 tanks (water tanks, oil tanks, etc.).

I can easily create a Class that using List<ContainerTank> tankList to maintain the data in each tank per site, but I’d rather find a way to initialize my class by specifying how many tanks are on a site, then have each tank show up individually.

For example, if I create a new site with 2 tanks, I would have a map to Tank1 and Tank2 (or Tank0 and Tank1 if you want to use zero index).

Why?

For our developers using the code, seeing Tank1 and Tank2 pop up with Visual Studio’s IntelliSense would help them when using our control rather than presenting them with a collection.

Mainly, I want to know if it can be done and how I’d implement it.

  • 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-19T23:32:40+00:00Added an answer on May 19, 2026 at 11:32 pm

    No, this isn’t possible. All class members must be specified when the assembly is compiled.

    If what you’re interested in is purely ease of debugging, it’s possible to write your own debug visualizer.

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

Sidebar

Related Questions

I want to dynamically add javascript to an existing script element something like: var
I want to dynamically add image in EditText . Is it possible? if anyone
I want to add dynamically captured images in hierarchical structure (one after one). I
I want an app or python package that can 1.Dynamically add python script to
I want to dynamically construct a TreeView using Node which represents a typical tree
I have a query returning data that looks like this: Status Total Success 234
I dynamically create gridview, and in this grid I have template field also field.HeaderTemplate
I have a custom view (an extension of a TextView) that I want to
I got a question to ask on building firefox plugin, basically my aim is
Today, I'm building a little form generator for my firm. It would ask for

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.