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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:38:07+00:00 2026-06-07T22:38:07+00:00

I have an implementation of the Shunting-Yard algorithm that I am trying to integrate

  • 0

I have an implementation of the Shunting-Yard algorithm that I am trying to integrate clearly into our framework. Currently I have it all packed into a class with a simple public interface.

namespace MathematicalParser {
  public class ExpressionParser {
    public ExpressionParser(string expression, List<string> variables);
    public double GetNumericValue(Dictionary<string,double> variableValues);
  }
}

Inside this class there are a lot of helper classes, helper enums, static variables etc to map different names to functions. All these are private so that is no concern to the user of the library.

In an effort to improve maintainability of the code I’m trying to separate code that is logically unrelated into their own classes, these classes do however not have any meaning outside of the ExpressionParser so I’d like to limit their visibility to the namespace MathematicalParser (which only contains the ExpressionParser).

How do you best accomplish this in c#, the internal keyword only works on assemblies and private can’t be used in namespaces.

  • 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-07T22:38:08+00:00Added an answer on June 7, 2026 at 10:38 pm

    I wouldn’t do this (same opinion as Joe), but here’s another solution derived from Lopina’s answer: nested classes + partial classes.

    PublicClass.cs:

    namespace MyNamespace
    {
        public partial class PublicClass
        {
            public int ReturnSomeStuff()
            {
                MyHelperClass1 tmp = new MyHelperClass1();
                MyHelperClass2 tmp2 = new MyHelperClass2();
    
                return tmp.GetValue1() + tmp2.GetValue2();
            }
        }
    }
    

    PrivateClass1.cs:

    namespace MyNamespace
    {
        public partial class PublicClass
        {
            private class MyHelperClass1
            {
                public int GetValue1()
                {
                    return 5;
                }
            }
        }
    }
    

    PrivateClass2.cs:

    namespace MyNamespace
    {
        public partial class PublicClass
        {
            private class MyHelperClass2
            {
                public int GetValue2()
                {
                    return 10;
                }
            }
        }
    }
    

    Program.cs:

    public class Program
    {
        private static void Main(string[] args)
        {
            PublicClass tmp = new PublicClass();
    
            MyHelperClass2 zz;  // Can't access MyHelperClass2 here cause it's private
    
            Console.WriteLine(tmp.ReturnSomeStuff());
            Console.ReadLine();
        }
    }
    

    As you can see, your different helper classes are physically separated in different files (maybe it’ll help you maintain your code). And you can’t access them directly, they are private to the PublicClass.

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

Sidebar

Related Questions

I have an implementation of the Zend Search (Lucene) framework on my website that
I have an implementation of the preflow push network flow algorithm that returns the
For example: I have an implementation (say doSomething()) in Base class. I want all
I know that it's OK for a pure virtual function to have an implementation.
I have a c++ implementation file (my.cpp) that indirectly includes a header file (b.h)
I have a Runnable implementation that does some work which might take some time
I have an implementation of an interface, and that interface extends IDisposable . In
I currently have a implementation where some markers coming from JSON list is shown,
Note:I don't mean some theoretical question which don't have any implementation just languages that
I have run into a problem with a custom wpf splash-screen implementation. The problem

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.