Post­Sharp Documentation

PostSharp Documentation

PostSharp is the #1 pattern-aware extension to C# and VB. It allows developers to eradicate boilerplate by offloading repeating work from humans to machines. PostSharp contains ready-made implementations of the most common patterns and gives you the tools to build automation for your own patterns.

Developers usually think in terms of design patterns, but with conventional programming languages, they end up writing boilerplate code. PostSharp extends the C# and VB languages with a notion of pattern. The result: shorter, cleaner code that’s easier to write and understand, contains fewer defects and is less expensive to maintain.

In this documentation

Chapter

Description

Introduction

This chapter covers: Quick Examples; Why Use PostSharp; How Does PostSharp Work; How to Learn PostSharp; What's New.

Deployment and Configuration

This chapter explains how to install PostSharp on your development computer, how to deploy it to end-user machines, how to cope with build servers, how to deploy license keys, and how to configure PostSharp.

Adding Aspects to Code

This chapter explains different mechanism to add existing aspects to source code.

Logging

This chapter explains how to apply logging to your entire codebase in a matter of minutes, and how to configure the logging aspects to your needs.

Contracts

This chapter explains how to validate parameters, properties and fields with custom attributes.

INotifyPropertyChanged

This chapter explains how to automatically implement the INotifyPropertyChanged interface.

Weak Event

This chapter explains how to transform a plain C# event into a weak event and avoid memory leaks.

XAML

This chapter covers: Command, Dependency Property and Attached Property.

Parent/Child, Visitor and Disposable

This chapter explains how to implement the Aggregatable pattern by annotating an object model with parent/child information, and how to implement a visitor. The Aggregatable pattern is the base of undo/redo patterns and threading models.

Undo/Redo

This chapter explains how to implement an undo/redo feature by making your model objects record their changes.

Caching

This chapter explains how to add caching to your code.

Multithreading

This chapter covers multit-threading aspects: Writing Thread-Safe Code with Threading Models; Dispatching a Method to Background; Dispatching a Method to the UI ThreadDetecting Deadlocks at Runtime.

Developing Custom Aspects

This chapter explains how to create your own aspects with PostSharp Aspect Framework.

Validating Architecture

This chapter explains how to automatically validate your code against guidelines and conventions using PostSharp Architecture Framework.

Testing and Debugging

This chapter explains how to test and debug aspects.

Hacking

This chapter covers: Executing Code Just After the Assembly is Loaded.

API Reference

This is the complete API reference documentation.