Technical Reports

The ICICS/CS Reading Room

UBC CS TR-2003-20 Summary

Aspect Weaving with C# and .NET, December 19, 2003 Michael A. Blackstock, 9 pages

Since current object oriented programming languages donít have existing support for aspects, aspects are often supported through language extensions. Another approach is to use the existing language to encapsulate aspect behaviors, and provide an additional language to express cross cutting statements. Finally, other systems including the one described in this paper use features of the existing language to specify aspect behavior and cross cutting. This paper presents a prototype weaver called AOP.NET that demonstrates the feasibility of supporting aspect oriented programming in C# without the need for language extensions, or a cross cutting statement file. All of the information related to supporting AOP including the cross cutting statements is contained in the aspect declaration. The cross cutting statements are expressed using a language feature called attributes which are used to annotate methods, fields and classes with meta data in languages targeting the Common Language Runtime (CLR) such as C#. Since attributes are supported in all CLR languages it should be possible to maintain .NET language independence with this approach. AOP.NET demonstrates the feasibility of static and transparent dynamic weaving in .NET. Unlike other .NET dynamic weavers, no changes are required to the source code of clients of functional components for dynamic weaving, the same weaving engine is used in both a static tool and dynamic weaving run time host, and it is implemented completely in C#.

If you have any questions or comments regarding this page please send mail to