I have an XML configuration file with a set of lines like this:
<SomeSetting>value</SomeSetting>
<SomeOtherSetting>value</SomeOtherSetting>
<TypesOfThings>
<Thing>Type 1</Thing>
<Thing>Type 2</Thing>
<Thing>Type 3</Thing>
</TypesOfThings>
These "things" become parameters in the user interface of the application.
My question is, should I create an item class to use Serialization correctly, or is there a way to use attributes to read strings right in the list?
For example (bodies and private vars are removed for brevity, this is .NET 2.0):
[Serializable]
public class Config
{
public string SomeSetting
{
get;
set;
}
public string SomeOtherSetting
{
get;
set;
}
public List<string> TypesOfThings
{
get;
set;
}
}
source
share