Search code examples
c#visual-studioenvdte

Get base constructor parameter from a class


I have a class like this

public class cmdGetAllCustomers : CommandBase
{
    public cmdGetAllCustomers(WToken token)
        : base(token, false, typeof(WCustomer))
    {
    }

    // ...
}

I need to get the type of the third base constructor parameter. In this case that would be WCustomer.

I have already found the CodeClass object for the class and also the CodeFunction object which, in my understanding, represents the constructor.

Within CodeFunction there are CodeParameters, which describe almost what I am searching for, all constructor parameters, except the ones from the base class.

Got anyone a idea on how to get these types with EnvDTE?


Solution

  • If found that solutions made in comments are not really read-friendly and therfore will not be read.

    So, here ist the solution which worked for me:

    Thanks, i got the full content and parse it. Should be the solution! (string functionContent = codeFunction.StartPoint.CreateEditPoint().GetText(codeFunction.EndPoint);)