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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:02:33+00:00 2026-05-23T15:02:33+00:00

I think I couldnt do this thing, but I try to ask (maybe :)).

  • 0

I think I couldnt do this thing, but I try to ask (maybe :)).

Suppose I have this Main class :

public class UiUtils
{   
    public static MyObject myObject;
    public UiUtils()
    {
       myObject=new MyObject();
    }
}

now if I want to try to call this instance from another Context Class (web application), I do this :

public partial class context_eventi_CustomClass : System.Web.UI.UserControl
{   
    protected void Page_Load(object sender, EventArgs e)
    {
       Console.Write(UiUtils.myObject.Title());
    }
}   

but what I’d like to do is this :

public partial class context_eventi_CustomClass : System.Web.UI.UserControl
{   
    protected void Page_Load(object sender, EventArgs e)
    {
       Console.Write(myObject.Title());
    }
}

so, use directly myObject and not UiUtils.myObject 🙂

I think this is not possible, but maybe I wrong and there are any strategies 🙂 Thanks

** EDIT **

my solution for the moment :

public class UiUtils
{   
    public static MyObject myObject;
    public UiUtils()
    {
       myObject=new MyObject();
       iContext.myObject = myObject;
    }
}

public class iContext : System.Web.UI.UserControl
{
    public static MyObject myObject;

    public iContext()
    {

    }    

    public iContext(MyObject myObject)
    {
        myObject = myObject;
    }
}

public partial class context_eventi_CustomClass : iContext
{   
    protected void Page_Load(object sender, EventArgs e)
    {
       Console.Write(myObject.Title());
    }
}

seems to works! What do you think about?

  • 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-23T15:02:34+00:00Added an answer on May 23, 2026 at 3:02 pm

    To access the object without typing the class you can use inheritance.

    public class CustomClass : UiUtils
    

    This will share UiUtils properties with CustomClass

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

Sidebar

Related Questions

Sorry if this is duplicate,I would think it would be but couldn't find anything.
I think this question was already asked, but I couldn't find a solution which
I realize that this is probably a very basic question, but I have spent
Couldn't think of better phrasing for this question, but basically I want to store
This may be impossible, but I thought I'd ask before I rework the whole
I have been trying to fix this issue for weeks but I'm at the
OK, so I couldn't really think of an apropos title that summarizes this. The
Sorry about the vague subject but I couldn't think what to put. Here's my
Sorry for the bad title, but I couldn't think of a better one. I'm
I know the questions seems ambiguous, but I couldn't think of any other way

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.