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

  • SEARCH
  • Home
  • 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 371861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:09:18+00:00 2026-05-12T14:09:18+00:00

Are there any good resources out there that explain attributes and reflection and their

  • 0

Are there any good resources out there that explain attributes and reflection and their many uses in depth?

I am especially interested in best practices, i.e. when it would be useful or appropriate to use attributes and reflection to solve specific computing problems.

  • 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-12T14:09:18+00:00Added an answer on May 12, 2026 at 2:09 pm

    I don’t know of a good comprehensive resource. In my experience, the best way to learn is to run into a situation that can’t be solved without it (at least not easily). So if you know the basic situations where reflection & attributes make things easier, you’ll know when you need to start learning them.

    Reflection: appropriate when you can’t do what you need without it.

    I know that sounds a little snarky, but it’s actually true – if you need to write some code but there is just no way to figure out the types of the objects you’re dealing with, reflection is appropriate. It’s also appropriate when you need to sneak in and use private/protected/internal members of an object you don’t control.

    Attributes: appropriate when you need to add extra information about a type.

    Example: I have a bunch of IConverter classes. Each one corresponds to a specific field in our content management system. How can I decorate this class with extra information which describes the field it is used for?

    • I could create a different interface for every converter, even though they all do the same thing, but that seems like a bad idea.
    • I could put a read-only property that returns a hard-coded string to the name of the field on each class, but then I’d have to create an instance of each one to check the property value.

    It would be nice if I could just put some kind of extra piece of information on the class itself that says what field it’s for. Then I can check through all my types and find the one I want, and just instantiate that one. Attributes let me do that:

    [HandlesField("FieldName")]
    public class FooFieldConverter : IConverter
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 248k
  • Answers 248k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Specifying HorizontalScrollBarVisibility="Auto" and VerticalScrollBarVisibility="Auto" acheives this goal with out you… May 13, 2026 at 8:54 am
  • Editorial Team
    Editorial Team added an answer One solution is to introduce a counter_cache: # add a… May 13, 2026 at 8:54 am
  • Editorial Team
    Editorial Team added an answer Here is a quick example of how to load google… May 13, 2026 at 8:54 am

Related Questions

I've written a c/c++ memory manager for heap allocations (overloaded new/delete and malloc/realloc/free, based
I'm working on performance tuning my SQL Server 2008 database and am using the
I've inherited a vb6 application that makes use of Visual Basic User Document files
I'm a moderately experienced Java / C# programmer, and I've recently started learning C++.

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.