Home / ASP.NET Weblogs

Latest Microsoft Blogs

Browse by Tags

Related Posts

  • Creating Copies of Attributes

    I’ve been working on a lovely little prototype recently but ran into a problem where my code receives a collection of attributes and needs to change them in some way and then pass the changed collection along to another method that consumes the collection. I want to avoid changing the attributes directly, because when you use reflection to retrieve attributes, those attributes may be cached by the framework. So changing an attribute is not a safe operation as you may be changing the attribute for everyone else who tries to retrieve them. What I really wanted to do is create a copy of all these attributes, and pass the collection of copied attributes along. But how do I do that? CustomAttributeData Brad Wilson and David Ebbo to the rescue! In...


Page 1 of 1 (1 items)

Archives