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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:37:28+00:00 2026-05-18T01:37:28+00:00

I have an interface based class that I want to have a few static

  • 0

I have an interface based class that I want to have a few static classes as properties. However, I can’t seem to find a way to use a static class as an instance property on a class based on an interface.

public interface IHttpHelp
{
   ItemsManager {get;set;}
}

public static class ItemsManager
{
   //static methods
}

public class HttpHelper
{
   public ItemsManager { get { return ItemsManager;} 
}

The above code won’t work because of the “ItemsManager is used like a variable but it’s a type error.” Is there anyway to use a class this way?

For some insight into what I’m doing – I have a few static helper classes that access the httpruntime and current context. I currently use them directly, but wanted to move into a container class that will be used IoC. I could make them instance classes and forget about it, but I’m wondering f there’s a way to this.

  • 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-18T01:37:29+00:00Added an answer on May 18, 2026 at 1:37 am

    You can’t use a static class like that, because by definition you can’t create an instance of it, so you can’t return it from a property. Make it a singleton instead:

    public class ItemsManager
    {
        #region Singleton implementation
    
        // Make constructor private to avoid instantiation from the outside
        private ItemsManager()
        {
        }
    
        // Create unique instance
        private static readonly ItemsManager _instance = new ItemsManager();
    
        // Expose unique instance
        public static ItemsManager Instance
        {
            get { return _instance; }
        }
    
        #endregion
    
        // instance methods
        // ...
    }
    
    public class HttpHelper
    {
        public ItemsManager ItemsManager { get { return ItemsManager.Instance; } }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to make an application with plugins that also can have plugins (which
I have a class that implements an interface like this; ... = new Location<ICafe>();
I have an interface (say Employee) which has 2 classes that implements it (say
I have Googled and read for hours now and I can't find anyone that
I want to test which interfaces a class/interface is implementing. So I have a
I have a class that has 3 properties: class Three { int ID {
I have a collection of classes that inherit from an abstract class I created.
I have an ASP.NET page that is interacting with a business class. I want
When you have a class car that implements IVehicle and you want to wrap
I have an interface with several events I have base class implementing the interface

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.