Marking a method or interface as deprecated

  • Thread starter Peter Strøiman
  • Start date
P

Peter Strøiman

Hi.

I have a situation where I'm developing some .NET components that are to be
used from both .NET applications and from COM clients ( the .NET components
are exposed as COM objects ).

The COM clients are old applications that are being modified to use new
code, but are not going to be rewritten to .NET right away.
In order to expose my .NET components to my COM clients I have to write
methods and interfaces that are supposed only to be used from the COM
clients, and when the COM clients have been rewritten to .NET, these methods
and interfaces will be removed from the component.

Is there any way that I can mark a method or interface as deprecated, or do
something else, so if somebody tries to access these methods from a .NET
application they will get a compiler warning?

Thanks in advance
Peter Strøiman
 
J

Jochen Kalmbach

P

Peter Strøiman

beautiful

Jochen Kalmbach said:
Peter said:
Is there any way that I can mark a method or interface as deprecated,
or do something else, so if somebody tries to access these methods
from a .NET application they will get a compiler warning?

See "Obsolete-Attribute":
http://msdn.microsoft.com/library/en-us/csref/html/vclrfobsolete.asp

[Obsolete("Use newMethod instead", false)] // warn if referenced


--
Greetings
Jochen

Do you need a memory-leak finder ?
http://www.codeproject.com/tools/leakfinder.asp
 

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

Top