I have some configuration stored in the following data structure which uses nested classes for Organization.
public abstract class LogoSpec
{
public abstract byte[] Logo { get; set; }
public class Web
{
public static float Width { get; set; }
public static float Height { get; set; }
public class A4 : Web
{
public static float Left { get; set; }
public static float Top { get; set; }
}
public class Letter : Web
{
public static float Left { get; set; }
public static float Top { get; set; }
}
}
public class Print
{
public static float Width { get; set; }
public static float Height { get; set; }
public class A4 : Print
{
public static float Left { get; set; }
public static float Top { get; set; }
}
public class Letter : Print
{
public static float Left { get; set; }
public static float Top { get; set; }
}
}
}
public class SampleLogo : LogoSpec
{
public override byte[] Logo { get; set; }
}
I can easily use it when I exactly know what value to use at design time
// Usage
SampleLogo.Web.A4.Height = 10.25f;
How can I retrieve these values on runtime using reflection?
Aucun commentaire:
Enregistrer un commentaire