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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:14:46+00:00 2026-06-14T20:14:46+00:00

namespace MyStyle { public class Styles { //intended to store style.properties & style.values class

  • 0
namespace MyStyle
{
    public class Styles
    {                  
            //intended to store style.properties & style.values class 

        public sealed class sealdPropsClass 
        {
            public sealed const string DarkBlueColor = "darkBlue";
        }

        public static class staticPropsClass
        {
            public static const string LightBlueColor = "lightBlue";
        }
    }
}

accessing like so :

 using MyStyles;
 
 string ColorBlue = Styles.sealedPropsClass.DarkBlueColor;

in another question about classes and inheritance
I had been warned to refrain the static modifier

reason is : it would be un accessible to others while The Current user
is already Accessing the class

via current page or another web application that uses that class .

what i would like to understand from this example:

1.

How Can i wrap Styles in an outer class(is that what i Should do?) :

so i would be able to use an instance = a clone, of the subject class as in this code below:

public Styles CurrentAppStyles = new Styles();

string darkColor = CurrentAppStyles.sealdPropsClass.DarkBlueColor

2.

if i am importing MyStyle namespace via

 using MyStyle; ///<-- is that an instance ? 

meaning it would not (if there was an Exeption error for that case) alert user:

"Styles.SealedPropsClass.DarkBlueColor is Currently being used, Please try again later…"

or it is actually instantiating the Whole namespace (that’s what i think happens in this case)

and thanks for the Great help i can get here , from your experience and Knowledge !!

updated (source of Question)

this is where i have been warned , could you pleas shed some more light ???

This isn’t answering your question but I noticed this hasn’t been pointed out yet: your mail class is dangerous because it is declared static and has public static fields exposed. **

** update 2** my fault was that i didn’t get from Joshuas comment is actually
sharing the state globally was the issue rather access issue… so , i guess in the case of using constant fields (strings etc…) would not be a problem

  • 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-14T20:14:47+00:00Added an answer on June 14, 2026 at 8:14 pm

    so what i can understand by now that using a static class is not to be avoided at all scenarios
    for example . extention methods are used via a static class , most of my sub classess are static for example :”

    public class container // instanciated so name is not so relevant 
    {                      // e.g : container c = new container()
                           // usage- c.utils.......
        public static class utils // used from an instance of container
        {
          public static int Str2int(string strToConvert)
          {
              return Convert.ToInt32(StrToConvert);
          }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

using namespace std; class A { public: A() {} ~A() {} map<int, string*>& getMap()
namespace pairDemo{ template<typename L, typename R> class pair{ public: pair(const L& left,const R& right)
namespace Dic { public class Key { string name; public Key(string n) { name
namespace KetBanBonPhuong.Controls.Default { public partial class SugFriends : System.Web.UI.UserControl { private string Uid; protected
API: namespace ClassLibrary1 { public class Class1 { public static string Test(string input) {
namespace WpfApplication3 { public class Hex { public String terr; } public class HexC
namespace StorageRoleMVC4.Controllers { public class SearchController : ApiController { public Dictionary<string, string> Get([FromUri] string
namespace std { class type_info { public: virtual ~type_info(); //type_info can serve as a
namespace DataAccessLayer { public class PaymentDAL { public void InsertInGenLedDet(GenLedDet genLedDet) { } }
namespace A { class B { public: B(int); }; } namespace C { class

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.