Marking a method or interface as deprecated

  • Thread starter Thread starter Peter Strøiman
  • Start date 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
 
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
 
Back
Top