Multicasting: Enhance a group of methods with just one attribute

added by PostSharp
11/10/2020 2:00:00 PM


Attribute multicasting, in PostSharp, is a way to apply an aspect (such as method interception) to many types or methods with just one attribute instance. It’s at the core of the ability of PostSharp to reduce the number of lines of code in your project. In the most basic use case, you annotate a class with a method interception/method boundary attribute and it’s multicast (applied) to all methods in that class, but in this blog post, we’ll go over some more advanced use cases as well. Multicasting is included in all versions of PostSharp including the free PostSharp Community edition, and works also for community add-ins such as ToString and StructuralEquality.