473,474 Members | 1,850 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Marking code deprecated

How do I mark a method or class in my library as deprecated, so that when it
is used by some other application, the compiler will issue a warning?
Jun 14 '07 #1
9 23227
Michael,

You want to add the Obsolete attribute to it.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"michael sorens" <m_********@newsgroup.nospamwrote in message
news:1A**********************************@microsof t.com...
How do I mark a method or class in my library as deprecated, so that when
it
is used by some other application, the compiler will issue a warning?

Jun 14 '07 #2
Hi,

Yes, just as Nicholas pointed out, you may use ObsoleteAttribute for this
task. Actually, .Net Base Class Library also uses ObsoleteAttribute to mark
obsolete classes or methods. For example, if you search
AppDomain.AppendPrivatePath Method in .Net2.0 MSDN, you will see the
following:
[ObsoleteAttribute("AppDomain.AppendPrivatePath has been deprecated. Please
investigate the use of AppDomainSetup.PrivateBinPath instead.
http://go.microsoft.com/fwlink/?linkid=14202")]
public void AppendPrivatePath (
string path
)

Thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Jun 15 '07 #3
Thank you. I will give that a try...
Could I also ask where I might find an overview article on attributes? I
have had occasion to use a few now and then (this one, with nunit, and
others) but I would like to learn a bit more about them, including which ones
are available (like the ObsoleteAttribute).

Jun 17 '07 #4
On Jun 14, 11:43 am, michael sorens <m_j_sor...@newsgroup.nospam>
wrote:
How do I mark a method or class in my library as deprecated, so that when it
is used by some other application, the compiler will issue a warning?
It might be a good idea to use the EditorBrowsableAttribute as well.
Intellisense uses this attribute to decide whether or not to display
the member.

Jun 18 '07 #5
Hi Michael ,

Yes, Attribute is an essential mechanism of .Net. You may read the 2 links
below to understand the Attribute feature in .Net:
"Attributes Tutorial"
http://msdn2.microsoft.com/en-us/lib...54(VS.71).aspx
"Designing With Custom Attributes"
http://msdn.microsoft.com/msdnmag/is...asicInstincts/

Since all the .Net BCL Attribute classes inherited from System.Attribute
class, you may search and examine the "Attribute Hierarchy" below to find
any useful attribute in .Net BCL:
http://msdn2.microsoft.com/en-us/lib...96(VS.80).aspx

However, as you can see, the "Attribute Hierarchy" is really a big table,
there is no quick way to understand them all in a short time.

If you still have anything unclear, please feel free to tell me, thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Jun 18 '07 #6
Hi Michael,

Have you reviewed my last reply to you? Does it make sense to you? If you
still need any help or have any concern, please feel free to tell me,
thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Jun 20 '07 #7
Very cool--thank you, Brian.

"Brian Gideon" wrote:
On Jun 14, 11:43 am, michael sorens <m_j_sor...@newsgroup.nospam>
wrote:
How do I mark a method or class in my library as deprecated, so that when it
is used by some other application, the compiler will issue a warning?

It might be a good idea to use the EditorBrowsableAttribute as well.
Intellisense uses this attribute to decide whether or not to display
the member.

Jun 20 '07 #8
Your links are quite helpful. Even allowed me to quickly look up the
EditorBrowsableAttribute that Brian Gideon mentioned in another reply to this.

Jun 20 '07 #9
Hi Michael,

Thank you for the confirmation. Ok, if you need further help, please feel
free to post, thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Jun 21 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Spartanicus | last post by:
How to get help from this group, and how to construct a minimised test case: http://www.spartanicus.utvinternet.ie/help_us_help_you.htm -- Spartanicus
1
by: Hafeez | last post by:
I am having real trouble compiling this code http://www.cs.wisc.edu/~vganti/birchcode/codeHier/AttrProj.tgz The attachment shows errors when compiled using the current version of g++ in a...
45
by: Matt Parkins | last post by:
Hi, (I realise this probably isn't precisely the right group for this - could someone direct me to the appropriate group to post this question? - thanks !) I'm using Visual C++ 2005 Express...
3
by: Deano | last post by:
Thought it might be a cool feature to allow my users to click a button, and connect to a webpage that would tell them if a more recent version was available. I can create a button that opens a...
3
by: Ben Rush | last post by:
When I compile my solution I get the following output - NET 2003\Vc7\atlmfc\include\atlwin.h(2027) : warning C4995: 'wsprintf': name was marked as #pragma deprecated C:\Program Files\Microsoft...
4
by: SenthilVel | last post by:
Hi I am in a conversion project of Code from .Net 1.1 -->.Net 2.0 . 1. I am going to build all my projects with NAnt RC4 version and also with VS2005 to check the affected Areas. 2. I have...
4
by: sicapitan | last post by:
I have this code snippet: updateProps snippet: if (mycheckbox.checked == '1') ? $('mycheckbox').checked = true : $('mycheckbox').checked = false; content = $('mydiv').innerHTML;
0
by: Nokao | last post by:
I'm having a lot of severe errors in my db2diag.log, (DB2 v9.1.0.0). Googling I don't fin any information :( What can I do? I attach the first reports...: 2007-11-19-17.50.26.379948+060...
78
by: Jeremy J Starcher | last post by:
(Request for Discussion) I've put together a guide that I hope will help novice coders avoid the same hair pulling that I went through. I'm open for comments about it. Have I missed the...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.