public static void Main()
Console.WriteLine("childClassOne");
var cc1 = new childClassOne();
Console.WriteLine("\nchildClassTwo");
var cc2 = new childClassTwo();
abstract public class containerClass
protected containerClass()
protected Comparison<PropertyInfo> comparer = (x,y) => {
var type = typeof(ProperyOrderAttribute);
var xAttr = x.GetCustomAttributes(type, false);
var yAttr = y.GetCustomAttributes(type, false);
var xOrder = xAttr.Count() > 0 ?
(xAttr[0] as ProperyOrderAttribute).Order :
var yOrder = yAttr.Count() > 0 ?
(yAttr[0] as ProperyOrderAttribute).Order :
return xOrder.CompareTo(yOrder);
virtual protected void parseData()
var properties = this.GetType().GetProperties();
Array.Sort(properties, comparer);
foreach (var p in properties)
var propValue = p.GetValue(this);
Console.WriteLine(string.Format("{0} = {1}", propName, propValue));
[System.AttributeUsage(System.AttributeTargets.Property)]
public class ProperyOrderAttribute : System.Attribute
public ProperyOrderAttribute(int order)
public class childClassOne : containerClass
public childClassOne(): base ()
var3S = "2015-04-22T15:55:25.2625065-07:00";
[ProperyOrderAttribute(0)]
[ProperyOrderAttribute(1)]
[ProperyOrderAttribute(2)]
[ProperyOrderAttribute(3)]
[ProperyOrderAttribute(4)]
[ProperyOrderAttribute(5)]
public class childClassTwo : containerClass
public childClassTwo(): base ()