~mkw

Average guy, above average luck...the blog of M. Keith Warren

  • Using inheritance to limit GetCustomAttributes array size

    OK, here is the deal – I want to get back an array of all the custom attributes assigned to my class. In my instance I have three custom attributes I have applied to the class. When I call GetCustomAttributes against the type I only want to see the custom attributes that I have added, not all the ones the ASP.NET runtime adds. When I ran my test I was getting an array of 13 attributes which included System.ComponentModel attributes that I don’t care about. How do you get rid of them? Create a BaseAttribute class derived from System.Attribute and then derive your attribute classes from this BaseAttribute class. Then use the GetCustomAttributes(System.Type, bool inherited) overload and pass in a reference to your BaseAttribute class as the type. This will cause your array to be limited to only attributes that derive from your base class; in my instance limiting to only the 3 custom attributes that I added!

  • VS2K3 Upgrade Shipments

    WOOOHOOO

    Looks like those of us who scraped our pennies and paid the whopping $29 to upgrade to Visual Studio.NET 2003 will finally get our new toy. Got an email today saying it had shipped.

  • Matrix.Reloaded.InCaseYouCare

    It is always fun to watch 127 million dollars worth of synapse stimulation, but when it involves computers and wicked special effects...well, it is that much better.

  • Good Recreational Reading

    I am sure that since most of you are like me and want to drink as much Kool-Aid as possible; I am sure you prolly read Paul Thurott's great stuff on The SuperSite and WinInfo. If you don't, give him a look some time; he is about as connected in MSFT as any person I know of...Today there is a new interview with the executive godfather himself!

    NOTE TO PAUL: Can you join the gave and give us an RSS feed!?