0

I wish to write a custom rule for StyleCop that is the opposite of SA1101; namely, I want a violation to occur if there is a redundant this. (similar to ReSharper). This happens if the methods/indexers/delegates/constructors containing the element does not have a parameter that is the same name as the element.

For the custom source analyzer, within the VisitElement(CsElement element, CsElement parentElement, T context), how do I get the names of the parameter of each methods/indexers/delegates/constructors containing the element?

cubetwo1729
  • 1,438
  • 1
  • 11
  • 18

1 Answers1

1

You can cast the CsElement to StyleCop.CSharp.IParameterContainer, then use its Parameters property to retrieve the parameters.

Nicole Calinoiu
  • 20,843
  • 2
  • 44
  • 49