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