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 7989569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:47:19+00:00 2026-06-04T12:47:19+00:00

We have a custom attribute [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] public class CustomDesignerAttribute: Attribute then

  • 0

We have a custom attribute

[AttributeUsage(AttributeTargets.All, AllowMultiple = true)]
public class CustomDesignerAttribute: Attribute

then we have a base class decorated with this attribute

[CustomDesigner(someKey, someValue)]
public class BaseClass

then we have a class derived from this one, decorated with same attribute (with same key, different value)

[CustomDesigner(someKey, someOtherValue)]
public class ChildClass : BaseClass

Is there possibility that ChildClass don’t create a duplicate of attribute but overwrite a value for existing key instead (overwrites whole parent attribute)?
If not, what’s the best pattern for getting default value from BaseClass if ChildClass has not defined his own?

  • 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-06-04T12:47:21+00:00Added an answer on June 4, 2026 at 12:47 pm

    No, it’s not possible to override the existing attribute.

    Attributes are metadata attached to an object (assembly, class, method, variable and so on) so they always keep this connection.

    If you want to give a default “behavior” in the base class and override it in some derived classes you have to check all the attributes returned by GetCustomAttributes() to use only the most derived one (the first in the list).

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

Sidebar

Related Questions

I have created my own attribute to decorate my object. [AttributeUsage(AttributeTargets.All)] public class MyCustomAttribute
I have custom attribute defined like so: [AttributeUsage(AttributeTargets.Field)] public class EnumDisplayAttribute : Attribute {
I have a custom Attribute class that I defined as: [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] public
I have defined a custom attribute [AttributeUsage(AttributeTargets.Property )] public class FieldAttribute: Attribute { public
I have the following custom attribute, which can be applied on properties: [AttributeUsage(AttributeTargets.Property, AllowMultiple
I have a class which is marked with a custom attribute, like this: public
I have created custom validation attribute [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false, Inherited =
I have made custom attribute in my asp.net mvc2 project: [AttributeUsage(AttributeTargets.Property, AllowMultiple = false,
I have a custom attribute that I apply to properties on a class. This
Hi I have a custom Attribute public class NameAttribute : RegularExpressionAttribute { public NameAttribute()

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.