private void SetConstraintsByReflection() { Constraint = null; //Gets the upper and lower bound for the structure. object[] allAttributes = GetType().GetCustomAttributes(true); foreach (object o in allAttributes) { if (o is Asn1StringConstraint) { Constraint = o as Asn1StringConstraint; break; } } }