Search code examples
c#vsixvspackagevs-extensibility

VSPackage, how to add a pointer type variable to a CodeClass


I'm working on my own vspackage. I can add variables to my class by using AddVariable.

The "cl" is a class named "TestPage", and following code insert "TestPage mTestVariable" to my class.

CodeClass cl = element as CodeClass;
cl.AddVariable("mTestVariable", cl, 0, EnvDTE.vsCMAccess.vsCMAccessPrivate);

Now I want to insert a pointer to my class, like this:

TestPage* mTestVariable;

How should I do?


Solution

  • I can just add variable named "*mTestVariable".

    Like this:

    cl.AddVariable("*mTestVariable", cl, 0, EnvDTE.vsCMAccess.vsCMAccessPrivate);