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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:28:26+00:00 2026-06-15T12:28:26+00:00

i am stuck with a simple variable assignment , the only condintion to make

  • 0

i am stuck with a simple variable assignment , the only condintion to make it littl complex for me
is that i need the struct values to be private , so they wont be modified alswhwere

and to be able to use values of the struct but in a safe way, i am trying to use public readonly variables . so that’s how i can share information with the application in read only mode , shouldn’t it be simple ?

what am i missing ?

as the application starts in Page_Load i am calling SetTablesMetaDetails()

protected void Page_Load(object sender, EventArgs e)
{
    if(!Page.IsPostBack)
    {
      .... some other App inits here
    }
    
    else
    {
 
    }    

    // this method should be the one that instanciates the DbTable struct
   //..thus sets the values of tables "Name" and "ID"
   currProjData.setTablesReferences(); 
}
  • The struct, will be used to assign values :
            public class DBMetaDetails
            {
                public struct DbTable
                {
                    public DbTable(string tableName, int tableId): this()
                    {
                        this.TableName = tableName;
                        this.TableID = tableId;
                    }

                    public string TableName { get;  set; }
                    public int TableID { get;  set; }
                }
            }
  • The current project class to hold values
public static class currProjData 
{
    static DBMetaDetails.DbTable CustomersMeta = new DBMetaDetails.DbTable();
    static DBMetaDetails.DbTable TimesMeta = new DBMetaDetails.DbTable();

    public static void SetTablesMetaDetails()
    {

        TimesMeta.TableID = HTtIDs.TblTimes;
        TimesMeta.TableName = HTDB_Tables.TblTimes;

        CustomersMeta.TableID = HTtIDs.TblCustomers;
        CustomersMeta.TableName = HTDB_Tables.TblTimeCPAReport;

    }

    public static readonly int CustomersTid = CustomersMeta.TableID;
    public static readonly string CustomersTblName = CustomersMeta.TableName;

    public static readonly int TimesTid = TimesMeta.TableID;
    public static readonly string TimesTblName = TimesMeta.TableName;
}

My Problem is that i need those two sets of tables (Tid & TblName) details to be exposed to rest of application but as application starts it calls the SetTablesMetaDetails()

and the four last lines does not execute , i’ve tried moving this section into SetTablesMetaDetails()
but it’s not the correct syntax , i am geting errors ,

What is the correct way to acomplish assignment of CustomersTid? (offcorse rest of the 3 as well)

public static readonly int CustomersTid = CustomersMeta.TableID;

this is what i am missing cause i don’t know how to get it initialized in same way the struct above does … preferebly in one method call

  • 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-15T12:28:28+00:00Added an answer on June 15, 2026 at 12:28 pm

    Use Properties

    public static int CustomersTid { get { return CustomersMeta.TableID; } }
    public static string CustomersTblName { get { return CustomersMeta.TableName; } }
    
    public static int TimesTid  { get { return TimesMeta.TableID; } }
    public static string TimesTblName  { get { return TimesMeta.TableName; } }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm stuck with a c++ assignment where I should make a simple thread and
I have a simple problem that I've been stuck on for some time and
May it's very simple question, but I'm stuck here. I have variable val as
This shouldn't be this hard, but I'm stuck. We have a simple assignment where
I am stuck in something that probably for you might think is simple! In
This should be simple but for some reason I'm stuck. I have data that
I'm sooo... close but am stuck on one tiny thing that's probably really simple
I am stuck with a simple problem but not able to figure out the
I've been stuck with this simple Sql query for last 3 hours and my
I'm playing with Mockito (1.9.5) and stuck at first simple test case: List mockedList

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.