Generating implementation declaration - CodeClass.AddImplementedInterface()fails

  • Thread starter Thread starter Philipp Sumi
  • Start date Start date
P

Philipp Sumi

Hello newsgroup

I want to add an interface declaration to a class using the EnvDTE
objects. Unfortunately, this code fails:

CodeClass cc = ....
cc.AddImplementedInterface("System.IComparable", (long)-1);

This code doesn't work - I'm always getting an exception that says
"Wrong Parameter".

CodeClass.AddBase() works, but the interface name is set immediately
behind the class name, ignoring the position parameter. This screws up
code for classes that inherit from other classes:

class myClass: System.IComparable, BaseClass instead of
class myClass: BaseClass, System.IComparable

Any workaround on this?

Thanks for your advice

Philipp
 
Philipp,
CodeClass cc = ....
cc.AddImplementedInterface("System.IComparable", (long)-1);

Have you tried it without the cast to long? In other words, keep -1 as
an int.



Mattias
 
Hello Mattias

That was the first thing I tried - doesn't work either. As the
documentation mentions long values, I tried it with a cast but with the
same result...

Philipp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top