public static void Decode(Object obj, Byte[] buff) { var t = obj.GetType(); var BitProperties = t.GetProperties() .Select(pi => new { pi, a = PlacementAttribute.GetPlacementAttribute(pi) }) .Where(bp => bp.a != null); foreach (var bp in BitProperties) { bp.a.DecodeProperty(bp.pi, obj, buff); } }
public static PlacementAttribute GetPlacementAttribute(PropertyInfo P) { return((PlacementAttribute)PlacementAttribute.GetCustomAttribute(P, typeof(PlacementAttribute))); }