I have some projects in my solution and in one of them I will have the settings configured with some parameters.
My question is: If you referenced this project in others, can I read these parameters in each project?
I have some projects in my solution and in one of them I will have the settings configured with some parameters.
My question is: If you referenced this project in others, can I read these parameters in each project?
You basically have two options:
settings
, you can change the modifier of class Settings
from internal
to public
If you do not want to expose all properties set in settings
, you can create a class to implement encapsulation. Ex:
public class AcessoAoSettings
{
public Propriedade1
{
get
{
return Properties.Settings.Default.Propriedade1;
}
set
{
Properties.Settings.Default.Propriedade1 = value;
}
}
public Propriedade2
{
get
{
return Properties.Settings.Default.Propriedade2;
}
private set;
}
}
I particularly prefer the second option because if you want, you can control write access (in this code, Propriedade2
does this by leaving set
as private
).