Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 609335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:33:20+00:00 2026-05-13T17:33:20+00:00

I saw some of the examples of utilize attribute, e.g. (as a map for

  • 0

I saw some of the examples of utilize attribute, e.g.
(as a map for dynamic factory)
http://msdn.microsoft.com/en-us/magazine/cc164170.aspx

Just wondering what is the advantage of using attribute?
I can find the reference on http://msdn.microsoft.com/en-gb/z0w1kczw(VS.80).aspx
however, I am not sure when and why should I try to use it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T17:33:20+00:00Added an answer on May 13, 2026 at 5:33 pm

    In the .NET Framework, attributes can be used for many reasons — like

    • Defining which classes are
      serializable

    • Choosing which methods are exposed in
      a Web service

    Attributes allow us to add descriptions to classes, properties, and methods at design time that can then be examined at runtime via reflection.

    Consider this example:

    Say you have a class which has a method from older version which is still in use for any reason and now you have come up with a new version of the class which makes fantastic use of Generic List and LINQ and has a new method for similar purpose. You would like developers to prefer the new one provided in the later version of your library. How will you do that ? One way is to write in the documentation. A better way is to use attribute as follow.

    public class AccountsManager
    {
      [Obsolete("prefer GetAccountsList", true)]
      static Account[] GetAccounts( ) { }    
      static List<Account> GetAccountsList( ) { }      
    }
    

    If an obsolete method is used when the program is compiled, the developer gets this info and decides accordingly.

    AccountManager.GetAccounts() is obsolete:
    prefer GetAccountsList

    We may also create and add Custom Attributes as per requirements.

    Reference :

    • Using Attributes in C#

    Hope this helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm learning WPF, so I'm kind of n00b in this. I saw some examples
I saw some examples creating the JSF pages with .jsp extension, other examples creating
I saw some examples giving boundary class like LoginForm etc. That sounds correct at
How do I make this work? I've googled and even saw some examples here
As I saw in some examples, and tried to understand throughout the velocity site
I'm learning about web services, and saw various examples. Some of them used @WebService
I saw some examples in java where they do synchronization on a block of
I saw in some NHibernate examples that an abstract base entity class is used,
I saw some examples with both of them, but I don't understand where to
hi im using mysqli and i saw some examples using placeholder like :something and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.