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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:45:34+00:00 2026-05-27T18:45:34+00:00

This is in the Immediate console: prop.GetCustomAttributes(typeof(RequiredParameterAttribute),true) {BridgeStack.DataContracts.RequiredParameterAttribute[0]} prop.GetCustomAttributes(typeof(RequiredParameterAttribute),true).Cast<RequiredParameterAttribute>() {BridgeStack.DataContracts.RequiredParameterAttribute[0]} [BridgeStack.DataContracts.RequiredParameterAttribute[]]: {BridgeStack.DataContracts.RequiredParameterAttribute[0]} prop.GetCustomAttributes(typeof(RequiredParameterAttribute),true).Cast<RequiredParameterAttribute>().Any() false

  • 0

This is in the Immediate console:

prop.GetCustomAttributes(typeof(RequiredParameterAttribute),true)

{BridgeStack.DataContracts.RequiredParameterAttribute[0]}

prop.GetCustomAttributes(typeof(RequiredParameterAttribute),true).Cast<RequiredParameterAttribute>()

{BridgeStack.DataContracts.RequiredParameterAttribute[0]}
[BridgeStack.DataContracts.RequiredParameterAttribute[]]: {BridgeStack.DataContracts.RequiredParameterAttribute[0]}

prop.GetCustomAttributes(typeof(RequiredParameterAttribute),true).Cast<RequiredParameterAttribute>().Any()

false

I get the same results in the application.

prop is Site in:

public class AnswerCollectionQuery : IPagedQuery, ISiteQuery, ISortableQuery, IOrderableQuery, IFilteredQuery
{
    public int? Page { get; set; }
    public int? PageSize { get; set; }
    public string Site { get; set; }

    [AllowedSortValues(QuerySortEnum.Activity, QuerySortEnum.Creation, QuerySortEnum.Votes)]
    public QuerySortEnum? Sort { get; set; }

    public object Min { get; set; }
    public object Max { get; set; }
    public DateTime? FromDate { get; set; }
    public DateTime? ToDate { get; set; }

    public QueryOrderEnum? Order { get; set; }

    public string Filter { get; set; }
}

Site in turn comes from ISiteQuery

public interface ISiteQuery : IQuery
{
    [RequiredParameter]
    string Site { get; set; }
}

The awkward part is that the console shows the attribute, allows me to cast it, but I can’t retrieve it at all, I get zero as the enumeration’s length, which is why .Any() fails, too, .FirstOrDefault() returns null, .First() throws, etc.

Any explanation for this type of behavior?

PD: this works though if I decorate Site with [RequiredAttribute] in the concrete class. But I wanted to make this part of the interface.

Update for clarity:

prop comes exactly from here:

    public static IEnumerable<PropertyInfo> GetAllProperiesOfObject(object o)
    {
        const BindingFlags flags = BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.Instance;
        PropertyInfo[] list = o.GetType().GetProperties(flags);

        return list;
    }

foreach (PropertyInfo prop in Utility.GetAllProperiesOfObject(entity))

This is the case for when prop becomes Site

  • 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-27T18:45:35+00:00Added an answer on May 27, 2026 at 6:45 pm

    The zero is because it is returning you a zero-length typed array, meaning: it doesn’t have the attribute. You can also see this with Attribute.IsDefined (which will return false).

    When using implicit interface implementation, the public property on the class does not automatically gain attributes from the interface that it satisfies. To see the attributes on the interface you would need to use

    typeof(ITheInterface).GetProperties()
    

    The Site property on the interface is unrelated to the Site property on the class. If the property on the class must have attributes: add the attributes explicitly.

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

Sidebar

Related Questions

Here is my jsp: <h:selectOneMenu value=#{member.dependentName} onchange=this.form.submit() immediate=true valueChangeListener=#{member.getDependentAddress}> <f:selectItems value=#{member.dependentList} /> </h:selectOneMenu> <h:inputText
When I type this into the Visual Studio 2008 immediate window: ? .9 -
I have been trying to get this one section of my UI to immediatly
This is my first post here and I wanted to get some input from
This confused me a lot var show = function(){ console.log('wow'); }; var show2 =
Fire up your firebug console and try this out. Compare this: $('body').data('x',1); $(thisx).remove(); console.log($('body').data('x'));
I have the following JavaScript function: function Console() { this.Log = function(msg) { if
Please help me with this one, I've been writing a console applicaiton using the
I continuously get below error on my weblogic 10.3 console logs java.lang.IllegalStateException: Response already
Why does this empty the text immediately (ignoring delay)? $('#error_box_text').html('error text').delay(5000).html('') # jQuery 1.4

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.