What is IL Weaving?

Weaving refers to the process of injecting functionality into an existing program. This can be done conceptually at a number of levels: Source code weaving would inject source code lines before the code is compiled IL weaving (for .NET) adds the code as IL instructions in the assembly ByteCode weaving (for Java) works on the … Read more

How to inject an attribute using a PostSharp attribute?

See http://www.sharpcrafters.com/blog/post/PostSharp-Principals-Day-12-e28093-Aspect-Providers-e28093-Part-1.aspx Here is a working example. Applying this aspect to a class will apply the XmlIgnore attribute to any public property that does not already have XmlElement or XmlAttribute applied to it. the trick is using the CustomAttributeIntroductioinAspect that is built in to Postsharp. You just need to instantiate an instance specifying the attribute … Read more