using System.Collections.Generic;
public static void Main()
Console.WriteLine("There are {0} errors in the XML configuration.",cfg.Errors().Length);
Console.WriteLine("---");
Console.WriteLine("There are {0} errors in the JSON configuration.",cfg.Errors().Length);
Console.WriteLine("---");
cfg.Load(GetXmlWithoutFruit());
Console.WriteLine("There is {0} error in the fruitless XML configuration.",cfg.Errors().Length);
foreach(var error in cfg.Errors()){
Console.WriteLine(error);
Console.WriteLine("---");
cfg.Load(GetXmlWithAnExtraApple());
Console.WriteLine("There is {0} error in the too many apples XML configuration.",cfg.Errors().Length);
foreach(var error in cfg.Errors()){
Console.WriteLine(error);
Console.WriteLine("---");
cfg.Load(GetXmlWithPinkBanana());
Console.WriteLine("There is {0} error in the pink banana XML configuration.",cfg.Errors().Length);
foreach(var error in cfg.Errors()){
Console.WriteLine(error);
Console.WriteLine("---");
foreach (var fruit in cfg.Fruit) {
foreach (var color in fruit.Colors) {
Console.WriteLine("{0} {1}", color.Name, fruit.Name);
public int Id {get; set; }
public List<Fruit> Fruit { get; set; }
public string Name { get; set; }
public List<Color> Colors {get; set;}
[Cfg(domain="red,yellow,green,blue,purple,orange")]
public string Name {get; set;}
private static string GetXml(){
private static string GetXmlWithoutFruit(){
private static string GetXmlWithAnExtraApple(){
private static string GetXmlWithPinkBanana(){
private static string GetJson(){