Actually, in the donjon thread you cite:

Assert.IsTrue(Attribute.IsDefined(nameProperty,
typeof(FixedFieldAttribute), true));

The problem is, I don't have the PropertyInfo or even the property Name.


On Thu, Sep 10, 2009 at 12:44 AM, Jonathon Rossi<[email protected]> wrote:
> You can do this as I mentioned in DYNPROXY-109:
> Attribute.IsDefined(methodInfo, typeof(FixedFieldAttribute), true)
>
> The static methods on the Attribute class works at a high level language
> level (e.g. C#) rather than an IL/metadata level.
>
> On Thu, Sep 10, 2009 at 12:47 PM, James Curran <[email protected]>
> wrote:
>>
>> Ok, I followed the debate over DYNPROXY-ISSUE-109.  Now that I
>> actually need the ability, it seems a bit screwy.   Here's my
>> situation:
>>
>> I've an interface like this (it will be user-defined in practice; this
>> is an example)
>>    public interface Dir
>>    {
>>        [FixedField(0, 20)]
>>        DateTime ModDate { get; }
>>
>>        [FixedField(29, 9)]
>>         int Size { get; }
>>
>>        [FixedField(38, 40)]
>>        string Name { get; }
>>    }
>>
>> The goal is to create a proxy class with automatic implements those
>> properties, base on the information in the Attributes.
>>
>> Now, if I followed this correctly, just to identify that a getter
>> method I'm given the option of intercepting (get_Name, for instance)
>> has the attribute, I must write:
>>
>> methodInfo.DeclaringType.GetProperty(methodInfo.Name.Substring
>> (4)).IsDefined(typeof(FixedFieldAttribute), true);
>>
>> That seems to be ridiculously convoluted and fragile.  Isn't there a
>> better way?
>>
>>
>>
>>
>
>
>
> --
> Jono
>
> >
>



-- 
Truth,
    James

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to