protected int GetAttributeIndex(ExplicitOrDerived attribute)
 {
     while (true)
     {
         if (attribute is ExplicitAttribute expl)
         {
             return(AllExplicitAttributes.IndexOf(expl));
         }
         if (!(attribute is DerivedAttribute derived))
         {
             return(-1);
         }
         attribute = derived.Redeclaring;
     }
 }
 protected virtual string GetCSType(ExplicitOrDerived attribute)
 {
     while (true)
     {
         if (attribute is ExplicitAttribute expl)
         {
             return(TypeHelper.GetCSType(expl, Settings));
         }
         var der = attribute as DerivedAttribute;
         if (der != null && der.Redeclaring == null)
         {
             var result = TypeHelper.GetCSType(der.Domain, Settings, true);
             result = TweekDerivedType(der, result);
             return(result);
         }
         if (der != null)
         {
             attribute = der.Redeclaring;
         }
     }
 }
 // ReSharper disable once InconsistentNaming
 protected string GetInterfaceCSType(ExplicitOrDerived attribute)
 {
     while (true)
     {
         if (attribute is ExplicitAttribute expl)
         {
             return(TypeHelper.GetInterfaceCSType(expl, Settings));
         }
         if (attribute is DerivedAttribute der)
         {
             if (der.Redeclaring == null)
             {
                 var result = TypeHelper.GetCSType(der.Domain, Settings, true, true);
                 result = TweekDerivedType(der, result);
                 //result = result.Replace("List<", "IEnumerable<");
                 return(result);
             }
             attribute = der.Redeclaring;
         }
         return("");
     }
 }