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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:48:54+00:00 2026-06-02T02:48:54+00:00

I have a static class Manager it should adapt between two tiers of logic

  • 0

I have a static class Manager it should adapt between two tiers of logic would it be a bad practice
to devide functionalitlies by nesting static classes inside it?
I have about two dozen diffrent subjects to manage with 2 -3 functions each.
and would like to avoid creating 2 dozen classes for this

I mean use this:

static class Manager
{
    static class Type1
    {
        static void Method1();
        static void Method2();
        static void Method3(); 
    }
    static class Type2
    {
        static void Method4();
        static void Method5();
        static void Method6(); 
    }
    static class Type3
    {
        static void Method7();
        static void Method8();
        static void Method9();
    }
}

instead of:

static class Manager
{
        static void Method1();
        static void Method2();
        static void Method3(); 
        static void Method4();
        static void Method5();
        static void Method6(); 
        static void Method7();
        static void Method8();
        static void Method9();
}

something like namespaces, but inside a class.

  • 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-02T02:48:56+00:00Added an answer on June 2, 2026 at 2:48 am

    There are a number of options, if you are about design choices.

    First, you can pour everything into a single class which would be terribly hard to debug and mixed several responsibilities.

    Second, you can create nested classes, as you also noted, where you have better seperation of concerns / code but still have everything hardcoded and in one big source-code file.

    Third, which is much more extendable, you can consider any container pattern you wish. I have listed one below which keeps your classes seperate and more easily testable should you care, as well as swappable.

    interface IManagementRole 
    {
    }
    
    class Dummy1: IManagementRole
    {
        public void Method1() { Console.WriteLine("Dummy1.Method1()"); }
        public void Method2() { Console.WriteLine("Dummy1.Method2()"); }
    }
    
    class Dummy2: IManagementRole
    {
        public void Method3() { Console.WriteLine("Dummy2.Method3()"); }
        public void Method4() { Console.WriteLine("Dummy2.Method4()"); }
    }
    
    static class Manager
    {
        private static Dictionary<Type, IManagementRole> myTypes = new Dictionary<Type, IManagementRole>();
    
        static Manager()
        {
            myTypes.Add(typeof(Dummy1), new Dummy1());
            myTypes.Add(typeof(Dummy2), new Dummy2());
        }
    
        public static T GetManagableType<T>() where T: class
        {
            if (myTypes.ContainsKey(typeof(T)))
            {
                return myTypes[typeof(T)] as T;
            }
    
            throw new ArgumentException("Type is not a managable type.", "T");
        }
    }
    
    class Program
    {
        public static void Main(string[] args)
        {
            Manager.GetManagableType<Dummy1>().Method1();
            Manager.GetManagableType<Dummy1>().Method2();
            Manager.GetManagableType<Dummy2>().Method3();
    
            Console.Write("Press any key to continue . . . ");
            Console.ReadKey(true);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a static class that I use as my Data Utils for my
I have a static class in a shared project, which I want to extend
I have a static class with no static constructor, but many static members. I
I have public static class A { public static string ConnString; } [Serializable] public
I have a static class that looks like this: namespace Argus { static class
So I have a static class that is supposed to be used as a
I have a static field in a non static class. public class DBtools {
Let's say I have a static class with a static method. Multiple threads can
In my testing project, I have a static class called FixtureSetup which I use
This has defeated me. I want to have a static class variable which is

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.