/// <summary>
 /// Get any constraints for the specified <see cref="TypeParameter"/> on this method, or on the base virtual method if this method is an override.
 /// </summary>
 public List <TypeParameterConstraint> GetTypeParameterConstraints(TypeParameter typeParameter)
 {
     // Override methods don't specify constraints - they inherit them from the base virtual method.
     // In order to handle invalid code, just look in the first occurrence of constraints, searching
     // any base method if the current one is an override.
     if (_constraintClauses != null && _constraintClauses.Count > 0)
     {
         foreach (ConstraintClause constraintClause in _constraintClauses)
         {
             if (constraintClause.TypeParameter.Reference == typeParameter)
             {
                 return(constraintClause.Constraints);
             }
         }
     }
     else
     {
         MethodRef baseMethodRef = FindBaseMethod();
         if (baseMethodRef != null)
         {
             // If the constraints are from a base method, we have to translate the type parameter
             int index = FindTypeParameterIndex(typeParameter);
             TypeParameterRef typeParameterRef = baseMethodRef.GetTypeParameter(index);
             return(baseMethodRef.GetTypeParameterConstraints(typeParameterRef));
         }
     }
     return(null);
 }