Yonghui Yonghui - 1 year ago 78
C# Question

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?

Answer Source

I can just add variable named "*mTestVariable".

Like this:

cl.AddVariable("*mTestVariable", cl, 0, EnvDTE.vsCMAccess.vsCMAccessPrivate);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download