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 Thread Detecting 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.

Copyright © SharpCrafters s.r.o. 2018. All rights reserved.

Send comments on this topic to PostSharp Technologies


Introduction

In conventional object-oriented programming, technical concerns like threading, INotifyPropertyChanged or logging generally result in a large amount of boilerplate code. This boilerplate code is tangled with business code, and makes it more difficult to understand and modify the business meaning of the source code.

Boilerplate code is in fact instances of source code patterns. As any pattern, their instances exhibit a great amount of regularity and predictability. Any decent software developer would be able to explain to their colleague how to properly implement INotifyPropertyChanged. These implementation guidelines would form some sort of algorithm, expressed in natural language, that the colleague would execute. Most of the work would be repetitive and would only require a limited amount of creativity.

Algorithmic work is exactly what machines are good at, so why not offload it the compiler? This is exactly what PostSharp has been designed for. Traditional languages have concepts like classes, methods, fields, but they don't have any construct to represent patterns like the implementation of INotifyPropertyChanged.

PostSharp adds support for patterns into the C# and VB languages, allowing developers to work more productively at a higher level of abstraction and to avoid the bugs that stem from working with a large amount of technical details.

In this chapter
Chapter | Description
Quick Examples | This topic gives some small examples to help you understand what PostSharp is about.
Why Use PostSharp | This chapter explains the main benefits of using PostSharp.
How Does PostSharp Work | This chapter proves that there is no magic involved, and that everything relies on stable specifications and documented extension points.
How to Learn PostSharp | This chapter suggests a few learning resources according to your role in and the phase of the project.
What's New | This chapter lists the new features in each major and minor release.


Quick Examples

This section shows a few examples to demonstrate what PostSharp is about:

  • Standard patterns
  • Thread safety patterns
  • Implementation of custom patterns
  • Validation of custom patterns
Standard patterns

PostSharp provides implementations of some of the patterns that are the most commonly found in .NET code bases:

  • INotifyPropertyChanged: see INotifyPropertyChanged.

  • Parent/child relationships: see Parent/Child, Visitor and Disposable.

  • Undo/redo: see Undo/Redo.

  • Code contracts: see Contracts.

  • Logging: see Logging.

Example

The following code snippet illustrates an object model where INotifyPropertyChanged, undo/redo, code contracts, aggregation and code contracts are all implemented using PostSharp ready-made attributes.

C#
Copy
[NotifyPropertyChanged]
public class CustomerViewModel
{
   [Required]
   public Customer Customer { get; set; }

   public string FullName { get { return this.Customer.FirstName + " " + this.Customer.LastName; } }
}

[NotifyPropertyChanged]
[Recordable]
public class Customer
{
   public string FirstName { get; set; }
   public string LastName { get; set; }

   [Child]
   public AdvisableCollection<Address> Addresses { get; set; }

   [Url]
   public string HomePage { get; set; }

   [Log]
   public void Save(DbConnection connection)
   {
      // ...
   }
}

[NotifyPropertyChanged]
[Recordable]
public class Address
{
   [Parent]
   public Customer Parent { get; private set; }

   public string Line1 { get; set; }
}
Thread safety patterns

Multithreading is a great demonstration of the limitations of conventional object-oriented programming. Thread synchronization is traditionally addressed at an absurdly low level of abstraction, resulting in excessive complexity and defects.

Yet, several design patterns exist to bring down the complexity of multithreading. New programming languages have been designed around these patterns: for instance Erlang over the Actor pattern and functional programming over the Immutable pattern.

PostSharp gives you the benefits of threading design patterns without leaving C# or VB.

PostSharp supports the following threading models and features:

  • Immutable: see Immutable Threading Model.

  • Freezable: see Freezable Threading Model.

  • Actor: see Actor Threading Model.

  • Reader/Writer Synchronized: see Reader/Writer Synchronized Threading Model.

  • Synchronized: see Synchronized Threading Model.

  • Thread Unsafe: see Thread-Unsafe Threading Model.

  • Thread Affine: see Thread Affine Threading Model.

  • Thread Dispatching: see Dispatching a Method to Background and Dispatching a Method to the UI Thread.

  • Deadlock Detection: see Detecting Deadlocks at Runtime.

Example

The following code snippet shows how a data transfer object can be made freezable, recursively but easily:

C#
Copy
[Freezable]
public class Customer
{
   public string Name { get; set; }

   [Child]
   public AdvisableCollection<Address> Addresses { get; set; }

}

[Freezable]
public class Address
{
   [Parent]
   public Customer Parent { get; private set; }

   public string Line1 { get; set; }
}

public class Program
{
   public static void Main()
   {
      Customer customer = ReadCustomer( "http://customers.org/11234" );

      // Prevent changes.
      ((IFreezable)customer).Freeze();

      // The following line will cause an ObjectReadOnlyException.
      customer.Addresses[0].Line1 = "Here";
   }
}
Implementation of custom patterns

The attributes that implement the standard and thread safety patterns are called aspects. This term comes from the paradigm of aspect-oriented programming (AOP). An aspect is a class that encapsulates behaviors that are injected into another class, method, field, property or event. The process of injecting an aspect into another piece of code is called weaving. PostSharp weaves aspects at build time; it is also named a build-time aspect weaver.

PostSharp Aspect Framework is a pragmatic implementation of AOP concepts. All ready-made implementations of patterns are built using PostSharp Aspect Framework. You can use the same technology to automate the implementation of your own patterns.

To learn more about developing your own aspects, see Developing Custom Aspects.

Example

The following code snippet shows a simple [PrintException] aspect that writes an exception message to the console before rethrowing it:

C#
Copy
[PSerializable]
class PrintExceptionAttribute : OnExceptionAspect
{
    public override void OnException(MethodExecutionArgs args)
    {
        Console.WriteLine(args.Exception.Message);
    }
}

In the next snippet, the [PrintException] aspect is applied to a method:

C#
Copy
class Customer
{
    public string FirstName { get; set; }
    public string LastName { get; set; }

    [PrintException]
    public void Store(string path)
    {
        File.WriteAllText( path, string.Format( "{0} {1}", this.FirstName, this.LastName ) );
    }
}
Validation of custom patterns

Not all patterns can be fully implemented by the compiler. Many patterns involve a lot of handwritten code. However, they are still patterns because we want to follow the same conventions and approach when solving the same problem. In this case, we have to validate the code against implementation guidelines of the pattern. This is typically achieved during code reviews, but as any algorithmic work, it can be partially automated using the right tool. This is the job of the PostSharp Architecture Framework.

PostSharp Architecture Framework also contains pre-built architectural constraints that help to solve common design problems. For instance, the InternalImplementAttribute constraint prevents an interface to be implemented in an external assembly.

See Validating Architecture for more details about architecture validation.

Example

Consider a form-processing application. There may be hundreds of forms, and each form can have dozens of business rules. In order to reduce complexity, the team decides that all business rules will respect the same pattern. The team decides that each class representing a business rule must contain a public nested class named Factory, and that this class must have an [Export(IBusinessRuleFactory)] custom attribute and a default public constructor. The team wants all developers to follow the convention. Therefore, the team decides to create an architectural constraint that will validate the code against the project-specific Business Rule Factory pattern.

C#
Copy
[MulticastAttributeUsage(MulticastTargets.Class, Inheritance = MulticastInheritance.Strict)]
public class BusinessRulePatternValidation : ScalarConstraint
{
    public override void ValidateCode(object target)
    {
        var targetType = (Type)target;

        if (targetType.GetNestedType("Factory") == null)
        {
            Message.Write( targetType, SeverityType.Error,  "2001",
                           "The {0} type does not have a nested type named 'Factory'.",
                           targetType.DeclaringType,  targetType.Name );
        }

        // ...
    }
}

[BusinessRulePatternValidation]
public abstract BusinessRule
{
  // ...
}


Why Use PostSharp

How many times did you find yourself:

  • copying and pasting blocks of code to implement a functionality (for instance logging)?

  • implementing INotifyPropertyChanged manually – and forget a notification?

  • trying to understand the business logic behind a cluttered codebase?

  • struggling to add or modify functionality in an existing software?

  • debugging data races in multithreaded applications?

  • wondering why it’s so hard to build enterprise-grade software?

PostSharp started as an open-source project in 2004 and due to its popularity, it soon became a commercial product trusted by over 50,000 developers worldwide and over 1,000 leading corporations. More than 10% of all Fortune 500 companies including Microsoft, Intel, Bank of America, Phillips, NetApp, BP, Comcast, Volkswagen, Hitachi, Deutsche Bank, Bosch, Siemens, and Oracle rely on PostSharp to reduce their development and maintenance costs.

With over a decade experience in boilerplate reduction, PostSharp is now the #1 best-selling pattern-aware extension to C# and VB and the only commercially-supported development tool for .NET.

In this chapter
Topic | Description
Which Problems Does PostSharp Solves | This topic describes which problems PostSharp attends to address.
Benefits of Pattern-Aware Compiler Extensions | This topic defines the concept of Patter-Aware Compiler and explains its benefits.
Benefits of PostSharp vs Alternatives | This topic lists the competitive benefits of using PostSharp over alternatives.


Which Problems Does PostSharp Solves

Conventional programming languages miss a concept of pattern, therefore patterns are hand-coded and result in boilerplate code.

Boilerplate code has the following impact:

  • High development effort
  • Poor quality software
  • Difficulty to add/modify functionality after release 1.0
  • Slow ramp-up of new team members
High development effort

  • Large codebases. Some application features require a large amount of repetitive code (boilerplate) when implemented with existing mainstream compiler technologies.

  • Reinventing the wheel. Solutions to problems like INotifyPropertyChanged are always being reinvented because there is no reusable options within conventional programming languages.

Poor quality software

  • High number of defects. Every line of code has a possibility of defect, but code that stems from copy-paste programming is more likely than other to be buggy because subtle differences are often overlooked.

  • Multithreading issues. Object-oriented programming does not deliver much value when it comes to developing multithreaded applications since it addresses issues at a low level of abstraction with locks, events or interlocked accesses that can easily result in deadlocks or random data races.

  • Lack of robustness. Enterprise-grade features such as exception handling or caching are often deliberately omitted because of the high amount of source code they imply, unintentionally forbidden in some parts of the applications, simply left untested and unreliable.

Difficulty to add/modify functionality after release 1.0

  • Unreadable code that’s difficult to maintain. Business code is often littered with low-level non-functional requirements and is more difficult to understand and maintain, especially when the initial developer left.

  • Strong coupling. Poor problem decomposition results in duplicate code and strong coupling making it very difficult to change the implementation of features like logging, exception handling or INotifyPropertyChanged because it is often scattered among thousands of files.

Slow ramp-up of new team members

  • Too much knowledge required. When new team members come to work on a specific feature, they often must first learn about caching, threading and other highly technical issues before being able to contribute to the business value: an example of bad division of labor.

  • Long feedback loops. Even with small development teams, common patterns like diagnostics, logging, threading, INotifyPropertyChanged and undo/redo can be handled differently by each developer. Architects need to make sure new team members understand and follow the internal design standards and have to spend more time on manual code reviews--delaying progress while new team members wait to get feedback from code review.


Benefits of Pattern-Aware Compiler Extensions

Pattern-aware programming extends conventional object-oriented programming with a concept of pattern, which becomes a first-class element of the programming language.

Most mainstream programming languages can be extended with a concept of pattern, avoiding the cost of rewriting applications in a new language.

Because patterns are supported by the compiler extension (100% compatible with your existing compiler), they do not need to be manually implemented as boilerplate code. Features such as INotifyPropertyChanged, logging, transactions are implemented in a cleaner, more concise way, making development and maintenance much easier.

There are 4 reasons to consider using a pattern-aware compiler extension:

  • Stop writing boilerplate code and deliver faster
  • Build more reliable software
  • Add/modify functionality more easily after first release
  • Help new members contribute quicker
Stop writing boilerplate code and deliver faster

  • Fewer lines of code means fewer hours of work. Patterns are repetitive, with little or no decision left to the developer. However, repetition is exactly what computers are good at. Let the compiler do the repetitive work and save development time and costs immediately.

Build more reliable software

  • Cleaner code means fewer defects. With a pattern-aware compiler eliminating the boilerplate, your code becomes easier to read, understand and modify, and contains fewer defects.

  • Reliability becomes much more affordable. Because they no longer require so much manual coding, reliability features such as caching or exception handling are much easier and cheaper to implement, so you can spend your extra time building a more robust app.

Add/modify functionality more easily after first release

  • Cleaner and shorter code is easier to understand. After the initial release, too much development time is spent reading and analyzing source code, especially if the initial developer left. With minimized boilerplate code, developers can easily focus on business logic and spend much less time trying to understanding the code.

  • Better architecture is future-proof. Using a pattern-aware compiler, features like logging, exception handling or transactions are no longer scattered among thousands of files but they are defined in one place, making it much easier and fast to modify when necessary.

Help new members contribute quicker

  • Achieve a better division of labor. Using a pattern-aware compiler makes the introduction of new or junior team members less onerous since they can focus on simpler, more business logic-oriented tasks rather than having to waste so much time learning complex architectural structures.

  • Implement a tighter feedback loop. A pattern-aware compiler can validate that handwritten code respects a pattern or a model, and it can detect bugs at build time instead of during code reviews, testing, or in production.


Benefits of PostSharp vs Alternatives

PostSharp is the #1 pattern-aware extension to C#/VB. It adds a concept of pattern to the languages, resulting in a dramatic reduction of boilerplate code, lower development and maintenance costs and fewer errors. With PostSharp you can:

Here are the reasons that differentiates PostSharp from alternatives:

  • Get more productive in minutes with ready-made pattern implementations
  • Automate more complex patterns and remove more boilerplate
  • Build thread-safe apps--without a PhD
  • Maintain your existing codebase in C# or Visual Basic
  • Benefit from much better run-time performance
Get more productive in minutes with ready-made pattern implementations

  • INotifyPropertyChanged Pattern. Automates the implementation of INotifyPropertyChanged and automatically raises notifications for you. It also analyzes chains of dependencies between properties, methods and fields in your source code, and understands that property getters can access several fields and call different methods, or even depend on properties of other objects. PostSharp eliminates all the repetition and lets you go from three lines of code per property to one attribute per base class... so you will never forget to raise a property change notification again.

  • Undo/Redo Pattern. Makes the implementation of the end-users most-wanted features easy and affordable by recording changes at model level. Provides built-in user controls or allows you to create your own. You can deliver the familiar Undo/Redo experience to your users without getting stuck writing large amounts of code.

  • Code Contracts. Provide validation for valid URLs, email addresses, positive numbers or not-null values and many more, right out of the box. Allows you to use contract attributes without limitations at any location in your codebase and validate methods, fields, properties and parameters. This enables you to protect your code from invalid inputs with custom attributes.

  • Logging Pattern. Adds comprehensive logging in a few clicks – without impact on your source code – and lets you remove it just as quickly. Provides parameter and return values providing added information for maintenance and support work. Supports most popular backends, including log4net, NLog, Enterprise Library, System Console, System Diagnostics. You can trace everything you need in minutes without cluttering your code.

Automate more complex patterns and remove more boilerplate

  • PostSharp Aspect Framework. PostSharp is hands down the most robust and exhaustive implementation of aspect-oriented programming for .NET and was evolved into the world's best pattern compiler. It is the most powerful toolset available to implement automation for your own patterns.

  • Largest choice of possible transformations. Includes decoration of methods, iterators and async state machines, interception of methods, events or properties, introduction of interfaces, methods, events, properties, custom attributes or resources, and more.

  • Composition of several transformations to easily automate complex patterns.

  • Dynamic aspect/advice providers. Addresses situations where it is not possible to add aspects declaratively (using custom attributes) to the source code with dynamic aspect/advice providers.

  • Aspect inheritance. Apply an aspect to a base class, specify that you want it to be inherited and all derived classes will automatically have the aspect applied to them. Relieves you from implementing the aspects manually and ensures that all derived classes using this aspect's logic is correct.

  • Architecture framework. Validates handwritten source code against your own custom pattern guidelines. It then express the rules in C# using the familiar System.Reflection API, extended with features commonly found in decompilers, such as “find usage”, and more.

Build thread-safe apps--without a PhD

Starting new threads and tasks in .NET languages is simple, but ensuring that objects are thread-safe is not with mainstream programming languages. That's why PostSharp extends C# and VB with thread-safety features.

  • 7 different threading models. Threading models are design patterns that guarantee your code executes safely even when used from multiple threads. Threading models raise the level of abstraction at which multithreading is addressed. Unlike working directly with locks and other low-level threading primitives, threading models decrease the number of lines of code, the number of defects and reduce development and maintenance costs – without having to have expertise in multithreading. Includes:

    1. Immutable Threading Model. Allows you to make select objects in your codebase immutable so that they can be safely accessed by several threads concurrently, without the need for locking or other synchronization.

    2. Freezable Threading Model. This is the milder brother of the Immutable pattern. It is suitable when you need to prevent changes to an instance of an object most of, but not all of the time. Lets you define the point in time where immutability begins.

    3. Synchronized Threading Model. Makes sure the objects are accessed by a single thread at a time. Other threads will wait until the object is available so you'll avoid data races.

    4. Reader-Writer Synchronized Threading Model. This pattern relies on the fact that most objects are much more often read than modified. Compared to traditional locking, it maximizes read throughput and minimizes the odds of deadlocks.

    5. Actor Threading Model. Actors are classes that essentially run within a single thread. Other code communicates with actors using asynchronous calls. Celebrated by Erlang, Scala and F# developers, this pattern is now available to .NET thanks to PostSharp and C# 5.0.

    6. Thread Affine Threading Model. Limits object instance access to the thread that created the instance.

    7. Thread Unsafe Threading Model. Perfect pattern to make sure that objects will never be accessed concurrently by several threads. Get an exception instead of a random data corruption.

  • Model validation. Catches most defects during the build or during single-threaded test coverage.

  • Thread dispatching patterns. Causes the execution of a method to be dispatched to the UI thread or to a background thread. Much easier than using nested anonymous methods.

  • Deadlock detection. Causes an easy-to-diagnose exception in case of deadlock instead of allowing the application to freeze and create user's frustration.

Maintain your existing codebase in C# or Visual Basic

Despite the hype around functional programming languages, C#/VB and .NET remain an excellent platform for enterprise development. PostSharp respects your technology assets and will work incrementally with your existing code base – there is NO need for a full rewrite or redesign.

  • Design neutrality. Unlike alternatives, PostSharp takes minimal assumptions on your code. It does not force you to adopt any specific architecture or threading model. You can add aspects to anything, not just interface/virtual methods. Plus, it is fully orthogonal from dependency injection. You don't have to dissect your application into components and interfaces in order to use PostSharp.

  • Plain C# and VB. PostSharp provides advanced features present in F#, Scala, Nemerle, Python, Ruby or JavaScript, but your code is still 100% C# and VB, and it is still compiled by the proved Microsoft compilers.

  • Cross-platform. PostSharp supports the .NET Framework, Windows Phone, WinRT, Xamarin and Portable Class Libraries.

  • Standard skill set. No complex API. Reuse what you already know from C# and System.Reflection.

Benefit from much better run-time performance

Start-up latency, execution speed and memory consumption matter. Whether you're building a mobile app or a backend server, PostSharp delivers exceptional run-time performance.

  • Build-time code generation. Unlike proxy-based solutions, PostSharp modifies your code at build time. It also allows for much more powerful enhancements that produces dramatically faster applications.

  • No reflection. PostSharp does not rely on reflection at run-time. The only code that is executed is what you can see with a decompiler.

  • Build-time initialization. Many patterns make decisions based on the shape of the code which they are applied. With PostSharp, you can analyze the target code at build-time and store the decisions into serializable fields. At runtime, the aspects will be deserialized and you won't need to analyze the code at run-time using reflection.


How Does PostSharp Work

On a conceptual level, you can think of PostSharp as an extension to the C# or VB compiler. Practically, Microsoft's compilers themselves are not extensible, but the build process can be easily extended. That's exactly what PostSharp is doing: it inserts itself into the build process and post-processes the output of the compiler.

This topic contains the following sections:

  • MSBuild Integration
  • MSIL Rewriting
MSBuild Integration

PostSharp integrates itself in the build process thanks to PostSharp.targets, which is imported into each project using PostSharp by the NuGet installation script install.ps1. PostSharp.targets adds a few steps to the build process. The principal step is the post-processing of the compiler's output by PostSharp itself.

See Configuring Projects Using MSBuild for details.

MSIL Rewriting

PostSharp post-processes the compiler output by reading and disassembling the intermediate assembly, execute the required transformations and validations, and rewriting the final assembly to disk.

Although this might sound magic or dangerous, PostSharp's MSIL technology is stable and mature, and has been used by tens of thousands of projects since 2004. Other .NET products relying on MSIL transformation or analysis include Microsoft Code Contracts, Microsoft Code Analysis, and Microsoft Code Coverage.


Key Technologies

PostSharp combines several technologies to leverage design pattern automation:

  • Metaprogramming
  • Aspect-Oriented Programming
  • Static Program Analysis
  • Dynamic Program Analysis
Metaprogramming

Metaprogramming is the writing of a program that analyzes and transforms itself or other programs. PostSharp internally represents a .NET program as a mutable .NET object model, so PostSharp can be considered a metaprogramming tool for .NET.

However, general metaprogramming (the ability to perform arbitrary modifications on a program) is a highly complex discipline. Although it may seem easy to perform simple modifications on simple programs, it is actually much more difficult to implement non-trivial transformations that work in all cases. Metaprogramming can result in a decrease in productivity when used improperly and it is very difficult, for application developers who lack specific training in compilers and metaprogramming, to use it properly.

Since general metaprogramming is too complex and too low level, we need a higher layer of abstraction that makes it easier and safer to express program transformations. Essential qualities of this abstraction layer would include safe composition of several transformations on the same declaration and restrictions on changing the program semantics.

Aspect-Oriented Programming fulfills these qualities as a disciplined approach to metaprogramming.

Aspect-Oriented Programming

PostSharp Aspect Framework is built on the principle of Aspect-Oriented Programming (AOP), a well-established programming paradigm, orthogonal to (and non-competing with) object-oriented programming or functional programming, that allows to modularize the implementation of some features that would otherwise crosscut a large number of classes and methods.

We can confidently say that PostSharp is the most advanced AOP framework for Microsoft .NET.

For details on PostSharp's implementation of AOP, see Developing Custom Aspects.

Static Program Analysis

Static program analysis is the analysis of a program without executing it.

There are two families of static analysis tools:

  • Structural static analysis tools analyze the program's declarations and instructions, but do not attempt to understand the run-time behavior of the program. Microsoft Code Analysis belongs to this category.

  • Behavioral static analysis tools are based on iterative techniques like abstract interpretation, model checking or data-flow analysis. Behavioral static analysis is much more complex and time consuming. Microsoft Code Contracts belong to this category.

PostSharp contains tools for structural static analysis only. These tools consist in complete access to the System.Reflection model of the assembly being built, navigating through code relationships using the ReflectionSearch facility, and an expression tree decompiler.

The most important use case for static analysis in PostSharp is when writing aspects, in order to determine how the target program should be transformed. Any of the static analysis tools can be used to build aspects. This contrasts with other AOP implementation like AspectJ, which defines its own specific language (pointcut language) to select target declarations.

Aspects like NotifyPropertyChangedAttribute or threading models make advanced use of static analysis.

A secondary role for static analysis is architecture validation. This role is marketed as the PostSharp Architecture Framework, which defines a notion of architectural constraint. see Validating Architecture for more information.

Dynamic Program Analysis

Dynamic program analysis is the analysis of a program during its execution. Dynamic analysis is often used to detect issues early, before they cause bigger damage. A typical example of dynamic analysis is the one that occurs when an object is cast to a type: when the safety of the type conversion cannot be proved using static analysis, the type conversion must be verified at run time, and an InvalidCastException is thrown when an invalid cast is detected.

PostSharp uses dynamic analysis to check the program against threading models. Since many model properties cannot be reliably verified at build time, they must be enforced at run time. For instance, with the Synchronized threading model, accessing a field without owning access to the object would result in a ThreadAccessException. For details, see Writing Thread-Safe Code with Threading Models.

Another example of use of dynamic program analysis in PostSharp is deadlock detection. For details, see Detecting Deadlocks at Runtime.

In PostSharp, dynamic analysis is achieved by adding instrumentation aspects to the program.


How to Learn PostSharp

A PostSharp implementation project is typically composed of three phases, in which three roles typically interact differently with the product. Each role requires different skills and knowledge. We have created a learning path for each of these roles. Depending on your team's organization, you may be involved in one or more roles.

Topic

Description

Architecture Role: Selecting and Creating Aspects

In the first phase, the team learns about the concepts and abilities of PostSharp, and identify how it could fit into the application's design and architecture. The team selects the ready-made aspects that will be used in the application and, when no ready-made aspects can be used, it creates custom aspects or architecture rules.

People in this role are typically called architects, technical leads or senior developers. They must acquire an extensive knowledge of PostSharp and their decisions affect the whole team's productivity.

Deployment Role: Installing and Deploying PostSharp

The next typical step is to deploy PostSharp into your development infrastructure and configure licensing. PostSharp works mostly out of the box for individual developers and small teams, but you may want some planning if you are responsible for a complex solution.

Developer Role: Using Aspects

Your team is finally ready to use PostSharp on a daily basis. At this point, typically, the team already knows which aspects will be used and when and how they will be used. As a developer who will use existing aspects, you don't need to invest a large amount of effort to learn PostSharp upfront. However, you will need to understand the aspects that have been selected by the team, and how to apply them to a code base.


Architecture Role: Selecting and Creating Aspects

The first step in the process of adopting PostSharp is typically to understand what the product can do for you and why you should use (or not use) its features. This activity is typically part of the architecture role.

As you will see, PostSharp offers a set of pre-built aspects implementing some of the most common patterns. As an architect, you will need to understand what these aspects can do for you and how they could fit and simplify your architecture.

However, standard patterns are only the top of the iceberg. To cover your specific needs, PostSharp includes construction kits that allow you to build your own pattern automation, namely the PostSharp Aspect Framework and the PostSharp Architecture Framework. Determining the need for custom aspects or architecture validation rules is typically also a part of the architecture role.

In a typical team, only a few people must be able to create custom aspects or architecture rules. These people must have a deeper understanding of PostSharp than the developers who will only use existing aspects and rules. This is why this skill set is included in the current section.

Note Note

When writing this section, we realized that the current documentation has some serious weaknesses regarding conceptual and architectural materials. This is why we are also referring to other resources hosted on our web site.

Introduction

Understanding the principles behind PostSharp will give you a foundation to build on. All patterns and techniques used by PostSharp relate back to this foundation.

Topic | Articles
About PostSharp | Why Use PostSharp How Does PostSharp Work Requirements and Compatibility
More About Design Pattern Automation | Article: Design Pattern Automation
More About Aspect-Oriented Programming | Aspect-Oriented Programming in Microsoft .NET White Paper: Producing High-Quality Software with Aspect-Oriented Programming
Selecting pre-built pattern implementations

PostSharp offers a number of different pre-built patterns. The following documentation will outline how to use each of the available patterns.

Topic | Articles
General patterns | Contracts Parent/Child, Visitor and Disposable
User interface patterns | Understanding the NotifyPropertyChanged Aspect Understanding the Recordable Aspect
Multithreading | White Paper: Threading Models for Object-Oriented Programming Detecting Deadlocks at Runtime Dispatching a Method to the UI Thread Dispatching a Method to Background
Diagnostics | [diagnostics-library]
Creating automation for custom patterns

PostSharp's built-in patterns won't cover all scenarios in your codebase that can benefit from AOP. Learn how to build custom patterns using the same foundational components as are used for the built-in patterns.

Topic | Articles
Aspects | Developing Custom Aspects
Architecture Validation | Validating Architecture


Deployment Role: Installing and Deploying PostSharp

This section describes how to deploy PostSharp in different situations. Read it if you are responsible to integrate PostSharp into your build process.

Topic | Articles
Deploying to the Development Environment | Installing PostSharp Tools for Visual Studio Installing PostSharp Into a Project Deploying License Keys Uninstalling PostSharp
Deploying to the Build Infrastructure | Using PostSharp on a Build Server Restoring Packages at Build Time Using PostSharp with Visual Studio Online
Deploying to Production or End-User Devices | Deploying PostSharp to End-User Devices
Deploying to Large or Regulated Development Environments | License Audit Using PostSharp License Server Upgrading Large Repositories from a Previous Version of PostSharp


Developer Role: Using Aspects

Using aspects requires much less training than creating new ones. In typical large teams, only a few developers or architects develop new aspects, while the rest of the team uses existing aspects. This section focuses on the skill set that you need to acquire if you have to be able to use PostSharp aspects but don't need to create your own.

In this session, we also assume that PostSharp has been properly deployed into your development and build environments.

Note Note

Of course, you can learn PostSharp as much as you want. The role of this section is to provide a short list of articles to minimize your learning curve and get you productive as quickly as possible, but this should not stop you from learning and experimenting more.

This topic contains the following sections:

  • Installing and upgrading PostSharp
  • Working with pre-built patterns
  • Working with Patterns
Installing and upgrading PostSharp

Every process has a starting point. Learn how to add PostSharp to your project so that you can get started with improving your codebase.

Topic | Articles
Install PostSharp to your machine | Requirements and Compatibility Installing PostSharp Tools for Visual Studio
Add PostSharp to a project and keep it up-to-date | Installing PostSharp Into a Project Upgrading from a Previous Version of PostSharp
Working with pre-built patterns

PostSharp offers a number of different pre-built patterns. You will need to learn those that will be used in your application.

Topic | Articles
Diagnostics | [diagnostics-library]
Code Contracts | Contracts
INotifyPropertyChanged | INotifyPropertyChanged
Aggregatable | Parent/Child, Visitor and Disposable
Disposable | Automatically Disposing Children Objects (Disposable)
Undo and Redo | Undo/Redo
Threading Models | Writing Thread-Safe Code with Threading Models Freezable, Immutable, Actor, Reader/Writer Synchronized, Synchronized, Thread-Unsafe, Thread Affine Compatibility of Threading Models Opting In and Out From Thread Safety
Deadlock Detection | Detecting Deadlocks at Runtime
Dispatching Threads | Dispatching a Method to the UI Thread Dispatching a Method to Background
Architecture Validation | Restricting Interface Implementation Controlling Component Visibility Beyond Private and Internal
Working with Patterns

The following resources are for all aspects. You can save a great amount of time in learning to master them.

Topic | Articles
Adding aspects to several declarations | Adding Aspects Declaratively Using Attributes
Resolving Errors | Working with Errors, Warnings, and Messages


What's New

PostSharp has been around since the early days of .NET 2.0 in 2004. Since the first version, many features have been added to make PostSharp the most popular and by far the most powerful tool for aspect-oriented programming and design pattern automation in .NET.

This chapter contains the following sections:

  • What's New in PostSharp 6.0

  • What's New in PostSharp 5.0

  • What's New in PostSharp 4.3

  • What's New in PostSharp 4.2

  • What's New in PostSharp 4.1

  • What's New in PostSharp 4.0

  • What's New in PostSharp 3.1

  • What's New in PostSharp 3.0

  • What's New in PostSharp 2.1

  • What's New in PostSharp 2.0

  • What's New in PostSharp 1.5


What's New in PostSharp 6.0

The primary focus of PostSharp 6.0 was to execute the PostSharp compiler itself on .NET Core when a .NET Core project is being built. This required the biggest refactoring of our compiler's internals since PostSharp 2.0, which broke backward-compatibility of build-time components, and warranted a major version change.

Additionally, PostSharp 6.0 brings support for C# 7.2 and improves the robustness of the logging component.

Important note Important

As a major version, PostSharp 6.0 contains some breaking changes. See Breaking Changes in PostSharp 6.0 for details.

This topic contains the following sections:

  • Support for .NET Core 2.0-2.1 and .NET Standard 2.0
  • PostSharp compiler runs natively in .NET Core
  • Support for Portable PDB
  • Support for C# 7.2
  • Logging: robustness to logging faults
  • Logging: adapters for Log4Net and NLog now support .NET Standard
  • Logging: no need to initialize before the first logged method is hit
  • Caching: preventing concurrent execution (locking)
  • Tools for Visual Studio: support for the new CPS-based project systems.
  • GDPR Compliance
  • End of support for Visual Studio 2012
  • End of support for .NET Core 1.1 as a build platform
  • Removal of the UI to use PostSharp without NuGet
Support for .NET Core 2.0-2.1 and .NET Standard 2.0

.NET Core 2.0-2.1 and .NET Standard 2.0 are now completely supported. PostSharp 5.0 used to have partial and buggy support for these frameworks, and significant work was required to get it right (see below).

PostSharp compiler runs natively in .NET Core

Up to version 5.0, the PostSharp compiler would always run the .NET Framework, even if it was building a project targeting .NET Core. That caused some serious challenges and problems because PostSharp is executing user code at build time, therefore it executed in .NET Framework code written for .NET Core.

Starting from PostSharp 6.0, PostSharp will run under .NET Core if you're building a project for .NET Core. Most of the PostSharp build-time code has been ported to .NET Standard 2.0.

This was a major refactoring and we've repaid a great deal of our technical debt. Support for new releases of .NET Core should become much quicker. This evolution also opens the path to supporting PostSharp on Linux, but there is still work to reach this objective.

Support for Portable PDB

Portable PDB (both standalone and embedded) are now fully supported.

Support for C# 7.2

PostSharp 6.0 properly handles and understands in parameters. It also understands ref struct, but prevents them from being used as parameters in methods that are enhanced by an aspect (except logging).

Logging: robustness to logging faults

Errors in the logging component or in your logging code will no longer cause your application to crash. For details, see Handling Faults in the Logging Component.

Logging: adapters for Log4Net and NLog now support .NET Standard

PostSharp.Patterns.Diagnostics.Log4Net and PostSharp.Patterns.Diagnostics.NLog now support .NET Standard.

Logging: no need to initialize before the first logged method is hit

It is now possible to change the logging back-ends dynamically, even after a log record has been emitted. As a result, it is no longer necessary to avoid any logging until the logging service was initialized.

Caching: preventing concurrent execution (locking)

You can now configure a lock manager to prevent concurrent execution of the same method with the same arguments on different threads, processes, or machines. See Preventing Concurrent Execution of Cached Methods for details.

Tools for Visual Studio: support for the new CPS-based project systems.

The new project systems, which work with simpler project files and include built-in support for NuGet package references, are now properly supported.

GDPR Compliance

PostSharp is now compliant with GDPR. A few changes were needed, including requiring explicit consent before performing license audit (instead of just informing) or sending the newsletter (instead of soft opt in), and making all data transfers secure.

End of support for Visual Studio 2012

PostSharp 6.0 no longer includes support for Visual Studio 2012, as it is no longer in Microsoft mainstream support.

End of support for .NET Core 1.1 as a build platform

You can still build .NET Core 1.1 and .NET Standard 1.* projects, but using the .NET Core 2.0 SDK.

Removal of the UI to use PostSharp without NuGet

If is still possible to use PostSharp without NuGet, but we removed the UI from PostSharp Tools for Visual Studio.


Breaking Changes in PostSharp 6.0

PostSharp 6.0 contains the following breaking changes:

Changes causing silent changes of behavior

  • The internal details of the assembly loading algorithms have been changed; therefore, in some rare situations, PostSharp may fail to find or load assemblies in cases that used to be successful with PostSharp 5.0. Please report these cases to the PostSharp support team for individual resolution.

  • All MSBuild properties that used to be prefixed PostSharp30 are now prefixed just PostSharp. Check your projects for occurrences of the PostSharp30 substring.

  • The RequiredAttribute code contract now throws ArgumentOutOfRangeException instead of ArgumentNullException when a target element is assigned an empty or white-space string.

Changes causing build errors

  • Parts of the API that were marked [Obsolete] in PostSharp 5.0 have been removed.

  • The way exception handlers and filters are represented in the PostSharp.Reflection.MethodBody has changed. They used to be tree nodes, but are now just properties of IBlockExpression. The MethodBodyVisitor class has been modified accordingly.

  • The PostSharp.​Patterns.​Diagnostics.​RecordBuilders.ParameterDirection has been renamed ParameterKind and moved to PostSharp.dll.

  • The notorious QueryInterface(object) extension method has been replaced by the non-extension QueryInterfaceT(Object, Boolean), in an effort to limit the pollution of Intellisense suggestions and documentation.

Deprecated platforms and features

  • Visual Studio 2012 is no longer supported.

  • .NET Core SDK 1.1 is no longer supported as a build platform. You can still build .NET Core 1.1 libraries under the .NET Core SDK 2.0 or later. See Requirements and Compatibility for details.

  • .NET Framework 4.7.1 or later is now required on build platforms. Older versions are still supported as run-time platforms. See Requirements and Compatibility for details.

  • Windows 7 SP1, Windows 8.1, Windows Server 2008 R2 and early versions of Windows 10 are no longer supported as build platforms. See Requirements and Compatibility for details.

  • Invoking PostSharp from the command line is no longer supported.

  • IncrediBuild is no longer supported.

Licensing changes

  • It is now mandatory to add your license key to the build server or the source repository if you are using the PostSharp.Patterns.Diagnostics namespace. See Licensing of PostSharp Diagnostics for details.


What's New in PostSharp 5.0

As a new major version, PostSharp 5.0 was the opportunity to introduce a few breaking changes. First, we dropped support for Microsoft's failed platforms Windows Phone and WinRT in favor of .NET Core, .NET Standard and Visual Studio 2017. Then, we completely revisited PostSharp Logging. Additionally, we added a caching aspect and three MVVM aspects.

Important note Important

As a major version, PostSharp 5.0 contains some breaking changes. See Breaking Changes in PostSharp 5.0 for details.

PostSharp 5.0 includes the following improvements:

  • Logging: complete revamping
  • Caching: a brand new feature
  • Filled gaps in support for async methods
  • XAML: Command, Dependency Property and Attached Property
  • Code Contracts: support for out parameters and return values
  • Architecture Framework: new constraints
  • Support for Visual Studio 2017
  • Support for .NET Core and .NET Standard
  • Support for NuGet 3
  • End of support for Windows Phone, WinRT and Silverlight
  • Suspended support for Xamarin
Logging: complete revamping

That's a complete rewrite! The new PostSharp Logging is fully customizable and faster than ever. See Logging for details.

Caching: a brand new feature

We've added a brand new ready-made caching framework, which includes not only a caching aspect but also a cache invalidation aspect. PostSharp Caching 5.0 comes with support for MemoryCache and Redis. See Caching for details.

Filled gaps in support for async methods

We've put a lot of efforts to put async methods on par with normal methods in PostSharp:

  • The MethodInterceptionAspect now has an OnInvokeAsync(MethodInterceptionArgs) advice, which you can implement to intercept async methods.

  • You can now set the return value and change the ReturnValue and the FlowBehavior of an async method in an OnMethodBoundaryAspect aspect.

  • The MethodInterceptionAspect and OnMethodBoundaryAspect aspects now advise async methods and iterators semantically by default (i.e. the state machine itself is advised), while previous versions advised the kick-off methods by default. The new property SemanticallyAdvisedMethodKinds controls whether the advice is applied semantically or not. The UnsupportedTargetAction property determines what should be done when semantic advising of the current method is not supported.

XAML: Command, Dependency Property and Attached Property

If you're writing XAML applications, you probably wrote a lot of boilerplate code for commands and dependency properties. We've created new aspects to automate that. See XAML for details.

Code Contracts: support for out parameters and return values

It is now possible to add code contracts to return values and out or ref parameters. The values are validated when the method succeeds.

Architecture Framework: new constraints

PostSharp 5.0 adds three constraints:

  • The NamingConventionAttribute constraint is a simple way to force derived class to respect some naming convention.

  • The ParameterValueConstraint abstract constraint lets you validate, at build-time, the value passed to method parameters.

  • The ReferenceConstraint abstract constraint allows you to validate which code uses (i.e. references) your type or method.

Support for Visual Studio 2017

PostSharp 5.0 supports Visual Studio 2017 including the new project format (package references) and the new features of C# 7.0.

Support for .NET Core and .NET Standard

PostSharp 5.0 supports .NET Core 1.0 and .NET Standard 1.3 in Visual Studio 2017 and .NET Core CLI. See Requirements and Compatibility for details.

Support for NuGet 3

PostSharp 5.0 supports NuGet 3 and it no longer needs install.ps1 to introduce itself into the build chain.

End of support for Windows Phone, WinRT and Silverlight

Let's face it, these platforms were a failure. We no longer want to pay a price for that and we're dropping support in PostSharp 5.0.

Suspended support for Xamarin

Usage data show that only a few customers are using PostSharp with Xamarin, so we demoted the priority of this platform. It is not supported in PostSharp 5.0. Affected customers should contact our support team. We're considering to support Xamarin through .NET Standard if there is significant demand for it.


Breaking Changes in PostSharp 5.0

PostSharp 5.0 contains the following breaking changes:

Changes causing silent changes of behavior

  • The OnMethodBoundaryAspect aspect will now advise the state machine of async methods and iterators by default instead of the kick-off method. The ApplyToStateMachine property is deprecated in favor of SemanticallyAdvisedMethodKinds and its default value is now true. The behavior of existing code that ignored the PS0215 warning will silently change.

Changes causing build errors

  • The PostSharp.Reflection.Syntax namespace has been renamed PostSharp.Reflection.MethodBody and classes inside this namespace have been renamed to reflect the fact this namespace is definitively not a syntax tree. (We were tired to apologize for this misnaming.) You must modify your code (hopefully just a few files) otherwise it will no longer build.

  • The PostSharp.MessageLocation class has been moved to the PostSharp.Extensibility namespace. You must modify your code (hopefully just a few files) otherwise it will no longer build.

  • The PostSharp.Patterns.Diagnostics has been completely revamped. See Upgrading from PostSharp Diagnostics 4.3 for details. You must modify your code (hopefully just a few files) otherwise it will no longer build.

  • The GenericArgs family of classes, a legacy from PostSharp 1.5 that no longer worked, was deleted.

  • It is no longer allowed to add an aspect or an advice to an anonymous method or to a method of a compiler-generated type, including the MoveNext method of a state machine type. To avoid the error, implementations of IAspectProvider and pointcuts should use method.GetSemanticInfo().IsSelectable to determine whether a method is a valid aspect or advice target.

Changes causing build warnings

  • The PostSharp.IgnoreWarningAttribute class has been renamed SuppressWarningAttribute and moved to the PostSharp.Extensibility namespace. You will get an obsolescence warning until you modify your code.

Deprecated platforms

  • Silverlight, Windows Phone and WinRT are no longer supported. These projects will no longer build.

  • Xamarin is temporarily unsupported. These projects will no longer build. Please contact our support team if you are affected by this change.

Licensing changes

  • PostSharp Professional has been renamed PostSharp Framework and no longer includes PostSharp Diagnostics. Please contact our sales team if you have a PostSharp Professional license and rely on PostSharp Diagnostics.

  • PostSharp Express has been renamed PostSharp Essentials is no longer compatible with PostSharp Express 4.2 and earlier. The licensing of PostSharp Express was modified in PostSharp 4.3, but PostSharp 4.3 included a backward-compatibility licensing mode. It has now been disabled.

  • Use of the license server is now restricted to the new PostSharp Enterprise license. Please contact our sales team if you are affected by this change.

Tip Tip

Please contact our sales team if you are a commercial user and are affected by the licensing changes. We will find a solution that is acceptable for both.


What's New in PostSharp 4.3

The objective of PostSharp 4.3 is to address the most important concerns of current PostSharp customers. We focused on improving the existing features without adding brand new ones.

PostSharp 4.3 includes the following improvements:

  • Improved build-time performance
  • Improved debugging experience
  • More flexible deployment
  • Improvements in the NotifyPropertyChanged aspect
  • Simplified licensing of PostSharp Express
  • Source code sharing with non-licensed teams
  • Automatic computing of build-time assembly binding redirections
Improved build-time performance

We understand that nobody likes to wait for the build to complete, so we've been working hard to optimize PostSharp's build performance. PostSharp 4.3 is up to 1.5 times faster than PostSharp 4.2 (the improvement is especially visible in large projects) and you don't need to change anything in your code.

But there's more. PostSharp 4.3 introduces a new feature called solution-wide build optimizations, which can double the build speed in large solutions. Since this feature can break custom build-time logic, it is disabled by default. For details, see Reducing Build Time.

Improved debugging experience

Debugging an application enhanced with aspects is now even easier thanks to the following improvements:

  • Full support for Just My Code.

  • During Step Into, aspect code is now stepped over by default.

  • The call stack no longer contains PostSharp implementation details by default.

To learn more about the new debugging behaviors and how to disable them, see Debugging Run-Time Logic.

More flexible deployment

PostSharp 4.3 brings more freedom when it comes to deployment and installation:

  • Alternative to NuGet. Between versions 3.0 and 4.2, the PostSharp compiler and libraries were only distributed as NuGet packages. Starting from version 4.3, we are re-introducing the old good zip file, and integrate it better with PostSharp Tools for Visual Studio. See Installing PostSharp without NuGet for details.

  • Command Line Tool. Using PostSharp as a command-line tool is now a supported and documented scenario. For details, see [command-line]

  • PostSharp Tools for Visual Studio no longer required. You will now be able to build a project that uses PostSharp without having PostSharp Tools installed in Visual Studio. The tooling is still highly recommended but no longer strictly required.

Improvements in the NotifyPropertyChanged aspect

PostSharp 4.3 brings two improvements to the NotifyPropertyChangedAttribute aspect:

  • Support for Caliburn.Micro and MVVM Light. See Integrating with UI Frameworks.

  • Option to avoid false positives. See Suppressing False Positives for details.

Simplified licensing of PostSharp Express

The limitations of PostSharp Express, the free edition of PostSharp, are now clearer and easier to understand and remember. For details, see Limitations of PostSharp Essentials.

Source code sharing with non-licensed teams

You no longer need a PostSharp license to build code that someone else wrote and uses PostSharp. A license is only required for code that you build or edited yourself. See Sharing Source Code With Unlicensed Teams for details.

Automatic computing of build-time assembly binding redirections

It is no longer necessary to manually create an assembly binding redirection file for PostSharp. For details, see Resolution of assembly binding redirections.


What's New in PostSharp 4.2

With PostSharp 4.2, we had two major objectives. The first was to dogfood our Threading Models into PostSharp Tools for Visual Studio, which pushed us to add many improvements both to the threading aspects and to the underlying aspect framework. The second focus was to expose code saving metrics, so you know how many lines of code you likely saved thanks to PostSharp. Additionally, we kept up with Microsoft and implemented support for the Elvis operator in NotifyPropertyChanged, and added experimental support for ASP.NET v5.

PostSharp 4.2 includes the following improvements:

  • Improvements to Aggregatable Pattern
  • Improvements to NotifyPropertyChanged
  • Improvements to Threading Models
  • Improvements to the Aspect Framework
  • Improved Support for Visual Basic
  • Code Saving Metrics
  • Module Initializers
  • Support for IncrediBuild (Experimental)
  • Support for ASP.NET v5 (Experimental)
Improvements to Aggregatable Pattern

We added the following improvements to the Aggregatable pattern and to other patterns that depend on it:

  • New advisable class AdvisableHashSetT in replacement of HashSetT.

  • New methods to the AdvisableCollectionT class: AddRange(IEnumerableT), InsertRange(Int32, IEnumerableT), RemoveRange(Int32, Int32).

  • Support for immutable collections like ImmutableArray or ImmutableDictionary.

  • Support for type adapters to allow third-party classes (at least read-only ones) to work with the Aggregatable pattern. See TypeAdapter for details.

  • Ability to programmatically and automatically mark a field as child or reference without having to use a custom attribute in source code. See FieldRule for details.

  • Performance improvement: memory no longer needs to be allocated at run time after objects are constructed, resulting in lower load on garbage collection.

  • New extensions methods for advisable collections. See Extensions.

Improvements to NotifyPropertyChanged

Improvements include to NotifyPropertyChangedAttribute include:

  • Support for the Elvis operator (?.) and properties of local variables.

  • Notification of the PropertyChanging event. See Implementing INotifyPropertyChanging for details.

  • Better error messages.

  • Inclusion of property dependencies in Visual Studio tooltips.

  • Performance improvement: memory no longer needs to be allocated at run time after objects are constructed, resulting in lower load on garbage collection.

Improvements to Threading Models

Improvements to threading models include:

  • Performance improvement: memory no longer needs to be allocated at run time after objects are constructed, resulting in lower load on garbage collection.

  • Several performance improvements regarding the instantiation of large object graphs. See Run-Time Performance of Threading Model for details.

  • New ThreadSafetyPolicy attribute to emit warning when a class is not assigned to any threading model or when a static field is not of a thread-safe type. See Making a Whole Project or Solution Thread Safe for details.

  • Better support for async methods: for lock-based models, locks are being awaited asynchronously instead of synchronously. These new high-performance advices are not yet fully implemented and tested for general use, therefore they are unsupported (except when they are used with our ready-made patterns) and undocumented.

  • Complete dogfooding in our PostSharp Tools for Visual Studio, resulting in dozen of bug fixes and usability improvements.

  • In the actor model, methods with non-void return type are now allowed and their execution will be done in the actor context, but the calling thread will wait synchronously for the execution to complete. Void but non-async methods must now be annotated with [Dispatched] (and until the next major version) to specify if execution must be synchronous or asynchronous.

Improvements to the Aspect Framework

Improvements to the aspect framework include:

  • New advice OnAspectsInitializedAdvice invoked after all aspects on the current objects have been initialized.

  • Ability to customize the description of aspects and advices in Visual Studio tooltips. See Customizing Aspect Description in Tooltips for details.

  • In the OnMethodBoundaryAspect and related aspects, ability to yield (await) a state machine upon on entry and resume.

Caution note Caution

To support performance improvements in ready-made patterns, we included a new family of advices that accept context on the stack instead of the heap.

Improved Support for Visual Basic

Visual Basic is now supported and tested at the same level as C# both in PostSharp Compiler and PostSharp Tools for Visual Studio.

Code Saving Metrics

PostSharp will now estimate the number of handwritten lines of code and the number of lines of code that you likely saved using PostSharp. For details, see Estimating Code Savings.

Module Initializers

You can now define methods that get executed immediately after the assembly is loaded, before any other code is executed. See Executing Code Just After the Assembly is Loaded and ModuleInitializerAttribute for details.

Support for IncrediBuild (Experimental)

If you use IncrediBuild, PostSharp can now be executed on a remote computer. Please contact PostSharp support for details.

Support for ASP.NET v5 (Experimental)

You can now use PostSharp in ASP.NET v5 code. The support is currently limited to the .NET Framework (CoreCLR is not supported). Support is not built-in in the normal PostSharp distribution. You need to download the PostSharp.Dnx project from GitHub. Please see https://github.com/postsharp/PostSharp.Dnx for details.


What's New in PostSharp 4.1

The focus of PostSharp 4.1 was to broaden the set of supported platforms for both PostSharp, with the addition of Xamarin and Visual Studio 2015, and improvements in the support of Windows Phone and Windows Store.

PostSharp 4.1 includes the following improvements:

  • Support for Xamarin
  • Threading Pattern Library: support for Windows Phone and Windows Store
  • Support for Visual Studio 2015
  • PostSharp Assistant
Support for Xamarin

Xamarin has become an inseparable part of the .NET ecosystem and was the number-one feature request of the PostSharp community. PostSharp 4.1 makes it possible to build applications for iOS and Android using Xamarin.

Note that Xamarin applications must be built using Visual Studio. Xamarin Studio is not supported.

Threading Pattern Library: support for Windows Phone and Windows Store

Threading Pattern Library newly supports Windows Phone, Windows Store and Xamarin. This allows you to create thread-safe applications for both Windows and Windows Phone (both Silverlight and WinRT) in the same way as for desktop applications.

Support for Visual Studio 2015

PostSharp Tools for Visual Studio have been almost completely rewritten to take advantage of the new compiler family "Roslyn" at the heart of Visual Studio 2015. New features include integration with the light bulb (instead of the smart tag), live code diagnostics and a few refactorings.

PostSharp Assistant

PostSharp Assistant guides you when you are implementing various patterns from Pattern Libraries so that you don't miss any detail. For instance, it would point at relevant documentation articles or at pieces of code that need to be fixed.

PostSharp Assistant is supported in Visual Studio 2015.


What's New in PostSharp 4.0

The principal focus of PostSharp 4 was to redesign the Threading Pattern Library from the ground up and make it a real solution to write thread-safe code with C# and VB. Additionally, we've introduced the undo/redo feature into the Model Pattern Library. To achieve these objectives properly, we had to implement a good old concept from UML and object-oriented modeling: aggregation and composition. We introduced significant improvements in the PostSharp Aspect Framework to support these new features.

PostSharp 4.0 includes the following improvements:

  • Aggregatable pattern
  • Disposable pattern
  • Immutable threading model
  • Freezable threading model
  • Synchronized threading model
  • Redesign of reader-writer-synchronized, actor, and thread-unsafe threading models
  • Recordable pattern (undo/redo)
  • Dynamic location imports
  • Aspect repository
  • OnInstanceConstructed advice
  • InitializeAspectInstance advice
  • NotifyPropertyChanged optimization
Aggregatable pattern

As it turns out, multiple patterns rely on the notion of parent-child relationships. These concepts are a part of the UML specification, where it is known as aggregation, but even modern programming languages don't implement the notions. We fixed that in PostSharp 4.0 with our AggregatableAttribute aspect. For details, see Parent/Child, Visitor and Disposable.

Disposable pattern

Once we have a notion of parent-child relationship, it is easy to build an aspect that recursively disposes a whole object tree. This is our DisposableAttribute aspect. For details, see Automatically Disposing Children Objects (Disposable).

Immutable threading model

The Immutable patterns made functional languages popular for its great usefulness in multithreaded programs. Unfortunately, the concept has traditionally been difficult to object-oriented programming. PostSharp 4.0 provides a pragmatic implementation with the ImmutableAttribute aspect. For details, see Immutable Threading Model.

Freezable threading model

Even a well-implemented Immutable pattern can be too strict for some object-oriented scenarios. In this case, the Freezable patterns may be more suitable. Based on the Aggregatable pattern, the FreezableAttribute aspect makes it possible to build freezable object trees. For details, see Freezable Threading Model.

Synchronized threading model

A threading model library could not be complete without it, so we added the SynchronizedAttribute aspect. For details, see Synchronized Threading Model.

Redesign of reader-writer-synchronized, actor, and thread-unsafe threading models

We took the right way in PostSharp 3.0 with threading models, but the vision was not yet fully consistent and the implementation was only partial. With PostSharp 3.2, we felt we had a better understanding of what we wanted to achieve, and completely revisited our threading models. Based on the Aggregatable pattern, and based on a consistent object model, the Threading Pattern Library is now much more powerful and consistent.

Recordable pattern (undo/redo)

The RecordableAttribute aspect, together with the Recorder class, make is possible to implement an undo/redo feature at the domain level.

Dynamic location imports

To allow to import several fields and properties into a single aspect field (which was not possible using ImportMemberAttribute, we added the IAdviceProvider interface and the ImportLocationAdviceInstance class.

Aspect repository

The new IAspectRepositoryService service exposes the list of all aspects added to the code model, both using custom attributes or IAspectProvider, and offer a way to execute validation logic after all aspects have been discovered.

OnInstanceConstructed advice

The OnInstanceConstructedAdvice custom attribute allows you to define an advice that is executed after the instance constructor exits.

InitializeAspectInstance advice

The InitializeAspectInstanceAdvice custom attribute allows you to define an advice that is similar to RuntimeInitializeInstance but passes information about the reason why the aspect is initialized (constructor, clone, deseralization).

NotifyPropertyChanged optimization

Our NotifyPropertyChangedAttribute is four times faster at run time on average.


What's New in PostSharp 3.1

PostSharp 3.1 builds on the vision of PostSharp 3.0, but makes it more convenient to use. It also catches up with the C# compiler features, and add more flexible licensing options.

PostSharp 3.1 includes the following improvements:

  • Better support for iterator and async methods
  • Improved configuration system
  • Build-time performance improvement
  • Resolution of file and line of error messages
  • Indentation in logging
  • Separate licensing of Pattern Libraries
Better support for iterator and async methods

When you applied an OnMethodBoundaryAspect to a method that was compiled into a state machine, whether an iterator or an async method, the code generated by PostSharp would not be very useful: the aspect would just be applied to the method that implements the state machine. An OnException advice had no chance to get ever fired.

Starting from PostSharp 3.1, OnMethodBoundaryAspect understands that is being applied to a state machine, and works as you would expect.

Improved configuration system

PostSharp 3.1 makes it easier to share configuration across several projects. For instance, you can now add aspects to all projects of a solution in just a few clicks. This is not just a UI tweak. This scenario has been made possible by significant improvements in the PostSharp configuration system:

  • Support for solution-level configuration files (SolutionName.pssln), and well-known configuration files (postsharp.config) additionally to project-level files (ProjectName.psproj). See Working with PostSharp Configuration Files for details.

  • Support for conditional configuration elements

  • Support for XPath in expressions (instead of only property references as previously). See Using Expressions in Configuration Files for details.

Build-time performance improvement

PostSharp can now optionally install itself in GAC and generate native images. This decreases build time of a fraction of a second for each project: a substantial gain if you have a lot of projects.

Resolution of file and line of error messages

When previous versions of PostSharp had to report an error or a warning, it would include the name of the type and/or method causing the message, but was unable to determine the file and line number. You can now double-click on an error message in Visual Studio and you’ll get to the relevant location for the error message.

Indentation in logging

For better log readability, PostSharp Diagnostics Pattern Library now automatically indents log entries when entering and exiting methods.

Separate licensing of Pattern Libraries

PostSharp Pattern Libraries can now be purchased separately, so you don't have to buy the full PostSharp Ultimate if you just want to use INotifyPropertyChanged. The licensing system has been modified to support this scenario.


What's New in PostSharp 3.0

The focus in PostSharp 3.0 was to deliver more value to customers with less initial learning. Instead of having to learn the product before being able to build aspects, customers can now choose from a set of ready-made implementations of some of the most popular design pattern, and apply them to their application from the Visual Studio code editor, using smart tags and wizards. We also improved support for Windows Phone, Silverlight, Windows Store and Portable Class Library.

PostSharp 3.0 includes the following improvements:

  • Model Pattern Library
  • Diagnostics Pattern Library
  • Threading Pattern Library
  • Smart tags and wizards in Visual Studio
  • Better platform support through Portable Class Libraries
  • Unified deployment through NuGet and Visual Studio Gallery
  • Transparency to obfuscators
  • Deprecation of old platforms
Model Pattern Library

The NotifyPropertyChangedAttribute aspect is a ready-made implementation of the NotifyPropertyChanged design pattern. The PostSharp.Patterns.Contracts namespace provides code contracts that can validate, at run time, the value of a parameter, a property, or a field.

Diagnostics Pattern Library

The LogAttribute and LogExceptionAttribute aspects provide a ready-made and high-performance implementation of a tracing aspect. They are compatible with the most popular logging framework, including log4net, nlog, and Enterprise Library.

Threading Pattern Library

PostSharp Threading Pattern Library invites you to raise the level of abstraction in which multithreading is being addressed. It provides three threading models: actors (Actor), reader-writer synchronized (ReaderWriterSynchronizedAttribute) and thread unsafe (ThreadUnsafeAttribute). Additionally, BackgroundAttribute and DispatchedAttribute allow you to easily dispatch a thread back and forth between a background and the UI thread.

Smart tags and wizards in Visual Studio

Smart tags allow for better discoverability of ready-made aspects and pattern implementations. When the aspect requires configuration, a wizard user interface collects the parameters and then generates the proper code.

Better platform support through Portable Class Libraries

Windows Phone, Windows Store and Silverlight are now first-class citizens. All features that are available for the .NET Framework now also work with these platforms. All platforms are supported transparently through the portable class library. To provide this feature, we had to develop the PortableFormatter, a portable serializer similar in function to the BinaryFormatter. All you have to do is to replace [Serializable] with [PSerializable].

Unified deployment through NuGet and Visual Studio Gallery

Installation of PostSharp is now unified and built on top of Visual Studio Gallery and NuGet Package Manager.

Transparency to obfuscators

PostSharp no longer requires specific support from obfuscators, as it no longer uses strings to refer to metadata declarations.

Deprecation of old platforms

Support for Silverlight 3, .NET Compact Framework, and Mono has been deprecated.


What's New in PostSharp 2.1

The objective of release 2.1 was to fix a number of 'gray points' of the version 2.0, which added friction to the adoption path of PostSharp, or even prevented people from using the product.

PostSharp 2.1 includes the following improvements:

  • Build-time performance improvement
  • Support for NuGet and improved no-setup experience
  • Compatibility with obfuscators
  • Extended reflection API
  • Architectural validation
  • Compatibility with Code Contracts
  • Support for Silverlight 5.0
  • License server
Build-time performance improvement

We traded our old text-based compilation engine to a brand new binary writer.

Support for NuGet and improved no-setup experience

PostSharp 2.1 can be installed directly from NuGet. Local installation is no longer a requirement to use the Visual Studio Extension. However, because the setup program creates ngenned images, it still provides the faster experience.

Compatibility with obfuscators

PostSharp can now be used jointly, and without limitation of features, with some obfuscators.

Extended reflection API

The class ReflectionSearch allows you to programmatically navigate the structure of an assembly: find custom attributes of a given type, find children of a given type, find members of a given type, find methods referring a given type or members, or find members accessed from a given method.

Architectural validation

Architecture Validation allows you annotate your code with constraints, which define the conditions in which your API is allowed to be used. Constraints are verified at build time and their violation generates a build warning and an error. See Validating Architecture for details.

Compatibility with Code Contracts

PostSharp 2.1 can be used jointly with Microsoft Code Contracts. Aspects and contracts can be applied to the same method.

Support for Silverlight 5.0

Silverlight 5.0 is added to the list of supported platforms.

License server

The license server helps customer manage and deploy license keys. The license server is a simple ASP.NET application that can be deployed easily on any Windows machine. Its use is optional.


What's New in PostSharp 2.0

PostSharp 1.0 and 1.5 made aspect-oriented programming (AOP) popular in the .NET community. PostSharp 2.0 makes it mainstream by enhancing convenience (Visual Studio Extension), reliability (dependency enforcement), run-time performance (optimizer), and features (composite aspects, property- and event-level aspects).

PostSharp 2.0 includes the following improvements:

  • Visual Studio Extension
  • Composite aspects (advices and pointcuts)
  • Adaptive code generation
  • Interception aspect for fields and properties
  • Interception aspect for events
  • Aspect dependencies
  • Instance-scoped aspects
  • Support for new platforms
  • Build performance improvements
Visual Studio Extension

As developers start being comfortable with PostSharp and add more and more aspects to their code, two questions become manifest: How can I know to which elements of code my aspect has been applied? How can I know which aspects have been applied to the element of code I am looking at? Answering these two questions is precisely what the PostSharp Extension for Visual Studio 2008 and 2010 has been designed for. It provides two new features to the IDE: an Aspect Browser tool window and new adornments of enhanced elements of code with clickable tooltip.

Composite aspects (advices and pointcuts)

Part of the success of PostSharp 1.5 was due to its ability to introduce aspects without appealing to barbaric terms such as advices and pointcuts. So why introduce them now? Because they make it easier to develop complex aspects. Thanks to advices and pointcuts, you can implement complex patterns such as observability awareness (INotifyPropertyChanged) with just a few lines of code. And just with PostSharp 1.5, you can still write your own aspects without knowing about advices and pointcuts.

Adaptive code generation

PostSharp 2.0 generates much smarter, faster, and smaller code than before. Let's face it: PostSharp 1.5 was quite dumb. It generated a lot of instructions that your aspects did not even need. PostSharp 2.0 analyzes your aspect to see which features are actually being used at run time, and generates only instructions that support these features. Result: you could probably not write much faster code by hand.

Interception aspect for fields and properties

PostSharp 2.0 comes with a new kind of aspect that handles fields and properties: LocationInterceptionAspect (in replacement of OnFieldAccessAspect). The aspect is much more usable than its predecessor; for instance, it is possible to call the field or property getter from the setter.

Interception aspect for events

The new aspect kind EventInterceptionAspect allows an aspect to intercept all event semantics: add, remove, and fire.

Aspect dependencies

By enforcing aspect dependency rules, PostSharp ensures that aspects behave in a predictable and robust way, even when multiple aspects are applied to the same element of code. This feature is important for large and complex projects, where aspects may be written by different teams, or provided by numerous third-party vendors who don't know about each other.

Instance-scoped aspects

In PostSharp 1.5, all aspects had static scope, i.e. there was a single instance of the aspect for every element of code to which they applied. It is now possible to define aspects that have instance lifetime. For instance, if the aspect is applied to an instance field, a new instance of the aspect will be created for every instance of the type declaring the field. This is named an instance-scoped aspect.

Support for new platforms
  • Microsoft .NET Framework 4.0
  • Microsoft Silverlight 3.0
  • Microsoft Silverlight 4.0
  • Microsoft Windows Phone 7 (Applications and Games)
  • Microsoft .NET Compact Framework 3.5
  • Novell Mono 2.6
Build performance improvements

Just starting the CLR and loading system assemblies takes considerable time, too much for an application (such as PostSharp) that is typically started very frequently and whose running time is just a couple of seconds. To cope with this issue, PostSharp now preferably runs as a background application


What's New in PostSharp 1.5

PostSharp 1.5 was published 3 years after the start of the project, and was the first release to be really production-ready.

PostSharp 1.5 includes the following improvements:

  • Aspect inheritance
  • Reading assemblies without loading them in the CLR
  • Lazy loading of assemblies
  • Build-time performance improvement
  • Support for Mono
  • Support for Silverlight 2.0 and the Compact Framework 2.0
  • Pluggable aspect serializer & partial trust
Aspect inheritance

It is now possible to put an aspect on an interface and have it implicitly applied to all classes implementing that interface. The same works with classes, virtual or interface methods, and parameters of virtual or interface methods. Read more...

Reading assemblies without loading them in the CLR

In version 1.0, PostSharp required assemblies to be loaded in the CLR (i.e. in the application domain) to be able to read them. This limitation belongs to the past. When PostSharp processes a Silverlight or a Compact Framework assembly, it is never loaded by the CLR.

Lazy loading of assemblies

When PostSharp has to load a dependency assembly, it now reads only the metadata objects it really needs, resulting in a huge performance improvement and much lower memory consumption.

Build-time performance improvement

The code has been carefully profiled and optimized for maximal performance.

Support for Mono

PostSharp is now truly cross-platform. Binaries compiled on the Microsoft platform can be executed under Novell Mono. Both Windows and Linux are tested and supported. A NAnt task makes it easier to use PostSharp in these environments.

Support for Silverlight 2.0 and the Compact Framework 2.0

You can add aspects to your projects targeting Silverlight 2.0 or the Compact Framework 2.0.

Pluggable aspect serializer & partial trust

Previously, all aspects were serializers using the standard .NET binary formatter. It is now possible to choose another serializer or implement your own, and enhance assemblies that be executed with partial trust.


Deployment and Configuration

This part describes how to deploy and configure PostSharp in complex situations.

Although PostSharp is very intuitive to use and get started with in small projects, large teams and regulated environments have specific challenges that are addressed here.

You can typically skip the reading of this part if you just want to get started quickly with PostSharp, then come back when you decide to deploy it at a larger scale.

This part is composed of the following chapters.

Chapter | Description
Deployment | This chapter describes how to install, uninstall and upgrade PostSharp, how to register license keys and to cope with build servers.
Licensing | This chapter addresses a few technical questions regarding licensing, license keys and license servers.
Configuration | This chapter explains configuration settings and how to modify them.


Deployment

PostSharp has been designed for easy deployment in typical development environments. Over the years, source control and build servers have become the norm, so we optimized PostSharp for this deployment scenario.

In most situations, PostSharp should work just fine without any advanced configuration. This chapter includes a detailed description of all deployment and configuration scenarios.

It contains the following topics:

Chapter | Description
Requirements and Compatibility | This topic lists the requirements for development, build and end-user devices.
PostSharp Components | This topic contains a summary of PostSharp components.
Installing PostSharp Tools for Visual Studio | This topic shows how to install PostSharp Tools for Visual Studio using an interactive installer.
Installing PostSharp Tools for Visual Studio Silently | This topic shows how to install PostSharp Tools for Visual Studio silently using a command line interface.
Installing PostSharp Into a Project | This topic shows how to install PostSharp Compiler into your project using NuGet Package Manager.
Installing PostSharp without NuGet | This topic shows how to install PostSharp Compiler into your project without NuGet Package Manager.
Using PostSharp on a Build Server | This topic shows how to use PostSharp on a build server and describes licensing details for this scenario.
Upgrading from a Previous Version of PostSharp | This topic explains how to upgrade from a previous version of PostSharp.
Uninstalling PostSharp | This topic shows how to uninstall PostSharp from your projects and from Visual Studio.
Deploying PostSharp to End-User Devices | This topic describes redistribution of PostSharp run-time libraries to end-user devices.


Requirements and Compatibility

You can use PostSharp to build applications that target a wide range of target devices. This article lists the requirements for development, build and end-user devices.

This topic contains the following sections:

  • Supported programming languages
  • Requirements on development workstations and build servers
  • Requirements on end-user devices
  • Compatibility with ASP.NET
  • Compatibility with Microsoft Code Analysis
  • Compatibility with Microsoft Code Contracts
  • Compatibility with Obfuscators
  • Known Incompatibilities
Important note Important

Please read our Supported Platforms Policies on our web site as it contains important explanations, restrictions and disclaimers regarding this article.

Supported programming languages

This version of PostSharp supports the following languages:

  • C# 7.2,

  • VB 15.5.

You may use PostSharp with an unsupported language version at your own risks by setting the PostSharpSkipLanguageVersionValidation MSBuild property to True. There are two risks in doing that: inconsistent or erroneous behavior of the current version of PostSharp, and breaking changes in the future version of PostSharp that will support this language version.

Requirements on development workstations and build servers

This section lists the supported platforms, and most importantly platform versions, on which PostSharp is intended to run.

The following software components need to be installed before PostSharp can be used:

  • Any of the following versions of Microsoft Visual Studio:

    • Visual Studio 2013 Update 5.

    • Visual Studio 2015 Update 3.

    • Visual Studio 2017 RTW (15.0).

    • Visual Studio 2017 Update 1 (15.9).

    The debugging experience may be inconsistent with other IDEs than Visual Studio or when PostSharp Tools for Visual Studio are not installed.

  • .NET Framework 4.7.1 or later.

  • Any of the following operating systems:

    • Windows 10: any version in mainstream Microsoft support, except LTSB and S editions.

    • On build agents only: Windows Server 2012, Windows Server 2012 R2, Windows Server 2016.

  • Optionally, one of the following versions of .NET Core:

    • .NET Core SDK 2.1 (LTS).

      .NET Core SDK 2.2.

Requirements on end-user devices

The following table displays the versions of the target frameworks that are supported by the current release of PostSharp and its components.

Package | .NET Framework | .NET Core | .NET Standard*
PostSharp | 3.5 SP1, 4.0*, 4.5*, 4.6, 4.7 | 1.1, 2.0, 2.1 | 1.3 or later
PostSharp.Patterns.Common PostSharp.Patterns.Aggregation PostSharp.Patterns.Threading PostSharp.Patterns.Model PostSharp.Patterns.Diagnostics | 4.0*, 4.5*, 4.6, 4.7 | 1.1, 2.0, 2.1 | 1.3 or later
PostSharp.Patterns.Xaml | 4.0*, 4.5*, 4.6, 4.7 | - | -
PostSharp.Patterns.Caching | 4.6, 4.7 | - | -
Note Note

.NET Framework 4.0 and 4.5 are no longer supported by Microsoft. Although we still provide libraries targeting them, we no longer run our tests on these specific versions of the .NET Framework. We do test these libraries, but on .NET Framework 4.5.2.

Note Note

PostSharp does not implicitly support all platforms that support .NET Standard. Only platforms mentioned in this table are supported.

Compatibility with ASP.NET

There are two ways to develop web applications using Microsoft .NET:

  • ASP.NET Application projects are very similar to other projects; they need to be built before they can be executed. Since they are built using MSBuild, you can use PostSharp as with any other kind of project.

  • ASP.NET Site projects are very specific: there is no MSBuild project file (a site is actually a directory), and these projects must not be built. ASP.NET Site projects are not supported.

Compatibility with Microsoft Code Analysis

By default, PostSharp reconfigures the build process so that Code Analysis is executed on the assemblies as they were before being enhanced by PostSharp. If you are using Code Analysis as an integrated part of Visual, no change of configuration is required.

You request the Code Analysis to execute on the output of PostSharp by setting the ExecuteCodeAnalysisOnPostSharpOutput MSBuild property to True. For more information, see Configuring Projects Using MSBuild.

Compatibility with Microsoft Code Contracts

PostSharp configures the build process so that Microsoft Code Contracts is executed before PostSharp. Additionally, Microsoft Code Contracts' static analyzer will be executed synchronously (instead of asynchronously without PostSharp), which will significantly impact the build performance.

Compatibility with Obfuscators

PostSharp generates assemblies that are theoretically compatible with all obfuscators.

Note Note

PostSharp Diagnostics is not designed to work with obfuscated assemblies.

Caution note Caution

PostSharp constructs that are not emitted by Microsoft compilers (for instance methodof). These unusual constructs may reveal bugs in third-party tools, because they are generally tested against the output of Microsoft compilers.

Known Incompatibilities

PostSharp is not compatible with the following products or features:

Product or Feature | Reason | Workaround
Visual Studio 2010 | No longer under Microsoft mainstream support | Use PostSharp 3.1.
Visual Studio 2012 | No longer under Microsoft mainstream support | Use PostSharp 5.0.
ILMerge | Bug in ILMerge | Use another merging product (such as ILPack, SmartAssembly).
Edit-and-Continue | Not Supported | Rebuild the project after edits
Silverlight 3 or earlier | No longer under Microsoft mainstream support | Use PostSharp 2.1.
Silverlight 4 | No longer under Microsoft mainstream support | Use PostSharp 3.1.
Silverlight 5 | Low customer demand. | Use PostSharp 4.3.
.NET Compact Framework | No support for PCL | Use PostSharp 2.1.
.NET Framework 2.0 | No longer under Microsoft mainstream support | Target .NET Framework 3.5 or use PostSharp 3.1.
Windows Phone 7 | No longer under Microsoft mainstream support | Use PostSharp 3.1
Windows Phone 8, WinRT | Low customer demand. | Use PostSharp 4.3
Visual Studio Express | Microsoft's licensing policy | Use Visual Studio Community Edition
ASP.NET Web Sites | Not built using MSBuild | Convert the ASP.NET Web Site to an ASP.NET Web Application.
Universal Windows Platform (UWP) | Not supported (low customer demand) | Contact PostSharp support team.
Xamarin | Support suspended (deprioritized because of low customer demand) | Use PostSharp 4.3. Contact PostSharp support team to discuss prioritization.
Mono, Unity3D | Unsupported | None.


PostSharp Components

PostSharp is composed of the following artifacts:

  • PostSharp Tools for Visual Studio
  • NuGet packages
  • Zip distribution
PostSharp Tools for Visual Studio

This is the user interface of PostSharp. It extends the Visual Studio editor and provides a new menu, option pages, toolbox windows, diagnostics, code actions, and debugging enhancements.

For details regarding the installation of this component, see Installing PostSharp Tools for Visual Studio and Installing PostSharp Tools for Visual Studio Silently.

NuGet packages

All build-time and run-time artifacts are released as NuGet packages. Build-time packages are required to build your projects, but only the content of run-time packages is required to execute your applications.

If you build NuGet packages that use PostSharp but does not define custom aspects, your package should only reference the relevant PostSharp run-time packages, not the build-time ones.

Note Note

The PostSharp License Agreement refers to run-time packages as redistributables. The license agreement allows for royalty-free redistribution of run-time packages, but stricter conditions apply to the redistribution of build-time packages.

The following table lists all PostSharp packages:

Run-time package | Build-time package | Description
PostSharp.Redist | PostSharp | PostSharp Framework. The build-time package includes the PostSharp compiler.
PostSharp.Patterns.Common.Redist | PostSharp.Patterns.Common | Common logic shared between pattern libraries. Code contracts.
PostSharp.Patterns.Aggregation.Redist | PostSharp.Patterns.Aggregation | Aggretable and Disposable aspects.
PostSharp.Patterns.Model.Redist | PostSharp.Patterns.Model | NotifyPropertyChanged aspect and Undo/Redo.
PostSharp.Patterns.XAML.Redist | PostSharp.Patterns.XAML | Command, Dependency Property and Attached Property aspects. WPF controls for undo/redo.
PostSharp.Patterns.Threading.Redist | PostSharp.Patterns.Threading | Threading models, thread dispatching aspects, deadlock detection.
PostSharp.Patterns.Caching.Redist | PostSharp.Patterns.Caching | Caching aspect.
PostSharp.Patterns.Caching.Redis | N/A | Redis connector for PostSharp.Patterns.Caching.
PostSharp.Patterns.Caching.Azure | N/A | Azure connector for PostSharp.Patterns.Caching.
PostSharp.Patterns.Diagnostics.Redist | PostSharp.Patterns.Diagnostics | Logging aspect.
PostSharp.Patterns.Diagnostics.ApplicationInsights | N/A | Application Insights connector for PostSharp.Patterns.Diagnostics.
PostSharp.Patterns.Diagnostics.CommonLogging | N/A | Common.Logging connector for PostSharp.Patterns.Diagnostics.
PostSharp.Patterns.Diagnostics.EnterpriseLibrary | N/A | Enterprise Library connector for PostSharp.Patterns.Diagnostics.
PostSharp.Patterns.Diagnostics.Log4Net | N/A | Log4Net connector for PostSharp.Patterns.Diagnostics.
PostSharp.Patterns.Diagnostics.Microsoft | N/A | Microsoft.Extensions.Logging connector for PostSharp.Patterns.Diagnostics.
PostSharp.Patterns.Diagnostics.NLog | N/A | NLog connector for PostSharp.Patterns.Diagnostics.
PostSharp.Patterns.Diagnostics.Serilog | N/A | Serilog connector for PostSharp.Patterns.Diagnostics.
PostSharp.Patterns.Diagnostics.Tracing | N/A | System.Diagnostics connector for PostSharp.Patterns.Diagnostics.
PostSharp.Patterns.Diagnostics.Loupe | N/A | Loupe connector for PostSharp.Patterns.Diagnostics.
Zip distribution

For teams that cannot use NuGet, PostSharp also comes as one zip archive containing the files otherwise contained in all NuGet packages.

In this archive, the lib folder contains run-time libraries (redistributables), and the tools folder contains all build-time components.

See Installing PostSharp without NuGet for details.

See Also

Other Resources

Deploying PostSharp to End-User Devices


Installing PostSharp Tools for Visual Studio

PostSharp Tools for Visual Studio are PostSharp's user interface. Install them on a developer's computer, does not affect the projects until the PostSharp NuGet package has been added to this project. See Installing PostSharp Into a Project for details.

To install PostSharp Tools for Visual Studio:

  1. Download the file PostSharp-full-X.X.X.exe from https://www.postsharp.net/download.

  2. Run the file PostSharp-full-X.X.X.exe.

  3. Complete the installation configuration wizard. You will be asked to enter a license key or to start the trial period. The wizard may ask the permission to install NuGet Package Manager or to uninstall the user interface of PostSharp.

Note Note

The installer mentioned above contains Visual Studio extension packages for each version of Visual Studio supported by PostSharp. To save some space, use the file PostSharp-web-X.X.X.exe from https://www.postsharp.net/downloads. This file contains the installer only and each Visual Studio extension package is downloaded on the fly during the installation process. The packages for Visual Studio versions not installed on your machine are not downloaded.

See Also

Other Resources

Installing PostSharp Into a Project
Uninstalling PostSharp


Installing PostSharp Tools for Visual Studio Silently

PostSharp is composed of a user interface (PostSharp Tools for Visual Studio) and build components (NuGet packages). NuGet packages are usually checked into source control or retrieved from a package repository at build time (see Restoring Packages at Build Time), so its deployment does not require additional automation. The user interface is typically installed by each user. It does not require administrative privileges.

In large teams, it might be inconvenient to install PostSharp Tools for Visual Studio on each machine manually. For this purpose, PostSharp installer enables silent installation using a command line interface. You can install PostSharp automatically for a large number of users using the silent installer.

To install PostSharp unattended:

  1. Download the installer from https://www.postsharp.net/download. The installer is a file named PostSharp-full-X.X.X.exe.

  2. Extract the installer files using the following command line:

    Copy
    PostSharp-full-X.X.X.exe /extract %TEMP%\PostSharp-full.X.X.X

  3. Execute the following command line:

    Copy
    %TEMP%\PostSharp-full.X.X.X\PostSharp.Settings.exe /setup

    In the command line above, the following arguments are optional but recommended:

    Argument

    Description

    /ceip

    Allows PostSharp to collect anonymous information about the way you are using the software. We never collect your source code. See our privacy policy for details.

    If you don't specify this flag, CEIP will be disabled, and the user will not be asked to enable it.

    /license 000-AAAAAAAAAAAAAAA

    Installs the license key for the current user in registry. In this argument, 000-AAAAAAAAAAAAAAA must be replaced by the license key or the URL to the license server.

    /license-all 000-AAAAAAAAAAAAAAA

    Installs the license key for all users in registry. In this argument, 000-AAAAAAAAAAAAAAA must be replaced by the license key or the URL to the license server.

    Caution note Caution

    If the /license and /license-all arguments are omitted, the license keys on the machine will remain unchanged or uninstalled.

Note Note

If any Visual Studio instance or other processes affected by the installer is running during the installation process, the installer lists all the blocking processes, and fails. You need to run silent installation when none of these processes is running.

See Also

Other Resources

Installing PostSharp Into a Project
Uninstalling PostSharp


Installing PostSharp Into a Project

The compiler components of PostSharp are distributed as a NuGet package named simply PostSharp. If you want to use PostSharp in a project, you simply have to add this NuGet package to the project.

This topic contains the following sections:

  • Adding PostSharp to a project
  • Including files in your source control system
Adding PostSharp to a project

To add PostSharp to a project:

  1. Open the Solution Explorer in Visual Studio.

  2. Right-click on the project.

  3. Click on Add PostSharp.

Tip Tip

Remember that adding PostSharp to a project just means adding the PostSharp NuGet package. If you want to add PostSharp to several projects in a solution, it may be easier to use NuGet to manage packages at the solution level. You may need to select the Include Prerelease option to install a prerelease version of PostSharp.

Tip Tip

NuGet Package Manager can be configured using a file named nuget.config, which can be checked into source control and can specify, among other settings, the location of the package repository (if it must be shared among several solutions, for instance) or package sources (if packages must be pre-approved). See NuGet Configuration File and NuGet Configuration Settings for more information.

Including files in your source control system

After you add PostSharp to a project, you need to add the following files to source control:

  • packages.config

  • postsharp.config, if any

  • *.psproj, if any

  • *.pssln, if any

Some of the files above might not be present depending on the package management format you use (packages.config/PackageReference) and on which PostSharp packages you have installed in your project.

Optionally, if you use the packages.config package management format, you can also include the packages folder in your source control. Note that there are negative consequences on this practice. See Omitting NuGet packages in source control systems for more information. If you choose not to include the packages folder in your source control system, read Restoring Packages at Build Time.

Once you have all of these files included in your source code repository, any other developer getting that source code from the repository will have the required information to be able to build the application.


Installing PostSharp without NuGet

The most common way to add PostSharp to your project is by installing PostSharp NuGet packages. The main benefit of using NuGet Package Manager is that it provides a standard way to install and manage all dependencies for your .NET projects.

Previous versions of NuGet had several issues that made it an impractical solution for some teams. For this reason, we allow to use PostSharp without NuGet, by downloading and extracting a standard zip file. However, the installation procedure is significantly more cumbersome without NuGet than with NuGet.

To install PostSharp into a project without NuGet:

  1. Download the zip distribution from https://www.postsharp.net/downloads (a file named PostSharp-x.x.x.zip).

  2. Extract the zip file into some local directory.

  3. Using Visual Studio, add references to the relevant PostSharp assemblies. They are located under the lib directory.

  4. Open the project file with a text editor and add the following line just after the last Import element.

    Copy
    <Import Project="..\..\..\postsharp\Tools\PostSharp.targets" />
See Also

Other Resources

Deployment
Installing PostSharp Into a Project
Uninstalling PostSharp


Using PostSharp on a Build Server

PostSharp has been designed for frictionless use on build servers. PostSharp build-time components are deployed as NuGet packages, and are integrated with MSBuild. No component needs to be installed or configured on the build server, and no extra build step is necessary. If you choose not to check in NuGet packages in your source control, read Restoring Packages at Build Time.

Installing a License on the Build Server

There are several ways to install a license on the build server:

  • Don't install it. It is not necessary to install the license key on the build server unless you are using the features of PostSharp Diagnostics.

  • Add your license key to the postsharp.config file and add this file to the source repository as described in Deploying License Keys.

  • Set an environment variable named PostSharpLicense to a semicolon-separated list of your license keys.

We do not recommend to install the license key on a build server using the user interface.

See Also

Other Resources

Installing PostSharp Tools for Visual Studio
Deploying License Keys


Restoring Packages at Build Time

NuGet Package Manager has the ability to restore packages from their repository during the build. This allows teams to avoid storing NuGet packages in their source repository.

You can restore the PostSharp package at build time as long as the package is restored before MSBuild is invoked to build the project.

The reason is that the PostSharp.targets file is required during the build, otherwise PostSharp is not inserted in the build process, and simply does not work. Because of the design of MSBuild, PostSharp.targets must be present when the build starts, so it cannot be restored from the package repository during the same build. The build that triggers the package restore will either fail or run without PostSharp, and subsequent builds will succeed. A rebuild is then required.

This behavior is acceptable on developer workstations. However, on build servers, you must ensure that the packages are restored before the project is built.

The way you restore packages differs with the version of NuGet:

  • NuGet 2.7 and Later
  • Visual Studio 2017 and Later
  • .NET Core Command Line Interface
  • NuGet 2.0 to 2.6
NuGet 2.7 and Later

To restore the PostSharp package at build time, add a preliminary step before building the Visual Studio solutions or projects. This step should execute the following command:

Copy
NuGet.exe restore MySolution.sln

In this command, the MySolution.sln is the solution for which packages have to be restored.

To restore packages for a solution where some projects use the packages.config package management format and others use the PackageReference package management format, use this way as well. It will restore packages in all the projects, regardless of the package management format used.

See NuGet Command-Line Reference for details.

Visual Studio 2017 and Later

If all your projects use the PackageReference package management format, you can use the MSBuild Restore target to restore NuGet packages. To restore the PostSharp package at build time, add a preliminary step before building the Visual Studio solutions or projects. This step should execute the following command:

Copy
MSBuild /T:Restore MySolution.sln

In this command, the MySolution.sln is the solution for which packages have to be restored. Eventually, you can call the MSBuild target from your MSBuild script.

Caution note Caution

If some projects of your solution use the packages.config project management format, those will not get the NuGet packages restored this way. Use the NuGet.exe command described in the first section instead.

See NuGet pack and restore as MSBuild targets for details.

.NET Core Command Line Interface

If all your projects are .NET Core projects, you can use the .NET Core Command Line Interface to restore NuGet packages. To restore the PostSharp package at build time, add a preliminary step before building the Visual Studio solutions or projects. This step should execute the following command:

Copy
dotnet restore MySolution.sln

In this command, the MySolution.sln is the solution for which packages have to be restored.

Caution note Caution

If some projects of your solution are not .NET Core projects, those will not get the NuGet packages restored this way correctly. Use the NuGet.exe command described in the first section instead.

See dotnet-restore for details.

NuGet 2.0 to 2.6

To restore the PostSharp package at build time, add a preliminary step before building the Visual Studio solutions or projects. This step should execute the following command for every packages.config file in your solution (typically, for every project):

Copy
NuGet.exe install packages.config -OutputDirectory SolutionDirectory\packages

In this command, where SolutionDirectory\packages is the directory where the NuGet packages should be installed.

Please look at the NuGet Command-Line Reference for details.

Tip Tip

You can use PowerShell or MSBuild to execute the nuget install command to all packages.config files in your source repository.

See Also

Other Resources

Package Restore on NuGet Reference Documentation


Using PostSharp with Visual Studio Online

When hosting your source code on Visual Studio Online, adding PostSharp to the codebase is no different than for any other build server situation.

Visual Studio Online offers an online build server environment. Once configured the build server will retrieve your source code and compile the application for you. As part of this build process, you will want any PostSharp aspects to be added in the same way that it occurs on your local development machine. To do this you will have to ensure that your codebase includes PostSharp as outlined in the Installing PostSharp Into a Project section. You will also need to configure a build definition as outlined in the Create or edit build definition article on MSDN.

Once you are able to successfully run the build you will want to review the build logs and verify the artifacts that were created by that build. Here's how you can verify that your build included your PostSharp aspects.

Verifying Visual Studio Online Builds

  1. To review the build logs, open the successful build.

  2. Select the Diagnostics tab.

  3. Ensure that the installation of PostSharp and any PostSharp patterns libraries that you used.

    If you see entries like these in your build log you know that the build process correctly downloaded the PostSharp components.

    If you do not see any entries for the downloading of the PostSharp components you will want to ensure that the packages.config file is correctly included in your source code repository and that the PostSharp dependencies are referenced in the appropriate projects.

See Also

Other Resources

MSDN: Create or edit Visual Studio Online build definition


Upgrading from a Previous Version of PostSharp

This section explains how to upgrade from a previous version of PostSharp.

This topic contains the following sections:

  • Upgrading PostSharp Tools for Visual Studio
  • Upgrading solutions from PostSharp 3 or later
  • Upgrading large repositories
  • Upgrading solutions from PostSharp 2
Tip Tip

Other sections of this chapter, specifically Installing PostSharp Tools for Visual Studio, Deploying License Keys and Using PostSharp on a Build Server, are also useful if you need to upgrade from an earlier version of PostSharp.

Upgrading PostSharp Tools for Visual Studio

After you install PostSharp Tools for Visual Studio, you will still be able to open solutions that use older versions of PostSharp.

PostSharp Tools for Visual Studio are backward compatible with older versions of PostSharp. However, several versions of the extension cannot coexist. Therefore, installing a new version of PostSharp Tools will uninstall the previous version.

To upgrade PostSharp Tools for Visual Studio, simply download it from https://www.postsharp.net/download and execute the installation package.

Caution note Caution

Upgrading PostSharp Tools for Visual Studio does not implicitly upgrade your source code.

Upgrading solutions from PostSharp 3 or later
Caution note Caution

Before you upgrade your project to a different major release of PostSharp, check that the new version still supports your version Visual Studio and the target framework of your application. Check the release notes for an accurate compatibility list of the specific version you are installing.

You can use several versions of PostSharp side-by-side on the same machine. However, it is recommended that you use the same version in all projects of the same solution.

To upgrade a solution from PostSharp 3 or later:

  1. Open the Solution Explorer in Visual Studio.

  2. Right-click on the solution.

  3. Click on Manage NuGet Packages for Solution.

  4. Click on Updates.

  5. Find the PostSharp package and click on Update.

  6. Select all projects, click OK.

  7. Repeat the operation for all PostSharp.Patterns.* packages.

Upgrading large repositories

If your source contains a large number of solutions, upgrading manually using NuGet may be too labor intensive. In this situation, it is better to use our upgrade PowerShell script.

To upgrade a large number of solutions with the PowerShell script:

  1. Download the following Git repository: https://github.com/sharpcrafters/PostSharp.Utilities. You can download it manually from the web page or execute the following command:

    Copy
    git clone https://github.com/sharpcrafters/PostSharp.Utilities.git

  2. Follow instructions on in README.md.

Caution note Caution

This script does not support other platforms than the .NET Framework and does not support PostSharp Pattern Libraries.

Upgrading solutions from PostSharp 2

Every project can have only references to a single version of PostSharp. This applies both to direct and indirect references. The PostSharp 3 or later compiler is not backward compatible with PostSharp 2, and PostSharp 3 will refuse to compile projects that have a reference to PostSharp 2. Therefore, you will typically use a single version of PostSharp in every solution.

You can upgrade projects from PostSharp 2 to PostSharp 3 by adding the PostSharp NuGet package to these projects.

To upgrade a solution from PostSharp 2:

  1. Open the Solution Explorer in Visual Studio.

  2. Right-click on the solution.

  3. Click on Manage NuGet Packages for Solution.

  4. Click on Online.

  5. In the search box, type PostSharp. You may want to select the Select prereleases option (instead of the default Stable Only) to install a pre-release version of PostSharp.

  6. Find the PostSharp package and click on Install.

  7. Select all projects, click OK.

Although PostSharp 3 or later is mostly backward compatible with PostSharp 2 at source-code level, you may need to perform small adjustments to your source code:

  • Every occurrence of the _Assembly interface has been replaced by the Assembly classes. You may have to change the signatures of some methods derived from AssemblyLevelAspect.

  • Aspects that target Silverlight, Windows Phone or Windows Store must be annotated with the PSerializableAttribute custom attribute.

  • PostSharp Toolkits 2.1 need to be uninstalled using NuGet. Instead, you can install PostSharp Pattern Libraries 3 from NuGet. Namespaces and some type names have been changed.


Uninstalling PostSharp

If you make the decision to remove PostSharp from your project we are sorry to see you leave.

There are two scenarios you may want to consider: removing PostSharp from individual projects or solutions, and removing PostSharp from Visual Studio.

This topic contains the following sections:

  • Removing PostSharp from your projects and solutions
  • Removing PostSharp from Visual Studio
Removing PostSharp from your projects and solutions

Here are some steps to follow to remove PostSharp from your project.

Caution note Caution

As you'll see in these steps, removing the product from your project is not that difficult. However, replacing the aspects that you were using will be a much more arduous task that will require a great deal of planning.

You will need to replace the aspects by handwritten source code that implement the same behaviors. Depending on how intensively you used PostSharp, your codebase could significantly increase as a result of stopping using PostSharp. Other products and frameworks that pretend to implement aspect-oriented programming actually only provide a small subset of the features you are got used to with PostSharp.

Because every project will use aspects differently, and some will have custom aspects, we are unable to provide you with any generic piece of advice about how to replace specific aspects.

To remove PostSharp from a project, you simply have to remove all PostSharp packages from it. The following procedure demonstrates how to remove PostSharp for the whole solution.

Removing PostSharp with NuGet Packages Manager for Solution

  1. Open the Package Manager for Solution windows

  2. Select the All tab from the left side of the window.

  3. Find the PostSharp packages in the list and select one of the PostSharp Library packages. Click the Manage button.

    Note Note

    Start by selecting the PostSharp Library Packages and working in reverse dependency order. This will result in the main PostSharp package being the last one that you select to remove.

  4. Ensure that you uncheck all of the projects listed in the window and click OK.

  5. Repeat steps 3 and 4 for each of the PostSharp packages that show in the Packages Manager for Solution window.

  6. To verify that all of the PostSharp packages have been removed from your codebase, ensure that there are no PostSharp packages listed in the Packages Manager for Solution window.

Once you have removed all of the PostSharp packages from your codebase it is most probable that your application will no longer compile. Compilation errors will be registered where PostSharp aspect attributes exist in the codebase as well as where custom aspects were written. You will need to remove these entries from your codebase to get it to compile again.

Simply deleting the offending code can accomplish this. You must remember that in the process of removing PostSharp from your codebase these errors indicate locations where you are removing functionality from the codebase as well. If the functionality that is being removed is required by the application you will need to determine how to provide that functionality in the codebase going forward. This is the most difficult part of removing PostSharp from your codebase. Because aspects can be used in a multitude of different manners, and custom aspects can be created for any number of different uses, there is no practical way to tell you how to replace the functionality being lost.

Note Note

You now have removed PostSharp from your codebase. At this point, you are able to continue on your development effort without making use of PostSharp.

If you would like to remove PostSharp from Visual Studio, proceed with the following steps.

Removing PostSharp from Visual Studio

Before you uninstall PostSharp Tools for Visual Studio, we suggest you remove the compiled images.

Removing Native Compiled Images

  1. Open the Visual Studio Options dialog.

  2. Expand the PostSharp node in the tree and select the Compiled Images node.

  3. Select an entry in the list box and click Uninstall .

  4. Follow the wizard to uninstall the compiled images for the selection you made. There are no choices to be made, simply click Next and Finish until the wizard is completed.

    Note Note

    You will need to perform the previous steps for each of the versions listed in the PostSharp Compiled Image page in the Options dialog.

The next step is to remove PostSharp from Visual Studio.

Uninstalling the PostSharp Tools for Visual Studio

  1. Open the Extensions and Updates window.

  2. Select the All tab on the left of the window.

  3. Find the PostSharp entry, select it and click the Uninstall button.

  4. Click Yes to confirm that you want to uninstall the PostSharp extension.

  5. Repeat the two previous steps and uninstall the extension named PostSharp Backward Compatibility Tools.

  6. Restart Visual Studio.

Finally, you can remove the temporary files created by PostSharp. These files would be recreated as necessary the next time you run PostSharp.

Other than occupying disk space, there is no impact of not removing these files.

Cleaning temporary files

  1. Open Windows Explorer and navigate to C:\ProgramData\PostSharp.

  2. Select the C:\ProgramData\PostSharp folder and delete it.


Deploying PostSharp to End-User Devices

Although PostSharp is principally a compiler technology, it contains run-time libraries that need to be deployed along with your application to end-user devices.

This topic contains the following sections:

  • Redistribution of PostSharp run-time libraries without NuGet
  • Redistribution of PostSharp run-time libraries using NuGet
Redistribution of PostSharp run-time libraries without NuGet

If you do not deliver your final product using NuGet, you can bundle all the referenced PostSharp run-time libraries in your product. These libraries are the ones included in the lib subdirectory of the NuGet packages and the ZIP distribution.

These run-time libraries can be distributed to end-users free of charge. However, the build-time parts of PostSharp cannot be redistributed under the terms of the standard license agreement.

Besides including these run-time libraries, no other action or configuration is required.

Redistribution of PostSharp run-time libraries using NuGet

If you deliver your final product using NuGet, you can add PostSharp redistributable NuGet packages as a dependency to your NuGet package instead of including all the run-time libraries inside your NuGet package.

PostSharp NuGet packages are either intended for build-time or for run-time. We do not mix both in any of our NuGet packages. See PostSharp Components for a description of how to distinguish them.

Thanks to this fact, you only need to set the run-time PostSharp NuGet packages as a dependency of your NuGet package.

Sample NuGet package

In the following example, there is a NuGet package specification of a package which has the PostSharp.Redist package as its dependency. This way, there's no need to include the PostSharp run-time libraries inside the package.

Copy
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
  <metadata>
    <id>MyLibrary</id>
    <version>1.0.0</version>
    <authors>John Smith</authors>
    <owners>John Smith</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>This is my library created with a help of PostSharp.</description>
    <dependencies>
      <!-- TODO: Replace X.X.X with a version of PostSharp you want to be dependent. -->
      <dependency id="PostSharp.Redist" version="X.X.X" />
    </dependencies>
  </metadata>
  <files>
    <file src="bin\Release\MyLibrary.dll" target="lib\net46"/>
    <!-- NOTE: No need to include PostSharp run-time libraries inside the package. -->
  </files>
</package>

See .nuspec reference for details.

Using the Pack MSBuid target or .NET Core CLI

In the following example, you see a .NET Core project which uses the PackageReference package management format. Creating a NuGet package using the Pack MSBuid target or .NET Core CLI command dotnet pack from this project will create a NuGet package which will depend on the run-time PostSharp packages only.

Copy
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp1.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>

    <!-- TODO: Replace X.X.X with a version of PostSharp you want to be dependent. -->
    <PackageReference Include="PostSharp" Version="X.X.X">
      <!-- NOTE: Thanks to the following element, the PostSharp build-time NuGet package
                 will not be a dependency of the NuGet package created from this project. -->
      <PrivateAssets>All</PrivateAssets>
    </PackageReference>

    <!-- TODO: Replace X.X.X with a version of PostSharp you want to be dependent. -->
    <PackageReference Include="PostSharp.Redist" Version="X.X.X" />
    <!-- NOTE: The PostSharp.Redist run-time NuGet package
               will be a dependency of the NuGet package created from this project. -->

  </ItemGroup>

</Project>

See Package references (PackageReference) in project files for details.


Licensing

This chapter addresses some technical questions related to the licensing of PostSharp. For business questions, please refer to our web site.

It contains the following topics:

Chapter | Description
Deploying License Keys | This topic shows how each developer can install the license key using the UI and how this can be done centrally by adding the license key to source control.
License Audit | This topic explains that PostSharp does not validate the license key in a blocking way, but audits the use of license keys.
Limitations of PostSharp Essentials | This topic explains the limitations of PostSharp Essentials.
Sharing Source Code With Unlicensed Teams | This topic explains that you don't need to purchase a license if you need to build code that you didn't write yourself but uses PostSharp.
Using PostSharp License Server | This topic shows how users can obtain a license from a license server.
Installing and Servicing PostSharp License Server | This topic describes how system administrators can install and maintain the license server.


Deploying License Keys

This section explains how to install PostSharp license keys.

Whether you are using a free or commercial edition, PostSharp requires you to enter a license key before being able to build a project.

This topic contains the following sections:

  • Registering a license key using the user interface
  • Installing the license key in your source control
Registering a license key using the user interface

Registering a license key using the user interface is the preferred procedures for individual developers and small teams.

To register a license key using the user interface:

  1. Open Visual Studio.

  2. Click on menu PostSharp, then Options.

  3. Open the License option page.

  4. Click on the Register a license link.

  5. Click on Register a license.

    License Wizard 1

  6. Paste the license key and click Next .

    License Wizard 2

  7. Read the license agreement and check the option I agree. Click on Next.

    License Wizard 3
    Tip Tip

    If you are registering the license key on a build server, also check the option Register these settings for all accounts on this machine.

  8. Click Next on the notice regarding license metering.

Installing the license key in your source control

It is possible to install the license key in your source control, so that these settings are automatically applied during the build.

To install the license the in source control:

  1. Create a file named postsharp.config in the root directory of your source repository, or in any parent directory of the Visual Studio project file (*.csproj or *.vbproj).

  2. Add the following content to the postsharp.config file:

    Copy
    <?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.postsharp.org/1.0/configuration">
  <License Value="000-AAAAAAAAAAAAAAA"/>
</Project>

    In this code, 000-AAAAAAAAAAAAAAA must be replaced by the license key or the URL to the license server.

See Working with PostSharp Configuration Files for details about this configuration file.


License Audit

Although most software packages are protected with a license activation mechanism, we think that the practice is not adequate for software development tools:

  • The source code is sometimes compiled several years after it has been written, and there is no guarantee that the license activation server will still be functional.

  • Development teams want their tools to be included in the source control repository together with the source code, and want the license key to be deployed the same way.

Instead of license activation, PostSharp relies on asynchronous, fail-safe license audit. PostSharp audits the use of license keys on each client machine and periodically reports it to our license servers. The mechanism does not require a permanent network connection, and PostSharp will not fail if the license server is not available.

The licensing client will contact our licensing servers in the following cases:

  • When a license is registered on a computer with the user interface.

  • Once per week, for every user and every device using PostSharp.

No personally identifiable information is transmitted during this process except the license key. In case we suspect a rough violation of the License Agreement, we reserve the right to contact the legitimate owner of this license.

Tip Tip

If license audit is not acceptable in your company, please contact us with a request to disable license audit. Our sales teams will evaluate your request and answer with a license key containing an audit waiver. Global licenses and site licenses are not subject to license audit by default. The use of the license server does not implicitly disable license audit. For more information, see Using PostSharp License Server.

See Also

Other Resources

Using PostSharp License Server


Limitations of PostSharp Essentials

PostSharp Essentials contains all the features of PostSharp Ultimate, but the number of types to which you can apply aspects is limited to 10 per project or 50 per solution.

To know how many types are already using aspects, open the PostSharp Metrics tool window in Visual Studio.

This topic contains the following sections:

  • Limitations of PostSharp Architecture Framework
  • Limitations of PostSharp Diagnostics
  • Enforcement of the solution-level limit
  • Diagnosing licensing issues
Limitations of PostSharp Architecture Framework

PostSharp Architecture Framework has no concept of aspect and no concept of aspect target, therefore the number of types is computed differently. Instead, what is limited is the number of types for which you can call APIs like ReflectionSearch or ISyntaxReflectionService.

Limitations of PostSharp Diagnostics

There is no limit on the number of types to which you can apply aspects of the PostSharp.Patterns.Diagnostics namespace. However, when using PostSharp Essentials, your application will emit log records only one day after it has been built. After this period, your application will still work normally, but log records will no longer be emitted.

See Licensing of PostSharp Diagnostics for details.

Enforcement of the solution-level limit

The limitation of 50 types per solution is implemented not by looking at the sln file, but by counting the number of classes in all assemblies that are referenced by the current assembly. That is, the limit is actually 50 types in the whole assembly closure.

Diagnosing licensing issues

If you don't understand why PostSharp is requiring a commercial license, you can generate a licensing diagnostic log by building your project with the following command line:

Copy
msbuild /v:detailed /p:PostSharpTrace=Licensing > msbuild.log


Sharing Source Code With Unlicensed Teams

You only need a license if you create or modify code using PostSharp. If you only build code that is using PostSharp, you don't need to purchase a license.

PostSharp can determine whether you modify the code or just build it by looking at your source control repository. If your working copy has modifications against your base commit in your source control repository, PostSharp will consider that you are creating or modifying the code yourself, and will require a valid license.

By default, checking the modifications in the source control is disabled for performance reasons. It means that by default PostSharp always requires a valid license during the build. You can enable source control checking by editing the PostSharp Configuration File for your project or solution (see Working with PostSharp Configuration Files).

To enable source code sharing with unlicensed teams:

  1. Open the file postsharp.config that is located in the root directory of your solution or project. If the file doesn't exist then create a new postsharp.config file in that location with the following content:

    Copy
    <?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.postsharp.org/1.0/configuration">
</Project>

  2. Add a Property element under the Project element, set the Name attribute to VcsCheckEnabled and the Value attribute to True.

    Copy
    <?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.postsharp.org/1.0/configuration">
    <Property Name="VcsCheckEnabled" Value="True" />
</Project>
Note Note

The following source control systems are supported: Git and TFS. If you are not using any of these systems, PostSharp will always require a license at build time.

Caution note Caution

When building unmodified source code without a commercial license, PostSharp Diagnostics Developer Edition and limitations to PostSharp Diagnostics features will apply to your build. See Licensing of PostSharp Diagnostics for details.


Installing and Servicing PostSharp License Server

This topic covers PostSharp License Server from the point of view of the system administrator and license administrator.

We designed our license server to help our customers, not to enforce our license agreements. The application is open-source, it uses a clear SQL database and provides the ability to workaround issues by canceling leases or purging tables.

This topic contains the following sections:

  • System Requirements
  • Installing PostSharp License Server
  • Installing a license key
  • Testing the license server
  • Displaying license usage
  • Canceling leases
  • Maintenance
System Requirements

PostSharp License Server is an ASP.NET 4.5 application backed by a Microsoft SQL database.

It requires:

  • Windows Server 2003 or later with Internet Information Services installed.

  • Microsoft SQL Server 2005 or later (any edition, including the Express edition).

If the license server can be configured with a sufficiently long lease renewal period, there is no need to deploy the application and its database in high-availability conditions. You need to plan that the amount of time between the lease renewal and the lease end is larger than the longest expected outage. Frequent backups are not critical unless usage information is required for accounting purposes in case of pay-as-you-use licenses, where the Export Logs feature is required.

Caution note Caution

Deploying the ASP.NET application to several machines is not supported because the lease algorithm uses application locking instead of database locking.

Installing PostSharp License Server

The setup procedure is simple but must be performed manually.

To install PostSharp License Server, you will need administrative access on a Windows Server machine and the permission to create a new database.

To install PostSharp License Server:

  1. Download the latest version of PostSharp License Server from GitHub.

    Note Note

    It is not necessary that the version of PostSharp License Server exactly matches the version of PostSharp. You do not have to upgrade PostSharp License Server as long as the license keys you want to use are compatible with the server version.

  2. Using Internet Information Services (IIS) Manager, configure a new web application whose root is the folder containing the file web.config.

  3. The application pool should be configured to use ASP.NET 4.5.

  4. Configure the authentication mode of the web application: disable Anonymous Authentication, and enable Windows Authentication.

  5. Create an MS SQL database (the free MS SQL Express server is supported).

  6. Execute the script CreateTables.sql in the context of this database. The file is located in the zip archive of the license server.

  7. Set up the security on this database so that the user account under which the ASP.NET application pool is running (typically NETWORK SERVICE) can access the database.

  8. Edit the file web.config:

    1. configuration/connectionStrings: Correct the connection string (server name and database name) to match your settings.

    2. configuration/system.net/mailSettings: Set the name of the SMTP server used to send warning emails.

    3. configuration/applicationSettings: this section contains several settings that are documented inside the web.config file. The most important settings are the email addresses for shortage notifications and the duration of leases duration and renewal delay.

    4. configuration/system.web/authorization: Set up the security of the whole application to restrict the persons who are allowed to borrow a license. Optional.

    5. configuration/location[@path='Admin']/system.web/authorization: Specify who has access to the administrative interface of the application. Optional.

Installing a license key

Before developers can start using the license server, you need to install a license key.

To install a license key into the license server:

  1. Open the home page of the license server using a web browser.

  2. Click on the link Install a new license.

  3. Paste the license key and click on button Add.

    License Server 1
Testing the license server

If you have installed the license server at the address http://localhost/PostSharpLicenseServer, you can test it opening the URL http://localhost/PostSharpLicenseServer/Lease.ashx?product=PostSharp30&user=me&machine=other using Firefox or Chrome. If the license acquisition was successful, the browser will display the license key and the duration of the lease. You can also then see the resulting allocation on the home page http://localhost/PostSharpLicenseServer, and cancel the lease.

Displaying license usage

PostSharp License Server makes it easy to know how many people are currently using the product, and to display historical data.

Overview of installed license keys and current number of leases
License Server 2

Detail of leases
License Server 3

History of license usage. The figure demonstrates a 30-day, +30% grace period.
License Server 4
Canceling leases

You can cancel a lease from the lease list by clicking on the Cancel hyperlink. Note that canceling a lease on the server does not cancel the lease on the client. It is not possible to cancel leases on the client.

Maintenance

The license server is designed to keep a history of all leases. Therefore, it can grow indefinitely, depending on the number of users and lease duration. It is safe to delete all records from the Lease table at any time unless these records are necessary for accounting purposes.

Using SQL Agent, you can schedule a job that purges old records of the Lease table:

Copy
DELETE FROM [dbo].[Leases] WHERE EndTime < DATEADD( day, -90, GETDATE() );


Using PostSharp License Server

If the license audit is not acceptable in your company for regulatory or other reasons, you can consider using the PostSharp License Server.

PostSharp License Server is a server application that customers can install into on their own premises to measure the number of concurrent users of PostSharp. The application is based on ASP.NET and Microsoft SQL Server.

This topic contains the following sections:

  • Disclaimer
  • Design Principles
  • Subscribing to the license server
  • Installing the license settings in your source control

If you are a system administrator or license administrator, see also Installing and Servicing PostSharp License Server.

Disclaimer

Using the license server is optional. Only a few enterprise customers chose to use it. Alternative approaches are:

  • To rely on the default license audit mechanism (see License Audit for details).

  • To acquire enough licenses for the whole team with some reserve margin.

  • To use a spreadsheet to keep track of who is using the software.

  • To use other software audit products, although this approach is imperfect because PostSharp is not installed on the developer's machine as a standalone and indentifiable application.

Design Principles

The license server manages leases of a license to a given user on a given machine (the “client”). Once the lease is provided to the client, it is cached on the client. Upon client request, the server will return a license key and two dates: the lease end date and the lease renewal date. The lengths of the lease and of the renewal period are configurable. The client will not contact the license server before the renewal date, so the client can go offline during the duration of the lease. Then, a new lease will be reserved for the client. If the client is not able to renew its lease from the server after the lease renewal date, the client will still be able to use PostSharp until the end of the lease. Then, the use of PostSharp will be prevented. To avoid loss of productivity due to lack of network connection or server outages, we recommend setting a large delay between the lease renewal period and the lease period.

If the number of concurrent users exceeds the licensed number, the license administrator will receive an email, and additional users will be allowed during a grace period. At the end of the grace period, only the licensed number of concurrent users will be allowed. The duration of the grace period and the number of excess users depend on the kind of license. By default, it is set to 30% of users and 30 days.

Important note Important

If you have subscribed to a license server, you will need periodic connections to the company network. The licensing client will automatically try to renew a lease when it comes close to expiration and if the license server is available. Lease duration and renewal settings can be configured by the administrator of the license server. A connection to the license server is not necessary while the lease is valid.

Subscribing to the license server

If your company uses PostSharp License Server, you can register using a similar procedure as for registering a license key:

To subscribe to a license server using the user interface:

  1. Open Visual Studio.

  2. Click on menu PostSharp, then Options.

  3. Open the License option page.

  4. Click on the Subscribe to a license server link.

    License Server 5

  5. Paste the URL of the license server. You can click on the Open hyperlink to verify that the URL is correct and that you have access to it. Click Next.

    License Server 6

  6. Read the license agreement and check the option I accept. Click on Next.

    License Server 7
    Tip Tip

    If you are registering the license server on a build server, also check the option Register the license for all accounts on this machine.

  7. You are done.

    License Server 8
Installing the license settings in your source control

It is possible to subscribe to the license server using a file stored in your source control system by using the exact same mechanism as to register a license key.

To install license settings in your source control system:

  1. Create a file named postsharp.config in the root directory of your source repository, or in any parent directory of the Visual Studio project file (*.csproj or *.vbproj).

  2. Add the following content to the postsharp.config file:

    Copy
    <?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.postsharp.org/1.0/configuration" x:xmlns="http://schemas.postsharp.org/1.0/configuration">
  <License Value="http://server/path"/>
</Project>

    In this code, http://server/path must be replaced by the URL to the license server.

See Working with PostSharp Configuration Files for details about this configuration file.

See Also

Other Resources

Installing and Servicing PostSharp License Server


Configuration

For most use cases, PostSharp does not require any custom configuration. PostSharp gets its default configuration from three sources:

  • MSBuild integration. PostSharp gets most of its configuration settings directly from the parent MSBuild project.

  • NuGet integration. Some PostSharp plug-ins delivered as NuGet packages may modify PostSharp configuration files during installation.

  • PostSharp Tools. When adding aspects and policies from Visual Studio, PostSharp may automatically modify some configuration files.

Even if most configuration settings are correct by default, you may want to understand the configuration system to troubleshoot configuration and installation issues, or simply to implement more advanced configuration scenarios.

PostSharp can be configured using the Visual Studio user interface, by editing MSBuild project files, or by editing PostSharp configuration files.


Configuring Projects in Visual Studio

PostSharp accepts several configuration settings such as the version and processor architecture of the CLR that is used at build time, the search path of dependencies, and whether some features are enabled.

Although the default configuration is appropriate for most situations, you may have to fine-tune some of them to cope with particular cases.

Most common properties can be edited directly from Visual Studio using the PostSharp project property page.

This topic contains the following sections:

  • Opening PostSharp project properties tab
  • Understanding configuration settings
Opening PostSharp project properties tab

To open the PostSharp project property page in Visual Studio

  1. Open the Solution Explorer.

  2. Right-click on the project then select Properties at the bottom of the menu.

  3. Select the PostSharp tab.

The PostSharp property page in the Visual Studio project properties dialog.
Project Property Page
Understanding configuration settings

Note that all settings are dependent on the selected project configuration (for instance Debug) and platform (for instance Any CPU).

Setting | Description
Disable PostSharp | True if PostSharp should not execute in for the selected configuration and platform, otherwise False. This setting maps to the MSBuild property SkipPostSharp.
Additional search path | A semicolon-separated list of directories where plug-ins and libraries have to be searched for. This property can reference other MSBuild properties, for instance: ..\MyWeaver\bin\$(Configuration). All project references are already added to the search path by default. This setting maps to the MSBuild property PostSharpSearchPath.
Additional properties | A semicolon-separated list of property definition, for instance: Name1=Value1;Name2=Value2. This property can reference other MSBuild properties, for instance: RootNamespace=$(RootNamespace). Several properties are defined by default; for details, see Well-Known PostSharp Properties. This setting maps to the MSBuild property PostSharpProperties
Suppress warnings | A semicolon-separated list of warning identifiers that must be ignored, or * if all warnings have to be ignored. This setting maps to the MSBuild property PostSharpDisabledMessages.
Treat warnings as errors | A semicolon-separated list of warning identifiers that must be escalated into errors, or * if all warnings must be treated as errors. This setting maps to the MSBuild property PostSharpEscalatedMessages.
Architecture Validation | Enabled if constraints must be validated, otherwise Disabled. The default value is Enabled. For details regarding architecture validation, see Validating Architecture.
CLR Version | The version of the CLR that hosts PostSharp. PostSharp currently only supports the CLR 4.0 so this setting is disabled. This setting maps to the MSBuild property PostSharpTargetFrameworkVersion.
Processor Architecture | The processor architecture (x86 or x64) of the process hosting PostSharp. Since PostSharp needs to execute the current project during the build, the processor architecture of the PostSharp process must be compatible with the target platform of the current project. The default value is x86, or x64 if the target platform of the current project is x64. This setting maps to the MSBuild property PostSharpTargetProcessor.
Build Host | The kind of process hosting PostSharp, which influences the assembly loading mechanism, compatibility and performance features. This setting maps to the MSBuild property PostSharpHost. For details, see Configuring Projects Using MSBuild.
Optimization Mode | When set to Build Time, PostSharp will use a faster algorithm to generate the final assembly. When set to Size, PostSharp will use a slower algorithm that generates smaller assemblies. The default value is Build Time by default, or Size when the C# or VB compiler is set to generate optimal code (typically, in release builds). This settings maps to the MSBuild property PostSharpOptimizationMode.


Configuring Projects Using MSBuild

Most configuration settings of PostSharp can be set as MSBuild properties.

Note Note

The integration of PostSharp with MSBuild is implemented in files PostSharp.tasks and PostSharp.targets. These files define some properties and items that are not documented here. They are considered implementation details and may change without notice.

This topic contains the following sections:

  • Setting MSBuild properties with a text editor
  • Configuring several projects at a time
  • Setting MSBuild properties from the command line
  • List of properties
Setting MSBuild properties with a text editor

To set a property that persistently applies to a specific project, but not to the whole solution, the best solution is to define it directly inside the C# or VB project file (*.csproj or *.vbproj, respectively) using a text editor.

Adding a project-level MSBuild property using Visual Studio

  1. Open the Solution Explorer, right-click on the project name, click on Unload project, then right-click again on the same project and click on Edit.

  2. Insert the following XML fragment just before the <Import /> elements:

    Copy
    <PropertyGroup>
    <PropertyName>PropertyValue</PropertyName>
</PropertyGroup>

    See Configuring Projects Using MSBuild for the list of MSBuild properties used by PostSharp.

  3. Save the file. If the project was open in Visual Studio, go to the Solution Explorer, right-click on the project name, then click on Reload project.

Note Note

For more information regarding MSBuild properties, see MSDN Documentation.

Configuring several projects at a time

Instead of editing every project file, you can define shared settings in a file named PostSharp.Custom.targets and store in the same directory as the project file or in any parent directory of the parent file (up to 7 levels from the project directory).

Files PostSharp.Custom.targets are loaded from the root directory to the project directory, so that files that are closer to the project directory are loaded after and override files in parent directories.

Thanks to this mechanism, it is possible to define settings that apply to a large set of projects and control the grain of settings.

Files PostSharp.Custom.targets are normal MSBuild project or targets files; they should have the following content:

Copy
<? xml version="1.0" encoding="utf-8" ?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <PropertyName>PropertyValue</PropertyName>
  </PropertyGroup>
</Project>

See Configuring Projects Using MSBuild for the list of MSBuild properties used by PostSharp.

Note Note

For more information regarding MSBuild project files, see MSDN Documentation.

Setting MSBuild properties from the command line

When an MSBuild property does not need to be set permanently, it is convenient to set is from the command prompt by appending the flag /p:PropertyName=PropertyValue to the command line of msbuild.exe, for instance:

Copy
msbuild.exe /p:PostSharpHost=Native
List of properties

General Properties

The following properties are most commonly overwritten. They can also be edited in Visual Studio using the PostSharp project property page.

Property Name | Description
PostSharpSearchPath | A semicolon-separated list of directories added to the PostSharp search path. PostSharp will probe these directories when looking for an assembly or an add-in. Note that several directories are automatically added to the search path: the .NET Framework reference directory, the directories containing the dependencies of your project and the directories added to the reference path of your project (tab Reference Path in the Visual Studio project properties dialog box).
SkipPostSharp | True if PostSharp should not be executed.
PostSharpOptimizationMode | When set to OptimizeForBuildTime, PostSharp will use a faster algorithm to generate the final assembly. The other possible value is OptimizeForSize. The default value of the PostSharpOptimizationMode property is OptimizeForBuildTime by default and OptimizeForSize when the C# or VB compiler is set to generate optimal code (typically, in release builds).
PostSharpDisabledMessages | Comma-separated list of warnings and messages that should be ignored.
PostSharpEscalatedMessages | Comma-separated list of warnings that should be escalated to errors. Use * to escalate all warnings.
PostSharpLicense | License key or URL of the license server.
PostSharpProperties | Additional properties passed to the PostSharp project, in format Name1=Value1;Name2=Value2. See Well-Known PostSharp Properties.
PostSharpConstraintVerificationEnabled | Determines whether verification of architecture constraints is enabled. The default value is True.

Hosting Properties

Because PostSharp not only reads but also executes the assemblies it transforms, it must run under the proper version and processor architecture of the CLR. Additionally, for each version and processor architecture. The following properties allow influencing the choice of the PostSharp host process.

Property Name

Description

PostSharpTargetFrameworkVersion

Version of the CLR that hosts the PostSharp process. The only valid value is 4.0.

PostSharpTargetProcessor

Processor architecture of the PostSharp hosting process. Valid values are x86 and x64. Since PostSharp needs to execute the current project during the build, the processor architecture of the PostSharp process must be compatible with the target platform of the current project. The default value is x86, or x64 if the target platform of the current project is x64.

PostSharpHost

Kind of process hosting PostSharp. This setting is usually changed for troubleshooting only. The following values are supported:

  • PipeServer means that PostSharp will run as a background process invoked synchronously from MSBuild. Using the pipe server results in lower build time, since PostSharp would otherwise have to be started every time a project is built. The pipe server uses native code and the CLR Hosting API to control the way assemblies are loaded in application domains; the assembly loading algorithm is generally more accurate and predictable than with the managed host.

  • Native uses the same native code as the pipe server, but the process runs synchronously and terminates immediately after an assembly has been processed. For this reason, it does not have the same build-time performance as the pipe server, but it has exactly the same assembly loading algorithm and is useful for diagnostics.

  • Managed is a purely managed application. The assembly loading algorithm may be less reliable in some situations because PostSharp has less control over it. Note that this host is no longer being tested and officially supported.

PostSharpBuild

Build configuration of PostSharp. Valid values are Release, Diag and Debug. Only the Release build is distributed in the normal PostSharp packages.

PostSharpHostConfigurationFile

A semicolon-separated list of configuration files containing assembly binding redirections that should be taken into account by the PostSharp hosting process, such as app.config or web.config.

Diagnostic Properties

Property Name | Description
PostSharpAttachDebugger | If this property is set to True, PostSharp will break before starting execution, allowing you to attach a debugger to the PostSharp process. The default value is False. For details, see Debugging Build-Time Logic.
PostSharpTrace | A semicolon-separated list of trace categories to be enabled. The property is effective only when PostSharp runs in diagnostic mode (see property PostSharpBuild here above). Additionally, the MSBuild verbosity should be set to detailed at least. For details, see Debugging Build-Time Logic.
PostSharpUpdateCheckDisabled | True if the periodic update check mechanism should be disabled, False otherwise.
PostSharpExpectedMessages | A semicolon-separated list of codes of expected messages. PostSharp will return a failure code if any expected message was not emitted. This property is used in unit tests of aspects, to ensure that the application of an aspect results in the expected error message.
PostSharpIgnoreError | If this property is set to True, the PostSharp MSBuild task will succeed even if PostSharp returns an error code, allowing the build process to continue. The project or targets file can check the value of the ExitCode output property of the PostSharp MSBuild task to take action.
PostSharpFailOnUnexpectedMessage | This property should be used jointly with PostSharpExpectedMessages. If it set to True, PostSharp will fail if any unexpected message was emitted, even if this message was not an error. This property is used in unit tests of aspects, to ensure that the application of an aspect did not result in other messages than expected.

Other Properties

Property Name | Description
PostSharpProject | Location of the PostSharp project (*.psproj) to be executed by PostSharp, or the string None to specify that PostSharp should not be invoked. If this property is defined, the standard detection mechanism based on references to the PostSharp.dll is disabled.
PostSharpUseHardLink | Use hard links instead of file copies when creating the snapshot for Visual Studio Code Analysis (FxCop). This property is True by default.
ExecuteCodeAnalysisOnPostSharpOutput | When set to True, executes Microsoft Code Analysis on the output of PostSharp. By default, the analysis is done on the input of PostSharp, i.e. on the output of the compiler. This property has no effect when Microsoft Code Analysis is disabled for the current build.
PostSharpCopyCodeAnalysisDependenciesDisabled | When set to True, PostSharp will not copy the all dependencies of the current project output into the obj\Debug\Before-PostSharp directory, which contains the copy of the assembly on which Microsoft Code Analysis is executed by default. This property has no effect when Microsoft Code Analysis is disabled for the current build or when the ExecuteCodeAnalysisOnPostSharpOutput property has been set to True.


Working with PostSharp Configuration Files

PostSharp is designed as a modular post-compilation platform, whose functionality can be extended using plug-ins. For instance, the Diagnostics Pattern Library is implemented as a plug-in. Although writing custom plug-ins is out of the scope of this documentation, you should be able, as a PostSharp user, to understand how plug-ins can be added to a project and how they can be configured.

This topic contains the following sections:

  • PostSharp configuration files
  • Sharing configuration between projects
  • Order of processing of configuration files
PostSharp configuration files

The configuration system of PostSharp is based on configuration files.

By default, if you have a project named MyProject.csproj, PostSharp will try to load, from the same directory, a configuration file, named MyProject.psproj. Configuration file is optional. Most projects don't need it.

See Configuration File Schema Reference for details about the format of this file.

For instance, the following code is the configuration file of a project using two plug-ins:

Copy
<Project xmlns="http://schemas.postsharp.org/1.0/configuration">

  <Property Name="LoggingBackend" Value="nlog" />

  <Using File="..\..\Build\bin\{$Configuration}\PostSharp.Patterns.Diagnostics.Weaver.dll"/>
  <Using File="..\..\Build\bin\{$Configuration}\PostSharp.Patterns.Diagnostics.Weaver.NLog.dll"/>

  <Multicast>
    <LogAttribute xmlns="clr-namespace:PostSharp.Patterns.Diagnostics;assembly:PostSharp.Patterns.Diagnostics"
                  AttributeTargetTypes="PostSharp.Patterns.Diagnostics.Tests.NLog.Person" />
  </Multicast>

</Project>

The principal use cases for end-users are the following:

  • Adding license keys. See the License configuration element for details.

  • Configuring properties. See the Property configuration element for details.

  • Including a plug-in. See the Using configuration element for details.

  • Adding aspects or constraints without modifying your source code. See Adding Aspects Using XML for details.

  • Editing logging profiles. See Configuration File Schema Reference and [logging-profiles] for details.

Sharing configuration between projects

You will often want to share some configuration settings between several projects. A typical example is to add the license key to all projects of your source code repository.

This can be achieved by adding a well-known configuration file to your source tree, or thanks to the Using configuration element.

Well-known configuration files

PostSharp will automatically load a few well-known configuration files if they are present on the file system, in the following order:

  1. Any file named postsharp.config located in the directory containing the MSBuild project file (csproj or vbproj, typically), or in any parent directory, up to the root. These files are loaded in ascending order, i.e. up from the root directory to the project directory.

  2. Any file named MySolution.pssln located in the same directory as the solution file MySolution.sln .

  3. Any file named MyProject.psproj located in the same directory as the project file MyProject.csproj or MyProject.vbproj .

For instance, the files may be loaded in the following order:

  1. c:\src\BlueGray\postsharp.config

  2. c:\src\BlueGray\FrontEnd\postsharp.config

  3. c:\src\BlueGray\FrontEnd\BlueGray.FrontEnd.Web\postsharp.config

  4. c:\src\BlueGray\Solutions\BlueGray.pssln assuming that the current solution file is c:\src\BlueGray\Solutions\BlueGray.sln.

  5. c:\src\BlueGray\FrontEnd\BlueGray.FrontEnd.Web\BlueGray.FrontEnd.Web.psproj assuming that the current project file is c:\src\BlueGray\Solutions\BlueGray.sln.

Explicit configuration sharing

The second technique to share a configuration file among several projects is to use the Using configuration element to import a configuration file into another configuration file.

Order of processing of configuration files

Elements of configuration files are processed in the following order:

  1. License elements are loaded.

  2. Property elements are loaded. Properties are evaluated at this moment unless they are marked for deferred evaluation.

  3. SearchPath elements are loaded.

  4. Using elements are loaded and referenced plug-ins and configuration files are immediately loaded.

  5. SectionType elements are loaded.

  6. Service elements are loaded, but they are not yet instantiated.

  7. Extension elements are loaded, but they are not evaluated at this moment.

  8. Finally, services and other tasks are instantiated and the project is executed.


Configuration File Schema Reference

The basic format of a PostSharp configuration file is as follows:

Copy
<Project xmlns="http://schemas.postsharp.org/1.0/configuration" xmlns:x="http://schemas.postsharp.org/1.0/configuration">

  <!-- The following elements must appear in the proper order. -->

  <License Value="[<license-key>|<url>](;[<license-key>|<url>])*"/>

  <Property Name="<string>" Value="<expression:string>" Overwrite="[true|false]" Sealed="[true|false]" Deferred="[true|false]" Condition="<expression:bool>" />

  <SearchPath Path="<expression:string>(;<expression:string>)*" ReferenceDirectory="<expression:string>" PathKind="[File|Directory]" Condition="<expression:bool>" />

  <Using File="<expression:string>" ProjectName="<expression:string>" Condition="<expression:bool>" />

  <SectionType LocalName="<string>" Namespace="<string>" />

  <Service TypeName="<string>" AssemblyFile="<string>" Condition="<expression:bool>" />

  <!-- The rest of the file contains extension elements defined using <SectionType /> elements.
       PostSharp itself defines the following extension elements: -->

  <Multicast>
    <MyMulticastAspect MyAttributeName="<value>" xmlns="clr-namespace:<namespace>;assembly:<assembly>" x:Condition="<expression:bool>" />
  </Multicast>

  <LoggingProfiles xmlns="clr-namespace:PostSharp.Patterns.Diagnostics;assembly:PostSharp.Patterns.Diagnostics" x:Condition="<expression:bool>">
    <LoggingProfile
                Name="<string>"
                OnEntryLevel="<LogLevel>"
                OnSuccessLevel="<LogLevel>"
                OnExceptionLevel="<LogLevel>"
                OnEntryOptions="<LogOptions>"
                OnSuccessOptions="<LogOptions>"
                OnSuccessOptions="<LogOptions>"/>
  </LoggingProfiles>

</Project>
Schema elements

The configuration file includes these elements, described in detail in subsequent sections in this topic:

Project

License

SearchPath

Using

SectionType

Property

Service

Multicast

Project

This element is the root of the configuration file.

License

This element allows loading one or more license keys.

Attribute | Type | Description
Value | string | Required. A semicolon-separated list of license keys, or an URL to the license server.
SearchPath

This element adds a file or a directory to the list of paths in which PostSharp searches for assemblies and plug-ins.

Attribute | Type | Description
Path | string expression | Required. A semicolon-separated list of files or directories that must be added to the path.
PathKind | File or Directory | Optional. Specifies the kind of items contained in the Path property. If this property is not specified, the item kind is automatically determined for each individual item of the Path property.
ReferenceDirectory | string expression | Optional. The directory from which relative paths in the Path property.
Condition | boolean expression | Optional. true if the element is considered, false if it must be ignored.
Using

This element imports another configuration file into the current project.

Attribute | Type | Description
File | string expression | Required. Name of the file to be imported. Unless the name is qualified by a relative or absolute path, the file will be searched for using the search path. In this case, a file with extension psplugin or dll will be searched.
ProjectName | string | Optional. In case that a single dll includes several configurations, specifies which configuration should be loaded.
Condition | boolean expression | Optional. true if the element is considered, false if it must be ignored.
SectionType

This element defines custom sections for the current project. Custom sections can appear under the Project element under all system-defined elements.

Attribute | Type | Description
LocalName | string | Required. The local name of the XML element representing the custom section.
Namespace | string | Required. The namespace of the XML element representing the custom section.
Property

This element defines a property for the current project.

Attribute | Type | Description
Name | string | Required. The property name.
Value | string expression | Required. The value that is assigned to the property.
Overwrite | boolean | Optional. true if the element will overwrite any previously-defined property of the same name, otherwise false. The default value is true.
Sealed | boolean | Optional. true if an attempt to overwrite this property should result in an error, otherwise false. The default value is false.
Deferred | boolean | Optional. true if the expression in the Value attribute should be dynamically evaluated every time the property value is requested, or false if the expression should be set at the time the property is defined. The default value is false.
Condition | boolean expression | Optional. true if the element is considered, false if it must be ignored.
Service

This element registers a service to the service locator for the current project.

Attribute | Type | Description
TypeName | string | Required. The full type name implementing the service. This class must have a public parameterless constructor and implement the IService interface.
AssemblyFile | string expression | Optional. The path of the assembly defining the service class. If the attribute is not provided, the type will be searched for in the assembly being currently processed by PostSharp.
Condition | boolean expression | Optional. true if the element is considered, false if it must be ignored.
Multicast

This element can be used to add aspects, policies or constraints to a project without adding the C# project as custom attributes. Adding elements to this section is equivalent to adding them to source code at assembly level.

The Multicast section is convenient to add aspect to several projects from a single file.

For details regarding this section, see Including CLR Objects in Configuration.


Well-Known PostSharp Properties

The following table lists the PostSharp properties that may be set from the MSBuild project. The second column specifies the name of the MSBuild property that influences the value of the PostSharp property, if any.

Property Name | MSBuild Property Name | Description
Configuration | Configuration | Build configuration (typically Debug or Release).
Platform | Platform | Target processor architecture (typically AnyCPU, x86 or x64).
MSBuildProjectFullPath | MSBuildProjectFullPath | Full path of the C# or VB project being built.
IgnoredAssemblies |  | Comma-separated list of assembly short names (without extension) that should be ignored by the dependency scanning algorithm. Add an assembly to this list if it is obfuscated, or contains native code, and causes PostSharp to fail.
ReferenceDirectory | MSBuildProjectDirectory | Directory with respect to which relative paths are resolved.
SearchPath | PostSharpSearchPath | Comma-separated list of directories containing reference assemblies and plug-ins.
TargetFrameworkIdentifier | TargetFrameworkIdentifier | Identifier of the target framework of the current project (i.e. the framework on which the application will run). For instance .NETFramework or Silverlight.
TargetFrameworkVersion | TargetFrameworkVersion | Version of the target framework of the current project (i.e. the framework on which the application will run). For instance v4.0.
TargetFrameworkProfile | TargetFrameworkProfile | Profile of the target framework of the current project (i.e. the framework on which the application will run). For instance WindowsPhone.

Other properties are recognized but are of little interest for end-users. For a complete list of properties, see PostSharp.targets.

Using custom properties

By defining your own PostSharp properties, you can pass information from the build environment to aspects, or to any code running in PostSharp. Custom PostSharp properties behave exactly as other PostSharp properties, so they can be defined and read using the same procedures.


Including CLR Objects in Configuration

PostSharp includes a basic facility to describe CLR objects using XML. This facility is used to implement the Multicast and LoggingProfiles sections of the configuration file, and can be used to define custom sections.

The facility is consciously limited in features. It was only designed to provide the same features as custom attributes in programming languages.

This topic contains the following sections:

  • Basic rules
  • Formatting of attributes
  • Specific rules for the Multicast section
Basic rules

The basic rules apply to XML serialized objects:

  • The local name of the XML element must exactly match the type name of the CLR type. An exception to this rule is that the Attribute prefix can be omitted.

  • The XML namespace of the element must be in the form clr-namespace:namespace;assembly:assembly where namespace is the namespace of the CLR type and assembly is the name of the assembly declaring the type.

  • The type must have a public parameterless constructor.

  • Names of XML attributes must exactly match the name of a public field or property of the CLR type.

Formatting of attributes

Values of XML attributes, mapping to CLR fields and properties, must be formatted according to the rule relevant for each type:

Type | Formatting
Intrinsics | An intrinsic is any of the following types: bool, char, sbyte, byte, short, ushort, int, uint, long, ulong, float, double or string. Conversion is done using the Convert class.
Arrays | A semicolon-separated list of elements.
Enumerations | A list of enumeration member names separated by characters | or +. Names in the list are combined using the + operator.
Types | An assembly-qualified type name.
Object | Fields and properties of type Object are not supported.
Specific rules for the Multicast section

The following additional rules apply to the Multicast section of the configuration file:

  • The class must derive from MulticastAttribute.

  • The AttributePriority property may not be defined. This attribute is added automatically according to the order of the XML element in the section.


Using Expressions in Configuration Files

Many attributes of the configuration schema accept expressions, which are dynamically evaluated. Expressions in the PostSharp configuration system work similarly as in XSLT. Substrings enclosed by curled brackets, for instance {$property}, are interpreted as XPath expressions.

For instance, the following code contains two XPath expressions:

Copy
<Project xmlns="http://schemas.postsharp.org/1.0/configuration">
  <Property Name="LoggingEnabled" Value="{has-plugin('PostSharp.Patterns.Diagnostics')}" Deferred="true" />
  <Multicast>
    <When Condition="{$LoggingEnabled}">
      <d:Log  />
    </When>
  </Multicast>
</Project>

Please check the MSDN documentation for general information about XPath.

Note Note

In the context of PostSharp configuration files, XPath expressions cannot refer to XML elements or attributes, but only to variables, functions, operators and constants.

Accessing properties

PostSharp properties are mapped to XPath variables.

For instance, the expression {$LoggingEnabled} evaluates o the value of the LoggingEnabled property.

Using operators and functions

You can use any XPath function and operators.

Additionally to standard XPath 1.0 functions, PostSharp defines the following functions:

Function | Description
has-plugin(name) | Evaluates to true if the given plug-in is loaded, otherwise false.
environment(variable) | Returns the value of an environment variable.
Mixing expressions and literal strings

An attribute value can contain both text and expressions. This is illustrated in the following example:

Copy
<Project xmlns="http://schemas.postsharp.org/1.0/configuration">
  <Property Name="A" Value="A" />            <!-- Evaluates to A -->
  <Property Name="B" Value="B;{$A}" />       <!-- Evaluates to B;A -->
  <Property Name="C" Value="C;{$B};{$A}" />  <!-- Evaluates to C;B;A;A -->
</Project>


Accessing Configuration from Source Code

Even if most configuration settings are consumed by PostSharp or its add-in, it is sometimes useful to access configuration elements from user code. The PostSharp.dll library gives access to both configuration properties and extension configuration elements.

This topic contains the following sections:

  • Accessing properties
  • Accessing custom sections
Accessing properties

You can read the value of any PostSharp property by including it in an XPath expression and evaluating it using the EvaluateExpression(String) method of PostSharpEnvironmentCurrentProject:

C#
Copy
string value = PostSharpEnvironment.CurrentProject.EvaluateExpression("{$PropertyName}")

For details regarding expressions, see Using Expressions in Configuration Files.

Accessing custom sections

You can get a list of custom sections of a given name and namespace by calling the GetExtensionElements(String, String) method of PostSharpEnvironmentCurrentProject:

C#
Copy
IEnumerable<ProjectExtensionElement> elements =
     PostSharpEnvironment.CurrentProject.GetExtensionElements( "MyElement", "uri:MyNamespace" );

Extension elements must be declared using the SectionType element.

See Also

Other Resources

Using Expressions in Configuration Files
Working with PostSharp Configuration Files


Working with Errors, Warnings, and Messages

As any compiler, PostSharp can emit messages, warnings, and errors, commonly referred to as message. Custom code running at build time (typically the implementation of CompileTimeValidate or of a custom constraint) can use PostSharp messaging facility to emit their own messages.

In this section:

  • Ignoring and Escalating Warnings

  • Emitting Errors, Warnings, and Messages.

Tip Tip

PostSharp 2.1 contains an experimental feature that adds file and line information to errors and warnings. The feature requires Visual Studio. In must be enabled manually in the PostSharp tab of Visual Studio options.


Ignoring and Escalating Warnings

As with conventional compilers, warnings emitted by PostSharp, as well as those emitted by custom code running at build time in PostSharp, can be ignored (in that case they will not be displayed) or escalated into errors.

Warnings can be ignored either globally, using a project-wide setting, or locally for a given element of code. Warnings can be escalated only globally.

Ignoring or escalating warnings globally

There are several ways to ignore or escalate a warning for a complete project:

  • In Visual Studio, in the PostSharp tab of the project properties dialog. See Configuration for details.

  • By defining the PostSharpDisabledMessages or PostSharpEscalatedMessages MSBuild properties. See Configuration and Configuring Projects Using MSBuild for details.

Note Note

The value * can be used to escalate all warnings into errors.

Ignoring warnings locally

Most warnings are related to a specific element of code. To disable a specific warning for a specific element of code, add the IgnoreWarningAttribute custom attribute to that element of code, or to any enclosing element of code (for instance, adding the attribute to a type will make it effective for all members of this type).

You can create your own custom attribute derived from IgnoreWarningAttribute and make it conditional to a compilation symbol by using the ConditionalAttribute custom attribute.


Emitting Errors, Warnings, and Messages

Custom code running in PostSharp at build time can use the messaging facility to emit its own messages, warnings, and errors. These messages will appear in the MSBuild output and/or in Visual Studio. User-emitted warnings can be ignored or escalated using the same mechanism as for system messages.

Emitting messages

If you just have a few messages to emit, you may simply use one of the overloads of the Write method of the Message class.

All messages must have a severity SeverityType, a message number (used as a reference when ignoring or escalating messages), and a message text. Additionally, and preferably, messages may have a location (MessageLocation).

Note Note

To benefit from the possibility to ignore messages locally, you should always use provide a relevant location with your messages. Previous API overloads, which did not require a message location, are considered obsolete.

Tip Tip

Do not use string.Format to format your messages. Instead, pass message arguments to the messaging facility, which will format some argument types, for instance reflection objects, in a more readable way.

Emitting messages using a message source

If you want the text of all messages to be stored in a single location, you have to emit messages through a MessageSource. Typically, you would create a singleton instance of MessageSource for each component, and associate each instance with a message dispenser. A message dispenser is a custom-written class implementing the IMessageDispenser interface. The MessageDispenser provides a convenient abstract implementation.

Note Note

Although it is tempting to use a ResourceManager as the backend of a message dispenser, comes with a non-negligible performance penalty because of the cost of instantiating the ResourceManager.


Resolution of assembly binding redirections

PostSharp executes your project assemblies at compile time. This is why PostSharp must follow assembly binding redirections at compile time. Although the default assembly redirection mechanism works fine in most cases, there may be situations where you will need to override it.

Note Note

To learn why PostSharp executes your project assemblies at compile time, see Understanding Aspect Lifetime and Scope.

Default assembly binding redirections

In order to follow the same assembly binding redirections as you application does at run time, PostSharp analyzes your projects and configuration files (typically app.config or web.config) and generates assembly binding redirection configuration. PostSharp stores the assembly binding redirection in a file named PostSharpHost.config and stored in the obj folder. You can review the PostSharpHost.config file to get an idea of what configuration PostSharp uses to resolve assemblies. For an empty ASP.NET MVC 5 application the PostSharpHost.config may look like this

Copy
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin.Security.OAuth" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>
Note Note

We didn't reinvent the wheel. Under the hood, PostSharp relies on the GenerateBindingRedirects MSBuild task.

Overriding default assembly redirections

In case the default mechanism does not work, you can disable it by setting the MSBuild property PostSharpDisableDefaultBindingRedirects to True in your project file:

Copy
<PropertyGroup>
  <PostSharpDisableDefaultBindingRedirects>True</PostSharpDisableDefaultBindingRedirects>
</PropertyGroup>

With this configuration PostSharp doesn’t analyze assembly binding redirections.

Caution note Caution

Do not set PostSharpDisableDefaultBindingRedirects to True unless you really have to. It may produce difficult to predict results.

Note Note

The default algorithm is always disabled for Windows Phone Silverlight projects because it does not work.

If you disable default binding redirections, you may want to specify a file with your own assembly binding redirection configuration

Copy
<PropertyGroup>
  <PostSharpDisableDefaultBindingRedirects>True</PostSharpDisableDefaultBindingRedirects>
  <PostSharpHostConfigurationFile>web.config</PostSharpHostConfigurationFile>
</PropertyGroup>

With this configuration PostSharp uses explicit assembly binding redirection configuration from the web.config file.


Adding Aspects to Code

An aspect has no effect until it is applied to some element of code. PostSharp provides multiple ways to add aspects to your code.

In this chapter
Section | Description
Adding Aspects Declaratively Using Attributes | This section shows how to add aspects to code using custom attributes and explains how you can target several declarations with a single line of code
Adding Aspects Using XML | This section shows how to add aspects without modifying your source code, by using an external configuration file.
Adding Aspects Programmatically using IAspectProvider | This section describes how to add aspects programmatically (by writing code that is executed at build-time) and overcome limitations of declarative approaches.


Adding Aspects Declaratively Using Attributes

In .NET, you normally need to write one line of code for any application of a target attribute. If a custom attribute applies to all types of a namespace, you have to manually add the custom attribute to every single type.

By contrast, multicast custom attributes allow you to apply a custom attribute on multiple declarations from a single line of code by using wildcards or regular expressions, or by filtering on some attributes. It makes it easy to apply an aspect to, say, all public static methods of a namespace, with a single line of code.

Multicast attributes can be inherited: you can put it on an interface and ask it to apply to all classes implementing this interface. Attribute inheritance also works for classes, virtual or interface methods, and parameters of virtual or interface methods.

Custom attributes supporting multicasting needs to be derived from MulticastAttribute. All PostSharp aspects and constraints are derived from this class.

Note Note

Multicasting of custom attribute is a feature of PostSharp. If you do not transform your assembly using PostSharp, multicast attributes will behave as plain old custom attributes.

Note Note

This documentation often refers to this as aspect multicasting and inheritance. This is not totally accurate. Although this feature has been developed to support aspects, you can use it for your own custom attributes, even if they are not aspects. To use multicasting and inheritance for custom attributes that are not aspects, simply derive the attribute class from MulticastAttribute instead of Attribute.

Attribute multicasting supports the following scenarios:

  • Adding Aspects to a Single Declaration

  • Adding Aspects to Multiple Declarations

  • Adding Aspects to Derived Classes and Methods

  • Overriding and Removing Aspect Instances

  • Reflecting Aspect Instances at Runtime

For a conceptual overview of this feature, see:

  • Understanding Attribute Multicasting

  • Understanding Aspect Inheritance

See Also

Reference

MulticastAttribute
MulticastAttributeUsageAttribute
IAspectProvider

Other Resources

Overriding and Removing Aspect Instances
Reflecting Aspect Instances at Runtime


Adding Aspects to a Single Declaration Using Attributes

Aspects in PostSharp are plain custom attributes. You can apply them to any element of code as usual.

In the following example, the Trace aspect is applied to two methods.

C#
Copy
public class CustomerService
 {
     [Trace]
     public Custom GetCustomer( int customerId )
     {
         // Details skipped.
     }

     [Trace]
     public void MergeCustomers( Customer customer1, Customer customer2 );
     {
         // Details skipped.
     }
 }


Adding Aspects to Multiple Declarations Using Attributes

Once have written an aspect we have to apply it to the application code so that it will be used. There are a number of ways to do this so let's take a look at one of them: custom attribute multicasting. Other ways include XML Multicasting (see the section Adding Aspects Using XML) and dynamic aspect providers (see more in the section Adding Aspects Programmatically using IAspectProvider).

This topic contains the following sections:

  • Applying to all members of a class
  • Applying an aspect to all types in a namespace
  • Excluding an aspect from some members
  • Filtering by class visibility
  • Filtering by method modifiers
  • Programmatic filtering
Applying to all members of a class

When we are trying to apply a method level aspect we can place an attribute to each of the methods.

C#
Copy
[OurLoggingAspect]
public class CustomerServices

As our codebase grows this approach becomes tedious. We need to remember to add the attribute to all of the methods on the class. If you have hundreds of classes, you may have thousands of methods you need to manually add the aspect attribute to. It's an unsustainable proposition. Thankfully, there is a way to make this easier. Instead of applying your aspect on each method you can add that attribute to the class and PostSharp will ensure that the aspect is applied to all of the methods on that class.

Applying an aspect to all types in a namespace

Even though we don't have to apply an aspect to all methods in all classes in our application, adding the aspect attribute to every class could still be an overwhelming task. If we want to apply our aspect in a broad stroke we can make use of PostSharp's MulticastAttribute.

The MulticastAttribute is a special attribute that will apply other attributes throughout your codebase. Here's how we would use it.

  1. Open the AssemblyInfo.cs, or create a new file GlobalAspects.cs if you prefer to keep things separate (the name of this file does not matter).

  2. Add an [assembly:] attribute that references the aspect you want to apply.

  3. Add the AttributeTargetTypes property to the aspect constructor and define the namespace that you would like the aspect applied to.

    C#
    Copy
    [assembly: OurLoggingAspect(AttributeTargetTypes="OurCompany.OurApplication.Controllers.*")]

This one line of code is the equivalent of adding the aspect attribute to every class in the desired namespace.

Note Note

When setting the AttributeTargetTypes you can use wildcards (*) to indicate that all sub-namespaces should have the aspect applied to them. It is also possible to indicate the targets of the aspect using regex. Add "regex:" as a prefix to the pattern you wish to use for matching.

Excluding an aspect from some members

Multicasting an attribute can apply the aspect with a very broad brush. It is possible to use AttributeExclude to restrict where the aspect is attached.

C#
Copy
[assembly: OurLoggingAspect(AttributeTargetTypes="OurCompany.OurApplication.Controllers.*", AttributePriority = 1)]
[assembly: OurLoggingAsepct(AttributeTargetMembers="Dispose", AttributeExclude = true, AttributePriority = 2)]

In the example above, the first multicast line indicates that the OurLoggingAspect should be attached to all methods in the Controllers namespace. The second multicast line indicates that the OurLoggingAspect should not be applied to any method named Dispose.

Note Note

Notice the AttributePriority property that is set in both of the multicast lines. Since there is no guarantee that the compiler will apply the attributes in the order you have specified in the code, it is necessary to declare an order to ensure processing is completed as desired.

In this case, the OurLoggingAspect will be applied to all methods in the Controllers namespace first. After that is completed, the second multicast of OurLoggingAspect is performed which then excludes the aspect from methods named Dispose.

See Overriding and Removing Aspect Instances for more details about excluding and overriding aspects.

Filtering by class visibility

Now that you've been able to apply our aspect to all classes in a namespace and its sub-namespaces, you may be faced with the need to restrict that broad stroke. For example, you may want to apply your aspect only to classes defined as being public.

  1. Add the AttributeTargetTypeAttributes property to the MulticastAttribute's constructor.

  2. Set the AttributeTargetTypeAttributes value to Public.

    C#
    Copy
    [assembly: OurLoggingAspect(AttributeTargetTypes="OurCompany.OurApplication.Controllers.*",
                            AttributeTargetTypeAttributes = MulticastAttributes.Public)]

By combining AttributeTargetTypeAttributes values you are able to create many combinations that are appropriate for your needs.

Note Note

When specifying attributes of target members or types, do not forget to provide all categories of flags, not only the category on which you want to put a restriction.

Filtering by method modifiers

Filtering at a class level may not be granular enough for your needs. Aspects can be attached at the method level and you will want to control filtering on these aspects as well. Let's look at an example of how to apply aspects only to methods marked as virtual.

  1. Add the AttributeTargetTypeAttributes property to the MulticastAttribute's constructor.

  2. Set the AttributeTargetTypeAttributes value to VirtualVirtual.

    C#
    Copy
    [assembly: OurLoggingAspect(AttributeTargetTypes="OurCompany.OurApplication.Controllers.*", AttributeTargetMemberAttributes = MulticastAttributes.Virtual)]

Using this technique you can apply a method level aspect, or stop it from being applied, based on the existence or non-existence of things like the static, abstract, and virtual keywords.

Programmatic filtering

There are situations where you will want to filter in a way that isn't based on class or method declarations. You may want to apply an aspect only if a class inherits from a specific class or implements a certain interface. There needs to be a way for you to accomplish this.

The easiest way is to override the CompileTimeValidate(Object) method of your aspect class, where you can perform your custom filtering. This is the opt-out approach. Have the CompileTimeValidate(Object) method return false without emitting any error, and the candidate target will be ignored. See the section Validating Aspect Usage for details.

The second approach is opt-in. See the section Adding Aspects Programmatically using IAspectProvider for details.

See Also

Reference

MulticastAttribute
AttributeTargetTypes
AttributeExclude
AttributePriority
AttributeTargetTypeAttributes
CompileTimeValidate(Object)
PersistMetaData

Other Resources

Validating Aspect Usage
Adding Aspects Programmatically using IAspectProvider
Adding Aspects Using XML


Understanding Attribute Multicasting

This topic contains the following sections:

  • Overview of the Multicasting Algorithm
  • Filtering Target Elements of Code
  • Filtering Properties
  • Overriding Filtering Attributes
Overview of the Multicasting Algorithm

Every multicast attribute class must be assigned a set of legitimate targets using the MulticastAttributeUsageAttribute custom attribute, which is the equivalent and complement of AttributeUsageAttribute for multicast attributes. Multicast attributes can be applied to types, methods, fields, properties, events, or/or parameters. For instance, a caching aspect targets methods. A field validation aspect targets fields.

When a field-level multicast attribute is applied to a type, the attribute is implicitly applied to all fields of that type. When it is applied to an assembly, it is implicitly applied to all fields of that assembly.

The general rule is: when a multicast attribute is applied to a container, it is implicitly (and recursively) applied to all elements of that container.

The next table illustrates how this rule translates for different kinds of targets.

Directly applied to | Implicitly applied to
Assembly or Module | Types, methods, fields, properties, parameters, and events contained in this assembly or module.
Type | Methods, fields, properties, parameters, and events contained in this type.
Property or Event | Accessors of this property or event.
Method | This method and the parameters of this method.
Field | This field.
Parameter | This parameter.
Filtering Target Elements of Code

Note that the default behavior is maximalist: we apply the attribute to all contained elements. However, PostSharp provides a way to restrict the set of elements to which the attribute is multicast: filtering.

Both the attribute developer and the user of the aspect can specify filters.

Developer-Specified Filtering

Just like normal custom attributes should be decorated with the [AttributeUsage] custom attribute, multicast custom attributes must be decorated by the [MulticastAttributeUsage] attribute (see MulticastAttributeUsageAttribute). It specifies which are the valid targets of the multicast attributes.

For instance, the following piece of code specifies that the attribute GuiThreadAttribute can be applied to instance methods. Aspect users experience a build-time error when trying to use this aspect on a constructor or static method.

C#
Copy
[MulticastAttributeUsage(MulticastTargets.Method, TargetMemberAttributes = MulticastAttributes.Instance)]
[AttributeUsage(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Method, AllowMultiple = true)]
[PSerializable]
public class GuiThreadAttribute : MethodInterceptionAspect
{
// Details skipped.
}

Note the presence of the AttributeUsageAttribute attribute in the sample above. It tells the C# or VB compiler that the attribute can be directly applied to assemblies, classes, constructors, or methods. But this aspect will never be eventually applied to an assembly or a class. Indeed, the MulticastAttributeUsageAttribute attribute specifies that the sole valid targets are methods. Furthermore, the TargetMemberAttributes property establishes a filter that includes only instance methods.

Therefore, if the aspect is applied to a type containing an abstract method, the aspect will not be multicast to this method, neither to its constructors.

Tip Tip

Additionally to multicast filtering, consider using programmatic validation of aspect usage. Any custom attribute can implement IValidableAnnotation to implement build-time validation of targets. Aspects that derive from Aspect already implement these interfaces: your aspect can override the method CompileTimeValidate(Object).

Tip Tip

As an aspect developer, you should enforce as many restrictions as necessary to ensure that your aspect is only used in the way you intended, and raise errors in other cases. Using an aspect in an unexpected way may result in runtime errors that are difficult to debug.

User-Specified Filtering

The attribute user can specify multicasting filters using specific properties of the MulticastAttribute class. To make it clear that these properties only impact the multicasting process, they have the prefix Attribute.

As an aspect user, it is important to understand that you can only apply aspects to elements of codes that have been allowed by the developer of the aspect.

For instance, the following element of code adds a tracing aspect to all public methods of a namespace:

C#
Copy
[assembly: Trace( AttributeTargetTypes="AdventureWorks.BusinessLayer.*", AttributeTargetMemberAttributes = MulticastAttributes.Public )]
Filtering Properties

The following table lists the filters available to users and developers of aspects:

MulticastAttribute Property | MulticastAttributeUsageAttribute Property | Description
AttributeTargetElements | ValidOn | Restricts the kinds of targets (assemblies, classes, value types, delegates, interfaces, properties, events, properties, methods, constructors, parameters) to which the attribute can be indirectly applied.
AttributeTargetAssemblies |  | Wildcard expression or regular expression specifying to which assemblies the attribute is multicast.
 | AllowExternalAssemblies | Determines whether the aspect can be applied to elements defined in a different assembly than the current one.
AttributeTargetTypes |  | Wildcard expression or regular expression filtering by name the type to which the attribute is applied, or the declaring type of the member to which the attribute is applied.
AttributeTargetTypeAttributes | TargetTypeAttributes | Restricts the visibility of the type to which the aspect is applied, or of the type declaring the member to which the aspect is applied.
AttributeTargetMembers |  | Wildcard expression or regular expression filtering by name the member to which the attribute is applied.
AttributeTargetMemberAttributes | TargetMemberAttributes | Restricts the attributes (visibility, virtuality, abstraction, literality, ...) of the member to which the aspect is applied.
AttributeTargetParameters |  | Wildcard expression or regular expression specifying to which parameter the attribute is multicast.
AttributeTargetParameterAttributes | TargetParameterAttributes | Restricts the attributes (in/out/ref) of the parameter to which the aspect is applied.
AttributeInheritance | Inheritance | Specifies whether the aspect is propagated along the lines of inheritance of the target interface, class, method, or parameter (see Understanding Aspect Inheritance).
Caution note Caution

Whenever possible, do not rely on naming conventions to apply aspects (properties AttributeTargetTypes, AttributeTargetMembers and AttributeTargetParameters). This may work perfectly today, and break tomorrow if someone renames an element of code without being aware of the aspect.

Overriding Filtering Attributes

Suppose we have two classes A and B, B being derived from A. Both A and B can be decorated with MulticastAttributeUsageAttribute. However, since B is derived from A, filters on B cannot be more permissive than filters on A.

In other words, the MulticastAttributeUsageAttribute custom attribute is inherited. It can be overwritten in derived classes, but derived class cannot enlarge the set of possible targets. They can only restrict it.

Similarly (and hopefully predictably), the aspect user is subject to the same rule: she can restrict the set of possible targets supported by the aspect, but cannot enlarge it.


Adding Aspects to Derived Classes and Methods Using Attributes

By default, aspects apply to the class or class member which your attribute has been applied to. However, PostSharp provides the ability to specify aspect inheritance which can allow your attributes to be inherited in derived classes. This feature, named aspect inheritance can be specified on types, methods, and parameters, but not on properties or events.

Note Note

PostSharp Framework or higher edition is required for aspect inheritance.

This topic contains the following sections:

  • Applying aspects to derived types
  • Setting inheritance on a per-usage basis
  • Applying aspects to overridden methods
  • Applying aspects to new methods of derived types
Applying aspects to derived types

One way to implement aspect inheritance is to add a MulticastAttributeUsageAttribute custom attribute to your aspect class. Aspects that apply to types are typically derived from TypeLevelAspect or InstanceLevelAspect.

The benefit of this approach is that the aspect will be automatically applied to all derived classes, eliminating the need to manually setup attributes in the derived classes. Moreover, this logic lives in one place.

The following steps describe how to enable aspect inheritance on existing aspect, derived from TypeLevelAspect, which applies a DataContractAttribute attribute to the base and all derived classes, and a DataMemberAttribute attribute to all properties of the base class and those of derived classes:

How to enable aspect inheritance on existing aspect:

  1. Create a TypeLevelAspect which implements IAspectProvider.

  2. Decorate AutoDataContractAttribute with the MulticastAttribute, and set the Inheritance to Strict. Note that MulticastInheritance.Strict and MulticastInheritance.Multicast have the same effect when applied to type-level aspects.

    C#
    Copy
    [MulticastAttributeUsage(Inheritance = MulticastInheritance.Strict)]
[PSerializable]
public sealed class AutoDataContractAttribute : TypeLevelAspect, IAspectProvider
{
   // Details skipped.
}

  3. Decorate your base class with AutoDataContractAttribute. The following snippet shows a base customer class and a derived customer class:

    C#
    Copy
    [AutoDataContractAttribute]
class Document
{
    public string Title { get; set; }
    public string Author { get; set; }
    public DateTime PublishedOn { get; set; }

}

class MultiPageArticle : Document
{
    public List<ArticlePage> Pages { get; set; }
}

When the attribute is applied to the base class, the DataContractAttribute and DataMemberAttribute attributes will be applied at compile time to both classes. If other derived classes were added, then these would be decorated automatically as well.

Setting inheritance on a per-usage basis

Specifying targets and attribute inheritance can also be done on a per-usage basis rather than hard-coding it into the custom attribute. In the following snippet, we’ve removed the MulticastAttributeUsageAttribute attribute from AutoDataContractAttribute:

C#
Copy
// [MulticastAttributeUsage(Inheritance = MulticastInheritance.Strict)]
[PSerializable]
public sealed class AutoDataContractAttribute : TypeLevelAspect, IAspectProvider
{
    // Details skipped.
}

Now the inheritance mode can be specified directly on the AutoDataContractAttribute instance by setting the AttributeInheritance property as shown here:

C#
Copy
[TraceMethodAttribute(AttributeInheritance = MulticastInheritance.Strict)]
class Document
{
    // Details skipped.
}
Applying aspects to overridden methods

The following example shows a custom attribute which when applied to a class, writes a message to the console window whenever a method enters and exits:

C#
Copy
[PSerializable]
public sealed class TraceMethodAttribute : OnMethodBoundaryAspect
{
    public override void OnEntry(MethodExecutionArgs args)
    {
        Console.WriteLine(string.Format("Entering {0}.{1}.", args.Method.DeclaringType.Name, args.Method.Name));
    }

    public override void OnExit(MethodExecutionArgs args)
    {
        Console.WriteLine(string.Format("Leaving {0}.{1}.", args.Method.DeclaringType.Name, args.Method.Name));
    }
}

Specifying inheritance is simply a matter of adding the MulticastAttributeUsageAttribute attribute and specifying the inheritance type, or to set the AttributeInheritance property on the custom attribute usage.

In the snippet below, we have added the TraceMethod aspect to a virtual method and used the AttributeInheritance property to require the aspect to be automatically applied to all overriding methods:

C#
Copy
class Document
{
    // Details skipped.

       // This method will be traced.
    [TraceMethodAttribute(AttributeInheritance = MulticastInheritance.Strict)]
    public virtual void RenderHtml(StringBuilder html)
    {
         html.AppendLine( this.Title );
       html.AppendLine( this.Author );
    }
}

class MultiPageArticle: Document
{

  // This method will be traced.
    public override void RenderHtml(StringBuilder html)
    {
      base.RenderHtml(html);
      foreach ( ArticlePage page in this.Pages )
      {
        page.RenderHtml( html );
      }
    }

  // This method will NOT be traced.
       public void RenderHtmlPage(StringBuilder html, int pageIndex )
       {
          html.AppendFormat ( “{0}, page {1}”, this.Title, pageIndex+1 );
          html.AppendLine();
          html.AppendLine( this.Author );

       }

   }

In this example, TraceMethodAttribute will output entry and exit messages for Document.RenderHtml method and MultiPageArcticle.RenderHtml method as shown here:

Copy
Entering MultiPageArcticle.RenderHtml
Entering Document.RenderHtml
Leaving Document.RenderHtml
Leaving MultiPageArcticle.RenderHtml
Note Note

Aspect inheritance works with virtual, abstract and interface methods and their parameters.

We would get the similar result by adding the TraceMethod attribute to the Document class. Indeed, by virtue of attribute multicasting (see section Adding Aspects to Multiple Declarations for more details), adding a method-level attribute to a class implicitly adds it to all method of this class.

C#
Copy
[TraceMethodAttribute(AttributeInheritance = MulticastInheritance.Strict)]
class Document
 {
     // All property getters and setters will be traced.
     public string Title { get; set; }
     public string Author { get; set; }
     public DateTime PublishedOn { get; set; }

        // This method will be traced.
     public virtual void RenderHtml(StringBuilder html)
     {
          html.AppendLine( this.Title );
        html.AppendLine( this.Author );
     }
 }

 class MultiPageArticle: Document
 {
    // Property getters and setters will NOT be traced.
    public List<ArticlePage> Pages { get; set; }

   // This method will be traced.
     public override void RenderHtml(StringBuilder html)
     {
       base.RenderHtml(html);
       foreach ( ArticlePage page in this.Pages )
       {
         page.RenderHtml( html );
       }
     }

   // This method will NOT be traced.
        public void RenderHtmlPage(StringBuilder html, int pageIndex )
        {
           html.AppendFormat ( “{0}, page {1}”, this.Title, pageIndex+1 );
           html.AppendLine();
           html.AppendLine( this.Author );

        }

    }

However, by adding the TraceMethod aspect to all methods of the Document type, we added it to property getters and setters, influencing the output:

C#
Copy
Entering MultiPageArcticle.RenderHtml
Entering Document.RenderHtml
Entering Document.get_Title
Leaving Document.get_Title
Entering Document.get_Author
Leaving Document.get_Author
Leaving Document.RenderHtml
Leaving MultiPageArcticle.RenderHtml
Applying aspects to new methods of derived types

In the previous section the TraceMethod attribute used Strict inheritance which means that if the base class is decorated with the attribute, it will only be applied to methods which are declared in the base class and overridden in the derived class.

By changing the inheritance mode to Multicast, we specify that the aspect should be also be applied to new methods of the derived class, i.e. not only methods that are overridden from the base class.

In the following snippet we’ve changed inheritance from Strict to Multicast:

C#
Copy
[TraceMethodAttribute(AttributeInheritance = MulticastInheritance.Multicast)]
class Document
 {
     // All property getters and setters will be traced.
     public string Title { get; set; }
     public string Author { get; set; }
     public DateTime PublishedOn { get; set; }

        // This method will be traced.
     public virtual void RenderHtml(StringBuilder html)
     {
          html.AppendLine( this.Title );
      html.AppendLine( this.Author );
     }
 }

 class MultiPageArticle: Document
 {
    // Property getters and setters will ALSO be traced.
    public List<ArticlePage> Pages { get; set; }

   // This method will be traced.
     public override void RenderHtml(StringBuilder html)
     {
       base.RenderHtml(html);
       foreach ( ArticlePage page in this.Pages )
       {
         page.RenderHtml( html );
       }
     }

   // This method will ALSO be traced.
        public void RenderHtmlPage(StringBuilder html, int pageIndex )
        {
           html.AppendFormat ( “{0}, page {1}”, this.Title, pageIndex+1 );
           html.AppendLine();
           html.AppendLine( this.Author );

        }

    }

With Strict inheritance in use, TraceMethodAttribute applied to Document was not applied to the RenderHtmlPage method and the Pages property. In other words, as the name suggests, Strict inheritance is strictly applying the attribute on base members and any derived members which are inherited. However, with Multicast inheritance, the aspect is also applied to the RenderHtmlPage method and the Pages property.

Strict inheritance evaluates multicasting and then inheritance, but Multicast inheritance evaluates inheritance and then multicasting.

See Also

Reference

MulticastAttributeUsageAttribute
TypeLevelAspect
InstanceLevelAspect
DataContractAttribute
DataMemberAttribute
IAspectProvider
MulticastAttribute
Inheritance

Other Resources

Adding Aspects to Multiple Declarations


Understanding Aspect Inheritance

This topic contains the following sections:

  • Lines of Inheritance
  • Strict and Multicast Inheritance
Lines of Inheritance

Aspect inheritance is supported on the following elements.

Aspect Applied On | Aspect Propagated To
Interface | Any class implementing this interface or any other interface deriving this interface.
Class | Any class derived from this class.
Virtual or Abstract Methods | Any method implementing or overriding this method.
Interface Methods | Any method implementing that interface semantic.
Parameter or Return Value of an abstract, virtual or interface method | The corresponding parameter or to the return value of derived methods using the method-level rules described above.
Assembly | All assemblies referencing (directly or not) this assembly.
Note Note

Aspect inheritance is not supported on events and properties, but it is supported on event and property accessors. The reason for this limitation is that there is actually nothing like event inheritance or property inheritance in MSIL (events and properties have nearly no existence for the CLR: these are pure metadata intended for compilers). Obviously, aspect inheritance is not supported on fields.

Strict and Multicast Inheritance

To understand the difference between strict and multicast inheritance, remember the original role of MulticastAttribute: to propagate custom attributes along the lines of containment. So, if you apply a method-level attribute to a type, the attribute will be propagated to all the methods of this type (some methods can be filtered out using specific properties of MulticastAttribute, or MulticastAttributeUsageAttribute; see Adding Aspects Declaratively Using Attributes for details).

The difference between strict and multicasting inheritance is that, with multicasting inheritance (but not with strict inheritance), even inherited attributes are propagated along the lines of containment.

Consider the following piece of code, where A and B are both method-level aspects.

C#
Copy
[A(AttributeInheritance = MulticastInheritance.Strict)]
[B(AttributeInheritance = MulticastInheritance.Multicast)]
public class BaseClass
{
  // Aspect A, B.
  public virtual void Method1();
}

public class DerivedClass : BaseClass
{
  // Aspects A, B.
  public override void Method1() {}

  // Aspect B.
  public void Method2();
}

If you just look at BaseClass, there is no difference between strict and multicasting inheritance. However, if you look at DerivedClass, you see the difference: only aspect B is applied to MethodB.

The multicasting mechanism for aspect A is the following:

  1. Propagation along the lines of containment from BaseClass to BaseClass.Method1.

  2. Propagation along the lines of inheritance from BaseClass.Method1 to DerivedClass.Method.

For aspect B, the mechanism is the following:

  1. Propagation along the lines of containment from BaseClass to BaseClass.Method1.

  2. Propagation along the lines of inheritance from BaseClass.Method1 to DerivedClass.Method1.

  3. Propagation along the lines of inheritance from BaseClass to DerivedClass.

  4. Propagation along the lines of containment from DerivedClass to DerivedClass.Method1and DerivedClass.Method2.

In other words, the difference between strict and multicasting inheritance is that multicasting inheritance applies containment propagation rules to inherited aspects; strict inheritance does not.

Avoiding Duplicate Aspects

If you read again the multicasting mechanism for aspect B, you will notice that the aspect B is actually applied twice to DerivedClass.Method1: one instance comes from the inheritance propagation from BaseClass.Method1, the other instance comes from containment propagation from DerivedClass.

To avoid surprises, PostSharp implements a mechanism to avoid duplicate aspect instances. The rule: if many paths lead from the same custom attribute usage to the same target element, only one instance of this custom attribute is applied to the target element.

Caution note Caution

Attention: you can still have many instances of the same custom attribute on the same target element if they have different origins (i.e. they originate from different lines of code, typically). You can enforce uniqueness of custom attribute instances by using AllowMultiple. See the section Overriding and Removing Aspect Instances for details.

See Also

Reference

MulticastAttribute
MulticastAttributeUsageAttribute


Overriding and Removing Aspect Instances

Having multiple instances of the same aspect on the same element of code is sometimes the desired behavior. With multicasting custom attributes (MulticastAttribute), it is easy to end up with that situation. Indeed, many multicasting paths can lead to the same target.

However, most of the time, a different behavior is preferred. We could define a method-level aspect on the type (this aspect would apply to all methods) and override (or even exclude) the aspect on a specific method.

The multicasting engine has both the ability to apply multiple aspect instances on the same target, and the ability to replace or remove custom attributes.

Understanding the Multicasting Algorithm

Before going ahead, it is important to understand the multicasting algorithm. The algorithm relies on a notion of order of processing of aspect instances.

Important note Important

This section covers how PostSharp handles multiple instances of the same aspect type for the sole purpose of computing how aspect instances should be overridden or removed. See Coping with Several Aspects on the Same Target to understand how to cope with multiple instances of different aspects.

The following rules apply:

  1. Aspect instances defined on a container (for instance a type) have always precedence over instances defined on an item of that container (for instance a method). Elements of code are processed in the following order: assembly, module, type, field, property, event, method, parameter.

  2. When multiple aspect instances are defined on the same level, they are sorted by increasing value of the AttributePriority.

The algorithm builds a list of aspect instances applied (directly and indirectly) on an element of code, sorts these instances, and processes overrides or removals as described below.

Applying Multiple Instances of the Same Aspect

The property MulticastAttributeUsageAttributeAllowMultiple determines whether multiple instances of the same aspect are allowed on an element of code. By default, this property is set to true for all aspects.

In the following example, the methods in type MyClass are enhanced by one, two and three instances of the Trace aspect (see code comments).

C#
Copy
using System;
using System.Diagnostics;
using PostSharp.Aspects;
using PostSharp.Extensibility;
using PostSharp.Serialization;
using Samples3;

[assembly: Trace(AttributeTargetTypes = "Samples3.My*", Category = "A")]
[assembly: Trace(AttributeTargetTypes = "Samples3.My*",
    AttributeTargetMemberAttributes = MulticastAttributes.Public, Category = "B")]

namespace Samples3
{
    [PSerializable]
    public sealed class TraceAttribute : OnMethodBoundaryAspect
    {
        public string Category { get; set; }

        public override void OnEntry(MethodExecutionArgs args)
        {
            Trace.WriteLine("Entering " +
                            args.Method.DeclaringType.FullName + "." + args.Method.Name, this.Category);
        }
    }

    public class MyClass
    {
        // This method will have 1 Trace aspect with Category set to A.
        private void Method1()
        {
        }

        // This method will have 2 Trace aspects with Category set to A, B
        public void Method2()
        {
        }

        // This method will have 3 Trace aspects with Category set to A, B, C.
        [Trace(Category = "C")]
        public void Method3()
        {
        }
    }
}
Overriding an Aspect Instance Manually

You can require an aspect instance to override any previous one by setting the aspect property AttributeReplace. This is equivalent to a deletion followed by an insertion (see below).

In the following examples, the first two methods of type MyClass are enhanced by aspects applied at assembly level, but these aspects are replaced by a different one on Method3.

C#
Copy
using System;
using System.Diagnostics;
using PostSharp.Aspects;
using PostSharp.Extensibility;
using PostSharp.Serialization;
using Samples5;

[assembly: Trace(AttributeTargetTypes = "Samples5.My*", Category = "A")]
[assembly: Trace(AttributeTargetTypes = "Samples5.My*",
    AttributeTargetMemberAttributes = MulticastAttributes.Public, Category = "B")]

namespace Samples5
{
    [PSerializable]
    public sealed class TraceAttribute : OnMethodBoundaryAspect
    {
        public string Category { get; set; }

        public override void OnEntry(MethodExecutionArgs args)
        {
            Trace.WriteLine("Entering " +
                            args.Method.DeclaringType.FullName + "." + args.Method.Name, this.Category);
        }
    }

    public class MyClass
    {
        // This method will have 1 Trace aspect with Category set to A.
        private void Method1()
        {
        }

        // This method will have 2 Trace aspect with Category set to A, B.
        public void Method2()
        {
        }

        // This method will have 1 Trace aspects with Category set to C.
        [Trace(Category = "C", AttributeReplace = true)]
        public void Method3()
        {
        }
    }
}
Overriding an Aspect Instance Automatically

To cause a new aspect instance to automatically override any previous one, the aspect developer must disallow multiple instances by annotating the aspect class with the custom attribute MulticastAttributeUsageAttribute and setting the property AllowMultiple to false.

In the following example, the methods in type MyClass are enhanced by a single Trace aspect:

C#
Copy
using System;
using System.Diagnostics;
using PostSharp.Aspects;
using PostSharp.Extensibility;
using PostSharp.Serialization;
using Samples4;

[assembly: Trace(AttributeTargetTypes = "Samples4.My*", AttributePriority = 1, Category = "A")]
[assembly: Trace(AttributeTargetTypes = "Samples4.My*",
    AttributeTargetMemberAttributes = MulticastAttributes.Public, AttributePriority = 2, Category = "B")]

namespace Samples4
{
    [MulticastAttributeUsage(MulticastTargets.Method, AllowMultiple = false)]
    [PSerializable]
    public sealed class TraceAttribute : OnMethodBoundaryAspect
    {
        public string Category { get; set; }

        public override void OnEntry(MethodExecutionArgs args)
        {
            Trace.WriteLine("Entering " +
                            args.Method.DeclaringType.FullName + "." + args.Method.Name, this.Category);
        }
    }

    public class MyClass
    {
        // This method will have 1 Trace aspect with Category set to A.
        private void Method1()
        {
        }

        // This method will have 1 Trace aspects with Category set to B.
        public void Method2()
        {
        }

        // This method will have 1 Trace aspects with Category set to C.
        [Trace(Category = "C")]
        public void Method3()
        {
        }
    }
}
Deleting an Aspect Instance

The MulticastAttributeAttributeExclude property removes any previous instance of the same aspect on a target.

This is useful, for instance, when you need to exclude a target from the matching set of a wildcard expression. For instance:

C#
Copy
[assembly: Configurable( AttributeTypes = "BusinessLayer.*" )]

          namespace BusinessLayer
          {
            [Configurable( AttributeExclude = true )]
            public static class Helpers
            {

            }
          }


Reflecting Aspect Instances at Runtime

Attribute multicasting has been primarily designed as a mechanism to add aspects to a program. Most of the time, the custom attribute representing an aspect can be removed after the aspect has been applied.

By default, if you add an aspect to a program and look at the resulting program using a disassembler or System.Reflection, you will not find these corresponding custom attributes.

If you need your aspect (or any other multicast attribute) to be reflected by System.Reflection or any other tool, you have to set the MulticastAttributeUsageAttributePersistMetaData property to true.

For instance:

C#
Copy
[MulticastAttributeUsage( MulticastTargets.Class, PersistMetaData = true )]
  public class TagAttribute : MulticastAttribute
  {
    public string Tag;
  }
Note Note

Multicasting of attributes is not limited only to PostSharp aspects. You can multicast any custom attribute in your codebase in the same way as shown here. If a custom attribute is multicast with the PersistMetaData property set to true, when reflected on the compiled code will look as if you had manually added the custom attribute in all of the locations.


Adding Aspects Using XML

PostSharp not only allows aspects to be applied in code, but also through XML. This is accomplished by adding them to your project’s .psproj file.

Adding aspects through XML gives the advantage of applying aspects without modifying the source code, which could be an advantage in some legacy projects.

Specifying an attribute in XML
C#
Copy
 namespace MyCustomAttributes
{
    // We set up multicast inheritance so  the aspect is automatically added to children types.
    [MulticastAttributeUsage(MulticastTargets.Class, Inheritance = MulticastInheritance.Strict)]
    [PSerializable]
    public sealed class AutoDataContractAttribute : TypeLevelAspect, IAspectProvider
    {
        // Details skipped.
    }
}

Normally AutoDataContractAttribute would be applied to Customer in code as follows:

C#
Copy
 namespace MyNamespace
{
    [AutoDataContractAttribute]
    class Customer
    {
        public string FirstName {get; set;}
        public string LastName { get; set; }
    }
}

Using XML instead, we can remove the custom attribute from source code and instead specify a Multicast element in the PostSharp project file, a file that has the same name as your project file (csproj or vbproj), but with the .psproj extension:

Copy
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.postsharp.org/1.0/configuration">
    <Multicast xmlns:my="clr-namespace:MyCustomAttributes;assembly:MyAssembly">
        <my:AutoDataContractAttribute  AttributeTargetTypes=" MyNamespace.Customer" />
    </Multicast>

</Project>

In this snippet, the xmlns:my attribute associates a prefix to an XML namespace, which must be mapped to the .NET namespace and assembly where custom attributes classes are defined:

Copy
<Multicast xmlns:my="clr-namespace:MyCustomAttributes;assembly:MyAssembly">

The next line then specifies the custom attribute to apply and the target attributes to apply the custom attributes to:

Copy
<my:AutoDataContractAttribute  AttributeTargetTypes="MyNamespace.Customer" />

The XML element name must be the name of a class inside the .NET namespace and assembly as defined by the XML namespace. Attributes of this XML element map to public properties or fields of this class.

Note that any property inherited from MulticastAttribute can be used here in order to apply the aspect to several classes at a time. See the section Adding Aspects to Multiple Declarations for details about these properties.

See Also

Other Resources

Adding Aspects to Multiple Declarations


Adding Aspects Programmatically using IAspectProvider

You may have situations where you are looking to implement an aspect as part of a larger pattern. Perhaps you want to add an aspect, implement an interface and dynamically inject some logic into the target code. In those situations, you will want to apply an aspect to the target code and have that aspect then add other aspects to other elements of code.

The theoretical concept can cause some mental gymnastics, so let's take a look at the implementation.

  1. Create an aspect that implements that IAspectProvider interface.

    C#
    Copy
     public class ProviderAspect : IAspectProvider
{
   public IEnumerable<AspectInstance> ProvideAspects(object targetElement)
   {
       throw new System.NotImplementedException();
   }
}

  2. Cast the target object parameter to the type that will be targeted by this aspect: Assembly, Type, MethodInfo, ConstructorInfo or LocationInfo.

    C#
    Copy
     public IEnumerable<AspectInstance> ProvideAspects(object targetElement)
{
   Type type = (Type) targetElement;

   throw new NotImplementedException();
}

  3. In the ProvideAspects(Object) method returns an AspectInstance of the aspect type you want, for every target element of code.

    C#
    Copy
     public IEnumerable<AspectInstance> ProvideAspects(object targetElement)
{
    Type type = (Type)targetElement;

    return type.GetMethods().Select(
       m => new AspectInstance(m, new LoggingAspect()) );

}

This aspect will now add aspects dynamically at compile time. Use of the IAspectProvider interface and technique is usually reserved for situations where you are trying to implement a larger design pattern. For example, it would be used when implementing an aspect that created the NotifyPropertyChangedAttribute pattern across a large number of locations in your codebase. It is overkill for many of the situations that you will encounter. Use it only for complicated pattern implementation aspects that you will create.

Note Note

To read more about NotifyPropertyChangedAttribute, see Handling Corner Cases.

Note Note

PostSharp does not automatically initialize the aspects provided by IAspectProvider, even if the method CompileTimeInitialize is defined. Any initialization, if necessary, should be done in the ProvideAspects method or in the constructor of provided aspects.

However, these aspects are initialized at run time just like normal aspects using the RunTimeInitialize method.

Creating Graphs of Aspects

It is common that aspects provided by IAspectProvider (children aspects) form a complex object graph. For instance, children aspects may contain a reference to the parent aspect.

An interesting feature of PostSharp is that object graphs instantiated at compile-time are serialized, and can be used at run-time. In other words, if you store in a child aspect a reference to another aspect, you will be able to use this reference at run time.

See Also

Reference

IAspectProvider
NotifyPropertyChangedAttribute
ProvideAspects(Object)
AspectInstance

Other Resources

INotifyPropertyChanged
Handling Corner Cases


Logging

PostSharp Logging allows you to add logging to your complete solution in just a few lines of code.

It has the following benefits:

  • Can produce super-detailed logs including parameter values and execution time.

  • Can stay turned off by default and be dynamically enabled on-demand, with fine-grained control over types and namespaces, when a problem happens in production.

  • Super fast. In fact, faster than string.Format.

  • Fully customizable. Works with your logging framework (even your custom one)

  • Supports a broad set of logging frameworks.

In this chapter
Section | Description
Adding Detailed Logging to your Solution | This article shows how to add detailed logging to your application.
Customizing the Appearance of Log Records | This article describes how to customize the log records. It covers both build-time configuration (logging profiles) and run-time configuration.
Implementing a Custom Formatter | This article shows how to create your own formatter to display the value of parameter values.
Enabling and Disabling Logging At Run Time | This article shows how to enable and disable logging for a specific type and namespace, and message severity.
Adding Audit to your Solution | This article shows how to automatically add audit records to your application.
Implementing an Adapter to a Custom Logging Framework | This article demonstrates how to use your own logging framework with PostSharp Logging.
Upgrading from PostSharp Diagnostics 4.3 | This article lists a few breaking changes between PostSharp 4.3 and PostSharp 5.0 and how to cope with them.
Licensing of PostSharp Diagnostics | This article describes important details about licensing of PostSharp Diagnostics.
Handling Faults in the Logging Component | This article explains what happens when the logging component fail and how to customize this behavior.
See Also

Reference

LogAttribute
LogExceptionAttribute


Adding Detailed Logging to your Solution

When you're working with your codebase, it's common to need to add logging either as a non-functional requirement or simply to assist during the development process. In either situation, you will want to include information about the parameters passed to the method when it was called as well as the parameter values once the method call has completed. This can be a tedious and brittle process. As you work and refactor methods, the order and types of parameters may change, parameters may be added and some may be removed. Along with performing these refactorings, you have to remember to update the logging messages to keep them in sync. This is something that is easy to forget, and once forgotten, the output of the logging is much less useful.

Logging is one of the examples of a boilerplate code. Performing logging imperatively not only leads to the problems with refactoring mentioned above. It also makes your code harder to understand.

PostSharp offers a solution to all of these problems. PostSharp Logging allows you to configure where logging should be performed and takes over the task of keeping your log entries in sync as you add, remove and refactor your codebase. Using the PostSharp Logging does not require changing your codebase allowing you to keep the production code clearly understandable with no boilerplate code.

Let's take a look at how you can add a trace logging for the start and completion of method calls.

This topic contains the following sections:

  • Step 1. Adding logging to your projects
  • Step 2. Choose your logging framework
  • Step 3. Configure PostSharp logging at run-time
  • Step 4. Configure your logging framework.
  • Result
Step 1. Adding logging to your projects

To add logging to a specific project:

  1. Add a reference to the PostSharp.Patterns.Diagnostics package to your project.

  2. Create a source code file where you will add all project-wise aspects. We suggest naming this file GlobalAspects.cs.

    Add the following content to this file:

    C#
    Copy
    using PostSharp.Patterns.Diagnostics;
using PostSharp.Extensibility;

[assembly: Log(AttributePriority = 1, AttributeTargetMemberAttributes = MulticastAttributes.Protected | MulticastAttributes.Internal | MulticastAttributes.Public)]
[assembly: Log(AttributePriority = 2, AttributeExclude = true, AttributeTargetMembers = "get_*" )]

    This code adds logging to all methods except private methods and except property getters. You can edit this code to target methods relevant to your scenarios. See Adding Aspects to Code for details.

PostSharp will now add logging before and after the execution of all methods targeted by the logging aspect.

Note Note

If there are several projects in your solution, repeat this procedure for each project. Note that you can share the GlobalAspects.cs file among several projects.

The next step is to configure logging at run-time. You should at least determine using which logging framework the records should be written. We call this concept the logging backend.

Step 2. Choose your logging framework

The role of PostSharp Logging is to generate logging records, but PostSharp itself does not intent to write these logs to files, databases, or network services. Several excellent open-source projects and commercial services already fulfill this role. In PostSharp terminology, the target logging framework is called the logging back-end. In order to see the logged records, you first need to choose and then configure a logging back-end.

PostSharp integrates with several logging frameworks right out of the box. You can choose from the following implementations:

Name | Class | Package
Microsoft Application Insights | ApplicationInsightsLoggingBackend | PostSharp.Patterns.Diagnostics.ApplicationInsights
Common.Logging | CommonLoggingLoggingBackend | PostSharp.Patterns.Diagnostics.CommonLogging
System.Console.WriteLine | ConsoleLoggingBackend | PostSharp.Patterns.Diagnostics
Enterprise Library | EnterpriseLibraryLoggingBackend | PostSharp.Patterns.Diagnostics.EnterpriseLibrary
ETW (System.Diagnostics.EventSource) | EventSourceLoggingBackend | PostSharp.Patterns.Diagnostics.Tracing
Log4Net | Log4NetLoggingBackend | PostSharp.Patterns.Diagnostics.Log4Net
Microsoft.Extensions.Logging | MicrosoftLoggingBackend | PostSharp.Patterns.Diagnostics.Microsoft
NLog | NLogLoggingBackend | PostSharp.Patterns.Diagnostics.NLog
Serilog | SerilogLoggingBackend | PostSharp.Patterns.Diagnostics.Serilog
System.Diagnostics.Trace | TraceLoggingBackend | PostSharp.Patterns.Diagnostics.Tracing
System.Diagnostics.TraceSource | TraceSourceLoggingBackend | PostSharp.Patterns.Diagnostics.Tracing
Loupe | LoupeLoggingBackend | PostSharp.Patterns.Diagnostics.Loupe

Alternatively, you can easily implement a custom backend. See Implementing an Adapter to a Custom Logging Framework for details.

Step 3. Configure PostSharp logging at run-time

To configure logging:

  1. Identify the startup method of your solution. In a console application and an ASP.NET Core application, the startup method is usually named Program.Main. In a XAML application, this is the Startup event handler. In an ASP.NET application, this is the Application_Start method in the Global.asax source file.

  2. To the startup project, add a reference to the package containing the implementation of your logging backend, as listed in the table above.

  3. Import the PostSharp.Patterns.Diagnostics namespace in the startup file.

    C#
    Copy
    using PostSharp.Patterns.Diagnostics;

  4. Add the following code on the top of the startup method:

    C#
    Copy
    LoggingServices.DefaultBackend = new Patterns.Diagnostics.Backends.Console.ConsoleLoggingBackend();

    In the code snippet above, you can replace ConsoleLoggingBackend by any of the logging backends.

  5. It is essential that you configure logging before any logged type (i.e. any type containing a logged method or field) is initialized, otherwise TypeInitializationException will be thrown at build time. Therefore, you should add the following custom attribute on the top of the startup class:

    C#
    Copy
    [Log(AttributeExclude = true)]
class Program
{
// ...
}

    Important note Important

    You should exclude the logging aspect from any class that is executed before you set up and configure the backend. If this is too cumbersome, you can create a module initializer for your startup project using the ModuleInitializerAttribute aspect.

Step 4. Configure your logging framework.

Remember that PostSharp emits records to the logging framework of your choice. Some of these frameworks may need additional configuration. Please refer to the documentation of the logging framework for details.

Result

Now that you have added logging to your project method, you will get a super-detailed log of your program execution, including parameter values and return values. You are able to add, remove, or rename a method or its parameters with the confidence that your log entries will be kept in sync with each of those changes. Adding logging to your codebase and maintaining it becomes a very easy task.

See Also

Reference

LogAttribute

Other Resources

Adding Aspects to Multiple Declarations


Customizing the Appearance of Log Records

PostSharp offers several ways to customize the apprarance and the content of log records. This article maps different customization scenarios to a procedure, then explains each procedure in detail.

This topic contains the following sections:

  • Scenarios
  • Editing a build-time configuration
  • Editing run-time options
  • Implementing a custom formatter
  • Overriding a backend
Scenarios
Scenario | Procedure
Include execution time. Emit a warning when execution time exceeds a given threshold. Include source file and line information. Include information about which task or method is being awaited by the await operator. | Edit the build-time configuration (LoggingProfile) in postsharp.config.
Include parameter name, type, or value. Include return value. Include this parameter. Set the LogLevel. | Edit the build-time configuration (LoggingOptions) in postsharp.config.
Set the maximum length of a record. Set formatting options such as the delimiter character or the number of indentation spaces Include the type name, namespace, or name. Include exception details. Specify which exceptions should be logged. | Edit run-time options (TextLoggingBackendOptions or a derived class).
Change how parameter values of a specific type are rendered. | Implement a custom formatter.
Change any other behavior. | Override the backend.
Editing a build-time configuration

Some configuration settings affect the way how PostSharp generates instructions. These settings can have an important effect on run-time execution speed or assembly size. These settings are defined in the postsharp.config file. This file can be private to a project or shared among several projects. See Working with PostSharp Configuration Files for details about the postsharp.config file.

Because settings in postsharp.config affect code generation, you will have to rebuild your project after you modify this file.

In large applications, you may need to configure logging differently for different areas or layers in your application. For example, exceptions in the service that cleans up old data in the database can be logged with a "Warning" level, while exceptions in the customer-facing web service must be logged with the "Error" level.

PostSharp enables you to organize your logging options using Logging Profiles. You apply a given logging profile by providing its name as an argument for the constructor of the LogAttribute constructor.

Logging aspects are assigned to a default profile, as shown in the following table:

Aspect | Default logging profile
LogAttribute | default
LogExceptionAttribute | exceptions
AuditAttribute | audit (see Adding Audit to your Solution).

To edit the default logging profile:

  1. Open the file postsharp.config in your project. If it does not exist, create an XML file with the following content:

    Copy
    <?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.postsharp.org/1.0/configuration">
</Project>
    Note Note

    If you create postsharp.config in a directory, the file will be used for any project located under that directory. This allows you to share the logging profile among several projects. See Working with PostSharp Configuration Files for details.

  2. Edit postsharp.config as in the following example:

    Copy
    <?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.postsharp.org/1.0/configuration">
  <Logging xmlns="clr-namespace:PostSharp.Patterns.Diagnostics;assembly:PostSharp.Patterns.Diagnostics">
    <Profiles>
      <LoggingProfile Name="default" IncludeSourceLineInfo="True">
        <DefaultOptions>
          <LoggingOptions IncludeParameterType="True"/>
        </DefaultOptions>
      </LoggingProfile>
    </Profiles>
  </Logging>
</Project>

    See the documentation of the LoggingProfile and LoggingOptions classes for details.

To create and use a new logging profile:

  1. Configure a logging profile in postsharp.config, but choose a different name than default, exceptions or audit.

    Copy
    <?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.postsharp.org/1.0/configuration">
  <Logging xmlns="clr-namespace:PostSharp.Patterns.Diagnostics;assembly:PostSharp.Patterns.Diagnostics">
    <Profiles>
      <LoggingProfile Name="detailed" IncludeSourceLineInfo="True" IncludeExecutionTime="True" IncludeAwaitedTask="True">
        <DefaultOptions>
          <LoggingOptions IncludeParameterType="True" IncludeThisValue="True"/>
        </DefaultOptions>
      </LoggingProfile>
    </Profiles>
  </Logging>
</Project>

  2. Specify the profile name when you add the LogAttribute aspect to a method, type, or project.

    C#
    Copy
    [assembly: Log("detailed", AttributeTargetTypes = "My.Namespace.*", AttributePriority = 1, AttributeTargetMemberAttributes = MulticastAttributes.Public)]
    Note Note

    Alternatively, you can create a new aspect class and derive it from LogAttributeBase.

Editing run-time options

The run-time options are available on the Options property of the backend class. Each backend can expose a specific set of options.

Contrarily to the build-time options, the run-time options are not organized into profiles. They affect all profiles that use the backend you configure.

To edit run-time options, go to the startup method where PostSharp Logging is initialized, and set the backend options:

C#
Copy
var backend = new Patterns.Diagnostics.Backends.Console.ConsoleLoggingBackend();
backend.Options.Delimiter = " \u00A6 ";
backend.Options.UseColors = false;
LoggingServices.DefaultBackend = backend ;
Implementing a custom formatter

When you include parameter values in log records, PostSharp will invoke the ToString method of the object by default. To learn when and how to override the default formatter, see Implementing a Custom Formatter.

Overriding a backend

If none of the previous options are sufficient, you can create your own backend. Instead of creating your own implementation from scratch, you can derive any existing implementation and override relevant methods.

See Implementing an Adapter to a Custom Logging Framework for details.

See Also

Reference

LogAttribute

Other Resources

Adding Aspects to Multiple Declarations
Working with PostSharp Configuration Files


Implementing a Custom Formatter

Formatters are responsible for representing an object as a string. Formatters are used in two contexts: logging and caching. This article describes how to implement a custom formatter.

This topic contains the following sections:

  • When to implement a custom formatter
  • Implementing the IFormattable interface
  • Implementing the Formatter class
  • Registering the custom formatter
When to implement a custom formatter

You may consider implementing a custom formatter in two situations:

  • You want the object to be formatted differently in different contexts, i.e. you want the logging representation to be different than the caching representation or than the ToString representation.

  • The formatting is performance-critical. Since custom formatters are based on the UnsafeStringBuilder class, they are much faster than formatters based on ToString or string.Format.

Implementing the IFormattable interface

If you own the source code of a type, the easiest way to implement a custom formatter is to make the type implement the IFormattable interface, which has a single method named Format(UnsafeStringBuilder, FormattingRole).

The following example shows how to implement the IFormattable interface:

C#
Copy
using PostSharp.Patterns.Diagnostics;
using PostSharp.Patterns.Formatters;

namespace PostSharp.Samples.Logging
{
    class CustomerData : PostSharp.Patterns.Formatters.IFormattable
    {
        public string FirstName { get; set; }
        public string LastName { get; set; }

        [Log(AttributeExclude=true)]
        void Patterns.Formatters.IFormattable.Format(UnsafeStringBuilder stringBuilder, FormattingRole role)
        {
            stringBuilder.Append("{CustomerData FirstName=\"");
            stringBuilder.Append(this.FirstName);
            stringBuilder.Append("\", LastName=\"");
            stringBuilder.Append(this.LastName);
            stringBuilder.Append("}");
        }
    }
}
Tip Tip

To prevent the formatter from being logged, add [Log(AttributeExclude=true)] to the formatting method.

When you implement the IFormattable interface, you don't need to register the formatter because the formatter is the object itself.

Implementing the Formatter class

If you don't own the source code of a type, you cannot implement the IFormattable. Instead, you can create a new class derived from the FormatterT class and implement the Write(UnsafeStringBuilder, T) method.

The following example illustrates a formatter for the Int32 class.

C#
Copy
using PostSharp.Patterns.Diagnostics;
using PostSharp.Patterns.Formatters;

 [Log(AttributeExclude=true)]
 class FancyIntFormatter : Formatter<int>
 {
     public override void Write(UnsafeStringBuilder stringBuilder, int value)
     {
         switch ( value )
         {
             case 0:
                 stringBuilder.Append("zero");
                 break;

             case 1:
                 stringBuilder.Append("one");
                 break;

             case 2:
                 stringBuilder.Append("two");
                 break;

             case 3:
                 stringBuilder.Append("three");
                 break;

             default:
                 stringBuilder.Append(value);
                 break;
         }
     }
 }
Tip Tip

To prevent the formatter from being logged, add [Log(AttributeExclude=true)] to the formatting method.

Registering the custom formatter

Creating a new formatter class does not cause PostSharp to use it. You still need to register it.

Use the following code to register your formatter with PostSharp Logging:

C#
Copy
LoggingServices.Formatters.Register(new FancyIntFormatter());

To use the same formatter in PostSharp Caching, use:

C#
Copy
CachingServices.Formatters.Register(new FancyIntFormatter());
See Also

Other Resources

Example project: PostSharp.Samples.Logging.Customization


Adding Custom Log Records Manually

When you're using the LogAttribute aspect, PostSharp automatically generates code that emits log records before and after the execution of a method. But there are times when you will want to write your own records. For instance, you may want to log a custom error or warning. You may want this message to be displayed even when trace-level logging is disabled. But when it is enabled, you want this message to appear in the right context, with the proper indentation.

For these scenarios, you can use the methods provided by the Logger class.

This topic contains the following sections:

  • Emitting custom log records
  • Logging records with parameters
  • Logging custom activities
  • Changing the severity level of custom activities
Important note Important

All projects that use the Logger facility to emit manual log records and activities MUST be processed by PostSharp, otherwise the execution of your application will fail. Therefore your projects must have a reference to the PostSharp.Patterns.Common package (a reference to PostSharp.Patterns.Common.Redist is not sufficient), and PostSharp may not be disabled on this project.

Emitting custom log records

To write a custom log record, use the LoggerWrite(LogLevel, String) method.

To write custom log records:

  1. Define a static field of type Logger in the class emitting the log records and initialize it using the LoggerGetLogger(String) method.

  2. Emit log records using the LoggerWrite(LogLevel, String) method.

Example

C#
Copy
static class Hasher
{
    static readonly Logger logger = Logger.GetLogger();

    public static async Task ReadAndHashAsync(string url)
    {
       if ( string.IsNullOrEmpty( url ) )
       {
          logger.Write(LogLevel.Warning, "Empty URL passed. Skipping this method.");
          return;
       }

       // Details skipped.
    }
}
Logging records with parameters

Most of the time, you won't log constant strings, but you will want to include variable pieces of information. In this case, you can use one of the overloads of the LoggerWrite(LogLevel, String) that accepts formatting parameters.

Note that the specification of the formatting string used by the Logger class is not identical to the one used by string.Format.

The formatting string used by the Logger class is designed to support named parameters (for use with logging backends that support it, i.e. semantic logging) and for high-performance evaluation. It has the following specifications:

  • Named parameters must be surrounded by curly brackets, e.g. {MyParameter}.

  • Values are matched to named parameters by position. This means that the order of named parameters in the formatting string must match the order of corresponding values passed to the LoggerWrite(LogLevel, String) method and that two named parameters with the same name are not matched to the same value.

  • Anything inside a pair of curly brackets is considered as the parameter name and will be passed to the backend as it, without further parsing.

  • Formatting specifiers are not supported but may be partially supported in the future. Do not use colons (:) in your parameter names, as they may be interpreted differently in future versions of PostSharp.

  • Use the escaped form of curly brackets {{ and }} if you want to include curly brackets in the formatted string.

Important note Important

Consider the performance impact of using string.Format or equivalent constructs such as interpolated strings. PostSharp Logging is highly optimized and is able to generate a logging record without allocating any memory on the heap. If you're using a high-performance backend, using string.Format can bring a significant performance overhead to your logging.

Example

C#
Copy
static class Hasher
{
    static readonly Logger logger = Logger.GetLogger();

    public static byte[] ReadAndHash(string url)
    {
        var hashAlgorithm = HashAlgorithm.Create("SHA256");
        hashAlgorithm.Initialize();

        var webClient = new WebClient();
        var buffer = new byte[16 * 1024];

        logger.Write(LogLevel.Info, "Using a {BufferSize}-byte buffer.", buffer.Length);

        using (var stream = webClient.OpenRead(url))
        {
            int countRead;
            while ((countRead = stream.Read(buffer, 0, buffer.Length)) != 0)
            {
                logger.Write(LogLevel.Info, "Got {CountRead} bytes.", countRead);
                hashAlgorithm.ComputeHash(buffer, 0, countRead);
            }
        }

        return hashAlgorithm.Hash;
    }
}
Logging custom activities

More often than not, you will find yourself logging the beginning and the end of an activity, e.g. Starting to read MyFile.xml and Succeeded to read MyFile.xml or Cannot read MyFile.xml: unexpected element at line 5. With PostSharp, this concept is represented by the LogActivity class. An activity is anything that starts and stops. When you use the LogAttribute aspect to log a method, it also translates into an activity behind the scenes. Activities are hierarchical: they have a notion of child and parent and form a tree. Activities can be synchronous and asynchronous.

To log a non-async custom activity method:

  1. If you haven't already done it, define a static field of type Logger in the class emitting the log records and initialize it using the LoggerGetLogger(String) method.

  2. To start the activity, call the LoggerOpenActivity(String) method if the activity is synchronous, or LoggerOpenAsyncActivity(String) if it is asynchronous. An asynchronous activity is any activity that contains the await operator.

  3. To write a log record, use the LoggerWrite(LogLevel, String) method on the LogActivity object returned by the the LoggerOpenActivity(String) or or LoggerOpenAsyncActivity(String) method.

  4. To close the activity, call the SetSuccess, SetFailure or SetException(Exception) method. We suggest that you wrap the activity source code inside a try block and call the SetException(Exception) method from the catch block.

Example

C#
Copy
static class Hasher
{
    static readonly Logger logger = Logger.GetLogger();

    private static byte[] ReadAndHash(string file)
    {
        var activity = logger.OpenActivity("Processing file {Url}", file);

        try
        {
            var totalSize = 0;

            var hashAlgorithm = HashAlgorithm.Create("SHA256");
            hashAlgorithm.Initialize();

            var buffer = new byte[128 * 1024];

            activity.Write(LogLevel.Info, "Working with a {BufferSize}-byte buffer.", buffer.Length);

            using (var stream = File.OpenRead(file))
            {
                int countRead;
                while ((countRead = stream.Read(buffer, 0, buffer.Length)) != 0)
                {
                    activity.Write(LogLevel.Info, "Got {CountRead} bytes.", countRead);

                    hashAlgorithm.ComputeHash(buffer, 0, countRead);
                    totalSize += countRead;
                }
            }

            activity.SetSuccess("Success. Read {TotalSize} bytes in total.", totalSize);
            return hashAlgorithm.Hash;
        }
        catch ( Exception e )
        {
            activity.SetException(e);
            throw;
        }

    }
}
Changing the severity level of custom activities

By default, entry and success messages of activities are logged with Debug severity and failures and exceptions with Error severity.

You can change the default severity by setting the properties of the DiagnosticsCustomRecordLoggingOptions class by using the following code:

Copy
LoggingServices.Roles[LoggingRoles.Custom].CustomRecordLoggingOptions.ActivityLevel = LogLevel.Trace;

In the code above, the LoggingRoles.Custom string refers to the role parameter of the GetLogger(String) method, whose default value equals to LoggingRoles.Custom.


Enabling and Disabling Logging At Run Time

Sometimes when an issue happens in production, you will want to enable tracing for a specific type or namespace dynamically, without rebuilding the application. To prepare for this scenario, you need to add as much logging as reasonable at build time, but disable it by default at run time, and then enable it selectively.

This topic contains the following sections:

  • Enabling/disabling with the PostSharp Logging API
  • Optimizing the execution time when logging is disabled
  • Enabling/disabling with the backend API
Enabling/disabling with the PostSharp Logging API

To enable or disable logging for a specific type or namespace:

  1. Use the LoggingServicesGetSource(String, String) method to retrieve the LoggingNamespaceSource or LoggingTypeSource for the given namespace or type.

  2. Call the LoggingNamespaceSourceSetLevel(LogLevel) method to set the minimal severity for which logging is enabled. Calling this method will override the Level property for the current type or namespace and all nested types or namespaces.

Note Note

PostSharp Logging does not implement a mechanism to enable or disable tracing through a configuration file. If you need to be able to configure logging without editing source code, you will have to implement yourself the code reading the configuration and calling the LoggingNamespaceSourceSetLevel(LogLevel) method with proper arguments. Alternatively, you can use backend configuration mechanism (see below).

Example

The following code will cause PostSharp to log only exceptions for the MyCompany namespace, but everything for the MyCompany.BusinessLayer namespace. The order of the two lines of code is important.

C#
Copy
LoggingServices.GetSource(LoggingRoles.Tracing, "MyCompany").SetLevel(LogLevel.Error);
LoggingServices.GetSource(LoggingRoles.Tracing, "MyCompany.BusinessLayer").SetLevel(LogLevel.Debug);
Caution note Caution

If you want to change the minimal severity for custom log records, use the role LoggingRoles.Custom additionally to LoggingRoles.Tracing.

Logging is enabled for all types and any severity by default.

Optimizing the execution time when logging is disabled

By default, PostSharp generates code that allows you to dynamically enable or disable logging for a specific type and severity. However, even if logging is disabled, your CPU still needs to execute the code that evaluates whether logging is enabled.

By setting the AllowDynamicEnabling property of the logging profile to false, you can ask PostSharp to generate instructions that will be fully eliminated by the JIT compiler when logging is disabled. Therefore, the cost of inactive logging will be strictly zero.

When you set the AllowDynamicEnabling property to false, you need to call the LoggingNamespaceSourceSetLevel(LogLevel) method when the application initializes. Any change done after a logged type is JIT-compiled will be ignored for this specific type.

Example

The following postsharp.config enables the JIT-compiler for the default profile.

Copy
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.postsharp.org/1.0/configuration">
  <Logging xmlns="clr-namespace:PostSharp.Patterns.Diagnostics;assembly:PostSharp.Patterns.Diagnostics">
    <Profiles>
      <LoggingProfile Name="default" AllowDynamicEnabling="False"/>
    </Profiles>
  </Logging>
</Project>
Enabling/disabling with the backend API

Several logging frameworks offer a configuration mechanism that allows you to enable or disable logging. For a PostSharp log record to be emitted, two conditions need to be met: logging must be enabled by PostSharp (see above) and by the backend logging framework.

Logging frameworks generally have a concept of category or source (the terminology can vary), which typically is just determined by a string (typically a type or namespace). The corresponding concept in PostSharp Logging is the LoggingTypeSource class, which is determined by two strings: a role (see LoggingRoles) and a type name or namespace.

By default, a LoggingTypeSource is mapped to a category according to the value of the Role property. If you want to control logging using the backend framework, you will need to customize this mapping. This can be done by setting a property of the LoggingBackendOptions class. This property is different for each backend framework.

When the mapping is properly set up, you enable or disable logging using the facilities implemented by the backend logging framework.

Example

The following code shows how to configure PostSharp Logging with log4net so that type name and namespace is used instead of the role.

C#
Copy
((Log4NetLoggingBackend) LoggingServices.DefaultBackend).Options.GetLogger = ts => LogManager.GetLogger( ts.DisplayFullName  );


Configuring specific logging frameworks

This chapter explains how to configure PostSharp Logging to specifically work with different logging frameworks.

It contains the following articles:

Logging to NLog

Logging to log4net

Logging to Serilog

Logging to the system console

Logging to ETW

Logging to Common.Logging

Logging to Loupe


Logging to the system console

This article shows how to target the output of PostSharp Logging to the console and how to configure it.

Configuring PostSharp Logging to use the console

To use target PostSharp Logging to the console:

  1. Add PostSharp logging to your codebase as described in Adding Detailed Logging to your Solution.

  2. In the application startup file, include the following namespace imports:

    C#
    Copy
    using PostSharp.Patterns.Diagnostics;
using PostSharp.Patterns.Diagnostics.Backends.Console;

    In the application startup method, include the following code:

    C#
    Copy
    LoggingServices.DefaultBackend = new ConsoleLoggingBackend();
Theming the console

Selecting a console theme

Console themes define the colors used when rendering the log messages. The ConsoleThemes class exposes a few themes. The default theme is ConsoleThemesClassic, which copies the colors used by MSBuild. If you do not want any color, use ConsoleThemesNone.

A nicer and more sophisticated theme is Dark.

You can change the current theme by setting the ConsoleLoggingBackendOptionsTheme as demonstrated in the following example:

C#
Copy
var backend = new ConsoleLoggingBackend();
backend.Options.Theme = ConsoleThemes.Dark;
LoggingServices.DefaultBackend = backend;

Customizing a theme

The ConsoleTheme class provides a convenient implementation of the low-level IConsoleTheme interface. The dark theme is an instance of the ConsoleTheme.

The ConsoleTheme class simplifies the programming of a theme by allowing only two colors for each log level: a normal color used for the message template, and a highlighted color used for variable parts of the message (typically parameter values). See the methods and properties of the ConsoleTheme class for details.

The easiest way to customize the dark theme is to take a copy of the theme by calling the Clone method and then configure the new object.

For instance, the following code changes the colors of critical error messages:

C#
Copy
ConsoleTheme myTheme = ConsoleThemes.Dark.Clone();
myTheme.NormalStyles[LogLevel.Critical] = new ConsoleThemeStyle("\x1b[38;5;0199m\x1b[49m", ConsoleColor.Magenta );
myTheme.HightlightedStyles[LogLevel.Critical] = new ConsoleThemeStyle("\x1b[38;5;0201m\x1b[48;5;0236m", ConsoleColor.Magenta);

var backend = new ConsoleLoggingBackend();
backend.Options.Theme = myTheme;
LoggingServices.DefaultBackend = backend;

When the simplifications of the ConsoleTheme class are too restrictive for your needs, you can directly implement the IConsoleTheme or override the GetStyle(String, LogLevel, LogRecordKind, ConsoleThemeItem) method of the ConsoleTheme class.

The following code example displays the message time in a special color:

C#
Copy
class CustomTheme : ConsoleTheme
{
    readonly ConsoleThemeStyle timeStyle = new ConsoleThemeStyle(" \x1b[38;5;0006m", ConsoleColor.Cyan);
    readonly ConsoleThemeStyle delimiterStyle = new ConsoleThemeStyle("\x1b[38;5;0255m", ConsoleColor.Gray);

    public CustomTheme() : base(ConsoleThemes.Dark)
    {

    }

    public override ConsoleThemeStyle GetStyle(string role, LogLevel level, LogRecordKind kind, ConsoleThemeItem item)
    {
        if ( item == ConsoleThemeItem.Time )
        {
            return timeStyle;
        }
        else if ( item == ConsoleThemeItem.Delimiter )
        {
            return delimiterStyle;
        }

        return base.GetStyle(role, level, kind, item);

  }
}

To include the message time, you need the following code:

C#
Copy
var backend = new ConsoleLoggingBackend();
backend.Options.Theme = new CustomTheme();
backend.Options.IncludeTimestamp = true;
backend.Options.TimestampFormat = "HH:mm:ss";

LoggingServices.DefaultBackend = backend;
See Also

Reference

ConsoleLoggingBackend

Other Resources

Example project: PostSharp.Samples.Logging.Console


Logging to log4net

This article shows how to use PostSharp Logging and log4net together.

To use PostSharp Logging with log4net:

  1. Add PostSharp logging to your codebase as described in Adding Detailed Logging to your Solution.

  2. Add the PostSharp.Patterns.Diagnostics.Log4Net package to your startup project.

  3. Create an XML file named log4net.config. In the file properties, set the Copy to Output Directory property to Copy always.

    Add the following content to this file:

    Copy
    <log4net>
  <appender name="file" type="log4net.Appender.FileAppender">

    <file value="log4net.log" />

    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%date [%thread] %-5level %logger %ndc - %message%newline" />
    </layout>
  </appender>

  <appender name="console" type="log4net.Appender.ColoredConsoleAppender">
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
    </layout>
  </appender>

  <root>
    <level value="DEBUG" />
    <appender-ref ref="file" />
    <appender-ref ref="console" />
  </root>

</log4net>

    This example configuration file instructs log4net to write all log records to a file named log4net.log and to the console.

    See the log4net documentation for details about this configuration file.

  4. In the application startup file, include the following namespace imports:

    C#
    Copy
    using log4net.Config;
using PostSharp.Patterns.Diagnostics;
using PostSharp.Patterns.Diagnostics.Backends.Log4Net;

    In the application startup method, include the following code:

    C#
    Copy
    // Configure Log4Net
XmlConfigurator.Configure(new FileInfo("log4net.config"));

// Configure PostSharp Logging to use Log4Net
LoggingServices.DefaultBackend = new Log4NetLoggingBackend();

If you run your application, you should now see a detailed log in a file named log4net.log. If your application is a console application, you should also see the log in the console.

See Also

Reference

Log4NetLoggingBackend

Other Resources

Example project: PostSharp.Samples.Logging.Log4Net


Logging to NLog

This article shows how to use PostSharp Logging and nlog together.

To use PostSharp Logging with NLog:

  1. Add PostSharp logging to your codebase as described in Adding Detailed Logging to your Solution.

  2. Add the PostSharp.Patterns.Diagnostics.NLog package to your startup project.

  3. In the application startup file, include the following namespace imports:

    C#
    Copy
    using NLog;
using NLog.Config;
using NLog.Targets;
using PostSharp.Patterns.Diagnostics;
using PostSharp.Patterns.Diagnostics.Backends.NLog;

    In the application startup method, include the following code:

    C#
    Copy
    // Configure NLog.
var nlogConfig = new LoggingConfiguration();

var fileTarget = new FileTarget("file")
{
    FileName = "nlog.log",
    KeepFileOpen = true,
    ConcurrentWrites = false,
};

nlogConfig.AddTarget(fileTarget);
nlogConfig.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, fileTarget));

var consoleTarget = new ConsoleTarget("console");
nlogConfig.AddTarget(consoleTarget);
nlogConfig.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, consoleTarget));

LogManager.EnableLogging();

// Configure PostSharp Logging to use NLog.
LoggingServices.DefaultBackend = new NLogLoggingBackend(new LogFactory(nlogConfig));

    This example code instructs NLog to write all log records to a file named nlog.log and to the console. If you prefer, you can configure NLog with a configuration file. See the NLog documentation for details.

If you run your application, you should now see a detailed log in a file named nlog.log. If your application is a console application, you should also see the log in the console.

See Also

Reference

NLogLoggingBackend


Logging to Serilog

This article shows how to use PostSharp Logging and Serilog together.

This topic contains the following sections:

  • Getting started with PostSharp Logging and Serilog
  • Using Serilog formatters instead of PostSharp ones
  • Including more semantic parameters
Getting started with PostSharp Logging and Serilog

To use PostSharp Logging with Serilog:

  1. Add PostSharp logging to your codebase as described in Adding Detailed Logging to your Solution.

  2. Add the PostSharp.Patterns.Diagnostics.Serilog package to your startup project, as well as the packages for all Serilog sinks you will need. For the next code examples, install the packages Serilog.Sinks.ColoredConsole and Serilog.Sinks.File.

  3. In the application startup file, include the following namespace imports:

    C#
    Copy
    using PostSharp.Patterns.Diagnostics;
using PostSharp.Patterns.Diagnostics.Backends.Serilog;
using Serilog;

    In the application startup method, include the following code:

    C#
    Copy
    // The output template must include {Indent} for nice output.
const string template = "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level}] {Indent:l}{Message}{NewLine}{Exception}";

// Configure a Serilog logger.
var logger = new LoggerConfiguration()
  .MinimumLevel.Debug()
  .WriteTo.File("serilog.log", outputTemplate: template)
  .WriteTo.ColoredConsole(outputTemplate: template)
  .CreateLogger();

// Configure PostSharp Logging to use Serilog
LoggingServices.DefaultBackend = new SerilogLoggingBackend(logger);

    This example code instructs Serilog to write all log records to a file named serilog.log and to the console.

    Note that this code snippet supplies a custom output template. By default, Serilog does not indent the logs generated by PostSharp. PostSharp passes the indentation string to Serilog as a parameter named Indent. In order to produce indented logs, you need to include the {Indent:l} parameter into your output template.

    See the Serilog documentation for more details.

If you run your application, you should now see a detailed log in a file named serilog.log. If your application is a console application, you should also see the log in the console.

Using Serilog formatters instead of PostSharp ones

By default, PostSharp Logging will use its own formatters to format parameter values into a string and will pass the already-formatted string to Serilog.

If you want the unformatted parameter value to be passed to Serilog instead of the string, set the SerilogLoggingBackendOptionsUseSerilogFormatters property to true.

Including more semantic parameters

By default, PostSharp Logging passes the following pieces of information to Serilog as semantic parameters: parameter values, return values, this value, and execution time. Other pieces of information such as for instance the type and method name are included in the message template.

If you want pass more pieces of information as semantic parameters, set the SerilogLoggingBackendOptionsSemanticParametersTreatedSemantically property.

Note Note

Semantic parameters have a relatively high performance cost in Serilog. We suggest you do not use more semantic parameters than necessary.


Logging to ETW

This article shows how to use PostSharp Logging and Event Tracing for Windows (ETW) together.

If you run your application, you should now see a detailed log in a file named nlog.log. If your application is a console application, you should also see the log in the console.

This topic contains the following sections:

  • Targeting ETW
  • Listening to ETW events
Targeting ETW

To target ETW with PostSharp Logging:

  1. Add PostSharp logging to your codebase as described in Adding Detailed Logging to your Solution.

  2. Add the PostSharp.Patterns.Diagnostics.Tracing package to your startup project.

  3. In the application startup file, include the following namespace imports:

    C#
    Copy
    using PostSharp.Patterns.Diagnostics;
using PostSharp.Patterns.Diagnostics.Backends.EventSource;

    In the application startup method, include the following code:

    C#
    Copy
    var eventSourceBackend = new EventSourceLoggingBackend(new PostSharpEventSource());
if (eventSourceBackend.EventSource.ConstructionException != null)
    throw eventSourceBackend.EventSource.ConstructionException;

As a result of this procedure, PostSharp Logging will emit records to the ETW event source named PostSharp-Patterns-Diagnostics. You now need to attach a listener to this event source.

Listening to ETW events

ETW is a very complex system and explaining it is beyong the scope of this documentation. Let's just show how you can collect and view ETW events on your development machine.

We will use a tool named PerfView developed by Microsoft.

To collect and view PostSharp Logging logs using PerfView:

See Also

Reference

EventSourceLoggingBackend

Other Resources

Example project: PostSharp.Samples.Logging.Etw


Logging to Common.Logging

This article shows how to use PostSharp Logging and Common.Logging together.

To use PostSharp Logging with Common.Logging:

  1. Add PostSharp logging to your codebase as described in Adding Detailed Logging to your Solution.

  2. Add the PostSharp.Patterns.Diagnostics.CommonLogging package to your startup project.

  3. In the application startup file, include the following namespace imports:

    C#
    Copy
    using Common.Logging;
using Common.Logging.Simple;
using PostSharp.Patterns.Diagnostics;
using PostSharp.Patterns.Diagnostics.Backends.CommonLogging;

    In the application startup method, include the following code:

    C#
    Copy
    // Configure Common.Logging to direct outputs to the system console.
LogManager.Adapter = new ConsoleOutLoggerFactoryAdapter();

// Configure PostSharp Logging to direct outputs to Common.Logging.
LoggingServices.DefaultBackend = new CommonLoggingLoggingBackend();

    This example code instructs Common.Logging to write all log records to the system console. See the Common.Logging documentation for details.

If you run your application, you should also see the log in the console.

See Also

Reference

CommonLoggingLoggingBackend

Other Resources

Example project: PostSharp.Samples.Logging.CommonLogging


Logging to Loupe

This article shows how to use PostSharp Logging and Loupe together.

To use PostSharp Logging with Loupe:

  1. Add PostSharp logging to your codebase as described in Adding Detailed Logging to your Solution.

  2. Add the PostSharp.Patterns.Diagnostics.Loupe package to your startup project.

  3. Follow the instructions of the first step Loupe configuration tutorial to properly initialize Loupe for your application kind.

    In the following examples, we will show instructions for a console or WinForms application.

    In the application startup file, include the following namespace imports:

    C#
    Copy
    using Gibraltar.Agent;
using PostSharp.Patterns.Diagnostics;
using PostSharp.Patterns.Diagnostics.Backends.Loupe;

    In the application startup method, include the following code before any logged code:

    C#
    Copy
    // Initialize Loupe.
Log.StartSession();

// Configure PostSharp Logging to use Loupe.
LoggingServices.DefaultBackend = new LoupeLoggingBackend();

    If you followed the Loupe configuration tutorial for a different type of application, do not forget to set the DefaultBackend just after the call to Log.StartSession().

  4. Before the application exits, include the following code:

    C#
    Copy
    // Initialize Loupe.
Log.EndSession();

  5. In order to enable source file information, create an XML file named postsharp.config in your project with the followig content:

    Copy
    <?xml version="1.0" encoding="utf-8"?>

<Project xmlns="http://schemas.postsharp.org/1.0/configuration">

  <Logging xmlns="clr-namespace:PostSharp.Patterns.Diagnostics;assembly:PostSharp.Patterns.Diagnostics">
    <Profiles>
      <LoggingProfile Name="Default" IncludeSourceLineInfo="True" />
      <LoggingProfile Name="Exceptions" IncludeSourceLineInfo="True" />
    </Profiles>
  </Logging>

</Project>

  6. At this point, you should be able to use Loupe Viewer to see the live log of your running application. You can download Loupe Viewer and open it in the background. When you start your application, you will see a desktop notification from Loupe. Click on this notification to open the live log. Note that the live log will disappear as soon as Log.EndSession has been called.

  7. Configure your application to send data to Loupe server as described in the second step of the Loupe configuration tutorial.

    You will need to add some settings in your app.config or web.config. Replace the customerName attribute with the name of your Loupe subscription. If you don't have a Loupe subscription, you can sign up for a free trial.

    Copy
    <configuration>
  <configSections>
    <sectionGroup name="gibraltar">
      <section name="publisher" type="Gibraltar.Agent.PublisherElement, Gibraltar.Agent" />
      <section name="server" type="Gibraltar.Agent.ServerElement, Gibraltar.Agent" />
    </sectionGroup>
  </configSections>
  <gibraltar>
    <publisher productName="Your Product" applicationName="Your Application" />
    <server autoSendSessions="True" sendAllApplications="True" useGibraltarService="True" customerName="Your Loupe Service Name"  />
  </gibraltar>
</configuration>
See Also

Reference

LoupeLoggingBackend

Other Resources

Example project: PostSharp.Samples.Logging.Loupe


Adding Audit to your Solution

Auditing and logging are technically very similar but serve different purposes. Whereas application logs are typically used by server administrators or technical support engineers to diagnose technical issues, audit trails are primarily used by security analysts and business users.

A typical business application will need to implement both logging and audit.

This article explains how to add audit into your application and how to customize the default behaviors.

This topic contains the following sections:

  • Adding audit to your projects
  • Adding more information to the audit record
Adding audit to your projects

To audit your code, you have to add the AuditAttribute attribute to all methods to audit, and implement a handler for the AuditServicesRecordPublished event event. Let's see that in details.

To add audit to your application:

  1. Add a reference to the PostSharp.Patterns.Diagnostics package to your project.

  2. Decide how you want to tag methods that need to be audited. If you want to select them individually, add the AuditAttribute attribute to each of them. For instance:

    C#
    Copy
    [Audit]
public void AssignTo(Employee employee)
{
}

    If you need to audit dozens or hundreds of methods, you can select them using project-wide matching rule. Create a source code file where you will add all project-wise aspects. We suggest naming this file GlobalAspects.cs. Then add the following content to this file:

    C#
    Copy
    using PostSharp.Patterns.Diagnostics;
using PostSharp.Extensibility;

[assembly: Audit(AttributePriority = 1, AttribueTargetTypes = "Contoso.BusinessObjects.*", AttributeTargetMemberAttributes = MulticastAttributes.Public)]
[assembly: Audit(AttributePriority = 2, AttributeExclude = true, AttributeTargetMembers = "get_*" )]

    This code adds audit to all public methods except property getters. You can edit this code to target methods relevant to your scenarios. See Adding Aspects to Code for details.

  3. Implement the code that appends the audit record into your database table. This code needs to react to the AuditServicesRecordPublished event.

    C#
    Copy
    AuditServices.RecordPublished += delegate(object o, AuditRecordEventArgs e)
    {
        var record = new DbAuditRecord(
            WindowsIdentity.GetCurrent().Name,
            ((BusinessObject)e.Record.Target).Id,
            e.Record.MemberName,
            e.Record.Text
        );

        record.AppendToDatabase();
    };
Adding more information to the audit record

The AuditRecord class exposed by the AuditServicesRecordPublished event only contain the most common pieces of information regarding the audited operation. If you want to include more information in the record event, you need to override the audit back-end.

Since the audit back-end is simply another logging back-end, you can use the same approach as described in Implementing an Adapter to a Custom Logging Framework. Here are the specific steps you need to follow to add more information to the AuditRecord class class.

To extend the audit record object:

  1. Create a new class derived from AuditRecord add all necesarry fields or properties.

    C#
    Copy
    using System;
using System.Collections.Generic;
using PostSharp.Patterns.Diagnostics;
using PostSharp.Patterns.Diagnostics.Audit;

namespace PostSharp.Samples.Audit.Extended
{
  public class ExtendedAuditRecord : AuditRecord
  {
    public ExtendedAuditRecord(Type declaringType, string memberName, LogRecordKind recordKind) : base(declaringType,
      memberName, recordKind)
    {
    }

    public List<BusinessObject> RelatedBusinessObjects { get; } = new List<BusinessObject>();
  }
}

  2. Create a new class derived from AuditRecordBuilder.

    Override the CreateRecord(LoggingContext, LogRecordInfo, LogMemberInfo) method and return a instance of your new custom AuditRecord class. The instance you return here will be stored in the AuditRecordBuilderCurrentRecord property.

    Then override other methods such as SetParameter``1(Int32, String, ParameterDirection, String, UMP, IFormatterUMP) and assign the custom fields of properties of the CurrentRecord property.

    C#
    Copy
    using PostSharp.Patterns.Diagnostics.Audit;
using PostSharp.Patterns.Diagnostics.Backends.Audit;
using PostSharp.Patterns.Diagnostics.Contexts;
using PostSharp.Patterns.Diagnostics.RecordBuilders;
using PostSharp.Patterns.Formatters;
using PostSharp.Reflection;

namespace PostSharp.Samples.Audit.Extended
{
  public class ExtendedAuditRecordBuilder : AuditRecordBuilder
  {
    public ExtendedAuditRecordBuilder(AuditBackend backend) : base(backend)
    {
    }

    protected override AuditRecord CreateRecord(LoggingContext context, ref LogRecordInfo recordInfo,
      ref LogMemberInfo memberInfo)
    {
      // Return an instance of our own extended class.
      return new ExtendedAuditRecord(context.Source.SourceType, memberInfo.MemberName, recordInfo.RecordKind);
    }

    public override void SetParameter<T>(
      int index, string parameterName, ParameterKind parameterKind, string typeName, T value, IFormatter<T> formatter)
    {
      base.SetParameter(index, parameterName, parameterKind, typeName, value, formatter);

      // When the parameter is a business object, add it to the list of correlated business objects.
      var businessObject = value as BusinessObject;

      if (businessObject != null)
        ((ExtendedAuditRecord) CurrentRecord).RelatedBusinessObjects.Add(businessObject);
    }
  }
}

  3. Create a new class derived from AuditBackend. Override the CreateRecordBuilder method and return a new instance of your custom AuditRecordBuilder.

    C#
    Copy
    using PostSharp.Patterns.Diagnostics.Backends.Audit;
using PostSharp.Patterns.Diagnostics.RecordBuilders;

namespace PostSharp.Samples.Audit.Extended
{
  public class ExtendedAuditBackend : AuditBackend
  {
    public override LogRecordBuilder CreateRecordBuilder()
    {
      return new ExtendedAuditRecordBuilder(this);
    }
  }
}

  4. Set an instance of new class as the logging back-end for the Audit role:

    C#
    Copy
    LoggingServices.Roles[LoggingRoles.Audit].Backend = new ExtendedAuditBackend();
See Also

Other Resources

Example project: PostSharp.Samples.Audit
Example project: PostSharp.Samples.Audit.Extended


Implementing an Adapter to a Custom Logging Framework

The adapter between PostSharp Logging and the target logging framework is called a back-end in PostSharp terminology. PostSharp comes with ready-made support for the most popular logging frameworks in .NET. If you need to integrate with a different logging solution, you can implement a custom logging back-end.

You need to implement at least 4 classes to implement a custom logging back-end.

This topic contains the following sections:

  • Override the TextLoggingBackendOptions class
  • Override the LoggingTypeSource class
  • Override the TextLogRecordBuilder class
  • Override the TextLoggingBackend class
  • Overriding context classes
Override the TextLoggingBackendOptions class

By design, every logging back-end must implement a class exposing all available run-time options. This is a design decision to expose options on a different class than the back-end class itself. Even if your custom back-end does not expose new options, we suggest you respect this convention and create a new empty class.

Example

C#
Copy
using PostSharp.Patterns.Diagnostics.Backends;

namespace PostSharp.Samples.Logging.CustomBackend.ServiceStack
{
  public class ServiceStackLoggingBackendOptions : TextLoggingBackendOptions
  {
  }
}
Override the LoggingTypeSource class

The LoggingTypeSource class corresponds to the ILog or ILogger concept of several logging frameworks. Your LoggingTypeSource will typically contain one field of this type, which will be initialized in the constructor.

Additionally to exposing the back-end logger, the LoggingTypeSource class exposes the IsBackendEnabled(LogLevel) method, which determines whether logging is enabled for the specified level and the current type and role.

Your implementation of LoggingTypeSource must be immutable or thread-safe.

Example

C#
Copy
using System;
using PostSharp.Patterns.Diagnostics;
using ServiceStack.Logging;

namespace PostSharp.Samples.Logging.CustomBackend.ServiceStack
{
  public class ServiceStackLoggingTypeSource : LoggingTypeSource
  {
    public ServiceStackLoggingTypeSource(LoggingNamespaceSource parent, Type sourceType) : base(parent, sourceType)
    {
      Log = LogManager.GetLogger(sourceType);
    }

    public ILog Log { get; }

    protected override bool IsBackendEnabled(LogLevel level)
    {
      switch (level)
      {
        case LogLevel.Trace:
        case LogLevel.Debug:
          return Log.IsDebugEnabled;

        default:
          return true;
      }
    }
  }
}
Override the TextLogRecordBuilder class

The role of the TextLogRecordBuilder is to create a string representing the current log record and finally to emit this string to the target logging framework.

The TextLogRecordBuilder class already contains the logic that creates the string. If you don't need to alter the string formatting logic, all you have to do is to implement the Write(UnsafeString) method.

If you need to customize the formatting of the string, or if you need to implement semantic logging, you will need to override other virtual methods of the TextLogRecordBuilder class. Please refer to the API reference for details.

Your implementation of the TextLogRecordBuilder class does not need to be thread-safe. All threads involved in logging have their own instance of the TextLogRecordBuilder class.

Example

C#
Copy
using PostSharp.Patterns.Diagnostics;
using PostSharp.Patterns.Diagnostics.Backends;
using PostSharp.Patterns.Diagnostics.RecordBuilders;
using PostSharp.Patterns.Formatters;

namespace PostSharp.Samples.Logging.CustomBackend.ServiceStack
{
  public class ServiceStackLogRecordBuilder : TextLogRecordBuilder
  {
    public ServiceStackLogRecordBuilder(TextLoggingBackend backend) : base(backend)
    {
    }

    protected override void Write(UnsafeString message)
    {
      var log = ((ServiceStackLoggingTypeSource) TypeSource).Log;
      var messageString = message.ToString();

      switch (Level)
      {
        case LogLevel.None:
          break;

        case LogLevel.Trace:
        case LogLevel.Debug:
          if (Exception == null)
            log.Debug(messageString);
          else
            log.Debug(messageString, Exception);
          break;

        case LogLevel.Info:
          if (Exception == null)
            log.Info(messageString);
          else
            log.Info(messageString, Exception);
          break;

        case LogLevel.Warning:
          if (Exception == null)
            log.Warn(messageString);
          else
            log.Warn(messageString, Exception);
          break;

        case LogLevel.Error:
          if (Exception == null)
            log.Error(messageString);
          else
            log.Error(messageString, Exception);
          break;

        case LogLevel.Critical:
          if (Exception == null)
            log.Fatal(messageString);
          else
            log.Fatal(messageString, Exception);
          break;
      }
    }
  }
}
Override the TextLoggingBackend class

The root of a logging back-end is the TextLoggingBackend class. You can consider this class as a factory type that instantiates other facilities needed to log with your custom logging back-end.

Since the TextLoggingBackend is an abstract class, you will have to implement several factory methods

To implement the back-end class:

  1. Create a new class and derive it from the TextLoggingBackend class.

  2. Add a get-only Options property and initialize it to a new instance of your LoggingBackendOptions class.

  3. Implement the GetTextBackendOptions abstract method so that it returns the value of your Options property.

  4. Implement the CreateTypeSource(LoggingNamespaceSource, Type) abstract method so that it returns a new instance of your LoggingTypeSource class.

  5. Implement the CreateRecordBuilder abstract method so that it returns a new instance of your LogRecordBuilder class.

Example

C#
Copy
using System;
using PostSharp.Patterns.Diagnostics;
using PostSharp.Patterns.Diagnostics.Backends;
using PostSharp.Patterns.Diagnostics.RecordBuilders;

namespace PostSharp.Samples.Logging.CustomBackend.ServiceStack
{
  public class ServiceStackLoggingBackend : TextLoggingBackend
  {
    public new ServiceStackLoggingBackendOptions Options { get; } = new ServiceStackLoggingBackendOptions();

    protected override LoggingTypeSource CreateTypeSource(LoggingNamespaceSource parent, Type type)
    {
      return new ServiceStackLoggingTypeSource(parent, type);
    }

    public override LogRecordBuilder CreateRecordBuilder()
    {
      return new ServiceStackLogRecordBuilder(this);
    }

    protected override TextLoggingBackendOptions GetTextBackendOptions()
    {
      return Options;
    }
  }
}
Overriding context classes

Contexts are typically used to represent the execution of a logged method and a custom activity. There are typically two log records per context: the entry record and the exit record. The role of context classes is to expose or store pieces of information that are shared by several records of the same context. Unless you need to store more pieces of information in the context, you do not need to extend the context classes. Most back-end implementations do not extend context classes.

Context classes all derive from the LoggingContext class. The following table lists all context classes. If you choose to derive a context class, you will also need to override the corresponding factory method in your LoggingBackend class.

Context class | Factory method | Description
SyncMethodLoggingContext | CreateSyncMethodContext(ThreadLoggingContext) | Normal method (neither async neither iterator).
AsyncMethodLoggingContext | CreateAsyncMethodContext | async method.
IteratorLoggingContext | CreateIteratorContext | Iterator method.
SyncCustomActivityLoggingContext | CreateSyncCustomActivityContext(ThreadLoggingContext) | Synchronous custom activity.
AsyncCustomActivityLoggingContext | CreateAsyncCustomActivityContext | Asynchronous custom activity.
ThreadLoggingContext | CreateThreadContext | A special kind of context that represents the roots of the context tree and contains all thread-static fields.
EphemeralLoggingContext | CreateEphemeralContext(ThreadLoggingContext) | A degenerated kind of context used when a log record is emitted out of a context, for instance when an exception record is logged without the corresponding entry record.
See Also

Other Resources

Example project: PostSharp.Samples.Logging.CustomBackend.ServiceStack
Example project: PostSharp.Samples.Logging.Customization


Upgrading from PostSharp Diagnostics 4.3

PostSharp Logging has been completely rewritten between PostSharp 4.3 and PostSharp 5.0. There are some significant breaking changes that you will need to take into account.

To migrate your logging from a previous version of PostSharp:

  1. Uninstall all PostSharp.Patterns.Diagnostics.* packages except PostSharp.Patterns.Diagnostics itself

  2. Upgrade all PostSharp packages.

  3. Add the package for your backend logging framework to the start-up project (instead of adding it to all projects prior to PostSharp 5.0) and configure it at run-time as described in Adding Detailed Logging to your Solution.

  4. Migrate the logging profiles to the new format as described in Adding Detailed Logging to your Solution. Some options that used to be accessible from logging profiles are now run-time options and are described in Customizing the Appearance of Log Records.


Handling Faults in the Logging Component

The last thing you want is to have your application to fail in production because of a failure of the logging feature. In order to prevent this from happening, PostSharp catches all exceptions that are thrown by the logging code and allows you to override the behavior.

This topic contains the following sections:

  • Default exception handling policy
  • Customizing the exception handling logic
Default exception handling policy

By default, when an exception occurs in the logging feature, the following happens:

  1. A message is logged to the Meta role. By default, the Meta role uses the default LoggingBackend, so it is likely that the logging of the logging failure will fail. It is recommended to configure the Meta logging role separately by using the following code snippet:

    C#
    Copy
    LoggingServices.Roles[LoggingRoles.Meta].Backend = new MyBackend();

  2. The whole LoggingBackend responsible for the failure is disabled, unless the reason of the failure is LoggingBackend is a defect in user code (typically an invalid use of the Logger API) and not in the logging component itself. This pattern is called a circuit breaker. You can enable the LoggingBackend again by setting the IsEnabled property to true.

Caution note Caution

When the logging exception happens during the logging of a user-code exception, the details of the logging exception are not available. The reason for this behavior is that user-code exceptions are logged from exception filters in order to preserve the call stack, and exception thrown in exception filters cannot be caught.

Customizing the exception handling logic

To override the default exception handling behavior:

  1. Create a class that implements the ILoggingExceptionHandler interface.

  2. Assign the ExceptionHandler property to an instance of your class.

The following code snippet implements an exception handler that throws an exception upon any failure. The Initialize method registers the exception handler.

C#
Copy
class ThrowLoggingExceptionHandler : ILoggingExceptionHandler
{
    public void OnInternalException( LoggingExceptionInfo exceptionInfo )
    {
        throw new Exception("Internal logging exception.", exceptionInfo.Exception);
    }

    public void OnInvalidUserCode( ref CallerInfo callerInfo, LoggingTypeSource source, string message, params object[] args )
    {
        throw new InvalidOperationException( string.Format( message, args ) );
    }

    public static void Initialize()
    {
        LoggingServices.ExceptionHandler = new ThrowLoggingExceptionHandler();
    }
}
See Also

Reference

ILoggingExceptionHandler
ExceptionHandler
LoggingBackendIsEnabled


Licensing of PostSharp Diagnostics

The way PostSharp Diagnostics is licensed differs from the other components of PostSharp. Depending on the license available during the build of your project, either PostSharp Diagnostics Developer Edition or PostSharp Diagnostics Standard Edition is selected.

This topic contains the following sections:

  • PostSharp Diagnostics Developer Edition
  • PostSharp Diagnostics Standard Edition
  • Using PostSharp Diagnostics on a Build Server
PostSharp Diagnostics Developer Edition

During a software development process, you often need to trace the project behavior in run-time. This is where you choose the PostSharp Diagnostics Developer Edition. It allows you to use the logging pattern anywhere in your project. PostSharp Diagnostics Developer Edition is free of charge and included in all PostSharp products, even the free PostSharp Essentials.

The limitation of this edition is that the logging messages will be emitted up to 24 hours after the build of your assembly. After this period of time, your application will keep working, but the logging messages will no longer be emitted.

PostSharp Diagnostics will switch itself to Developer Edition in the following situations:

  • When using PostSharp Essentials or another PostSharp product that does not include PostSharp Diagnostics.

  • When building your code on a build server, unless the license key has been added to postsharp.config.

  • When building unmodified code on the machine of an unlicensed developer, using the feature described in Sharing Source Code With Unlicensed Teams.

PostSharp Diagnostics Standard Edition

PostSharp Diagnostics Standard Edition does not have the limitations of the Developer Edition.

PostSharp Diagnostics Standard Edition is a commercial product. It can be purchased separately or as a part of PostSharp Ultimate or PostSharp Enterprise. See our web site for details regarding the PostSharp commercial offering.

Using PostSharp Diagnostics on a Build Server

If your project uses PostSharp Diagnostics and you need to build your project on a build server, you must configure a license key on the build server (regardless of the kind of license you are using). We recommend you add your license key to postsharp.config as described in Deploying License Keys.

See Also

Other Resources

Licensing
Using PostSharp on a Build Server
Sharing Source Code With Unlicensed Teams


Contracts

Throwing exceptions upon detecting a bad or unexpected value is good programming practice called precondition checking. However, writing the same checks over and over in different areas of the code base is tedious, error prone, and difficult to maintain.

PostSharp Code Contracts have the following features and benefits:

  • More readable. PostSharp Code Contracts are represented as custom attributes there is less code to read and understand.

  • Inherited. You can add a PostSharp Code Contract attribute to an interface method parameter and it will automatically be enforced in all implementations of this method.

  • Localizable. It's easy to display the error message in the user's language, even if you didn't design for this scenario upfront.

In this chapter
Section | Description
Adding Contracts to Code | This section demonstrates how to add contracts to code and how inheritance works.
Creating Custom Contracts | This section explains how to create your own contract attributes.
Localizing Contract Errors | This section describes how to customize the texts of exceptions that are thrown when a contract is violated.
See Also

Reference

RequiredAttribute
PostSharp.Patterns.Model
PostSharp.Patterns.Contracts
PostSharp.Aspects
PostSharp.Reflection
LocationContractAttribute
ErrorMessage
ILocationValidationAspect
ValidateValue(UTP, String, LocationKind)


Adding Contracts to Code

This section describes how to add a contract to a field, property, or parameter.

This topic contains the following sections:

  • Introduction
  • Adding contracts
  • Contract inheritance
Introduction

Consider the following method which checks if a valid string has been passed in:

C#
Copy
public class CustomerModel
{
  public void SetFullName(string firstName, string lastName)
  {
      if(firstName == null)
        throw NullReferenceException();

      if(lastName == null)
        throw NullReferenceException();

      this.FullName = firstName + " " + lastName;
  }
}

In this example, checks have been added to ensure that both parameters contain a valid string. A better solution is to place the logic which performs this check into its own reusable class, especially such boilerplate logic is involved, and then reuse/invoke this class whenever the check needs to be performed.

PostSharp’s Contract attributes do just that by moving such checks out of code and into parameter attributes. For example, PostSharp’s RequiredAttribute contract could be used to simplify the example as follows:

C#
Copy
public class CustomerModel
{
    public void SetFullName([Required] string firstName, [Required] string lastName)
    {
        this.FullName = firstName + " " + lastName;
    }
}

In this example, the RequiredAttribute attribute performs the check for null, thus eliminating the need to write the boiler plate code for the check in line with other code.

A contract can also be applied to a property or field as shown in the following example:

C#
Copy
public class CustomerModel
{
    [Required]
    public FirstName { get; set; }
}

Using a contract in a property ensures that the value being passed into set is validated before the logic (if any) for set is executed.

Similarly, a contract can be used directly on a field which will validate the value being assigned to the field:

C#
Copy
public class CustomerModel
{
    [Required]
    private string mFirstName = "Not filled in yet";

    public void SetFirstName(string firstName)
    {
        mFirstName = firstName;
    }
}

In this example, firstName will be validated by the Required contract before being assigned to mFirstName. Placing a contract on a field provides the added benefit of validating the field regardless of where it’s set from.

Note that PostSharp also includes a number of built-in contracts which range from checks for null values to testing for valid phone numbers. You can also develop your own contracts with custom logic for your own types as described below.

There are two ways to add contracts:

Adding contracts

To add a contract to an element of code:

  1. Add the PostSharp.Patterns.Model package to your project.

  2. Import the PostSharp.Patterns.Contracts namespace into your file:

    C#
    Copy
    import PostSharp.Patterns.Contracts;

  3. Add the contract custom attribute to the parameter, field, or property, or return value. See the PostSharp.Patterns.Contracts namespace for a list of available contract attributes. For example:

    C#
    Copy
    public void SetFullName([Required] string firstName, [Required] string lastName)
Contract inheritance

PostSharp ensures that any contracts which have been applied to an abstract, virtual, or interface method are inherited along with that method in derived classes, all without the need to re-specify the contract in the derived methods. This is shown in the following example:

C#
Copy
public interface ICustomerModel
{
  void SetFullName([Required] string firstName, [Required] string lastName);
}

public class CustomerModel : ICustomerModel
{
  public void SetFullName(string firstName, string lastName)
  {
     this.FullName = firstName + " " + lastName;
  }

}

Here ICustomerModel.SetFullName method specifies that the firstName and lastName parameters are required using the RequiredAttribute attribute. Since the CustomerModel.SetFullName method implements this method, these attributes will also be applied to its parameters.

Note Note

If the derived class exists in a separate assembly, that assembly must be processed by PostSharp and must reference the PostSharp and PostSharp.Patterns.Model package


Creating Custom Contracts

Given the benefits that contracts provide over manually checking values and throwing exceptions in code, you will likely want to implement your own contracts to perform your own custom checks and handle your own custom types.

The following steps show how to implement a contract which throws an exception if a numeric parameter is zero:

To implement a contract throwing an exception if a numeric parameter is zero:

  1. Use the following namespaces: PostSharp.Aspects and PostSharp.Reflection.

  2. Derive a class from LocationContractAttribute and override the GetErrorMessage method:

    C#
    Copy
    public class NonZeroAttribute : LocationContractAttribute
{
    public const string ErrorMessage = "NonZeroErrorMessage";

    public NonZeroAttribute()
      : base()
    {
    }

    protected override string GetErrorMessage()
    {
        return "Value {2} must have a non-zero value.";
    }
}
    Note Note

    The value returned by GetErrorMessage method can contain formatting placeholders. See the remarks section for the LocationContractAttribute class for more information.

  3. Implement the ILocationValidationAspect interface in the new contract class which exposes the ValidateValue(UTP, String, LocationKind) method. Note that this interface must be implemented for each type that is to be handled by the contract. In this example, the contract will handle both int and uint, so the interface is implemented for both integer types. If additional integer types were to be handled by this class (e.g. long), then additional implementations of ILocationValidationAspect would have to be added:

    C#
    Copy
    public class NonZeroAttribute : LocationContractAttribute, ILocationValidationAspect<int>, ILocationValidationAspect<uint>
{
    public const string ErrorMessage = "NonZeroErrorMessage";

    public NonZeroAttribute()
      : base()
    {
    }

    protected override string GetErrorMessage()
    {
       return "Value {2} must have a non-zero value.";
    }

    public Exception ValidateValue(int value, string name, LocationKind locationKind)
    {
       if (value == 0)
         return this.CreateArgumentOutOfRangeException(value, name, locationKind);
      else
         return null;
    }

    public Exception ValidateValue(uint value, string name, LocationKind locationKind)
    {
        if (value == 0)
          return this.CreateArgumentOutOfRangeException(value, name, locationKind);
        else
          return null;
    }
}

    The ValidateValue(UTP, String, LocationKind) method takes in the value to test, the name of the parameter, property or field, and the usage (i.e. whether it’s a parameter, property, or field). The method must return an exception if a check fails, or null or if no exception is to be raised.

With the contract now created it can be used. For example, the following methods, which calculate the modulus between two numbers, can use the contract defined above to ensure that neither of their input parameters are zero:

C#
Copy
bool Mod([NonZero] int number, [NonZero] int dividend)
{
  return ((number % dividend) == 0);
}

bool Mod([NonZero] uint number, [NonZero] uint dividend)
{
  return ((number % dividend) == 0);
}


Localizing Contract Errors

You can customize all texts of exceptions raised by built-in contract. This allows you to localize error messages into different languages.

Contracts use the ContractLocalizedTextProvider class to obtain the text of an error message. This class follows a simple chain of responsibilities pattern where each provider has a reference to the next provider in the chain. When a message is queried, the provider either returns a message or passes control to the next provider in the chain.

Each message is identified by a string identifier and can refer to 4 basic arguments and additional arguments specific to a message type. For general information about message arguments please see remarks section of LocationContractAttribute. For identifier of a particular message and its additional arguments, please see remarks section of contract classes in PostSharp.Patterns.Contracts.

This topic contains the following sections:

  • Localizing a built-in error message
  • Localizing custom contracts
Localizing a built-in error message

Following steps illustrate how to override an error message of a given contract:

To override a contract error message:

  1. Declare a class that derives from ContractLocalizedTextProvider and implement the chain constructor.

    C#
    Copy
    public class CzechContractLocalizedTextProvider : ContractLocalizedTextProvider
{
    public CzechContractLocalizedTextProvider(ContractLocalizedTextProvider next)
      : base(next)
    {
    }

}

  2. Implement the GetMessage(String) method. In the next code snippet, we show how to build a simple and efficient dictionary-based implementation.

    C#
    Copy
    public class CzechContractLocalizedTextProvider : ContractLocalizedTextProvider
{
      private readonly Dictionary<string, string> messages = new Dictionary<string, string>
                                    {
                                        {RegularExpressionErrorMessage, "Hodnota {2} neodpovídá regulárnímu výrazu '{4}'."},
                                    };

    public CzechContractLocalizedTextProvider(ContractLocalizedTextProvider next)
      : base(next)
    {
    }

    public override string GetMessage( string messageId )
    {
        if ( string.IsNullOrEmpty( messageId ))
            throw new ArgumentNullException("messageId");

        string message;
        if ( this.messages.TryGetValue( messageId, out message ) )
        {
            return message;
        }
        else
        {
            // Fall back to the default provider.
            return base.GetMessage( messageId );
        }
    }
}
    Note Note

    If you need to support several languages, you can make your implementation of the GetMessage(String) method depend on the value of the CultureInfoCurrentCulture property. You can optionally store your error messages in a managed resource and use the ResourceManager class to access it and manage localization issues. The design of PostSharp Code Contracts is agnostic to these decisions.

  3. In the beginning of an application, create a new instance of the provider and set the current provider as its successor.

    C#
    Copy
    public static void Main()
{
    ContractLocalizedTextProvider.Current = new CzechContractLocalizedTextProvider(ContractLocalizedTextProvider.Current);

    // ...
}
Localizing custom contracts

Once you have configured a text provider, you can use it to localize error messages of custom contracts. In the following procedure, we will localize the error message of the example contract described in Creating Custom Contracts.

To localize a custom contract:

  1. Edit the code contract class (NonZeroAttribute in our case) and replace the implementation of the GetErrorMessage method by a call to the GetMessage(String) method. Pass a unique message identifier to this method.

    Copy
    protected override string GetErrorMessage()
 {
     return ContractLocalizedTextProvider.Current.GetMessage("NonZeroErrorMessage");
 }

  2. Edit your implementation of the LocalizedTextProvider class and include the message for your custom contract:

    C#
    Copy
    private readonly Dictionary<string, string> messages = new Dictionary<string, string>
  {
     {RegularExpressionErrorMessage, "Hodnota {2} neodpovídá regulárnímu výrazu '{4}'."},
     {"NonZeroErrorMessage", "Value {2} must have a non-zero value."}
  };


INotifyPropertyChanged

Binding objects to the UI is a large and tedious task. You must implement INotifyPropertyChanged on every property that needs to be bound. You need to ensure that the underlying property setter correctly raises events so that the View knows that changes have occurred. The larger your codebase, the more work there is. You can partially eliminate all of this repetitive code by pushing some of the functionality to a base class that each Model class inherits from. It still doesn't eliminate all of the repetition though.

PostSharp can completely eliminate all of that repetition for you. PostSharp's NotifyPropertyChangedAttribute has the following features and benefits:

  • Supports computed properties.

  • Supports computed properties referencing child objects, e.g. string FullName => this.model.FirstName + " " + this.model.LastName.

  • Raises the PropertyChanged at the right moment, when all class invariants are valid.

  • Fully customizable. Can be integrated with other MVVM frameworks.

  • High-performance. Almost as fast as handwritten code.

In this chapter
Topic | Description
Implementing INotifyPropertyChanged | This section shows how to automatically implement the INotifyPropertyChanged interface in a class thanks to the NotifyPropertyChangedAttribute aspect.
Working with Properties that Depend on Other Objects | This section describes how to handle dependencies that cross several objects, as when a view-model object is dependent on properties of a model object.
Implementing INotifyPropertyChanging | This section documents how to implement the INotifyPropertyChanging interface for components which need to be signalled before a property value is changed.
Integrating with UI Frameworks | This section shows examples of using the NotifyPropertyChangedAttribute aspect with some of the popular UI frameworks.
Handling Corner Cases | This section documents how to cope with the cases that cannot be automatically handled by the NotifyPropertyChangedAttribute aspect.
Understanding the NotifyPropertyChanged Aspect | This section describes the principles and concepts on which the NotifyPropertyChangedAttribute aspect relies.
Suppressing False Positives | This section shows how to prevent notifications when the property value does not actually change.


Implementing INotifyPropertyChanged

This section shows how to make your class automatically implements the INotifyPropertyChanged interface NotifyPropertyChangedAttribute aspect.

This topic contains the following sections:

  • Adding the NotifyPropertyChanged aspect
  • Consuming the INotifyPropertyChanged interface
Adding the NotifyPropertyChanged aspect

To add INotifyPropertyChanged aspect:

  1. Use NuGet Package Manager to add the PostSharp.Patterns.Model package to your project.

  2. Import the PostSharp.Patterns.Model namespace into your file.

  3. Add the [NotifyPropertyChanged] custom attribute to the class.

By using the Model Pattern Library to add NotifyPropertyChangedAttribute to your Model classes you are able to eliminate all of the repetitive boilerplate coding tasks and code from the codebase.

Note Note

This procedure has added NotifyPropertyChangedAttribute to one class. If you need to implement NotifyPropertyChangedAttribute to many different classes in your codebase you will want to read about using aspect multicasting. See the section Adding Aspects to Multiple Declarations.

Example

C#
Copy
[NotifyPropertyChanged]
public class CustomerForEditing
{
    public string FirstName { get; set; }
    public string LastName { get; set; }

    public string FullName
    {
        get { return string.Format("{0} {1}", this.FirstName, this.LastName); }
    }

}
Consuming the INotifyPropertyChanged interface

Since the INotifyPropertyChanged interface is implemented by PostSharp at build time after the compiler has completed, the interface will neither be visible to Intellisense or other tools like Resharper, neither to the compiler. The same is true for the PropertyChanged event.

In many cases, this limitation does not matter because the interface is consumed from a framework (like WPF) that is not coupled with your project. However, in some situations, you may need to access the INotifyPropertyChanged interface.

There are two ways to access the INotifyPropertyChanged interface from your code:

  • You can cast your object to INotifyPropertyChanged, for instance:

    C#
    Copy
    ((INotifyPropertyChanged) obj).PropertyChanged += obj_OnPropertyChanged;

    If your tooling complains that the object does not implement the interface, you can first cast to object:

    C#
    Copy
    ((INotifyPropertyChanged) (object) obj).PropertyChanged += obj_OnPropertyChanged;

  • You can use the PostCastSourceType, TargetType(SourceType) method. The benefit of using this method is that the cast operation is validated by PostSharp, to the build will fail if you try to cast an object that does not implement the INotifyPropertyChanged interface. For instance:

    C#
    Copy
    Post.Cast<Foo,INotifyPropertyChanged>(obj).PropertyChanged += obj_OnPropertyChanged;
See Also

Reference

INotifyPropertyChanged
NotifyPropertyChangedAttribute

Other Resources

Adding Aspects to Multiple Declarations


Implementing INotifyPropertyChanged with Properties that Depend on Other Objects

It’s very common for the properties of one class to be dependent on the properties of another class. For example, a view-model layer will often contain a reference to a model object, and public properties which are, in turn, forwarded to the underlying properties of this referenced object. In this scenario, the view-model component’s properties have a dependency on the referenced model’s properties. Subsequently, the referenced model may also have properties which depend on the properties of other objects.

PostSharp easily handles transitive dependencies that follow the this.field.Property.Property form. Simply add the NotifyPropertyChangedAttribute class attribute to each class in the dependency chain. This will ensure that property change notifications are propagated up and down the dependency chain. PostSharp takes care of the rest and will even handle circular dependencies.

Note Note

Read the article Handling Corner Cases to learn about referencing more complex properties that do not follow the this.field.Property.Property form.

Example

In the following example, the CustomerModel class is used as a dependency of a CustomerViewModel class containing FirstName and LastName properties, both of which directly map to properties of the CustomerModel class, and a public read only property called FullName, which is calculated based on the value of the underlying customer’s FirstName and LastName properties.

C#
Copy
[NotifyPropertyChanged]
public class CustomerModel
{
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public string Phone { get; set; }
    public string Mobile { get; set; }
    public string Email { get; set; }
}

[NotifyPropertyChanged]
class CustomerViewModel
{
    CustomerModel model;

    public CustomerViewModel(CustomerModel m)
    {
        this.model = m;
    }

    public string FirstName { get { return this.model.FirstName; } set { this.model.FirstName = value;}}
    public string LastName { get { return this.model.LastName; } set { this.model.LastName = value; }}
    public string FullName { get { return string.Format("{0} {1}", this.model.FirstName, this.model.LastName); } }

}

You now have a view-model class which can be used to bridge a view (e.g. an application’s user interface) with the underlying data, and calls to get/set will be propagated across the chain of dependencies.

See Also

Reference

NotifyPropertyChangedAttribute

Other Resources

Handling Corner Cases


Implementing INotifyPropertyChanging

By convention, the PropertyChanged event must be raised after the property value has changed. However, some components need to be signaled before the property value will be changed. This is the role of the INotifyPropertyChanging interface.

Because the INotifyPropertyChanging interface is not portable (in Xamarin, it is even a part of a different namespace), PostSharp cannot introduce it. However, if you implement the INotifyPropertyChanging interface yourself in your code, PostSharp will signal the PropertyChanging event. To make that work, you need to create an OnPropertyChanging method with the right signature.

To add the INotifyPropertyChanging interface to a class:

  1. Make your class implement INotifyPropertyChanging and add the PropertyChanging event.

  2. Add the OnPropertyChanging method with exactly the following signature, and invoke the PropertyChanging event.

    C#
    Copy
    protected void OnPropertyChanging( string propertyName )
{
    if ( this.PropertyChanging != null )
    {
      this.PropertyChanging( this, new PropertyChangingEventArgs ( propertyName ) );
    }
}

  3. Add the NotifyPropertyChangedAttribute aspect to your class as described in INotifyPropertyChanged.

Note Note

The contract between your class and the NotifyPropertyChangedAttribute is only the OnPropertyChanging method. As long as this method exists in the class, it will be invoked by the aspect before the value of a property changes.

Example

The following example demonstrates how to implement INotifyPropertyChanging.

C#
Copy
[NotifyPropertyChanged]
public class MyClass : INotifyPropertyChanging
{
    public event PropertyChangingEventHandler PropertyChanging;

    protected void OnPropertyChanging( string propertyName )
    {
       if ( this.PropertyChanging != null )
       {
          this.PropertyChanging( this, new PropertyChangingEventArgs ( propertyName ) );
       }
    }

    public string MyProperty { get; set; }
}


Handling Corner Cases of the NotifyPropertyChanged Aspect

PostSharp includes a number of attributes for customizing the default behavior and for handling special dependencies.

This topic contains the following sections:

  • Ignoring changes to properties
  • Handling virtual calls, delegates, external methods, or complex data flows
  • Handling dependencies on pure methods
Ignoring changes to properties

Use the IgnoreAutoChangeNotificationAttribute class attribute to prevent an OnPropertyChanged event from being invoked when setting a property.

Example

In this example, the CustomerModel class contains a Country property amongst others. To prevent a property notification from being invoked when the value of this property is set, simply place the IgnoreAutoChangeNotificationAttribute attribute above the property.

C#
Copy
[NotifyPropertyChanged]
public class CustomerModel
{
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public string Phone { get; set; }
    public string Mobile { get; set; }
    public string Email { get; set; }

    [IgnoreAutoChangeNotification]
    public string Country { get; set;}
}
Handling virtual calls, delegates, external methods, or complex data flows

If a property getter calls a virtual method from its class or a delegate, or references a property of another object (without using canonical form this.field.Property), PostSharp will generate an error because it cannot resolve such a dependency at build time. The same limitations apply when your property getter contains complex data flows, such as loops, or calls to methods (except property getters) of other classes.

When this happens, you can either refactor your code so that it can be automatically analyzed by PostSharp, or you can take over the responsibility for analyzing the code.

Taking responsibility for dependency analysis

To suppress the error that PostSharp emits when it is unable to fully analyze your code, add the SafeForDependencyAnalysisAttribute custom attribute to the property accessor (or in any method used by the property accessor).

Note Note

By using SafeForDependencyAnalysisAttribute, you are taking the responsibility that your code only has dependencies that are given either in the canonical form of this.field.Property either explicitly using the DependsOn construct (see below). If you are using this custom attribute but have non-canonical dependencies, some property changes may not be detected in which case no notification will be generated.

Adding dependencies manually

Even when a method has the SafeForDependencyAnalysisAttribute attribute, PostSharp still discovers the dependencies that are in canonical form this.field.Property. However, PostSharp does not discover dependencies hidden under delegate or virtual method calls.

To explicitly add a dependency to a property, you can use the DependsOn method. The expression passed to the DependsOn must be in canonical form this.field.Property, i.e. Depends.On( this.field.Property ).

Example

In the following example, the CustomerModel class contains a virtual method called ValidateCountry which is used by the get accessor of its Country property. The presence of the call to the virtual method prevents PostSharp from fully understanding the dependencies of the Country property. PostSharp discovers the dependency to the _country field but cannot analyze the implementations of the ValidateCountry method, and therefore emits an error. By adding the SafeForDependencyAnalysisAttribute attribute, to the Country property, you remove the error.

Even if you remove the error, PostSharp still analyzes the Country property getter and finds the dependency on the _country field. However, it does not follow the call to the ValidateCountry method and does not find the dependency to the Continent property. That is why we have to add this dependency manually by calling the Depends.On method.

C#
Copy
[NotifyPropertyChanged]
public class Address
{
  string _country;
  public string Continent { get; set; }

  public virtual bool ValidateCountry(string country)
  {
     return GeoService.ContinentContains( this.Continent, country );
  }

  [SafeForDependencyAnalysisAttribute]
  public string Country
  {
    get
    {
      Depends.On( this.Continent );

      if(this.ValidateCountry(_country))
        return _country;
      else
        return "Lilliput";
    }

    set;
  }
}
Handling dependencies on pure methods

Often times a property will depend on a method which is solely dependent on its input parameters to produce a return value. These methods are called pure and do not need to be analyzed. To mark a method as pure, use the PureAttribute custom attribute.

Example

Consider the following variation to CustomerModel where the ValidPhoneNumber property logic has been moved into a static method called GetValidPhoneNumber() which exists in a separate helper class called ContactHelper:

Since GetValidPhoneNumber() is a standalone method of another class, it is not analyzed. Therefore the PureAttribute attribute needs to be applied to this method to acknowledge this dependency.

C#
Copy
public class ContactHelper
{
  [Pure]
  public static string GetValidPhoneNumber(string firstPhoneNumber, string secondPhoneNumber)
  {
    return firstPhoneNumber ?? secondPhoneNumber;
  }
}

[NotifyPropertyChanged]
public class CustomerModel
{
  public Contact PrimaryContact {get; set;}
  public Contact SecondaryContact {get; set;}

  public string ValidPhoneNumber
  {
    get {
      return ContactHelper.GetValidPhoneNumber(this.PrimaryContact.Phone, this.SecondaryContact.Phone);
    }
  }
}
See Also

Reference

PureAttribute
IgnoreAutoChangeNotificationAttribute
SafeForDependencyAnalysisAttribute
DependsOn
Depends


Integrating the NotifyPropertyChanged Aspect with UI Frameworks

There are frameworks that help you to create XAML applications including binding of objects in a simplified way. But usually, you still need to include some repetitive code anyway.

PostSharp can eliminate most of that repetition for you. All you have to do is make use of the NotifyPropertyChangedAttribute aspect.

In this chapter, you can find examples of using the NotifyPropertyChangedAttribute aspect with some of the popular UI frameworks.

This list of supported frameworks is not exhaustive. If the framework you are using is not listed here, it does not necessarily mean that PostSharp will not work with the framework.

In this chapter
Topic | Description
Caliburn.Micro | This section shows how to use the NotifyPropertyChangedAttribute aspect with the Caliburn.Micro framework.
MVVM Light | This section shows how to use the NotifyPropertyChangedAttribute aspect with the MVVM Light Toolkit.


INotifyPropertyChanged and Caliburn.Micro

Caliburn.Micro is a popular framework designed for building applications across all XAML platforms. Caliburn.Micro includes several features, and one of those is to simplify the implementation of the INotifyPropertyChanged interface. However, Caliburn.Micro still requires you to write a lot of boilerplate code. This article shows how to use PostSharp together with Caliburn.Micro, whether because you are upgrading an existing project that already uses this framework or because you want to use the other features of Caliburn.Micro.

Without PostSharp

The example below shows a View-Model implemented according to the Caliburn.Micro specification. The class ShellViewModel inherits from the class PropertyChangedBase, which implements the INotifyPropertyChanged interface and thus is already helping you to use the Notify Property Changed pattern.

On the other hand, there is still part of the boilerplate usually appearing within the NotifyPropertyChanged pattern. For each property, you must have an explicit field, and you must manually notify all dependencies and the property itself. The result is not only more code written, but also a big space for bugs because you must discover and maintain the chain of dependent properties yourself.

C#
Copy
using Caliburn.Micro;
using System.Windows;

namespace CaliburnMicroWithPostSharp
{
    public class ShellViewModel : PropertyChangedBase
    {
        string name;

        public string Name
        {
            get { return this.name; }
            set
            {
                this.name = value;
                this.NotifyOfPropertyChange( () => this.Name );
                this.NotifyOfPropertyChange( () => this.CanSayHello );
            }
        }

        public bool CanSayHello => !string.IsNullOrWhiteSpace( this.Name );

        public void SayHello()
        {
            MessageBox.Show( $"Hello {this.Name}!" );
        }
    }
}
With PostSharp

With PostSharp, you don’t need to do any of that. You just indicate which classes should have the NotifyPropertyChanged pattern implemented using the NotifyPropertyChangedAttribute attribute and PostSharp does the hard work for you. You can see the difference in the second example, where the previous code got refactored keeping the same functionality.

C#
Copy
using System.Windows;
using PostSharp.Patterns.Model;

namespace CaliburnMicroWithPostSharp
{
    [NotifyPropertyChanged]
    public class ShellViewModel : PropertyChangedBase
    {
        public string Name { get; set; }

        public bool CanSayHello => !string.IsNullOrWhiteSpace( this.Name );

        public void SayHello()
        {
            MessageBox.Show( $"Hello {this.Name}!" );
        }
    }
}

Note that it is no longer necessary to derive your class from the PropertyChangedBase class. Even if you suppress the inheritance from PropertyChangedBase class, you can still use other Caliburn.Micro features in your code such as commands. However, if you do keep the inheritance from PropertyChangedBase, the NotifyPropertyChangedAttribute aspect will invoke the NotifyOfPropertyChange method of the PropertyChangedBase class, consistently with the coding practices of Caliburn.Micro.


INotifyPropertyChanged and MVVM Light Toolkit

MVVM Light is a framework that helps you build XAML applications according to the Model-View-View-Model architectural pattern. MVVM Light includes several features, and one of those is to simplify the implementation of the INotifyPropertyChanged interface. However, MVVM Light still requires you to write a lot of boilerplate code. This article shows how to use PostSharp together with MVVM Light, whether because you are upgrading an existing project that already uses this framework or because you want to use the other features of MVVM Light.

Without PostSharp

In the example below, there is a View-Model implemented according to the MVVM Light Toolkit specification. The class MainViewModel inherits from the class ViewModelBase, which implements the INotifyPropertyChanged interface and thus is already helping you to use the Notify Property Changed pattern.

On the other hand, there is still part of the boilerplate usually appearing within the NotifyPropertyChanged pattern. For each property, you must have an explicit field, and you must manually notify all dependencies and the property itself. The result is not only more code written, but also a big space for bugs because you must discover and maintain the chain of dependent properties yourself.

C#
Copy
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using System.Windows.Input;
using System.Windows;

namespace MvvmLightTest.ViewModel
{
    public class MainViewModel : ViewModelBase
    {
        int _exampleValue;

        public int ExampleValue
        {
            get
            {
                return _exampleValue;
            }
            set
            {
                if (_exampleValue == value)
                    return;
                _exampleValue = value;
                RaisePropertyChanged("ExampleValue");
            }
        }

    }
}
With PostSharp

With PostSharp, you don’t need to do any of that. You just indicate which classes should have the NotifyPropertyChanged pattern implemented using the NotifyPropertyChangedAttribute attribute and PostSharp does the hard work for you. You can see the difference in the second example, where the previous code got refactored keeping the same functionality.

C#
Copy
using GalaSoft.MvvmLight.Command;
using System.Windows.Input;
using System.Windows;
using PostSharp.Patterns.Model;

namespace MvvmLightTest.ViewModel
{
    [NotifyPropertyChanged]
    public class MainViewModel : ViewModelBase
    {
        public int ExampleValue { get; set; }
    }
}

Note that it is no longer necessary to derive your class from the ViewModelBase class. Even if you suppress the inheritance from ViewModelBase class, you can still use other MVVM Light features in your code such as commands. However, if you do keep the inheritance from ViewModelBase, the NotifyPropertyChangedAttribute aspect will invoke the RaisePropertyChanged method of the ViewModelBase class, consistently with the coding practices of MVVM Light.


Understanding the NotifyPropertyChanged Aspect

This section describes the principles and algorithm on which the NotifyPropertyChangedAttribute aspect is based. It helps developers and architects to understand the behavior and limitation of the aspect.

This topic contains the following sections:

  • Implementation of the INotifyPropertyChanged interface
  • Instrumentation of fields
  • Analysis of field-property dependencies
  • Limitations
  • Raising notifications
  • Remarks
Implementation of the INotifyPropertyChanged interface

The NotifyPropertyChangedAttribute aspect introduces the INotifyPropertyChanged interface to the target class unless the target class already implements the interface. Additionally, the aspect also introduces the OnPropertyChanged(String) method. The aspect always introduces this method as protected and virtual, so it can be overridden in derived classes.

If the target class already implements the INotifyPropertyChanged interface, the aspect requires the class to expose the OnPropertyChanged(String) method.

The aspect uses the OnPropertyChanged(String) to raise the PropertyChanged event. Thanks to this method, the aspect is able to raise the event even when the INotifyPropertyChanged is not implemented by the aspect. This mechanism also allows user code to raise notifications that are not automatically handled by the NotifyPropertyChangedAttribute aspect.

Instrumentation of fields

Although most implementations the INotifyPropertyChanged interface rely on instrumenting the property setter, this strategy has severe limitations: it is unable to handle composite properties, which return a value based on several other fields or properties. Composite properties have no setter, rendering this strategy unusable.

Instead, the NotifyPropertyChangedAttribute aspect instruments all write operations to fields (for instance a FullName property appending FirstName and LastName). It analyzes dependencies between fields and properties and raises a change notification for any property affected by a change in this specific field.

All methods, and not just property setters, can make a change to a field and therefore cause the PropertyChanged event to be raised. Property setters do not have any specific status in the NotifyPropertyChangedAttribute implementation.

Analysis of field-property dependencies

In order to adequately raise the PropertyChanged event, the NotifyPropertyChangedAttribute aspect needs to know which properties are affected by a change of a class field. The field-property dependency map is created at build time by analyzing the source code: the analyzer reads the getter of all properties and check for field references. The map is then serialized inside the assembly and used at run time to raise relevant events when a field has changed.

Dependencies on fields of the current object

Consider the following code snippet:

C#
Copy
[NotifyPropertyChanged]
class Invoice
{
  private decimal _amount;
  private decimal _tax;

  public decimal Amount { get { return this._amount; } set { this._amount = value; } }
  public decimal Tax { get { return this._tax; } set { this._tax = value; } }

  public void Set( decimal amount, decimal tax )
  {
     this._amount = amount;
     this._tax = tax;
  }

  public decimal Total { get { return this._amount + this._tax; } }
}

The result of the analysis for the code snippet above would be the map { _amount => ( Amount, Total ), _tax => ( Tax, Total ) }. Whenever the _amount field is changed, the PropertyChanged event will be raised for properties Amount and Total.

Automatic properties are processed as handwritten properties; in this case, the implicit backing field is taken into account for the dependency analysis.

Recursive analysis of the call graph

Field references are not only looked for in the getter, but in any method invoked from the getter, and recursively.

Consider the following code snippet:

C#
Copy
[NotifyPropertyChanged]
class Invoice
{
  private decimal _amount;
  private decimal _exchangeRate;

  public decimal Amount { get { return this._amount; } set { this._amount = value; } }
  public decimal ExchangeRate { get { return this._exchangeRate; } set { this._exchangeRate = value; } }

  private decimal Convert( decimal amount )
  {
    return amount * this.ExchangeRate;
  }

  public int AmountBase { get { return this.Convert( this.Amount ); } }

}

In the code snippet above, the analyzer starts from the getter of the AmountBase property, follows the call to the Amount property getter, then call to the AmountBase method and recursively follows the ExchangeRate property getter. Therefore, the resulting property map remains { _amount => ( Amount, AmountBase ), _exchangeRate => ( ExchangeRate, AmountBase ) }.

Dependencies on properties of external objects

The NotifyPropertyChangedAttribute aspect does not just handle dependencies between a property and a field of the same class. It also handles dependencies on properties of properties or properties of fields, and recursively. That is, it supports expressions of the form _f.P1.P2.P3 where _f is a field or property and P1, P2 and P3 are properties.

Consider the following code snippet:

C#
Copy
[NotifyPropertyChanged]
class InvoiceModel
{
  private decimal _amount;
  private decimal _tax;

  public decimal Amount { get { return this._amount; } set { this._amount = value; } }
  public decimal Tax { get { return this._tax; } set { this._tax = value; } }
}

[NotifyPropertyChanged]
class InvoiceViewModel
{
  InvoiceModel _model;

  public InvoiceModel Model { get { return this._model; } }

  public decimal Total { get { return this._model.Amount + this.Model.Tax; } }

}

In the example above, the InvoiceViewModel.Total property is dependent on properties Amount and Tax of the _model field. Therefore, changes in the InvoiceModel._amount field will trigger a change notification for the InvoiceModel.Amount and InvoiceViewModel.Total properties.

The NotifyPropertyChangedAttribute aspect automatically subscribes to the PropertyChanged event of the child object, and unsubscribes whenever the value of the field in the parent object (_model in our example) is modified. However, the parent object does not unsubscribe upon disposal because the NotifyPropertyChangedAttribute makes no assumption that the IDisposable interface has been implemented. Therefore, the implementation of the INotifyPropertyChanged of the external object must hold weak references to clients of the PropertyChanged event.

Recursive dependencies to external objects are handled thanks to an auxiliary interface named INotifyChildPropertyChanged. This interface is implemented by the NotifyPropertyChangedAttribute aspect. It is considered an implementation detail and cannot be implemented manually. Classes that do not implement the INotifyChildPropertyChanged interface can only participate as terminal dependencies, i.e. they can be leaves but not intermediate nodes.

Limitations

The design goal of the NotifyPropertyChangedAttribute aspect is to be able to handle the majority of use cases in real-world source code while requiring only an acceptable amount of compilation time. The dependency analysis algorithm imposes several limitations:

  • Calls to virtual methods (other than through the base keyword), abstract methods, interface methods or delegates are not supported.

  • Calls to static methods or methods of external classes are not supported unless they are decorated with the PureAttribute custom attribute, or unless the method is a property getter in a supported dependency chain.

  • Valuations of properties method return values are not supported. Only properties of fields or properties are supported.

  • Dependencies on properties of variables are not supported if the variable is assigned in a loop (while, for, ...) or in an exception handling block.

See Handling Corner Cases to learn how to cope with these limitations.

Raising notifications

Simplistic implementations of the INotifyPropertyChanged interface signal a change notification immediately after a property has been changed. However, this strategy may cause subtle errors in client code.

Consider the following code:

C#
Copy
[NotifyPropertyChanged]
class Invoice
{
  public decimal Amount { get; private set; }
  public decimal Tax { get; private set; }
  public decimal Total { get; private set; }

  public void Set( decimal amount, decimal tax )
  {
    /* 1 */ this.Amount = amount;
    /* 2 */ this.Tax = tax;
    /* 3 */ this.Total = amount + tax;
  }

}

As a class invariant, the assumption Total == Amount + Tax should always be true.

However, suppose that the PropertyChanged event is raised immediately after the Amount property is set at line 1 of the Set method. Clearly, for a client subscribing to this event, the class invariant would be broken at this specific moment.

Therefore, it is not safe to raise change notifications immediately after a change has been achieved. It is necessary to wait until the object can be safely observed by external code, when all class invariants are valid again (i.e. when the object state is consistent). A common best practice in object-oriented programming is to ensure that class invariants are valid before the control flow goes back from the current object to the caller. Typically, it means that a private or protected method can exit with an inconsistent object state, but public and internal methods must guarantee that the object state is consistent upon exit.

The NotifyPropertyChangedAttribute aspect relies on this best practice and raises the property change notifications just before the control flow exits the current object, that is, just before the last public or internal method in the call stack for the current object exits.

Besides avoiding to expose invalid object state, this strategy also avoids the same property to be notified for change several times during the execution of a single public method, which a potentially great positive performance impact.

To solve this problem, NotifyPropertyChangedAttribute aspect uses the following strategy:

  1. Instead of causing immediate change notifications, field changes are buffered into a thread-local storage named the accumulator.

  2. Calls to public and methods are instrumented so the aspect can detect when the control flow exits the object. At this moment, the accumulator is flushed and all change notifications are triggered.

It is possible to flush the accumulator at any time by invoking the NotifyPropertyChangedServicesRaiseEventsImmediate(Object) method.

You can suspend and resume notifications using the NotifyPropertyChangedServicesSuspendEvents and NotifyPropertyChangedServicesResumeEvents methods.

Remarks

The NotifyPropertyChangedAttribute aspect never evaluates property getters at run time. This decision is deliberate and aims at avoiding possible side-effects (lazy-initialization, logging, etc.). Therefore, it is possible that the algorithms emit false positives, i.e. change notifications for properties whose values did not actually change.

The algorithm heuristically detects dependency cycles. If a cycle is detected, an exception is thrown instead of allowing for an infinite update cycle.

All notifications are invoked on the thread on which the change is being made. The accumulator that buffers the changes is a thread-local storage.


Suppressing False Positives of the NotifyPropertyChanged Aspect

The NotifyPropertyChangedAttribute aspect, when applied to a class, raises the PropertyChanged event every time it detects a possible change of a property, even when the actual value of the property doesn't change. By default, the aspect doesn’t keep track of the property values because that would require the aspect to invoke property getters arbitrarily outside of the developer’s control. And when property getters have any side effects (lazy-initialization, logging, etc.), invoking them randomly is not a safe behavior.

In certain scenarios, such as rich client applications with many UI controls, redundant event notifications are not desired because they cause excessive UI updates and can degrade the application responsiveness. You can avoid these redundant event notifications by suppressing false positives in the NotifyPropertyChangedAttribute aspect.

This topic contains the following sections:

  • Example of a false positive
  • How to suppress false positives
Example of a false positive

The following Calc class has two integer fields a and b, and a property Sum that returns the sum of these two numbers. The Main method creates an instance of the Calc class and changes the fields from (a=1, b=2) to (a=2, b=1). There are two PropertyChanged event notifications shown in the output, even though the actual Sum value doesn’t change in the second case.

C#
Copy
[NotifyPropertyChanged]
class Calc
{
    private int a, b;

    public int Sum
    {
        get { return this.a + this.b; }
    }

    public void Update(int a1, int b1)
    {
        this.a = a1;
        this.b = b1;
    }
}

static void Main()
{
    Calc calc = new Calc();
    ((INotifyChildPropertyChanged) calc).PropertyChanged +=
        (sender, eventArgs) =>
        {
            Console.WriteLine("Property {0} changed. New value = {1}.",
                eventArgs.PropertyName,
                sender.GetType().GetProperty(eventArgs.PropertyName).GetValue(sender));
        };

    calc.Update(1, 2);
    calc.Update(2, 1);
}

Output:

Copy
Property Sum changed. Value = 3.
Property Sum changed. Value = 3.
How to suppress false positives

To suppress false positive event notifications, set the PreventFalsePositives property to true when you apply the aspect to the target element.

C#
Copy
[NotifyPropertyChanged(PreventFalsePositives = true)]
class Calc
{
    // ...
}

If you run the test code snippet again after this change, you can see that there’s only one change notification now.

Copy
Property Sum changed. Value = 3.
Caution note Caution

Do not suppress false positive notifications in your class when the property getters in the class have side effects. In this case, reset the PreventFalsePositives property to its default value of false.

By enabling the PreventFalsePositives option of the NotifyPropertyChangedAttribute aspect you can reduce the number of events raised in your application and improve your UI responsiveness.

See Also

Reference

INotifyPropertyChanged
NotifyPropertyChangedAttribute

Other Resources

Understanding the NotifyPropertyChanged Aspect


Weak Event

Event handlers are often source of memory leaks in .NET. The reason is that the standard .NET event implementation holds a strong reference to the delegates registered as event handlers, which, in turn, hold a strong reference to the event client. As a result, event clients are not garbage collected as long as the event source is alive unless the event client delegate is unregistered from the event. Junior developers are often unaware of this reality, which is why this is a frequent cause of memory leaks.

The WeakEventAttribute aspect solves this problem by changing the implementation of the events to which it is applied. Instead of holding a strong reference to the delegates, a weak event holds only a weak reference, and therefore does not prevent the event client from being garbage collected. The WeakEventAttribute aspect also ensures that delegates of an instance method are not collected until the instance itself is alive.

This topic contains the following sections:

  • Making an event a weak event
  • Making all events weak events
Making an event a weak event

To turn event into a weak event:

  1. Add a reference to the PostSharp.Patterns.Model package to your project.

  2. Add a reference to the PostSharp.Patterns.Model namespace to your file.

  3. Add the WeakEventAttribute custom attribute to your event.

Classes consuming weak events can register events as usual and do not need to take care of unregistering the event handler, unless the event handler needs to be unregistered before then end of the consuming class lifetime. It is not necessary to implement IDisposable to unregister the event handlers because this is automatically done during garbage collection.

Example

The following code snippet shows a weak event named MyEvent and an event client named MyEventClient. Note that the MyEventClient does not need to take care of unregistering the OnMyEvent event handler.

C#
Copy
using PostSharp.Patterns.Model;

static class MyEventSource
{
   [WeakEvent]
   public static event EventHandler MyEvent;
}

class MyEventClient
{

  public MyEventClient()
  {
     MyEventSource.MyEvent += OnMyEvent;
  }

  public void OnMyEvent(object sender, EventArgs e)
  {
      Console.WriteLine("Oops!");
  }

}
Making all events weak events

Since there are very few situations that you would actually not want an event to be a weak event, you may want to make all events of a project weak events by default. You can achieve this using aspect multicasting. See Adding Aspects to Multiple Declarations for details.

The following code snippet makes all events of the current assembly weak events:

C#
Copy
[assembly: PostSharp.Patterns.Model.WeakEvent]

The following code snippet makes all events of a specific namespace weak events:

C#
Copy
[assembly: PostSharp.Patterns.Model.WeakEvent(AttributeTargetTypes="OurCompany.OurApplication.ViewModel.*")]


XAML

This chapter covers the aspects that specific to XAML applications.

In this chapter
Section | Description
Command | This section shows how to implement the command pattern for the ICommand properties of your view model classes.
Dependency Property | This section shows how to use the DependencyPropertyAttribute aspect to turn simple properties into fully-featured dependency properties that support data binding, validation, styling, etc.
Attached Property | This section shows how to use the AttachedPropertyAttribute aspect to turn the simple properties into attached properties that are used in XAML to set the value on any object.

Additionally, if you are writing a XAML application, you may be interested in the following aspects:

Chapter | Description
INotifyPropertyChanged | This chapter shows how to automatically implement the INotifyPropertyChanged interface without boilerplate code.
Contracts | This chapter describes how to validate the value of your fields, properties and parameters with custom attributes.
Weak Event | This article shows how to turn normal events into weak events and prevent memory leaks.
Undo/Redo | This chapter explains how to add undo/redo to your application with a minimum of handwritten code.


Command

In the GUI applications built using MVVM pattern, it's common for the view model class to define commands that can be performed by the user in the associated XAML view. These commands are implemented as nested classes of the view model classes, and require a lot of boilerplate code.

The CommandAttribute aspect allows you to implement commands in your view model classes without adding nested classes, with greatly reduces boilerplate code. The aspect also integrates with the NotifyPropertyChangedAttribute aspect, which makes it much easier to implement the CanExecute logic.

This topic contains the following sections:

  • Creating a simple command
  • Determining whether your command can be executed
  • Overriding naming conventions
Creating a simple command

To add a command named LoadContactsList to your view model class

  1. Implement the command logic in the ExecuteLoadContactsList method in your view model class. This method will be the equivalent to the ICommandExecute(Object) method.

    Optionally, the Execute method can have one parameter of any type, which becomes the command parameter.

  2. Add a LoadContactsListCommand property to your view model class and mark it with the CommandAttribute attribute. The property must be of type ICommand and have both a getter and a setter.

Example

The following code snippet defines a dependency property named LoadContactsList.

C#
Copy
[Command]
public ICommand LoadContactsListCommand { get; private set; }

public void ExecuteLoadContactsList()
{
    // ...
}

After adding a new command to your view model class you can bind it to a UI control in your XAML code.

XAML
Copy
<Button x:Name="LoadButton" Content="Load contacts" Command="{Binding LoadContactsListCommand}"
  HorizontalAlignment="Left" Margin="361,10,0,0" VerticalAlignment="Top" Width="85" Height="20"/>
Determining whether your command can be executed

The UI controls in the GUI application can be enabled or disabled based on what actions are available to the user in the current state of the application. This feature is usually implemented by the ICommandCanExecute(Object) method.

The CommandAttribute aspect provides a clean way to determine the availability of the actions. For each command in your view model class, you can implement a CanExecute property or method that validates whether this command can be currently executed.

Adding a CanExecute property

To allow the view to determine the availability of the CreateContact command, simply add a public bool property named CanExecuteCreateContact to the same class.

C#
Copy
[Command]
public ICommand CreateContactCommand { get; private set; }

public bool CanExecuteCreateContact
{
    get
    {
        bool canCreateContact = true;
        // ...
        return canCreateContact;
    }
}

public void ExecuteCreateContact()
{
    // ...
}

The CanExecute properties associated with the commands support the NotifyPropertyChangedAttribute aspect. Therefore, if you add the NotifyPropertyChangedAttribute aspect to the view model class, the UI will be notified of changes in the CanExecute properties.

Adding a CanExecute method

A limitation of the CanExecute is that they cannot depend on the input argument of the command. For example, with the DeleteContact command, you may want to validate whether the current user has the permission to delete the currently selected contact. If your availability logic depends on the input argument, you must use a CanExecute method instead of a property.

To allow the UI to determine the availability of the DeleteContact command, add a CanExecuteDeleteContact method to the view model class. The method must have one parameter and return a bool value. The parameter type must be assignable from the type of the command's input argument.

C#
Copy
[Command]
public ICommand DeleteContactCommand { get; private set; }

public bool CanExecuteDeleteContact(int contactId)
{
    bool canDeleteContact = true;
    // ...
    return canDeleteContact;
}

public void ExecuteDeleteContact(int contactId)
{
    // ...
}
Overriding naming conventions

The CommandAttribute aspect follows a predefined naming convention when looking for methods and properties associated with the command in your view model class. You can override the naming convention and choose your own member names by setting properties on the CommandAttribute. The following table shows the default naming convention and the properties used to override member names.

Command pattern's naming conventions
Member kind | Default name | Example | Override property
Command property | CommandName -or- CommandNameCommand | UpdateContact -or- UpdateContactCommand | N/A
Execute method | ExecuteCommandName | ExecuteUpdateContact | ExecuteMethod
CanExecute method | CanExecuteCommandName | CanExecuteUpdateContact | CanExecuteMethod
CanExecute property | CanExecuteCommandName | CanExecuteUpdateContact | CanExecuteProperty

The following examples shows a command that does not respect naming conventions.

C#
Copy
[Command(ExecuteMethod = nameof(UpdateContact), CanExecuteMethod = nameof(CanUpdate))]
public ICommand UpdateContactCommand { get; private set; }

public bool CanUpdate(object newData)
{
    bool canUpdate = true;
    // ...
    return canUpdate;
}

public void UpdateContact(object newData)
{
    // ...
}
See Also

Reference

CommandAttribute
ICommand

Other Resources

INotifyPropertyChanged


Dependency Property

XAML dependency properties extend the functionality of the CLR properties with features such as data binding, styling, animation, etc. Whenever you need to define a dependency property in your XAML application, you typically have to follow a strict implementation pattern and write a fair amount of boilerplate code. The DependencyPropertyAttribute aspect allows you to create custom dependency properties much faster, without writing repetitive code.

This topic contains the following sections:

  • Creating a simple dependency property
  • Exposing the DependencyProperty object
  • Validating the value of the dependency property with contracts
  • Validating the value of the dependency property with a validation method
  • Reacting to the changes of the dependency property value
  • Implementing INotifyPropertyChanged
  • Overriding the naming conventions
Creating a simple dependency property

To add a new dependency property to your class

  1. Add a new property to your class with a chosen name, type and a public getter and setter.

  2. Mark your new property with the DependencyPropertyAttribute attribute.

After you have marked your property with the DependencyPropertyAttribute attribute, you can immediately start using advanced features in your XAML code.

Example

The following code snippet comes from a custom control named ContactCard. The snippet defines a dependency property named Phone. The custom control defines other dependency properties not listed here.

C#
Copy
[DependencyProperty]
public string Phone { get; set; }

The dependency properties can be used in XAML for advanced features. In the following code snippet, we're using data binding with the dependency properties of the ContactCard custom control.

XAML
Copy
<local:ContactCard FullName="{Binding ContactName}" Phone="{Binding ContactPhone}" Email="{Binding ContactEmail}" Notes="{Binding ContactNotes}"
                   x:Name="CurrentContactCard" HorizontalAlignment="Left" Margin="478,270,0,0" VerticalAlignment="Top" Background="Bisque"/>
Exposing the DependencyProperty object

If you want to manipulate the dependency property using the XAML API in C# or VB, then you need to get the DependencyProperty for this specific property. One solution is to use the GetDependencyProperty(Type, String) method, but this is long and error-prone.

A better solution is to add a public static property of type DependencyProperty with the same name as your dependency property, but the Property suffix. This property will be picked by the DependencyPropertyAttribute aspect and set to the proper DependencyProperty value.

Example

The following example shows how to expose the DependencyProperty for the Phone property.

C#
Copy
[DependencyProperty]
public string Phone { get; set; }

public static DependencyProperty PhoneProperty { get; private set; }
C#
Copy
this.CurrentContactCard.SetBinding(ContactCard.PhoneProperty, new Binding("ContactPhone"));
Validating the value of the dependency property with contracts

PostSharp Code Contracts (see Contracts) provide a convenient way to validate the values of the dependency properties. To add the validation to your dependency property, you just need to apply a contract attribute to that property.

Example

The following code snippet shows how to validate a dependency property using a code contract.

C#
Copy
[DependencyProperty]
[NotEmpty]
public string FullName { get; set; }
Validating the value of the dependency property with a validation method

If you need more complex validation for your dependency property, you can implement it in a dedicated validation method. To define a validation method for the Email dependency property, add a new method named ValidateEmail to the same class where the property is declared. The method must accept one argument with the type assignable from the property type and return a bool value.

The following list shows the method signatures you can use when implementing the validation method where TPropertyType is the type of the dependency property and TDeclaringType is the class where your property is declared.

  • static bool ValidatePropertyName(TPropertyType value)

  • static bool ValidatePropertyName(DependencyProperty property, TPropertyType value)

  • static bool ValidatePropertyName(TDeclaringType instance, TPropertyType value)

  • static bool ValidatePropertyName(DependencyProperty property, TDeclaringType instance, TPropertyType value)

  • bool ValidatePropertyName(TPropertyType value)

  • bool ValidatePropertyName(DependencyProperty property, TPropertyType value)

Example

The following code snippet shows how to validate a dependency property using a validation method.

C#
Copy
[DependencyProperty]
public string Email { get; set; }

private bool ValidateEmail(string value)
{
    return EmailRegex.IsMatch(value);
}
Reacting to the changes of the dependency property value

The WPF property system can automatically notify you about the dependency property value changes via callback methods. This can be useful when, for example, you need to update the visual presentation of your custom UI control in response to a change of its property. This section shows how you can define a property change callback method with the PostSharp's dependency property pattern.

To define a property change callback method for the PictureUrl dependency property, add a new method named OnPictureUrlChanged to the same class where the property is declared. The method doesn't have to accept any arguments and must have a void return type. Implement your property change handling logic inside this new method.

The following list shows the method signatures you can use when implementing the property change callback method. TDeclaringType is the class where your property is declared.

  • static void OnPropertyNameChanged()

  • static void OnPropertyNameChanged(DependencyProperty property)

  • static void OnPropertyNameChanged(TDeclaringType instance)

  • static void OnPropertyNameChanged(DependencyProperty property, TDeclaringType instance)

  • void OnPropertyNameChanged()

  • void OnPropertyNameChanged(DependencyProperty property)

Example

C#
Copy
[DependencyProperty]
public string PictureUrl { get; set; }

private void OnPictureUrlChanged()
{
    this.ProfileImage.Source = this.LoadImageFromUrl(this.PictureUrl);
}
Implementing INotifyPropertyChanged

You may also want to notify the users of your class when a dependency property value changes. In this case, you would normally need to implement the INotifyPropertyChanged interface in your class and raise the PropertyChanged event. PostSharp helps you to automate this task using INotifyPropertyChanged pattern. To raise the PropertyChanged event every time any of the dependency properties in your class changes its value, mark your class with the NotifyPropertyChangedAttribute attribute.

C#
Copy
[NotifyPropertyChanged]
public partial class ContactCard : UserControl
{
    // ...
Overriding the naming conventions

The DependencyPropertyAttribute aspect follows a predefined naming convention when looking for methods and properties associated with the dependency property in your class. You can override the naming convention and choose your own member names by setting properties on the DependencyPropertyAttribute. The following table shows the default naming convention and the properties used to override member names.

Dependency property pattern's naming conventions
Member kind | Default name | Example | Override property
Value validation method | ValidatePropertyName | ValidatePhoneNumber | ValidateValueMethod
Property changed callback method | OnPropertyNameChanged | OnPhoneNumberChanged | PropertyChangedMethod
Registration property | PropertyNameProperty | PhoneNumberProperty | RegistrationProperty

Example

C#
Copy
[DependencyProperty(ValidateValueMethod = "ValidateStringMaxLength" )]
public string Notes { get; set; }

private bool ValidateStringMaxLength(string value)
{
    if (string.IsNullOrEmpty(value))
        return true;

    return value.Length <= MAX_LENGTH;
}
See Also

Reference

DependencyPropertyAttribute
DependencyProperty
DependencyPropertyServices
NotifyPropertyChangedAttribute
INotifyPropertyChanged
NotEmptyAttribute

Other Resources

Dependency Properties Overview
Contracts
INotifyPropertyChanged


Attached Property

In XAML, Attached properties are a special kind of properties that are settable on a different object than the one that exposes it. An example of attached property is DockPanel.Dock. Attached properties are a special kind of dependency properties and thus require the same amount of boilerplate code to be written.

The AttachedPropertyAttribute aspect allows you to automate the implementation of attached properties in your classes and eliminates the boilerplate.

This topic contains the following sections:

  • Creating a simple attached property
  • Using the dependency property

The AttachedPropertyAttribute aspect is a special case of the DependencyPropertyAttribute aspect. Therefore you can refer to the Dependency Property article for additional documentation on topics such as validation, property change callbacks, and naming conventions.

Creating a simple attached property

To add a new attached property to your class

  1. Add a new static property to your class with a chosen name, a public getter and private setter. Declare the property type as Attached<T> where T is the desired type of your attached property (see AttachedT).

  2. Mark your new property with the AttachedPropertyAttribute attribute.

C#
Copy
[AttachedProperty]
public static Attached<Dock> Dock { get; set; }
Using the dependency property

After you have marked your property with the AttachedPropertyAttribute attribute, you can directly start to use it in XAML. For example, you can set the value of the property on any object using the attached property syntax in XAML.

XAML
Copy
<MyDockPanel>
  <CheckBox MyDockPanel.Dock="Top">Hello</CheckBox>
</MyDockPanel>

You can also read and write the property value on any object in C# by using the Attached.GetValue(DependencyObject) and Attached.SetValue(DependencyObject, UTP) methods.

C#
Copy
MyDockPanel.Dock.SetValue(this.HelloCheckBox, Dock.Top);

To get a DependencyProperty instance that is backing your attached property, read the value of the AttachedTRuntimeProperty property.

C#
Copy
MyDockPanel.Dock.RuntimeProperty.OverrideMetadata( typeof(MyPropertiesListView), new PropertyMetadata(Dock.Right) ));
See Also

Reference

AttachedPropertyAttribute
DependencyPropertyAttribute
DependencyProperty
AttachedT
GetValue(DependencyObject)
SetValue(DependencyObject, UTP)
RuntimeProperty

Other Resources

Attached Properties Overview
Dependency Property


Parent/Child, Visitor and Disposable

The parent-child relationship is a foundational concept of object oriented design. There are three kinds of object relationships in the UML specification:

  • Aggregation is the parent-child (also named whole-part) relationship. It is implemented in PostSharp by the AggregatableAttribute aspect described in Annotating an Object Model for Parent/Child Relationships (Aggregatable).

  • Composition is an aggregation relationship where the parent controls the lifetime their children. It is implemented in PostSharp by the DisposableAttribute aspect pattern, which relies on the AggregatableAttribute aspect. For details, see Automatically Disposing Children Objects (Disposable).

  • Association is a simple reference between two objects.

Despite its importance, C# and VB have no keyword to represent aggregation. All C# and VB object references correspond to an association. Therefore, most applications and frameworks tend to re-implement the aggregation relationship, resulting in boilerplate code and defects. For instance, UI frameworks such as WinForms and WPF rely on a parent-child structure.

PostSharp implements the Aggregatable pattern thanks to the AggregatableAttribute aspect, together with the ChildAttribute, ReferenceAttribute and ParentAttribute custom attributes.

The Aggregatable pattern is used by other PostSharp aspects, including all threading models (ThreadAwareAttribute), DisposableAttribute and RecordableAttribute. You can also use the aspect to automatically implement a parent-child relationship in your own code.

In this chapter
Section | Description
Annotating an Object Model for Parent/Child Relationships (Aggregatable) | This section shows how to prepare a class so that it can participate in a parent-child relationship.
Enumerating Child Objects (Visitor) | This section describes how to enumerate the children of an object thanks to the visitor pattern.
Automatically Disposing Children Objects (Disposable) | This section shows how to automatically implement the IDisposable interface so that children objects are disposed when the parent object is disposed.
Working With Child Collections | This section covers advanced topics related to collections in aggregatable object models.


Annotating an Object Model for Parent/Child Relationships (Aggregatable)

PostSharp provides several custom attributes that you can apply to your object model to describe the parent-child relationships in a natural and concise way. The AggregatableAttribute aspect is applied to the object model classes, and the properties are marked with ChildAttribute, ReferenceAttribute and ParentAttribute custom attributes. You can also use AdvisableCollectionT and AdvisableDictionaryTKey, TValue classes to make your collection properties aware of the Aggregatable pattern.

Below you can find a detailed walkthrough on how to add parent-child relationships implementation into existing object models.

To apply the Aggregatable to an object model:

  1. Add the PostSharp.Patterns.Model package to your project.

  2. Add the AggregatableAttribute aspect to all base classes. Note that the aspect is inherited, so it is not necessary to explicitly add the aspect to classes that derive from a class that already has the aspect. Note also that AggregatableAttribute aspect is implicitly added by other aspects, including all threading models (ThreadAwareAttribute), DisposableAttribute and RecordableAttribute.

    Note Note

    It is not strictly necessary to add the AggregatableAttribute aspect to a class whose instances will be children but not parents unless you want to track the relationship to the parent using the IAggregatableParent property or the ParentAttribute custom attribute in this class (see below).

  3. Annotate fields and automatic properties of all aggregatable classes with the ChildAttribute or ReferenceAttribute custom attribute. Fields or properties of a value type must not be annotated.

  4. Collections require special attention:

    • Modify the code to use AdvisableCollectionT, AdvisableDictionaryTKey, TValue or AdvisableKeyedCollectionTKey, TItem instead of standard .NET collections for children fields. This change is necessary because all objects assigned to children fields/properties must be aware of the Aggregatable pattern.

    • By default, PostSharp considers that items of child collections will be child objects of the collection. If the collection itself is a child but its items should be considered as references, set the ChildAttributeItemsRelationship property to RelationshipKind.Reference.

    See Working With Child Collections for details.

  5. Optionally, add a field or property to link back from the child object to the parent, and add the ParentAttribute to this field/property. PostSharp will automatically update this field or property to make sure it refers to the parent object.

    Tip Tip

    For better encapsulation, setters of parent properties should have private visibility. In case of parent fields, the private visibility is preferred. User code should not manually set a parent field or property.

Example

In the following examples, an Invoice object owns several instances of the InvoiceLine class, therefore both classes must be annotated with AggregatableAttribute. However, the Invoice does not own the Customer to which it is associated, so the Customer class does not need the custom attribute.

Note that in the constructor of the Invoice class, we assign an AdvisableCollectionT to the Lines field instead of a List.

C#
Copy
[Aggregatable]
public class Invoice
{
  public Invoice()
  {
     this.Lines = new AdvisableCollection<InvoiceLine>();
  }

    [Reference]
    public Customer Customer { get; set; }

    [Child]
    public IList<InvoiceLine> Lines { get; private set; }

  [Child]
  public Address DeliveryAddress { get; set; }
}

[Aggregatable]
public class InvoiceLine
{
  [Reference]
  private Product product;

  public decimal Amount { get; set; }

  [Parent]
  public Invoice ParentInvoice { get; private set; }
}

[Aggregatable]
public class Address
{
}

public class Customer
{
}
See Also

Reference

AggregatableAttribute
ParentAttribute
ChildAttribute
ReferenceAttribute
AdvisableCollectionT
AdvisableDictionaryTKey, TValue

Other Resources

Rule-Based Annotation


Rule-Based Annotation

There are times where you cannot or don't want to add custom attributes manually.

For instance, you cannot add any custom attribute to an auto-generated field backing a XAML element. The WPF designer generates C# code from your XAML files and stores them in i.g.cs files hidden in the obj folder. You cannot modify these files directly.

Another scenario is when you have a large amount of fields and don't want to annotate each of them individually.

Field rules allow you to annotate a field as a child or a reference programmatically, without adding a custom attribute to each field manually.

In the following example, let's consider a class where PostSharp shows an error message COM002: “Field/property InvoiceLine.product must be annotated with a custom attribute [Child], [Reference] or [Parent].”

C#
Copy
[Aggregatable]
public class InvoiceLine
{
  private Product product;

  public decimal Amount { get; set; }
}

To automatically mark all fields as references by default:

  1. Create a class inherited from the FieldRule class.

    C#
    Copy
    public class RefererenceFieldRule : FieldRule

  2. Override the GetRelationshipInfo(FieldInfo) method. PostSharp calls the GetRelationshipInfo(FieldInfo) method for each field that is not annotated with the ChildAttribute, ReferenceAttribute or ParentAttribute custom attribute. The GetRelationshipInfo(FieldInfo) method allows you to specify the field relationship by returning a RelationshipInfo instance.

    C#
    Copy
    public override RelationshipInfo? GetRelationshipInfo(FieldInfo field)
{
    return new RelationshipInfo(RelationshipKind.None, RelationshipKind.Reference);
}

  3. Decorate your project’s assembly with a RegisterFieldRuleAttribute custom attribute to activate your field rule.

    C#
    Copy
    [assembly: RegisterFieldRule(typeof(RefererenceFieldRule))]
    Caution note Caution

    You have to mark each project assembly to make your FieldRule active in the whole solution.

Now PostSharp considers all fields without any Parent-Child annotation as a reference and doesn’t show any error for the product field.

Note Note

PostSharp has two built-in rules: one rule for auto-generated WinForms fields and one rule for auto-generated XAML fields.

Copy
<Window x:Class="WpfApp.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Grid>
        <Button x:Name="myButton" />
    </Grid>f
</Window>

In this example, the WPF designer generates a myButton field to a MainWindow class. Both the myButton field and the MainWindow class are indirectly inherited from System.Windows.Controls.Control. The built-in rule annotates the myButton field as a reference automatically.

See Also

Reference

FieldRule
RegisterFieldRuleAttribute


Enumerating Child Objects (Visitor)

After you have declared the structure of your object graph, you will want to make use of it.

Both the ChildAttribute and ParentAttribute can be used to declare parent-child relationships for other patterns such as Undo/Redo (RecordableAttribute) or threading models (ImmutableAttribute, FreezableAttribute, ...).

You can also use the Aggregatable pattern from your own code. The functionalities of this pattern are exposed by the IAggregatable interface, which all aggregatable object automatically implement. This interface allows you to execute a Visitor method against all child objects of a parent.

In the following example, we see how to implement recursive validation for an object model. We will assume that the InvoiceLine and Address line implement an IValidatable interface.

To enumerate all child objects of a parent:

  1. Cast the parent object to the IAggregatable interface.

    C#
    Copy
    var invoice = new Invoice();
IAggregatable aggregatable = (IAggregatable) invoice;
    Note Note

    The IAggregatable interface will be injected into the Invoice class after compilation. Tools that are not aware of PostSharp may incorrectly report that the Invoice class does not implement the IAggregatable interface. Instead of using the cast operator, you can also use the CastSourceType, TargetType(SourceType) method. This method is faster and safer than the cast operator because it is verified and compiled by PostSharp at build time.

    Note Note

    If you are attempting to access IAggregatable members on either AdvisableCollectionT or AdvisableDictionaryTKey, TValue you will not be able to use the cast operator or the CastSourceType, TargetType(SourceType) method. Instead, you will have to use the QueryInterface``1(Object, Boolean) extension method.

  2. Invoke the VisitChildren(ChildVisitor, ChildVisitorOptions, Object) method and pass a delegate to the method to be executed.

    C#
    Copy
    var invoice = new Invoice();
IAggregatable aggregatable = invoice.QueryInterface<IAggregatable>();
int errors = 0;
bool isValid = aggregatable.VisitChildren( (child, childInfo) =>
        {
            var validatable = child as IValidatable;
            if (validatable != null)
            {
                if ( !validatable.Validate() )
              errors++;
            }
          return true;
        });
    Note Note

    The visitor must return a true to continue the enumeration and false to stop the enumeration.

See Also

Reference

AggregatableAttribute
ParentAttribute
ChildAttribute
IAggregatable
VisitChildren(ChildVisitor, ChildVisitorOptions, Object)
CastSourceType, TargetType(SourceType)
QueryInterface``1(Object, Boolean)


Automatically Disposing Children Objects (Disposable)

When you are working with hierarchies of objects, you sometimes run into situations where you need to properly dispose of an object. Not only will you need to dispose of that object, but you likely will need to walk the object tree and recursively dispose of children of that object. To do this, we typically implement the IDisposable pattern and manually code the steps required to shut down the desired objects, and call the Dispose method on other children objects. This cascading of disposals takes a lot of effort and it is prone to mistakes and omissions.

The DisposableAttribute aspect relies on the AggregatableAttribute aspect and, as a result, is able to make use of the VisitChildren(ChildVisitor, ChildVisitorOptions, Object) method to cascade disposals through child objects.

This topic contains the following sections:

  • Disposing of object trees
  • Customizing the Dispose logic
Disposing of object trees

To automatically implement the IDisposable interface:

  1. Add a reference to the PostSharp.Patterns.Model package.

  2. On the top level object add the DisposableAttribute.

  3. Annotate the object model as described in Parent/Child, Visitor and Disposable.

Note Note

Fields that are marked as children but are assigned to an object that does not implement IDisposable (either manually or through DisposableAttribute) will simply be ignored during disposal.

Note Note

Items of child collections will be automatically disposed of as well unless items of child collections are considered as references. See Working With Child Collections for details.

Example

In this example, the HomeMadeLogger class has two fields, _stream and _textWriter, which should also be disposed of when the HomeMadeLogger is disposed of.

C#
Copy
[Disposable]
public class HomeMadeLogger
{
  [Child]
  private TextWriter _textWriter;
  [Child]
  private Stream _stream;
  [Reference]
  private MessageFormatter _formatter;

  public HomeMadeLogger(MessageFormatter formatter)
  {
    _formatter = formatter;
    _stream = new FileStream("our.log", FileMode.Append);
    _textWriter = new StreamWriter(_stream);
  }

  public void Debug(string message)
  {
    _textWriter.WriteLine(_formatter.Format(message));
  }
}

The _stream and _textWriter child objects will now have their Dispose() method called automatically when the HomeMadeLogger is disposed of. Since both the _stream and _textWriter objects are framework types that already implement IDisposable, adding the DisposableAttribute aspect to those object types is not necessary.

Customizing the Dispose logic

There will be times when you have objects that need custom disposal logic. At the same time, you may want to implement a parent child relationship and make use of the DisposableAttribute. PostSharp allows you to combine custom and automatic logic.

To add your own logic to the Dispose method, create a method with exactly the following signature:

C#
Copy
protected virtual void Dispose( bool disposing )
{
}
Caution note Caution

The DisposableAttribute aspect does not automatically dispose of the object when it is garbage collected. That is, the aspect does not implement a destructor. If you need a destructor, you have to do it manually and invoke the Dispose.

Example

In the following example, we are customizing the Dispose pattern to expose the IsDispose property:

C#
Copy
[Disposable]
public class HomeMadeLogger
{
  public bool IsDisposed { get; private set; }

  protected virtual void Dispose( bool disposing )
  {
    this.IsDisposed = true;
  }
}

Once you have done this, PostSharp will properly run your custom Dispose logic as well as running any of the parent and child implementations of the DisposableAttribute that exist for the object.


Working With Child Collections

It would not be possible to implement the Aggregatable pattern without support for collection classes. However, collections of the .NET base class libraries cannot be reliably extended to support the Aggregatable pattern. Therefore, code that implements the Aggregatable pattern must rely on collection classes defined by PostSharp, namely AdvisableCollectionT, AdvisableDictionaryTKey, TValue, AdvisableKeyedCollectionTKey, TItem and AdvisableHashSetT.

This topic contains the following sections:

  • Why yet other collection types?
  • Replacing standard collections with advisable collections
  • Casting advisable collections
  • Parent surrogates
  • Enumerating children and parent surrogates
  • Collections of references
  • Using immutable collections
Why yet other collection types?

In the following example, an Invoice entity is composed of one instance of the Invoice class and several instances of the InvoiceLine class. The relationship between the Invoice and InvoiceLine classes is implemented using a collection.

Copy
[Aggregatable]
public class Invoice
{
    public Invoice()
    {
        this.Lines = new List<InvoiceLine>();
    }

    [Child]
    public IList<InvoiceLine> Lines { get; private set; }
}

[Aggregatable]
public class InvoiceLine
{
}

When we add a new element to the Lines collection, we also need to update the parent-child relationship between the corresponding invoice and invoice line. It is not possible to do this with the standard ListT class, so we need to build a specialized aggregatable collection class instead. However, we may later decide to apply another pattern to our object model, such as a threading model or undo/redo. This new pattern would, in turn, require support from the collection class. Creating new collection classes for each pattern (and potentially for each pattern combination) is clearly unmanageable.

Instead of providing a new collection class for each specific behavior we need to inject, PostSharp introduces the concept of advisable collections. Advisable collections are collection classes into which PostSharp can inject behavior dynamically, at run time, according to the field to which they are assigned. Advisable collections are a way to make the collection "inherit" the pattern of the parent class

Let's modify our previous example to work correctly with the Aggregatable aspect.

C#
Copy
[Aggregatable]
public class Invoice
{
    public Invoice()
    {
        this.Lines = new AdvisableCollection<InvoiceLine>();
    }

    [Child]
    public IList<InvoiceLine> Lines { get; private set; }

}

[Aggregatable]
public class InvoiceLine
{
}

As you can see, the only change we made is using AdvisableCollectionT class instead of ListT. The Aggregatable aspect applied to the Invoice class detects that the child property is an advisable collection and applies dynamic Aggregatable advice to the collection instance at run time. This turns our collection of invoice lines into an aggregatable collection. If we apply another aspect to the Invoice class later, it can add new behaviors to this collection in the same way.

Replacing standard collections with advisable collections

The PostSharp.Patterns.Collections namespace defines advisable collection classes that are highly compatible with the collection types of the .NET base class libraries.

The following table shows how advisable collections map to standard collections.

Advisable collection | Replacement for
AdvisableCollectionT | Array, ListT, CollectionT, ObservableCollectionT
AdvisableDictionaryTKey, TValue | DictionaryTKey, TValue
AdvisableKeyedCollectionTKey, TItem | KeyedCollectionTKey, TItem
Caution note Caution

Interfaces IReadOnlyListT and IReadOnlyCollectionT are not implemented.

Casting advisable collections

Patterns such as Aggregatable, Recordable or Threading Models dynamically inject advices into advisable collections. These advices typically expose an interface, respectively IAggregatable, IRecordable and IThreadAware. Because interfaces are introduced at run-time and not at build-time, you cannot use the normal type casting constructs to access the interface members.

Instead of a normal cast, you can use the QueryInterface``1(Object, Boolean) extension method to access interfaces implemented by the given instance. This method will return the proper interface implementation irrespective how the interface is implemented: directly in the source code, introduced by PostSharp aspect at build time, or added dynamically at run time.

The following code snippet gets the IAggregatable interface of the Lines collection in the example above:

C#
Copy
IAggregatable aggregatable = invoice.Lines.QueryInterface<IAggregatable>();

By default, the QueryInterface``1(Object, Boolean) method throws InvalidCastException if the given instance doesn't implement the queried interface. You can also safely check whether the interface is implemented by passing false as a method argument.

C#
Copy
if ( collection.QueryInterface<IAggregatable>( false ) != null )
{
}
Parent surrogates

Collections play a special role in implementing the parent-child relationships between classes. Collections are often instruments instead of first-class entities of the object model. When enumerating children of a class, one generally wants to avoid the collections themselves to be returned, but only items of these collections. Additionally, the Parent property of a child object should typically refer to the parent entity and not to the collection that contains the child.

Consider the following example:

C#
Copy
[Aggregatable]
public class Invoice
{
   public Invoice()
   {
     this.Lines = new AdvisableCollection<InvoiceLine>();
   }

   [Child]
   public IList<InvoiceLine> Lines { get; private set; }

}

[Aggregatable]
public class InvoiceLine
{
   [Parent]
   public Invoice Invoice { get; private set; }
}

The Invoice class contains a collection of InvoiceLine instances. We want each item of the Lines collection to be a child of the Invoice instance. However, the collection itself should not be considered a child of the Invoice. Additionally, we want the InvoiceLine.Invoice property to be set to the Invoice, not to the collection.

To implement this behavior, PostSharp needs to give a different status to collections than to other entities. This concept is named a parent surrogate, because the collection acts as a surrogate (or proxy) between the parent and its children.

Any aggregatable object can act as a parent surrogate, but only collections act as parent surrogates by default. You can override the default behavior by setting the ChildAttributeIsParentSurrogate property.

In the next example, the Lines collection will be treated as a first-class entity.

C#
Copy
[Aggregatable]
public class Invoice
{
   public Invoice()
   {
     this.Lines = new AdvisableCollection<InvoiceLine>();
   }

  [Child(IsParentSurrogate = false)]
   public IList<InvoiceLine> Lines { get; private set; }

}

[Aggregatable]
public class InvoiceLine
{
   [Parent]
   public IList<InvoiceLine> Parent { get; private set; }
}

To cause a custom class to behave like a parent surrogate by default, set the IsParentSurrogate property of the AggregatableAttribute applied to your class to true. In this case, it's not allowed to override the value in the [Child] attributes applied to individual properties.

C#
Copy
[AggregatableAttribute(IsParentSurrogate = false)]
Enumerating children and parent surrogates

The default behavior of the VisitChildren(ChildVisitor, ChildVisitorOptions, Object) method is to skip the surrogate collection itself and invoke the ChildVisitor delegate on each item of the collection. In our first example, calling the VisitChildren(ChildVisitor, ChildVisitorOptions, Object) method on the Invoice instance will invoke the visitor on the items of the Lines collection, but not on the collection instance itself.

You can customize this behavior by providing one or more flags for the ChildVisitorOptions parameter of the method. The ChildVisitorOptions.IncludeParentSurrogates flag will cause the visitor to be additionally invoked on the instances of the surrogate collections, while the ChildVisitorOptions.ExcludeIndirectChildren flag will exclude the items of such collection from being visited.

Collections of references

As we showed earlier, when you annotate the collection property with the [Child] attribute, collection items become children of the class instance.

In certain situations, you may want to have a collection of references. The collection itself is still marked with the [Child] custom attribute because it would make sense from the point of view of other patterns (for instance, changes in the collection must be recorded by the Recordable pattern). However, the collection items themselves must not be considered children of the entity.

To implement this requirement, you can set the ChildAttributeItemsRelationship property to RelationshipKind.Reference.

In the example below, the RelatedOrders collection is a child and therefore its changes are being recorded by the Recordable aspect. However, collection items are not children of the parent entity, because related orders do not belong to the invoice.

C#
Copy
[Recordable]
public class Invoice
{
   public Invoice()
   {
     this.Lines = new AdvisableCollection<InvoiceLine>();
     this.RelatedOrders = new AdvisableCollection<Order>();
   }

   [Child]
   public IList<InvoiceLine> Lines { get; private set; }

   [Child(ItemsRelationship = RelationshipKind.Reference)]
   public IList<Order> RelatedOrders { get; private set; }

}
Using immutable collections

In section Working With Child Collections, we explained the need to replace standard .NET collections by special advisable collections of the PostSharp.Patterns.Collections namespace. These collections come with a significant inconvenient: they have a significant performance and memory overhead. In many situations, collections can be replaced by immutable collections. Immutable collections are collections whose content never changes after instantiation. Adequate use of immutable collections can significantly improve application performance and simplify API design compared to mutable collections, whether standard or advisable.

Immutable collections are implemented in the System.Collections.Immutable namespace, contained in the System.Collections.Immutable NuGet package.

The Aggregatable pattern and threading models support immutable collections. When you assign an immutable collection to a child field of a parent object, items of the collection become children of the parent object. Immutable collections behave similarly than other types, so you still have to use the ChildAttribute and ReferenceAttribute custom attributes as usual.

See Also

Reference

AdvisableCollectionT
AdvisableDictionaryTKey, TValue
AdvisableKeyedCollectionTKey, TItem
AdvisableHashSetT


Undo/Redo

Most business application users are familiar with applications that have the ability to undo and redo changes that they have made. It’s not common to see this functionality in custom built applications because it is quite difficult to do. Despite this difficulty, undo/redo is consistently mentioned on the top of users' wish list.

The RecordableAttribute aspect makes it much easier to add undo/redo to your application by automatically appending changes done on your object model to a Recorder that you can then bind to your user interface. Unlike other approaches to undo/redo, the RecordableAttribute aspect only requires minimal changes to your source code.

In this chapter
Section | Description
Making Your Model Recordable | The first step is to make your model classes This section shows how to add the RecordableAttribute aspect to the model classes to enable the undo/redo functionality.
Adding Undo/Redo to the User Interface | This section describes how to expose the undo/redo functionality to the application's users.
Customizing Undo/Redo Operation Names | This section shows how to group changes into logical operations and give them a name that is meaningful to the application's users.
Assigning Recorders Manually | This section explains how to customize the assignment of recordable objects to recorders.
Adding Callbacks on Undo and Redo | This section shows how to execute custom logic when undo/redo operations occur in a recordable object.
Understanding the Recordable Aspect | This section describes the concepts and architecture of the RecordableAttribute aspect.


Making Your Model Recordable

To make an object usable for undo/redo operations, you will need to add the RecordableAttribute aspect to the class. This aspect instruments changes to fields and records them into a Recorder. The aspect also instruments public methods to group field changes into logical operations.

To make the class recordable:

  1. Add the PostSharp.Patterns.Model package to the project.

  2. Add the RecordableAttribute to the class.

  3. Annotate your object model for parent/child relationships as explained in Parent/Child, Visitor and Disposable.

Example

The following example shows an object model that has been prepared for undo/redo.

C#
Copy
[Recordable]
public class Invoice
{
  public Invoice()
  {
     this.Lines = new AdvisableCollection<InvoiceLine>();
  }

    [Reference]
    public Customer Customer { get; set; }

    [Child]
    public IList<InvoiceLine> Lines { get; private set; }

  [Child]
  public Address DeliveryAddress { get; set; }
}

[Recordable]
public class InvoiceLine
{
  [Reference]
  private Product product;

  public decimal Amount { get; set; }

  [Parent]
  public Invoice ParentInvoice { get; private set; }
}

[Recordable]
public class Address
{
}

[Recordable]
public class Customer
{
}

By adding the RecordableAttribute aspect to the classes, all modifications to properties of these classes (including modifications to child collections) will be recorded.


Adding Undo/Redo to the User Interface

The Undo/Redo functionality that you added to your codebase needs to be made available to the users. Users will want to have the ability to move forward and backward through the operations that they too and have been recorded.

This topic contains the following sections:

  • Using the ready-made WPF controls
  • Clearing the initial history
  • Creating custom undo/redo controls
Using the ready-made WPF controls

PostSharp includes two button controls UndoButton and RedoButton that you can add to your application.

To add Undo/Redo to a WPF window:

  1. Install the PostSharp.Patterns.Xaml package using NuGet.

  2. Add the following namespace declaration to the root element of your XAML file:

    C#
    Copy
    xmlns:model="clr-namespace:PostSharp.Patterns.Xaml;assembly=PostSharp.Patterns.Xaml"

  3. To add Undo and Redo buttons to the user interface, including the following two lines of XAML.

    C#
    Copy
    <model:UndoButton HorizontalAlignment="Left" Margin="22,24,0,0" VerticalAlignment="Top" />
<model:RedoButton HorizontalAlignment="Left" Margin="64,24,0,0" VerticalAlignment="Top"/>

    Your users are now able to make a changes in the user interface and Undo and/or Redo those changes at any point that they want.

Clearing the initial history

If we were to open the Customer management screen you would notice that the Undo button has a number of actions listed under it.

Those actions are listing the changes that were taken when the different Person instances were loaded and their properties were set. Most users will only want to see actions that they have manually taken in the screen. As such, you will need to manually interact with the Recorder to ensure that the Undo button list is empty when the window opens.

To provide an empty list of recorded actions when the window is initially opened, open the ViewModelMain class and find the constructor. Add the following as the last line in the constructor:

C#
Copy
RecordingServices.DefaultRecorder.Clear();

The Recorder class is accessed through the RecordingServicesDefaultRecorder property. This property contains the current Recorder instance that is being used by the RecordableAttribute aspect. The Recorder class has two collections, UndoOperations and RedoOperations, which contain all of the past operations that can be undone and redone. The Clear method removes all operations from both of those collections.

Now when you open the Customer management screen both the Undo and Redo buttons will show no history. This is the simplest type of Undo/Redo implementation that you can do. It will record each property change operation separately in the Undo and Redo UI buttons which probably isn’t what you, or your users, will want to see. Read Customizing Undo/Redo Operation Names to learn how to record groupings of operations that make sense to your business users.

Creating custom undo/redo controls

If the buttons provided by PostSharp don't meet your requirements, you can create your own controls for WPF, Windows Phone or WinRT.

Custom controls will typically provide a front-end to the global Recorder exposed on the RecordingServicesDefaultRecorder property, and we provide a view for the UndoOperations and RedoOperations collections. Controls typically use the RecorderUndo and RecorderRedo methods.


Customizing Undo/Redo Operation Names

The example of previous sections displays the list of operations appearing in the two UI buttons. That list of operations references the setters on the different individual properties in a very technical manner, for instance the operation of setting the first name is named set_FirstName, according to the name of the property in source code.

End users will want to see the operations described in meaningful business terms, not technical ones. This article will show you how to explicitly name the recording operations that will take place in your code.

This topic contains the following sections:

  • Default operation naming algorithm
  • Setting the operation name declaratively
  • Setting the operation scope and name dynamically
  • Using the OperationFormatter class
Default operation naming algorithm

From the end user's perspective, the undo/redo feature exposes a flat list of operations that can be undone or redone. From a system perspective, an operation is composed of changes to individual fields and collections. For instance, moving a picture on a design surface is seen as a single operation Move by the user, but it is composed of two changes in fields x and y.

Let's see this in a code example:

C#
Copy
[Recordable]
public class Picture
{
   private double x, y;

   public double X
   {
      get { return x; }
      set { x = value; }
   }

   public double Y
   {
      get { return y; }
      set { y = value; }
   }

   public void Move( double x, double y )
   {
      this.X = x;
      this.Y = y;
   }

}

public static class Program
{
   public static void Main()
   {
      var picture = new Picture();

      picture.Move( 10, 10 );

      // 1 undo operation at this point: Move.

      picture.X = 20;

      // 2 undo operations at this point: set_X, Move.

      picture.Y = 20;

      // 3 undo operations at this point: set_Y, set_X, Move.
   }
}

By default, the RecordableAttribute aspect will automatically open a new operation for any public method unless the current Recorder already has an open operation. Therefore, invoking the Move method results in a single operation, even if it modifies two fields. Note that the Move method invokes the setters of public properties X and Y, which are themselves public methods, but they do not open new operations since they run from within the Move method. However, when properties X and Y are accessed from outside of the Picture class, new operations are created for the set_X and set_Y methods.

Setting the operation name declaratively

By default, the name of an operation is set to the name of the method. There are various ways to customize this name, and the easiest is to add a RecordingScopeAttribute custom attribute to the public method.

In the following example, we're declaring a different name for the Move method:

C#
Copy
[Recordable]
public class Picture
{
   private double x, y;

   [RecordingScope("Moving the picture")]
   public void Move( double x, double y )
   {
      this.x = x;
      this.y = y;
   }

}

With that RecordingScopeAttribute added, the recorded operation will now have a name of Moving the picture instead of just Move.

Setting the operation scope and name dynamically

Setting the operation name declaratively is convenient but relatively rigid. When more flexibility is needed, you can use the RecorderOpenScope(String, RecordingScopeOption) method to control the creation and naming of scopes.

In the following example, we will modify the Move method to include the target position in the operation description.

To dynamically name an operation:

  1. Add the [RecordingScope(RecordingScopeOption.Skip)] custom attribute to the method, so that the method does not automatically define a new operation.

    Note Note

    This step is not required if you are starting the operation from a non-recordable object.

    However, if you do not to add this custom attribute to a method of a recordable object, the RecordableAttribute aspect will automatically create a new scope to execute the method, and your call of the OpenScope(String, RecordingScopeOption) method will be ignored.

  2. Invoke the OpenScope(String, RecordingScopeOption) method and wrap the code you want to record in a using block.

Example

C#
Copy
[Recordable]
public class Picture
{
   private double x, y;

   [RecordingScope(RecordingScopeOption.Skip)]
   public void Move( double x, double y )
   {
      string scopeName = string.Format( "Moving to ({0}, {1})", x, y );

      using (RecordingScope scope = RecordingServices.DefaultRecorder.OpenScope(scopeName))
      {
        this.x = x;
        this.y = y;
      }
   }
}
Using the OperationFormatter class

Explicitly declaring the name for every operation would be a large and tedious task. It is possible to write your own naming engine and apply that set of naming rules across the entire application. To achieve this, derive your own implementation from the OperationFormatter class. to the

In the following example, we will create a custom formatter that reads the operation name from the DisplayNameAttribute custom attribute and display the value to which a property has been set.

To create and register a custom OperationFormatter:

  1. Create a new class and inherit from the OperationFormatter class.

  2. Create a constructor for the new formatter class.

  3. Override the FormatOperationDescriptor(IOperationDescriptor) method and write your custom logic for generating a custom operation name.

    Note Note

    Formatters create a chain of responsibility. If one formatter is unable to provide a name it will ask the next formatter in the chain to attempt to provide a name. To make the hand-off occur the FormatOperationDescriptor(IOperationDescriptor) method needs to return null. If it returns anything else the chain is broken and the returned value is used as a name.

  4. Finally, you need to add your custom name formatter into the chain of responsibility.

    C#
    Copy
    RecordingServices.OperationFormatter = new MyOperationFormatter(RecordingServices.OperationFormatter);

    Because the RecordingServices is making use of a chain of responsibility, you are able to insert as many custom name formatters as you want. You are also able to determine their order of execution based on the order that you insert them into the chain of responsibility.

Example

C#
Copy
class MyOperationFormatter : OperationFormatter
 {
     public MyOperationFormatter( OperationFormatter next ) : base( next )
     {
     }

     protected override string FormatOperationDescriptor( IOperationDescriptor operation )
     {
         if ( operation.OperationKind != OperationKind.Method )
             return null;

         var descriptor = (MethodExecutionOperationDescriptor) operation;

         if ( descriptor.Method.IsSpecialName && descriptor.Method.Name.StartsWith( "set_" ) )
         {
             // We have a property setter.

             var property = descriptor.Method.DeclaringType.GetProperty(
                    descriptor.Method.Name.Substring( 4 ),
                    BindingFlags.Instance|BindingFlags.Public|BindingFlags.NonPublic );

             var attributes =
                  (DisplayNameAttribute[]) property.GetCustomAttributes(typeof(DisplayNameAttribute), false);

             if ( attributes.Length > 0 )
                 return string.Format( "Set {0} to {1}", attributes[0].DisplayName, descriptor.Arguments[0] ?? "null" );
         }
         else
         {
             // We have another method.

             var attributes =  (DisplayNameAttribute[])
                descriptor.Method.GetCustomAttributes(typeof(DisplayNameAttribute), false);

             if ( attributes.Length > 0 )
                 return attributes[0].DisplayName;
         }

         return null;
     }
 }


Assigning Recorders Manually

By default, all recordable objects are attached to the global Recorder exposed on the RecordingServicesDefaultRecorder property. There is nothing you have to do to make this happen. There may be circumstances where you want to create and assign your own recorder to the undo/redo process. There are two different ways that you can accomplish this.

This topic contains the following sections:

  • Overriding the default RecorderProvider
  • Attaching a recorder manually
Overriding the default RecorderProvider

By default, the RecordableAttribute aspect attaches an object to a Recorder as soon as its constructor exits. To determine which Recorder should be used, the aspect uses the RecordingServicesRecorderProvider service. By default, this service always serves the global instance that is also exposed on the RecordingServicesDefaultRecorder property.

You can override this automatic assignment to inject your own RecorderProvider to into the process.

To use a custom RecorderProvider:

  1. Create a class inherited from the RecorderProvider class.

  2. Implement the chaining constructor. The RecorderProvider that you inherited from requires a RecorderProvider as a constructor parameter. This constructor parameter facilitates the chain of responsibility for providers that can be run when a Recorder is requested. To keep the chain of responsibility intact your custom RecorderProvider will need to accept a RecorderProvider in its constructor and pass that to the base constructor.

  3. Override the GetRecorderCore(Object) method.

  4. Insert an instance of your custom RecorderProvider class into the chain of responsibility by assigning it to the RecordingServicesRecorderProvider.

    C#
    Copy
    RecordingServices.RecorderProvider = new MyProvider(RecordingServices.RecorderProvider);
Note Note

RecorderProvider is a chain of responsibility. As such, if a GetRecorderCore(Object) method returns null then the chain will move on to the next RecorderProvider and attempt to get a Recorder to use.

By overriding the default RecorderProvider you are able to assign a custom Recorder across the entire application.

Example

C#
Copy
public class ThreadStaticRecorderProvider : RecorderProvider
{
  private static Recorder _recorder;

  public ThreadStaticRecorderProvider(RecorderProvider next) : base(next)
  {
  }

  public Recorder GetRecorderImpl(object obj)
  {
    if ( _recorder == null )
    {
       _recorder = new Recorder();
    }

    return _recorder;
  }
}
Attaching a recorder manually

The second way that you can add a Recorder to objects is to manually assign them when, and where, they are needed.

To manually assign a Recorder to an object:

  1. Set the RecordableAttributeAutoRecord property to false for that class.

    C#
    Copy
    [Recordable(AutoRecord = false)]
public class Invoice
{
}
    Note Note

    By disabling AutoRecord you are telling the RecordingServices that this object should not be included in recordings unless the recording is explicitly declared in your code.

  2. Create a new instance of a Recorder and attach the object to it using the Attach(Object) method.

    C#
    Copy
    var invoice = new Invoice();

var recorder = new Recorder();
recorder.Attach(invoice);

    You can then use the Detach(Object) method to remove the Recorder from the object in question.

Note Note

An object must always have the same Recorder as its parent has unless the parent has no Recorder assigned. Because of this, whenever a Recorder is assigned to an object, all of the child objects will have that same Recorder assigned to them. However, if you detach a child object from its parent the child object's assigned Recorder will not be detached. For more information about parent-child relationships, see Parent/Child, Visitor and Disposable.


Adding Callbacks on Undo and Redo

You may run into situations where you will want to execute some code before or after an object is being modified by an Undo or Redo operation. This capability is provided through the IRecordableCallback interface.

In the following example, we will show how to integrate the RecordableAttribute aspect with a custom implementation of INotifyPropertyChanged (the standard NotifyPropertyChangedAttribute aspect is already integrated with the RecordableAttribute aspect so you don't need to worry).

C#
Copy
[Recordable]
public class Invoice : INotifyPropertyChanged, IRecordableCallback
{
  public void OnReplaying(ReplayKind kind, ReplayContext context)
  {
  }

  public void OnReplayed(ReplayKind kind, ReplayContext context)
  {
    OnPropertyChanged("ShippingDate");
  }

  private DateTime _shippingDate;
  public DateTime ShippingDate
  {
    get { return _shippingDate; }
    set
    {
      _shippingDate = value;
       OnPropertyChanged("ShippingDate");
    }
  }

  public event PropertyChangedEventHandler PropertyChanged;

  protected virtual void OnPropertyChanged(string propertyName = null)
  {
      var handler = PropertyChanged;
      if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
  }
}

For more information, see the reference documentation for the IRecordableCallback interface.


Understanding the Recordable Aspect

This section describes how the RecordableAttribute aspect is implemented. It helps developers and architects to understand the behavior and limitations of the aspect.

This topic contains the following sections:

  • Overview
  • Scopes and Logical Operations
  • Atomic Operations
  • Primitive Operations
  • Restore Points
  • Implementing IEditableObject
  • Callback Methods
  • Memory Consumption
Overview

When the RecordableAttribute aspect is applied to a class, the aspect records changes performed on instances of this class. Changes are represented as instances of the Operation class. For instance, the FieldOperationT class represents the operation of changing the value to a field. All operations implement the Undo(ReplayContext) and Redo(ReplayContext) methods. For instance, the FieldOperationT class stores both the new and old value so that the operation can be undone and redone.

The changes are recorded into the Recorder object. The Recorder maintains two collections of operations: UndoOperations and RedoOperations. The RecorderUndo method takes the last operation from the UndoOperations collection, invokes OperationUndo(ReplayContext) for this operation, and moves the operation to the RedoOperations collection. The RecorderUndo method works symmetrically.

It would not be safe, however, to allow users to undo changes in the object model back to any arbitrary point in history. Users don't want to undo primitive changes to an object model, but to undo whole operations understood from a user's perspective. This is why the UndoOperations and RedoOperations collections don't expose primitive changes on the object model but logical operations.

By default, logical operations are automatically opened when calling a public or internal method of a recordable object, and closed when the same method exits. The principal use case of scopes is to define user-friendly operation names.

There is typically a single instance of this class per application, but there could be many if needed (for instance in a multi-document application). The default single instance is accessible from the RecordingServicesDefaultRecorder property. By default, recordable objects are attached to the default recorder immediately after completion of the constructor. See Assigning Recorders Manually to learn how to customize this behavior.

Scopes and Logical Operations

Scopes are a mechanism to aggregate several primitive operations into logical operations that make sense for the end-user. Logical operations are represented by the CompositeOperation class.

In general, logical operations form a flat structure: the UndoOperations and RedoOperations collections are flat double linked lists, and each CompositeOperation typically contains primitive operations such as a field value change.

Scopes define boundaries of logical operations. Scopes can be opened using the RecorderOpenScope(RecordingScopeOption) method, which returns an object of type RecordingScope. This class implements the IDisposable interface, making it convenient to define scopes with the using statement.

By default, the RecordableAttribute aspect encloses all instance public and internal methods with an implicit scope. That is, by default, public and internal methods define boundaries of logical operations.

Unlike logical operations, scopes are generally nested. Scope nesting typically happens when a public method directly or indirectly invokes another public method. In general, only the outermost scope results in creating a logical operation. This is why, in general, logical operations form a flat structure.

Because they are visible to users, logical operations must be given a user-friendly name. PostSharp defines default names that are not user-friendly. The responsibility of generating operation names is implemented by the OperationFormatter class. You can provide your own OperationFormatter to generate operations names on demand, or you can set the name explicitly in source code for each operation.

Scope names can be declaratively defined using the RecordingScopeAttribute custom attribute, or programmatically using the RecorderOpenScope(String, RecordingScopeOption) method. To learn more about operation names, see Customizing Undo/Redo Operation Names.

Atomic Operations

Atomic scopes are scopes whose changes are automatically rolled back when it does not complete successfully, typically when an exception occurs. The rollback is implemented using the undo mechanism. Atomic scopes are a similar concept than transactions, but multithreading is not taken into account. Therefore, other threads may see changes that have not been "committed", because the Recordable\ pattern does not have a notion of transaction isolation.

Atomic scopes cause composite operations to have a tree structure. However, the concept of atomic structure does not surface to the users. Therefore, from a user's perspective, the UndoOperations and RedoOperations collections still present linear lists of logical operations.

Scope defined declaratively using the RecordingScopeAttribute custom attribute, or programmatically using the RecorderOpenScope(RecordingScopeOption) method.

Primitive Operations

The following table lists the primitive operations that are automatically appended to the Recorder object by the RecordableAttribute aspect.

Class | Description
FieldOperationT | Represents the operation of setting a field to a different value.
CollectionOperationT | Represents operations on collections.
DictionaryOperationTKey, TValue | Represents operations on dictionaries.
RecorderOperation | Represents the operation of attaching or detaching an object to or from a Recorder.

Additionally to these system-defined operations, it is possible to implement custom operations by deriving from the Operation abstract class. You can then use the RecorderAddOperation(Operation) method to append the custom operation to the Recorder.

Logical operations, which are presented to the end user, are typically represented as instances of the CompositeOperation class.

Restore Points

Restore points act like bookmarks in the list of operations. They allow to undo or redo operations up to a specific point. You can use the RecorderAddRestorePoint(String) method to create a restore point. The method returns an instance of the RestorePoint class, which derives from the Operation class. Unlike other operations, you can safely remove a restore point from the history thanks to the Remove method.

Implementing IEditableObject

You can use the EditableObjectAttribute custom attribute to automatically implement the IEditableObject interface. The implementation is based on the RecordableAttribute aspect. It creates a RestorePoint when the BeginEdit method is invoked, removes the restore point upon EndEdit, and undoes changes up to the restore point when CancelEdit is called.

Because of this implementation strategy, it is possible that CancelEdit actually cancels changes done to other objects that share the same Recorder.

Callback Methods

The Recorder will invoke the OnReplaying(ReplayKind, ReplayContext) and OnReplayed(ReplayKind, ReplayContext) methods of any recordable object implementing the IRecordableCallback interface, whenever the object is affected by an undo or redo operation.

The order in which these methods are ordered on several objects is nondeterministic; in particular, the aggregation structure is not respected.

It is not allowed, from a callback methods:

  • to perform a change that would be recorded, e.g. to set a field that has not been waived from recording with the NotRecordedAttribute custom attributes.

  • to invoke methods Undo, Redo or AddRestorePoint of the Recorder class.

Memory Consumption

The UndoOperations and RedoOperations collections hold strong references to all objects that have changes that can be undone or redone. This means that these objects cannot be garbage-collected and will remain in memory.

You can define the maximal number of operations available for undo thanks to the RecorderMaximumOperationsCount property.


Caching

Caching is a great way to improve the latency an application. Traditionally, when you implement caching, you need to play with the API of the caching framework (such as MemoryCache) or caching server (such as Redis) and to include moderately complex logic to your source code to generate the cache key, check the existence of the item in the cache, and add the item into the cache. Another source of complexity stems from removing items from the cache when the source data is updated. Implementing caching manually is not only time-consuming, but also is error-prone: it is easy to generate inconsistent cache keys between read and update methods.

PostSharp allows you to dramatically reduce the complexity of caching. It allows you to cache the return value of a method as a function of its arguments with just a custom attribute, namely the CacheAttribute aspect. The InvalidateCacheAttribute aspect and the CachingServicesInvalidation API offer a strongly-typed way to invalidate cached methods. Additionally, PostSharp is independent from the caching framework or server (called caching backend), so you can choose from several backends or implement an adapter for your own backend.

In this chapter
Section | Description
Caching Method Return Values | This article shows how to make method returned values being cached.
Removing Items From the Cache | This article shows how to invalidate cached returned values of methods declaratively and imperatively.
Working with Cache Dependencies | This article shows how to invalidate cache items automatically using cache dependencies.
Customizing Cache Keys | This article shows how to customize the cache keys which identify cached method return values.
Caching Back-Ends | This article shows how to store cached values in various backends.
Synchronizing Local In-Memory Caches for Multiple Servers | This article shows how to invalidate all related in-memory caches in a distributed environment.
Caching Special Types with Value Adapters | This article describes how to cache return values of methods which cannot be cached directly, such as instances of IEnumerableT or Stream.
Preventing Concurrent Execution of Cached Methods | This article explains how you can prevent the same method from being executed with the same arguments at the same time - by using locking.
See Also

Reference

CacheAttribute
CacheConfigurationAttribute
InvalidateCacheAttribute


Caching Method Return Values

Suppose you have a time-consuming method that always returns the same return value when called with the same arguments. You decided to cache it. This topic describes how to proceed.

This topic contains the following sections:

  • Caching the return value of a method
  • Configuring the cache behavior
  • Configuring caching with custom attributes
  • Configuring caching with caching profiles
  • Disabling caching at run time
Caching the return value of a method

To make a return value of a method being cached:

  1. Add a reference to the PostSharp.Patterns.Caching package.

  2. Add the CacheAttribute custom attribute on the method which should be cached. Such method is called the cached method.

  3. Now you need to specify which caching framework or caching server is to be used by the CacheAttribute aspect. We call this the caching backend. You must specify the caching backend by setting the CachingServicesDefaultBackend property. See Caching Back-Ends for a list of caching backends.

    Important note Important

    The caching backend has to be set before any cached method is called for the first time.

  4. Unless all method parameters are intrinsic types such as int or string, you need to ensure that the parameter types generate a meaningful cache key. See Customizing Cache Keys for details.

Example

In this example, the GetNumber method's return value is cached.

C#
Copy
using System;
using System.Threading;
using PostSharp.Patterns.Caching;
using PostSharp.Patterns.Caching.Backends;

namespace PostSharp.Samples.Caching.MethodResults
{
    class Program
    {
        static void Main( string[] args )
        {
            CachingServices.DefaultBackend = new MemoryCachingBackend();

            Console.WriteLine( "Retrieving value of 1 for the 1st time should hit the database." );
            Console.WriteLine( "Retrieved: " + GetNumber( 1 ) );

            Console.WriteLine( "Retrieving value of 1 for the 2nd time should NOT hit the database." );
            Console.WriteLine( "Retrieved: " + GetNumber( 1 ) );

            Console.WriteLine( "Retrieving value of 2 for the 1st time should hit the database." );
            Console.WriteLine( "Retrieved: " + GetNumber( 2 ) );

            Console.WriteLine( "Retrieving value of 2 for the 2nd time should NOT hit the database." );
            Console.WriteLine( "Retrieved: " + GetNumber( 2 ) );
        }

        [Cache]
        static int GetNumber( int id )
        {
            Console.WriteLine( $">> Retrieving {id} from the database..." );
            Thread.Sleep( 1000 );
            return id;
        }
    }
}

The output of this sample is:

Copy
Retrieving value of 1 for the 1st time should hit the database.
>> Retrieving 1 from the database...
Retrieved: 1
Retrieving value of 1 for the 2nd time should NOT hit the database.
Retrieved: 1
Retrieving value of 2 for the 1st time should hit the database.
>> Retrieving 2 from the database...
Retrieved: 2
Retrieving value of 2 for the 2nd time should NOT hit the database.
Retrieved: 2
Configuring the cache behavior

The following elements of the CacheAttribute aspect behavior can be configured:

  • expiration (absolute and sliding),

  • priority,

  • auto-reload, and

  • enabled/disabled.

Configuring caching with custom attributes

You can configure the CacheAttribute aspect by setting the properties of the CacheAttribute custom attribute. The inconvenience of this approach is that you have to repeat the configuration for each cached method. To configure several methods in a single line of code, you can add the CacheConfigurationAttribute custom attribute to the declaring type, a parent of the declaring type, or the declaring assembly.

When PostSharp processes the CacheAttribute aspect on a given method, it looks for configuration in the following order.

  1. the CacheAttribute itself,

  2. a CacheConfigurationAttribute attribute on the declaring class of the cached method,

  3. a CacheConfigurationAttribute attribute any parent class of the cached method (starting from the declaring class to the parent class),

  4. a CacheConfigurationAttribute added to the assembly declaring the cached method. Note that all CacheConfigurationAttribute assembly-level attributes defined in a different assembly than the current one are ignored.

  5. the caching profile (see below).

Configuration is defined on a per-property basis. The value set of a property set by the highest item in the following list wins.

Example

In the following account, the absolute expiration of cache items is set to 60 seconds for methods of the AccountServices class, but to 20 seconds for the GetAccountsOfCustomer method.

C#
Copy
using System;
using System.Collections.Generic;
using PostSharp.Patterns.Caching;

namespace PostSharp.Samples.Caching
{
    [CacheConfiguration( AbsoluteExpiration = 60 )]
    class AccountServices
    {
        [Cache]
        public static Account GetAccount(int id)
        {
           // Detailed skipped.
        }

        [Cache( AbsoluteExpiration = 20 )]
        public static IEnumerable<Account> GetAccountsOfCustomer(int customerId)
        {
            // Detailed skipped.
        }

        public static void UpdateAccount(Account account)
        {
            // Detailed skipped.
        }
    }
}
Configuring caching with caching profiles

Using custom attributes to configure caching has two major inconveniences: it is hard to share caching configuration between several classes that don't derive from the same parent, and the configuration cannot be modified at run time. To work around these limitations, you can use caching profiles.

Caching profiles are useful in the following scenarios:

  • to centralize the configuration of several cached methods (which may belong to different type hierarchies) into a single location;

  • to modify the configuration of cached methods (such as expiration settings) at run-time; and

  • to completely disable or re-enable caching at run-time.

Caching profiles are represented by the CachingProfile class. They are exposed on the CachingServicesProfiles property, which is a collection indexed by the profile name. The default caching profile is accessible via the CachingServices.Profiles.Default property.

Note Note

Configuration specified thanks to the CacheAttribute aspect and the CacheConfigurationAttribute custom attribute have priority over the configuration of the CachingProfile.

To use a caching profile:

  1. Set the ProfileName property of the CacheAttribute aspect or the CacheConfigurationAttribute custom attribute.

  2. Configure the CachingProfile object exposed on the CachingServicesProfiles collection.

Example

The following code snippet sets the profile name to Account for all methods of the AccountServices class.

C#
Copy
using System;
using System.Collections.Generic;
using System.Threading;
using PostSharp.Patterns.Caching;

namespace PostSharp.Samples.Caching
{
    [CacheConfiguration( ProfileName = "Account" )]
    class AccountServices
    {
        [Cache]
        public static Account GetAccount(int id)
        {
            // Details skipped.
        }

        [Cache]
        public static IEnumerable<Account> GetAccountsOfCustomer(int customerId)
        {
            // Details skipped.
        }

        public static void UpdateAccount(Account account)
        {
            // Details skipped.
        }
    }
}

The following code snippet sets the absolute expiration to 60 seconds for all methods using the Account profile.

C#
Copy
CachingServices.Profiles["Account"].AbsoluteExpiration = TimeSpan.FromSeconds(60);
Disabling caching at run time

You can disable caching at run time by setting the IsEnabled property of a caching profile to false, for instance:

C#
Copy
CachingServices.Profiles.Default.IsEnabled = false;
CachingServices.Profiles["Account"].IsEnabled = false;


Removing Items From the Cache

When a method updates an entity, it must also remove any cache item that depends on this entity. One way to achieve this goal is to require the update methods to know precisely which cached methods are dependent on the entity that has been modified, and to remove these methods (with proper arguments) from the cache. We call this scenario direct cache invalidation.

The benefit of direct invalidation is that it does not require a lot of resources on the caching backend. However, this approach has a big disadvantage: it exhibits an imperfect separation of concerns. Update methods need to have a precise knowledge of cached methods (typically read methods), therefore update methods need to be modified whenever a read method is added. For an approach with better abstraction, see Working with Cache Dependencies.

This topic contains the following sections:

  • Invalidating cache items using the [InvalidateCache] aspect
  • Invalidating cache items imperatively
Invalidating cache items using the [InvalidateCache] aspect

You can add the InvalidateCacheAttribute aspect to a method (called the invalidating method) to cause any call to this method to remove from the cache the value of one or more other methods. Parameters of both methods are matched by name and type. If any parameter of the cached method cannot be matched with a parameter of the invalidating method, you will get a build error (unless the parameter has the NotCacheKeyAttribute custom attribute). The order of parameters is not considered.

Note Note

By default, the InvalidateCacheAttribute aspect will look for the cached method in the current type. You can specify a different type using the alternative constructor of the custom attribute. When you invalidate a non-static method (unless instance has been excluded from the cache key by setting the IgnoreThisParameter to true), you can do it only from a non-static method of a derived type.

If there are more invalidated methods of the same name for one invalidating method, a build error is emitted. To enable invalidation of all the matching overloads by the one invalidating methods, set the property AllowMultipleOverloads to .

Example

In this example, the Update method invalidates the cached return value of the GetValue method.

C#
Copy
using System;
using System.Collections.Generic;
using System.Threading;
using PostSharp.Patterns.Caching;
using PostSharp.Patterns.Caching.Backends;

namespace PostSharp.Samples.Caching.Invalidation
{
    class Database
    {
        private Dictionary<int, string> data = new Dictionary<int, string>();

        [Cache]
        public string GetValue( int id )
        {
            Console.WriteLine( $">> Retrieving {id} from the database..." );
            Thread.Sleep( 1000 );
            return this.data[id];
        }

        [InvalidateCache( nameof(GetValue) )]
        public void Update( int id, string value )
        {
            this.data[id] = value;
        }
    }

    class Program
    {
        static void Main( string[] args )
        {
            CachingServices.DefaultBackend = new MemoryCachingBackend();

            Database db = new Database();

            db.Update( 1, "first" );

            Console.WriteLine( "Retrieving value of 1 for the 1st time should hit the database." );
            Console.WriteLine( "Retrieved: " + db.GetValue( 1 ) );

            Console.WriteLine( "Retrieving value of 1 for the 2nd time should NOT hit the database." );
            Console.WriteLine( "Retrieved: " + db.GetValue( 1 ) );

            db.Update( 1, "second" );

            Console.WriteLine( "Retrieving updated value of 1 for the 1st time should hit the database." );
            Console.WriteLine( "Retrieved: " + db.GetValue( 1 ) );
        }
    }
}

The output of this sample is:

Copy
Retrieving value of 1 for the 1st time should hit the database.
>> Retrieving 1 from the database...
Retrieved: first
Retrieving value of 1 for the 2nd time should NOT hit the database.
Retrieved: first
Retrieving updated value of 1 for the 1st time should hit the database.
>> Retrieving 1 from the database...
Retrieved: second
Invalidating cache items imperatively

Instead of annotating invalidating methods with a custom attribute, you can call to one of the overloads of the CachingServices.Invalidation.Invalidate method.

Example

In this example, the cached return value of the GetValue method is invalidated by calling one of the overloads of the CachingServices.Invalidation.Invalidate method.

C#
Copy
using System;
using System.Collections.Generic;
using System.Threading;
using PostSharp.Patterns.Caching;
using PostSharp.Patterns.Caching.Backends;

namespace PostSharp.Samples.Caching.ImperativeInvalidation
{
    class Database
    {
        private Dictionary<int, string> data = new Dictionary<int, string>();

        [Cache]
        public string GetValue( int id )
        {
            Console.WriteLine( $">> Retrieving {id} from the database..." );
            Thread.Sleep( 1000 );
            return this.data[id];
        }

        public void Update( int id, string value )
        {
            this.data[id] = value;
        }
    }

    class Program
    {
        static void Main( string[] args )
        {
            CachingServices.DefaultBackend = new MemoryCachingBackend();

            Database db = new Database();

            db.Update( 1, "first" );

            Console.WriteLine( "Retrieving value of 1 for the 1st time should hit the database." );
            Console.WriteLine( "Retrieved: " + db.GetValue( 1 ) );

            Console.WriteLine( "Retrieving value of 1 for the 2nd time should NOT hit the database." );
            Console.WriteLine( "Retrieved: " + db.GetValue( 1 ) );

            db.Update( 1, "second" );
            CachingServices.Invalidation.Invalidate( db.GetValue, 1 );

            Console.WriteLine( "Retrieving updated value of 1 for the 1st time should hit the database." );
            Console.WriteLine( "Retrieved: " + db.GetValue( 1 ) );
        }
    }
}

The output of this sample is:

Copy
Retrieving value of 1 for the 1st time should hit the database.
>> Retrieving 1 from the database...
Retrieved: first
Retrieving value of 1 for the 2nd time should NOT hit the database.
Retrieved: first
Retrieving updated value of 1 for the 1st time should hit the database.
>> Retrieving 1 from the database...
Retrieved: second


Working with Cache Dependencies

Cache dependencies have two major use cases. First, dependencies can act as a middle layer between the cached methods (typically the read methods) and the invalidating methods (typically the update methods) and therefore reduce the coupling between the read and update methods. Second, cache dependencies can be used to represent external dependencies, such as file system dependencies or SQL dependencies.

Compared to direct invalidation, using dependencies exhibits lower performance and higher resource consumption in the caching backend because of the need to store and synchronize the graph of dependencies. For details about direct invalidation, see Removing Items From the Cache.

This topic contains the following sections:

  • Working with string dependencies
  • Working with object-oriented dependencies through the ICacheDependency interface
  • Working with object-oriented dependencies through a formatter
Working with string dependencies

Eventually, all dependencies are represented as strings. Although we recommend using one of the strongly-typed approaches described below, it is good to understand how string dependencies work.

To assign a string dependency to a cached return value of a method and to invalidate it:

  1. Add a call to the CachingServices.CurrentContext.AddDependency method to the cached method.

  2. Add a call to the CachingServices.Invalidation.Invalidate method to the invalidating method.

Note Note

Dependencies properly work with recursive method calls. If a cached method A calls another cached method B, all dependencies of B are automatically dependencies of A, even if A was cached when A was being evaluated.

Example

In this example, the GetValue method assigns a string dependency to its cached return value. The Update method invalidates the dependency. This causes the related cached return value to be invalidated as well.

C#
Copy
using System;
using System.Collections.Generic;
using System.Threading;
using PostSharp.Patterns.Caching;
using PostSharp.Patterns.Caching.Backends;

namespace PostSharp.Samples.Caching.StringDependencies
{
    class Database
    {
        private Dictionary<int, string> data = new Dictionary<int, string>();

        private static string GetValueDependencyString( int id ) => $"value:{id}";

        [Cache]
        public string GetValue( int id )
        {
            Console.WriteLine( $">> Retrieving {id} from the database..." );
            Thread.Sleep( 1000 );
            CachingServices.CurrentContext.AddDependency( GetValueDependencyString( id ) );
            return this.data[id];
        }

        public void Update( int id, string value )
        {
            this.data[id] = value;
            CachingServices.Invalidation.Invalidate( GetValueDependencyString( id ) );
        }
    }

    class Program
    {
        static void Main( string[] args )
        {
            CachingServices.DefaultBackend = new MemoryCachingBackend();

            Database db = new Database();

            db.Update( 1, "first" );

            Console.WriteLine( "Retrieving value of 1 for the 1st time should hit the database." );
            Console.WriteLine( "Retrieved: " + db.GetValue( 1 ) );

            Console.WriteLine( "Retrieving value of 1 for the 2nd time should NOT hit the database." );
            Console.WriteLine( "Retrieved: " + db.GetValue( 1 ) );

            db.Update( 1, "second" );

            Console.WriteLine( "Retrieving updated value of 1 for the 1st time should hit the database." );
            Console.WriteLine( "Retrieved: " + db.GetValue( 1 ) );
        }
    }
}

The output of this sample is:

Copy
Retrieving value of 1 for the 1st time should hit the database.
>> Retrieving 1 from the database...
Retrieved: first
Retrieving value of 1 for the 2nd time should NOT hit the database.
Retrieved: first
Retrieving updated value of 1 for the 1st time should hit the database.
>> Retrieving 1 from the database...
Retrieved: second
Working with object-oriented dependencies through the ICacheDependency interface

Working with string dependencies can be error-prone because the code generating the string is duplicated in the invalidated and the invalidating method. A better approach is to encapsulate the cache key generation logic, i.e. to represent the cache dependency as an object, and add some key-generation logic to this object.

If you own the source code of the class you want to use as a cache dependency, the easiest approach is to implement the ICacheDependency interface.

Note Note

This approach can be used to implement support for other kinds of dependencies, like file system dependencies or SQL dependencies.

Example

In the following example, the Customer class represents a business entity. Instances of this class are being cached. At the same time, they serve as object dependencies, therefore the Customer class implements the ICacheDependency interface. The GetValue method assigns an object dependency of type Customer to its cached return value. The Update method invalidates the dependency. This causes the related cached return value to be invalidated as well.

C#
Copy
using System;
using System.Collections.Generic;
using System.Threading;
using PostSharp.Patterns.Caching;
using PostSharp.Patterns.Caching.Backends;
using PostSharp.Patterns.Caching.Dependencies;

namespace PostSharp.Samples.Caching.ICacheDependencies
{
    class Customer : ICacheDependency
    {
        public int Id { get; set; }

        public string Name { get; set; }

        public bool Equals( ICacheDependency other )
        {
            Customer otherCustomer = other as Customer;
            return otherCustomer != null && this.Id == otherCustomer.Id;
        }

        public string GetCacheKey() => $"{nameof(Customer)}:{this.Id}";
    }

    class Database
    {
        private Dictionary<int, Customer> customers = new Dictionary<int, Customer>();

        [Cache]
        public Customer GetCustomer( int id )
        {
            Console.WriteLine( $">> Retrieving {id} from the database..." );
            Thread.Sleep( 1000 );
            Customer customer = this.customers[id];
            CachingServices.CurrentContext.AddDependency( customer );
            return customer;
        }

        public void Update( Customer customer )
        {
            this.customers[customer.Id] = customer;
            CachingServices.Invalidation.Invalidate( customer );
        }
    }

    class Program
    {
        static void Main( string[] args )
        {
            CachingServices.DefaultBackend = new MemoryCachingBackend();

            Database db = new Database();

            db.Update( new Customer() {Id = 1, Name = "Alice"} );

            Console.WriteLine( "Retrieving value of 1 for the 1st time should hit the database." );
            Console.WriteLine( "Retrieved: " + db.GetCustomer( 1 ).Name );

            Console.WriteLine( "Retrieving value of 1 for the 2nd time should NOT hit the database." );
            Console.WriteLine( "Retrieved: " + db.GetCustomer( 1 ).Name );

            db.Update( new Customer() {Id = 1, Name = "Bob"} );

            Console.WriteLine( "Retrieving updated value of 1 for the 1st time should hit the database." );
            Console.WriteLine( "Retrieved: " + db.GetCustomer( 1 ).Name );
        }
    }
}

The output of this sample is:

Copy
Retrieving value of 1 for the 1st time should hit the database.
>> Retrieving 1 from the database...
Retrieved: Alice
Retrieving value of 1 for the 2nd time should NOT hit the database.
Retrieved: Alice
Retrieving updated value of 1 for the 1st time should hit the database.
>> Retrieving 1 from the database...
Retrieved: Bob
Working with object-oriented dependencies through a formatter

The previous approach requires implementing an interface in the source code of the business entity. If you cannot modify the source code of a dependency class, the best approach is to implement a formatter for this class and to register it.

See Customizing Cache Keys for details.


Customizing Cache Keys

Each value returned by a cached method is indexed by a cache key. By default, the cache key is composed of the full method name, the parameter types, and the parameter values. By default, parameters are formatted using the ToString method. PostSharp allows you to completely customize how the cache key is generated.

This topic contains the following sections:

  • Default cache key generation logic
  • Overriding the ToString method
  • Implementing a custom cache key formatter
  • Excluding parameters from a cache key
  • Changing the maximal length of a cache key
  • Implementing a custom cache key builder
Default cache key generation logic

By default, the key is composed of the following elements of the method call:

  • the full name of the declaring type (including generic parameters, if any),

  • the method name,

  • the method generic parameters, if any,

  • the formatted caller object (unless the method is static),

  • a comma-separated list of all method arguments including the full type of the parameter and the formatted parameter value,

  • in case that the backend supports it, a global prefix that allows using the same caching server with several applications (see e.g. KeyPrefix ).

Caution note Caution

By default, the cache key of a value is built using ToString method, but the default implementation of the ToString method does not return a unique string for custom types. You must override the ToString method or implement a formatter for all types of parameters used in a cached method.

Overriding the ToString method

By default, the cache key of a value is built using the ToString method. You can override the ToString method so that it returns a distinct value for each distinct instance of the type.

Implementing a custom cache key formatter

Since the ToString method is used in different contexts than just caching, using it as the cache key might be inappropriate in your case. In this situation, you can implement the IFormattable interface or the FormatterT class.

See Implementing a Custom Formatter for details.

Excluding parameters from a cache key

Using [NotCacheKey]

To exclude a method parameter from being a part of a cache key, add the NotCacheKeyAttribute custom attribute on the parameter to be excluded.

Using [IgnoreThisParameter]

To exclude the value of the this parameter of an instance method from being a part of a cache key, set the IgnoreThisParameter parameter of the aspect to true.

Example

In this example, the this and callId parameters of the GetNumber method are not part of the cache key.

C#
Copy
using System;
using System.Threading;
using PostSharp.Patterns.Caching;
using PostSharp.Patterns.Caching.Backends;

namespace PostSharp.Samples.Caching.ExcludingParameters
{
    class Database
    {
        [Cache( IgnoreThisParameter = true )]
        public int GetNumber( int id, [NotCacheKey] int callId )
        {
            Console.WriteLine( $">> Retrieving {id} from the database, call ID {callId}..." );
            Thread.Sleep( 1000 );
            return id;
        }
    }

    class Program
    {
        static void Main( string[] args )
        {
            CachingServices.DefaultBackend = new MemoryCachingBackend();

            int callId = 0;

            Database db1 = new Database();
            Database db2 = new Database();

            Console.WriteLine( "Retrieving value of 1 for the 1st time from DB 1 should hit the database." );
            Console.WriteLine( "Retrieved: " + db1.GetNumber( 1, callId++ ) );

            Console.WriteLine( "Retrieving value of 1 for the 2nd time from DB 1 passing different call ID should NOT hit the database." );
            Console.WriteLine( "Retrieved: " + db1.GetNumber( 1, callId++ ) );

            Console.WriteLine( "Retrieving value of 1 for the 1st time from DB 2 should NOT hit the database." );
            Console.WriteLine( "Retrieved: " + db2.GetNumber( 1, callId++ ) );
        }
    }
}

The output of this sample is:

Copy
Retrieving value of 1 for the 1st time from DB 1 should hit the database.
>> Retrieving 1 from the database, call ID 0...
Retrieved: 1
Retrieving value of 1 for the 2nd time from DB 1 passing different call ID should NOT hit the database.
Retrieved: 1
Retrieving value of 1 for the 1st time from DB 2 should NOT hit the database.
Retrieved: 1
Changing the maximal length of a cache key

The maximal length of a cache key is 2048 characters by default.

To change the maximal length of a cache key, create a new instance of the CacheKeyBuilder class passing the new value of the maximal length to the constructor and assign the new instance to the CachingServicesDefaultKeyBuilder property.

Caution note Caution

If you need large cache keys, we suggest you also hash the cache key before submitting to the caching backend. To hash the cache key, implement a custom cache key builder (see below). The MD5 algorithm is generally a good choice given its speed, its collision probability, and the fact that it cryptographic strength is irrelevant in this case.

The following example sets the maximal length of a cache key to 4096 characters:

C#
Copy
CachingServices.DefaultKeyBuilder = new CacheKeyBuilder(4096);
Implementing a custom cache key builder

All the options described above modify the behavior of formatting of a parameter value. To customize the other parts of the cache key, you can override the methods of the CacheKeyBuilder class.

To override the cache building logic

  1. Create a new class and derive it from the CacheKeyBuilder class.

  2. Override the virtual methods as needed.

    To completely override the key building process, override the BuildMethodKey(MethodInfo, IListObject, Object) and/or BuildDependencyKey(Object) methods. The default implementation of these two methods uses AppendType(UnsafeStringBuilder, Type), AppendMethod(UnsafeStringBuilder, MethodInfo), AppendArgument(UnsafeStringBuilder, Type, Object) and AppendObject(UnsafeStringBuilder, Object) helper methods. If you need to override how a type, a method, an argument or an object is formatted, you can override just some of these methods.

  3. Assign an instance of you new cache key builder to the CachingServicesDefaultKeyBuilder property.


Caching Back-Ends

The CacheAttribute can be used with different caching frameworks or caching servers. This concept is called a caching backend. Caching backends are represented by the CachingBackend abstract class. You can use an existing implementation or implement your own caching backend.

In this chapter
Section | Description
Using In-Memory Cache | This article shows how to store cached values using MemoryCache class.
Using Redis Cache | This article shows how to store cached values using Redis and using a combination of Redis and MemoryCache class.
See Also

Reference

MemoryCachingBackend
RedisCachingBackend


Using In-Memory Cache

For local, in-memory caching, PostSharp relies on the MemoryCache class of the .NET Framework.

To use the MemoryCache class to store cached values in memory, assign an instance of a MemoryCachingBackend class to CachingServicesDefaultBackend property.

C#
Copy
CachingServices.DefaultBackend = new MemoryCachingBackend();

By default, the MemoryCacheDefault is used. To use other instance of the MemoryCache than the default one, an instance of the MemoryCache class can be passed to the constructor of the MemoryCachingBackend class.

C#
Copy
MemoryCache cache = new MemoryCache( "myCache" );
CachingServices.DefaultBackend = new MemoryCachingBackend( cache );

See MSDN for details on the MemoryCache class.


Using Redis Cache

Redis is a popular choice for distributed, in-memory caching.

Our implementation uses StackExchange.Redis library internally and is compatible with on-premises instances of Redis Cache as well as with the Azure Redis Cache cloud service.

This topic contains the following sections:

  • Configuring the Redis server
  • Configuring the caching backend in PostSharp
  • Adding a local in-memory cache to a remote Redis server
  • Using dependencies with the Redis caching backend
Configuring the Redis server

To prepare your Redis server for use with PostSharp caching:

  1. Set up the eviction policy to volatile-lru or volatile-random. See https://redis.io/topics/lru-cache#eviction-policies for details.

    Caution note Caution

    Other eviction policies than volatile-lru or volatile-random are not supported.

  2. Set up the key-space notification to include the AKE events. See https://redis.io/topics/notifications#configuration for details.

Configuring the caching backend in PostSharp

To set up PostSharp to use Redis for caching:

  1. Add a reference to the PostSharp.Patterns.Caching.Redis package.

  2. Create an instance of StackExchange.Redis.ConnectionMultiplexer .

  3. Create an instance of the RedisCachingBackend class using the RedisCachingBackendCreate(IConnectionMultiplexer, RedisCachingBackendConfiguration) factory method and assign the instance to CachingServicesDefaultBackend.

Important note Important

The caching backend has to be set before any cached method is called for the first time.

Example

C#
Copy
string connectionConfiguration = "localhost";
ConnectionMultiplexer connection = ConnectionMultiplexer.Connect( connectionConfiguration );
RedisCachingBackendConfiguration redisCachingConfiguration = new RedisCachingBackendConfiguration();
CachingServices.DefaultBackend = RedisCachingBackend.Create( connection, redisCachingConfiguration );
Adding a local in-memory cache to a remote Redis server

For higher performance, you can add an additional, in-process layer of caching between your application and the remote Redis server. To enable the local cache, set the RedisCachingBackendConfigurationIsLocallyCached property to true.

The benefit of using local caching is to decrease latency between the application and the Redis server, and to decrease CPU load due to the deserialization of objects. The inconvenience is that there is that distributed local caches are synchronized asynchronously, therefore different application instances may see different values of cache items during a few milliseconds. However, the application instance initiating the change will have a consistent view of the cache.

Using dependencies with the Redis caching backend

Support for dependencies is disabled by default with the Redis caching backend because it has an important performance and deployment impact. From a performance point of view, the cache dependencies need to be stored in Redis (therefore consuming memory) and handled in a transactional way (therefore consuming processing power). As for deployment, the problem is that the cache GC process, which cleans up dependencies when cache items are expired from the cache, needs to run continuously, even when the application is not running.

If you choose to enable dependencies with Redis, you need to make sure that there is at least one instance of the cache GC process is running. It is legal to have several instances of this process running, but since all instances will compete to process the same messages, it is better to ensure that only a small number of instances (ideally one) is running.

To use dependencies with the Redis caching backend:

  • Make sure that at least one instance of the RedisCacheDependencyGarbageCollector class is alive at any moment (whenever the application is running or not). If several instances of your application use the same Redis server, a single instance of the RedisCacheDependencyGarbageCollector class is required. You may package the RedisCacheDependencyGarbageCollector into a separate application of cloud service.

  • In case of an outage of the service running the GC process, execute the PerformFullCollectionAsync(RedisCachingBackend, CancellationToken) method.

  • Set the RedisCachingBackendConfigurationSupportsDependencies property to true.


Synchronizing Local In-Memory Caches for Multiple Servers

Caching in distributed applications can be a tricky problem. When there are several instances of an application running simultaneously (typically web sites or web services deployed into the cloud or web farms), you have to make sure that the cache is properly invalidated for all instances of the application.

A typical answer to this issue is to use a centralized cache server (or a cluster of cache servers) that solves this problem for you. For instance, you can use a Redis server or a Redis cluster. However, running a cache server, even more a cache cluster, comes with a cost, and it does not always pay off for medium applications such as the website of a small business.

An alternative solution to the problem of distributed caching is to have a local in-memory cache in each instance in the application. Instead of using a shared distributed cache, each application instance caches its own data into its own local cache. However, when one instance of the application modifies a piece of data, it needs to make sure that all instances remove the relevant items from their local cache. This is called distributed cache invalidation. It can be achieved easily and cheaply with a publish/subscribe (Pub/Sub) message bus such as Azure Service Bus, much less expensive than a cache cluster.

PostSharp allows you to easily add sub/sub cache invalidation to your existing PostSharp caching.

The principal inconvenience of pub/sub invalidation is that there is some latency in the invalidation mechanism, i.e. different instances of the application can see different data during a few dozens of milliseconds.

This topic contains the following sections:

  • Using Azure Service Bus pub/sub for distributed invalidation
  • Using Redis pub/sub for distributed invalidation
Using Azure Service Bus pub/sub for distributed invalidation

To use Azure Service Bus pub/sub for distributed invalidation:

  1. Add in-memory local caching to your application as described in Using In-Memory Cache.

  2. Go to a Microsoft Azure portal, open the Service Bus panel and create a new Topic. Choose a small value for the time-to-live setting, for instance 30 seconds. See Microsoft Azure website for details.

  3. In the Microsoft Azure portal, create a Shared access policy and include the Manage right. This policy will be used by your application.

  4. Go to the properties of the newly created policy and copy the primary or secondary connection string to the clipboard.

  5. Go back to your source code and find the place where the MemoryCachingBackend is initialized.

  6. Create an instance of AzureCacheInvalidatorOptions class and specify the connection string to the shared access policy you just created.

  7. Create an instance of the AzureCacheInvalidator class using the AzureCacheInvalidatorCreate(CachingBackend, AzureCacheInvalidatorOptions) factory method passing the existing instance of theMemoryCachingBackend and AzureCacheInvalidatorOptions. Assign the new AzureCacheInvalidator the to CachingServicesDefaultBackend property.

Example

This example shows how to initialize an in-memory caching backend to let it invalidate and be invalidated using Azure Service Bus Pub/Sub.

C#
Copy
var localCache = new MemoryCachingBackend();

string connectionString = "Endpoint=sb://yourServiceNamespace.servicebus.windows.net/;EntityPath=yourTopic;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=yourKey";

var azureCacheInvalidatorOptions = new AzureCacheInvalidatorOptions
                                    {
                                        ConnectionString = connectionString
                                    };

CachingServices.DefaultBackend = AzureCacheInvalidator.Create( localCache, azureCacheInvalidatorOptions );
Using Redis pub/sub for distributed invalidation

If you are already using Redis for PostSharp caching, it is useless to add another layer of invalidation because this is already taken care of by the RedisCachingBackend class. However, if you already have a Redis cluster but you don't want to use it for caching, you can still use it for cache invalidation. An example situation is when the latency of your Redis server is too high for caching but sufficient for cache invalidation.

To use Redis Pub/Sub for distributed invalidation:

  1. Add in-memory local caching to your application as described in Using In-Memory Cache.

  2. Create an instance of StackExchange.Redis.ConnectionMultiplexer. See Redis Pub/Sub documentation for details.

  3. Create and configure an instance of RedisCacheInvalidatorOptions class.

  4. Create an instance of the RedisCacheInvalidator class using the RedisCacheInvalidatorCreate(CachingBackend, IConnectionMultiplexer, RedisCacheInvalidatorOptions) factory method passing your instance of MemoryCachingBackend and RedisCacheInvalidatorOptions. Assign the instance to the CachingServicesDefaultBackend property.

Example

This example shows how to initialize an in-memory caching backend to let it invalidate and be invalidated using Redis Pub/Sub.

C#
Copy
var localCache = new MemoryCachingBackend();

string connectionConfiguration = "localhost";
string channelName = "myCahnnel";

ConnectionMultiplexer connection = ConnectionMultiplexer.Connect( connectionConfiguration );

var redisCacheInvalidatorOptions = new RedisCacheInvalidatorOptions
                                    {
                                        ChannelName = channelName
                                    };

CachingServices.DefaultBackend = RedisCacheInvalidator.Create( localCache, connection, redisCacheInvalidatorOptions );


Caching Special Types with Value Adapters

Some types, for instance the IEnumeratorT interface or the Stream class cannot be directly cached because the position of the enumerator or stream can be changed by the caller. Some other interfaces like IEnumerableT cannot be cached because the real value may be a LINQ expression, and it is not useful to cache the LINQ expression itself. However, you may still want to cache methods returning these types. If you wrote the code manually, you would simply cache a different type, for instance a list or an array of bytes.

PostSharp addresses this problem by the concept of a value adapter. A value adapter allows you to store another type than the one than the return type of the cached method. The method return value is called the exposed value because this is the value exposed by your API. The exposed value must be type-compatible with the method return type. The value that is actually stored in cache is called the stored value. For instance, for a method returning a Stream, the stored value is an array of bytes and the exposed value is a MemoryStream.

This topic contains the following sections:

  • Standard value adapters
  • Implementing a custom value adapter
Standard value adapters

The following value adapters are used automatically by default:

Return type | Stored type | Exposed type | Comments
IEnumerableT | ListT | ListT |
IEnumeratorT | ListT | System.Collections.GenericListTEnumerator | The IEnumerator.Reset method is not supported by the exposed value.
Stream | Byte[] | MemoryStream |
Implementing a custom value adapter

To implement a custom value adapter:

  1. Add a reference to the PostSharp.Patterns.Caching package.

  2. Create a class implementing the IValueAdapterT interface or the IValueAdapter interface.

  3. Register the class from the previous step using one of the overloads of the ValueAdapterFactoryRegister method.

    Each caching backend has its own instance of the PostSharp.Patterns.Caching.ValueAdaptersValueAdapterFactory class available via the ValueAdapters property.

Note Note

Null values are handled automatically outside of the value adapters.

Example

In this example, we create the EnumerableValueAdapter`1 class, which transforms instances of the IEnumerableT interface into an array.

C#
Copy
using System;
using System.Collections.Generic;
using System.Linq;
using PostSharp.Patterns.Caching;
using PostSharp.Patterns.Caching.Backends;
using PostSharp.Patterns.Caching.ValueAdapters;

namespace PostSharp.Samples.Caching.ValueAdapters
{
    class EnumerableValueAdapter<T> : ValueAdapter<IEnumerable<T>>
    {
        public override IEnumerable<T> GetExposedValue(object storedValue)
        {
            return (IEnumerable<T>)storedValue;
        }

        public override object GetStoredValue(IEnumerable<T> value)
        {
            Console.WriteLine("Caching enumerable.");
            return value.ToArray();
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            MemoryCachingBackend memoryCachingBackend = new MemoryCachingBackend();
            memoryCachingBackend.ValueAdapters.Register(typeof(IEnumerable<>), typeof(EnumerableValueAdapter<>));
            CachingServices.DefaultBackend = memoryCachingBackend;

            Console.WriteLine("Cache miss:");
            foreach (int value in GetValues())
            {
                Console.WriteLine("Value {0} obtained.", value);
            }

            Console.WriteLine("Cache hit:");
            foreach (int value in GetValues())
            {
                Console.WriteLine("Value {0} obtained.", value);
            }

            Console.WriteLine("Cache miss for null:");
            Console.WriteLine(GetNull() == null);

            Console.WriteLine("Cache hit for null:");
            Console.WriteLine(GetNull() == null);
        }

        [Cache]
        static IEnumerable<int> GetValues()
        {
            for (int value = 0; value < 3; value++)
            {
                Console.WriteLine("Returning value {0}.", value);
                yield return value;
            }
        }

        [Cache]
        static IEnumerable<int> GetNull()
        {
            return null;
        }
    }
}

The output of this sample is:

Copy
Cache miss:
Caching enumerable.
Returning value 0.
Returning value 1.
Returning value 2.
Value 0 obtained.
Value 1 obtained.
Value 2 obtained.
Cache hit:
Value 0 obtained.
Value 1 obtained.
Value 2 obtained.
Cache miss for null:
True
Cache hit for null:
True


Preventing Concurrent Execution of Cached Methods

When the evaluation of a method consumes significant resources or time, you may want to prevent a situation where several threads, processes or machines are evaluating the same method with the same parameters at the same time. You can achieve it by instructing PostSharp to use a lock manager. PostSharp implements two lock managers: the default NullLockManager, and LocalLockManager.

This topic contains the following sections:

  • Preventing concurrent execution in the current process
  • Handling lock timeouts
  • Implementing a distributed lock manager
Preventing concurrent execution in the current process

By default, the caching aspect allows concurrent execution of the same method with the same arguments.

The LocalLockManager class implements that is able to prevent execution of methods running in the current process (or AppDomain, to be exact).

To configure the lock manager, you have to set the CachingProfileLockManager property. Each caching profile must be set up separately.

The following code shows how to configure locking for two profiles:

C#
Copy
CachingServices.Profiles.Default.LockManager = new LocalLockManager();
CachingServices.Profiles["MyProfile"].LockManager = new LocalLockManager();
Note Note

Each instance of the LocalLockManager class maintains its own set of locks. However, whether several profiles use the same or a different instance of the LocalLockManager does not matter because each method is associated with one and only one profile.

Handling lock timeouts

By default (unless you use the default NullLockManager), the caching aspect will wait for a lock during an infinite amount of time. Suppose that the thread that evaluates the method gets stuck (e.g. it is involved in a deadlock). Because of the locking mechanism, all threads evaluating the same method will also get stuck. To avoid this situation, you can choose to implement a timeout behavior.

Two properties influence the timeout behavior:

Property | Description
CachingProfileAcquireLockTimeout | Maximum time that the caching aspect will wait for the lock manager to acquire a lock. To specify an infinite waiting time, set this property to TimeSpan.FromMilliseconds( -1 ). The default behavior is to wait infinitely.
CachingProfileAcquireLockTimeoutStrategy | Implements the logic executed when the caching aspect could not acquire a lock because of a timeout. The default behavior is to throw a TimeoutException. You can implement your own strategy by implementing the IAcquireLockTimeoutStrategy interface.
Note Note

This section only covers the time it takes to acquire a lock. It does not cover the execution time of the method that has already acquired the lock.

The following code shows how to set a 10-second timeout and ignore any timeout situation.

C#
Copy
CachingServices.Profiles.Default.AcquireLockTimeout = TimeSpan.FromSeconds(10);
CachingServices.Profiles.Default..AcquireLockTimeoutStrategy = new IgnoreLockStrategy();

Here is the code of the IgnoreLockStrategy class:

C#
Copy
public class IgnoreLockStrategy : IAcquireLockTimeoutStrategy
{
    public void OnTimeout( string key )
    {
       // The cacheable method will be evaluated regardless of our unability to acquire a lock,
       // unless we throw an exception here.
    }
}
Implementing a distributed lock manager

Implementing a distributed locking algorithm is a highly complex task and we at PostSharp decided not to get involved in this business (just as we do not provide the implementation of a cache itself). However, PostSharp gives you the ability to use any third-party implementation.

To create make your lock manager work with the caching aspect, you should implement the ILockManager and ILockHandle interfaces.


Multithreading

The Threading Pattern Library helps building multithreaded applications with fewer lines of code and fewer defects. The library implements locking models (thread unsafe, reader-writer synchronized, actor), thread synchronization aspects (to background thread, to UI thread), and a deadlock detection facility.

It provides the following features:

  • Threading Models. A threading model is a design pattern that gives guarantees that your code executes safely on a multithreaded computer. Three models are implemented: Thread Exclusive (thread unsafe), Reader-Writer Synchronized, and Actor. See Writing Thread-Safe Code with Threading Models for details.

  • Thread Dispatching. Custom attributes DispatchedAttribute and BackgroundAttribute cause the execution of a method to be dispatched to the UI thread or to a background thread, respectively. For details, read Dispatching a Method to the UI Thread and Dispatching a Method to Background.

  • Deadlock Detection. Detects deadlocks at run time and throws an exception instead of allowing your application to freeze. For details, see Detecting Deadlocks at Runtime.


Writing Thread-Safe Code with Threading Models

A threading model is a design pattern that gives guarantees that your code executes safely on a multithreaded computer. Threading models both define coding rules (for instance: all fields must be private) and add new behaviors to existing code (for instance: acquiring a lock before method execution). Coding rules are typically enforced at build time or at run time; violations result in build-time errors or run-time exceptions. Threading models may also require the use of custom attributes in source code, for instance to indicate that a method requires read access to the object.

Tip Tip

We recommend assigning a threading model to every class whose instances can be shared between different threads.

Threading models raise the level of abstraction at which multi threading is addressed. Compared to working directly with locks and other low-level threading primitives, using threading models has the following benefits:

  • Threading models are named solutions to a recurring problem. Threading models are specific types of design patterns, and have the same benefits. When team members discuss the multithreaded behavior of a class, they just need to know which threading model this class uses. They don't need to know the very details of its implementation. Since the human short-term memory seems to be limited to 5-9 elements, it is important to think in terms of larger conceptual blocks whenever we can.

  • Much of the code required to implement the threading model can be automatically generated, which decreases the number of lines of code, and therefore the number of defects. It also reduces development and maintenance costs.

  • Your source code can be automatically verified against the selected threading model, both at build time and at run time. This makes the discovery of defect much more deterministic. Without verifications, threading defects usually show up randomly and provoke data structure corruption instead of immediate exceptions. Run-time verification would be too labor-intensive to implement without compiler support, so would be most likely omitted.

Available threading models

PostSharp Threading Library provides an implementation for the following threading models:

Threading Model | Aspect Type | Description
Thread-Unsafe Threading Model | ThreadUnsafeAttribute | These objects may never be accessed concurrently by several threads.
Thread Affine Threading Model | ThreadAffineAttribute | These objects must be accessed from the thread that instantiated them.
Synchronized Threading Model | SynchronizedAttribute | Synchronized objects can be accessed by a single thread at a time. Other threads will wait until the object is available.
Reader/Writer Synchronized Threading Model | ReaderWriterSynchronizedAttribute | These objects that can be read concurrently by several threads, but write access requires exclusivity. Public methods of this object must specify which kind of access they require (read or write, typically).
Actor Threading Model | ActorAttribute | These objects communicate with their clients using an asynchronous communication pattern. All accesses to the object are queued and then processed in a single thread. However, queuing is transparent to clients, which just call standard void or methods.
Freezable Threading Model | FreezableAttribute | These objects can be set to a state where their property values can no longer be changed. Unlike immutable objects, the developer dictates the time and place in their code where changes to the object's state will no longer be accepted.
Immutable Threading Model | ImmutableAttribute | These objects cannot have their state changed after their constructor has finished executing.
Other topics
Article | Description
Making a Whole Project or Solution Thread Safe | This article describes how to get compiler warnings when you forget to assign a threading model to a type.
Opting In and Out From Thread Safety | This article shows how to disable the enforcement of the threading model for specific fields or methods.
Compatibility of Threading Models | This article lists compatibility of threading models when they are applied to objects that are in a parent-child relationship.
Enabling and Disabling Runtime Verification | This article explains when runtime verification is enabled or disabled and how to customize the default behavior.
Conceptual documentation

Please read this technical white paper for details about the concepts and architecture of PostSharp Threading Models.


Immutable Threading Model

There are times when you want certain objects in your codebase to retain their post creation state without the possibility of it ever changing. These objects are said to be immutable. Immutable objects are useful in multithreaded applications because they can be safely accessed by several threads concurrently, without the need for locking or other synchronization. PostSharp offers the ImmutableAttribute aspect that allows you enforce this pattern on your objects.

Changes in an object with the ImmutableAttribute aspect will be forbidden as soon as the object constructor exits. Any further attempt to modify the object will result in an ObjectReadOnlyException.

Note Note

The Immutable pattern can be too strong for some common object-oriented scenarios, for instance with serializable classes. In some cases, the Freezable object is a better choice. For details, see Freezable Threading Model.

This topic contains the following sections:

  • Making a class immutable
  • Rules enforced by the Immutable aspect
  • Immutable object trees
  • Immutable vs readonly
  • Constructor execution
  • Immutable collections
Making a class immutable

To add the Immutable pattern manually:

  1. Add a reference to the PostSharp.Patterns.Threading package to your project.

  2. Add the ImmutableAttribute custom attribute to your class.

  3. Annotate your object model for parent/child relationships as described in Annotating an Object Model for Parent/Child Relationships (Aggregatable).

Rules enforced by the Immutable aspect

An immutable object will throw the following exceptions at run-time:

  • ThreadMismatchException if both following conditions are simultaneously true:

    • you access the object from a different thread than the one that created it, and

    • the constructor has not completed yet.

  • ObjectReadOnlyException if a field or property is being modified after the constructor has completed.

Immutable object trees

Because the Immutable pattern is an implementation of the Aggregatable pattern, all of the same behaviors of the AggregatableAttribute are available. As a result, you can create both immutable classes and immutable object trees. For more information regarding object trees, read Parent/Child, Visitor and Disposable.

Note Note

Children of immutable objects must be marked as Immutable or Freezable themselves. Adding ImmutableAttribute or FreezableAttribute to the child classes will accomplish this. Freezable children will be automatically frozen when the constructor of the parent completes.

Immutable vs readonly

Many C# developers make use of the readonly keyword in an attempt to make their objects immutable. The readonly keyword doesn't guarantee immutability though. Using readonly only ensures that no method other than the object's constructor can alter the variable's value. It doesn't, however, prevent you from altering values on complex objects outside of the constructor.

The readonly keyword may be too strict

In the following code sample, the _id variable is a primitive type and can't be altered outside the constructor. This is enforced at compile time and an error would be displayed where the SetIdentifier method attempts to change the _id field value. The compiler does not see that the SetIdentifier method is called only from the constructor. In this example, the readonly keyword is too strong even if the class is legitimately immutable.

C#
Copy
public class Invoice
{
  public readonly long _id;

  public Invoice(long id)
  {
    SetIdentifier(id);
  }

  private void SetIdentifier(long id)
  {
    // Will cause compilation error.
    _id = id;
  }
}

The readonly keyword may also be too loose

When you have complex entities composed of several objects, immutability is a characteristic of the whole entity, not of a single object. However, this does not fit with the readonly keyword.

In the following example, the Invoice is not immutable even if the _invoiceHeader field is readonly.

C#
Copy
public class Invoice
{
  public readonly InvoiceHeader _invoiceHeader;

  public Invoice()
  {
    _invoiceHeader = new InvoiceHeader();
  }

  public void Refresh()
  {
    // Valid but not immutable.
    _invoiceHeader.CustomerName = "Jim";
    _invoiceHeader.CustomerPhone = "555-123-9876";
  }
}

The same type of change to object state can happen with collections. You can not reinitialize a readonly collection, but you can freely Add, Remove, Clear and do other operations that the collection itself exposes. Additionally, if the collection contains complex types you are able to change values on each instance that the collection contains.

C#
Copy
public class Invoice
{
  public readonly IList<Item> _items;
  public Invoice()
  {
    _items = new List<Item>();
  }

  public void Refresh()
  {
    //will cause a compilation error
    _items = new List<Item>();

    //valid but not immutable
    _items.Add(new Item());
    _items[0].Price = 3.50;
    _items.RemoveAt(0);
  }
}

As you can see there is no way to use the readonly keyword to make complex object graphs immutable. Combining the ImmutableAttribute, ChildAttribute, AdvisableCollectionT and the AdvisableDictionaryTKey, TValue types allows you to make immutable objects that guarantee no changes to primitive or complex objects after constructor execution has completed.

Constructor execution

Objects are not frozen until the last constructor has finished executing. Because of this, you can use the constructor to set up the state of the parent instance through its own constructor as well as chained, or inherited object, constructors. You're also able to make changes to child object instances through their constructors at this time.

Copy
[Immutable]
public class Invoice : Document
{
  public Invoice(long id) : base(id)
  {
    Items = new AdvisableCollection<Item>();
    Items.Add(new Item("widget"));
  }

  [Child]
  public AdvisableCollection<Item> Items { get; set; }
}

[Immutable]
public class Document
{
  private long _id;
  public Document (long id)
  {
    _id = id;
  }
}

[Immutable]
public class Item
{
  public Item (string name)
  {
    Name = name;
  }
  public string Name { get; set; }
}

In this example, the constructors finish executing in the order of Document, Item and finally Invoice. It is not until after the Invoice constructor finishes executing that the object graph is made immutable.

Immutable collections

When authoring immutable object models, immutable collections are a good replacement for advisable collections. For details, see [immutable-collections].

See Also

Reference

ImmutableAttribute
AggregatableAttribute
AdvisableDictionaryTKey, TValue
AdvisableCollectionT

Other Resources

[immutable-collections]


Freezable Threading Model

When you need to prevent changes to an instance of an object most of the time, but not all of the time, the Immutable pattern (implemented by the ImmutableAttribute aspect) will be too aggressive for you. In these situations, you need a pattern that allows you to define the point in time where immutability begins. To accomplish this you can make use of the FreezableAttribute aspect.

Changes in an object with the ImmutableAttribute aspect will be forbidden as soon as you call the Freeze method. Any further attempt to modify the object will result in an ObjectReadOnlyException. Any attempt to share the object before you call the Freeze method. will result in a ThreadMismatchException.

This topic contains the following sections:

  • Making an object freezable
  • Freezing an object
  • Rules enforced by the Freezable aspect
  • Determining whether an object is in frozen state
  • Freezable object trees

To make an object freezable all you need to do is add the FreezableAttribute attribute to the class in question.

Making an object freezable

To make an object freezable:

  1. Add the PostSharp.Patterns.Threading package to your project using NuGet.

  2. Add the FreezableAttribute custom attribute to your class.

    C#
    Copy
    using PostSharp.Patterns.Threading;

[Freezable]
public class Invoice
{
  public long Id { get; set; }
}

  3. Annotate your object model for parent/child relationships as described in Annotating an Object Model for Parent/Child Relationships (Aggregatable).

Freezing an object

To freeze an object, use will first have to case the object to the IFreezable interface. After that, you are able to call the Freeze method.

C#
Copy
var invoice = new Invoice();
invoice.Id = 123456;

((IFreezable)invoice).Freeze();
Note Note

The IFreezable interface will be injected into the Invoice class after compilation. Tools that are not aware of PostSharp may incorrectly report that the Invoice class does not implement the IFreezable interface.

Instead of using the cast operator, you can also use the CastSourceType, TargetType(SourceType) method. This method is faster and safer than the cast operator because it is verified and compiled by PostSharp at build time.

Note Note

If you are attempting to freeze either AdvisableCollectionT or AdvisableDictionaryTKey, TValue you will not be able to use the cast operator or the CastSourceType, TargetType(SourceType) method. Instead, you will have to use the QueryInterface``1(Object, Boolean) extension method.

Once you’ve called the Freeze method on an object instance the code will no longer be able to change the property values on that instance. If a value change is attempted the code will throw an ObjectReadOnlyException.

C#
Copy
var invoice = new Invoice();
invoice.Id = 123456;

((IFreezable)invoice).Freeze();

// This will throw an exception.
invoice.Id = 345678;
Rules enforced by the Freezable aspect

A freezable object will throw the following exceptions at run-time:

  • ThreadMismatchException if both following conditions are simultaneously true:

    • you access the object from a different thread than the one that created it, and

    • the Freeze method has not yet been called.

  • ObjectReadOnlyException if a field or property is being modified after the Freeze method has been called.

Determining whether an object is in frozen state

To determine whether an object has been frozen, cast it to IThreadAware and get the readonly value from IsReadOnly via the ConcurrencyController property.

C#
Copy
var invoice = new Invoice();
invoice.Id = 123456;

((IFreezable)invoice).Freeze();

// The 'frozen' property will be set to 'true'.
bool frozen = ((IThreadAware)invoice).ConcurrencyController.IsReadOnly;
Freezable object trees

The Freezable pattern relies on the Aggregatable pattern. The AggregatableAttribute aspect will be implicitly added to the target class. Therefore, you can not only create freezable classes, but also freezable object trees. Read the Parent/Child, Visitor and Disposable for more information on how to establish object trees.

Important note Important

Children of freezable objects must be either freezable either immutable. Therefore, children classes must be annotated with the FreezableAttribute or ImmutableAttribute custom attribute. Collection types must be derived from AdvisableCollectionT or AdvisableDictionaryTKey, TValue.

See Also

Reference

FreezableAttribute
AggregatableAttribute
ChildAttribute
ParentAttribute
ImmutableAttribute
AdvisableDictionaryTKey, TValue
AdvisableCollectionT

Other Resources

Immutable Threading Model
Parent/Child, Visitor and Disposable
Annotating an Object Model for Parent/Child Relationships (Aggregatable)
Working With Child Collections


Thread Affine Threading Model

One of the simplest ways to consider threading is to limit object instance access to the thread that created the instance. This is how the Thread Affine threading model works.

This topic contains the following sections:

  • Adding the Thread Affine model to a class
  • Rules enforced by the Actor aspect
  • Working with object trees
Adding the Thread Affine model to a class

To apply the Thread-Affine threading model to a class:

  1. Add the PostSharp.Patterns.Threading package to your project.

  2. Add using PostSharp.Patterns.Threading namespace to your file.

  3. Add the ThreadAffineAttribute to the class.

  4. Annotate your object model for parent/child relationships as described in Annotating an Object Model for Parent/Child Relationships (Aggregatable).

Example

In the example below the ThreadAffineAttribute has been added to the class.

C#
Copy
[ThreadAffine]
public class OrderService
{
    public void Process(int sequence)
    {
        Console.WriteLine("sequence {0}", sequence);
        Console.WriteLine("sleeping for 10s");

        Thread.Sleep(new TimeSpan(0,0,10));
    }
}
Rules enforced by the Actor aspect

The ThreadAffineAttribute aspect does not verify your code at build-time. Instead, it injects code that enforces the model at run time. If it detects that the object is being accessed from a different thread than the one that created it, the aspect will throw a ThreadMismatchException exception.

To test this the thread-affine OrderService class, we can run the following code:

C#
Copy
public void Main()
{
    var orderService = new OrderService();

    orderService.Process(1);

    var backgroundWorker = new BackgroundWorker();
    backgroundWorker.DoWork += (sender, args) =>
    {
        try
        {
            orderService.Process(2);
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.ToString());
        }
    };
    backgroundWorker.RunWorkerAsync();
}

The above code will execute the orderService.Process(1) method and output the following to the console.

That code successfully executed because the orderService instance was both created (via the new keyword) and executed on the same thread.

After the 10 second sleep period, a BackgroundWorker thread is opened and it is set to execute the orderService.Process(2) method. If an exception is thrown that will be output to the console. When this piece of code executes you will see the following console output.

As you can see that a ThreadMismatchException exception was thrown. This happened because the orderService instance was created on the main thread and the BackgroundWorker thread attempted to execute it. Because the OrderService class has been marked with the ThreadAffineAttribute attribute only the thread that creates an instance of it can access that instance.

Working with object trees

Because the Thread-Affine model is an implementation of the Aggregatable pattern, all of the same behaviors of the AggregatableAttribute are available. For more information regarding object trees, read Parent/Child, Visitor and Disposable.

Note Note

Once you have established your parent-child relationships you will need to apply compatible threading models to the child classes. You will want to refer to the Compatibility of Threading Models article to determine which threading model will work for the children of the Thread-Affine object.

See Also

Reference

ThreadAffineAttribute
ThreadMismatchException
PrivateThreadAwareAttribute
ChildAttribute

Other Resources

Compatibility of Threading Models


Synchronized Threading Model

A common way to avoid data races is to enclose all public instance methods of a class with a lock(this) statement. This is basically what the Synchronized model does

This article describes how to use the Synchronized model and how it differs from the use of lock(this) statement.

This topic contains the following sections:

  • Comparing with lock(this)
  • Applying the Synchronized model to a class
  • Rules enforced by the Synchronized aspect
  • Working with object trees
Comparing with lock(this)

Traditionally, the C# keyword lock(this) statement has been used to synchronize access of several threads to a single object. When an object is locked by one thread, any other object that attempts to access that object will have its execution blocked.

C#
Copy
private object myLockingObject = new Object();

public void DoSomething()
{
    lock(myLockingObject)
    {
        //some code that does something in one thread at a time
    }
}

In this example, the myLockingObject member variable is used as a locking object. Once a thread runs the lock(myLockingObject) line, all other threads that enter the DoSomething method will stop executing, or be blocked, until the original thread has exited the lock(myLockingObject) code block.

The Synchronized model is similar to using the lock statement around every single public method, but it has the following differences:

  • It is not technically equivalent to locking the current instance (this). Another object is actually being locked.

  • Locking is automatic for all public and internal instance methods. You cannot forget it.

  • If a thread attempts to access a field without having first acquired access to the object (by invoking a public or internal method), an exception will be thrown.

  • The pattern also works with entities composed of several objects organized in a tree.

Applying the Synchronized model to a class

To apply the Synchronized threading model to a class:

  1. Add the PostSharp.Patterns.Threading package to your project.

  2. Add using PostSharp.Patterns.Threading namespace to your file.

  3. Add the SynchronizedAttribute to the class.

  4. Annotate your object model for parent/child relationships as described in Annotating an Object Model for Parent/Child Relationships (Aggregatable).

Example

In the example below the SynchronizedAttribute has been added to the class.

C#
Copy
[Synchronized]
public class OrderService
{
    public void Process(int sequence)
    {
        Console.WriteLine("sequence {0}", sequence);
        Console.WriteLine("sleeping for 10s");

        Thread.Sleep(new TimeSpan(0,0,10));
    }
}

To test this we can run the following code.

Copy
public void Main()
{
    var orderService = new OrderService();

    var backgroundWorker = new BackgroundWorker();
    backgroundWorker.DoWork += (sender, args) => orderService.Process(1);
    backgroundWorker.RunWorkerAsync();

    orderService.Process(2);
}

The code above will attempt to execute the Process method on two different threads; the main thread and a background worker thread. Because these two threads are trying to access the same instance of the OrderService the first thread to access it will block the second. As a result, when you run the program you will first see the following.

Because the OrderService.Process method has a Thread.Sleep call, the first thread accessing that method will block the second for 10 seconds. After those 10 seconds have passed the second thread will no longer be blocked and it will be able to continue its execution.

Rules enforced by the Synchronized aspect

The SynchronizedAttribute aspect emits build-time errors in the following situations:

  • The class contains a public or internal field.

A synchronized object will throw a ThreadAccessException whenever some code tries to access a field from a thread that does not own the correct lock, i.e. the call stack does not contain a public or internal method of this method (e.g. a private delegate call).

Working with object trees

Because the Synchronized model is an implementation of the Aggregatable pattern, all of the same behaviors of the AggregatableAttribute are available. For more information regarding object trees, read Parent/Child, Visitor and Disposable.

Note Note

Once you have established your parent-child relationships you will need to apply compatible threading models to the child classes. You will want to refer to the Compatibility of Threading Models article to determine which threading model will work for the children of the Synchronized object.

See Also

Reference

SynchronizedAttribute
ChildAttribute
PrivateThreadAwareAttribute

Other Resources

Compatibility of Threading Models


Reader/Writer Synchronized Threading Model

When a class instance is concurrently used by multiple threads, accesses must be synchronized to prevent data races, which typically result in data inconsistencies and corruption of data structures. The Reader/Writer Synchronized Threading Model uses locks to allow several read-only methods to execute simultaneously on one instance, but guarantee that writer methods have exclusive access.

The Reader/Writer Synchronized Threading Model is implemented by the ReaderWriterSynchronizedAttribute aspect. It requires you to annotate all public methods of your synchronized classes with the ReaderAttribute and WriterAttribute custom attributes.

This topic contains the following sections:

  • Why use the reader-writer synchronized pattern?
  • Making a class reader-writer synchronized
  • Rules enforced by the ReaderWriterSynchronized aspect
  • Raising synchronous events
  • Executing long-running write methods
  • Working with object trees
Why use the reader-writer synchronized pattern?

Problems without locks

Consider the following example of an Order class which stores an amount and a discount:

C#
Copy
class Order
{
    int Amount { get; private set; }
    int Discount { get; private set; }

    public int AmountAfterDiscount
    {
        get { return this.Amount - this.Discount; }
    }

    public void Set(int amount, int discount)
    {
        if (amount < discount)
            throw new InvalidOperationException();

        this.Amount = amount;
        this.Discount = discount;
    }
}

In this example, the Set method writes to the Amount and Discount members, while the AmountAfterDiscount property reads these members. In a single-threaded program, the AmountAfterDiscount property is guaranteed to be positive or zero. However, in a multithreaded program, the AmountAfterDiscount property could be evaluated in the middle of the Set operation, and return an inconsistent result.

Problems of the lock keyword

The easiest way to synchronize accesses to a class in C# is to use the lock keyword. However, this practice cannot be generalized for two reasons:

  • The use of exclusive locks often results in high contention and therefore low performance because many threads queue to access the same resource;

  • Applications relying on exclusive locks are prone to deadlocks because of cyclic waiting dependencies.

Problems of reader-writer locks

Reader-writer locks take advantage of the fact that most applications involve much fewer writes than reads, and that concurrent reads are always safe. Reader-writer locks ensure that no other thread is accessing the object when it is being written. Reader-writer locks are normally implemented by the .NET classes ReaderWriterLock or ReaderWriterLockSlim. The following example shows how ReaderWriterLockSlim would be used to control reads and writes in the Order class:

C#
Copy
class Order
{
    private ReaderWriterLockSlim orderLock = new ReaderWriterLockSlim();

    public decimal Amount { get; private set; }
    public decimal Discount { get; private set; }

    public decimal AmountAfterDiscount
    {
        get
        {
            orderLock.EnterReadLock();
            decimal result = this.Amount - this.Discount;
            orderLock.ExitReadLock();
            return result;
        }
    }

    public void Set(decimal amount, decimal discount)
    {

        if (amount < discount)
        {
            throw new InvalidOperationException();
        }

        orderLock.EnterWriteLock();
        this.Amount = amount;
        this.Discount = discount;
        orderLock.ExitWriteLock();
    }
}

However, working directly with the ReaderWriterLock and ReaderWriterLockSlim classes has disadvantages:

  • It is cumbersome because a lot of code is required.

  • It is unreliable because it is too easy to forget to acquire the right type of lock, and these errors are not detectable by the compiler or by unit tests.

So, not only the direct use of locks results in more lines of code, but it won’t reliably prevent nondeterministic data structure corruptions.

Making a class reader-writer synchronized

PostSharp Threading Pattern Library has been designed to eliminate nondeterministic data corruptions while reducing the size of thread synchronization code to the absolute minimum (but not less).

The ReaderWriterSynchronizedAttribute aspect implements the threading model (or threading pattern) based on the reader-writer lock, with the following principles:

  • At any time, the object can be open for reading or closed for reading.

  • Methods define their required access level using ReaderAttribute and WriterAttribute custom attributes (other access levels exist for advanced scenarios)

  • An error will be emitted at build-time or runtime, but deterministically, whenever an object field is being accessed by a method that does not have the required access level on the object.

To apply the ReaderWriterSynchronized threading model to a class:

  1. Add the PostSharp.Patterns.Threading package your project.

  2. Add using PostSharp.Patterns.Threading namespace to your file.

  3. Add the custom attribute [ReaderWriterSynchronizedAttribute] to the class.

  4. Annotate your object model for parent/child relationships as described in Annotating an Object Model for Parent/Child Relationships (Aggregatable).

  5. Add the custom attribute [ReaderAttribute] or [WriterAttribute] to the public and internal methods. Note that it is not necessary to put these attributes on property getters and setters or on events.

The ReaderAttribute attribute causes PostSharp to acquire a lock on the instance whenever the method is invoked. While this lock is held, other threads can also read properties or invoke read-only methods of that instance, but calls to properties or methods marked with WriterAttribute will be blocked until all reads are complete.

Likewise, invoking methods marked with WriterAttribute will lock the instance causing all reads and writes to block until the write has completed and the write lock has been released.

Example

The following code shows the Order class, synchronized with the reader-writer threading pattern:

C#
Copy
[ReaderWriterSynchronized]
class Order
{
    decimal Amount { get; private set; }
    decimal Discount { get; private set; }

    public decimal AmountAfterDiscount
    {
        get { return this.Amount - this.Discount; }
    }

    [Writer]
    public void Set(decimal amount, decimal discount)
    {
        if (amount < discount)
            throw new InvalidOperationException();

        this.Amount = amount;
        this.Discount = discount;
    }
}
Rules enforced by the ReaderWriterSynchronized aspect

The ReaderWriterSynchronizedAttribute aspect emits build-time errors in the following situations:

  • The class contains a public or internal field.

  • The class contains a public method is missing a ReaderAttribute or WriterAttribute custom attribute, or another attribute derived from AccessLevelAttribute. Note that property getters and setters and event accessors do not need to be annotated.

The reader/writer synchronized object will throw a ThreadAccessException whenever some code tries to access a field from a thread that does not own the correct lock, i.e. when a reader method tries to write a field, or when a non-annotated method (e.g. a delegate call) tries to read or write a field.

Raising synchronous events

In some situations, a method with write access needs to allow other threads to read the object before another write is performed on the object. The implementation of INotifyCollectionChanged gives a typical example of this situation. The INotifyCollectionChanged event defined by this interface is typically raised from a write method but is consumed from the user interface thread. The object cannot have changed between the moment the event is raised and it is processed by the UI thread, because the event arguments contain data that relates to the current state of the object. Using only WriterAttribute and ReaderAttribute would either result in deadlocks or in inconsistencies, respectively.

The solution to this problem is to use the YielderAttribute custom attribute, which allows read access from other threads but prevents any other thread from acquiring a writer lock.

Example

In the following example, OrderCollection is a collection of Order objects. In this example, the Add() and Remove() methods are marked with the WriterAttribute attributes. Listeners can be notified about these changes by subscribing to the CollectionChanged event which is exposed through the implementation of INotifyCollectionChanged

Since listeners can be on other threads (e.g. a UI thread), this event is invoked by the Add() and Remove() methods via a method called OnCollectionChanged() which has been marked with the YielderAttribute attribute. This lock ensures that the listener (which may be in another thread space) can read the current state of the collection without the collection being modified by another invocation of the Add() or Remove() operations from another thread.

C#
Copy
[ReaderWriterSynchronized]
class OrderCollection : ICollection, INotifyCollectionChanged
{
    ArrayList list = new ArrayList();

    // Details skipped.

    [Reader]
    public int Count
    {
        get
        {
            return list.Count;
        }
    }

    [Writer]
    public void Add(Order o)
    {
        list.Add(o);
        NotifyCollectionChangedEventArgs changedArgs = new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, o);
        OnCollectionChanged(changedArgs);
    }

    [Writer]
    public void Remove(int index)
    {
        NotifyCollectionChangedEventArgs changedArgs = new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, list[index]);
        list.RemoveAt(index);
        OnCollectionChanged(changedArgs);
    }

    [Yielder]
    private void OnCollectionChanged(NotifyCollectionChangedEventArgs changedArgs)
    {
        CollectionChanged(this, changedArgs);
    }

    [Reader]
    public Order Get(int index)
    {
        return (Order)list[index];
    }

    public event NotifyCollectionChangedEventHandler CollectionChanged;
}
Executing long-running write methods

Since write methods require exclusive access to the object, they should complete as quickly as possible. However, this is not always possible. Some long-running write methods really do a lot of write operations (or rely on slow external services) which make them inappropriate for the reader-writer-synchronized model. However, many write methods are actually composed of a lot of read operations but just a few write operations at the end. In this case, it is possible to use a combination of the UpgradeableReaderAttribute and WriterAttribute attributes. The UpgradeableReaderAttribute attribute ensures that no other thread than the current one will be able to acquire a writer lock on the object, so it gives the guarantee that the object is not going to be modified during the method’s execution. A method that holds an upgradeable reader lock can then invoke a method with the WriterAttribute attributes custom attribute. Note that it is important that the writer methods leave the object in a consistent state before exiting, because other threads will be allowed to read the object.

The following example builds on that in the section where the Order class contains a collection of Line objects which make up the order. In the example below, a new method called Recalculate() has been added to Order which iterates through each Line in the collection, tallies up the amount from each, and then stores the total in Amount.

Since the Recalculate method performs a series of reads followed by a write operation (to store the total in Amount), it is marked with the UpgradeableReaderAttribute attribute which ensures that all of the orders that it reads remain locked so that it calculates and writes out the correct total. In addition to this, the set accessor of the Order’s Amount property has been marked with WriterAttribute:

C#
Copy
[ReaderWriterSynchronized]
class Order
{
    // Other details skipped for brevity.

    public decimal Amount
    {
       // The [Reader] attribute optional here is optional because the method is a public getter.
       get;

       // The [Writer] attribute is required because, although the method is a setter, this setter is private,
       // therefore is does not acquire write access by default.
       [Writer] private set;
    }

    [UpgradeableReader]
    public void Recalculate()
    {
        decimal total = 0;

        for (int i = 0; i < lines.Count; ++i)
        {
            total += lines[i].Amount;
        }

        this.Amount = total;
    }
}
Working with object trees

Because the Reader/Writer Synchronized model is an implementation of the Aggregatable pattern, all of the same behaviors of the AggregatableAttribute are available. For more information regarding object trees, read Parent/Child, Visitor and Disposable.

Note Note

Once you have established your parent-child relationships you will need to apply compatible threading models to the child classes. You will want to refer to the Compatibility of Threading Models article to determine which threading model will work for the children of the Read/Writer Synchronized object.

See Also

Reference

ReaderWriterSynchronizedAttribute
WriterAttribute
ReaderAttribute
UpgradeableReaderAttribute
YielderAttribute
ExplicitlySynchronizedAttribute

Other Resources

Compatibility of Threading Models


Actor Threading Model

Given the complexity of trying to coordinate accesses to an object from several threads, sometimes it makes more sense to avoid multi threading altogether. The Actor model avoids the need for thread safety on class instances by routing method calls from each instance to a single message queue which is processed, in order, by a single thread.

Since the processing for each instance takes place in a single thread, multithreading is avoided altogether and the object is guaranteed to be free of data races. Calls are processed asynchronously in the order in which they were added to the message queue. Because all calls to an actor are asynchronous, it is recommended that the async/await feature of C# 5.0 be used.

Additionally to providing a race-free programming model, the Actor pattern has the benefit of transparently distributing the computing load to all available CPUs without additional logic. Note that PostSharp’s implementation does not assign a new thread to each actor instance but uses a thread pool instead, so it is possible to have a very large number of actors with relatively low overhead.

This topic contains the following sections:

  • Applying the Actor pattern
  • Rules enforced by the Actor aspect
  • Working with a complex state
  • Dealing with constraints of the Actor model
Applying the Actor pattern

To apply the Actor threading model:

  1. Add the PostSharp.Patterns.Threading package to your project.

  2. Add using PostSharp.Patterns.Threading namespace to your file.

  3. Add the ActorAttribute to the class.

  4. Annotate your object model for parent/child relationships as described in Annotating an Object Model for Parent/Child Relationships (Aggregatable).

  5. It is recommended, but not required, that you change all methods async methods, and modify the code that calls them.

Example

Consider the following example of an AverageCalculator class. The code is not thread-safe because incrementing the count has four operations (read and write) that must all be performed atomically.

C#
Copy
class AverageCalculator
{
    float sum;
    int count;

    public void AddSample(float n)
    {
        this.count++;
        this.sum += n;
    }

    public float GetAverage()
    {
        return this.sum / this.count;
    }
}

We could use the Synchronized or Reader-Writer Synchronized threading model to make sure that the calling thread will wait if the object is currently being accessed by another thread. Another solution in this situation is to avoid concurrency altogether using the Actor pattern and asynchronous methods.

In the reworked example below, the AverageCalculator class has had the ActorAttribute added and the GetAverage method has been changed into asynchronous with ReentrantAttribute attribute. The AddSample method was also changed to an async method returning Task and ReentrantAttribute attribute was applied.

Note that we could keep the methods non-async, but it is a good practice to make the public API of all actors async methods.

C#
Copy
[Actor]
class AverageCalculator
{
    float sum;
    int count;

    [Reentrant]
    public async Task AddSample(float n)
    {
        this.count++;
        this.sum += n;
    }

    [Reentrant]
    public async Task<float> GetAverage()
    {
        return this.sum / this.count;
    }
}

You can now use the same AverageCalculator from two concurrent threads.

C#
Copy
class Program
{
    static void Main(string[] args)
    {
        MainAsync().GetAwaiter().GetResult();
    }

    static async Task MainAsync()
    {
        AverageCalculator averageCalculator = new AverageCalculator();

        SampleObserver observer = new SampleObserver(averageCalculator);
        DataSources.Source1.Subscribe(observer);
        DataSources.Source2.Subscribe(observer);

        Console.ReadKey();

        float average = await averageCalculator.GetAverage();

        Console.WriteLine("Average: {0}", average);
    }
}

class SampleObserver : IObserver<float>
{
    AverageCalculator calculator;

    public void OnNext( float value )
    {
      // Each of the data sources can call us from a different thread and concurrently.
      // But we don't have to care since our calculator will enqueue method calls.
      this.calculator.AddSample( value );
    }

    // Details skipped.
}

Behind the scenes, each invocation of AverageCalculator.AddSample is added to the message queue by the ActorAttribute, which then processes each call sequentially in the order it was added to the queue. This gives us the guarantee that an instance of the AverageCalculator class is never being accessed concurrently by two threads, and eliminates the need to make take multithreading into account.

Rules enforced by the Actor aspect

At build time, the Actor aspect emits an error in the following situations: if your class has public or internal instance fields.

  • The class has async methods that are not annotated with the ReentrantAttribute attribute (non-reentrant async methods are not yet supported in actors).

  • The class has public or internal instance fields.

At run-time, an actor will throw a ThreadMismatchException is some code attempts to access a field from a thread that does not currently have access to the object. This typically happens when you schedule a background task or register to an event handler, and you do not mark this method with the EntryPointAttribute custom attribute.

Working with a complex state

PostSharp generates code that prevents the fields of an actor class to be accessed from an invalid context. For instance, trying to read an actor field from a background task would result in a ThreadAccessException. However, very often, the state is more complex than fields of simple types like int or string. The state can be composed of several objects and collections.

To prevent state corruption, it is important that PostSharp generates code that enforces the Actor model at run time even for child objects of the actor.

To add complex state to actor classes:

  1. Declare the Parent-Child relationship on the property using the ChildAttribute custom attribute.

  2. Add the PrivateThreadAwareAttribute attribute to the child class.

For more information regarding parent-child relationships in threading models, see also Parent/Child, Visitor and Disposable.

Example

C#
Copy
[Actor]
class AverageCalculator
{
    float sum;
    int count;

    [Child]
    private CounterInfo counterInfo;

    // Other details skipped for brevity
}

[PrivateThreadAware]
public class CounterInfo
{
    public string Name { get; set; }
}
Dealing with constraints of the Actor model

Per definition of the Actor model, all methods are executed asynchronously. Methods that have no return value (void methods) can be executed asynchronously without syntactic changes. However, methods that do have a return value need to be made asynchronous using the async keyword.

In some situations, the application of the async keyword and the corresponding dispatching of the method may be unnecessary. For instance, a method that returns immutable information is always thread-safe and does not need to be dispatched. For more information on excluding methods from dispatching, see Opting In and Out From Thread Safety.

See Also

Reference

ActorAttribute
ChildAttribute
ParentAttribute
PrivateThreadAwareAttribute
ReferenceAttribute
ThreadAccessException

Other Resources

Opting In and Out From Thread Safety


Thread-Unsafe Threading Model

When you are dealing with multithreaded code you will run into situations where some objects are not safe for concurrent use by several threads. Although these objects should theoretically not be accessed concurrently, it is very hard to prove that it never happens. And when it does happen, thread-unsafe data structures get corrupted, and symptoms may appear much later. These issues are typically very difficult to debug. So instead of relying on hope, it would be nice if the object threw an exception whenever it is accessed simultaneously by several threads. This is why we have the thread-unsafe threading model.

This topic contains the following sections:

  • Applying the Thread-Unsafe model to a class
  • Rules enforced by the Thread-Unsafe aspect
Applying the Thread-Unsafe model to a class

To apply the Thread-Unsafe threading model to a class:

  1. Add the PostSharp.Patterns.Threading package to your project.

  2. Add using PostSharp.Patterns.Threading namespace to your file.

  3. Add the ThreadUnsafeAttribute to the class.

  4. Annotate your object model for parent/child relationships as described in Annotating an Object Model for Parent/Child Relationships (Aggregatable).

Rules enforced by the Thread-Unsafe aspect

The ThreadUnsafeAttribute aspect emits build-time errors in the following situations:

  • The class contains a public or internal field.

Internally, the Thread-Unsafe model is implemented by a lock. The lock is automatically acquired by public and internal methods, just like the Synchronized model.

A thread-unsafe object will throw the following exceptions:

  • A ThreadAccessException whenever some code tries to access a field from a thread that does not own the correct lock, i.e. the call stack does not contain a public or internal method of this method (e.g. a private delegate call).

  • A ConcurrentAccessException when two public or internal methods execute at the same time on the same object (i.e. whenever the lock cannot be acquired without waiting).

See Also

Reference

InstanceLevelAspect
ThreadUnsafeAttribute
ExplicitlySynchronizedAttribute
EntryPointAttribute

Other Resources

Opting In and Out From Thread Safety
Dispatching a Method to the UI Thread


Making a Whole Project or Solution Thread Safe

When you want to make a large application thread-safe with PostSharp threading models, it can become difficult to remember to assign a threading model to every single class. In this situation, you can add the thread-safety policy to your project or solution.

The thread-safety policy emits warnings in two situations:

  • classes that are not assigned to a threading model,

  • static fields that are not read-only or not of a thread-safe type.

Important note Important

The thread-safety policy does not make your application thread-safe by itself. What the thread-safety policy does is to remind you to use threading models in your code. It is the use of threading models that makes your application thread-safe.

This topic contains the following sections:

  • Adding the thread-safety policy using PostSharp Tools for Visual Studio.
  • Adding the thread-safety policy to a project manually.
  • Adding the thread-safety policy to a whole solution manually.
Adding the thread-safety policy using PostSharp Tools for Visual Studio.

To apply the thread-safety policy to your application with PostSharp Tools for Visual Studio:

  1. Right click on your solution or your project in Solution Explorer, select Add followed by PostSharp Policy...

  2. In the Add PostSharp policy wizard, expand Threading and select Thread Safety.

  3. If you clicked on the solution, select the projects that you would like to add the policy to.

  4. Review the configuration that you have selected and click Next.

  5. Close the wizard when the process had completed by clicking Finish.

If you added the policy to the whole solution, the result of running this wizard is that a pssln file has been added to your project. The pssln file contains an entry that enables deadlock detection across all projects in your solution.

Copy
<Project xmlns="http://schemas.postsharp.org/1.0/configuration" xmlns:t="clr-namespace:PostSharp.Patterns.Threading;assembly:PostSharp.Patterns.Threading">
  <Multicast>
    <t:ThreadSafetyPolicy />
  </Multicast>
</Project>
Adding the thread-safety policy to a project manually.

To add the thread-safety policy to a project manually:

  1. Add the PostSharp.Patterns.Threading NuGet package to the project.

  2. Add the ThreadSafetyPolicy any C# file. We recommend you add it to a new file named GlobalAspects.cs.

    C#
    Copy
    using PostSharp.Patterns.Threading;
[assembly: ThreadSafetyPolicy]
Adding the thread-safety policy to a whole solution manually.

To manually add the thread-safety policy to a whole solution:

  1. Open the solution's pssln file. This can be found under the Solution Items folder in Visual Studio's Solution Explorer.

    If the pssln file doesn't exist manually add the file at the solution level. Name the file with the same name as your solution and the pssln file extension.

  2. If you had to create the pssln file and add it to your solution add the following XML to it. If the pssln file already existed in your project proceed to the next step.

    Copy
    <?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.postsharp.org/1.0/configuration" xmlns:t="clr-namespace:PostSharp.Patterns.Threading;assembly:PostSharp.Patterns.Threading">
</Project>

  3. Add a multicast attribute to the Project element that will add ThreadSafetyPolicy to all the projects in the solution.

    Copy
    <?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.postsharp.org/1.0/configuration" xmlns:t="clr-namespace:PostSharp.Patterns.Threading;assembly:PostSharp.Patterns.Threading">
  <Multicast>
    <t:ThreadSafetyPolicy />
  </Multicast>
</Project>

  4. Add the PostSharp.Patterns.Threading NuGet package to all projects in the solution.

Once you save the pssln file you will have added thread-safety policy to all projects in your solution.

See Also

Reference

DeadlockDetectionPolicy

Other Resources

Detecting Deadlocks at Runtime


Opting In and Out From Thread Safety

By default, PostSharp enforces thread safety for all instance fields and all public and internal methods of any class to which you applied a threading model.

However, there are times when you want to opt-out from this mechanism for a specific field or method. A typical reason is that access to the field is synchronized manually using a different mechanism.

This section shows how to override the default thread safety implemented by PostSharp.

This topic contains the following sections:

  • Opting out from thread-safety verification for a method
  • Opting out from thread-safety for a field
  • Opting in for thread safety for callback methods
Opting out from thread-safety verification for a method

To disable enforcement of the class-level threading model for a specific method, add the ExplicitlySynchronizedAttribute attribute to that method.

In the following example, this custom attribute allows us to implement the ToString in a class that respects the Actor model. Without the custom attribute, this would not have been possible because non-void public methods must have the async keyword.

C#
Copy
[Actor]
class Player
{
   private readonly string name;

   [ExplicitlySynchronized]
   public override string ToString()
   {
      return this.name;
   }
}

When used on a method, the ExplicitlySynchronizedAttribute attribute has several effects:

  1. Lock-based aspects such as SynchronizedAttribute or ReaderWriterSynchronizedAttribute will not attempt to acquire a lock before executing this method.

  2. Accesses to fields are not verified during the whole execution of the method (for the current thread).

  3. All build-time verifications are disabled for this method.

Caution note Caution

By using the ExplicitlySynchronizedAttribute custom attribute, you are significantly increasing the risk that multithreading defects in user code go undetected by PostSharp. Code using ExplicitlySynchronizedAttribute should be more carefully covered by reviews and tests.

Opting out from thread-safety for a field

To disable enforcement of the class-level threading model for a specific field, add the ExplicitlySynchronizedAttribute attribute to the field:

C#
Copy
[Actor]
class MyActor
{

  [ExplicitlySynchronized]
  int counter;

  public void FooBar()
  {
    // This line would throw an exception without [ExplicitlySynchronized].
    Task.Factory.StartNew(() => Interlocked.Increment( ref this.counter ));
  }

}

When used on a field, the ExplicitlySynchronizedAttribute attribute has several effects:

  1. Accesses to the field are never verified

  2. All build-time verifications are disabled for this method.

Opting in for thread safety for callback methods

By default, thread safety is ensured when a thread first invokes a public or internal method of an object. The underlying motivation is that public and internal methods are the primary way how a thread can enter an object. Another way is to enter an object through a delegate call to a private method. By default, PostSharp does not ensure thread safety for private methods. If you register a callback method, you need to add the EntryPointAttribute custom attribute on this method.

In the following code snippet, the OnCreated method is invoked from a background thread by the FileSystemWatcher class. The InputQueueWatcher is thread-safe thanks to the SynchronizedAttribute aspect.

C#
Copy
[Synchronized]
class InputQueueWatcher
{
  FileSystemWatcher watcher;

  [Child]
  AdvisableCollection<string> files = new AdvisableCollection<string>();

  public InputQueueWatcher(string path)
  {
    this.watcher = new FileSystemWatcher();
    this.watcher.Path = path;
    this.watcher.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName;
    this.watcher.Filter = "*.xml";
    this.watcher.Created += new FileSystemEventHandler(OnCreated);
  }

  [EntryPoint]
  private void OnCreated(object source, FileSystemEventArgs e)
  {
     // Without [EntryPoint], the following line would throw ThreadAccessException.
     this.files.Add(e.FullPath);
  }

   public ICollection Files { get { return this.files; } }

 }
See Also

Reference

ExplicitlySynchronizedAttribute
EntryPointAttribute

Other Resources

Thread-Unsafe Threading Model
Reader/Writer Synchronized Threading Model
Dispatching a Method to the UI Thread
Actor Threading Model


Compatibility of Threading Models

Required introduction

Compatibility Matrix
Parent | Actor | Freezable | Immutable | Private | Reader-Writer Synchronized | Synchronized | Thread Affine | Thread Unsafe
Actor | No | Yes | Yes | Yes | No | No | No | Yes
Freezable | No | Yes | Yes | Yes | No | No | No | No
Immutable | No | Yes | Yes | Yes | No | No | No | No
Reader-Writer Synchronized | Yes (Own) | Yes | Yes | Yes | Yes (Shared) | No | No | No
Synchronized | Yes (Own) | Yes | Yes | Yes | Yes (Shared) | Yes (Shared) | No | No
Thread Affine | Yes (Own) | Yes | Yes | Yes | No | No | Yes | Yes (Shared)
Thread Unsafe | Yes (Own) | Yes | Yes | Yes | No | No | Yes | Yes (Shared)
Private |  |  |  |  |  |  |  |


Enabling and Disabling Runtime Verification

When you apply a threading model to a class, PostSharp adds two kinds of behaviors: behaviors that are necessary to implement the semantic of the threading model (for instance acquiring a lock or dispatching a method call) and behaviors that validate that the source code is valid against the chosen threading model (for instance that no field is written if the current method does not have write access). The second set of behaviors are called runtime verifications. By default, runtime verifications are enabled in the Debug build and disabled in the Release build.

This section explains how to enable or disable runtime verification.

This topic contains the following sections:

  • Understanding the default configuration
  • Enabling or disabling runtime verification for a whole project
  • Enabling and disabling runtime verification for a specific class
Understanding the default configuration

By default, runtime verification is disabled if the Optimize Code compiler flag is enabled. Therefore, runtime verification is enabled by default in the Debug build and disabled in the Release build.

Enabling or disabling runtime verification for a whole project

Perform the following steps to enable runtime verification by using the Project Settings dialog

Enabling Runtime Verification in Project Properties

  1. Open the project's Properties window.

  2. Select the build configuration that you want to enable runtime verification on.

    Note Note

    By default, projects have two different build configurations: Debug and Release. Each build configuration can, and by default does, have a different behavior for runtime verification.

  3. Open the PostSharp tab.

  4. In the Optional Features section there is a Runtime Verification dropdown. The dropdown has three options in it; Default, Disabled, and Enabled.

    The Default option will include either (Enabled) or (Disabled) after it. This value will change based on the Optimize Code compiler flag setting. If the compiler flag is disabled the drop down option will read Default (Enabled) and if the Optimize Code flag is enabled the dropdown option will read Default (Disabled).

Enabling and disabling runtime verification for a specific class

You can override the project-level configuration of the runtime verification setting by setting the RuntimeVerificationEnabled property of the threading model custom attribute. This property is defined by the ThreadAwareAttribute class, from which all threading model attributes derive.

C#
Copy
[ThreadAffine(RuntimeVerificationEnabled = true)]

If the property is not manually set it derives its value from the setting on the project properties page. If you want to override the default value all you need to do is set the value of the RuntimeVerificationEnabled to true or false.

See Also

Reference

ThreadAwareAttribute
RuntimeVerificationEnabled


Run-Time Performance of Threading Model

When runtime verification of threading models is disabled (see Enabling and Disabling Runtime Verification), there is almost no runtime overhead of using PostSharp threading models compared to implementing thread synchronization manually, at least after the object model has been instantiated.

However, PostSharp threading models come at a high memory cost, and there may be a significant performance overhead when instantiating large object graphs unless care is taken.

This topic contains the following sections:

  • Memory Consumption
  • Instantiation of Large Object Trees
  • Assigning the Concurrency Controller Manually
Memory Consumption

As most complex aspects implemented with PostSharp, threading models have a high memory cost. Several object instances are needed for each instance of a thread-safe class. If memory consumption is a concern, you should not use threading models on classes that have a very high number of instances.

Instantiation of Large Object Trees

Threading models can have a significant impact on the cost of creating large object trees. In some situations, the cost of instantiating the tree can become O(n^2) instead of O(n). The performance issue affects only the following threading models:

  • Synchronized,

  • Reader-Writer Synchronized and

  • Thread-Unsafe.

The performance issue stems from the fact that each root node in a tree needs its own instance of its concurrency controller.

Consider the scenario when you build a tree using a depth-first approach. That means that you would first instantiate the leaves of the tree, then the parent of the leaves, then the parent of the parent, and so on until you reach the root. Depth-first tree instantiation is a common strategy when you instantiate immutable trees. Note however that the immutable model is not affected by this issue.

When you start instantiating the leaves, and until the leaf is assigned to a parent, every leaf is the root of its own tree. This means that an instance of the concurrency controller may be created if needed. When you instantiate the first-level parents, a new concurrency controller is created for each first-level parent. When the leaf is assigned to its parent, the concurrency controllers of the leaves will be replaced by the concurrency controller of the immediate parent.

The same phenomenon occurs at each level of the tree. Whenever you assign a sub-tree to a parent, the concurrency controller of whole subtree is reassigned. Replacing the concurrency controller of a subtree is an O(n) operation, and it should be achieved for each of the n nodes, which means that totally the concurrency controllers will be reassigned O(n^2) times.

During the operation of instantiating the tree, O(n) controllers may be instantiated. However, at the end of the operation, a single controller will remain in memory.

To prevent PostSharp from allocating O(n) controllers and performing O(n^2) reassignments, you need to manually assign newly-created objects to a concurrency controller.

Assigning the Concurrency Controller Manually

To avoid excessive creation and assignment of concurrency controllers, you can use the WithConcurrencyController(IConcurrencyController) method to set the default controller for newly-created objects.

The following code snippet illustrates the use of WithConcurrencyController(IConcurrencyController). Thanks to this method, a single concurrency controller instance is created, and each node is assigned only once to this concurrency controller, amounting to 3 assignments for 3 nodes. Without the use of this method, 3 instances of the concurrency controller would have been created, and totally 5 assignments would be done.

C#
Copy
using ( ThreadAwareServices.WithConcurrencyController( ThreadAwareServices.CreateSynchronizedController() ) )
{
    var child1 = new SynchronizedObject();
    var child2 = new SynchronizedObject();

    var parent = new SynchronizedObject();
    parent.Children.Add( child1 );
    parent.Children.Add( child2 );
}


Dispatching a Method to Background

Long running processes will block the further execution of code while the system waits for them to complete. When you are building applications it's common to push long running processes to the background so that other processes can continue without waiting. Two common ways of doing this are with asynchronous processing and the BackgroundWorker. Both require a lot of boiler plate code to push execution to another thread.

PostSharp provides you with the ability to push execution of a method to a background thread without having to worry about all of the boiler plate code.

To add execute a method in the background:

  1. Add the PostSharp.Patterns.Threading package to your project.

  2. Add using PostSharp.Patterns.Threading namespace to your file.

  3. Add the BackgroundAttribute to the method that you want to push to the background for execution. The method must have void, Task or TaskTResult return type.

Those simple steps are all that is required for you to declare that a method should be executed in a background thread.

If the method is void, it will be executed in the background, and the caller code will not wait until the background method completes its execution. If the method returns a Task, the method will be fully executed in the background (even the first segment of the method, before the first await keyword).

See Also

Reference

BackgroundWorker

Other Resources

Dispatching a Method to the UI Thread


Dispatching a Method to the UI Thread

When you are building desktop or mobile user interfaces, parts of your code may execute on background threads. However, the user interface itself can be accessed only from the UI thread. Therefore, it is often necessary to dispatch execution of code from a background thread to the foreground thread.

Traditionally, thread dispatching has been implemented using the Invoke(Delegate) method in WinForms or the Dispatcher class in XAML. However, this results in a large amount of boilerplate, making the code unreadable.

The DispatchedAttribute aspect addresses the issue of thread dispatching by forcing a method to execute on the thread that created the object (typically the foreground thread).

This topic contains the following sections:

  • Forcing a method to execute on the foreground thread
  • Executing a method asynchronously
  • Executing async methods in the foreground thread
Forcing a method to execute on the foreground thread

To force a method to execute on the foreground thread:

  1. Add the PostSharp.Patterns.Threading package to your project.

  2. Add using PostSharp.Patterns.Threading namespace to your file.

  3. Add the DispatchedAttribute to the method that you want to push to the background for execution.

Example

The following example shows how to use both BackgroundAttribute and DispatchedAttribute to specify on which threads different methods of the class are executed.

C#
Copy
[Background]
private void SaveButton_Click( object sender, RoutedEventArgs e )
{
   using ( var file = File.CreateText( this.path ) )
   {
      this.model.SaveTo( file );
   }

   this.SaveCompleted();
}

[Dispatched]
private void SaveCompleted()
{
    this.StatusLabel.Text = "Finished Saving";
}
Executing a method asynchronously

By default, the DispatchedAttribute forces the target method to execute synchronously on the foreground thread, which means that the background thread will wait until the method execution has completed. This waiting causes some performance overhead. Additionally, synchronous execution is not always useful. If the method has no return value and no side effect of interest for the calling thread, the method could be safely executed asynchronously, which means the calling thread would not need to wait for the method execution to complete on the foreground thread, so that the calling thread would continue its execution immediately after having enqueued the call to the foreground thread.

You can enable asynchronous execution of a dispatched method by passing the true value to the parameter of the DispatchedAttribute(Boolean) constructor, for instance:

C#
Copy
[Dispatched(true)]
private void SaveCompleted()
{
    this.StatusLabel.Text = "Finished Saving";
}
Executing async methods in the foreground thread

When you use the DispatchedAttribute aspect on asynchronous methods (async keyword in C#), the method is guaranteed to execute on the foreground thread even when it is invoked from a background thread.

See Also

Reference

DispatchedAttribute
BackgroundAttribute

Other Resources

Dispatching a Method to Background


Detecting Deadlocks at Runtime

A common problem that is found in multithreaded code is that multiple threads enter a situation where they are waiting for each other to finish. This is a deadlock situation and neither thread will complete executing in this situation. Because the threads are waiting on each other, neither is capable of providing diagnostic information to aid in debugging the situation. The DeadlockDetectionPolicy helps provide this information.

This topic contains the following sections:

  • Adding deadlock detection using PostSharp Tools for Visual Studio
  • Manually adding deadlock detection to a project
  • Manually adding deadlock detection to the whole solution
  • Deadlock detection
Adding deadlock detection using PostSharp Tools for Visual Studio

To apply the deadlock detection to your application with PostSharp Tools for Visual Studio:

  1. Right click on your solution in Solution Explorer, select Add followed by PostSharp Policy...

  2. In the Add PostSharp policy wizard, expand Threading and select Deadlock detection.

  3. Select the projects that you would like to add deadlock detection to.

    Note Note

    You will need to add this to every project in your application. Excluding projects could cause your application to fail.

  4. Review the configuration that you have selected and click Next.

  5. Close the wizard when the process had completed by clicking Finish.

The result of running this wizard is that a pssln file has been added to your project.

The pssln file contains an entry that enables deadlock detection across all projects in your solution.

Copy
<Project xmlns="http://schemas.postsharp.org/1.0/configuration" xmlns:t="clr-namespace:PostSharp.Patterns.Threading;assembly:PostSharp.Patterns.Threading">
  <Multicast>
    <t:DeadlockDetectionPolicy />
  </Multicast>
</Project>
Manually adding deadlock detection to a project

To manually add deadlock detection to a project:

  1. Add the PostSharp.Patterns.Threading NuGet package to the project.

  2. Add the DeadlockDetectionPolicy custom attribute to in any C# file. We recommend you add it to a new file named GlobalAspects.cs.

    C#
    Copy
    [assembly: DeadlockDetectionPolicy]
    Note Note

    You will need to add this to every project in your application. Excluding projects could cause your application to fail.

Manually adding deadlock detection to the whole solution

Adding deadlock detection at the solution level can also be done manually. This can be done by adding an entry to the pssln file in the solution.

To manually add deadlock detection to a solution:

  1. Open the solution's pssln file. This can be found under the Solution Items folder in Visual Studio's Solution Explorer.

    If the pssln file doesn't exist manually add the file at the solution level. Name the file with the same name as your solution and the pssln file extension.

  2. If you had to create the pssln file and add it to your solution add the following XML to it. If the pssln file already existed in your project proceed to the next step.

    Copy
    <?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.postsharp.org/1.0/configuration" xmlns:t="clr-namespace:PostSharp.Patterns.Threading;assembly:PostSharp.Patterns.Threading">
</Project>

  3. Add a multicast attribute to the Project element that will add DeadlockDetectionPolicy to all the projects in the solution.

    Copy
    <?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.postsharp.org/1.0/configuration" xmlns:t="clr-namespace:PostSharp.Patterns.Threading;assembly:PostSharp.Patterns.Threading">
  <Multicast>
    <t:DeadlockDetectionPolicy />
  </Multicast>
</Project>

  4. Add the PostSharp.Patterns.Threading NuGet package to all projects in the solution.

Once you save the pssln file you will have added deadlock detection to all projects in your solution.

Deadlock detection

When a deadlock is detected a DeadlockException is thrown. The exception will include a detailed report of all the threads and locks involved in the deadlock. Here is an example of that.

See Also

Reference

DeadlockDetectionPolicy
DeadlockException
ThreadSafetyPolicy

Other Resources

Making a Whole Project or Solution Thread Safe


Developing Custom Aspects

This chapter describes how to build your own aspect. It includes the following topics:

Section | Description
Developing Simple Aspects | This topic describes how to create aspects that contain a single transformation (named simple aspects). It describes all kinds of simple aspects.
Understanding Aspect Lifetime and Scope | This topic explains the lifetime of aspects, which are instantiated at build time, serialized, then deserialized at run time and executed.
Initializing Aspects | This topic discusses different techniques to initialize aspects.
Validating Aspect Usage | This topic shows how to validate that an aspect has been applied to a valid target declaration.
Developing Composite Aspects | This topic describes how to create aspects that are composed of several primitive transformations, using advices and pointcuts.
Coping with Several Aspects on the Same Target | This topic explains how to express aspect dependencies to prevent issues that would otherwise happen if several aspects are added to the same declaration.
Understanding Aspect Serialization | This topic explains aspect serialization and how to customize it.
Customizing Aspect Appearance in Visual Studio | This topic shows how aspect can influence how they appear in Visual Studio tooltips and code saving metrics.
Consuming Dependencies from an Aspect | This topic describes several strategies to consume services from aspects.


Developing Simple Aspects

Simple aspects are aspects that are composed of a single transformation. Developing a simple aspect in PostSharp is straightforward: you just have to create a new class, derive it from a primitive aspect class, and override some special methods named advices.

If your aspect cannot be implemented as a single transformation, see Developing Composite Aspects.

In this section:
Article | Description
Injecting Behaviors Before and After Method Execution | This article shows how to execute code when a method starts, succeeds, or fails, around await operators of async methods, or yield return statements of iterator methods.
Handling Exceptions | This article describes how to write an aspect that handles exceptions.
Intercepting Methods | This article explains how to intercept the execution of methods.
Intercepting Properties and Fields | This article shows how to intercept read and write accesses to fields and properties.
Intercepting Events | This article describes how to intercept the action of adding a delegate to an event, removing a delegate from an event, and invoking a delegate by raising the event.
Introducing Custom Attributes | This article shows how to add a custom attribute to any element of code.
Introducing Managed Resources | This article shows how to add a managed resource to the current assembly.


Injecting Behaviors Before and After Method Execution

The OnMethodBoundaryAspect aspect implements the so-called decorator pattern: it allows you to execute logic before and after the execution of a target method.

You may want to use method decorators to perform logging, monitor performance, initialize database transactions or any one of many other infrastructure related tasks. PostSharp provides you with an easy to use framework for all of these tasks in the form of the OnMethodBoundaryAspect.

This topic contains the following sections:

  • Executing code before and after method execution
  • Accessing the current execution context
  • Changing execution flow
  • Sharing state between advices
  • Working with async methods
  • Working with iterator methods
Executing code before and after method execution

When you are decorating methods, there are different locations that you may wish to inject functionality to. You may want to perform a task prior to the method executing or just before it finishes execution. There are situations where you may want to inject functionality only when the method has successfully executed or when it has thrown an exception. All of these injection points are structured and available to you in the OnMethodBoundaryAspect class as virtual methods (called advices) that you can implement if you need them.

The following table shows the advice methods available in the OnMethodBoundaryAspect class (see below for more advice methods available on async and iterator methods).

Advice | Description
OnEntry(MethodExecutionArgs) | When the method execution starts, before any user code.
OnSuccess(MethodExecutionArgs) | When the method execution succeeds (i.e. returns without an exception), after any user code.
OnException(MethodExecutionArgs) | When the method execution fails with an exception, after any user code. It is equivalent to a catch block.
OnExit(MethodExecutionArgs) | When the method execution exits, whether successfully or with an exception. This advice runs after any user code and after the OnSuccess(MethodExecutionArgs) or OnException(MethodExecutionArgs) method of the current aspect. It is equivalent to a finally block.

To create a simple aspect that writes some text whenever a method enters, succeeds, or fails:

  1. Add a reference to the PostSharp package to your project.

  2. Create an aspect class and inherit OnMethodBoundaryAspect.

  3. Annotate the class with the [PSerializableAttribute] custom attribute.

  4. Override the OnEntry(MethodExecutionArgs), OnSuccess(MethodExecutionArgs), OnException(MethodExecutionArgs) and/or OnExit(MethodExecutionArgs) as needed, and code the logic that needs to be executed at these points.

  5. Add the aspect to one or more methods. Since OnMethodBoundaryAspect derives from the Attribute class, you can just add the aspect custom attribute to the methods you need. If you need to add the aspect to more methods (for instance all public methods in a namespace), you can learn about more advanced techniques in Adding Aspects to Code.

Example

The following code snippet shows a simple aspect based on OnMethodBoundaryAspect which writes a line to the console during each of the four events. The aspect is applied to the Program.Main method.

C#
Copy
[PSerializable]
public class LoggingAspect : OnMethodBoundaryAspect
{

  public override void OnEntry(MethodExecutionArgs args)
  {
     Console.WriteLine("The {0} method has been entered.", args.Method.Name);
  }

  public override void OnSuccess(MethodExecutionArgs args)
  {
      Console.WriteLine("The {0} method executed successfully.", args.Method.Name);
  }

  public override void OnExit(MethodExecutionArgs args)
  {
     Console.WriteLine("The {0} method has exited.", args.Method.Name);
  }

  public override void OnException(MethodExecutionArgs args)
  {
      Console.WriteLine("An exception was thrown in {0}.", args.Method.Name);
  }

}

static class Program
{
   [LoggingAspect]
   static void Main()
   {
     Console.WriteLine("Hello, world.");
   }
}

Executing the program prints the following lines to the console:

Copy
The Main method has been entered.
Hello, world.
The Main method executed successfully.
The Main method has exited.
Accessing the current execution context

As illustrated in the example above, you can access information about the method being intercepted from the property MethodExecutionArgsMethod, which gives you a reflection object MethodBase. This object gives you access to parameters, return type, declaring type, and other characteristics. In case of generic methods or generic types, Method gives you the proper generic method instance, so you can use this object to get generic parameters.

The MethodExecutionArgs object contains more information about the current execution context, as illustrated in the following table:

Property | Description
Method | The method or constructor being executed (in case of generic methods, this property is set to the proper generic instance of the method).
Arguments | The arguments passed to the method. In case of out and ref arguments, the argument values can be modified by the aspect.
Instance | The object on which the method is being executed, i.e. the value of the this keyword.
ReturnValue | The return value of the method. This property can be modified by the aspect.
Exception | The Exception thrown by the method. This value can be modified (see below).
Note Note

The properties of the MethodExecutionArgs class cannot be directly viewed in the debugger. Because of optimizations, the properties must be referenced in your source code in order to be viewable in the debugger.

Example

The following program illustrates how to consume the current context from the MethodExecutionArg parameter:

C#
Copy
[PSerializable]
public class LoggingAspect : OnMethodBoundaryAspect
{

  public override void OnEntry(MethodExecutionArgs args)
  {
     Console.WriteLine("Method {0}({1}) started.", args.Method.Name, string.Join( ", ", args.Arguments ) );
  }

  public override void OnSuccess(MethodExecutionArgs args)
  {
      Console.WriteLine("Method {0}({1}) returned {2}.", args.Method.Name, string.Join( ", ", args.Arguments ), args.ReturnValue );
  }

}

static class Program
{
   static void Main()
   {
     Foo( 1, 2 );
   }

   static int Foo(int a, int b)
   {
       Console.WriteLine("Hello, world.");
       return 3;
   }
}

When this program executes, it prints the following output:

Copy
Method Foo(1, 2) started.
Hello, world.
Method Foo(1, 2) return 3.
Changing execution flow

There are several ways you can affect the execution of a method using the OnMethodBoundaryAspect aspect:

This section contains the following subsections:

  • Returning without executing the method
  • Throwing a different exception than the caught one

Returning without executing the method

When your aspect is interacting with the target code, there are situations where you will need to alter the execution flow behavior. For example, your OnEntry(MethodExecutionArgs) advice may want to prevent the target method from being executed. PostSharp offers this ability through the use of the MethodExecutionArgsFlowBehavior property. Unless the target method is void, you will also need to set the MethodExecutionArgsReturnValue property.

C#
Copy
public override void OnEntry(MethodExecutionArgs args)
{
    if (args.Arguments.Count > 0 && args.Arguments[0] == null)
    {
        args.FlowBehavior = FlowBehavior.Return;
        args.ReturnValue = -1;
    }

  Console.WriteLine("The {0} method was entered with the parameter values: {1}",
                    args.Method.Name, argValues.ToString());
}

As you can see, all that is needed to exit the execution of the target code is setting the FlowBehavior property on the MethodExecutionArgs to Return.

Managing execution flow control when dealing with exceptions there are two primary situations that you need to consider: re-throwing the exception and throwing a new exception.

Throwing a different exception than the caught one

To throw a new exception you will have to perform two tasks. First, you will need to assign the new exception to the Exception property. This is the exception that will be thrown as part of the flow behavior. After that, you will need to set the FlowBehavior property to ThrowException.

C#
Copy
 public override void OnException(MethodExecutionArgs args)
{
    if (args.Exception.GetType() == typeof(IndexOutOfRangeException))
    {
        args.Exception = new CustomArrayIndexException("This was thrown from an aspect",
                                                        args.Exception);
        args.FlowBehavior = FlowBehavior.ThrowException;
    }
}
Note Note

The remaining FlowBehavior enumeration value is Continue. In OnException(MethodExecutionArgs), this behavior will not rethrow the caught exception. In OnEntry(MethodExecutionArgs), OnSuccess(MethodExecutionArgs) and OnExit(MethodExecutionArgs) the target code execution will continue with no interruption.

Note Note

The default FlowBehavior value for OnEntry(MethodExecutionArgs), OnSuccess(MethodExecutionArgs) and OnExit(MethodExecutionArgs) is Continue. For OnException(MethodExecutionArgs) the default value is RethrowException.

Sharing state between advices

When you are working with multiple advices on a single aspect, you will encounter the need to share state between these advices. For example, if you have created an aspect that times the execution of a method, you will need to track the starting time at OnEntry(MethodExecutionArgs) and share that with OnExit(MethodExecutionArgs) to calculate the duration of the call.

To do this we use the MethodExecutionTag property on the MethodExecutionArgs parameter in each of the advices. Because MethodExecutionTag is an object type, you will need to cast the value stored in it while retrieving it and before using it.

C#
Copy
[PSerializable]
public class ProfilingAspect : OnMethodBoundaryAspect
{
    public override void OnEntry(MethodExecutionArgs args)
    {
        args.MethodExecutionTag = Stopwatch.StartNew();
    }

    public override void OnExit(MethodExecutionArgs args)
    {
        var sw = (Stopwatch)args.MethodExecutionTag;
        sw.Stop();

        System.Diagnostics.Debug.WriteLine("{0} executed in {1} seconds", args.Method.Name,
                                           sw.ElapsedMilliseconds / 1000);
    }
}
Note Note

The value stored in MethodExecutionTag will not be shared between different instances of the aspect. If the aspect is attached to two different pieces of target code, each attachment will have its own unshared MethodExecutionTag for state storage.

Working with async methods

The specificity of async methods is that their execution can be suspended while they are awaiting a dependent operation (typically another async method or a Task). While an async method is suspended, it does not block any thread. When the dependent operation has completed, the execution of the async method can be resumed, possibly on a different thread than the one the method was previously executing on.

There are many situations in which you may want to execute some logic when an async method is being suspended or resumed. For instance, a profiling aspect may exclude the time when the method is waiting for a dependency. You can achieve this by overriding the OnYield(MethodExecutionArgs) and OnResume(MethodExecutionArgs) methods of the OnMethodBoundaryAspect class.

The following table shows the advices that are specific to async methods.

Advice | Description
OnYield(MethodExecutionArgs) | When the method execution being suspended, i.e. when the operand of the await operator is a task that has not yet completed.
OnResume(MethodExecutionArgs) | When the method execution being resumed, i.e. when the operand of the await operator has completed.
Note Note

When the operand of the await is a task that has already completed, the OnYield(MethodExecutionArgs) and OnResume(MethodExecutionArgs) methods are not invoked.

See Semantic Advising of Iterator and Async Methods for more details regarding the behavior OnMethodBoundaryAspect aspect on asynchronous methods.

Example

In this example, we will reuse the ProfilingAttribute class from the previous section and will extend it to exclude the time spent while waiting for dependent operations.

C#
Copy
[PSerializable]
public class ProfilingAspect : OnMethodBoundaryAspect
{
    public override void OnEntry(MethodExecutionArgs args)
    {
      args.MethodExecutionTag = Stopwatch.StartNew();
    }

    public override void OnExit(MethodExecutionArgs args)
    {
      var sw = (Stopwatch)args.MethodExecutionTag;
      sw.Stop();

      System.Diagnostics.Debug.WriteLine("{0} executed in {1} seconds", args.Method.Name,
                                         sw.ElapsedMilliseconds / 1000);
    }

    public override void OnYield( MethodExecutionArgs args )
    {
      Stopwatch sw = (Stopwatch) args.MethodExecutionTag;
      sw.Stop();
    }

    public override void OnResume( MethodExecutionArgs args )
    {
        Stopwatch sw = (Stopwatch) args.MethodExecutionTag;
        sw.Start();
    }

}

Let's apply the [Profiling] attribute to the TestProfiling method.

C#
Copy
[Profiling]
public async Task TestProfiling()
{
    await Task.Delay( 3000 );
    Thread.Sleep( 1000 );
}

During the code execution, the stopwatch will start upon entering the TestProfiling method. It will stop before the await statement and resume when the task awaiting is done. Finally, the time measuring is stopped again before exiting the TestProfiling method and the result is written to the console.

Copy
Method ProfilingTest executed for 1007ms.
Working with iterator methods

Iterator methods are methods that contain the yield keyword. Under the hood, the C# or VB compiler transforms the iterator method into a state machine class that implements the IEnumerableT and IEnumeratorT interfaces. Calling the MoveNext method causes the method to execute until the next yield keyword. The keyword causes the method execution to be suspended, and it is resumed by the next call to MoveNext.

Just like with async methods, you can use the OnYield(MethodExecutionArgs) and OnResume(MethodExecutionArgs) methods to inject behaviors when an iterator method is suspended or resumed.

The following table explains the behavior of the different advices of the OnMethodBoundaryAspect aspects in the context of iterator methods.

Advice | Description
OnEntry(MethodExecutionArgs) | When the method execution starts, i.e. during the first call of the MoveNext method, before any user call.
OnYield(MethodExecutionArgs) | When the iterator method emits a result using the yield return statement (and the iterator execution is therefore suspended). The operand of the yield return statement (i.e. the value of the IEnumeratorCurrent property) can be read from the YieldValue property of the MethodExecutionArgs parameter.
OnResume(MethodExecutionArgs) | When the method execution being resumed by a call to MoveNext. Note, however, that the first call to MoveNext results into a call to OnEntry(MethodExecutionArgs).
OnSuccess(MethodExecutionArgs) | When the iterator method execution succeeds (i.e. returns without an exception, causing the MoveNext method to return false) or is interrupted (by disposing of the enumerator), after any user code.
OnException(MethodExecutionArgs) | When the method execution fails with an exception, after any user code. It is equivalent to a catch block around the whole iterator method.
OnExit(MethodExecutionArgs) | When the iterator method execution successfully (when MoveNext method returns false), is interrupted (by disposing of the enumerator) or fails with an exception. This advice runs after any user code and after the OnSuccess(MethodExecutionArgs) or OnException(MethodExecutionArgs) method of the current aspect. It is equivalent to a finally block around the whole iterator.

See Semantic Advising of Iterator and Async Methods for more details regarding the behavior OnMethodBoundaryAspect aspect on iterator methods.

Example

The following program illustrates the timing of different advices in the context of an iterator.

C#
Copy
[PSerializable]
class MyAspect : OnMethodBoundaryAspect
{
    public override void OnEntry(MethodExecutionArgs args)
    {
        Console.WriteLine("! entry");
    }

    public override void OnResume(MethodExecutionArgs args)
    {
        Console.WriteLine("! resume");
    }
    public override void OnYield(MethodExecutionArgs args)
    {
        Console.WriteLine($"! yield return {args.YieldValue}");
    }

    public override void OnSuccess(MethodExecutionArgs args)
    {
        Console.WriteLine("! success");
    }

    public override void OnExit(MethodExecutionArgs args)
    {
        Console.WriteLine("! exit");
    }
}

class Program
{
    static void Main(string[] args)
    {
        foreach (var i in Foo())
        {
            Console.WriteLine($"# received {i}");
        }

        Console.WriteLine("# done");
    }

    [MyAspect]
    static IEnumerable<int> Foo()
    {
        Console.WriteLine("@ part 1");
        yield return 1;
        Console.WriteLine("@ part 2");
        yield return 2;
        Console.WriteLine("@ part 3");
        yield return 3;
        Console.WriteLine("@ part 4");
    }
}

Executing the program prints the following output:

Copy
! entry
@ part 1
! yield return 1
# received 1
! resume
@ part 2
! yield return 2
# received 2
! resume
@ part 3
! yield return 3
# received 3
! resume
@ part 4
! success
! exit
# done
See Also

Reference

OnMethodBoundaryAspect
Arguments
MethodExecutionTag
PSerializableAttribute
OnExit(MethodExecutionArgs)
OnSuccess(MethodExecutionArgs)
OnException(MethodExecutionArgs)
OnEntry(MethodExecutionArgs)
Method
Arguments

Other Resources

PostSharp Aspect Framework - Product Page


Handling Exceptions

Adding exception handlers to code requires the addition of try/catch statements which can quickly pollute code. Exception handling implemented this way is also not reusable, requiring the same logic to be implemented over and over wherever exceptions must be dealt with. Raw exceptions also present cryptic information and can often expose too much information to the user.

PostSharp provides a solution to these problems by allowing custom exception handling logic to be encapsulated into a reusable class, which is then easily applied as an attribute to all methods and properties where exceptions are to be dealt with.

This topic contains the following sections:

  • Intercepting an exception
  • Specifying the type of handled exceptions
  • Ignoring ("swallowing") exceptions
  • Replacing or wrapping exceptions
  • Accessing the current execution context
Intercepting an exception

PostSharp provides the OnExceptionAspect class which is the base class from which exception handlers are to be derived from.

The key element of this class is the OnException(MethodExecutionArgs) method: this is the method where the exception handling logic (i.e. what would normally be in a catch statement) goes. A MethodExecutionArgs parameter is passed into this method by PostSharp; it contains information about the exception.

To create an exception handling aspect:

  1. Add a reference to the PostSharp package to your project.

  2. Derive a class from OnExceptionAspect.

  3. Apply the PSerializableAttribute to the class.

  4. Override OnException(MethodExecutionArgs) and implement your exception handling logic in this class. The Exception object is available on the Exception property of the MethodExecutionArgs parameter.

  5. Add the aspect to one or more methods. Since OnExceptionAspect derives from the Attribute class, you can just add the aspect custom attribute to the methods you need. If you need to add the aspect to more methods (for instance all public methods in a namespace), you can learn about more advanced techniques in Adding Aspects to Code.

Example

The following snippet shows an example of an exception handler which watches for exceptions of any type, and then writes a message to the console when an exception occurs:

C#
Copy
[PSerializable]
public class PrintExceptionAttribute : OnExceptionAspect
{

    public override void OnException(MethodExecutionArgs args)
    {
        Console.WriteLine(args.Exception.Message);
    }
}

Once created, apply the derived class to all methods and/or properties for which the exception handling logic is to be used, as shown in the following example:

C#
Copy
class Customer
{
    public string FirstName { get; set; }
    public string LastName { get; set; }

    [PrintException]
    public void StoreName(string path)
    {
        File.WriteAllText( path, string.Format( "{0} {1}", this.FirstName, this.LastName ) );
    }

}

Here PrintException will output a message when an exception occurs in trying to write text to a file.

Specifying the type of handled exceptions

The GetExceptionType(MethodBase) method can be used to return the type of the exception which is to be handled by this aspect. Otherwise, all exceptions will be caught and handled by this class. Note that the GetExceptionType(MethodBase) method is evaluated at build time.

If the aspect needs to handle several types of exception, the GetExceptionType should return a common base type, and the OnException implementation should be modified to dynamically handle different types of exception.

Example

In the following snippet, we updated the PrintExceptionAttribute aspect and added the possibility to specify from the custom attribute constructor which type of exception should be traced.

C#
Copy
[PSerializable]
public class PrintExceptionAttribute : OnExceptionAspect
{
    Type type;

    public PrintExceptionAttribute(Type type)
    {
        this.type = type;
    }

    // Method invoked at build time.
    // Should return the type of exceptions to be handled.
    public override Type GetExceptionType(MethodBase method)
    {
        return this.type;
    }

    public override void OnException(MethodExecutionArgs args)
    {
        Console.WriteLine(args.Exception.Message);
    }
}

class Customer
{
    public string FirstName { get; set; }
    public string LastName { get; set; }

    [PrintException(typeof(IOException)]
    public void StoreName(string path)
    {
        File.WriteAllText( path, string.Format( “{0} {1}”, this.FirstName, this.LastName ) );
    }

}
Ignoring ("swallowing") exceptions

The FlowBehavior member of MethodExecutionArgs in the exception handler’s OnException(MethodExecutionArgs) method, can be set to ignore an exception. Note however that ignoring exceptions is generally dangerous and not recommended. In practice, it’s only safe to ignore exceptions in event handlers (e.g. to display a message in a WPF form) and in thread entry points.

Exceptions can be ignored by setting the FlowBehavior property to Return. You must then set the return value of the method by setting the ReturnValue property.

Example

The following aspect catches all exceptions flowing from the methods the aspect is applied to, prints the exception to the console, and makes the target method return -1 instead of failing with an exception.

C#
Copy
[PSerializable]
public class PrintAndIgnoreExceptionAttribute : OnExceptionAspect
{

    public override void OnException(MethodExecutionArgs args)
    {
        Console.WriteLine(args.Exception.Message);
        args.FlowBehavior = FlowBehavior.Return;
        args.ReturnValue = -1;
    }
 }

public class Customer
{
    [PrintException(typeof(IOException))]
    public int GetDataLength(string path)
    {
       return File.ReadAllText(path).Length;
    }

}
Replacing or wrapping exceptions

Many times, the original exception must be hidden from the user or the client of the service, and should be replaced by another exception.This can be done by setting the MethodExecutionArgsFlowBehavior property to FlowBehavior.ThrowException and the MethodExecutionArgsException to the new exception.

  • FlowBehavior.RethrowException: rethrows the original exception after the exception handler exits. This is the default behavior for the OnException(MethodExecutionArgs) advice.

  • FlowBehavior.ThrowException: throws a new exception once the exception handler exits. This is useful when details of the original exception should be hidden from the user or when a more meaningful exception is to be shown instead. When throwing a new exception, a new exception object must be assigned to the Exception member of MethodExecutionArgs. The following snippet shows the creation of a new BusinessExceptionAttribute which throws a BusinessException containing a description of the cause:

    C#
    Copy
    [PSerializable]
public sealed class BusinesssExceptionAttribute : OnExceptionAspect
{
    public override void OnException(MethodExecutionArgs args)
    {
        args.FlowBehavior = FlowBehavior.ThrowException;
        args.Exception = new BusinessException("Bad Arguments", new Exception("One or more arguments were null. Use the id " + guid.ToString() + " for more information"));
   }
}

Example

The following aspect handles all exceptions in the BusinessServices class by generating a GUID for it, writing all details to the trace file and then throwing a BusinessException showing just the incident GUID and hiding other details.

C#
Copy
[PSerializable]
public sealed class HandleExceptionsAttribute : OnExceptionAspect
{
    public override void OnException(MethodExecutionArgs args)
    {
        Guid guid = Guid.NewGuid();

        // In a real-world app, we would file the exception in the QA database.
        Trace.WriteLine( #"Exception {guid}:");
        Trace.WriteLine(args.Exception.ToString());

        args.FlowBehavior = FlowBehavior.ThrowException;
        args.Exception = new BusinessException( $"The service failed unexpectedly. Please report the incident to the QA team with the id #{guid}." );
    }
}

[HandleExceptions]
public class BusinessServices
{
   // Dozens of methods here.
}

public class BusinessException : Exception
{
    public BusinessException(string message) : base(message)
    {
    }
}
Accessing the current execution context

The OnException(MethodExecutionArgs) method requires one argument of type MethodExecutionArgs. This object gives access to the exception being handled, the identity of the method being executed, its arguments, and the current object.

The following table lists the pieces of context made available by the MethodExecutionArgs class.

Property | Description
Method | The method or constructor being executed (in case of generic methods, this property is set to the proper generic instance of the method). This is not necessarily equal to the method that originally threw the exception.
Arguments | The arguments passed to the method. In case of out and ref arguments, the argument values can be modified by the aspect.
Instance | The object on which the method is being executed, i.e. the value of the this keyword.
Exception | The Exception thrown by the method. This value can be modified (see below).
Note Note

The properties of the MethodExecutionArgs class cannot be directly viewed in the debugger. Because optimizations, the properties must be referenced in your source code in order to be viewable in the debugger.

Example

The following code improves the previous example by adding more context information to the print-out of the exception details.

C#
Copy
[PSerializable]
public sealed class HandleExceptionsAttribute : OnExceptionAspect
{
    public override void OnException(MethodExecutionArgs args)
    {
        Guid guid = Guid.NewGuid();

        // In a real-world app, we would file the exception in the QA database.
        Trace.WriteLine( $"Exception {guid} when invoking the method {args.Method.DeclaringType.FullName}.{args.Method.Name}({string.Join(", ", args.Arguments)}) ");
        Trace.WriteLine(args.Exception.ToString());

        args.FlowBehavior = FlowBehavior.ThrowException;
        args.Exception = new BusinessException( $"The service failed unexpectedly. Please report the incident to the QA team with the id #{guid}." );
    }
}
See Also

Reference

OnException(MethodExecutionArgs)
MethodExecutionArgs
OnExceptionAspect
PSerializableAttribute
GetExceptionType(MethodBase)

Other Resources

Adding Aspects to Multiple Declarations


Intercepting Methods

It is often useful to be able to intercept the invocation of a method and invoke your own hook in its place. Common use cases for this capability include dispatching the method execution to a different thread, asynchronously executing the method at a later time, and retrying the method call an when exception is thrown.

PostSharp addresses these needs with the MethodInterceptionAspect aspect class which intercepts the invocation of a method before the method is executed. It also allows you to invoke the original method and access its arguments and return value.

The current article covers method interception, for another approach to injecting behaviors into methods, see Injecting Behaviors Before and After Method Execution.

This topic contains the following sections:

  • Intercepting a method call
  • Accessing the current execution context
  • Intercepting methods returning a Task, including async methods
Intercepting a method call

To create an aspect that retries a method call on exception:

  1. Add a reference to the PostSharp package to your project.

  2. Create an aspect class and inherit MethodInterceptionAspect. Annotate the class with the [PSerializableAttribute] custom attribute.

  3. Override and implement the OnInvoke(MethodInterceptionArgs) method and implement the interception logic. Call args.Proceed() to invoke the intercepted method.

    Note Note

    Calling base.OnInvoke() is equivalent to calling args.Proceed().

  4. Add the aspect to one or more methods. Since MethodInterceptionAspect derives from the Attribute class, you can just add the aspect custom attribute to the methods you need. If you need to add the aspect to more methods (for instance all public methods in a namespace), you can learn about more advanced techniques in Adding Aspects to Code.

Example

Consider the following CustomerService class which has methods to load and save customer entities and relies on calls to a database or a web-service.

C#
Copy
public class CustomerService
{
    public void Save(Customer customer)
    {
        // Database or web-service call.
    }

}

Occasionally, the connection to the underlying store may become unreliable and the application user is presented with the error message. To improve the user experience you may want to retry the failing operation several times before displaying the error message. In the following steps, we'll create a method interception class which can be applied to repository methods and will retry the invocation whenever an exception is thrown by the original method.

The complete aspect code is as follows:

C#
Copy
[PSerializable]
public class RetryOnExceptionAttribute : MethodInterceptionAspect
{
    public RetryOnExceptionAttribute()
    {
        this.MaxRetries = 3;
    }

    public int MaxRetries { get; set; }

    public override void OnInvoke(MethodInterceptionArgs args)
    {
        int retriesCounter = 0;

        while (true)
        {
            try
            {
                args.Proceed();
                return;
            }
            catch (Exception e)
            {
                retriesCounter++;
                if (retriesCounter > this.MaxRetries) throw;

                Console.WriteLine(
                    "Exception during attempt {0} of calling method {1}.{2}: {3}",
                    retriesCounter, args.Method.DeclaringType, args.Method.Name, e.Message);
            }
        }
    }
}

Apply the [RetryOnException] custom attributes to all methods where the behavior is needed.

In the following snippet, this aspect is applied to the CustomerService.Save method:

C#
Copy
public class CustomerService
{
    [RetryOnException(MaxRetries = 5)]
    public void Save(Customer customer)
    {
        // Database or web-service call.
    }
}

Whenever the CustomerService.Save method is invoked, the RetryOnExceptionAttribute.OnInvoke method is called instead. The aspect method will invoke the original method and retry if necessary.

Accessing the current execution context

As illustrated in the example above, you can access information about the method being intercepted from the property MethodInterceptionArgsMethod, which gives you the MethodBase of the method that has been intercepted. This object gives you access to parameters, return type, declaring type, and other characteristics. In case of generic methods or generic types, MethodInterceptionArgsMethod gives you the proper generic method instance, so you can use this object to get generic parameters.

The MethodInterceptionArgs parameter gives you access to other pieces of information regarding the current execution context.

Property | Description
Method | The method being executed (in case of generic methods, this property is set to the proper generic instance of the method).
Arguments | The arguments passed to the method. If you modify the arguments and call args.Proceed(), the intercepted method will be invoked with the modified arguments.
Instance | The object on which the method is being executed, i.e. the value of the this keyword.
ReturnValue | The return value of the method. This property is populated after the aspect calls args.Proceed. The aspect can then modify the value of this property if it needs to return a different value than the one returned by the intercepted method.
Intercepting methods returning a Task, including async methods

The Task class in .NET represents operations that can execute asynchronously. Whenever you want to intercept a method that returns a Task, you have two options of how to define the target of the interception:

  • Intercepting the logic that creates and returns a new Task. The logic of the asynchronous operation represented by the Task is not intercepted, and the Task's status, return value and thrown exception are not handled by an aspect. This is what happens when you intercept a Task-returning method with an aspect implementing only OnInvoke(MethodInterceptionArgs).

  • Intercepting both the logic that instantiates the Task and the logic of the Task. In this case, you intercept the asynchronous operation represented by the task. You can await for the completion of the task, and you can handle the task's return value and thrown exception inside the aspect. This interception mode is called semantic advising.

To intercept the whole Task logic, your aspect must implement the OnInvokeAsync(MethodInterceptionArgs) method. Your implementation can call args.ProceedAsync() instead of args.Proceed() to invoke the intercepted method and execute the intercepted task.

When an aspect implements both OnInvoke(MethodInterceptionArgs) and OnInvokeAsync(MethodInterceptionArgs), PostSharp automatically selects the proper method when the target method returns a Task. You can change this behavior by changing the value of the SemanticallyAdvisedMethodKinds aspect property. See Semantic Advising of Iterator and Async Methods for details regarding this property.

In this article, we will demonstrate how to control the semantic behavior of the MethodInterceptionAspect aspect when it is applied to a method returning a task or to an async method. For a more general information about using MethodInterceptionAspect see Intercepting Methods.

Example

To demonstrate when the semantic approach to method interception can be useful, let's extend at the RetryOnExceptionAttribute aspect created in the previous example.

The previous version of RetryOnExceptionAttribute aspect intercepts the original method, but it does not intercept the async task returned by the method. As a result, the aspect cannot catch the exception thrown by the async task and the test method fails. In order to properly handle async methods, we need to add an implementation of the OnInvokeAsync(MethodInterceptionArgs) method to the RetryOnExceptionAttribute aspect:

C#
Copy
[PSerializable]
public class RetryOnExceptionAttribute : MethodInterceptionAspect
{
    public RetryOnExceptionAttribute()
    {
        this.MaxRetries = 3;
    }

    public int MaxRetries { get; set; }

    public override void OnInvoke(MethodInterceptionArgs args)
    {
        int retriesCounter = 0;

        while (true)
        {
            try
            {
                args.Proceed();
                return;
            }
            catch (Exception e)
            {
                retriesCounter++;
                if (retriesCounter > this.MaxRetries) throw;

                Console.WriteLine(
                    "Exception during attempt {0} of calling method {1}.{2}: {3}",
                    retriesCounter, args.Method.DeclaringType, args.Method.Name, e.Message);
            }
        }
    }

    public override async Task OnInvokeAsync(MethodInterceptionArgs args)
    {
        int retriesCounter = 0;

        while (true)
        {
            try
            {
                await args.ProceedAsync();
                return;
            }
            catch (Exception e)
            {
                retriesCounter++;
                if (retriesCounter > this.MaxRetries) throw;

                Console.WriteLine(
                    "Exception during attempt {0} of calling method {1}.{2}: {3}",
                    retriesCounter, args.Method.DeclaringType, args.Method.Name, e.Message);
            }
        }
    }
}

We can now apply the [RetryOnException] aspect to an async method:

C#
Copy
[RetryOnException]
private async Task AsyncThrow()
{
    await Task.Yield();
    if (--this.counter > 0)
    {
        throw new Exception();
    }
}

Whenever the AsyncThrow method is invoked, the RetryOnExceptionAttribute.OnInvokeAsync method is called instead. The aspect method will invoke the original method asynchronously and await for its completion. If the asynchronous task throws an exception, the aspect will catch the exception and either retry the asynchronous call or re-throw the exception.

Intercepting methods returning a null Task

The following example shows how to intercept methods that may return a null Task. There is no way for the an aspect based on a semantically-advised MethodInterceptionAspect to return a null Task. If the aspect requires returning a null Task, it must use non-semantic advising. See Semantic Advising of Iterator and Async Methods for details.

C#
Copy
[PSerializable]
public sealed class MyAspect1 : MethodInterceptionAspect
{
    public override async Task OnInvokeAsync(MethodInterceptionArgs args)
    {

        object instance = args.Instance;
        Arguments arguments = args.Arguments;

        MethodBindingInvokeAwaitable bindingInvokeAwaitable = args.AsyncBinding.InvokeAsync(ref instance, arguments);

        Task task = bindingInvokeAwaitable.GetTask();

        if (task != null)
        {
            args.ReturnValue = await bindingInvokeAwaitable;
        }
        else
        {
            args.ReturnValue = "Some special value";
        }

    }
}
See Also

Reference

MethodInterceptionAspect
OnInvoke(MethodInterceptionArgs)
MethodInterceptionArgs
Arguments
Binding
Instance
Method
PSerializableAttribute

Other Resources

PostSharp Aspect Framework - Product Page


Intercepting Properties and Fields

In .NET, both fields and properties are "things" that can be set and get. You can intercept get and set operations using the LocationInterceptionAspect. It makes it possible to develop useful aspects, such as validation, filtering, change tracking, change notification, or property virtualization (where the property is backed by a registry value, for instance).

This topic contains the following sections:

  • Intercepting Get operations
  • Intercepting Set operations
  • Getting and setting the underlying property
  • Intercepting fields
  • Getting the property or property being accessed
Intercepting Get operations

In this example, we will see how to create an aspect that filters the value read from a field or property.

To create an aspect that filters the value read from a field or property

  1. Add a reference to the PostSharp package to your project.

  2. Create an aspect that inherits from LocationInterceptionAspect and add the custom attribute [PSerializableAttribute].

  3. Override the OnGetValue(LocationInterceptionArgs) method.

    C#
    Copy
    [PSerializable]
public class StringCheckerAttribute : LocationInterceptionAspect
{
    public override void OnGetValue(LocationInterceptionArgs args)
    {
        base.OnGetValue(args);
    }

}

  4. Calling base.OnGetValue actually retrieves the value from the underlying field or property, and populates the Value property. Add some code to check if the property currently is set to null If the current value is null, we want to return a predefined value. To do this we can set the Value property. Any time this property is requested, and it is set to null, the value "foo" will be returned.

    C#
    Copy
     public override void OnGetValue(LocationInterceptionArgs args)
{
    base.OnGetValue(args);

    if (args.Value == null)
    {
        args.Value = "foo";
    }
}

  5. Now that you have a complete getter interception aspect written you can attach it to the target code. Simply add an attribute to either properties or fields to have the interception attached.

    C#
    Copy
     public class Customer
{
    [StringChecker]
    private readonly string _address;

    public Customer(string address)
    {
        _address = address;
    }
    [StringChecker]
    public string Name { get; set; }
    public string Address { get { return _address; } }
}
    Note Note

    Adding aspects to target code one property or field at a time can be a tedious process. There are a number of techniques in the article Adding Aspects to Multiple Declarations that explain how to add aspects en mass.

  6. Now when you create an instance of a customer and immediately try to access the Name and Address values the get request will be intercepted and null values will be returned as "foo".

    C#
    Copy
     class Program
{
    static void Main(string[] args)
    {
        var customer = new Customer("123 Main Street");
        Console.WriteLine("Address: {0}", customer.Address);
        Console.WriteLine("Name: {0}", customer.Name);
        Console.ReadKey();
    }
}
    Intercepting Properties 1

Property and field interception is a simple and seamless task. Once you have intercepted your target you can act on the target or you can allow the original code to execute.

Intercepting Set operations

The previous section showed how to intercept a get accessor. Intercepting a set accessor is accomplished in a similar manner by implementing OnSetValue(LocationInterceptionArgs) in the LocationInterceptionAspect.

The following snippet shows the addition of OnSetValue(LocationInterceptionArgs) to the StringCheckerAttribute example:

C#
Copy
[PSerializable]
public class StringCheckerAttribute : LocationInterceptionAspect
{
public override void OnGetValue(LocationInterceptionArgs args)
{
base.OnGetValue(args);
}

public override void OnSetValue(LocationInterceptionArgs args)
{
base.OnSetValue(args);
}
}

When applied to a property with a set operator, OnSetValue(LocationInterceptionArgs) will intercept the set operation. In the Customer example shown below, OnSetValue(LocationInterceptionArgs) will be called whenever the Name property is set:

C#
Copy
 public class Customer
{
    .
    .
    .
[StringChecker]
public string Name { get; set; }
}

The SetNewValue(Object) method of LocationInterceptionArgs can be used instead of base.OnSetValue() to pass a different value in for the property. For example, OnSetValue(LocationInterceptionArgs) could be used to check for a null string, and then change the string to a non-null value:

C#
Copy
[PSerializable]
public class StringCheckerAttribute : LocationInterceptionAspect
{
    .
    .
    .
public override void OnSetValue(LocationInterceptionArgs args)
{
if (args.Value == null)
{
args.Value = “Empty String";
}

args.ProceedSetValue();

}
}
Getting and setting the underlying property

PostSharp provides a mechanism to check a property’s underlying value via the LocationInterceptionArgsGetCurrentValue method. This can be useful to check the current property value when a setter is called and then take some appropriate action.

For example, the following snippet shows a modified OnSetValue(LocationInterceptionArgs) method which gets the current underlying property value and compares the (new) value passed into the setter against the current value. If current and new value don’t match then some message is written:

C#
Copy
 public override void OnSetValue(LocationInterceptionArgs args)
{
  //get the current underlying value
  string existingValue = (string)args.GetCurrentValue();

  if (((existingValue==null) && (args.Value != null)) || (!existingValue.Equals(args.Value)))
  {
    Console.WriteLine(“Value changed.”);
    args.ProceedSetValue();
  }
}
Note Note

GetCurrentValue will call the underlying property getter without going through OnGetValue(LocationInterceptionArgs). If several aspects are applied to the property (and/or to the property setter), GetCurrentValue will go through the next aspect in the chain of invocation.

PostSharp also provides a mechanism to set the underlying property in a getter via the SetNewValue(Object) method of LocationInterceptionArgs. This could be used for example, to ensure that a default value is assigned to the underlying property if there is currently no value. The following snippet shows a modified OnGetValue(LocationInterceptionArgs) method which gets the current underlying value, and sets a default value if the current value is null:

C#
Copy
 public override void OnGetValue(LocationInterceptionArgs args)
{
    object o = args.GetCurrentValue();
    if (o == null)
    {
        args.SetNewValue("value not set");
    }

    base.OnGetValue(args);
}
Intercepting fields

One benefit to implementing a LocationInterceptionAspect is that it can be applied directly to fields, allowing for reads and writes to those fields to be intercepted, just like with properties.

Applying a LocationInterceptionAspect implementation to a field is simply a matter of setting it as an attribute on a field, just as it was done with a property:

C#
Copy
 public class Customer
{
    .
    .
    .
[StringChecker]
public string name;
}

With the attribute applied to the name field, all attempts to get and set that field will be intercepted by StringChecker in its OnGetValue(LocationInterceptionArgs) and OnSetValue(LocationInterceptionArgs) methods.

Note that when a LocationInterceptionAspect is added to a field, the field is replaced by a property of the same field and visibility. The field itself is renamed and made private.

Getting the property or property being accessed

Information about the property or field being intercepted can be obtained through the LocationInterceptionArgs via its Location property. The type of this property, LocationInfo, can represent a FieldInfo, a PropertyInfo, or a ParameterInfo (although LocationInterceptionAspect cannot be added to parameters).

One use for this is to reflect the property name whenever a property is changed. In the following example, we have an Entity class that implements INotifyPropertyChanged and a public OnPropertyChanged method which allows notifications to be made whenever a property is changed. The Customer class has been modified to derive from Entity.

C#
Copy
 class Entity : INotifyPropertyChanged
{

  public event PropertyChangedEventHandler PropertyChanged;

  public void OnPropertyChanged(string propertyName)
  {
    if (PropertyChanged != null)
     PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
  }
}

 class Customer : Entity
{
  public string Name { get; set; }
}

With the ability to invoke an OnPropertyChanged event, we can create a LocationInterceptionAspect which invokes this event when setting a value and pass in the property name from the underlying PropertyInfo object:

C#
Copy
[PSerializable]
public class NotifyPropertyChangedAttribute : LocationInterceptionAspect
{

public override void OnSetValue(LocationInterceptionArgs args)
{
If ( args.Value != args.GetCurrentValue() )
{
args.Value = args.Value;
args.ProceedSetValue();
((Entity)args.Instance).OnPropertyChanged(args.Location.Name);
}
}
}
Note Note

This example is a simplistic implementation of the NotifyPropertyChangedAttribute aspect. For a production-ready implementation, see the section INotifyPropertyChanged.

This aspect can then be applied to the Customer class:

Copy
[NotifyPropertyChangedAttribute]
class Customer : INotifyPropertyChanged
{
    public string Name { get; set; }
}

Now when the Name property is changed, NotifyPropertyChangedAttribute will invoke the Entity.OnPropertyChanged method passing in the property name retrieved from its underlying property.

See Also

Reference

LocationInterceptionAspect
OnGetValue(LocationInterceptionArgs)
OnSetValue(LocationInterceptionArgs)
LocationInterceptionArgs
Location
LocationInfo
FieldInfo
PropertyInfo
ParameterInfo
INotifyPropertyChanged
NotifyPropertyChangedAttribute

Other Resources

Adding Aspects to Multiple Declarations
INotifyPropertyChanged


Intercepting Events

You interact with events in three primary ways: subscribing, unsubscribing and raising them. Like methods and properties, you may find yourself needing to intercept these three interactions. How do you execute code every time that an event is subscribed to? Or raised? Or unsubscribed? PostSharp provides you with a simple mechanism to accomplish this easily.

This topic contains the following sections:

  • Intercepting Add and Remove
  • Intercepting Raise
  • Accessing the current context
  • Example: Removing offending event subscribers
Intercepting Add and Remove

Throughout the life of an event, it is possible to have many different event handlers subscribe and unsubscribe. You may want to log each of these actions.

  1. Add a reference to the PostSharp package to your project.

  2. Create an aspect that inherits from EventInterceptionAspect. Add the [PSerializableAttribute] custom attribute.

  3. Override the OnAddHandler(EventInterceptionArgs) method and add your logging code to the method body.

  4. Add the base.OnAddHandler call to the body of the OnAddHandler(EventInterceptionArgs) method. If this is omitted, the original call to add a handler will not be executed. Unless you want to stop the addition of the handler, you will need to add this line of code.

    C#
    Copy
    [PSerializable]
public class CustomEventHandling : EventInterceptionAspect
{
    public override void OnAddHandler(EventInterceptionArgs args)
    {
        base.OnAddHandler(args);
        Console.WriteLine("A handler was added");
    }
}

  5. To log the removal of an event handler, override the OnRemoveHandler(EventInterceptionArgs) method.

  6. Add the logging you require to the method body.

  7. Add the base.OnRemoveHandler call to the body of the OnRemoveHandler(EventInterceptionArgs) method. Like you saw when overriding the OnAddHandler(EventInterceptionArgs) method, if you omit this call, the original call to remove the handler will not occur.

    C#
    Copy
    public override void OnRemoveHandler(EventInterceptionArgs args)
{
    base.OnRemoveHandler(args);
    Console.WriteLine("A handler was removed");
}

Once you have defined the interception points in the aspect, you will need to attach the aspect to the target code. The simplest way to do this is to add the attribute to the event handler definition.

C#
Copy
public class Example
{
    [CustomEventHandling]
    public EventHandler<EventArgs> SomeEvent;

    public void DoSomething()
    {
        if (SomeEvent != null)
        {
            SomeEvent.Invoke(this, EventArgs.Empty);
        }
    }
}
Intercepting Raise

When you are intercepting events, you may also have situations where you want to execute additional code when the event is raised. Raising of an event can occur in many places and you will want to centralize this code to avoid repetition.

  1. Override the OnInvokeHandler(EventInterceptionArgs) method in your aspect class and add the logging you require to the method body.

  2. Add a call to base.OnInvokeHandler to ensure that the original invocation occurs.

    C#
    Copy
    public override void OnInvokeHandler(EventInterceptionArgs args)
{
    base.OnInvokeHandler(args);
    Console.WriteLine("A handler was invoked");
}

By adding the attribute to the target event handler earlier in this process you have enabled intercepting of each raised event.

Accessing the current context

At any time, the Handler property is set to the delegate being added, removed, or invoked. You can read and write this property. If you write it, the delegate you assign must be compatible with the type of the event. The Event property gets you the EventInfo of the event being accessed.

Within OnInvokeHandler(EventInterceptionArgs), the property Arguments gives access to the arguments with which the delegate was invoked.

These concepts will be illustrated in the following example.

Example: Removing offending event subscribers

When events are subscribed to, the component that raises the event has no way to ensure that the subscriber will behave properly when that event is raised. It's possible that the subscribing code will throw an exception when the event is raised and when that happens you may want to unsubscribe the handler to ensure that it doesn't continue to throw the exception. The EventInterceptionAspect can help you to accomplish this easily.

  1. Override the OnInvokeHandler(EventInterceptionArgs) method in your aspect.

  2. In the method body add a try...catch block.

  3. In the try block add a call to base.OnInvokeHandler and in the catch block add a call to RemoveHandler(Delegate)

    C#
    Copy
    [PSerializable]
public class CustomEventHandling : EventInterceptionAspect
{
    public override void OnInvokeHandler(EventInterceptionArgs args)
    {
        try
        {
            base.OnInvokeHandler(args);
        }
        catch (Exception e)
        {
            Console.WriteLine("Handler '{0}' invoked with arguments {1} failed with exception {2}.",
                              args.Handler.Method,
                              string.Join(", ", args.Arguments.Select(a => a == null ? "null" : a.ToString())),
                              e.GetType().Name);

            args.RemoveHandler(args.Handler);
            throw;
        }
    }

}

Now, any time an exception is thrown during event execution, the offending event handler will be unsubscribed from the event.

See Also

Reference

EventInterceptionAspect
Handler
Event
PSerializableAttribute
OnAddHandler(EventInterceptionArgs)
OnAddHandler(EventInterceptionArgs)
OnRemoveHandler(EventInterceptionArgs)
OnInvokeHandler(EventInterceptionArgs)
EventInfo
RemoveHandler(Delegate)


Introducing Custom Attributes

Applying custom attributes to class members in C# is a powerful way to add metadata about those members at compile time.

PostSharp provides the ability to create a custom attribute class which when applied to another class, can iterate through those class members and automatically decorate them with custom attributes. This can be useful for example, to automatically apply custom attributes or groups of custom attributes when new class members are added, without having to remember to do it manually each time.

This topic contains the following sections:

  • Introducing new custom attributes
  • Copying existing custom attributes
Introducing new custom attributes

In the following example, we’ll create an attribute decorator class which applies .NET’s DataContractAttribute to a class and DataMemberAttribute to members of a class at build time.

  1. Start by creating a class called AutoDataContractAttribute which derives from TypeLevelAspect. TypeLevelAspect transforms the class into an attribute which can be applied to other classes. Also implement IAspectProvider which exposes the ProvideAspects(Object) method for iterating on class members. ProvideAspects(Object) will be called for each member in the target class and will contain the code for applying the attributes:

    C#
    Copy
    public sealed class AutoDataContractAttribute : TypeLevelAspect, IAspectProvider
{
    public IEnumerable<AspectInstance> ProvideAspects(object targetElement)
    {
}

  2. Implement the ProvideAspects(Object) method to cast the targetElement parameter to a Type object. Note that this method will be called at build time. Since ProvideAspects(Object) will be called for the class itself and for each member of the target class, the Type object can be used for inspecting each member and making decisions about when and how to apply custom attributes. In the following snippet, the implementation returns a new AspectInstance for the Type containing a new DataContractAttribute and then iterates through each property of the Type returning a new AspectInstance with the DataMemberAttribute for each. Note that both the DataContractAttribute and DataMemberAttribute are both wrapped in CustomAttributeIntroductionAspect objects:

    C#
    Copy
    public sealed class AutoDataContractAttribute : TypeLevelAspect, IAspectProvider
{
    // This method is called at build time and should just provide other aspects.
    public IEnumerable<AspectInstance> ProvideAspects(object targetElement)
    {
        Type targetType = (Type) targetElement;

        CustomAttributeIntroductionAspect introduceDataContractAspect =
            new CustomAttributeIntroductionAspect(
                new ObjectConstruction(typeof (DataContractAttribute).GetConstructor(Type.EmptyTypes)));
        CustomAttributeIntroductionAspect introduceDataMemberAspect =
            new CustomAttributeIntroductionAspect(
                new ObjectConstruction(typeof (DataMemberAttribute).GetConstructor(Type.EmptyTypes)));

        // Add the DataContract attribute to the type.
        yield return new AspectInstance(targetType, introduceDataContractAspect);

        // Add a DataMember attribute to every relevant property.
        foreach (PropertyInfo property in
            targetType.GetProperties(BindingFlags.Public | BindingFlags.DeclaredOnly | BindingFlags.Instance))
        {
            if (property.CanWrite)
                yield return new AspectInstance(property, introduceDataMemberAspect);
        }
    }
}
    Note Note

    Since the ProvideAspects(Object) method returns an IEnumerable, the yield keyword should be used to return aspects for PostSharp to apply.

  3. Apply the AutoDataContractAttribute class. In the following example we apply it to a Product class where it will decorate Product with DataContractAttribute and each member with DataMemberAttribute:

    C#
    Copy
    [AutoDataContractAttribute]
public class Product
{
    public int ID { get; set; }

    public string Name { get; set; }

    public int RevisionNumber { get; set; }
}
Copying existing custom attributes

Another way to introduce attributes to class members is to copy them from another class. This is useful, for example, when distinct classes have members with the same names and are of the same types. In this case, attributes can be defined in one class and then that class can be used to decorate other similar classes with same attributes.

In the following snippet, Product’s ID and Name properties have both been modified to contain an additional attribute from the System.ComponentModel.DataAnnotations namespace – Editable, Display, and Required respectively. Below Product is another class called ProductViewModel containing the same properties to which we want to copy the attributes to:

C#
Copy
class Product
{
    [EditableAttribute(false)]
    [Required]
    public int Id { get; set; }

    [Display(Name = "The product's name")]
    [Required]
    public string Name { get; set; }
    public int RevisionNumber { get; set; }
}

class ProductViewModel
{
    public int Id { get; set; }
    public string Name { get; set; }
    public int RevisionNumber { get; set; }
}

To copy the attributes from the properties of Product to the corresponding properties of ProductViewModel, create an attribute class which can be applied to ProductViewModel to perform this copy process:

  1. Create a TypeLevelAspect which implements IAspectProvider. In the snippet below our class is called CopyCustomAttributesFrom:

    C#
    Copy
    class CopyCustomAttributesFrom : TypeLevelAspect, IAspectProvider
{
}

  2. Create a constructor to take in the class type from which the property attributes are to be copied from. This class type will be used in the next step to enumerate its properties:

    C#
    Copy
    class CopyCustomAttributesFrom : TypeLevelAspect, IAspectProvider
{
private Type sourceType;

public CopyCustomAttributesFrom(Type srcType)
{
    sourceType = srcType;
}
    }

  3. Implement ProvideAspects(Object):

    C#
    Copy
    class CopyCustomAttributesFrom : TypeLevelAspect, IAspectProvider
{
    // Details skipped.

    public IEnumerable<AspectInstance> ProvideAspects(object targetElement)
    {
        Type targetClassType = (Type)targetElement;

        //loop thru each property in target
        foreach (PropertyInfo targetPropertyInfo in targetClassType.GetProperties())
        {
            PropertyInfo sourcePropertyInfo = sourceType.GetProperty(targetPropertyInfo.Name);

            //loop thru all custom attributes for the source property and copy to the target property
            foreach (CustomAttributeData customAttributeData in sourcePropertyInfo.GetCustomAttributesData())
            {
                //filter out attributes that aren’t DataAnnotations
                if (customAttributeData.AttributeType.Namespace.Equals("System.ComponentModel.DataAnnotations"))
                {
                    CustomAttributeIntroductionAspect customAttributeIntroductionAspect =
                        new CustomAttributeIntroductionAspect(new ObjectConstruction(customAttributeData));

                    yield return new AspectInstance(targetPropertyInfo, customAttributeIntroductionAspect);
                }
            }

        }
    }
}

    The ProvideAspects(Object) method iterates through each property of the target class and then gets the corresponding property from the source class. It then iterates through all custom attributes defined for the source property, copying each to the corresponding property of the target class. ProvideAspects(Object) also filters out attributes which aren’t from the System.ComponentModel.DataAnnotations namespace to demonstrate how you may want to ignore some attributes during the copy process.

  4. Decorate the ProductViewModel class with the CopyCustomAttributesFrom attribute, specifying Product as the source type in the constructor. During compilation, CopyCustomAttributesFrom’s ProvideAspects(Object) method will then perform the copy process from Product to ProductViewModel:

    C#
    Copy
    [CopyCustomAttributesFrom(typeof(Product))]
class ProductViewModel
{
    // Details skipped.
}

The following screenshot shows the Product and ProductViewModel classes reflected from an assembly. Here we can see that the Editable and Display attributes were copied from Product to ProductViewModel using CopyCustomAttributesAttribute at build time:

Note Note

It is not possible to delete or replace an existing custom attribute.

See Also

Reference

ProvideAspects(Object)
CopyCustomAttributesAttribute
DataContractAttribute
DataMemberAttribute
TypeLevelAspect
IAspectProvider
AspectInstance
CustomAttributeIntroductionAspect


Introducing Managed Resources

Embedding resources in .NET allows for data to be packaged together with your code in an assembly. Resources are normally specified at design time and then embedded by the compiler during build time.

PostSharp’s AssemblyLevelAspect adds additional flexibility by allowing you to programmatically add resources at compile time. In doing so you can add logic and therefore flexibility in determining which resources get embedded and how. For example, you could use this feature to encrypt a resource just before embedding it into your assembly.

Introducing resources

In the following example, we’ll create an assembly decorator which retrieves the current date and time during compilation, and then stores that information in the current assembly as a resource. The example will then show that that information can be retrieved from the assembly at run time.

  1. Start by creating a class called AddBuildInfoAspect which derives from AssemblyLevelAspect. Also implement IAspectProvider which exposes the ProvideAspects(Object) method. The ProvideAspects(Object) method will be called once by PostSharp, providing access to assembly information and allowing for a resource to be programmatically added to the assembly:

    C#
    Copy
     public sealed class AddBuildInfoAspect : AssemblyLevelAspect, IAspectProvider
{
    public IEnumerable<AspectInstance> ProvideAspects(object targetElement)
    {
    }
}

  2. Implement the ProvideAspects(Object) method:

    C#
    Copy
     public sealed class AddBuildInfoAspect : AssemblyLevelAspect, IAspectProvider
{
    public IEnumerable<AspectInstance> ProvideAspects(object targetElement)
    {
        Assembly assembly = (Assembly)targetElement;

        byte[] userNameData = Encoding.ASCII.GetBytes(
           assembly.FullName + " was compiled by: " + Environment.UserName);
        ManagedResourceIntroductionAspect mria2 = new ManagedResourceIntroductionAspect("BuildUser", userNameData);

        yield return new AspectInstance(assembly, mria2);
    }
}

    In this example, the targetElement object passed in is cast to an Assembly object from which the assembly named is retrieved. The code then gets the current date and time, concatenates it with the assembly name, and then converts this string to a byte array. The byte array is then stored along with a name for the data in PostSharp’s ManagedResourceIntroductionAspect object, and returned via an AspectInstance. PostSharp then embeds the resource into the current assembly.

  3. Open your project’s AssemblyInfo.cs file and add a line to include the AddBuildInfoAspect class:

    C#
    Copy
    [assembly:AddBuildInfoAspect]

With this code in place, the assembly will now embed the date and time as a resource into itself during compilation.

The following code demonstrates how to retrieve the data at run time:

C#
Copy
 class Program
{
    static void Main(string[] args)
    {
        Assembly a = Assembly.GetExecutingAssembly();
        Stream stream = a.GetManifestResourceStream("BuildUser");

        byte[] bytesRead = new byte[stream.Length];
        stream.Read(bytesRead, 0, (int)stream.Length);
        string value = Encoding.ASCII.GetString(bytesRead);
        Console.WriteLine(value);
    }
}

This will display the following line in the console window:

See Also

Reference

AssemblyLevelAspect
IAspectProvider
ManagedResourceIntroductionAspect
AspectInstance

Other Resources

Adding Aspects Programmatically using IAspectProvider


Semantic Advising of Iterator and Async Methods

In most C# and VB methods, the source code is very similar to the way how the method is actually executed by the .NET runtime. However, with async and iterator methods, mapping between source code and assembly code is far from being straightforward. The compiler performs a complex transformation of the source code and generates a state machine type. If you disassemble an async or iterator method, you would just find some instructions that instantiate this state machine. When you apply an aspect to an async or iterator method, it leads to an ambiguity whether the aspect should be applied semantically at the abstraction level of the source code, or whether it should be applied non-semantically at the abstraction level of the assembly code.

By default, PostSharp applies semantic advising for async and iterator methods. It also uses semantic advising for all methods returning a Task.

This article discusses all details of semantic advising.

This topic contains the following sections:

  • Semantic advising for asynchronous code
  • Semantic advising for iterators
  • Semantic advising vs non-semantic advising
  • Supported and default advising modes
  • Enabling and disabling semantic advising
  • Coping with situations where semantic advising is not available
Semantic advising for asynchronous code

Consider the following code snippet:

C#
Copy
public class FlowerService
{

  [MyAspect]
  public Task<Flower> GetFlowerAsync1( int flowerId, string connectionString )
  {
    var connection = ConnectionManager.GetConnection( connectionString );
    return this.GetFlowerAsync2( flowerId, connection );
  }

  [MyAspect]
  public async Task<Flower> GetFlowerAsync2( int flowerId, Connection connection )
  {
      var flowerData = await connection.GetFlowerAsync( flowerId );
      var familyData = await connection.GetFlowerFamilyAsync( flowerData.FamilyId );
      return new Flower( flowerId, flowerData.Name, familyData.Name );
  }

}

The GetFlowerAsync1 method returns a Task but is not async (it would be useless and hurt performance to make it async). The GetFlowerAsync2 method both returns a Task and is async.

Both methods are enhanced by [MyAspect]. For different behaviors implemented by MyAspect, how would you expect MyAspect to work?

  • If MyAspect was an exception handler, you would probably expect all exceptions to be caught by MyAspect, including exceptions thrown by the GetFlowerAsync and GetFlowerFamilyAsync methods and the constructor of the Flower class. You would be deceived to realize that the aspect only handles exceptions thrown in the process of instantiating Task<Flower> and execute the part of the task that can run synchronously.

  • If MyAspect was a profiling aspect, you would probably want to measure the time taken by the whole method to execute. That is, you will probably be interested in the time of the whole Task<Flower> to run to completion, not just the time to instantiate it and run to the first waiting point.

  • If MyAspect was a caching aspect, you would probably want to cache the Flower object, not the Task<Flower> itself.

That is, most of the time, you want the aspect to apply to the semantic of the method, not to its implementation (how it is implemented in MSIL and executed by the .NET runtime).

We use the term semantic advising when an aspect or advice is applied to the level of abstraction of the programming language (C# or VB). Non-semantic advising or low-level advising means that PostSharp applies the aspect to the level of abstraction of MSIL.

Semantic advising is the default behavior for all methods returning a Task (or any other awaitable type such as ValueTask) and all async methods.

Semantic advising for iterators

The notion of semantic advising also applies to iterator methods, i.e. methods that include the yield return statement.

Consider the following code snippet:

C#
Copy
public class PostcardService
{

  [MyAspect]
  public IEnumerable<Postcard> GetPostcards1( )
  {
      return new [] { new Postcard("Hello from Alaska"), new Postcard("Hello from Siberia") };
  }

  [MyAspect]
  public IEnumerable<Postcard> GetPostcards2( int flowerId, Connection connection )
  {
      yield return new Postcard("Hello from Alaska");
      yield return new Postcard("Hello from Siberia");
  }

}

The GetPostcards2 method requires special attention. Under the hood, the C# or VB compiler generates a new class implementing the IEnumerableT and IEnumeratorT interfaces, called the enumerator class. At runtime, calling the GetPostcards2 method only instantiates the enumerator class. The initial logic of GetPostcards2 is moved to the MoveNext method of the enumerator.

Let's do the same exercise as for asynchronous methods. For different behaviors implemented by MyAspect, how would you expect MyAspect to work?

  • If MyAspect was an exception handler, you would probably want the aspect to catch any exception thrown by the C# code that you can see. That is, in GetPostcards2, you actually want to catch exceptions in the MoveNext method of the enumerator class. In this case, you need semantic advising.

  • If MyAspect was a profiling aspect, you may want to only measure the time when GetPostcards2 is actually executing, but exclude the time when the caller is processing the data returned by the enumerator. Therefore, you will also want to add behaviors to the MoveNext method of the enumerator class. In this case again, you need semantic advising.

  • If MyAspect was a caching aspect, however, you will want to cache a copy of the enumerator itself, therefore you will need to enhance the GetPostcards2 method and not the MoveNext method. In this case, you don't need semantic advising.

Semantic advising vs non-semantic advising

The following table compares semantic advising with non-semantic advising in several situations.

 | Semantic Advising | Non-Semantic Advising
Async methods: |  |
Code covered or intercepted by the aspect | The whole async method. | The part of the async method before the first await operator whose operand (typically a Task) has not yet completed.
Return value | The operand of the return statement, i.e. TaskTResultResult. | The TaskTResult object itself.
Non-async methods returning a Task: |  |
Code covered or intercepted by the aspect | Both the code that instantiates or gets the Task and the whole execution of the Task. | Only the code that instantiates or gets the Task (and if the Task represents an async method, the first segment of the method that runs synchronously).
Return value | The value of the TaskTResultResult property. | The TaskTResult object itself.
Iterator methods: |  |
Code covered or intercepted by the aspect | The whole method. | The compiler-generated code that instantiates the enumerator class (no user code is covered).
Return value | None. | The enumerator.
Supported and default advising modes

Semantic advising is available for the OnMethodBoundaryAspect, OnExceptionAspect and MethodInterceptionAspect aspects. Whenever semantic advising makes sense, it is the default advising mode.

The following table specifies where semantic advising is supported and where it is the default advising mode.

Target methods | Advising modes supported by OnMethodBoundaryAspect and OnExceptionAspect | Advising modes supported by MethodInterceptionAspect | Default advising mode
async method returning void | Semantic and non-semantic | Non-semantic. | Semantic.
async method returning a Task | Semantic and non-semantic | Semantic and non-semantic | Semantic.
async method returning something else than void or a Task | Semantic and non-semantic | Non-semantic | Semantic
Iterator method | Semantic and non-semantic | Non-semantic | Semantic
Normal method returning IEnumerableT or IEnumeratorT | Non-semantic | Non-semantic | Non-semantic
Caution note Caution

With MethodInterceptonAspect, the default advising mode is always non-semantic when the OnInvokeAsync(MethodInterceptionArgs) advice is not implemented by the aspect.

As you can see, the default mode is semantic even in situations where semantic advising is not available, where we believe semantic advising would be desirable. This design allows us to implement support for semantic advising in future versions of PostSharp without breaking backward compatibility. However, PostSharp will emit a build-time error if you try to use semantic advising on a method that is not supported.

The next sections explain how to opt out from semantic advising and how to cope with situations when semantic advising is not available.

Enabling and disabling semantic advising

You can disable or enable semantic advising by setting the SemanticallyAdvisedMethodKinds property of your aspect. You would typically set this property in the constructor or in the CompileTimeInitialize(MethodBase, AspectInfo) method.

If you want to disable semantic advising in all situations, set the SemanticallyAdvisedMethodKinds property to None. Otherwise, you can select individual situations in which semantic advising should be applied by setting the property to a bitwise combination of the values of the SemanticallyAdvisedMethodKinds enumeration. For instance, the Async | Iterator value instructs PostSharp to use semantic advising for async methods and iterators but not for other methods returning a Task or an enumerable.

Example

The following code snippet shows how to configure a caching aspect so that semantic advising is used for methods returning a Task but not for methods returning an enumerable.

C#
Copy
[PSerializable]
public class CacheAttribute : MethodInterceptionAspect
{

  public CacheAttribute()
  {
      this.SemanticallyAdvisedMethodKinds = SemanticallyAdvisedMethodKinds.ReturnsAwaitable;
  }

  // Detailed skipped.

}
Coping with situations where semantic advising is not available

By default, PostSharp will emit a build-time error if you're applying a semantically advising aspect to a method that does not support it (for instance an asynchronous MethodInterceptionAspect cannot be applied to an async void method.

Instead of failing with an error, you can change the behavior by setting the UnsupportedTargetAction aspect property. The default value is Fail. You can choose Ignore to silently skip applying the aspect or advice to the target method, or Fallback to apply non-semantic advising.

See Also

Reference

OnMethodBoundaryAspect
OnYield(MethodExecutionArgs)
OnResume(MethodExecutionArgs)
OnEntry(MethodExecutionArgs)
OnExit(MethodExecutionArgs)
OnSuccess(MethodExecutionArgs)
MethodExecutionArgs
SemanticallyAdvisedMethodKinds
MethodExecutionTag
PSerializableAttribute

Other Resources

Injecting Behaviors Before and After Method Execution
PostSharp Aspect Framework - Product Page


Understanding Aspect Lifetime and Scope

An original feature of PostSharp is that aspects are instantiated at compile time. Most other frameworks instantiate aspects at run time.

Persistence of aspects between compile time and run time is achieved by serializing aspect instances into a binary resource stored in the transformed assembly. Therefore, you should carefully mark all aspect classes with the PSerializableAttribute custom attribute, and distinguish between serialized fields (typically initialized at compile-time and used at run-time) and non-serialized fields (typically used at run-time only or at compile-time only).

This topic contains the following sections:

  • Scope of Aspects
  • Steps in the Lifetime of an Aspect Instance
Scope of Aspects

PostSharp offers two kinds of aspect scopes: static (per-class) and per-instance.

Statically Scoped Aspects

With statically-scoped aspects, PostSharp creates one aspect instance for each element of code to which the aspect applies. The aspect instance is stored in a static field and is shared among all instances of the target class.

In generic types, the aspect instance has not exactly the same scope as static fields. Consider the following piece of code:

C#
Copy
 public class GenericClass<T>
{
  static T f;

  [Trace]
  public void void SetField(T value) { f = value; }
}

public class Program
{
   public static void Main()
   {
      GenericClass<int>.SetField(1);
      GenericClass<long>.SetField(2);
   }
}

In this program, there are two instances of the static field f (one for GenericClass<int>, the second for GenericClass<long>) but only a single instance of the aspect Trace.

Instance-Scoped Aspects

Instance-scoped aspects have the same scope (instance or static) as the element of code to which they are applied. If an instance-scoped aspect is applied to a static member, it will have static scope. However, if it is applied to an instance member or to a class, it will have the same lifetime as the class instance: an aspect instance will be created whenever the class is instantiated, and the aspect instance will be garbage-collectable at the same time as the class instance.

Instance-scoped aspects are implemented according to the prototype pattern: the aspect instance created at compile time serves as a prototype, and is cloned at run-time whenever the target class is instantiated.

Instance-scoped aspects must implement the interface IInstanceScopedAspect. Any aspect may be made instance-scoped. The following code is a typical implementation of the interface IInstanceScopedAspect:

C#
Copy
 object IInstanceScopedAspect.CreateInstance( AdviceArgs adviceArgs )
{
  return this.MemberwiseClone();
}

void IInstanceScopedAspect.RuntimeInitializeInstance()
{
}
Steps in the Lifetime of an Aspect Instance

The following table summarizes the different steps of the aspect instance lifetime:

Phase

Step

Description

Compile-Time

Instantiation

PostSharp creates a new instance of the aspect for every target to which it applies. If the aspect has been applied using a multicast custom attribute (MulticastAttribute), there will be one aspect instance for each matching element of code.

When the aspect is given as a custom attribute or a multicast custom attribute, each custom attribute instance is instantiated using the same mechanism as the Common Language Runtime (CLR) does: PostSharp calls the appropriate constructor and sets the properties and/or fields with the appropriate values. For instance, when you use the construction [Trace(Category="FileManager")], PostSharp calls the default constructor and the Category property setter.

Validation

PostSharp validates the aspect by calling the CompileTimeValidate aspect method. See Validating Aspect Usage for details.

Compile-Time Initialization

PostSharp invokes the CompileTimeInitialize aspect method. This method may, but must not, be overridden by concrete aspect classes in order to perform some expensive computations that do not depend on runtime conditions. The name of the element to which the custom attribute instance is applied is always passed to this method.

Serialization

After the aspect instances have all been created and initialized, PostSharp serializes them into a binary stream. This stream is stored inside the new assembly as a managed resource.

Run-Time

Deserialization

Before the first aspect must be executed, the aspect framework deserializes the binary stream that has been stored in a managed resource during post-compilation.

At this point, there is still one aspect instance per target class.

Per-Class Runtime Initialization

Once all custom attribute instances are deserialized, we call for each of them the RuntimeInitialize method. But this time we pass as an argument the real System.Reflection object to which it is applied.

Per-Instance Runtime Initialization

This step applies only to instance-scoped aspects when they have been applied to an instance member.

When a class is instantiated, the aspect framework creates an aspect instance by invoking the method CreateInstance(AdviceArgs) of the prototype aspect instance. After the new aspect instance has been set up, the aspect framework invokes the RuntimeInitializeInstance.

Advice Execution

Finally, advices (methods such as OnEntry(MethodExecutionArgs)) are executed.

See Also

Other Resources

Validating Aspect Usage
Initializing Aspects
Understanding Aspect Serialization
Coping with Custom Object Serializers


Initializing Aspects

As explained in the section Understanding Aspect Lifetime and Scope, a different aspect instance is associated with every element of code it is applied to. Aspect instances are created at compile time, serialized into the assembly as a managed resource, and deserialized at run time. If the aspect is instance-scoped, instances are duplicated from the prototype and initialized.

Therefore, you can override one of the following three methods to handle aspect initializations:

  1. The method CompileTimeInitialize is invoked at compile time, and should initialize only serializable fields of the aspect, so that the value of these fields will be available at run time. The argument of this method is the System.Reflection object representing the element of code to which this aspect instance has been applied. Therefore, this method can already perform expensive computations that depend only on metadata.

  2. The method RuntimeInitialize is invoked at run time. Note that the aspect constructor itself is not invoked at run time. Therefore, overriding RuntimeInitialize is the only way to perform initialization tasks at run time. If the aspect is instance-scoped, this method is executed on the prototype instance.

  3. The methods IInstanceScopedAspectCreateInstance(AdviceArgs) and IInstanceScopedAspectRuntimeInitializeInstance is invoked only for instance-scoped aspects. They initialize the aspect instance itself, as RuntimeInitialize was invoked on the prototype.

Tip Tip

Initializing an aspect at compile time is useful when you need to compute a difficult result that depends only on metadata -- that is, it does not depend on any runtime information. An example is to build the strings that need to be printed by a tracing aspect. It is rather expensive to build strings that contain the full type name, the method name, and eventually placeholders for generic parameters and parameters. However, all required pieces of information are available at compile time. So compile time is the best moment to compute these strings.

See Also

Other Resources

Understanding Aspect Lifetime and Scope


Coping with Custom Object Serializers

Some aspects need to be initialized when a new instance of the class to which they are applied is created. For instance, instance-scoped aspect must be cloned from the prototype; members imported into the through ImportMemberAttribute must be bound to aspect fields.

PostSharp enhances every constructor of every enhanced class so that aspects are properly initialized.

However, it is possible to create new instances of classes by bypassing the constructor. This happens, for instance, when classes are deserialized by the BinaryFormatter or the DataContractSerializer. These formatters use the method FormatterServicesGetUninitializedObject(Type) to create new instances, but this method bypasses all constructors.

PostSharp implements a workaround for the deserializers BinaryFormatter and DataContractSerializer: it creates or modifies a method annotated by the custom attribute OnDeserializingAttribute, so that aspects are initialized properly.

However, if you are using a custom deserializer, or for any reason create instances using the method the method FormatterServicesGetUninitializedObject(Type), you will have to initialize aspects manually.

Initializing Aspects Manually

There are two possible ways to initialize an aspect from user code.

By Defining a Method InitializeAspects

You can define in your classes (typically in one of the root classes of your class hierarchy) a method with the following name and signature:

C#
Copy
protected virtual void InitializeAspects();

When PostSharp discovers this method, it will insert its own initialization logic at the beginning of the InitializeAspects method. The original logic is not deleted. This method can safely have an empty implementation.

The following constraints apply:

  • The method should be virtual unless the class is sealed.

  • The method should be protected or public unless the class is internal.

For instance, the following class would enable aspects (applied to this class or on derived classes) to be initialized after deserialization (note that PostSharp automatically generates this code for BinaryFormatter and DataContractSerializer; you only need to do it manually for a custom serializer).

C#
Copy
[DataContract]
public abstract class BaseClass
{
  protected virtual void InitializeAspects()
  {
  }

  [OnDeserializing]
  private void OnDeserializingInitializeAspects()
  {
    this.InitializeAspects();
  }
}

By Invoking AspectUtilities.InitializeCurrentAspects

Instead of providing an empty method InitializeAspects, it is possible to invoke the method AspectUtilitiesInitializeCurrentAspects. A call to this method will be translated into a call to InitializeAspects. It has to be invoked from a non-static method of an enhanced class.

If the class from which InitializeCurrentAspects is invoked has not been enhanced by an aspect requiring initialization, the call to this method is simply ignored.

Note Note

Using this approach may be brittle in some situations: calls to InitializeCurrentAspects will have no effect if aspects are applied to derived classes, but not to the calling class. In this scenario, it is preferable to define the method InitializeAspects.


Validating Aspect Usage

Some aspects make sense only on a specific subset of targets. For instance, an aspect may require being applied to non-static methods only. Another aspect may not be compatible with methods that have ref or out parameters. If these constraints are not respected, these aspects will fail at run time. However, defects detected by the compiler are always cheaper to fix than ones detected later. So, as the developer of an aspect, you should ensure that the build will fail if your aspect is being used on an invalid target.

This topic contains the following sections:

  • Using [MulticastAttributeUsage]
  • Implementing CompileTimeValidate
  • Using Message Sources
  • Validating Attributes That Are Not Aspects
Using [MulticastAttributeUsage]

The first level of protection is to configure multicasting properly with [MulticastAttributeUsageAttribute], as described in the article Adding Aspects Declaratively Using Attributes. However, this approach can only filter based on characteristics that are supported by the multicasting component.

Implementing CompileTimeValidate

The best way to validate aspect usage is to override the CompileTimeValidate(Object) method of your aspect class.

In this example, we will show how an aspect RequirePermissionAttribute can require being applied only to methods of types that implement the ISecurable interface.

  1. Inherit from one of the pre-built aspects. In this case, OnMethodBoundaryAspect.

    C#
    Copy
    public class RequirePermissionAttribute: OnMethodBoundaryAspect

  2. Override the CompileTimeValidate(Object) method.

    C#
    Copy
     public override bool CompileTimeValidate(MethodBase target)
{

  3. Perform a check to see if the target class implements the interface in question.

    C#
    Copy
    Type targetType = target.DeclaringType;
if (!typeof(ISecurable).IsAssignableFrom(targetType))
{

}

  4. If the target does not implement the interface you must signal the compilation process that this target should not have the aspect applied to it. There are two ways to do this. The first option is to throw an InvalidAnnotationException.

    C#
    Copy
    if (!typeof(ISecurable).IsAssignableFrom(targetType))
{
  throw new InvalidAnnotationException("The target type does not implement ISecurable.");
}

  5. The second option is to emit an error message to the compilation process.

    C#
    Copy
     if (!typeof(ISecurable).IsAssignableFrom(targetType))
{
  Message.Write(SeverityType.Error, "Custom01",
                "The target type does not implement ISecurable.", target);
 return false;
}
Note Note

You may have noticed that CompileTimeValidate(Object) returns a boolean value. If you only return false from this method the compilation process will silently ignore it. You must either throw the InvalidAnnotationException or emit an error message to not silently ignore the false return value.

Making use of the CompileTimeValidate(Object) method is a great way to encode custom rules for applying aspects to target code. While it could be used to duplicate the functionality of the AttributeTargetTypeAttributes or AttributeTargetMemberAttributes, its real power is to go beyond those filtering techniques. By using CompileTimeValidate(Object) you are able to filter aspect application in any manner that you can interrogate your codebase using reflection.

Using Message Sources

If you plan to raise many messages, you may prefer to define your own MessageSource. A MessageSource is backed by a managed resource mapping error codes to error messages.

In order to create your own MessageSource, you should:

  1. Create an implementation of the IMessageDispenser. Typically, implement the GetMessage(String) method using a large switch statement. To each message will correspond a string

  2. Create a static instance of the MessageSource class for your message source.

    For instance, the following code defines a message source based on a message dispenser:

    C#
    Copy
    internal class ArchitectureMessageSource : MessageSource
{
    public static readonly ArchitectureMessageSource Instance = new ArchitectureMessageSource();

    private ArchitectureMessageSource() : base( "PostSharp.Architecture", new Dispenser() )
    {
    }

    private class Dispenser : MessageDispenser
    {
        public Dispenser() : base( "CUS" )
        {
        }

        protected override string GetMessage( int number)
        {
            switch ( number )
            {
                case 1:
                    return "Interface {0} cannot be implemented by {1} because of the [InternalImplement] constraint.";

                case 2:
                    return "{0} {1} cannot be referenced from {2} {3} because of the [ComponentInternal] constraint.";

                case 3:
                    return "Cannot use [ComponentInternal] on {0} {1} because the {0} is not internal.";

                case 4:
                    return "Cannot use [Internal] on {0} {1} because the {0} is not public.";

                default:
                    return null;
            }
        }
    }
}

  3. Then you can use a convenient set of methods on your MessageSource object:

    C#
    Copy
    MyMessageSource.Instance.Write( classType, SeverityType.Error, "CUS001", new object[] { interfaceType, classType } );
Note Note

You can also emit information and warning messages.

Tip Tip

Use ReflectionSearch to perform complex queries over System.Reflection.

Validating Attributes That Are Not Aspects

You can validate any attribute derived from Attribute by implementing the interface IValidableAnnotation.

See Also

Reference

MethodLevelAspectCompileTimeValidate(MethodBase)
TypeLevelAspectCompileTimeValidate(Type)
FieldLevelAspectCompileTimeValidate(FieldInfo)
LocationLevelAspectCompileTimeValidate(LocationInfo)
EventLevelAspectCompileTimeValidate(EventInfo)
AssemblyLevelAspectCompileTimeValidate(Assembly)
IValidableAnnotation
MessageSource
Message
MessageWrite


Developing Composite Aspects

PostSharp offers two approaches to aspect-oriented development. The first, as explained in section Developing Simple Aspects, is very similar to object-oriented programming. It requires the aspect developer to override virtual methods or implement interfaces. This approach is very efficient for simple problems.

One way to grow in complexity with the first approach is to use the interface IAspectProvider (see Adding Aspects Dynamically). However, even this technique has its limitations.

This chapter documents the second approach, closer to the classic paradigm of aspect-oriented programming introduced by AspectJ. This approach allows developers to implement more complex design patterns using aspects. We call the aspects developed with this approach composite aspects, because they are freely composed of different elements named advices and pointcuts.

An advice is anything that adds a behavior or a structural element to an element of code. For instance, introducing a method into a class, intercepting a property setter, or catching exceptions, are advices.

A pointcut is a function returning a set of elements of code to which advices apply. For instance, a function returning the set of properties annotated with the custom attribute DataMember is a pointcut.

Classes supporting advices and pointcuts are available in the namespace PostSharp.Aspects.Advices.

A composite aspect generally derives from a class that does not define its own advices: AssemblyLevelAspect, TypeLevelAspect, InstanceLevelAspect, MethodLevelAspect, LocationLevelAspect or EventLevelAspect. As such, these aspects have no functionality. You can add functionalities by adding advices to the aspect.

Advices are covered in the following sections:

Section | Description
Adding Behaviors to Existing Members | Advices with equivalent functionality as OnMethodBoundaryAspect, MethodInterceptionAspect, LocationInterceptionAspect, and EventInterceptionAspect.
Introducing Interfaces, Methods, Properties and Events | Make the aspect introduce an interface into the target class. The interface is implemented by the aspect itself.
Accessing Members of the Target Class | Make the aspect introduce a new method, property or event into the target class. The new member is implemented by the aspect itself. Conversely, the aspect can import a member of the target so that it can invoke it through a delegate.


Adding Behaviors to Existing Members

In order to add new behaviors to (i.e. modify) existing members (methods, fields, properties, or events), two questions must be addressed:

  • What transformation should be performed? The answer lays in the advice. This advice is a method of your advice, annotated with a custom attribute determining in which situation the method should be invoked. You can freely choose the name of the method, but its signature must match the one expected by the advice type.

  • Where should it be performed, i.e. on which elements of code? The answer lays in the pointcut, another custom attribute expected on the method providing the transformation.

This topic contains the following sections:

  • How to Add a Behavior to an Existing Member
  • Advice Kinds
  • Pointcuts Kinds
  • Grouping Advices
How to Add a Behavior to an Existing Member

  1. Start with an empty aspect class deriving AssemblyLevelAspect, TypeLevelAspect, InstanceLevelAspect, MethodLevelAspect, LocationLevelAspect or EventLevelAspect. Mark it as serializable.

  2. Choose an advice type in the list below. For instance: OnMethodEntryAdvice.

  3. Create a method. The signature of this method should match exactly the signature matched by this advice type.

  4. Annotate this method with a custom attribute of the advice type you chose. For instance: [OnMethodEntryAdvice].

  5. Choose a pointcut type in the list below. For instance: SelfPointcut. Annotate the advice method with that custom attribute. For instance: [SelfPointcut].

Example

The following code shows a simple tracing aspect implemented with an advice and a pointcut. This aspect is exactly equivalent to a class derived from OnMethodBoundaryAspect where only the method OnEntry(MethodExecutionArgs) has been overwritten. The example is a method-level aspect and SelfPointcut means that the advice applies to the same target as the method itself.

C#
Copy
using System;
using PostSharp.Aspects;
using PostSharp.Aspects.Advices;
using PostSharp.Serialization;

namespace Samples6
{
    [PSerializable]
    public sealed class TraceAttribute : MethodLevelAspect
    {
        [OnMethodEntryAdvice, SelfPointcut]
        public void OnEntry(MethodExecutionArgs args)
        {
            Console.WriteLine("Entering {0}.{1}", args.Method.DeclaringType.Name, args.Method.Name);
        }
    }
}
Advice Kinds

The following table lists all types of advices that can transform existing members. Note that all these advices are available as a part of a simple aspect (for instance OnMethodEntryAdvice corresponds to OnMethodBoundaryAspectOnEntry(MethodExecutionArgs). For a complete documentation of the advice, see the documentation of the corresponding simple aspect.

Advice Type | Targets | Description
OnMethodEntryAdvice OnMethodSuccessAdvice OnMethodExceptionAdvice OnMethodExitAdvice | Methods | These advices are equivalent to the advices of the aspect OnMethodBoundaryAspect. The target method to be wrapped by a try/catch/finally construct.
OnMethodInvokeAdvice | Methods | This advice is equivalent to the aspect MethodInterceptionAspect. Calls to the target methods are replaced to calls to the advice.
OnLocationGetValueAdvice OnLocationSetValueAdvice | Fields, Properties | These advices are equivalent to the advices of the aspect LocationInterceptionAspect. Fields are changed into properties, and calls to the accessors are replaced to calls to the proper advice.
LocationValidationAdvice | Fields, Properties, Parameters | This advice is equivalent to the ValidateValue(UTP, String, LocationKind) LocationInterceptionAspect method of the ILocationValidationAspectT aspect interface. It validates values assigned to their targets and throws an exception in case of error.
OnEventAddHandlerAdvice OnEventRemoveHandlerAdvice OnEventInvokeHandlerAdvice | Events | These advices are equivalent to the advices of the aspect EventInterceptionAspect. Calls to add and remove semantics are replaced by calls to advices. When the event is fired, the OnEventInvokeHandler is invoked for each handler, instead of the handler itself.
Pointcuts Kinds

Pointcuts determine where the transformation provided by the advice should be applied.

From a logical point of view, pointcuts are functions that return a set of code elements. A pointcut can only select elements of code that are inside the target of the aspect itself. For instance, if an aspect has been applied to a class A, the pointcut can select the class A itself, members of A, but different classes or members of different classes.

Multicast Pointcut

The pointcut type MulticastPointcut allows expressing a pointcut in a purely declarative way, using a single custom attribute. It works in a very similar way as MulticastAttribute (see Adding Aspects Declaratively Using Attributes) the kind of code elements being selected, their name and attributes can be filtered using properties of this custom attribute.

For instance, the following code applies the OnPropertySet advice to all non-abstract properties of the class to which the aspect has been applied.

C#
Copy
 [OnLocationSetValueAdvice,
 MulticastPointcut( Targets = MulticastTargets.Property,
                    Attributes = MulticastAttributes.Instance | MulticastAttributes.NonAbstract)]
public void OnPropertySet( LocationInterceptionArgs args )
{
  // Details skipped.
}

Method Pointcut

The pointcut type MethodPointcut allows expressing a pointcut imperatively, using a C# or VB method. The argument of the custom attribute should contain the name of the method implementing the pointcut.

The only parameter of this method should be type-compatible with the kind of elements of code to which the aspect applies. The return value of the pointcut method should be a collection (IEnumerableT) of objects that are type-compatible with the kind of elements of code to which the advice applies.

For instance, the following code applies the OnPropertySet advice to all writable properties that are not annotated with the IgnorePropertyChanged custom attribute.

C#
Copy
private IEnumerable<PropertyInfo> SelectProperties( Type type )
{
    const BindingFlags bindingFlags = BindingFlags.Instance |
        BindingFlags.DeclaredOnly | BindingFlags.Public;

    return from property
               in type.GetProperties( bindingFlags )
           where property.CanWrite && !property.IsDefined(typeof(IgnorePropertyChanged))
           select property;
}

[OnLocationSetValueAdvice, MethodPointcut( "SelectProperties" )]
public void OnPropertySet( LocationInterceptionArgs args )
{
    // Details skipped.
}

As you can see in this example, pointcut methods can use the power of LINQ to query System.Reflection.

Self Pointcut

The pointcut type SelfPointcut simply selects the target of the aspect.

Grouping Advices

The table of above shows advice types grouped in families. Advices of different type but of the same family can be grouped into a single logical filter, so they are considered as single transformation.

Why Grouping Advices

Consider for instance three advices of the family OnMethodBoundaryAspect: OnMethodEntryAdvice, OnMethodSuccessAdvice and OnMethodExceptionAdvice. The way how they are ordered is important, as it results in a different generation of the try/catch/finally block.

The following table compares advice ordering strategies. In the left column, advices are executed in the order: OnEntry, OnExit, OnException. In the right column, advices are grouped together.

C#
Copy
 void Method()
{
  try
  {
    OnEntry();

    try
    {
      // Original method body.
    }
    finally
    {
      OnExit();
    }
  }
  catch
  {
     OnException();
     throw;
  }
}
C#
Copy
 void Method()
{
  OnEntry();

  try
  {
      // Original method body.
  }
  catch
  {
     OnException();
     throw;
  }
  finally
  {
      OnExit();
  }
}

The code in the left column may make sense in some situations, but it is not consistent with the code generated by OnMethodBoundaryAspect. Note that the advices may have been ordered differently: the order OnEntry, OnException, OnExit would have generated the same code as in the right column. However, you would have had to use custom attributes to specify order relationships between advices (see Ordering Advices). Grouping advices is a much easier way to ensure consistency.

Additionally, when advices of the OnMethodBoundaryAspect family are grouped together, it will be possible to share information among them using MethodExecutionTag.

The reasons to group advices of the family LocationInterceptionAspect and EventInterceptionAspect are similar: advices grouped together behave consistently as a single filter (see [interception-aspects]).

How to Group Advices

To group several advices into a single filter:

  1. Choose a master advice. The choice of the master advice is arbitrary. All other advices of the group are called slave advices.

  2. Annotate the master advice method with one advice custom attribute (see Available Advices and one pointcut custom attribute (see Available Pointcuts), as usual.

  3. Annotate all slave advices with one advice custom attribute. Set the property Master of the custom attribute to the name of the master advice method.

  4. Do not specify any pointcut on slave advice methods.

The following code shows how two advices of type OnMethodEntryAdvice and OnMethodExitAdvice can be grouped into a single filter:

C#
Copy
[OnMethodEntryAdvice, MulticastPointcut]
public void OnEntry(MethodExecutionArgs args)
{
}

[OnMethodExitAdvice(Master="OnEntry")]
public void OnExit(MethodExecutionArgs args)
{
}
See Also

Reference

PostSharp.Aspects.Advices

Other Resources

Ordering Advices
[interception-aspects]


Introducing Interfaces, Methods, Properties and Events into Existing Classes

Some design patterns require you to add properties, methods or interfaces to your target code. If many components in your codebase need to represent the same construct, repetitively adding those constructs flies in the face of the DRY (Don't Repeat Yourself) principle. So how can you add code constructs to your target code without it becoming repetitive?

PostSharp offers a number of ways for you to add different code constructs to your codebase in a controlled and consistent manner. Let's take a look at those techniques.

This topic contains the following sections:

  • Introducing interfaces
  • Introducing methods
  • Introducing properties
  • Controlling the visibility of introduced members
  • Overriding members or interfaces
Introducing interfaces

One of the common situations that you will encounter is the need to implement a specific interface on a large number of classes. This may be INotifyPropertyChanged, IDisposable, IEquatableT or some custom interface that you have created. If the implementation of the interface is consistent across all of the targets then there is no reason that we shouldn't centralize its implementation. So how do we go about adding that interface to a class at compile time?

  1. Let's add the IIdentifiable interface to the target code.

    C#
    Copy
     public interface IIdentifiable
{
    Guid Id { get; }
}

  2. Create an aspect that inherits from InstanceLevelAspect and add the custom attribute [PSerializableAttribute].

  3. The key to adding an interface to target code is that you must implement that interface on your aspect. Let's implement the IIdentifiable interface on our aspect. It's this implementation of the interface that will be added to the target code, so anything that you include in method or property bodies will be added to the target code as you have declared it in the aspect.

    C#
    Copy
    [PSerializable]
public class IdentifiableAspect : InstanceLevelAspect, IIdentifiable
{
    public Guid Id { get; private set; }
}

  4. Add the IntroduceInterfaceAttribute attribute to the aspect and include the interface type that you want to add to the target code.

    C#
    Copy
    [IntroduceInterface(typeof(IIdentifiable))]
[PSerializable]
public class IdentifiableAspect : InstanceLevelAspect, IIdentifiable
{
    public Guid Id { get; private set; }
}

  5. Finally you need to declare where this aspect should be applied to the codebase. In this example, let's add it, as an attribute, to a class.

    C#
    Copy
    [IdentifiableAspect]
public class Customer
{
    public string Name { get; set; }
    public string Address { get; set; }
}

  6. After compilation, you can decompile the target code and see that the interface has been added to it.

As you can see in the decompiled code, interfaces are implemented explicitly on the target code. It is also possible to introduce public members to target code. This is covered below.

Note Note

Interfaces and members introduced by PostSharp are not visible at compile time. To access the dynamically applied interface you must make use of a special PostSharp feature; the CastSourceType, TargetType(SourceType) pseudo-operator. The CastSourceType, TargetType(SourceType) method will allow you to safely cast the target code to the interface type that was dynamically applied. Once that call has been done, you are able to make use of the instance through the interface constructs.

There is no way to access a dynamically-inserted method, property or event, other than through reflection or the dynamic keyword.

Note Note

When you start adding code constructs to your target code, you need to determine how to initialize them correctly. Because these code constructs are not available for you to work with at compile time you need to figure out how to deal with them some other way. To see more about initializing code constructs that you introduce via aspects, please see the section Initializing Aspects.

Introducing methods

The introduction of methods to your target code is very similar to introducing interfaces. The biggest difference is that you will be introducing code at a much more granular level.

  1. Create an aspect that inherits from InstanceLevelAspect and add the custom attribute [PSerializableAttribute].

  2. Add to the aspect the method you want to introduce to the target code.

    C#
    Copy
    [PSerializable]
public class OurCustomAspect : InstanceLevelAspect
{
    public void TheMethodYouWantToUse(string aValue)
    {
        Console.WriteLine("Inside a method that was introduced {0}", aValue);
    }
}
    Note Note

    The method that you declare must be marked as public. If it is not you will see an error at compile time.

  3. Decorate the method with the IntroduceMemberAttribute attribute.

    C#
    Copy
    [IntroduceMember]
public void TheMethodYouWantToUse(string aValue)
{
    Console.WriteLine("Inside a method that was introduced {0}", aValue);
}

  4. Finally, declare where you want this aspect to be applied in the codebase.

    C#
    Copy
    [OurCustomAspect]
public class Customer
{
    public string Name { get; set; }
}

  5. After compilation, you can decompile the target code and see that the method has been added.

    Introducing Method decompile
Introducing properties

The introduction of properties is almost exactly the same as the introduction of methods. Like introducing a method you will use the IntroduceMemberAttribute attribute. Let's take a look at the details.

  1. Create an aspect that inherits from InstanceLevelAspect and add the custom attribute [PSerializableAttribute].

  2. Add the property you want to introduce to the aspect.

    C#
    Copy
    [PSerializable]
public class OurCustomAspect : InstanceLevelAspect
{
    public string Name { get; set; }
}
    Note Note

    The property that you declare must be marked as public. If it is not you will see a compiler error.

  3. Decorate the property with the IntroduceMemberAttribute attribute.

    C#
    Copy
    [IntroduceMember]
public string Name { get; set; }

  4. Add the aspect attribute to the target code where the aspect should be applied.

    C#
    Copy
    [OurCustomAspect]
public class Customer
{

}

  5. After you have compiled the codebase you can decompile the target code and see that the property has been added.

    Introducing Property decompile

As noted for both the introduction of methods and properties, the code being introduced must be declared as public. This is needed to ensure that PostSharp can function. If you look closely at the decompiled targets you will see that the introduced members are actually calling the methods/properties that were declared on the aspect. If the method/property on the aspect is not public, the target code will not be able to call it as it should.

Note Note

It is possible to introduce properties to target code, but it is not possible to introduce fields to your target code. The reason is that all members are introduced by delegation: the actual implementation of the member always resides in the aspect.

Controlling the visibility of introduced members

You may not want the introduced member to have public visibility once it has been introduced to the target code. PostSharp allows you to control the visibility of the introduced member through the use of the Visibility property on the aspect. To declare that a member should be introduced with private visibility, all you have to do is declare it as such.

C#
Copy
[IntroduceMember(Visibility = Visibility.Private)]
public string Name { get; set; }

You have the ability to introduce members with a number of different visibilities including public, private, assembly (internal in C#) and others. You also have the ability to mark an introduction so that it will be declared as virtual if you set the IsVirtual property to true.

C#
Copy
[IntroduceMember(Visibility = Visibility.Private, IsVirtual = true)]
public string Name { get; set; }
Overriding members or interfaces

One thing you need to be aware of is the situation where you are introducing a member that may already exist in the scope of the target code. Perhaps the method you are trying to introduce is available on the target code through inheritance. It's possible that the method is explicitly declared on the target code as well. The introduction of a member via an aspect needs to take these situations into account. PostSharp allows you to take these situations into account through the use of the OverrideAction property.

The OverrideAction property allows you to declare a rule for how the introduction of a member or interface should behave if the member or interface is already implemented on the target code. This property allows you to declare rules such as Fail (any conflict situation will throw a compile time error), Ignore (continue on without trying to introduce the member/interface), OverrideOrFail or OverrideOrIgnore. It's important to understand how you want to apply your introduced members/interfaces in situations where that member/interface may already exist.

C#
Copy
[IntroduceMember(OverrideAction = MemberOverrideAction.Fail)]
public string Name { get; set; }
See Also

Reference

CreateImplementationObject(AdviceArgs)
CompositionAspect
CastSourceType, TargetType(SourceType)
INotifyPropertyChanged
IDisposable
InstanceLevelAspect
PSerializableAttribute
IntroduceInterfaceAttribute
IntroduceMemberAttribute
Visibility
IsVirtual
OverrideAction
Fail
Ignore
OverrideOrFail
OverrideOrIgnore
GetPublicInterfaces(Type)
CreateImplementationObject(AdviceArgs)
CreateInstance(Type, ActivatorSecurityToken)


Accessing Members of the Target Class

PostSharp makes it possible to import a delegate of a target class method, property or event into the aspect class, so that the aspect can invoke this member.

These mechanisms allow developers to encapsulate more design patterns using aspects.

This topic contains the following sections:

  • Importing Members of the Target Class
  • Interactions Between Several Member Introductions and Imports
Importing Members of the Target Class

Importing a member into an aspect allows this aspect to invoke the member. An aspect can import methods, properties, or fields.

To import a member of the target type into the aspect class:

  1. Define a field into the aspect class, of the following type:

    Member Kind

    Field Type

    Method

    A typed Delegate, typically one of the variants of Action or FuncTResult. The delegate signature should exactly match the signature of the imported method.

    Property

    PropertyTValue, where the generic argument is the type of the property.

    Collection Indexer

    PropertyTValue, TIndex, where the first generic argument is the type of the property value and the second is the type of the index parameter. Indexers with more than one parameter are not supported.

    Event

    EventTDelegate, where the generic argument is the type of the event delegate (for instance EventHandler).

  2. Make this field public. The field cannot be static.

  3. Add the custom attribute ImportMemberAttribute to the field. As the constructor argument, pass the name of the member to be imported.

At runtime, the field is set to a delegate of the imported member. Properties and events are imported as set of delegates (PropertyTValueGet, PropertyTValueSet; EventTDelegateAdd, EventTDelegateRemove). These delegates can be invoked by the aspect as any delegate.

The property ImportMemberAttributeIsRequired determines what happens if the member could not be found in the target class or in its parent. By default, the field will simply have the null value if it could not be bound to a member. If the property IsRequired is set to true, a compile-time error will be emitted.

Interactions Between Several Member Introductions and Imports

Although member introduction and import may seem simple advices at first sight, things become more complex when the several advices try to introduce or import the same member. PostSharp handles these situations in a robust and predictable way. For this purpose, it is primordial to process classes, aspects and advices in a consistent order.

PostSharp enforces the following order:

  1. Base classes are processed first, derived classes after. Therefore, when a class is being processed, all parent classes have already been fully processed.

  2. Aspects targeting the same class are sorted (see Coping with Several Aspects on the Same Target) and executed.

  3. Advices of the same aspect are sorted and executed in the following order:

    1. Member imports which have the property ImportMemberAttributeOrder set to BeforeIntroductions.

    2. Member introductions.

    3. Members imports which have the property ImportMemberAttributeOrder set to AfterIntroductions (this is the default value).

Based on this well-defined order, the advices behave as follow:

Advice

Precondition

Behavior

ImportMemberAttribute

No member, or private member defined in a parent class.

Error if ImportMemberAttributeIsRequired is true, ignored otherwise (by default).

Non-virtual member defined.

Member imported.

Virtual member defined.

If ImportMemberAttributeOrder is BeforeIntroductions, the overridden member is imported. This similar to calling a method with the base prefix in C#. Otherwise (and by default), the member is dynamically resolved using the virtual table of the target object.

IntroduceMemberAttribute

No member, or private member defined in a parent class.

Member introduced.

Non-virtual member defined in a parent class

Ignored if the property IntroduceMemberAttributeOverrideAction is Ignore or OverrideOrIgnore, otherwise fail (by default).

Virtual member defined in a parent class

Introduce a new override method if the property IntroduceMemberAttributeOverrideAction is OverrideOrFail or OverrideOrIgnore, ignore if the property is Ignore, otherwise fail (by default).

Member defined in the target class (virtual or not)

Fail by default or if the property IntroduceMemberAttributeOverrideAction is Fail.

Otherwise:

  1. Move the previous method body to a new method so that the previous implementation can be imported by advices ImportMemberAttribute with the property Order set to BeforeIntroductions.

  2. Override the method with the imported method.

See Also

Reference

IntroduceMemberAttribute
ImportMemberAttribute

Other Resources

Coping with Several Aspects on the Same Target


Adding Aspects Dynamically

Additionally to providing advices, an aspect can provide other aspects dynamically using IAspectProvider. This allows aspect developers to address situations where it is not possible to add aspects declaratively (using custom attributes) to the source code; aspects can be provided on the basis of a complex analysis of the target assembly using System.Reflection, or by reading an XML file, for instance.

For details about IAspectProvider, see Adding Aspects Programmatically using IAspectProvider.

See Also

Reference

IAspectProvider

Other Resources

Adding Aspects Programmatically using IAspectProvider


Coping with Several Aspects on the Same Target

As the team learns aspect-oriented programming and starts adding more aspect to projects, chances raise that several aspects are added to the same element of code. This could be a major source of troubles if PostSharp did not provide a robust framework to detect and prevent conflicts between aspects:

  • Most aspects need to be ordered. For instance, an authorization aspect must be executed before a caching aspect.

  • Even if some aspects don't care to be ordered, it's good to have them applied in predictable order. Otherwise, some code that works today may be broken tomorrow -- just because aspects were applied in a different order.

  • Some aspects conflict; they cannot be together on the same aspect, or not in a given order. For instance, it does not make sense to persist an object using two different aspects: one would persist to the database, the other to the registry.

  • Some aspects require other aspects to be applied. For instance, an aspect changing the mouse pointer to an hourglass requires the method to execute asynchronously, otherwise the pointer shape will never be updated.

PostSharp addresses these issues by making it possible to add dependencies between aspects. The aspect dependency framework is implemented in the namespace PostSharp.Aspects.Dependencies.

Note Note

The aspect dependency framework is not related to the notion of dependency injection.

Aspect Dependency Custom Attributes

You can express dependencies of an aspect by annotating the aspect class with custom attributes derived from the type AspectDependencyAttribute. Several derived types are available; every type matches other aspects according to different criteria.

Types of Aspect Dependency Custom Attributes
Attribute Type | Description
AspectTypeDependencyAttribute | This custom attribute expresses a dependency with a well-known aspect class.
AspectRoleDependencyAttribute | This custom attribute expresses a dependency with any aspect classes enrolled in a given role. Its dual is ProvideAspectRoleAttribute: this custom attribute enrolls an aspect class into a role. A role is simply a string. Whenever possible, consider using one of the roles defined in the class StandardRoles.
AspectEffectDependencyAttribute | This custom attribute expresses a dependency with any aspect that has a specific effect on the source code or the control flow. Effects are represented as a string, whose valid values are listed in the type StandardEffects. Effects are provisioned by the aspect weaver on the basis of a rough analysis of what the aspect may do; aspect developers cannot assign new effects to aspects. However, they can waive effects by using the custom attribute WaiveAspectEffectAttribute. For instance, an aspect developer can specify that a trace attribute has no effect at all; this aspect will commute with any other aspect (see below).

All these custom attributes have similar structure and members. The first parameter of their constructor, of type AspectDependencyAction, determines the kind of dependency relationship added between the current aspect and the aspects matched by the custom attribute.

PostSharp supports the following kinds of relationships:

Kinds of Aspect Dependency Relationships
Action | Description
Order | The dependency expresses an order relationship. The second constructor of the custom attribute, of type AspectDependencyPosition (with values Before or After), must be specified. The custom attributes determine the position of the current aspect with respect to matched aspects.
Require | The dependency expresses a requirement. PostSharp will issue a compile-time error if the requirement is not satisfied for any target of the current aspect. The second constructor of the custom attribute, of type AspectDependencyPosition, is optional. If specified, an aspect matching the dependency should be present before or after the current aspect.
Conflict | The dependency expresses a conflict. PostSharp will issue a compile-time error if any aspect matching the dependency rule is present on any target of the current aspect. The second constructor of the custom attribute, of type AspectDependencyPosition, is optional. If specified, an error is issued only if a matching aspect is present before or after the current aspect.
Commute | The dependency specifies that the current aspect is commutable with any matching aspect. When aspects are commutable, PostSharp does not issue any warning if they are not strongly ordered.

Custom attribute types and values of the enumeration AspectDependencyAction are orthogonal; they can be freely combined.

Examples

Using role-based dependencies

The following code shows how three aspects can be ordered without having explicit knowledge of each other. Each aspect provides a different role, and defines dependencies with respect to other roles.

C#
Copy
[ProvideAspectRole( StandardRoles.Threading )]
[AspectRoleDependency(AspectDependencyAction.Order, AspectDependencyPosition.Before, "UI")]
public sealed class AsyncAttribute : MethodInterceptionAspect
{
  // Details skipped
}

[ProvideAspectRole( StandardRoles.ExceptionHandling )]
[AspectRoleDependency( AspectDependencyAction.Order, AspectDependencyPosition.After, StandardRoles.Threading )]
[AspectRoleDependency(AspectDependencyAction.Order, AspectDependencyPosition.After, "UI")]
public sealed class ExceptionDialogAttribute : OnExceptionAspect
{
  // Details skipped
}

[ProvideAspectRole("UI")]
public sealed class StatusTextAttribute : OnMethodBoundaryAspect
{
  // Details skipped
}

Using effect-based dependencies

The following code shows how to protect an authorization aspect to be executed after an aspect which may change the control flow and skip the execution of the method, such as a caching aspect. Then, it shows how the aspectAsyncAttribute can opt out from this effect, because the aspect developer knows that does aspect does not skip the execution of the method, but only defers it.

C#
Copy
[AspectEffectDependency( AspectDependencyAction.Conflict, AspectDependencyPosition.Before,
                         StandardEffects.ChangeControlFlow )]
public sealed class AuthorizationAttribute : OnMethodBoundaryAspect
{
  // Details skipped.
}

 [WaiveAspectEffect(StandardEffects.ChangeControlFlow)]
 public sealed class AsyncAttribute : MethodInterceptionAspect
 {
   // Details skipped
 }
Deferring Ordering to Aspect Users

By adding dependencies to the aspect class, the aspect developer specifies the order of execution of aspects in a fully static way. The same order is used for every element of code to which aspects apply. While this behavior is most of the time desirable, there may be situations where we want to defer ordering to users of our aspects.

Aspect users can influence the order of execution of an aspect by setting the aspect property AspectPriority, typically when using the aspect custom attribute (the same property is available in the configuration object as AspectConfigurationAspectPriority, see [aspect-configuration]).

Setting the AspectPriority results to an aspect in adding an ordering dependency between this aspect and all other aspects where the same property has been set. Therefore, aspect priorities complement, and do not replace, other ordering dependencies. The aspect developer may specify vital aspect dependencies (that is, under-specify aspect ordering), and let it to the aspect user to complete the ordering with priorities.

Caution note Caution

Do not confuse the property AspectPriority with AttributePriority. The latter determines an order in which several custom attributes of the same type are processed by the MulticastAttribute engine. The first determines in which order the aspects are executed at run time.

Adding Dependencies to Third-Party Aspects

If you are using aspects provided by several third-party vendors who don't know about each other, you may need to solve conflicts on your own.

You can do that by adding any custom attribute derived from AspectDependencyAttribute at assembly level, and use the property TargetType to specify to which aspect class the dependency applies.

Here is an example:

C#
Copy
[assembly: AspectTypeDependency( AspectDependencyAction.Order, AspectDependencyPosition.Before,
                                 typeof(Vendor1.TraceAspect), TargetType = typeof(Vendor2.ExceptionHandlingAspect) ]
See Also

Reference

PostSharp.Aspects.Dependencies


Ordering Advices

The section Coping with Several Aspects on the Same Target talks in terms of aspect dependencies and aspect ordering. Most of what has been said there is also valid to advices. When we talk of the order of execution of aspects, we actually mean the execution of advices ("aspects" themselves, stricto sensu, are never executed).

Dependencies defined at aspect level implicitly apply to all advices. When developing a composite aspect (see Developing Composite Aspects), it is possible to add dependencies directly to advice methods by annotating them with custom attributes of the namespace PostSharp.Aspects.Dependencies.

Note that all advices provided by an aspect are ordered in a single block. Suppose that a method is the target of advices Aspect1.MethodA, Aspect1.MethodB and Aspect2.MethodC. The next table shows valid and invalid orders:

Valid Orders | Invalid Orders
Aspect1.MethodA, Aspect1.MethodB, Aspect2.MethodC | Aspect1.MethodA, Aspect2.MethodC, Aspect1.MethodB
Aspect1.MethodB, Aspect1.MethodA, Aspect2.MethodC | Aspect1.MethodB, Aspect2.MethodC, Aspect1.MethodA
Aspect2.MethodC, Aspect1.MethodA, Aspect1.MethodB |
Aspect2.MethodC, Aspect1.MethodB, Aspect1.MethodA |
Ordering Advices of the Same Aspect

Advices of the same aspect can be used using any custom attribute derived from AspectDependencyAttribute.

Because advices of the same aspect instance are necessarily ordered in block, it is appropriate to specify dependencies between aspect classes extensively, and specify ordering of advices only in the scope of the current aspect instance. The most appropriate dependency custom attribute for this purpose is AdviceDependencyAttribute, which accepts the name of the advice method as a parameter.

See Also

Reference

AdviceDependencyAttribute


Understanding Aspect Serialization

As explained in section Understanding Aspect Lifetime and Scope, aspects are first instantiated at build time by the weaver, are then initialized by the CompileTimeInitialize method, and serialized and stored in the assembly as a managed resource. Aspects are then deserialized at run time, before being executed.

Because of the aspect life cycle, aspect classes must be made serializable as described in this section.

This topic contains the following sections:

  • Default serialization strategy
  • Fallback serialization strategy
  • Aspects without serialization
Default serialization strategy

Typically, aspects can be made serializable by adding a custom attribute to the class, which causes all fields of the class to be serialized. Fields that do not need to be serialized must be annotated with an opt-out custom attribute. PostSharp chooses the serialization strategy according to these custom attributes. The serialization strategy is implemented in classes derived from the abstract AspectSerializer class. The default serialization strategy is implemented in the PortableAspectSerializer class, that is backed by PortableFormatter.

This is how you can apply default serialization strategy to your aspect:

  • To make the class serializable, annotate the class with the [PSerializableAttribute] custom attribute.

  • To exclude the field from the serialization, annotate the field with the [PNonSerializedAttribute] custom attribute.

Fallback serialization strategy

In some cases, the default serialization strategy implemented by the PortableAspectSerializer class may not be appropriate for your aspects. For example, the data structures used in your classes may not be supported by the PortableFormatter implementation or you may need your code to be backward compatible with PostSharp 4.2 and earlier. In versions 4.2 and earlier the default serialization strategy was implemented in the BinaryAspectSerializer class, that was backed by BinaryFormatter. You can still use BinaryAspectSerializer as a fallback serialization strategy in PostSharp 4.3 and later.

To apply fallback serialization strategy to your aspects, use [SerializableAttribute] custom attribute instead of [PSerializableAttribute], and use [NonSerializedAttribute] custom attribute instead of [PNonSerializedAttribute].

Note Note

The BinaryAspectSerializer class is supported only in projects that target the .NET Framework with full trust.

Aspects without serialization

In some situations, serializing and deserializing the aspect may be a suboptimal solution. In case aspect field values are a pure function of constructor arguments and properties, it may be more efficient to emit code that instantiates these aspects at run time instead of serializing-deserializing them. This is the case, typically, if the aspect does not implement the CompileTimeInitialize method.

In this situation, it is better to use a different serializer: MsilAspectSerializer.

Note Note

MsilAspectSerializer is actually not a serializer. When you use this implementation instead of a real serializer, the aspect is not serialized, but the weaver generates MSIL instructions to build the aspect instance at run time, by calling the aspect class constructor and by setting its fields and properties.

You can specify which serializer should be used for a specific aspect class by setting the property AspectConfigurationSerializerType of the configuration of this aspect class or instance.

See section [aspect-configuration] for details.

The following code shows how to choose the serializer type for an OnMethodBoundaryAspect:

C#
Copy
[OnMethodBoundaryAspectConfiguration(SerializerType=typeof(MsilAspectSerializer))]
public sealed MyAspect : OnMethodBoundaryAspect
See Also

Reference

AspectSerializer
PortableAspectSerializer
MsilAspectSerializer
AspectConfigurationSerializerType

Other Resources

[aspect-configuration]


Customizing Aspect Appearance in Visual Studio

This chapter explains how to configure how your custom aspects appear in PostSharp Tools for Visual Studio. It contains the following topics:

Section | Description
Customizing Aspect Description in Tooltips | This topic describes how to change the description of custom aspects in PostSharp-generated tooltips in Visual Studio.
Estimating Code Savings | This topic explains how to give hints so that PostSharp can better estimate how many lines of code are saved thanks to your aspect.


Customizing Aspect Description in Tooltips

When you position the mouse cursor over a declaration that has been enhanced by an aspect, PostSharp Tools adds a description of the aspect to the Intellisense tooltip. The description that PostSharp generates by default is sometimes little helpful. To make the Intellisense description of your aspect more understandable for its users, you should override the default description.

Simple Aspects

Simple aspects are aspects built by deriving from a base class such as OnMethodBoundaryAspect and overriding virtual methods of the base class, such as OnEntry(MethodExecutionArgs). They are described in the section Developing Simple Aspects.

To set the description of a simple aspect, add the AspectDescriptionAttribute custom attribute to the aspect class.

This is illustrated in the following code snippet.

C#
Copy
[PSerializable]
[AspectDescription("Applies the exception handling policy")]
public sealed class ExceptionHandlerAttribute : OnExceptionAspect
{
    public override void OnException( MethodExecutionArgs eventArgs )
    {
        if ( !ExceptionHandler.OnException( eventArgs.Exception ) )
        {
            eventArgs.FlowBehavior = FlowBehavior.Continue;
        }
    }
}
Composite Aspects

Composite aspects are aspects where advices are not overridden from the base class, but are added using advice and pointcut custom attributes such as OnMethodEntryAdvice and MethodPointcut. Composite aspects are described in section Developing Composite Aspects. Unlike simple aspects, composite aspects can have several advices,

With composite aspects, you should add a description to every advice. You can do that by setting the Description property of the advice custom attribute.

The following code snippet illustrates how to set the description of the advice. This description will appear in the Intellisense tooltip of each property affected by this advice.

C#
Copy
 [OnLocationSetValueAdvice( Description="Persists the property to disk." ),
 MulticastPointcut( Targets = MulticastTargets.Property,
                    Attributes = MulticastAttributes.Instance | MulticastAttributes.NonAbstract)]
public void OnPropertySet( LocationInterceptionArgs args )
{
  // Details skipped.
}


Estimating Code Savings

During build, PostSharp attempts to estimate how many lines of handwritten code were avoided thanks to aspects. By default, PostSharp considers that 2 lines of code are saved every time an advice is applied to a target. This is of course a very rough estimate. You can add information to your aspects and advices to make the estimate more accurate.

Tip Tip

When adding code saving estimate, ask yourself the following question: how much code would an intelligent developer have written if she has to implement the same feature without PostSharp, using the best possible strategy? Do not assume that the strategy you took to implement the feature with an aspect would be the same as the strategy for handwritten code.

This topic contains the following sections:

  • Simple aspects
  • Composite aspects
  • Adding code saving hints programmatically
Simple aspects

Simple aspects are aspects built by deriving from a base class such as OnMethodBoundaryAspect and overriding virtual methods of the base class, such as OnEntry(MethodExecutionArgs). They are described in the section Developing Simple Aspects.

By default, PostSharp estimates that 2 lines of handwritten code are avoided for each advice method that you override, every time the aspect is applied to a target.

To override the default value, add the LinesOfCodeAvoidedAttribute custom attribute to the aspect class. The argument of the custom attribute constructor must be set to the number of lines of handwritten coded avoided every time the aspect is applied to a target.

The following code snippet shows how to specify that 4 lines of code are avoided every time the aspect is applied. If the aspect is applied to 100 methods, PostSharp will estimate that 400 lines of handwritten code have been avoided.

C#
Copy
[PSerializable]
[LinesOfCodeAvoided(4)]
public sealed class ExceptionHandlerAttribute : OnExceptionAspect
{
    public override void OnException( MethodExecutionArgs eventArgs )
    {
        if ( !ExceptionHandler.OnException( eventArgs.Exception ) )
        {
            eventArgs.FlowBehavior = FlowBehavior.Continue;
        }
    }
}
Composite aspects

Composite aspects are aspects where advices are not overridden from the base class, but are added using advice and pointcut custom attributes such as OnMethodEntryAdvice and MethodPointcut. Composite aspects are described in section Developing Composite Aspects. Unlike simple aspects, composite aspects can have several advices,

By default, PostSharp estimates that 2 lines of handwritten code are avoided for each advice, every time the advice is applied to a target. Some advices may have different default values. For instance, the IntroduceInterfaceAttribute advice shall count 2 lines of code per introduced interface method.

You can still use the aspect-level LinesOfCodeAvoidedAttribute custom attribute. It will increment the estimated number of avoided lines of code every time the aspect is applied to a target. However, to provide more relevant estimates, you need to provide code saving information at advice level.

To specify how many lines of handwritten code are avoided every time an advice is applied to a target, specify the Advice property of the advice custom attribute.

The following code snippet shows how to specify that 1 line of code is avoided every time the advice is applied. Suppose that the aspect is applied to 100 classes and each class has in average 5 instance non-abstract properties. In this situation, PostSharp will estimate that 500 lines of handwritten code have been avoided.

C#
Copy
 [OnLocationSetValueAdvice( LinesOfCodeAvoided = 1 ),
 MulticastPointcut( Targets = MulticastTargets.Property,
                    Attributes = MulticastAttributes.Instance | MulticastAttributes.NonAbstract)]
public void OnPropertySet( LocationInterceptionArgs args )
{
  // Details skipped.
}
Adding code saving hints programmatically

In the previous sections, we described how to add code saving hints declarively using custom attributes. Sometimes declarative estimations are not accurate enough. To learn how to add programmatic hints, see Pushing Information to PostSharp Tools Programmatically.

See Also

Reference

LinesOfCodeAvoidedAttribute
PostSharp.Aspects.AdvicesAdvice


Pushing Information to PostSharp Tools Programmatically

The IWeavingSymbolsService service allows you to push information from your aspect, at build time, to PostSharp Tools for Visual Studio.

This service can be used in the following scenarios:

  • Adding some text to the Intellisense tooltip of a declaration.

  • Adding some code saving information.

  • Add some annotation that means that PostSharp Tools should consider that a declaration has been decorated with a custom attribute. This annotation is then taken into account by the analytic engine that powers the real-time quick actions and diagnostics of PostSharp Tools. For instance, the FieldRule facility uses this feature.

To get an instance of this service, use the GetServiceT(Boolean) method from PostSharpEnvironment.CurrentProject.GetService.


Consuming Dependencies from an Aspect

Aspects, as other components, may have dependencies to other application services. Aspects may be bound to the abstract interface to this service, and may need to resolve the dependency at run time.

However, two reasons prevent us from the following approaches that are usual with dependency injection containers:

  • Aspects are instantiated at build time, and dependency-injection containers only exist at run-time.

  • Aspects typically have a static scope. Unless they implement the IInstanceScopedAspect, aspect instances are stored in static fields, even when applied to instance members.

These characteristics are not an obstacle to using service containers, but different patterns must be followed.

This section presents several ways to consume dependencies from an aspect:

  • Using a Global Composition Container

  • Using a Global Service Locator

  • Using Dynamic Dependency Resolution

  • Using Contextual Dependency Resolution

  • Importing Dependencies from the Target Object


Using a Global Composition Container

Although the aspect cannot be instantiated by the dependency injection container, it is possible to initialize the aspect from an ambient container at run time. An ambient container is one that is exposed as a static member and that is global to the whole application.

Dependency injection containers typically offer methods to initialize objects that have been instantiated externally. For instance, the Managed Extensibility Framework offers the SatisfyImportsOnce(ComposablePart) method.

The dependency injection method can be invoked from the RuntimeInitialize(MethodBase) method.

Note Note

User code has no control over the time when and the thread on which an aspect is initialized. Therefore, using ThreadStaticAttribute to make the container local to the current thread is not a reliable approach.

Important note Important

The service container must be initialized before the execution of any class that is enhanced by the aspect. It means that it is not possible to use the aspect on test classes themselves. To relax this constraint, it is possible to initialize the dependency lazily, when the first advice is hit.

Example: testable logging aspect with a global MEF service container

The following code snippet shows a logging aspect and how it could be used in production code:

C#
Copy
using System;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Hosting;
using System.ComponentModel.Composition.Primitives;
using System.Reflection;
using PostSharp.Aspects;
using PostSharp.Extensibility;
using PostSharp.Serialization;

namespace DependencyResolution.GlobalServiceContainer
{
    public interface ILogger
    {
        void Log(string message);
    }

    public static class AspectServiceInjector
    {
        private static CompositionContainer container;

        public static void Initialize(ComposablePartCatalog catalog)
        {
            container = new CompositionContainer(catalog);
        }

        public static void BuildObject(object o)
        {
            if (container == null)
                throw new InvalidOperationException();

            container.SatisfyImportsOnce(o);
        }
    }

    [PSerializable]
    public class LogAspect : OnMethodBoundaryAspect
    {
        [Import] private ILogger logger;

        public override void RuntimeInitialize(MethodBase method)
        {
            AspectServiceInjector.BuildObject(this);
        }

        public override void OnEntry(MethodExecutionArgs args)
        {
            logger.Log("OnEntry");
        }
    }

    internal class Program
    {
        private static void Main(string[] args)
        {
            AspectServiceInjector.Initialize(new TypeCatalog(typeof (ConsoleLogger)));

            // The static constructor of LogAspect is called before the static constructor of the type
            // containing target methods. This is why we cannot use the aspect in the Program class.
            Foo.LoggedMethod();
        }
    }

    internal class Foo
    {
        [LogAspect]
        public static void LoggedMethod()
        {
            Console.WriteLine("Hello, world.");
        }
    }

    [Export(typeof (ILogger))]
    internal class ConsoleLogger : ILogger
    {
        public void Log(string message)
        {
            Console.WriteLine(message);
        }
    }
}

The following code snippet shows how the logging aspect can be tested:

C#
Copy
using System;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Hosting;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace DependencyResolution.GlobalServiceContainer.Test
{
    [TestClass]
    public class TestLogAspect
    {
        static TestLogAspect()
        {
            AspectServiceInjector.Initialize(new TypeCatalog(typeof (TestLogger)));
        }

        [TestMethod]
        public void TestMethod()
        {
            TestLogger.Clear();
            new TargetClass().TargetMethod();
            Assert.AreEqual("OnEntry" + Environment.NewLine, TestLogger.GetLog());
        }

        private class TargetClass
        {
            [LogAspect]
            public void TargetMethod()
            {
            }
        }
    }

    [Export(typeof (ILogger))]
    internal class TestLogger : ILogger
    {
        public static readonly StringBuilder stringBuilder = new StringBuilder();

        public void Log(string message)
        {
            stringBuilder.AppendLine(message);
        }

        public static string GetLog()
        {
            return stringBuilder.ToString();
        }

        public static void Clear()
        {
            stringBuilder.Clear();
        }
    }
}


Using a Global Service Locator

If all aspect instances are using the same global dependency injection container, it is likely that dependencies of all instances will resolve to the same service implementation. Therefore, storing dependencies in an instance field may be a waste of memory, especially for aspects that are applied to a very high number of code elements.

Alternatively, dependencies can be stored in static fields and initialized in the aspect static constructor.

Tip Tip

Use the PostSharpEnvironmentIsPostSharpRunning property to make sure that this part of the static constructor is executed at run time only, when PostSharp is not running.

In this case, dependency injection method such as SatisfyImportsOnce(ComposablePart) cannot be used. Instead, the container must be used as a service locator. For instance, MEF exposes the method ExportProviderGetExport.

Important note Important

The service locator must be initialized before the execution of any class that is enhanced by the aspect. It means that it is not possible to use the aspect on the entry-point class (Program or App, typically). To relax this constraint, it is possible to initialize the dependency on demand, for instance using the LazyT construct.

Example: testable aspect with a global MEF service locator

The following code snippet shows a logging aspect and how it could be used in production code:

C#
Copy
using System;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Hosting;
using System.ComponentModel.Composition.Primitives;
using PostSharp.Aspects;
using PostSharp.Extensibility;
using PostSharp.Serialization;

namespace DependencyResolution.GlobalServiceLocator
{
    public interface ILogger
    {
        void Log(string message);
    }

    public static class AspectServiceLocator
    {
        private static CompositionContainer container;

        public static void Initialize(ComposablePartCatalog catalog)
        {
            container = new CompositionContainer(catalog);
        }

        public static Lazy<T> GetService<T>() where T : class
        {
            return new Lazy<T>(GetServiceImpl<T>);
        }

        private static T GetServiceImpl<T>()
        {
            if (container == null)
                throw new InvalidOperationException();

            return container.GetExport<T>().Value;
        }
    }

    [PSerializable]
    public class LogAspect : OnMethodBoundaryAspect
    {
        private static readonly Lazy<ILogger> logger;

        static LogAspect()
        {
            if (!PostSharpEnvironment.IsPostSharpRunning)
            {
                logger = AspectServiceLocator.GetService<ILogger>();
            }
        }

        public override void OnEntry(MethodExecutionArgs args)
        {
            logger.Value.Log("OnEntry");
        }
    }

    internal class Program
    {
        private static void Main(string[] args)
        {
            AspectServiceLocator.Initialize(new TypeCatalog(typeof (ConsoleLogger)));

            LoggedMethod();
        }

        [LogAspect]
        public static void LoggedMethod()
        {
            Console.WriteLine("Hello, world.");
        }
    }

    [Export(typeof (ILogger))]
    internal class ConsoleLogger : ILogger
    {
        public void Log(string message)
        {
            Console.WriteLine(message);
        }
    }
}

The following code snippet shows how the logging aspect can be tested:

C#
Copy
using System;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Hosting;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace DependencyResolution.GlobalServiceLocator.Test
{
    [TestClass]
    public class TestLogAspect
    {
        static TestLogAspect()
        {
            AspectServiceLocator.Initialize(new TypeCatalog(typeof (TestLogger)));
        }

        [TestMethod]
        public void TestMethod()
        {
            TestLogger.Clear();
            TargetMethod();
            Assert.AreEqual("OnEntry" + Environment.NewLine, TestLogger.GetLog());
        }

        [LogAspect]
        private void TargetMethod()
        {
        }
    }

    [Export(typeof (ILogger))]
    internal class TestLogger : ILogger
    {
        public static readonly StringBuilder stringBuilder = new StringBuilder();

        public void Log(string message)
        {
            stringBuilder.AppendLine(message);
        }

        public static string GetLog()
        {
            return stringBuilder.ToString();
        }

        public static void Clear()
        {
            stringBuilder.Clear();
        }
    }
}


Using Dynamic Dependency Resolution

Both previous approaches have a static dependency resolution strategy: it cannot be changed over time. Therefore, these strategies could be unsuitable in cases where several tests need different configurations of the dependency container.

A possible solution is to resolve dependencies dynamically each time they are needed, and not only at aspect initialization. Although this solution is ideal for the sake of testing, it may be too inefficient for production. Therefore, the solution would still need to provide dependency caching for production mode. Caching would neutralize the dynamic characteristics of dependency resolution.

This solution would be based on the following elements:

  1. The service locator can be initialized in two modes: production (the resolution strategy is immutable) and testing (the resolution strategy can be modified).

  2. The service locator returns a delegate (Func<T>, where T is the dependency type), instead of the dependency itself (T or Lazy<T>).

  3. The aspect calls the service locator during aspect initialization and stores the delegate.

  4. The aspect calls the delegate at run time.

Example: testable logging aspect with a global MEF service container with dynamic resolution

The following code snippet shows a logging aspect and how it could be used in production code:

C#
Copy
using System;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Hosting;
using System.ComponentModel.Composition.Primitives;
using PostSharp.Aspects;
using PostSharp.Extensibility;
using PostSharp.Serialization;

namespace DependencyResolution.Dynamic
{
    public interface ILogger
    {
        void Log(string message);
    }

    public static class AspectServiceLocator
    {
        private static CompositionContainer container;
        private static bool isCacheable;

        public static void Initialize(ComposablePartCatalog catalog, bool isCacheable)
        {
            if (AspectServiceLocator.isCacheable && container != null)
                throw new InvalidOperationException();

            container = new CompositionContainer(catalog);
            AspectServiceLocator.isCacheable = isCacheable;
        }

        public static Func<T> GetService<T>() where T : class
        {
            if (isCacheable)
            {
                return () => new Lazy<T>(GetServiceImpl<T>).Value;
            }
            else
            {
                return GetServiceImpl<T>;
            }
        }

        private static T GetServiceImpl<T>()
        {
            if (container == null)
                throw new InvalidOperationException();

            return container.GetExport<T>().Value;
        }
    }

    [PSerializable]
    public class LogAspect : OnMethodBoundaryAspect
    {
        private static readonly Func<ILogger> logger;

        static LogAspect()
        {
            if (!PostSharpEnvironment.IsPostSharpRunning)
            {
                logger = AspectServiceLocator.GetService<ILogger>();
            }
        }

        public override void OnEntry(MethodExecutionArgs args)
        {
            logger().Log("OnEntry");
        }
    }

    internal class Program
    {
        private static void Main(string[] args)
        {
            AspectServiceLocator.Initialize(new TypeCatalog(typeof (ConsoleLogger)), true);

            LoggedMethod();
        }

        [LogAspect]
        public static void LoggedMethod()
        {
            Console.WriteLine("Hello, world.");
        }
    }

    [Export(typeof (ILogger))]
    internal class ConsoleLogger : ILogger
    {
        public void Log(string message)
        {
            Console.WriteLine(message);
        }
    }
}

The following code snippet shows how the logging aspect can be tested:

C#
Copy
using System;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Hosting;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace DependencyResolution.Dynamic.Test
{
    [TestClass]
    public class TestLogAspect
    {
        [TestMethod]
        public void TestMethod()
        {
            // The ServiceLocator can be initialized for each test.
            AspectServiceLocator.Initialize(new TypeCatalog(typeof (TestLogger)), false);

            TestLogger.Clear();
            TargetMethod();
            Assert.AreEqual("OnEntry" + Environment.NewLine, TestLogger.GetLog());
        }

        [LogAspect]
        private void TargetMethod()
        {
        }
    }

    [Export(typeof (ILogger))]
    internal class TestLogger : ILogger
    {
        public static readonly StringBuilder stringBuilder = new StringBuilder();

        public void Log(string message)
        {
            stringBuilder.AppendLine(message);
        }

        public static string GetLog()
        {
            return stringBuilder.ToString();
        }

        public static void Clear()
        {
            stringBuilder.Clear();
        }
    }
}


Using Contextual Dependency Resolution

The dependency resolution strategy does not necessarily need to resolve to the same service implementation for all occurrences of the dependency. It is possible to design a strategy that depends on the context. For instance, the service locator could accept the aspect type and the target element of code as parameters. Test code could configure the service locator to resolve dependencies to specific implementations for a given context.

Evaluating context-sensitive rules may be CPU-intensive, but it needs to be done only during testing. In production mode, dependency resolution can be delegated to a global service catalog.

Example: testable logging aspect with contextual dependency resolution

The following code snippet shows a logging aspect and how it could be used in production code:

C#
Copy
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Hosting;
using System.ComponentModel.Composition.Primitives;
using System.Reflection;
using PostSharp.Aspects;
using PostSharp.Extensibility;
using PostSharp.Serialization;

namespace DependencyResolution.Contextual
{
    public interface ILogger
    {
        void Log(string message);
    }

    public static class AspectServiceLocator
    {
        private static CompositionContainer container;
        private static HashSet<object> rules = new HashSet<object>();

        public static void Initialize(ComposablePartCatalog catalog)
        {
            container = new CompositionContainer(catalog);
        }

        public static Lazy<T> GetService<T>(Type aspectType, MemberInfo targetElement) where T : class
        {
            return new Lazy<T>(() => GetServiceImpl<T>(aspectType, targetElement));
        }

        private static T GetServiceImpl<T>(Type aspectType, MemberInfo targetElement) where T : class
        {
            // The rule implementation is naive but this is for testing purpose only.
            foreach (object rule in rules)
            {
                DependencyRule<T> typedRule = rule as DependencyRule<T>;
                if (typedRule == null) continue;

                T service = typedRule.Rule(aspectType, targetElement);
                if (service != null) return service;
            }

            if (container == null)
                throw new InvalidOperationException();

            // Fallback to the container, which should be the default and production behavior.
            return container.GetExport<T>().Value;
        }

        public static IDisposable AddRule<T>(Func<Type, MemberInfo, T> rule)
        {
            DependencyRule<T> dependencyRule = new DependencyRule<T>(rule);
            rules.Add(dependencyRule);
            return dependencyRule;
        }

        private class DependencyRule<T> : IDisposable
        {
            public DependencyRule(Func<Type, MemberInfo, T> rule)
            {
                this.Rule = rule;
            }

            public Func<Type, MemberInfo, T> Rule { get; private set; }

            public void Dispose()
            {
                rules.Remove(this);
            }
        }
    }

    [PSerializable]
    public class LogAspect : OnMethodBoundaryAspect
    {
        private Lazy<ILogger> logger;

        public override void RuntimeInitialize(MethodBase method)
        {
            logger = AspectServiceLocator.GetService<ILogger>(this.GetType(), method);
        }

        public override void OnEntry(MethodExecutionArgs args)
        {
            logger.Value.Log("OnEntry");
        }
    }

    internal class Program
    {
        private static void Main(string[] args)
        {
            AspectServiceLocator.Initialize(new TypeCatalog(typeof (ConsoleLogger)));

            LoggedMethod();
        }

        [LogAspect]
        public static void LoggedMethod()
        {
            Console.WriteLine("Hello, world.");
        }
    }

    [Export(typeof (ILogger))]
    internal class ConsoleLogger : ILogger
    {
        public void Log(string message)
        {
            Console.WriteLine(message);
        }
    }
}

The following code snippet shows how the logging aspect can be tested:

C#
Copy
using System;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace DependencyResolution.Contextual.Test
{
    [TestClass]
    public class TestLogAspect
    {
        [TestMethod]
        public void TestMethod()
        {
            // The ServiceLocator can be initialized for each test.
            using (
                AspectServiceLocator.AddRule<ILogger>(
                    (type, member) =>
                    type == typeof (LogAspect) && member.Name == "TargetMethod" ? new TestLogger() : null)
                )
            {
                TestLogger.Clear();
                TargetMethod();
                Assert.AreEqual("OnEntry" + Environment.NewLine, TestLogger.GetLog());
            }
        }

        [LogAspect]
        public void TargetMethod()
        {
        }
    }

    internal class TestLogger : ILogger
    {
        public static readonly StringBuilder stringBuilder = new StringBuilder();

        public void Log(string message)
        {
            stringBuilder.AppendLine(message);
        }

        public static string GetLog()
        {
            return stringBuilder.ToString();
        }

        public static void Clear()
        {
            stringBuilder.Clear();
        }
    }
}


Importing Dependencies from the Target Object

The principal reason why aspects are believed to be difficult to test is that they are statically scoped by default, i.e. aspect objects are stored in static fields. However, any aspect can be made instance-scoped if it implements the IInstanceScopedAspect interface. See Understanding Aspect Lifetime and Scope for more information about aspect scopes.

Instance-scoped aspects can consume dependencies from the objects to which they are applied. They can also add dependencies to the target objects.

For instance, an aspect can consume a service ILogger using the following procedure:

To consume a service from an instance-scoped aspect:

  1. Add a public property of name Logger and type ILogger to the aspect and add the IntroduceMemberAttribute custom attribute. This will cause the aspect to add a property to the target class. Use the parameter MemberOverrideAction.Ignore to ignore the property if it already exists in the target type of if it has been added by another aspect.

  2. Add two custom attributes ImportAttribute and CopyCustomAttributesAttribute to the Logger property. This will cause the aspect to add the [Import] custom attribute to the Logger property added to the target class.

  3. Add a public field of name LoggerProperty and type Property<ILogger> to the aspect class and add the ImportMemberAttribute custom attribute to this field, with "Logger" as the parameter value. This will allow the aspect to read the Logger property even if it has been defined from outside the aspect.

  4. The aspect can now consume the dependency by calling this.LoggerProperty.Get().

The procedure is illustrated in the next example.

Example: testable logging aspect that consumes the dependency from the target object

The following code snippet shows a logging aspect and how it could be used in production code:

C#
Copy
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Hosting;
using System.ComponentModel.Composition.Primitives;
using System.ComponentModel.Design;
using System.Reflection;
using PostSharp.Aspects;
using PostSharp.Aspects.Advices;
using PostSharp.Extensibility;
using PostSharp.Reflection;
using PostSharp.Serialization;

namespace DependencyResolution.InstanceScoped
{
    public interface ILogger
    {
        void Log(string message);
    }

    [PSerializable]
    public class LogAspect : OnMethodBoundaryAspect, IInstanceScopedAspect
    {
        [IntroduceMember(Visibility = Visibility.Family, OverrideAction = MemberOverrideAction.Ignore)]
        [CopyCustomAttributes(typeof (ImportAttribute))]
        [Import(typeof(ILogger))]
        public ILogger Logger { get; set; }

        [ImportMember("Logger", IsRequired = true)]
        public Property<ILogger> LoggerProperty;

        public override void OnEntry(MethodExecutionArgs args)
        {
            this.LoggerProperty.Get().Log("OnEntry");
        }

        object IInstanceScopedAspect.CreateInstance(AdviceArgs adviceArgs)
        {
            return this.MemberwiseClone();
        }

        void IInstanceScopedAspect.RuntimeInitializeInstance()
        {
        }
    }

    [Export(typeof (MyServiceImpl))]
    internal class MyServiceImpl
    {
        [LogAspect]
        public void LoggedMethod()
        {
            Console.WriteLine("Hello, world.");
        }
    }

    internal class Program
    {
        private static void Main(string[] args)
        {
            AssemblyCatalog catalog = new AssemblyCatalog(typeof (Program).Assembly);
            CompositionContainer container = new CompositionContainer(catalog);
            MyServiceImpl service = container.GetExport<MyServiceImpl>().Value;
            service.LoggedMethod();
        }
    }

    [Export(typeof (ILogger))]
    internal class ConsoleLogger : ILogger
    {
        public void Log(string message)
        {
            Console.WriteLine(message);
        }
    }
}

The following code snippet shows how the logging aspect can be tested:

C#
Copy
using System;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Hosting;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace DependencyResolution.InstanceScoped.Test
{
    [TestClass]
    public class TestLogAspect
    {
        [TestMethod]
        public void TestMethod()
        {
            TypeCatalog catalog = new TypeCatalog(typeof (TestLogger), typeof (TestImpl));
            CompositionContainer container = new CompositionContainer(catalog);
            TestImpl service = container.GetExport<TestImpl>().Value;
            TestLogger.Clear();
            service.TargetMethod();
            Assert.AreEqual("OnEntry" + Environment.NewLine, TestLogger.GetLog());
        }

        [Export(typeof (TestImpl))]
        private class TestImpl
        {
            [LogAspect]
            public void TargetMethod()
            {
            }
        }
    }

    [Export(typeof (ILogger))]
    internal class TestLogger : ILogger
    {
        public static readonly StringBuilder stringBuilder = new StringBuilder();

        public void Log(string message)
        {
            stringBuilder.AppendLine(message);
        }

        public static string GetLog()
        {
            return stringBuilder.ToString();
        }

        public static void Clear()
        {
            stringBuilder.Clear();
        }
    }
}


Validating Architecture

Besides aspect-oriented programming, you can use PostSharp to validate your source code against architecture and design rules named constraints. Constraints are piece of codes that validate the code against specific rules at build time.

PostSharp provides ready-made constraints for the following scenarios:

  • Restricting Interface Implementation

  • Controlling Component Visibility Beyond Private and Internal

Additionally, you can develop custom constraints to enforce your own design rules. For details, see Developing Custom Architectural Constraints.


Restricting Interface Implementation

Under some circumstances, you may want to restrict users of an API to implement an interface. You may want to allow them to consume the interface but not to implement it in their own classes, so that, later, you can add new members to this interface without breaking the user's code. If retaining the interface as a public artifact is required, the programming language does not give you any option to enforce the desired restriction. Enter the InternalImplementAttribute from PostSharp.

This topic contains the following sections:

  • Adding the constraint to the interface
  • Emitting an error instead of a warning
  • Ignoring warnings
Adding the constraint to the interface

To restrict implementation of publicly declared interfaces you simply need to add [InternalImplementAttribute] to that interface.

Note Note

This procedure requires PostSharp Tools for Visual Studio to be installed on your machine. You can however achieve the same results by editing the code and the project manually.

  1. Place the caret over the interface that you want to add the attribute select the "Add architectural constraint...".

    Internal Implement 1

  2. Select "Prevent interface implementation in a different assembly" and select Next.

    Internal Implement 2

  3. Verify that you will be adding the InternalImplementAttribute attribute to the correct piece of code.

    Internal Implement 3

  4. Once the download, installation and configuration of PostSharp have finished you can close the wizard and look at the changes that were made to your codebase.

    Internal Implement 4

  5. You'll notice that the only thing that has changed in the code is the addition of the [InternalImplementAttribute] attribute.

    C#
    Copy
    [InternalImplement]
public interface ICustomerRepository
{
    IEnumerable<Customer> FetchAll();
}

Once that is done, implementing the interface that was decorated with the InternalImplementAttribute from another assembly will create a compile time warning.

Internal Implement Warning
Note Note

To perform this architectural validation the project that is trying to implement the interface will need to be processed by PostSharp.

Emitting an error instead of a warning

If a warning isn't strong enough for your environment you can change the output to a compile time error by setting the InternalImplementAttribute to have a Severity type of Error.

C#
Copy
[InternalImplement(Severity = SeverityType.Error)]
public interface ICustomerRepository
{
    IEnumerable<Customer> FetchAll();
}

Now any reference to the decorated interface from another assembly will generate an error and fail the compilation of your project.

Internal Implement Error
Ignoring warnings

If you are trying to implement a constrained interface in a separate assembly and you want to override the warning being generated there is a solution available for you. The IgnoreWarningAttribute attribute can be applied to stop warnings from being generated.

Note Note

The IgnoreWarningAttribute attribute will only suppress warnings. If you have escalated the warnings to be errors, those errors will still be generated even if the IgnoreWarningAttribute attribute is present.

To suppress warnings all that you need to do is add the IgnoreWarningAttribute attribute to the offending piece of code. In this example, we would suppress the warning being generated by adding the attribute to the class that is implementing the constrained interface. Once we have done that, the warning generated for that specific implementation would be suppressed. All other locations that are implementing this interface will continue to generate their warnings.

Note Note

You may wonder where the identifier AR0101 comes from. IgnoreWarningAttribute actually works with any PostSharp warning and not just this one. Any build error, whether from MSBuild, C# or PostSharp, has an identifier. To see error identifiers in Visual Studio, open the View menu and click on the Output item, select "Show output from: Build". You will see warnings including their identifiers.

C#
Copy
[IgnoreWarning("AR0101")]
public class PreferredCustomerRepository : ICustomerRepository
{
    public IEnumerable<Customer> FetchAll()
    {
        return null;
    }
}
See Also

Reference

InternalImplementAttribute
IgnoreWarningAttribute

Other Resources

Controlling Component Visibility Beyond Private and Internal


Controlling Component Visibility Beyond Private and Internal

When you are working on applications it's common to run across situations where you want to restrict access to a component you have written. Usually, you control this access using the private and/or internal keywords when defining the component. A class marked as internal can be accessed by any other class in the same assembly, but that may not be the level of restriction needed within the codebase. Access to a private class is restricted to those components that are inside the same class or struct that contains the private class, which prevents any other classes from accessing it. In one situation we are restricting access to the component to only the class or struct that contains it. In the other situation, we are allowing access to the component from any other component that is in the same assembly. What if needed something in between?

PostSharp offers the ability to define component access rules that exist between the scope of the internal and private keywords. This gives us the opportunity to restrict access to a component only from other components in the same namespace. We can also restrict access to a select few other components.

As an example let's look at a data access related class. As a precaution against developer's circumventing our data access structure we want to limit access to this repository class.

This topic contains the following sections:

  • Restricting access to specific namespaces
  • Restricting access to specific types
  • Controlling component visibility outside of the containing assembly
  • Emitting errors instead of warnings
  • Ignoring warnings
Restricting access to specific namespaces
Note Note

This procedure requires PostSharp Tools for Visual Studio to be installed on your machine. You can however achieve the same results by editing the code and the project manually.

To limit access of a class only to other classes within the validation namespace:

  1. Put the caret on the internal class that should have restricted access. Select "Add architectural constraint..." from the smart tag options.

    Component Internal 1

  2. Select "Prohibit use outside of given types" from the list of options.

    Component Internal 2

  3. Verify that you will be adding the ComponentInternalAttribute attribute to the correct piece of code.

    Component Internal 3

  4. Once the download, installation and configuration of PostSharp have finished you can close the wizard and look at the changes that were made to your codebase.

    Component Internal 4

  5. You'll notice that the only thing that has changed in the code is the addition of the [ComponentInternalAttribute] attribute.

    C#
    Copy
     namespace Sharpcrafters.Crm.Console.Repositories
{
    public class InvoiceRepository
    {
            [ComponentInternal]
            internal IEnumerable<Invoice> FetchAllForCustomer(Guid id)
            {
                //dostuff
                return null;
            }
     }
}

  6. The [ComponentInternalAttribute] attribute is templated to accept a string for the namespace that should be able to access this method. There are two options that you could use. The first is to pass the attribute an array of typeof(...) values that represents the types that can access this method. The second option is to pass in an array of strings that contain the namespaces of the code that should be able to access this method. For our example, replace the typeof(TODO) with a string for the validation namespace.

  7. If you try to access this component from a namespace that hasn't been granted access you will see a compile time warning in the Output window.

    C#
    Copy
     namespace Sharpcrafters.Crm.Console.Services
{
    public class InvoiceServices
    {
          public IEnumerable<InvoiceForList> FetchAllInvoicesForCustomer(Guid id)
          {
              var invoiceRepository = new InvoiceRepository();

              var allInvoices = invoiceRepository.FetchAllForCustomer(id);
              return
                  allInvoices.Where(x => !x.PaidInFull).Select(
                      x => new InvoiceForList
                          {
                              PurchaseDate = x.PurchaseDate,
                              ShipDate = x.ShipDate,
                              TotalAmount = x.Total
                           });
          }
      }
}
    Component Internal Warning
    Note Note

    If you are trying to access the component from a namespace that is in a different project you will need PostSharp to process that project for the validation to occur.

Restricting access to specific types

Under some circumstances, namespace level restrictions may not be tight enough for your needs. In that situation, you have the ability to apply this constraint at a type level.

  1. To restrict access at a component type level you need to explicitly define which component types will have access. This is done by passing types into the constructor of the ComponentInternalAttribute attribute's constructor. The construct accepts an array of Type which allows you to define many different component types that should be granted access.

    C#
    Copy
     public class InvoiceRepository
{
    [ComponentInternal(typeof(Sharpcrafters.Crm.Console.Services.InvoiceServices))]
    internal IEnumerable<Invoice> FetchAllForCustomer(Guid id)
    {
        //dostuff
        return null;
    }
}

  2. Now if you try to access this component from a type that hasn't been granted access you will see a compile time warning in the Output window.

    C#
    Copy
     public class CustomerServices
{
    public IEnumerable<Customer> FetchAll()
    {
        var invoiceRepository = new InvoiceRepository();
        var allInvoices = invoiceRepository.FetchAllForCustomer(Guid.NewGuid());
    }
}
    Component Internal Warning
Controlling component visibility outside of the containing assembly

Because of framework limitations or automated testing requirements you sometimes need to declare components as public so that you can perform the desired tasks or testing. For some of those components, you probably don't want external applications accessing them. For instance, WPF controls need a default constructor for use in the designer, but sometimes you want another constructor to be used at run time, so you want to prevent the default constructor to be used from code.

PostSharp offers you the ability to decorate a publically declared component in such a way that it is not accessible by applications that reference its assembly. All you need to do is apply the InternalAttribute attribute.

  1. Let's mark the Customer class so that it can only be accessed from the assembly it resides in.

    C#
    Copy
     namespace Sharpcrafters.Crm.Core
{
    public class Customer
    {
        public int Id { get; set; }
        public string Name { get; set; }
    }
}

  2. Place the caret on the publically declared component that you want to restrict external access to and expand the smart tag. Select "Add architectural constraint" This procedure requires PostSharp Tools for Visual Studio to be installed on your machine. You can however achieve the same results by editing the code and the project manually..

  3. When prompted to select a constraint, choose to "Prohibit use outside of the project".

  4. The summary page gives you the opportunity to review the selections that you have made. If you notice that the configuration is not what you wanted you can click the Previous button and adjust your selections. If the configuration meets your needs click Next. In this demo, you will see that the [InternalAttribute] attribute is being added to the Customer class.

  5. Once the download, installation and configuration of PostSharp have finished you can close the wizard and look at the changes that were made to your codebase.

  6. You'll notice that the only thing that has changed in the code is the addition of the [InternalAttribute] attribute.

    C#
    Copy
     namespace Sharpcrafters.Crm.Core
{
    [Internal]
    public class Customer
    {
        public int Id { get; set; }
        public string Name { get; set; }
    }
}

  7. When you attempt to make use of that public component in a different assembly a compile time warning will appear in the Output window.

    C#
    Copy
     namespace Sharpcrafters.Crm.Console.Repositories
{
    public class CustomerRepository:ICustomerRepository
    {
        public IEnumerable<Customer> FetchAll()
        {
            return new List<Customer>{new Customer{Id=1,Name="Joe Johnson"}};
        }
    }
}
    Note Note

    The assembly that is attempting to use the public component will need to reference PostSharp for this validation to occur.

Emitting errors instead of warnings

By default, any situation that breaks the access rules defined by the application of the ComponentInternalAttribute or InternalAttribute attribute will generate a compile time warning. It's possible to escalate this warning to the error level.

  1. Changing the output warning to an error requires you to set the Severity level.

    C#
    Copy
    [ComponentInternal(typeof (InvoiceServices), Severity = SeverityType.Error)]
public IEnumerable<Invoice> FetchAllForCustomer(Guid id)
{
    //dostuff
    return null;
}

  2. Now when you try to access the component when access hasn't been granted the Output window will display an error message.

    Component Internal Error
Ignoring warnings

There may be specific situations where you want to suppress the warning message that is being generated at compile time. In those cases, you can apply the IgnoreWarningAttribute attribute to the locations where you want to allow access to the component.

Note Note

The IgnoreWarningAttribute attribute will only suppress warnings. If you have escalated the warnings to be errors, those errors will still be generated even if the IgnoreWarningAttribute attribute is present.

If you wanted to allow access to the constrained component in a specific method you could add the IgnoreWarningAttribute attribute to that method.

C#
Copy
 public class CustomerServices
{
    [IgnoreWarning("AR0102")]
    public IEnumerable<Customer> FetchAll()
    {
        var invoiceRepository = new InvoiceRepository();
        var allInvoices = invoiceRepository.FetchAllForCustomer(Guid.NewGuid());
    }
}
Note Note

AR0102 is the identifier of the warning emitted by ComponentInternalAttribute. To ignore warnings emitted by Internal, use the identifier AR0104.

You may wonder where these identifiers come from. IgnoreWarningAttribute actually works with any PostSharp warning and not just this one. Any build error, whether from MSBuild, C# or PostSharp, has an identifier. To see error identifiers in Visual Studio, open the View menu and click on the Output item, select "Show output from: Build". You will see warnings including their identifiers.

If you wanted to allow access in an entire class you could add the IgnoreWarningAttribute attribute at the class level. Any access to the constrained component within the class would have its warning suppressed.

C#
Copy
[IgnoreWarning("AR0102")]
public class CustomerServices
{
    public IEnumerable<Customer> FetchAll()
    {
        var invoiceRepository = new InvoiceRepository();
        var allInvoices = invoiceRepository.FetchAllForCustomer(Guid.NewGuid());
    }
}
See Also

Reference

IgnoreWarningAttribute
ComponentInternalAttribute
InternalAttribute

Other Resources

Developing Custom Architectural Constraints


Developing Custom Architectural Constraints

When you are creating your applications it is common to adopt custom design patterns that must be respected across all modules. Custom design patterns have the same benefits as standard ones, but they are specific to your application. For instance, the team could decide that every class derived from BusinessRule must have a nested class named Factory, derived from BusinessRulesFactory, with a public default constructor.

Even performing line-by-line code reviews can miss violations of the pattern. Is there a better way to ensure that this doesn't happen? PostSharp offers the ability create custom architectural constraints. The constraints that you write are able to verify anything that you can query using reflection.

There are two kinds of constraints: scalar constraints and referential constraints.

This topic contains the following sections:

  • Creating a scalar constraint
  • Creating a referential constraint
  • Validating the constraint itself
  • Ignoring warnings
Creating a scalar constraint

Scalar constraints typically validate an element of code, while referential constraints validate how an element of code is being used.

Let's start with a scalar constraint and create a constraint that verifies the first condition our BusinessRule design pattern: that any class derived from BusinessRule must have a nested class named Factory. We can model this condition as a scalar constraint that applies to any class derived from BusinessRule. Therefore, we will create a type-level scalar constraint, apply it to the BusinessRule class, and use attribute inheritance to have the constraint automatically applied to all derived classes.

  1. Create a class that inherits from the ScalarConstraint class in PostSharp.

    C#
    Copy
     using System;
public class BusinessRulePatternValidation : ScalarConstraint
{
}

  2. Designate what code construct type this validation aspect should work for by adding the MulticastAttributeUsageAttribute attribute. In this case, we want the validation to occur on types only, and we want to enable inheritance.

    C#
    Copy
    [MulticastAttributeUsage(MulticastTargets.Class, Inheritance = MulticastInheritance.Strict)]
public class BusinessRulePatternValidation : ScalarConstraint
{
}

  3. Override the ValidateCode(Object) method.

    C#
    Copy
    [MulticastAttributeUsage(MulticastTargets.Class, Inheritance = MulticastInheritance.Strict)]
public class BusinessRulePatternValidation : ScalarConstraint
{
    public override void ValidateCode(object target)
    {
    }
}

  4. Create a rule that checks that there's a nested type called Factory. You'll note that the target parameter for the ValidateCode(Object) method is an object type. Depending on which target type you declare in the MulticastAttributeUsageAttribute attribute, the value passed through this parameter will change. For MulticastTargets.Type the type passed is Type. To make use of the target for validation you must cast to that type first.

    C#
    Copy
    [MulticastAttributeUsage(MulticastTargets.Class, Inheritance = MulticastInheritance.Strict)]
public class BusinessRulePatternValidation : ScalarConstraint
{
    public override void ValidateCode(object target)
    {
        var targetType = (Type) target;

        if ( targetType.GetNestedType("Factory") == null )
        {
           // Error
        }
    }
}
    Note Note

    Valid types for the target parameter of the ValidateCode(Object) method include Assembly, Type, MethodInfo, ConstructorInfo, PropertyInfo, EventInfo, FieldInfo, and ParameterInfo.

  5. Write a warning that the rule being broken to the Output window in Visual Studio.

    C#
    Copy
    [MulticastAttributeUsage(MulticastTargets.Class, Inheritance = MulticastInheritance.Strict)]
public class BusinessRulePatternValidation : ScalarConstraint
{
    public override void ValidateCode(object target)
    {
        var targetType = (Type)target;

        if (targetType.GetNestedType("Factory") == null)
        {
            Message.Write(
                targetType, SeverityType.Warning,
                "2001",
                "The {0} type does not have a nested type named 'Factory'.",
                targetType.DeclaringType,
                 targetType.Name);
        }
    }
}

  6. Attach the rule to the code that needs to be protected. For this example we want to add this rule to the BusinessRule class.

    C#
    Copy
    [BusinessRulePatternValidation]
public class BusinessRule
{
    // No Factory class here.
}
    Note Note

    This example shows applying the constraint to only one class. If you want to apply a constraint to large portions of your codebase, read the section on Adding Aspects to Multiple Declarations

  7. Now if you compile the project you will see an error in the Output window of Visual Studio when you run a build.

    Custom Arch Constraint warning

  8. In some circumstances you may determine that a warning isn't aggressive enough. We can alter the rule that you have created so that it outputs a compile time error instead. All that you need to do is change the SeverityType in the Message.Write to Error.

    C#
    Copy
    [MulticastAttributeUsage(MulticastTargets.Class, Inheritance = MulticastInheritance.Strict)]
public class BusinessRulePatternValidation : ScalarConstraint
{
    public override void ValidateCode(object target)
    {
        var targetType = (Type)target;

        if (targetType.GetNestedType("Factory") == null)
        {
            Message.Write(
            targetType, SeverityType.Error,
            "2001",
            "The {0} type does not have a nested type named 'Factory'.",
            targetType.DeclaringType,
            targetType.Name);
        }
    }
}
    Custom Arch Constraint error

Using this technique it is possible to create rules or restrictions based on a number of different criteria and implement validation for several design patterns.

When you are working on projects you need to ensure that they adhere to the ideals and principles that our project teams hold dear. As with any process in software development, manual verification is guaranteed to fail at some point in time. As you do in other areas of the development process, you should look to automate the verification and enforcement of our ideals. The ability to create custom architectural constraints provides both the flexibility and verification that you need to achieve this goal.

Creating a referential constraint

Now let's create a referential constraint that verifies the second condition our BusinessRule design pattern: that the BusinessRule class can only be used in the Controllers namespace. You can model this condition as a referential constraint and apply the constraint to any class in your codebase. If you apply this constraint to the entirety of your codebase you will ensure that the BusinessRule design pattern is only referenced in the Controllers namespace.

  1. Create a class that inherits from the ReferentialConstraint class in PostSharp.

    C#
    Copy
     public class BusinessRuleUseValidation : ReferentialConstraint
{
}

  2. Declare that this aspect should work only on types by adding the MulticastAttributeUsageAttribute attribute to the class.

    C#
    Copy
    [MulticastAttributeUsage(MulticastTargets.Class, Inheritance = MulticastInheritance.Strict)]
public class BusinessRuleUseValidation : ReferentialConstraint
{
}

  3. Override the ValidateCode(Object, Assembly) method.

    C#
    Copy
    [MulticastAttributeUsage(MulticastTargets.Class, Inheritance = MulticastInheritance.Strict)]
BusinessRuleUseValidation : ReferentialConstraint
{
    public override void ValidateCode(object target, Assembly assembly)
    {
    }
}

  4. Create the rule that checks for the use of the BusinessRule type in the target code.

    C#
    Copy
    [MulticastAttributeUsage(MulticastTargets.Class, Inheritance = MulticastInheritance.Strict)]
public class BusinessRulePatternValidation : ScalarConstraint
{
    public override void ValidateCode(object target, Assembly assembly)
    {
        var targetType = (Type) target;
        var usages = ReflectionSearch
                .GetMethodsUsingDeclaration(typeof (BusinessRule));

        if (usages !=null)
        {
            // Warning
        }
    }
}
    Note Note

    The rule here makes use of the ReflectionSearch helper class that is provided by the PostSharp framework. This class, along with others, is an extension to the built in reflection functionality of .NET and can be used outside of aspects as well.

  5. Write a warning message to be included in the Output window of Visual Studio.

    C#
    Copy
    [MulticastAttributeUsage(MulticastTargets.Class, Inheritance = MulticastInheritance.Strict)]
public class BusinessRulePatternValidation : ScalarConstraint
{
    public override void ValidateCode(object target, Assembly assembly)
    {
        var targetType = (Type) target;
        var usages = ReflectionSearch
        .GetMethodsUsingDeclaration(typeof (BusinessRule));

        if (usages !=null)
        {
            Message.Write(
                targetType, SeverityType.Warning,
                "2002",
                "The {0} type contains a reference to 'BusinessRule'" +
                "which should only be referenced from Controllers.",
                targetType.Name);
        }
    }
}

  6. Attach the referential constraint that you created to any code that needs to be checked. In this example, add an attribute to the AccountRepository class.

    C#
    Copy
     namespace PostSharp.Architecture.Repositories
{
    [BusinessRuleUseValidation]
    public class AccountRepository
    {
        public void AddAccount(string name)
        {
            var businessRule = new BusinessRule();
            businessRule.DoStuff();
        }
    }
}
    Note Note

    This example shows applying the constraint to only one class. If you want to apply this constraint to a larger portion of your codebase, read the section on Adding Aspects to Multiple Declarations.

  7. Now when you compile the project you will see a warning in the Output window in Visual Studio.

    Referential Constraint Warning
    Note Note

    If using a warning isn't aggressive enough you can change the SeverityType to Error. Now when the rule is broken an error will appear in the Output window of Visual Studio and the build will not be successful.

Caution note Caution

PostSharp constraints operate at the lowest level. For instance, checking relationships of a type with the rest of the code does not implicitly check the relationships of the methods of this type. Also, checking relationships of namespaces is not possible.

Custom attribute multicasting can be used to apply a constraint to a large number of types, for instance all types of a namespace. But this would result in one constraint instance for every type, method and field on this namespace. Although this has no impact on run time, it could severely affect build time. For this reason, the current version of PostSharp Constraints is not suitable to check isolation (layering) of namespaces at large scale.

Referential constraints provide you with the ability to declare architectural design patterns right in your code. By documenting these patterns right in the codebase you are able to provide easy access for the development team as well as continual verification that your desired design patterns are being adhered to.

Validating the constraint itself

Now that you have created scalar and referential constraints you can be assured that certain architectural rules are being consistently implemented in your codebase. There is one thing that is missing though.

With what you have done thus far, it is possible to attach your architectural constraints to any code element in your projects. This may not be appropriate. For example, the scalar constraint that you created to perform the BusinessRulePatternValidation may be a valid constraint only on classes that exist in the Models namespace.

Let's look at how we can ensure that this constraint is only enforced on classes that exist in the Models namespace.

  1. Open the BusinessRulePatternValidation class that you created earlier.

  2. Override the ValidateConstraint(Object) method.

  3. Write the validation logic to ensure that this constraint is only applied to classes in the Models namespace.

    Note Note

    When the ValidateConstraint(Object) method returns true, it tells PostSharp that the constraint should be applied to that target code element. When the ValidateConstraint(Object) method returns false PostSharp will not apply the constraint to the target code element.

Now, when the BusinessRulePatternValidation attribute is applied to a class that is not in the Models namespace of your project, there will be no warning or error added to the Visual Studio Output window.

When the attribute is applied to a class in the Models namespace and that class doesn't pass the constraint's rules you will continue to see the warning or error indicating this architectural failure.

Ignoring warnings

There will be situations where a constraint is generating a warning that is of no concern. In these exceptional circumstances, it is best if you remove the warning from the Visual Studio Output window.

To ignore these unnecessary warnings, find the target code that is responsible for generating the warning. Add the IgnoreWarningAttribute attribute to the target code entering the MessageId of the warning that you want to suppress.

The MessageId can be found in your constraint where you issue the Message.Write command. The Reason value performs no function during the suppression of the warning. It exists so that you can provide clear communication as to why the warning is being ignored.

Note Note

The IgnoreWarningAttribute attribute will only suppress the issuance of Message.Write statements that are assigned a SeverityType of Warning. If the SeverityType is set to Error the IgnoreWarningAttribute attribute will have no suppression effect on that statement.

See Also

Reference

MulticastAttributeUsageAttribute
ScalarConstraint
IgnoreWarningAttribute
MessageId
Reason
MulticastAttributeUsageAttribute

Other Resources

Adding Aspects to Multiple Declarations


Testing and Debugging

Aspects should be tested as any piece of code. However, testing techniques for aspects differ from testing techniques for normal class libraries because of a number of reasons:

  • Aspects instantiation is not user-controlled.

  • Aspects partially execute at build time.

  • Aspects can emit build errors. Logic that emits build errors should be tested too.

These characteristics are no obstacle to proper testing of aspects.

This chapter contains the following sections:

  • Testing Run-Time Logic explains how to test the behavior of an aspect.

  • Testing that an Aspect has been Applied shows how to test that an aspect has been applied to the expected set of code artifacts.

  • Consuming Dependencies from an Aspect describes several ways for aspects to consume dependencies from dependency-injection containers and service locators.

  • Debugging Run-Time Logic explains how to debug run-time logic.

  • Debugging Build-Time Logic explains how to debug build-time logic.


Debugging Run-Time Logic

Enhancing your code with aspects gives you a new dimension to your debugging experience. With PostSharp, patterns are implemented in classes that are separate from the business logic. Most of the time, you will want to debug just the business logic. But sometimes, you will want to debug the aspects: aspect code will now be skipped by default during step-into sessions and in the call stack window.

This topic contains the following sections:

  • Stepping into aspect code
  • Showing aspects code in the call stack window
  • Disabling debugger enhancements
Stepping into aspect code

Suppose you have a SayHello method intercepted by an Intercept aspect. You are about to step into the SayHello method. By default, the debugger steps over the code of the Intercept aspect and then breaks in the beginning of the SayHello method. When Step Into Aspects is enabled, the debugger will step into the Intercept aspect.

Step Over Aspects

The Step Into Aspects feature is disabled by default. To turn it on, go to the menu PostSharp / Options, then to the General tab and the Debugging section, and check the Step Into Aspects check box. Now you can step into aspects using the Step Into (F11) command of the debugger.

Showing aspects code in the call stack window

By default, all the calls to the methods of the Intercept aspect are hidden behind one stack frame named [Aspect Code]. Suppose you have the SayHello method intercepted by the Intercept aspect like in the example above. You are inside the SayHello method. In the call stack, all the methods introduced by PostSharp are hidden.

Prettify Call Stack On

Sometimes you may need to see the real call stack that includes all intermediate method calls generated by PostSharp. This is the purpose of the Show Aspects Code in Call Stack feature.

To turn it on, go to the menu PostSharp / Options, then to the General tab and the Debugging section, and check the Show Aspects Code in Call Stack check box. Now, the call stack includes all the methods introduced by PostSharp.

Prettify Call Stack Off
Disabling debugger enhancements

PostSharp improves your debugging experience by installing extensions for the Visual Studio Debugger and by enhancing PDB files during the build. In some use cases you may want to disable these PostSharp debugger extensions and revert back to the default debugging behavior in Visual Studio (e.g. building for a new or unsupported target framework, debugging code on unsupported devices, working around bugs, etc.).

To disable PostSharp debugger extensions:

  1. Right-click on your solution in the Solution Explorer and then click Properties

  2. On the PostSharp page of the displayed solution property pages dialog, select the check box Disable debugging experience improvements.

    Disable Debugger Extension

  3. Confirm the change by clicking OK and then rebuild your solution.

Note Note

Debugging extensions are automatically disabled when you build your project using MSBuild from outside Visual Studio.

Caution note Caution

If you build a solution with debugging extensions enabled, you must debug the solution with an instance of Visual Studio where debugging extensions are enabled, otherwise your debugging experience will be frustrating.


Debugging Build-Time Logic

It may seem unusual to debug compile-time logic, but like any process, it is perfectly legal and even simple to debug the build process!

Basically, what you will do is to attach a debugger to the PostSharp process. If you use the standard MSBuild targets for PostSharp, define the constant PostSharpAttachDebugger=True.

The trick is easier to explain when you have compile-time logic (your aspect, for instance) and the transformed assembly in different Visual Studio projects.

Suppose you have your aspects logic MyAspects.csproj and unit tests (i.e. the code to be transformed) in MyAspects.Test.csproj. The easiest way to debug MyAspects.csproj is the following:

To debug the build-time logic of an aspect:

  1. Open Visual Studio and load the solution containing MyAspects.csproj.

  2. Open the Visual Studio Command Prompt and go to the directory containing MyAspects.Test.csproj.

  3. Build MyAspects.csproj using Visual Studio as usual .

  4. From the command prompt, type:

    msbuild MyAspects.Test.csproj /T:Rebuild /P:PostSharpAttachDebugger=True

  5. The build process will hit a break point. When it happens, attach the instance of MyAspects.csproj Visual Studio.

    Note Note

    Because of a bug in Visual Studio, you need to use the mixed debugging engine. To do that, check the option Manually choose the debugging engines in the Visual Studio Just-In-Time Debugger and select both the managed and the native engines.

  6. Set up break points in your code and continue the program execution.


Testing that an Aspect has been Applied

In the previous section, we have seen how to test the aspect behavior itself. Now, let's see how we can test that the aspect has been applied to the expected set of targets. This can also be called testing the pointcut.

Why test that the aspect has been properly applied?

You may need to test whether an aspect has been applied to specific targets for one of the following reasons:

  • The aspect is applied using non-trivial regular expressions with MulticastAttribute.

  • The aspect is silently filtered out using CompileTimeValidate(MethodBase).

  • The aspect is applied using an IAspectProvider.

Testing that the aspect behavior is exhibited

The most obvious way to test that the aspect has been applied to an element of code is to execute that code and ensure that the code actually exhibits the aspect behavior. This approach does not differ from the one described in section Testing Run-Time Logic.

Testing that the aspect custom attribute is present

You can check that an aspect has been applied to a target by reflecting the custom attributes present on this element of code.

However, custom attributes representing aspects are stripped by default. If you want PostSharp to emit custom attributes, follow instructions of section Reflecting Aspect Instances at Runtime.

Note Note

Aspects added by IAspectProvider are not represented by custom attributes, so their presence cannot be tested by this approach.

Parsing the PostSharp symbol file

PostSharp generates a symbol file named bin\Debug\MyAssembly.psssym, where MyAssembly is the name of the assembly. In theory, you could use this file to determine which elements of code have been modified by aspects in your project.

Caution note Caution

The PostSharp symbol file format is undocumented and unsupported. It means that PostSharp support team cannot answer questions related to this file format.


Testing Run-Time Logic

When designing a test strategy for aspects, it is fundamental to understand that aspects cannot be used in isolation. They are always used in the context of the code artifact to which it has been applied. Therefore, when writing an aspect, two kinds of test artifacts must be written:

  • Test target code to which the aspect will be applied.

  • Test invocation code that invokes the target code and verifies that the combination of the aspect and the target code exhibits the intended behavior.

Achieving large test coverage

As with other code, you have to test the aspect with input context that varies enough to produce a large code coverage.

In the case of aspects, the input context is composed of the following items:

  • Arguments of the aspect itself, i.e. constructor arguments and property values. If the aspect behavior depends on aspect arguments, high code coverage of the aspect requires varying aspect arguments.

  • Target code can be considered as conceptually being a part of the input arguments of the aspect. For instance, if an aspect contains logic that depends on the method being static or non-static, you should test the aspect against both static and non-static methods.

  • Arguments of the target code can affect the run-time behavior of the aspect. For instance, a buggy aspects may incorrectly handle null arguments.

Example: testing a caching aspect

The following example demonstrates how to test a caching aspect. High code coverage is achieved by varying the target code and testing with null and non-null parameters.

C#
Copy
using System;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Samples
{
    [TestClass]
    public class TestCacheAspect
    {
        private static int invocations;

        // Instance method without parameters

        [TestMethod]
        public void TestInstanceMethodWithoutParameter()
        {
            int call1 = this.InstanceMethodWithoutParameter();
            int call2 = this.InstanceMethodWithoutParameter();

            Assert.AreEqual(call1, call2);
        }

        [Cache]
        private int InstanceMethodWithoutParameter()
        {
            return invocations++;
        }

        // Static method without parameters

        [TestMethod]
        public void TestStaticMethodWithoutParameter()
        {
            int call1 = StaticMethodWithoutParameter();
            int call2 = StaticMethodWithoutParameter();

            Assert.AreEqual(call1, call2);
        }

        [Cache]
        private static int StaticMethodWithoutParameter()
        {
            return invocations++;
        }

        //  Instance method with parameters

        [TestMethod]
        public void TestInstanceMethodWithParameter()
        {
            int call1a = this.InstanceMethodWithParameter("foo");
            int call2a = this.InstanceMethodWithParameter(null);
            int call1b = this.InstanceMethodWithParameter("foo");
            int call2b = this.InstanceMethodWithParameter(null);

            Assert.AreEqual(call1a, call1b);
            Assert.AreEqual(call2a, call2b);
            Assert.AreNotEqual(call1a, call2a);
        }

        [Cache]
        private int InstanceMethodWithParameter(string param)
        {
            return invocations++;
        }

        [TestMethod]
        public void TestInstanceTaskMethodWithParameters()
        {
            int invocationsOld = invocations;

            int call11a = this.InstanceTaskMethodWithParameters(1, 1).Result;
            int call11b = this.InstanceTaskMethodWithParameters(1, 1).Result;

            Assert.AreEqual(call11a, call11b);
            Assert.AreEqual(1, invocations - invocationsOld);
        }

        #region InstanceTaskMethodWithParameters

        [Cache]
        private Task<int> InstanceTaskMethodWithParameters(int a, int b)
        {
            return Task.Run(() =>
            {
                invocations++;
                return a + b;
            });
        }

        #endregion
    }
}


Testing Build-Time Logic

Testing build-time logic of aspects has specific challenges:

  • Aspects can emit errors and warnings, which cannot be tested using a run-time testing framework. We need a mechanism to test error messages themselves.

  • When a project contains a large number of test cases (which are all compiled at the same time), it is difficult to isolate one specific case when the debugger is attached to the build process (see Debugging Build-Time Logic). We need a mechanism to run the build process on a single test case.

Therefore, we built a test framework specifically for the purpose of testing aspects.

This topic contains the following sections:

  • Creating an aspect unit test project
  • Executing a single test
  • Executing all tests from a directory
  • Executing all tests in the project directory
  • Test that messages are emitted
  • Allow unsafe code
  • Creating a reference assembly
Creating an aspect unit test project

To create an aspect unit test project:

  1. Create a console project and add all required references to it.

  2. Add PostSharp to this project

  3. Edit the project file using a text editor. The project file must import PostSharp.BuildTests.targets before Microsoft.CSharp.targets (download). File PostSharp.targets also needs to be included (which is the case if the PostSharp NuGet package is added to the project).

  4. Implement each test case as a standalone file having its own Program class and Main method. To avoid naming conflicts, every file should have a distinct namespace.

A test is considered successful in the following situations:

  • the test compiles using the C# or VB compiler, and

  • the test compiles using PostSharp without any unexpected message (see below), and

  • the output exe is valid according to PEVERIFY, and

  • the output exe executes successfully and returns the exit code 0,

This default behavior can be altered by test directives, as described below.

Executing a single test

Execute the following line from the command prompt:

Copy
msbuild /t:TestOne /p:Source=MyFile.cs
Executing all tests from a directory

Execute the following line from the command prompt:

Copy
msbuild /t:Test /p:SourceDir=MyDirectory
Executing all tests in the project directory

Execute the following line from the command prompt:

Copy
msbuild /t:Test
Test that messages are emitted

If the test is expected to emit a message (error, warning, information), insert the text @ExpectedMessage(PS0001) in the test file as a comment line.

If this directive is present, the test will be valid if and only if all expected messages, and no other, have been emitted.

Allow unsafe code

To enable unsafe code and disable verification by PEVERIFY, insert the text @Unsafe in the test file as a comment line.

Creating a reference assembly

In case that a test requires a dependency assembly (typically, for tests that require two assemblies, for instance testing aspect inheritance that crosses assembly boundaries), you can create a second file named MyTest.Dependency.cs, if the first file is named MyTest.cs. This will create an assembly MyTest.Dependency.dll, and main test will have a reference to this assembly.


Hacking

The following aspects are not really pattern implementations but do not fit in any other chapter.

Section | Description
Executing Code Just After the Assembly is Loaded | This topic shows how to add module initializers to your code.


Executing Code Just After the Assembly is Loaded

Visual Basic has a concept of module. The module is a special class that gets initialized immediately when the assembly is loaded. This feature is implemented by the CLR, but is not exposed to the C# language. The ModuleInitializerAttribute attribute allows you to have module initializers in C#.

To add a module initializer to your project:

  • Create a public or internal method that has no parameter and no return value. The type declaring the method cannot have generic parameters.

  • Add the ModuleInitializerAttribute attribute to this method.

You can add several module initializers a project. Module initializers will be executed in the order you specified in the attribute constructor.

See Also

Reference

ModuleInitializerAttribute


API Reference

PostSharp is a design pattern automation tool for Microsoft .NET.
Namespaces
Namespace | Description
PostSharp | The PostSharp namespace is the root namespace of PostSharp.
PostSharp.Aspects | The PostSharp.Aspects namespace provides the primitives of the PostSharp aspect-oriented framework, such as abstract aspect classes, aspect interfaces, and advise argument classes.
PostSharp.Aspects.Advices | The PostSharp.Aspects.Advices provides custom attributes that allow developing composite aspects with advices and pointcuts.
PostSharp.Aspects.Configuration | The PostSharp.Aspects.Configuration namespace contains classes and custom attributes configuring the aspects of the PostSharp.Aspects namespace.
PostSharp.Aspects.Dependencies | The PostSharp.Aspects.Dependencies namespace contains types and custom attributes that allow to define dependencies between aspects and advices, so that the aspect weaver behaves determistically even if the same element of code is the target of several aspects provided by multiple vendors.
PostSharp.Aspects.Internals |
PostSharp.Aspects.Serialization | The PostSharp.Aspects.Serialization namespace contains types taking care of the process of serializing aspects at build time and deserializing them at run time.
PostSharp.Collections | The PostSharp.Collections namespace contains collection types used by the PostSharp library.
PostSharp.Constraints | The PostSharp.Constraints namespace allows you to validate your code against predefined or custom design rules.
PostSharp.Extensibility | The PostSharp.Extensibility namespace defines the semantics of the attribute multicasting mechanism and exposes other types that allow user code to interact with the PostSharp,platform.
PostSharp.Extensibility.BuildTimeLogging |
PostSharp.Patterns |
PostSharp.Patterns.Caching |
PostSharp.Patterns.Caching.Backends |
PostSharp.Patterns.Caching.Backends.Azure |
PostSharp.Patterns.Caching.Backends.Redis |
PostSharp.Patterns.Caching.Dependencies |
PostSharp.Patterns.Caching.Formatters |
PostSharp.Patterns.Caching.Implementation |
PostSharp.Patterns.Caching.Locking |
PostSharp.Patterns.Caching.Serializers |
PostSharp.Patterns.Caching.ValueAdapters |
PostSharp.Patterns.Collections | The PostSharp.Patterns.Collections namespace defines collection classes that work with the Aggregatable pattern.
PostSharp.Patterns.Collections.Advices |
PostSharp.Patterns.Common.Utilities |
PostSharp.Patterns.Contracts | The PostSharp.Patterns.Contracts namespace contains ready-made contracts that validate fields, properties and parameters at runtime.
PostSharp.Patterns.Diagnostics | The PostSharp.Patterns.Diagnostics namespace contains a logging aspect.
PostSharp.Patterns.Diagnostics.Audit |
PostSharp.Patterns.Diagnostics.Backends |
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights |
PostSharp.Patterns.Diagnostics.Backends.Audit |
PostSharp.Patterns.Diagnostics.Backends.CommonLogging |
PostSharp.Patterns.Diagnostics.Backends.Console |
PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary |
PostSharp.Patterns.Diagnostics.Backends.EventSource |
PostSharp.Patterns.Diagnostics.Backends.Log4Net |
PostSharp.Patterns.Diagnostics.Backends.Loupe |
PostSharp.Patterns.Diagnostics.Backends.Microsoft |
PostSharp.Patterns.Diagnostics.Backends.NLog |
PostSharp.Patterns.Diagnostics.Backends.Null |
PostSharp.Patterns.Diagnostics.Backends.Serilog |
PostSharp.Patterns.Diagnostics.Backends.Trace |
PostSharp.Patterns.Diagnostics.Backends.TraceSource |
PostSharp.Patterns.Diagnostics.Contexts |
PostSharp.Patterns.Diagnostics.Custom |
PostSharp.Patterns.Diagnostics.Formatters |
PostSharp.Patterns.Diagnostics.RecordBuilders |
PostSharp.Patterns.Diagnostics.ThreadingInstrumentation |
PostSharp.Patterns.DynamicAdvising |
PostSharp.Patterns.Formatters |
PostSharp.Patterns.Model | The PostSharp.Patterns.Model namespace contains an implementation of the Observer, Aggregatable and Disposable patterns.
PostSharp.Patterns.Model.Controls |
PostSharp.Patterns.Model.TypeAdapters |
PostSharp.Patterns.Recording | The PostSharp.Patterns.Recording namespace implements the undo/redo feature.
PostSharp.Patterns.Recording.Operations | The PostSharp.Patterns.Recording.Operations namespace defines recordable operations.
PostSharp.Patterns.Threading | The PostSharp.Patterns.Threading namespace contains an implementation of several threading models, and other thread dispatching aspects.
PostSharp.Patterns.Threading.Models |
PostSharp.Patterns.Utilities |
PostSharp.Patterns.Xaml |
PostSharp.Reflection | The PostSharp.Reflection namespace complements the System.Reflection namespace.
PostSharp.Reflection.MethodBody |
PostSharp.Serialization | The PostSharp.Serialization namespace implements a portable serializer.


PostSharp Namespace

The PostSharp namespace is the root namespace of PostSharp.
Classes
 | Class | Description
Public class | Post | Provides some methods that are transformed during post-compilation.


Post Class

Provides some methods that are transformed during post-compilation.
Inheritance Hierarchy
SystemObject
PostSharpPost

Namespace: PostSharp
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static class Post

The Post type exposes the following members.

Properties
Name | Description
IsTransformed | Determines whether the calling program has been transformed by PostSharp.
Top
Methods
Name | Description
CastSourceType, TargetType | At post-compile time, casts an instance of a type into another. A post-compile time error is reported if the source type cannot be assigned to the target type.
GetValueT | When used to retrieve the value of a field, forces the compiler to retrieve a copy of the field value instead of an address to this field. This allows to call instance methods of value-type fields without loading the field address.
Top
See Also

Reference

PostSharp Namespace


Post Properties

The Post type exposes the following members.

Properties
Name | Description
IsTransformed | Determines whether the calling program has been transformed by PostSharp.
Top
See Also

Reference

Post Class
PostSharp Namespace


Post.IsTransformed Property

PostIsTransformed Property

Determines whether the calling program has been transformed by PostSharp.

Namespace: PostSharp
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool IsTransformed { get; }

Property Value

Type: Boolean
true if the calling program has been transformed by PostSharp, otherwise false.
See Also

Reference

Post Class
PostSharp Namespace


Post Methods

The Post type exposes the following members.

Methods
Name | Description
CastSourceType, TargetType | At post-compile time, casts an instance of a type into another. A post-compile time error is reported if the source type cannot be assigned to the target type.
GetValueT | When used to retrieve the value of a field, forces the compiler to retrieve a copy of the field value instead of an address to this field. This allows to call instance methods of value-type fields without loading the field address.
Top
See Also

Reference

Post Class
PostSharp Namespace


Post.Cast(SourceType, TargetType) Method

PostCastSourceType, TargetType Method

At post-compile time, casts an instance of a type into another. A post-compile time error is reported if the source type cannot be assigned to the target type.

Namespace: PostSharp
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static TargetType Cast<SourceType, TargetType>(
    SourceType o
)
where SourceType : class
where TargetType : class

Parameters

o
Type: SourceType
Instance to be casted.

Type Parameters

SourceType
Source type.
TargetType
Target type.

Return Value

Type: TargetType
The object o casted as TargetType.
Remarks
The purpose of this method is to make a source code compilable even when an interface will be implemented at post-compile time. PostSharp ensures that TargetType is assignable from SourceType. If yes, the call to this method is simply suppressed. If types are not assignable, a build error is issued.
See Also

Reference

Post Class
PostSharp Namespace

Other Resources

Conceptual: Enumerating Child Objects (Visitor)
Conceptual: Freezable Threading Model
Conceptual: Implementing INotifyPropertyChanged
Conceptual: Introducing Interfaces, Methods, Properties and Events into Existing Classes


Post.GetValue(T) Method

PostGetValueT Method

When used to retrieve the value of a field, forces the compiler to retrieve a copy of the field value instead of an address to this field. This allows to call instance methods of value-type fields without loading the field address.

Namespace: PostSharp
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static T GetValue<T>(
    T value
)
where T : struct, new()

Parameters

value
Type: T
Value.

Type Parameters

T
Type of the value to retrieve (this type parameter can generally be omitted).

Return Value

Type: T
value, exactly.
See Also

Reference

Post Class
PostSharp Namespace


PostSharp.Aspects Namespace

The PostSharp.Aspects namespace provides the primitives of the PostSharp aspect-oriented framework, such as abstract aspect classes, aspect interfaces, and advise argument classes.
Classes
 | Class | Description
Public class | AdviceArgs | Base class for arguments of all advices.
Public class | Arguments | Encapsulation of method arguments.
Public class | Aspect | Base class for all aspects that are declared using multicast custom attributes (MulticastAttribute).
Public class | AspectDescriptionAttribute | Custom attribute that, when applied to an aspect class, specifies a human-readable description of the aspect that can be displayed in PostSharp Tools for Visual Studio.
Public class | AspectInfo | Reserved for future usage.
Public class | AspectInstance | Completely specifies an aspect instance, including its target code element. An AspectInstance contains either the aspect instance itself (Aspect property), either information allowing to construct the aspect (AspectConstruction) and configure the weaver (AspectConfiguration).
Public class | AspectSpecification | Completely specifies an aspect instance (but not its target). An AspectSpecification either the aspect instance itself (Aspect property), either information allowing to construct the aspect (AspectConstruction) and configure the weaver (AspectConfiguration).
Public class | AspectUtilities | Utility methods for PostSharp.Aspects.
Public class | AssemblyLevelAspect | Base class for all aspects applied on assemblies.
Public class | CompositionAspect | Aspect that, when applied on a type, introduces one or many new interfaces into that type.
Public class | CustomAttributeIntroductionAspect | Aspect that, when applied to a target, adds a custom attribute to this target.
Public class | EventInterceptionArgs | Arguments of handlers of aspects of the type EventInterceptionAspect.
Public class | EventInterceptionAspect | Aspect that, when applied on an event, intercepts invocations of its semantics Add (OnAddHandler(EventInterceptionArgs)), Remove (OnRemoveHandler(EventInterceptionArgs)) and Invoke (OnInvokeHandler(EventInterceptionArgs)).
Public class | EventLevelAspect | Base class for all aspects applied on events.
Public class | FieldLevelAspect | Base class for all aspects applied on fields.
Public class | InstanceLevelAspect | Base class for aspects applied on types, but having the same lifetime as instances of the type to which they are applied.
Public class | LinesOfCodeAvoidedAttribute | Custom attribute that, when applied to an aspect class, specifies how many manual lines of code are avoided every time the aspect is being used.
Public class | LocationBindingExtensions | Extension methods for the ILocationBinding interface.
Public class | LocationInterceptionArgs | Arguments of advices of aspect type LocationInterceptionAspect.
Public class | LocationInterceptionAspect | Aspect that, when applied on a location (field or property), intercepts invocations of the Get (OnGetValue(LocationInterceptionArgs)) and Set (OnSetValue(LocationInterceptionArgs)) semantics.
Public class | LocationLevelAspect | Base class for aspects defined in fields, properties, or parameters.
Public class | ManagedResourceIntroductionAspect | Aspect that, when applied to an assembly, adds a custom attribute to this assembly.
Public class | MethodExecutionArgs | Arguments of advices of aspects of type OnMethodBoundaryAspect and OnExceptionAspect
Public class | MethodImplementationAspect | Aspect that, when applied on an abstract or extern method, creates an implementation for this method.
Public class | MethodInterceptionArgs | Arguments of advices of aspect type MethodInterceptionAspect.
Public class | MethodInterceptionAspect | Aspect that, when applied on a method, intercepts invocations of this method.
Public class | MethodLevelAspect | Base class for all aspects applied on methods.
Public class | ModuleInitializerAttribute | Custom attribute that, when added to a static method, causes the method to be executed immediately after the assembly is loaded by the CLR. The target method must be public, parameterless, void, and non-generic.
Public class | NullTaskSentinel | The singleton instance of this class is assigned to the ReturnValue property when an OnMethodBoundaryAspect aspect is applied semantically to a method and the target method returns a null task.
Public class | OnExceptionAspect | Aspect that, when applied to a method, defines an exception handler around the whole method and calls a custom method in this exception handler.
Public class | OnMethodBoundaryAspect | Aspect that, when applied to a method defined in the current assembly, inserts a piece of code before and after the body of these methods.
Public class | TypeIdentity | Wraps a Type or a type name.
Public class | TypeLevelAspect | Base class for all aspects applied on types.
Structures
 | Structure | Description
Public structure | AsyncCallId | Identifier of an asynchronous method invocation, i.e. of a unique async state machine instance.
Public structure | ConstructorDepth | System type used in the implementation of the OnInstanceConstructedAdvice. Do not use in user code.
Public structure | MethodBindingInvokeAwaitable | Represents the awaitable result of the asynchronous method invocation. Await this value to get the System.Object instance containing the return value of the async method. The result of the await is null for async methods that do not return any value.
Public structure | MethodBindingInvokeAwaiter | Represents the awaiter for the result of the asynchronous method invocation.
Public structure | MethodInterceptionProceedAwaitable | Represents the asynchronous proceed operation that calls the next node in the chain of invocation.
Public structure | MethodInterceptionProceedAwaiter | Represents the awaiter for the completion of the asynchronous proceed operation.
Interfaces
 | Interface | Description
Public interface | IAspect | Base interface for run-time semantics of all aspects.
Public interface | IAspectBuildSemantics | Compile-time semantics of IAspect.
Public interface | IAspectInstance | Represents an instance of an aspect applied to a declaration.
Public interface | IAspectProvider | Interface that, when implemented by an aspect class, allows aspect instances to provide other aspects to the weaver.
Public interface | IAspectRepositoryService | Service that allows to determine which aspects have been applied to a given declaration, whether declaratively through custom attributes or MulticastAttribute, or programmatically using IAspectProvider.
Public interface | IAssemblyLevelAspect | Runtime semantics of aspects applied at assembly level.
Public interface | IAssemblyLevelAspectBuildSemantics | Build-time semantics of aspects applied at assembly level.
Public interface | IAsyncMethodBinding | Interface through which a method-level aspect or advice can asynchronously invoke the next node in the chain of invocation.
Public interface | IAsyncMethodInterceptionAspect | Runtime semantics of an aspect that, when applied on a method, intercepts invocations of this method. Includes semantics for both async and non-async method interception.
Public interface | ICloneAwareAspect | Defines the semantics of aspects that require to be notified after a target object is cloned using MemberwiseClone.
Public interface | ICompositionAspect | Defines the semantics of an aspect that, when applied on a type, introduce one or many new interfaces into that type, and let these interfaces be implemented by an object created at runtime.
Public interface | ICustomAttributeIntroductionAspect | Semantics of an aspect that, when applied to a target, adds a custom attribute to this target.
Public interface | IEventBinding | Interface through which an event-level aspect or advice can invoke the next node in the chain of invocation.
Public interface | IEventInterceptionAspect | Runtime semantics of an aspect that, when applied on an event, intercepts invocations of its semantics Add (OnAddHandler(EventInterceptionArgs)), Remove (OnRemoveHandler(EventInterceptionArgs)) and Invoke (OnInvokeHandler(EventInterceptionArgs)) semantics.
Public interface | IEventLevelAspect | Runtime semantics of aspects that can be applied on events.
Public interface | IEventLevelAspectBuildSemantics | Build-time semantics of aspects that can be applied on events.
Public interface | IFieldLevelAspect | Run-time semantics of aspects applied to fields.
Public interface | IFieldLevelAspectBuildSemantics | Compile-time semantics of IFieldLevelAspect.
Public interface | IInstanceScopedAspect | Runtime semantics of aspects that have the same lifetime as instance of types to which their are applied (or instance of the declaring type of members to which they are applied).
Public interface | ILocationBinding | Interface through which a field- or property-level aspect or advice can invoke the next node in the chain of invocation.
Public interface | ILocationBindingT | A strongly-typed variant for ILocationBinding.
Public interface | ILocationBindingActionTPayload | Exposes an ExecuteTValue(ILocationBindingTValue, TPayload) method invoked by the ExecuteTPayload(ILocationBindingActionTPayload, TPayload) method, which allows to execute strongly-typed operations and avoid boxing required by the weakly typed ILocationBinding interface.
Public interface | ILocationInterceptionArgs | An interface for LocationInterceptionArgs.
Public interface | ILocationInterceptionArgsT | A strongly-typed specialization of the ILocationInterceptionArgs interface.
Public interface | ILocationInterceptionArgsActionTPayload | Exposes an ExecuteTValue(ILocationInterceptionArgsTValue, TPayload) method invoked by the ExecuteTPayload(ILocationInterceptionArgsActionTPayload, TPayload) method, which allows to execute strongly-typed operations and avoid boxing required by the weakly typed ILocationInterceptionArgs interface.
Public interface | ILocationInterceptionAspect | Runtime semantics of an aspect that, when applied on a location (field or property), intercepts invocations of the Get (OnGetValue(LocationInterceptionArgs)) and Set (OnSetValue(LocationInterceptionArgs)) semantics.
Public interface | ILocationLevelAspect | Runtime semantics of aspects defined on a field, property, or parameter.
Public interface | ILocationLevelAspectBuildSemantics | Compile-time semantics of ILocationLevelAspect.
Public interface | ILocationValidationAspect | Ancestor of ILocationValidationAspectT.
Public interface | ILocationValidationAspectT | Runtime semantics of an aspect that, when applied on a location (field, property, or parameter), validates the value assigned to this location using method ValidateValue(T, String, LocationKind, LocationValidationContext), and throws the exception returned by this method if any.
Public interface | IManagedResourceIntroductionAspect | Semantics of an aspect that, when applied to an assembly, adds a managed resource to this assembly.
Public interface | IMethodBinding | Interface through which a method-level aspect or advice can invoke the next node in the chain of invocation.
Public interface | IMethodInterceptionAspect | Runtime semantics of an aspect that, when applied on a method, intercepts invocations of this method.
Public interface | IMethodLevelAspect | Runtime semantics of aspects applied to methods.
Public interface | IMethodLevelAspectBuildSemantics | Compile-time semantics of IMethodLevelAspect.
Public interface | IOnExceptionAspect | Runtime semantics of an aspect that, when applied on a method, defines an exception handler around the whole method body and let the implementation of this interface handle the exception.
Public interface | IOnMethodBoundaryAspect | Runtime semantics of OnMethodBoundaryAspect.
Public interface | IOnStateMachineBoundaryAspect | Extends the IOnMethodBoundaryAspect interface with two advises to be applied on state machines.
Public interface | ITypeLevelAspect | Run-time semantics of aspects applied to types.
Public interface | ITypeLevelAspectBuildSemantics | Compile-time semantics of ITypeLevelAspect.
Enumerations
 | Enumeration | Description
Public enumeration | FlowBehavior | Enumerates the possible behaviors of the calling method after the calling method has returned.
Public enumeration | LocationValidationContext | Enumerates the possible contexts in which the location validation advices can be invoked.
Public enumeration | SemanticallyAdvisedMethodKinds | Enumerates possible target methods for semantic advising.
Public enumeration | UnsupportedTargetAction | Enumerates actions that can be taken when an aspect is applied to a target element that is not currently supported.


AdviceArgs Class

Base class for arguments of all advices.
Inheritance Hierarchy
SystemObject
PostSharp.AspectsAdviceArgs
PostSharp.AspectsEventInterceptionArgs
PostSharp.AspectsLocationInterceptionArgs
PostSharp.AspectsMethodExecutionArgs
PostSharp.AspectsMethodInterceptionArgs

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class AdviceArgs

The AdviceArgs type exposes the following members.

Constructors
 | Name | Description
Public method | AdviceArgs | Initializes a new AdviceArgs.
Top
Properties
 | Name | Description
Public property | DeclarationIdentifier | Gets the DeclarationIdentifier of the declaration to which the advice has been applied.
Public property | Instance | Gets or sets the object instance on which the method is being executed.
Top
See Also

Reference

PostSharp.Aspects Namespace


AdviceArgs Constructor

Initializes a new AdviceArgs.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AdviceArgs(
    Object instance
)

Parameters

instance
Type: SystemObject
The instance related to the advice invocation, or null if the advice is associated to a static element of code.
See Also

Reference

AdviceArgs Class
PostSharp.Aspects Namespace


AdviceArgs Properties

The AdviceArgs type exposes the following members.

Properties
 | Name | Description
Public property | DeclarationIdentifier | Gets the DeclarationIdentifier of the declaration to which the advice has been applied.
Public property | Instance | Gets or sets the object instance on which the method is being executed.
Top
See Also

Reference

AdviceArgs Class
PostSharp.Aspects Namespace


AdviceArgs.DeclarationIdentifier Property

AdviceArgsDeclarationIdentifier Property

Gets the DeclarationIdentifier of the declaration to which the advice has been applied.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public DeclarationIdentifier DeclarationIdentifier { get; set; }

Property Value

Type: DeclarationIdentifier
Remarks

For usage information, see the remarks of the DeclarationIdentifier type documentation.

Note Note
As a result of weaving optimizations, value of this property may be seen null in a debugger. If you need to inspect the value in runtime, consider disabling aspect optimizations in the debug build configuration.
See Also

Reference

AdviceArgs Class
PostSharp.Aspects Namespace


AdviceArgs.Instance Property

AdviceArgsInstance Property

Gets or sets the object instance on which the method is being executed.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Object Instance { get; set; }

Property Value

Type: Object
Remarks

This set may be set by user code only when the instance is a value type. As usually, user code is responsible for setting an object of the right type.

Note Note
As a result of weaving optimizations, value of this property may be seen null in a debugger. If you need to inspect the value in runtime, consider disabling aspect optimizations in the debug build configuration.
See Also

Reference

AdviceArgs Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Handling Exceptions
Conceptual: Injecting Behaviors Before and After Method Execution
Conceptual: Intercepting Methods


Arguments Class

Encapsulation of method arguments.
Inheritance Hierarchy
SystemObject
PostSharp.AspectsArguments
More...

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class Arguments : IEnumerable<Object>,
    IEnumerable, IList<Object>, ICollection<Object>,
    ICloneable

The Arguments type exposes the following members.

Properties
 | Name | Description
Public property | Count | Gets the number of arguments encapsulated by the current object.
Public property | Item | Gets or sets the value of an argument.
Top
Methods
 | Name | Description
Public method | Clone | Returns a shallow copy of the current object.
Public method | CopyFrom | Copies all the argument values from the elements of Array.
Public method | CopyTo | Copies all arguments values to the specified Array starting at the specified destination Array index.
 | Create(Object) | Creates a weakly-typed Arguments object representing any number of arguments.
 | CreateT(T) | Creates a strongly-typed Arguments object representing 1 argument.
 | CreateT0, T1(T0, T1) | Creates a strongly-typed Arguments object representing 2 arguments.
 | CreateT0, T1, T2(T0, T1, T2) | Creates a strongly-typed Arguments object representing 3 arguments.
 | CreateT0, T1, T2, T3(T0, T1, T2, T3) | Creates a strongly-typed Arguments object representing 4 arguments.
 | CreateT0, T1, T2, T3, T4(T0, T1, T2, T3, T4) | Creates a strongly-typed Arguments object representing 5 arguments.
 | CreateT0, T1, T2, T3, T4, T5(T0, T1, T2, T3, T4, T5) | Creates a strongly-typed Arguments object representing 6 arguments.
 | CreateT0, T1, T2, T3, T4, T5, T6(T0, T1, T2, T3, T4, T5, T6) | Creates a strongly-typed Arguments object representing 7 arguments.
 | CreateT0, T1, T2, T3, T4, T5, T6, T7(T0, T1, T2, T3, T4, T5, T6, T7) | Creates a strongly-typed Arguments object representing 8 arguments.
Public method | GetArgument | Gets the value of the argument at a given index.
Public method | GetEnumerator | Returns an enumerator that iterates through the collection.
Public method | SetArgument | Sets the value of the argument at a given index.
Public method | ToArray | Converts the current argument list into an Array.
Top
Fields
Name | Description
Empty | Empty list of Arguments.
Top
Extension Methods
 | Name | Description
Public Extension Method | ToAdvisableCollectionObject | Converts an IEnumerableT into an AdvisableCollectionT. (Defined by Extensions.)
Public Extension Method | ToAdvisableDictionaryObject, TKey, TValue | Converts an IEnumerableT into a AdvisableDictionaryTKey, TValue given a method returning the item key and a method returning the item value. (Defined by Extensions.)
Public Extension Method | ToAdvisableHashSetObject | Converts an IEnumerableT into an AdvisableHashSetT. (Defined by Extensions.)
Top
Remarks
Note Note
As a result of optimizations, an Arguments object may be shared between different advices. If an advice implementation needs to access an Arguments object after it has given over control, it should take a reference to a clone instead of the initial object itself.
Note Note
Implementations of this type should be considered an implementation detail and should not be accessed by user code.
See Also

Reference

PostSharp.Aspects Namespace

Other Resources

Conceptual: Injecting Behaviors Before and After Method Execution
Inheritance Hierarchy
SystemObject
PostSharp.AspectsArguments
PostSharp.Aspects.InternalsArgumentsTArg0
PostSharp.Aspects.InternalsArgumentsTArg0, TArg1
PostSharp.Aspects.InternalsArgumentsTArg0, TArg1, TArg2
PostSharp.Aspects.InternalsArgumentsTArg0, TArg1, TArg2, TArg3
PostSharp.Aspects.InternalsArgumentsTArg0, TArg1, TArg2, TArg3, TArg4
PostSharp.Aspects.InternalsArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5
PostSharp.Aspects.InternalsArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6
PostSharp.Aspects.InternalsArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7
PostSharp.Aspects.InternalsArgumentsArray


Arguments Properties

The Arguments type exposes the following members.

Properties
 | Name | Description
Public property | Count | Gets the number of arguments encapsulated by the current object.
Public property | Item | Gets or sets the value of an argument.
Top
See Also

Reference

Arguments Class
PostSharp.Aspects Namespace


Arguments.Count Property

ArgumentsCount Property

Gets the number of arguments encapsulated by the current object.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int Count { get; }

Property Value

Type: Int32

Implements

ICollectionTCount
See Also

Reference

Arguments Class
PostSharp.Aspects Namespace


Arguments.Item Property

ArgumentsItem Property

Gets or sets the value of an argument.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Object this[
    int index
] { get; set; }

Parameters

index
Type: SystemInt32
Argument index.

Return Value

Type: Object
The argument value.

Implements

IListTItemInt32
Exceptions
Exception | Condition
ArgumentOutOfRangeException | index is lower than zero or greater or equal than Count.
See Also

Reference

Arguments Class
PostSharp.Aspects Namespace


Arguments Methods

The Arguments type exposes the following members.

Methods
 | Name | Description
Public method | Clone | Returns a shallow copy of the current object.
Public method | CopyFrom | Copies all the argument values from the elements of Array.
Public method | CopyTo | Copies all arguments values to the specified Array starting at the specified destination Array index.
 | Create(Object) | Creates a weakly-typed Arguments object representing any number of arguments.
 | CreateT(T) | Creates a strongly-typed Arguments object representing 1 argument.
 | CreateT0, T1(T0, T1) | Creates a strongly-typed Arguments object representing 2 arguments.
 | CreateT0, T1, T2(T0, T1, T2) | Creates a strongly-typed Arguments object representing 3 arguments.
 | CreateT0, T1, T2, T3(T0, T1, T2, T3) | Creates a strongly-typed Arguments object representing 4 arguments.
 | CreateT0, T1, T2, T3, T4(T0, T1, T2, T3, T4) | Creates a strongly-typed Arguments object representing 5 arguments.
 | CreateT0, T1, T2, T3, T4, T5(T0, T1, T2, T3, T4, T5) | Creates a strongly-typed Arguments object representing 6 arguments.
 | CreateT0, T1, T2, T3, T4, T5, T6(T0, T1, T2, T3, T4, T5, T6) | Creates a strongly-typed Arguments object representing 7 arguments.
 | CreateT0, T1, T2, T3, T4, T5, T6, T7(T0, T1, T2, T3, T4, T5, T6, T7) | Creates a strongly-typed Arguments object representing 8 arguments.
Public method | GetArgument | Gets the value of the argument at a given index.
Public method | GetEnumerator | Returns an enumerator that iterates through the collection.
Public method | SetArgument | Sets the value of the argument at a given index.
Public method | ToArray | Converts the current argument list into an Array.
Top
Extension Methods
 | Name | Description
Public Extension Method | ToAdvisableCollectionObject | Converts an IEnumerableT into an AdvisableCollectionT. (Defined by Extensions.)
Public Extension Method | ToAdvisableDictionaryObject, TKey, TValue | Converts an IEnumerableT into a AdvisableDictionaryTKey, TValue given a method returning the item key and a method returning the item value. (Defined by Extensions.)
Public Extension Method | ToAdvisableHashSetObject | Converts an IEnumerableT into an AdvisableHashSetT. (Defined by Extensions.)
Top
See Also

Reference

Arguments Class
PostSharp.Aspects Namespace


Arguments.Clone Method

ArgumentsClone Method

Returns a shallow copy of the current object.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Arguments Clone()

Return Value

Type: Arguments
A shallow copy of the current object.
See Also

Reference

Arguments Class
PostSharp.Aspects Namespace


Arguments.CopyFrom Method

ArgumentsCopyFrom Method

Copies all the argument values from the elements of Array.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void CopyFrom(
    Object[] array,
    int index
)

Parameters

array
Type: SystemObject
The array that is the source of the argument values copied into the current Arguments.
index
Type: SystemInt32
An integer that represents the index in array at which copying begins.
Exceptions
Exception | Condition
ArgumentNullException | array is null.
ArgumentOutOfRangeException | index is lower than zero.
See Also

Reference

Arguments Class
PostSharp.Aspects Namespace
ArgumentsCopyTo(Object, Int32)


Arguments.CopyTo Method

ArgumentsCopyTo Method

Copies all arguments values to the specified Array starting at the specified destination Array index.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void CopyTo(
    Object[] array,
    int index
)

Parameters

array
Type: SystemObject
The array that is the destination of argument values copied from the current Arguments.
index
Type: SystemInt32
An integer that represents the index in array at which copying begins

Implements

ICollectionTCopyTo(T, Int32)
See Also

Reference

Arguments Class
PostSharp.Aspects Namespace
ArgumentsCopyFrom(Object, Int32)


Arguments.Create Method

ArgumentsCreate Method

Overload List
Name | Description
Create(Object) | Creates a weakly-typed Arguments object representing any number of arguments.
CreateT(T) | Creates a strongly-typed Arguments object representing 1 argument.
CreateT0, T1(T0, T1) | Creates a strongly-typed Arguments object representing 2 arguments.
CreateT0, T1, T2(T0, T1, T2) | Creates a strongly-typed Arguments object representing 3 arguments.
CreateT0, T1, T2, T3(T0, T1, T2, T3) | Creates a strongly-typed Arguments object representing 4 arguments.
CreateT0, T1, T2, T3, T4(T0, T1, T2, T3, T4) | Creates a strongly-typed Arguments object representing 5 arguments.
CreateT0, T1, T2, T3, T4, T5(T0, T1, T2, T3, T4, T5) | Creates a strongly-typed Arguments object representing 6 arguments.
CreateT0, T1, T2, T3, T4, T5, T6(T0, T1, T2, T3, T4, T5, T6) | Creates a strongly-typed Arguments object representing 7 arguments.
CreateT0, T1, T2, T3, T4, T5, T6, T7(T0, T1, T2, T3, T4, T5, T6, T7) | Creates a strongly-typed Arguments object representing 8 arguments.
Top
See Also

Reference

Arguments Class
PostSharp.Aspects Namespace


Arguments.Create Method (Object[])

ArgumentsCreate Method (Object)

Creates a weakly-typed Arguments object representing any number of arguments.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Arguments Create(
    params Object[] array
)

Parameters

array
Type: SystemObject

Return Value

Type: Arguments
See Also

Reference

Arguments Class
Create Overload
PostSharp.Aspects Namespace


Arguments.Create(T) Method (T)

ArgumentsCreateT Method (T)

Creates a strongly-typed Arguments object representing 1 argument.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Arguments Create<T>(
    T arg0
)

Parameters

arg0
Type: T

Type Parameters

T

Return Value

Type: Arguments
See Also

Reference

Arguments Class
Create Overload
PostSharp.Aspects Namespace


Arguments.Create(T0, T1) Method (T0, T1)

ArgumentsCreateT0, T1 Method (T0, T1)

Creates a strongly-typed Arguments object representing 2 arguments.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Arguments Create<T0, T1>(
    T0 arg0,
    T1 arg1
)

Parameters

arg0
Type: T0
arg1
Type: T1

Type Parameters

T0
T1

Return Value

Type: Arguments
See Also

Reference

Arguments Class
Create Overload
PostSharp.Aspects Namespace


Arguments.Create(T0, T1, T2) Method (T0, T1, T2)

ArgumentsCreateT0, T1, T2 Method (T0, T1, T2)

Creates a strongly-typed Arguments object representing 3 arguments.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Arguments Create<T0, T1, T2>(
    T0 arg0,
    T1 arg1,
    T2 arg2
)

Parameters

arg0
Type: T0
arg1
Type: T1
arg2
Type: T2

Type Parameters

T0
T1
T2

Return Value

Type: Arguments
See Also

Reference

Arguments Class
Create Overload
PostSharp.Aspects Namespace


Arguments.Create(T0, T1, T2, T3) Method (T0, T1, T2, T3)

ArgumentsCreateT0, T1, T2, T3 Method (T0, T1, T2, T3)

Creates a strongly-typed Arguments object representing 4 arguments.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Arguments Create<T0, T1, T2, T3>(
    T0 arg0,
    T1 arg1,
    T2 arg2,
    T3 arg3
)

Parameters

arg0
Type: T0
arg1
Type: T1
arg2
Type: T2
arg3
Type: T3

Type Parameters

T0
T1
T2
T3

Return Value

Type: Arguments
See Also

Reference

Arguments Class
Create Overload
PostSharp.Aspects Namespace


Arguments.Create(T0, T1, T2, T3, T4) Method (T0, T1, T2, T3, T4)

ArgumentsCreateT0, T1, T2, T3, T4 Method (T0, T1, T2, T3, T4)

Creates a strongly-typed Arguments object representing 5 arguments.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Arguments Create<T0, T1, T2, T3, T4>(
    T0 arg0,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4
)

Parameters

arg0
Type: T0
arg1
Type: T1
arg2
Type: T2
arg3
Type: T3
arg4
Type: T4

Type Parameters

T0
T1
T2
T3
T4

Return Value

Type: Arguments
See Also

Reference

Arguments Class
Create Overload
PostSharp.Aspects Namespace


Arguments.Create(T0, T1, T2, T3, T4, T5) Method (T0, T1, T2, T3, T4, T5)

ArgumentsCreateT0, T1, T2, T3, T4, T5 Method (T0, T1, T2, T3, T4, T5)

Creates a strongly-typed Arguments object representing 6 arguments.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Arguments Create<T0, T1, T2, T3, T4, T5>(
    T0 arg0,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 args5
)

Parameters

arg0
Type: T0
arg1
Type: T1
arg2
Type: T2
arg3
Type: T3
arg4
Type: T4
args5
Type: T5

Type Parameters

T0
T1
T2
T3
T4
T5

Return Value

Type: Arguments
See Also

Reference

Arguments Class
Create Overload
PostSharp.Aspects Namespace


Arguments.Create(T0, T1, T2, T3, T4, T5, T6) Method (T0, T1, T2, T3, T4, T5, T6)

ArgumentsCreateT0, T1, T2, T3, T4, T5, T6 Method (T0, T1, T2, T3, T4, T5, T6)

Creates a strongly-typed Arguments object representing 7 arguments.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Arguments Create<T0, T1, T2, T3, T4, T5, T6>(
    T0 arg0,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 args5,
    T6 args6
)

Parameters

arg0
Type: T0
arg1
Type: T1
arg2
Type: T2
arg3
Type: T3
arg4
Type: T4
args5
Type: T5
args6
Type: T6

Type Parameters

T0
T1
T2
T3
T4
T5
T6

Return Value

Type: Arguments
See Also

Reference

Arguments Class
Create Overload
PostSharp.Aspects Namespace


Arguments.Create(T0, T1, T2, T3, T4, T5, T6, T7) Method (T0, T1, T2, T3, T4, T5, T6, T7)

ArgumentsCreateT0, T1, T2, T3, T4, T5, T6, T7 Method (T0, T1, T2, T3, T4, T5, T6, T7)

Creates a strongly-typed Arguments object representing 8 arguments.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Arguments Create<T0, T1, T2, T3, T4, T5, T6, T7>(
    T0 arg0,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 args5,
    T6 args6,
    T7 args7
)

Parameters

arg0
Type: T0
arg1
Type: T1
arg2
Type: T2
arg3
Type: T3
arg4
Type: T4
args5
Type: T5
args6
Type: T6
args7
Type: T7

Type Parameters

T0
T1
T2
T3
T4
T5
T6
T7

Return Value

Type: Arguments
See Also

Reference

Arguments Class
Create Overload
PostSharp.Aspects Namespace


Arguments.GetArgument Method

ArgumentsGetArgument Method

Gets the value of the argument at a given index.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual Object GetArgument(
    int index
)

Parameters

index
Type: SystemInt32
Argument index.

Return Value

Type: Object
The value of the argument at position index.
Exceptions
Exception | Condition
ArgumentOutOfRangeException | index is lower than zero or greater or equal than Count.
See Also

Reference

Arguments Class
PostSharp.Aspects Namespace


Arguments.GetEnumerator Method

ArgumentsGetEnumerator Method

Returns an enumerator that iterates through the collection.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IEnumerator<Object> GetEnumerator()

Return Value

Type: IEnumerator Object
An enumerator that can be used to iterate through the collection.

Implements

IEnumerableTGetEnumerator
See Also

Reference

Arguments Class
PostSharp.Aspects Namespace


Arguments.SetArgument Method

ArgumentsSetArgument Method

Sets the value of the argument at a given index.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void SetArgument(
    int index,
    Object value
)

Parameters

index
Type: SystemInt32
Argument index.
value
Type: SystemObject
New value of the argument at position index.
Exceptions
Exception | Condition
InvalidCastException | value is not assignable to parameter at position index.
ArgumentOutOfRangeException | index is lower than zero or greater or equal than Count.
See Also

Reference

Arguments Class
PostSharp.Aspects Namespace


Arguments.ToArray Method

ArgumentsToArray Method

Converts the current argument list into an Array.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Object[] ToArray()

Return Value

Type: Object
An Array whose elements are equal to the values encapsulated by the current Arguments.
See Also

Reference

Arguments Class
PostSharp.Aspects Namespace


Arguments Fields

The Arguments type exposes the following members.

Fields
Name | Description
Empty | Empty list of Arguments.
Top
See Also

Reference

Arguments Class
PostSharp.Aspects Namespace


Arguments.Empty Field

ArgumentsEmpty Field

Empty list of Arguments.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static readonly Arguments Empty

Field Value

Type: Arguments
See Also

Reference

Arguments Class
PostSharp.Aspects Namespace


Aspect Class

Base class for all aspects that are declared using multicast custom attributes (MulticastAttribute).
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
More...

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public abstract class Aspect : MulticastAttribute,
    IAspect, IAspectBuildSemantics, IValidableAnnotation

The Aspect type exposes the following members.

Constructors
 | Name | Description
Protected method | Aspect | Initializes a new instance of the Aspect class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect.
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime.
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element.
Top
Methods
 | Name | Description
Public method | CompileTimeValidate | Method invoked at build time to ensure that the aspect has been applied to the right target.
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type.
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect.
Protected method | SetAspectConfiguration | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.
Top
Remarks

This class is not specific to any kind of declaration (method, field, type, ...). Considering deriving your aspect from TypeLevelAspect, MethodLevelAspect, LocationLevelAspect, or EventLevelAspect if it should be applied to a specific kind of declarations.

Note Note
This class does not provide any advice. You may derive your aspect class from a class providing predefined advice , or build a composite aspect .

Note Note
All classes implementing IAspect should typically be marked as serializable using the SerializableAttribute or PSerializableAttribute custom attribute . Fields that are only used at runtime (and unknown at compile-time) should be carefully marked with the NonSerializedAttribute or PNonSerializedAttribute custom attribute. When PostSharp is used on a platform that does not support aspect serialization (such as .NET Compact Framework, Silverlight, or Windows Phone), or when another aspect serializer is used, it is not necessary to mark the aspect class as serializable. For more information, see Aspect Serialization .

See Also

Reference

PostSharp.Aspects Namespace

Other Resources

Conceptual: Aspect Classes
Conceptual: Developing Complex Aspects
Conceptual: Aspect Serialization
Conceptual: Understanding Attribute Multicasting
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsAssemblyLevelAspect
PostSharp.AspectsEventLevelAspect
PostSharp.AspectsFieldLevelAspect
PostSharp.AspectsLocationLevelAspect
PostSharp.AspectsMethodLevelAspect
PostSharp.AspectsTypeLevelAspect


Aspect Constructor

Initializes a new instance of the Aspect class

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected Aspect()
See Also

Reference

Aspect Class
PostSharp.Aspects Namespace


Aspect Properties

The Aspect type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect.
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime.
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element.
Top
See Also

Reference

Aspect Class
PostSharp.Aspects Namespace


Aspect.AspectPriority Property

AspectAspectPriority Property

Gets or sets the weaving priority of the aspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int AspectPriority { get; set; }

Property Value

Type: Int32
The aspect priority, or null if the aspect priority is not specified.
Remarks

Advices with lower priority are executed before in case of 'entry' semantics (entering or invoking a method, setting a field value), but this order is inverted for advices of 'exit' semantics (leaving a method, getting a field value).

This property must not be confused with AttributePriority, which solely influences the multicasting process.

See Also

Reference

Aspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Coping with Several Aspects on the Same Target
Conceptual: Coping with Several Aspects on the Same Target


Aspect.SerializerType Property

AspectSerializerType Property

Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected Type SerializerType { get; set; }

Property Value

Type: Type
See Also

Reference

Aspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Aspect Serialization


Aspect.UnsupportedTargetAction Property

AspectUnsupportedTargetAction Property

Specifies the action to take when the aspect is applied to an unsupported target element.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public UnsupportedTargetAction UnsupportedTargetAction { get; set; }

Property Value

Type: UnsupportedTargetAction
See Also

Reference

Aspect Class
PostSharp.Aspects Namespace


Aspect Methods

The Aspect type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeValidate | Method invoked at build time to ensure that the aspect has been applied to the right target.
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type.
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect.
Protected method | SetAspectConfiguration | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.
Top
See Also

Reference

Aspect Class
PostSharp.Aspects Namespace


Aspect.CompileTimeValidate Method

AspectCompileTimeValidate Method

Method invoked at build time to ensure that the aspect has been applied to the right target.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual bool CompileTimeValidate(
    Object target
)

Parameters

target
Type: SystemObject
Code element (Assembly, Type, FieldInfo, MethodBase, PropertyInfo, EventInfo, ParameterInfo, or LocationInfo) to which the aspect has been applied.

Return Value

Type: Boolean
true if the aspect was applied to an acceptable target, otherwise false.
Remarks
The implementation of this method is expected to emit an error message (see MessageSource) or an exception in case of error. Returning false without emitting an error message or exception causes the aspect to be silently ignored.
See Also

Reference

Aspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Validating Aspects
Conceptual: Adding Aspects to Multiple Declarations Using Attributes
Conceptual: Understanding Attribute Multicasting
Conceptual: Validating Aspect Usage


Aspect.CreateAspectConfiguration Method

AspectCreateAspectConfiguration Method

Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual AspectConfiguration CreateAspectConfiguration()

Return Value

Type: AspectConfiguration
A new and empty instance of AspectConfiguration, whose concrete type corresponds to the concrete type of the Aspect.
Remarks
This method should not set up the returned AspectConfiguration. After the current method has returned, the SetAspectConfiguration(AspectConfiguration, Object) method will be invoked, and this method is responsible for setting up the AspectConfigurationobject.
See Also

Reference

Aspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Configuring Aspects


Aspect.GetAspectConfiguration Method

AspectGetAspectConfiguration Method

Method invoked at build tome to get the imperative configuration of the current Aspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AspectConfiguration GetAspectConfiguration(
    Object targetElement
)

Parameters

targetElement
Type: SystemObject
Code element (Assembly, Type, FieldInfo, MethodBase, PropertyInfo, EventInfo, ParameterInfo, or LocationInfo) to which the current Aspect has been applied.

Return Value

Type: AspectConfiguration
An AspectConfiguration representing the imperative configuration of the current Aspect.

Implements

IAspectBuildSemanticsGetAspectConfiguration(Object)
Remarks

This method can be customized by overriding CreateAspectConfiguration and/or SetAspectConfiguration(AspectConfiguration, Object)

.
See Also

Reference

Aspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Configuring Aspects


Aspect.SetAspectConfiguration Method

AspectSetAspectConfiguration Method

Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void SetAspectConfiguration(
    AspectConfiguration aspectConfiguration,
    Object targetElement
)

Parameters

aspectConfiguration
Type: PostSharp.Aspects.ConfigurationAspectConfiguration
The AspectConfiguration instance previously returned by the CreateAspectConfiguration method.
targetElement
Type: SystemObject
Code element (Assembly, Type, FieldInfo, MethodBase, PropertyInfo, EventInfo, ParameterInfo, or LocationInfo) to which the current Aspect has been applied.
Remarks

Classes overriding this method must always invoke the base implementation before performing their own changes to the AspectConfiguration.

See Also

Reference

Aspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Configuring Aspects


AspectDescriptionAttribute Class

Custom attribute that, when applied to an aspect class, specifies a human-readable description of the aspect that can be displayed in PostSharp Tools for Visual Studio.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.AspectsAspectDescriptionAttribute

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class AspectDescriptionAttribute : Attribute

The AspectDescriptionAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | AspectDescriptionAttribute | Initializes a new instance of the AspectDescriptionAttribute class.
Top
Properties
 | Name | Description
Public property | Description | Gets a human-readable description of the aspect class to which the AspectDescriptionAttribute custom attribute is applied.
Top
Remarks

This attribute is intended to be used on simple aspects like OnMethodBoundaryAspect or MethodInterceptionArgs. For composite aspects, specify the description of each advice using the Description property.

See Also

Reference

PostSharp.Aspects Namespace

Other Resources

Conceptual: Customizing Aspect Description in Tooltips


AspectDescriptionAttribute Constructor

Initializes a new instance of the AspectDescriptionAttribute class.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AspectDescriptionAttribute(
    string description
)

Parameters

description
Type: SystemString
A human-readable description of the aspect class to which the AspectDescriptionAttribute custom attribute is applied.
See Also

Reference

AspectDescriptionAttribute Class
PostSharp.Aspects Namespace


AspectDescriptionAttribute Properties

The AspectDescriptionAttribute type exposes the following members.

Properties
 | Name | Description
Public property | Description | Gets a human-readable description of the aspect class to which the AspectDescriptionAttribute custom attribute is applied.
Top
See Also

Reference

AspectDescriptionAttribute Class
PostSharp.Aspects Namespace


AspectDescriptionAttribute.Description Property

AspectDescriptionAttributeDescription Property

Gets a human-readable description of the aspect class to which the AspectDescriptionAttribute custom attribute is applied.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string Description { get; }

Property Value

Type: String
See Also

Reference

AspectDescriptionAttribute Class
PostSharp.Aspects Namespace


AspectInfo Class

Reserved for future usage.
Inheritance Hierarchy
SystemObject
PostSharp.AspectsAspectInfo

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class AspectInfo

The AspectInfo type exposes the following members.

Constructors
 | Name | Description
Public method | AspectInfo | Initializes a new instance of the AspectInfo class
Top
See Also

Reference

PostSharp.Aspects Namespace


AspectInfo Constructor

Initializes a new instance of the AspectInfo class

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AspectInfo()
See Also

Reference

AspectInfo Class
PostSharp.Aspects Namespace


AspectInstance Class

Completely specifies an aspect instance, including its target code element. An AspectInstance contains either the aspect instance itself (Aspect property), either information allowing to construct the aspect (AspectConstruction) and configure the weaver (AspectConfiguration).
Inheritance Hierarchy
SystemObject
PostSharp.AspectsAspectSpecification
PostSharp.AspectsAspectInstance

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class AspectInstance : AspectSpecification

The AspectInstance type exposes the following members.

Constructors
 | Name | Description
Public method | AspectInstance(Object, IAspect) | Initializes a new AspectInstance from a runtime aspect instance (IAspect).
Public method | AspectInstance(Object, ObjectConstruction) | Initializes a new AspectInstance from an ObjectConstruction.
Public method | AspectInstance(Object, IAspect, AspectConfiguration) | Initializes a new AspectInstance from a runtime aspect instance (IAspect) and its AspectConfiguration.
Public method | AspectInstance(Object, ObjectConstruction, AspectConfiguration) | Initializes a new AspectInstance from an ObjectConstruction and specifies an AspectConfiguration object.
Top
Properties
 | Name | Description
Public property | Aspect | Gets the aspect instance. (Inherited from AspectSpecification.)
Public property | AspectAssemblyQualifiedTypeName | Gets the assembly-qualified type name of the aspect. (Inherited from AspectSpecification.)
Public property | AspectConfiguration | Gets the aspect configuration. (Inherited from AspectSpecification.)
Public property | AspectConstruction | Gets the aspect construction. (Inherited from AspectSpecification.)
Public property | AspectTypeName | Gets the type name of the aspect. (Inherited from AspectSpecification.)
Public property | RepresentAsStandalone | Determines whether the AspectInstance should be represented as a stand-alone instance in PostSharp Tools for Visual Studio. If false, the current AspectInstance will be not be represented as a standalone node, and its advices will be merged with the ones provided by the parent aspect (implementing IAspectProvider). The default value is false.
Public property | TargetElement | Gets the code element (Assembly, Type, FieldInfo, MethodBase, PropertyInfo, EventInfo, ParameterInfo, or LocationInfo) to which the current AspectInstance is applied.
Top
See Also

Reference

PostSharp.Aspects Namespace

Other Resources

Conceptual: Adding Aspects Dynamically
Conceptual: Adding Aspects Programmatically using IAspectProvider
Conceptual: Introducing Custom Attributes
Conceptual: Introducing Managed Resources


AspectInstance Constructor

Overload List
 | Name | Description
Public method | AspectInstance(Object, IAspect) | Initializes a new AspectInstance from a runtime aspect instance (IAspect).
Public method | AspectInstance(Object, ObjectConstruction) | Initializes a new AspectInstance from an ObjectConstruction.
Public method | AspectInstance(Object, IAspect, AspectConfiguration) | Initializes a new AspectInstance from a runtime aspect instance (IAspect) and its AspectConfiguration.
Public method | AspectInstance(Object, ObjectConstruction, AspectConfiguration) | Initializes a new AspectInstance from an ObjectConstruction and specifies an AspectConfiguration object.
Top
See Also

Reference

AspectInstance Class
PostSharp.Aspects Namespace


AspectInstance Constructor (Object, IAspect)

Initializes a new AspectInstance from a runtime aspect instance (IAspect).

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AspectInstance(
    Object targetElement,
    IAspect aspect
)

Parameters

targetElement
Type: SystemObject
Code element (Assembly, Type, FieldInfo, MethodBase, PropertyInfo, EventInfo, ParameterInfo, or LocationInfo) to which the current AspectInstance is applied.
aspect
Type: PostSharp.AspectsIAspect
The aspect runtime instance.
See Also

Reference

AspectInstance Class
AspectInstance Overload
PostSharp.Aspects Namespace


AspectInstance Constructor (Object, ObjectConstruction)

Initializes a new AspectInstance from an ObjectConstruction.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AspectInstance(
    Object targetElement,
    ObjectConstruction aspectConstruction
)

Parameters

targetElement
Type: SystemObject
Code element (Assembly, Type, FieldInfo, MethodBase, PropertyInfo, EventInfo, ParameterInfo, or LocationInfo) to which the current AspectInstance is applied.
aspectConstruction
Type: PostSharp.ReflectionObjectConstruction
An ObjectConstruction instructing how the aspect instance should be constructed.
See Also

Reference

AspectInstance Class
AspectInstance Overload
PostSharp.Aspects Namespace


AspectInstance Constructor (Object, IAspect, AspectConfiguration)

Initializes a new AspectInstance from a runtime aspect instance (IAspect) and its AspectConfiguration.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AspectInstance(
    Object targetElement,
    IAspect aspect,
    AspectConfiguration aspectConfiguration
)

Parameters

targetElement
Type: SystemObject
Code element (Assembly, Type, FieldInfo, MethodBase, PropertyInfo, EventInfo, ParameterInfo, or LocationInfo) to which the current AspectInstance is applied.
aspect
Type: PostSharp.AspectsIAspect
The aspect runtime instance.
aspectConfiguration
Type: PostSharp.Aspects.ConfigurationAspectConfiguration
The aspect configuration (the type of this parameter should be equal to the type configuration objects expected by the concrete aspect).
See Also

Reference

AspectInstance Class
AspectInstance Overload
PostSharp.Aspects Namespace


AspectInstance Constructor (Object, ObjectConstruction, AspectConfiguration)

Initializes a new AspectInstance from an ObjectConstruction and specifies an AspectConfiguration object.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AspectInstance(
    Object targetElement,
    ObjectConstruction aspectConstruction,
    AspectConfiguration aspectConfiguration
)

Parameters

targetElement
Type: SystemObject
Code element (Assembly, Type, FieldInfo, MethodBase, PropertyInfo, EventInfo, ParameterInfo, or LocationInfo) to which the current AspectInstance is applied.
aspectConstruction
Type: PostSharp.ReflectionObjectConstruction
An ObjectConstruction instructing how the aspect instance should be constructed.
aspectConfiguration
Type: PostSharp.Aspects.ConfigurationAspectConfiguration
An optional configuration object whose type corresponds to the aspect type.
See Also

Reference

AspectInstance Class
AspectInstance Overload
PostSharp.Aspects Namespace


AspectInstance Properties

The AspectInstance type exposes the following members.

Properties
 | Name | Description
Public property | Aspect | Gets the aspect instance. (Inherited from AspectSpecification.)
Public property | AspectAssemblyQualifiedTypeName | Gets the assembly-qualified type name of the aspect. (Inherited from AspectSpecification.)
Public property | AspectConfiguration | Gets the aspect configuration. (Inherited from AspectSpecification.)
Public property | AspectConstruction | Gets the aspect construction. (Inherited from AspectSpecification.)
Public property | AspectTypeName | Gets the type name of the aspect. (Inherited from AspectSpecification.)
Public property | RepresentAsStandalone | Determines whether the AspectInstance should be represented as a stand-alone instance in PostSharp Tools for Visual Studio. If false, the current AspectInstance will be not be represented as a standalone node, and its advices will be merged with the ones provided by the parent aspect (implementing IAspectProvider). The default value is false.
Public property | TargetElement | Gets the code element (Assembly, Type, FieldInfo, MethodBase, PropertyInfo, EventInfo, ParameterInfo, or LocationInfo) to which the current AspectInstance is applied.
Top
See Also

Reference

AspectInstance Class
PostSharp.Aspects Namespace


AspectInstance.RepresentAsStandalone Property

AspectInstanceRepresentAsStandalone Property

Determines whether the AspectInstance should be represented as a stand-alone instance in PostSharp Tools for Visual Studio. If false, the current AspectInstance will be not be represented as a standalone node, and its advices will be merged with the ones provided by the parent aspect (implementing IAspectProvider). The default value is false.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool RepresentAsStandalone { get; set; }

Property Value

Type: Boolean
See Also

Reference

AspectInstance Class
PostSharp.Aspects Namespace


AspectInstance.TargetElement Property

AspectInstanceTargetElement Property

Gets the code element (Assembly, Type, FieldInfo, MethodBase, PropertyInfo, EventInfo, ParameterInfo, or LocationInfo) to which the current AspectInstance is applied.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Object TargetElement { get; }

Property Value

Type: Object
See Also

Reference

AspectInstance Class
PostSharp.Aspects Namespace


AspectSpecification Class

Completely specifies an aspect instance (but not its target). An AspectSpecification either the aspect instance itself (Aspect property), either information allowing to construct the aspect (AspectConstruction) and configure the weaver (AspectConfiguration).
Inheritance Hierarchy
SystemObject
PostSharp.AspectsAspectSpecification
PostSharp.AspectsAspectInstance

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class AspectSpecification

The AspectSpecification type exposes the following members.

Constructors
 | Name | Description
Protected method | AspectSpecification | Initializes a new AspectSpecification when one cannot provide an aspect instance, i.e. from an ObjectConstruction and a AspectConfiguration.
Top
Properties
 | Name | Description
Public property | Aspect | Gets the aspect instance.
Public property | AspectAssemblyQualifiedTypeName | Gets the assembly-qualified type name of the aspect.
Public property | AspectConfiguration | Gets the aspect configuration.
Public property | AspectConstruction | Gets the aspect construction.
Public property | AspectTypeName | Gets the type name of the aspect.
Top
Remarks
User code cannot create an instance of the AspectSpecification class. Always create an instance of AspectInstance instead.
See Also

Reference

PostSharp.Aspects Namespace


AspectSpecification Constructor

Initializes a new AspectSpecification when one cannot provide an aspect instance, i.e. from an ObjectConstruction and a AspectConfiguration.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected AspectSpecification(
    ObjectConstruction aspectConstruction,
    AspectConfiguration aspectConfiguration
)

Parameters

aspectConstruction
Type: PostSharp.ReflectionObjectConstruction
Aspect construction.
aspectConfiguration
Type: PostSharp.Aspects.ConfigurationAspectConfiguration
Aspect configuration.
See Also

Reference

AspectSpecification Class
PostSharp.Aspects Namespace


AspectSpecification Properties

The AspectSpecification type exposes the following members.

Properties
 | Name | Description
Public property | Aspect | Gets the aspect instance.
Public property | AspectAssemblyQualifiedTypeName | Gets the assembly-qualified type name of the aspect.
Public property | AspectConfiguration | Gets the aspect configuration.
Public property | AspectConstruction | Gets the aspect construction.
Public property | AspectTypeName | Gets the type name of the aspect.
Top
See Also

Reference

AspectSpecification Class
PostSharp.Aspects Namespace


AspectSpecification.Aspect Property

AspectSpecificationAspect Property

Gets the aspect instance.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IAspect Aspect { get; }

Property Value

Type: IAspect
The aspect instance, or null if the AspectConfiguration was provided instead.
See Also

Reference

AspectSpecification Class
PostSharp.Aspects Namespace


AspectSpecification.AspectAssemblyQualifiedTypeName Property

AspectSpecificationAspectAssemblyQualifiedTypeName Property

Gets the assembly-qualified type name of the aspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string AspectAssemblyQualifiedTypeName { get; }

Property Value

Type: String
See Also

Reference

AspectSpecification Class
PostSharp.Aspects Namespace


AspectSpecification.AspectConfiguration Property

AspectSpecificationAspectConfiguration Property

Gets the aspect configuration.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AspectConfiguration AspectConfiguration { get; }

Property Value

Type: AspectConfiguration
The aspect configuration, or null if none was provided.
See Also

Reference

AspectSpecification Class
PostSharp.Aspects Namespace


AspectSpecification.AspectConstruction Property

AspectSpecificationAspectConstruction Property

Gets the aspect construction.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ObjectConstruction AspectConstruction { get; }

Property Value

Type: ObjectConstruction
The aspect construction, or null if the aspect instance was provided instead.
See Also

Reference

AspectSpecification Class
PostSharp.Aspects Namespace


AspectSpecification.AspectTypeName Property

AspectSpecificationAspectTypeName Property

Gets the type name of the aspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string AspectTypeName { get; }

Property Value

Type: String
See Also

Reference

AspectSpecification Class
PostSharp.Aspects Namespace


AspectUtilities Class

Utility methods for PostSharp.Aspects.
Inheritance Hierarchy
SystemObject
PostSharp.AspectsAspectUtilities

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class AspectUtilities

The AspectUtilities type exposes the following members.

Constructors
 | Name | Description
Public method | AspectUtilities | Initializes a new instance of the AspectUtilities class
Top
Methods
Name | Description
InitializeCurrentAspects | Initializes the all the aspects of the calling instance. This method must be invoked from an instance method (not a static method) of a type that has been enhanced by an aspect.
Top
See Also

Reference

PostSharp.Aspects Namespace


AspectUtilities Constructor

Initializes a new instance of the AspectUtilities class

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AspectUtilities()
See Also

Reference

AspectUtilities Class
PostSharp.Aspects Namespace


AspectUtilities Methods

The AspectUtilities type exposes the following members.

Methods
Name | Description
InitializeCurrentAspects | Initializes the all the aspects of the calling instance. This method must be invoked from an instance method (not a static method) of a type that has been enhanced by an aspect.
Top
See Also

Reference

AspectUtilities Class
PostSharp.Aspects Namespace


AspectUtilities.InitializeCurrentAspects Method

AspectUtilitiesInitializeCurrentAspects Method

Initializes the all the aspects of the calling instance. This method must be invoked from an instance method (not a static method) of a type that has been enhanced by an aspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void InitializeCurrentAspects()
Remarks

Calls to this method are transformed, at build time, to calls to this.InitializeAspects, a method that is typically generated by PostSharp. This is why the current method has actually no implementation.

The constructors of enhanced classes always initialize aspects. The only scenario where this method needs to be invoked manually is when instances are not built using the constructor, but for instance with the method GetUninitializedObject(Type).

See Also

Reference

AspectUtilities Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Coping with Custom Serializers
Conceptual: Coping with Custom Object Serializers


AssemblyLevelAspect Class

Base class for all aspects applied on assemblies.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsAssemblyLevelAspect
PostSharp.Patterns.Diagnostics.ThreadingInstrumentationThreadingInstrumentationPolicy
PostSharp.Patterns.ThreadingDeadlockDetectionPolicy

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public abstract class AssemblyLevelAspect : Aspect,
    IAssemblyLevelAspect, IAspect, IAssemblyLevelAspectBuildSemantics

The AssemblyLevelAspect type exposes the following members.

Constructors
 | Name | Description
Protected method | AssemblyLevelAspect | Initializes a new instance of the AssemblyLevelAspect class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Overrides AspectCompileTimeValidate(Object).)
Public method | CompileTimeValidate(Assembly) | Method invoked at build time to ensure that the aspect has been applied to the right target.
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Inherited from Aspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Overrides AspectSetAspectConfiguration(AspectConfiguration, Object).)
Protected method | SetAspectConfiguration(AspectConfiguration, Assembly) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.
Top
Remarks
Note Note
This class does not provide any advice. You may derive your aspect class from a class providing predefined advice , or build a composite aspect .

Note Note
All classes implementing IAspect should typically be marked as serializable using the SerializableAttribute or PSerializableAttribute custom attribute . Fields that are only used at runtime (and unknown at compile-time) should be carefully marked with the NonSerializedAttribute or PNonSerializedAttribute custom attribute. When PostSharp is used on a platform that does not support aspect serialization (such as .NET Compact Framework, Silverlight, or Windows Phone), or when another aspect serializer is used, it is not necessary to mark the aspect class as serializable. For more information, see Aspect Serialization .

See Also

Reference

PostSharp.Aspects Namespace
PostSharp.AspectsIAssemblyLevelAspect

Other Resources

Conceptual: Aspect Classes
Conceptual: Developing Complex Aspects
Conceptual: Aspect Serialization
Conceptual: Adding Behaviors to Existing Members
Conceptual: Developing Composite Aspects
Conceptual: Introducing Managed Resources
Conceptual: Upgrading from a Previous Version of PostSharp


AssemblyLevelAspect Constructor

Initializes a new instance of the AssemblyLevelAspect class

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected AssemblyLevelAspect()
See Also

Reference

AssemblyLevelAspect Class
PostSharp.Aspects Namespace


AssemblyLevelAspect Properties

The AssemblyLevelAspect type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

AssemblyLevelAspect Class
PostSharp.Aspects Namespace


AssemblyLevelAspect Methods

The AssemblyLevelAspect type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Overrides AspectCompileTimeValidate(Object).)
Public method | CompileTimeValidate(Assembly) | Method invoked at build time to ensure that the aspect has been applied to the right target.
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Inherited from Aspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Overrides AspectSetAspectConfiguration(AspectConfiguration, Object).)
Protected method | SetAspectConfiguration(AspectConfiguration, Assembly) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.
Top
See Also

Reference

AssemblyLevelAspect Class
PostSharp.Aspects Namespace


AssemblyLevelAspect.CompileTimeInitialize Method

AssemblyLevelAspectCompileTimeInitialize Method

Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void CompileTimeInitialize(
    Assembly assembly,
    AspectInfo aspectInfo
)

Parameters

assembly
Type: System.ReflectionAssembly
Assembly to which the current aspect is applied
aspectInfo
Type: PostSharp.AspectsAspectInfo
Reserved for future usage.

Implements

IAssemblyLevelAspectBuildSemanticsCompileTimeInitialize(Assembly, AspectInfo)
See Also

Reference

AssemblyLevelAspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Initializing Aspects


AssemblyLevelAspect.CompileTimeValidate Method

AssemblyLevelAspectCompileTimeValidate Method

Overload List
 | Name | Description
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Overrides AspectCompileTimeValidate(Object).)
Public method | CompileTimeValidate(Assembly) | Method invoked at build time to ensure that the aspect has been applied to the right target.
Top
See Also

Reference

AssemblyLevelAspect Class
PostSharp.Aspects Namespace


AssemblyLevelAspect.CompileTimeValidate Method (Object)

AssemblyLevelAspectCompileTimeValidate Method (Object)

Method invoked at build time to ensure that the aspect has been applied to the right target.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override sealed bool CompileTimeValidate(
    Object target
)

Parameters

target
Type: SystemObject
Code element (Assembly, Type, FieldInfo, MethodBase, PropertyInfo, EventInfo, ParameterInfo, or LocationInfo) to which the aspect has been applied.

Return Value

Type: Boolean
true if the aspect was applied to an acceptable target, otherwise false.
Remarks
The implementation of this method is expected to emit an error message (see MessageSource) or an exception in case of error. Returning false without emitting an error message or exception causes the aspect to be silently ignored.
See Also

Reference

AssemblyLevelAspect Class
CompileTimeValidate Overload
PostSharp.Aspects Namespace

Other Resources

Conceptual: Validating Aspects
Conceptual: Adding Aspects to Multiple Declarations Using Attributes
Conceptual: Understanding Attribute Multicasting


AssemblyLevelAspect.CompileTimeValidate Method (Assembly)

AssemblyLevelAspectCompileTimeValidate Method (Assembly)

Method invoked at build time to ensure that the aspect has been applied to the right target.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual bool CompileTimeValidate(
    Assembly assembly
)

Parameters

assembly
Type: System.ReflectionAssembly
Assembly on which the current aspect is applied.

Return Value

Type: Boolean
true if the aspect was applied to an acceptable target, otherwise false.
Remarks
The implementation of this method is expected to emit an error message (see MessageSource) or an exception in case of error. Returning false without emitting an error message or exception causes the aspect to be silently ignored.
See Also

Reference

AssemblyLevelAspect Class
CompileTimeValidate Overload
PostSharp.Aspects Namespace

Other Resources

Conceptual: Validating Aspects
Conceptual: Validating Aspect Usage


AssemblyLevelAspect.SetAspectConfiguration Method

AssemblyLevelAspectSetAspectConfiguration Method

Overload List
 | Name | Description
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Overrides AspectSetAspectConfiguration(AspectConfiguration, Object).)
Protected method | SetAspectConfiguration(AspectConfiguration, Assembly) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.
Top
See Also

Reference

AssemblyLevelAspect Class
PostSharp.Aspects Namespace


AssemblyLevelAspect.SetAspectConfiguration Method (AspectConfiguration, Object)

AssemblyLevelAspectSetAspectConfiguration Method (AspectConfiguration, Object)

Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override sealed void SetAspectConfiguration(
    AspectConfiguration aspectConfiguration,
    Object targetElement
)

Parameters

aspectConfiguration
Type: PostSharp.Aspects.ConfigurationAspectConfiguration
The AspectConfiguration instance previously returned by the CreateAspectConfiguration method.
targetElement
Type: SystemObject
Code element (Assembly, Type, FieldInfo, MethodBase, PropertyInfo, EventInfo, ParameterInfo, or LocationInfo) to which the current Aspect has been applied.
Remarks

Classes overriding this method must always invoke the base implementation before performing their own changes to the AspectConfiguration.

See Also

Reference

AssemblyLevelAspect Class
SetAspectConfiguration Overload
PostSharp.Aspects Namespace

Other Resources

Conceptual: Configuring Aspects


AssemblyLevelAspect.SetAspectConfiguration Method (AspectConfiguration, Assembly)

AssemblyLevelAspectSetAspectConfiguration Method (AspectConfiguration, Assembly)

Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void SetAspectConfiguration(
    AspectConfiguration aspectConfiguration,
    Assembly targetAssembly
)

Parameters

aspectConfiguration
Type: PostSharp.Aspects.ConfigurationAspectConfiguration
The AspectConfiguration instance previously returned by the CreateAspectConfiguration method.
targetAssembly
Type: System.ReflectionAssembly
Assembly to which the current aspect has been applied.
Remarks

Classes overriding this method must always invoke the base implementation before performing their own changes to the AspectConfiguration.

See Also

Reference

AssemblyLevelAspect Class
SetAspectConfiguration Overload
PostSharp.Aspects Namespace

Other Resources

Conceptual: Configuring Aspects


AsyncCallId Structure

Identifier of an asynchronous method invocation, i.e. of a unique async state machine instance.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public struct AsyncCallId : IEquatable<AsyncCallId>

The AsyncCallId type exposes the following members.

Properties
 | Name | Description
Public property | IsNull | Determines whether the current AsyncCallId is null.
 | Null | Gets a null instance of the AsyncCallId struct.
Top
Methods
 | Name | Description
Public method | Equals(Object) | Indicates whether this instance and a specified object are equal. (Overrides ValueTypeEquals(Object).)
Public method | Equals(AsyncCallId) | Indicates whether the current object is equal to another object of the same type.
Public method | GetHashCode | Returns the hash code for this instance. (Overrides ValueTypeGetHashCode.)
Public method | ToString | Returns the fully qualified type name of this instance. (Overrides ValueTypeToString.)
Top
Operators
Name | Description
Equality | Determines whether two instances of the AsyncCallId type are equal.
Inequality | Determines whether two instances of the AsyncCallId type are different.
Top
See Also

Reference

PostSharp.Aspects Namespace


AsyncCallId Properties

The AsyncCallId type exposes the following members.

Properties
 | Name | Description
Public property | IsNull | Determines whether the current AsyncCallId is null.
 | Null | Gets a null instance of the AsyncCallId struct.
Top
See Also

Reference

AsyncCallId Structure
PostSharp.Aspects Namespace


AsyncCallId.IsNull Property

AsyncCallIdIsNull Property

Determines whether the current AsyncCallId is null.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsNull { get; }

Property Value

Type: Boolean
See Also

Reference

AsyncCallId Structure
PostSharp.Aspects Namespace


AsyncCallId.Null Property

AsyncCallIdNull Property

Gets a null instance of the AsyncCallId struct.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static AsyncCallId Null { get; }

Property Value

Type: AsyncCallId
See Also

Reference

AsyncCallId Structure
PostSharp.Aspects Namespace


AsyncCallId Methods

The AsyncCallId type exposes the following members.

Methods
 | Name | Description
Public method | Equals(Object) | Indicates whether this instance and a specified object are equal. (Overrides ValueTypeEquals(Object).)
Public method | Equals(AsyncCallId) | Indicates whether the current object is equal to another object of the same type.
Public method | GetHashCode | Returns the hash code for this instance. (Overrides ValueTypeGetHashCode.)
Public method | ToString | Returns the fully qualified type name of this instance. (Overrides ValueTypeToString.)
Top
See Also

Reference

AsyncCallId Structure
PostSharp.Aspects Namespace


AsyncCallId.Equals Method

AsyncCallIdEquals Method

Overload List
 | Name | Description
Public method | Equals(Object) | Indicates whether this instance and a specified object are equal. (Overrides ValueTypeEquals(Object).)
Public method | Equals(AsyncCallId) | Indicates whether the current object is equal to another object of the same type.
Top
See Also

Reference

AsyncCallId Structure
PostSharp.Aspects Namespace


AsyncCallId.Equals Method (Object)

AsyncCallIdEquals Method (Object)

Indicates whether this instance and a specified object are equal.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool Equals(
    Object obj
)

Parameters

obj
Type: SystemObject
The object to compare with the current instance.

Return Value

Type: Boolean
true if obj and this instance are the same type and represent the same value; otherwise, false.
See Also

Reference

AsyncCallId Structure
Equals Overload
PostSharp.Aspects Namespace


AsyncCallId.Equals Method (AsyncCallId)

AsyncCallIdEquals Method (AsyncCallId)

Indicates whether the current object is equal to another object of the same type.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Equals(
    AsyncCallId other
)

Parameters

other
Type: PostSharp.AspectsAsyncCallId
An object to compare with this object.

Return Value

Type: Boolean
true if the current object is equal to the other parameter; otherwise, false.

Implements

IEquatableTEquals(T)
See Also

Reference

AsyncCallId Structure
Equals Overload
PostSharp.Aspects Namespace


AsyncCallId.GetHashCode Method

AsyncCallIdGetHashCode Method

Returns the hash code for this instance.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override int GetHashCode()

Return Value

Type: Int32
A 32-bit signed integer that is the hash code for this instance.
See Also

Reference

AsyncCallId Structure
PostSharp.Aspects Namespace


AsyncCallId.ToString Method

AsyncCallIdToString Method

Returns the fully qualified type name of this instance.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override string ToString()

Return Value

Type: String
A String containing a fully qualified type name.
See Also

Reference

AsyncCallId Structure
PostSharp.Aspects Namespace


AsyncCallId Operators

The AsyncCallId type exposes the following members.

Operators
Name | Description
Equality | Determines whether two instances of the AsyncCallId type are equal.
Inequality | Determines whether two instances of the AsyncCallId type are different.
Top
See Also

Reference

AsyncCallId Structure
PostSharp.Aspects Namespace


AsyncCallId.Equality Operator

AsyncCallIdEquality Operator

Determines whether two instances of the AsyncCallId type are equal.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool operator ==(
    AsyncCallId left,
    AsyncCallId right
)

Parameters

left
Type: PostSharp.AspectsAsyncCallId
right
Type: PostSharp.AspectsAsyncCallId

Return Value

Type: Boolean
See Also

Reference

AsyncCallId Structure
PostSharp.Aspects Namespace


AsyncCallId.Inequality Operator

AsyncCallIdInequality Operator

Determines whether two instances of the AsyncCallId type are different.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool operator !=(
    AsyncCallId left,
    AsyncCallId right
)

Parameters

left
Type: PostSharp.AspectsAsyncCallId
right
Type: PostSharp.AspectsAsyncCallId

Return Value

Type: Boolean
See Also

Reference

AsyncCallId Structure
PostSharp.Aspects Namespace


CompositionAspect Class

Aspect that, when applied on a type, introduces one or many new interfaces into that type.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsTypeLevelAspect
PostSharp.AspectsCompositionAspect

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public abstract class CompositionAspect : TypeLevelAspect,
    ICompositionAspect, ITypeLevelAspect, IAspect

The CompositionAspect type exposes the following members.

Constructors
 | Name | Description
Protected method | CompositionAspect | Initializes a new instance of the CompositionAspect class
Top
Properties
 | Name | Description
Protected property | AncestorOverrideAction | Specifies the action (Fail or Ignore) to be overtaken when an ancestor of one of the interfaces returned by GetPublicInterfaces(Type) is already implemented by the type to which the current aspect is applied.
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | GenerateImplementationAccessor | Determines whether the interface [!:IComposed<T>] should be introduced into the type to which the aspect is applied for each interface returned by the GetPublicInterfaces(Type) method.
Protected property | NonSerializedImplementation | Determines whether the field containing the interface implementation (and storing the object returned by CreateImplementationObject(AdviceArgs)) should be excluded from serialization by BinaryFormatter. The same effect is typically obtained by applying the NonSerializedAttribute custom attribute to the field.
Protected property | OverrideAction | Specifies the action (Fail or Ignore) to be overtaken when one of the interfaces returned by the GetPublicInterfaces(Type) method is already implemented by the type to which the current aspect is applied.
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Overrides AspectCreateAspectConfiguration.)
Public method | CreateImplementationObject | Method invoked at runtime, during the initialization of instances of the target type, to create the composed object.
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Protected method | GetPublicInterfaces | Gets the array of interfaces that should be introduced publicly into the target type of the current aspect.
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from TypeLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, Type) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Overrides TypeLevelAspectSetAspectConfiguration(AspectConfiguration, Type).)
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from TypeLevelAspect.)
Top
Remarks
Note Note
Consider using a composite aspect and introducing an interface using IntroduceMemberAttribute instead of using a CompositionAspect.

The GetPublicInterfaces(Type) method is invoked at build time. At runtime, the method CreateImplementationObject(AdviceArgs) should return an object implementing all interfaces.

Use the Post.CastSourceType, TargetType(SourceType) method to cast the enhanced type to the newly implemented interface. This cast is verified during post-compilation.

Properties OverrideAction and AncestorOverrideAction determine what should happen if the target type already implements the interface directly or indirectly.

By default, the object implementing the interface is stored as a serializable field. If the property NonSerializedImplementation is set to true, this field will be marked as NonSerializedAttribute.

Note Note
All classes implementing IAspect should typically be marked as serializable using the SerializableAttribute or PSerializableAttribute custom attribute . Fields that are only used at runtime (and unknown at compile-time) should be carefully marked with the NonSerializedAttribute or PNonSerializedAttribute custom attribute. When PostSharp is used on a platform that does not support aspect serialization (such as .NET Compact Framework, Silverlight, or Windows Phone), or when another aspect serializer is used, it is not necessary to mark the aspect class as serializable. For more information, see Aspect Serialization .

See Also

Reference

PostSharp.Aspects Namespace
PostSharp.Aspects.AdvicesIntroduceInterfaceAttribute

Other Resources

Conceptual: Aspect Serialization
Conceptual: Introducing Interfaces
Conceptual: Introducing Interfaces, Methods, Properties and Events into Existing Classes


CompositionAspect Constructor

Initializes a new instance of the CompositionAspect class

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected CompositionAspect()
See Also

Reference

CompositionAspect Class
PostSharp.Aspects Namespace


CompositionAspect Properties

The CompositionAspect type exposes the following members.

Properties
 | Name | Description
Protected property | AncestorOverrideAction | Specifies the action (Fail or Ignore) to be overtaken when an ancestor of one of the interfaces returned by GetPublicInterfaces(Type) is already implemented by the type to which the current aspect is applied.
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | GenerateImplementationAccessor | Determines whether the interface [!:IComposed<T>] should be introduced into the type to which the aspect is applied for each interface returned by the GetPublicInterfaces(Type) method.
Protected property | NonSerializedImplementation | Determines whether the field containing the interface implementation (and storing the object returned by CreateImplementationObject(AdviceArgs)) should be excluded from serialization by BinaryFormatter. The same effect is typically obtained by applying the NonSerializedAttribute custom attribute to the field.
Protected property | OverrideAction | Specifies the action (Fail or Ignore) to be overtaken when one of the interfaces returned by the GetPublicInterfaces(Type) method is already implemented by the type to which the current aspect is applied.
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

CompositionAspect Class
PostSharp.Aspects Namespace


CompositionAspect.AncestorOverrideAction Property

CompositionAspectAncestorOverrideAction Property

Specifies the action (Fail or Ignore) to be overtaken when an ancestor of one of the interfaces returned by GetPublicInterfaces(Type) is already implemented by the type to which the current aspect is applied.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected InterfaceOverrideAction AncestorOverrideAction { get; set; }

Property Value

Type: InterfaceOverrideAction
See Also

Reference

CompositionAspect Class
PostSharp.Aspects Namespace
CompositionAspectOverrideAction


CompositionAspect.GenerateImplementationAccessor Property

CompositionAspectGenerateImplementationAccessor Property

Determines whether the interface [!:IComposed<T>] should be introduced into the type to which the aspect is applied for each interface returned by the GetPublicInterfaces(Type) method.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected bool GenerateImplementationAccessor { get; set; }

Property Value

Type: Boolean
See Also

Reference

CompositionAspect Class
PostSharp.Aspects Namespace


CompositionAspect.NonSerializedImplementation Property

CompositionAspectNonSerializedImplementation Property

Determines whether the field containing the interface implementation (and storing the object returned by CreateImplementationObject(AdviceArgs)) should be excluded from serialization by BinaryFormatter. The same effect is typically obtained by applying the NonSerializedAttribute custom attribute to the field.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected bool NonSerializedImplementation { get; set; }

Property Value

Type: Boolean
See Also

Reference

CompositionAspect Class
PostSharp.Aspects Namespace


CompositionAspect.OverrideAction Property

CompositionAspectOverrideAction Property

Specifies the action (Fail or Ignore) to be overtaken when one of the interfaces returned by the GetPublicInterfaces(Type) method is already implemented by the type to which the current aspect is applied.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected InterfaceOverrideAction OverrideAction { get; set; }

Property Value

Type: InterfaceOverrideAction
See Also

Reference

CompositionAspect Class
PostSharp.Aspects Namespace
CompositionAspectAncestorOverrideAction


CompositionAspect Methods

The CompositionAspect type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Overrides AspectCreateAspectConfiguration.)
Public method | CreateImplementationObject | Method invoked at runtime, during the initialization of instances of the target type, to create the composed object.
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Protected method | GetPublicInterfaces | Gets the array of interfaces that should be introduced publicly into the target type of the current aspect.
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from TypeLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, Type) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Overrides TypeLevelAspectSetAspectConfiguration(AspectConfiguration, Type).)
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from TypeLevelAspect.)
Top
See Also

Reference

CompositionAspect Class
PostSharp.Aspects Namespace


CompositionAspect.CreateAspectConfiguration Method

CompositionAspectCreateAspectConfiguration Method

Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override sealed AspectConfiguration CreateAspectConfiguration()

Return Value

Type: AspectConfiguration
A new and empty instance of AspectConfiguration, whose concrete type corresponds to the concrete type of the Aspect.
Remarks
This method should not set up the returned AspectConfiguration. After the current method has returned, the SetAspectConfiguration(AspectConfiguration, Object) method will be invoked, and this method is responsible for setting up the AspectConfigurationobject.
See Also

Reference

CompositionAspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Configuring Aspects


CompositionAspect.CreateImplementationObject Method

CompositionAspectCreateImplementationObject Method

Method invoked at runtime, during the initialization of instances of the target type, to create the composed object.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract Object CreateImplementationObject(
    AdviceArgs args
)

Parameters

args
Type: PostSharp.AspectsAdviceArgs

Return Value

Type: Object
The composed object. This interface should implement the interfaces specified by the GetPublicInterfaces(Type) method.

Implements

ICompositionAspectCreateImplementationObject(AdviceArgs)
Remarks
This method is invoked during at runtime after the base constructor has executed, and before the constructor of the current type is executed.
See Also

Reference

CompositionAspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Introducing Interfaces, Methods, Properties and Events into Existing Classes


CompositionAspect.GetPublicInterfaces Method

CompositionAspectGetPublicInterfaces Method

Gets the array of interfaces that should be introduced publicly into the target type of the current aspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual Type[] GetPublicInterfaces(
    Type targetType
)

Parameters

targetType
Type: SystemType
Type to which the current aspect is applied.

Return Value

Type: Type
The array of interfaces that should be introduced publicly into Type targetType, or null if no interface should be introduced publicly.
See Also

Reference

CompositionAspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Introducing Interfaces, Methods, Properties and Events into Existing Classes


CompositionAspect.SetAspectConfiguration Method

CompositionAspectSetAspectConfiguration Method

Overload List
 | Name | Description
Protected method | SetAspectConfiguration(AspectConfiguration, Type) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Overrides TypeLevelAspectSetAspectConfiguration(AspectConfiguration, Type).)
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from TypeLevelAspect.)
Top
See Also

Reference

CompositionAspect Class
PostSharp.Aspects Namespace


CompositionAspect.SetAspectConfiguration Method (AspectConfiguration, Type)

CompositionAspectSetAspectConfiguration Method (AspectConfiguration, Type)

Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void SetAspectConfiguration(
    AspectConfiguration aspectConfiguration,
    Type targetType
)

Parameters

aspectConfiguration
Type: PostSharp.Aspects.ConfigurationAspectConfiguration
The AspectConfiguration instance previously returned by the CreateAspectConfiguration method.
targetType
Type: SystemType
Type to which the current aspect has been applied.
Remarks

Classes overriding this method must always invoke the base implementation before performing their own changes to the AspectConfiguration.

See Also

Reference

CompositionAspect Class
SetAspectConfiguration Overload
PostSharp.Aspects Namespace

Other Resources

Conceptual: Configuring Aspects


ConstructorDepth Structure

System type used in the implementation of the OnInstanceConstructedAdvice. Do not use in user code.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public struct ConstructorDepth

The ConstructorDepth type exposes the following members.

Properties
 | Name | Description
Public property | IsZero | Determines whether the current depth is zero.
 | Zero | Gets a ConstructorDepth instance representing zero.
Top
Methods
 | Name | Description
Public method | Increment | Creates a new instance of the ConstructorDepth type with a depth level that is one more than the current one.
Public method | ToString | Returns the fully qualified type name of this instance. (Overrides ValueTypeToString.)
Top
See Also

Reference

PostSharp.Aspects Namespace


ConstructorDepth Properties

The ConstructorDepth type exposes the following members.

Properties
 | Name | Description
Public property | IsZero | Determines whether the current depth is zero.
 | Zero | Gets a ConstructorDepth instance representing zero.
Top
See Also

Reference

ConstructorDepth Structure
PostSharp.Aspects Namespace


ConstructorDepth.IsZero Property

ConstructorDepthIsZero Property

Determines whether the current depth is zero.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsZero { get; }

Property Value

Type: Boolean
See Also

Reference

ConstructorDepth Structure
PostSharp.Aspects Namespace


ConstructorDepth.Zero Property

ConstructorDepthZero Property

Gets a ConstructorDepth instance representing zero.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static ConstructorDepth Zero { get; }

Property Value

Type: ConstructorDepth
See Also

Reference

ConstructorDepth Structure
PostSharp.Aspects Namespace


ConstructorDepth Methods

The ConstructorDepth type exposes the following members.

Methods
 | Name | Description
Public method | Increment | Creates a new instance of the ConstructorDepth type with a depth level that is one more than the current one.
Public method | ToString | Returns the fully qualified type name of this instance. (Overrides ValueTypeToString.)
Top
See Also

Reference

ConstructorDepth Structure
PostSharp.Aspects Namespace


ConstructorDepth.Increment Method

ConstructorDepthIncrement Method

Creates a new instance of the ConstructorDepth type with a depth level that is one more than the current one.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ConstructorDepth Increment()

Return Value

Type: ConstructorDepth
A new ConstructorDepth, incremented of one from the current ConstructorDepth.
See Also

Reference

ConstructorDepth Structure
PostSharp.Aspects Namespace


ConstructorDepth.ToString Method

ConstructorDepthToString Method

Returns the fully qualified type name of this instance.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override string ToString()

Return Value

Type: String
A String containing a fully qualified type name.
See Also

Reference

ConstructorDepth Structure
PostSharp.Aspects Namespace


CustomAttributeIntroductionAspect Class

Aspect that, when applied to a target, adds a custom attribute to this target.
Inheritance Hierarchy
SystemObject
PostSharp.AspectsCustomAttributeIntroductionAspect

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class CustomAttributeIntroductionAspect : ICustomAttributeIntroductionAspect,
    IAspect, IAspectBuildSemantics, IValidableAnnotation

The CustomAttributeIntroductionAspect type exposes the following members.

Constructors
 | Name | Description
Public method | CustomAttributeIntroductionAspect(CustomAttributeData) | Initializes a new CustomAttributeIntroductionAspect by specifying a CustomAttributeData.
Public method | CustomAttributeIntroductionAspect(ObjectConstruction) | Initializes a new CustomAttributeIntroductionAspect by specifying an ObjectConstruction.
Top
Properties
 | Name | Description
Public property | CustomAttribute | Gets the construction of the custom attribute that must be applied to the target of this aspect.
Top
Remarks

There are two ways to specify a custom attribute: either using an ObjectConstruction (to construct a new custom attribute), either a CustomAttributeData (to copy a custom attribute reflected using one of the overload of the method GetCustomAttributes(Assembly)/

Note Note
This aspect is not a custom attribute. You have to create another aspect implementing IAspectProvider and have the method ProvideAspects(Object) return instances of this aspect.
See Also

Reference

PostSharp.Aspects Namespace

Other Resources

Conceptual: Adding Aspects Dynamically
Conceptual: Introducing Custom Attributes


CustomAttributeIntroductionAspect Constructor

Overload List
 | Name | Description
Public method | CustomAttributeIntroductionAspect(CustomAttributeData) | Initializes a new CustomAttributeIntroductionAspect by specifying a CustomAttributeData.
Public method | CustomAttributeIntroductionAspect(ObjectConstruction) | Initializes a new CustomAttributeIntroductionAspect by specifying an ObjectConstruction.
Top
See Also

Reference

CustomAttributeIntroductionAspect Class
PostSharp.Aspects Namespace


CustomAttributeIntroductionAspect Constructor (CustomAttributeData)

Initializes a new CustomAttributeIntroductionAspect by specifying a CustomAttributeData.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CustomAttributeIntroductionAspect(
    CustomAttributeData customAttributeData
)

Parameters

customAttributeData
Type: System.ReflectionCustomAttributeData
Construction of the custom attribute to be added to the target.
See Also

Reference

CustomAttributeIntroductionAspect Class
CustomAttributeIntroductionAspect Overload
PostSharp.Aspects Namespace


CustomAttributeIntroductionAspect Constructor (ObjectConstruction)

Initializes a new CustomAttributeIntroductionAspect by specifying an ObjectConstruction.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CustomAttributeIntroductionAspect(
    ObjectConstruction attribute
)

Parameters

attribute
Type: PostSharp.ReflectionObjectConstruction
Construction of the custom attribute to be added to the target.
See Also

Reference

CustomAttributeIntroductionAspect Class
CustomAttributeIntroductionAspect Overload
PostSharp.Aspects Namespace


CustomAttributeIntroductionAspect Properties

The CustomAttributeIntroductionAspect type exposes the following members.

Properties
 | Name | Description
Public property | CustomAttribute | Gets the construction of the custom attribute that must be applied to the target of this aspect.
Top
See Also

Reference

CustomAttributeIntroductionAspect Class
PostSharp.Aspects Namespace


CustomAttributeIntroductionAspect.CustomAttribute Property

CustomAttributeIntroductionAspectCustomAttribute Property

Gets the construction of the custom attribute that must be applied to the target of this aspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ObjectConstruction CustomAttribute { get; }

Property Value

Type: ObjectConstruction
See Also

Reference

CustomAttributeIntroductionAspect Class
PostSharp.Aspects Namespace


EventInterceptionArgs Class

Arguments of handlers of aspects of the type EventInterceptionAspect.
Inheritance Hierarchy
SystemObject
PostSharp.AspectsAdviceArgs
PostSharp.AspectsEventInterceptionArgs

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class EventInterceptionArgs : AdviceArgs

The EventInterceptionArgs type exposes the following members.

Properties
 | Name | Description
Public property | Arguments | Gets the delegate arguments.
Public property | Binding | Gets an interface that allows to invoke the next node in the chain of invocation of the intercepted method.
Public property | DeclarationIdentifier | Gets the DeclarationIdentifier of the declaration to which the advice has been applied. (Inherited from AdviceArgs.)
Public property | Event | Gets the event to which the current aspect has been applied.
Public property | Handler | Gets the delegate being added, removed, or invoked.
Public property | Instance | Gets or sets the object instance on which the method is being executed. (Inherited from AdviceArgs.)
Public property | ReturnValue | Gets the return value of the delegate.
Top
Methods
 | Name | Description
Public method | AddHandler | Adds a handler to the event by invoking the Add semantic of the next node in the chain of invocation.
Public method | InvokeHandler | Invokes a handler by calling the Invoke semantic of the next node in the chain of invocation.
Public method | ProceedAddHandler | Proceeds with adding the Delegate to the event to which the current aspect. This method invokes the next handler in chain. It is typically invoked from the implementation of OnAddHandler(EventInterceptionArgs).
Public method | ProceedInvokeHandler | Proceeds with invoking the Delegate with the arguments specified in the Arguments property. The delegate may change the Arguments and set the ReturnValue. This method invokes the next handler in chain. It is typically invoked from the implementation of OnInvokeHandler(EventInterceptionArgs).
Public method | ProceedRemoveHandler | Proceeds with removing the Delegate from the event to which the current aspect. This method invokes the next handler in chain. It is typically invoked from the implementation of OnRemoveHandler(EventInterceptionArgs).
Public method | RemoveHandler | Removes a handler from the event by invoking the Remove semantic of the next node in the chain of invocation.
Top
Remarks
Note Note
As a result of weaving optimizations, instances of classes derived from AdviceArgs may be shared among different aspects. Therefore, aspect code should not attempt to access this object once the control has been given over to the next node in the chain of invocation. Consider working with aspect bindings if you need such deferred execution.
Note Note
Aspect weaving optimizations may also cause an advice parameter of this type to be seen null when inspecting it in a debugger. If you need to inspect the instance in runtime, consider disabling aspect optimizations in the debug build configuration.
See Also

Reference

PostSharp.Aspects Namespace
PostSharp.AspectsEventInterceptionAspect
PostSharp.AspectsEventInterceptionAspect

Other Resources

Conceptual: Aspect Bindings


EventInterceptionArgs Properties

The EventInterceptionArgs type exposes the following members.

Properties
 | Name | Description
Public property | Arguments | Gets the delegate arguments.
Public property | Binding | Gets an interface that allows to invoke the next node in the chain of invocation of the intercepted method.
Public property | DeclarationIdentifier | Gets the DeclarationIdentifier of the declaration to which the advice has been applied. (Inherited from AdviceArgs.)
Public property | Event | Gets the event to which the current aspect has been applied.
Public property | Handler | Gets the delegate being added, removed, or invoked.
Public property | Instance | Gets or sets the object instance on which the method is being executed. (Inherited from AdviceArgs.)
Public property | ReturnValue | Gets the return value of the delegate.
Top
See Also

Reference

EventInterceptionArgs Class
PostSharp.Aspects Namespace


EventInterceptionArgs.Arguments Property

EventInterceptionArgsArguments Property

Gets the delegate arguments.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Arguments Arguments { get; }

Property Value

Type: Arguments
Remarks

This property is meaningful only during a delegate invocation (not during an addition or removal).

This property is typically accessed by the ProceedInvokeHandler method. Implementations of OnInvokeHandler(EventInterceptionArgs) can also get or change the value of this property.

See Also

Reference

EventInterceptionArgs Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Intercepting Events


EventInterceptionArgs.Binding Property

EventInterceptionArgsBinding Property

Gets an interface that allows to invoke the next node in the chain of invocation of the intercepted method.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract IEventBinding Binding { get; }

Property Value

Type: IEventBinding
Remarks

Bindings are thread-safe and context-free singleton instances exposing the next node in the chain of invocation.

See Also

Reference

EventInterceptionArgs Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Aspect Bindings


EventInterceptionArgs.Event Property

EventInterceptionArgsEvent Property

Gets the event to which the current aspect has been applied.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public EventInfo Event { get; set; }

Property Value

Type: EventInfo
Remarks
Note Note
Using this property causes the aspect weaver to generate code that has non-trivial runtime overhead. Avoid using this property whenever possible. One of the possible solution is to use compile-time initialization of aspect instances and to make use of reflection only at build time.
See Also

Reference

EventInterceptionArgs Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Intercepting Events


EventInterceptionArgs.Handler Property

EventInterceptionArgsHandler Property

Gets the delegate being added, removed, or invoked.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Delegate Handler { get; }

Property Value

Type: Delegate
See Also

Reference

EventInterceptionArgs Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Intercepting Events


EventInterceptionArgs.ReturnValue Property

EventInterceptionArgsReturnValue Property

Gets the return value of the delegate.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Object ReturnValue { get; set; }

Property Value

Type: Object
Remarks

This property is meaningful only during a delegate invocation (not during an addition or removal).

This property is typically set by the ProceedInvokeHandler method. It is also legal for an implementation of OnInvokeHandler(EventInterceptionArgs) to change the value of this property.

See Also

Reference

EventInterceptionArgs Class
PostSharp.Aspects Namespace


EventInterceptionArgs Methods

The EventInterceptionArgs type exposes the following members.

Methods
 | Name | Description
Public method | AddHandler | Adds a handler to the event by invoking the Add semantic of the next node in the chain of invocation.
Public method | InvokeHandler | Invokes a handler by calling the Invoke semantic of the next node in the chain of invocation.
Public method | ProceedAddHandler | Proceeds with adding the Delegate to the event to which the current aspect. This method invokes the next handler in chain. It is typically invoked from the implementation of OnAddHandler(EventInterceptionArgs).
Public method | ProceedInvokeHandler | Proceeds with invoking the Delegate with the arguments specified in the Arguments property. The delegate may change the Arguments and set the ReturnValue. This method invokes the next handler in chain. It is typically invoked from the implementation of OnInvokeHandler(EventInterceptionArgs).
Public method | ProceedRemoveHandler | Proceeds with removing the Delegate from the event to which the current aspect. This method invokes the next handler in chain. It is typically invoked from the implementation of OnRemoveHandler(EventInterceptionArgs).
Public method | RemoveHandler | Removes a handler from the event by invoking the Remove semantic of the next node in the chain of invocation.
Top
See Also

Reference

EventInterceptionArgs Class
PostSharp.Aspects Namespace


EventInterceptionArgs.AddHandler Method

EventInterceptionArgsAddHandler Method

Adds a handler to the event by invoking the Add semantic of the next node in the chain of invocation.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract void AddHandler(
    Delegate handler
)

Parameters

handler
Type: SystemDelegate
The handler to add to the event.
See Also

Reference

EventInterceptionArgs Class
PostSharp.Aspects Namespace


EventInterceptionArgs.InvokeHandler Method

EventInterceptionArgsInvokeHandler Method

Invokes a handler by calling the Invoke semantic of the next node in the chain of invocation.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract Object InvokeHandler(
    Delegate handler,
    Arguments arguments
)

Parameters

handler
Type: SystemDelegate
Handler to be invoked.
arguments
Type: PostSharp.AspectsArguments
Arguments passed to the handler.

Return Value

Type: Object
Return value of the handler.
See Also

Reference

EventInterceptionArgs Class
PostSharp.Aspects Namespace


EventInterceptionArgs.ProceedAddHandler Method

EventInterceptionArgsProceedAddHandler Method

Proceeds with adding the Delegate to the event to which the current aspect. This method invokes the next handler in chain. It is typically invoked from the implementation of OnAddHandler(EventInterceptionArgs).

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract void ProceedAddHandler()
See Also

Reference

EventInterceptionArgs Class
PostSharp.Aspects Namespace


EventInterceptionArgs.ProceedInvokeHandler Method

EventInterceptionArgsProceedInvokeHandler Method

Proceeds with invoking the Delegate with the arguments specified in the Arguments property. The delegate may change the Arguments and set the ReturnValue. This method invokes the next handler in chain. It is typically invoked from the implementation of OnInvokeHandler(EventInterceptionArgs).

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract void ProceedInvokeHandler()
See Also

Reference

EventInterceptionArgs Class
PostSharp.Aspects Namespace


EventInterceptionArgs.ProceedRemoveHandler Method

EventInterceptionArgsProceedRemoveHandler Method

Proceeds with removing the Delegate from the event to which the current aspect. This method invokes the next handler in chain. It is typically invoked from the implementation of OnRemoveHandler(EventInterceptionArgs).

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract void ProceedRemoveHandler()
See Also

Reference

EventInterceptionArgs Class
PostSharp.Aspects Namespace


EventInterceptionArgs.RemoveHandler Method

EventInterceptionArgsRemoveHandler Method

Removes a handler from the event by invoking the Remove semantic of the next node in the chain of invocation.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract void RemoveHandler(
    Delegate handler
)

Parameters

handler
Type: SystemDelegate
Handler to be removed.
See Also

Reference

EventInterceptionArgs Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Intercepting Events


EventInterceptionAspect Class

Aspect that, when applied on an event, intercepts invocations of its semantics Add (OnAddHandler(EventInterceptionArgs)), Remove (OnRemoveHandler(EventInterceptionArgs)) and Invoke (OnInvokeHandler(EventInterceptionArgs)).
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsEventLevelAspect
PostSharp.AspectsEventInterceptionAspect
PostSharp.Patterns.ModelWeakEventAttribute

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public abstract class EventInterceptionAspect : EventLevelAspect,
    IEventInterceptionAspect, IEventLevelAspect, IAspect

The EventInterceptionAspect type exposes the following members.

Constructors
 | Name | Description
Protected method | EventInterceptionAspect | Initializes a new instance of the EventInterceptionAspect class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from EventLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from EventLevelAspect.)
Public method | CompileTimeValidate(EventInfo) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from EventLevelAspect.)
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Overrides AspectCreateAspectConfiguration.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnAddHandler | Method invoked instead of the Add semantic of the event to which the current aspect is applied, i.e. when a new delegate is added to this event.
Public method | OnInvokeHandler | Method invoked when the event to which the current aspect is applied is fired, for each delegate of this event, and instead of invoking this delegate.
Public method | OnRemoveHandler | Method invoked instead of the Remove semantic of the event to which the current aspect is applied, i.e. when a delegate is removed from this event.
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from EventLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from EventLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, EventInfo) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from EventLevelAspect.)
Top
Remarks

Applying an aspect of type EventInterceptionAspect to an event results in the add and remove methods of the event to be replaced by a call to OnAddHandler(EventInterceptionArgs) and OnRemoveHandler(EventInterceptionArgs), respectively. The original accessor body is moved into new methods, which the aspect code can call by invoking ProceedAddHandler or ProceedRemoveHandler.

The method OnInvokeHandler(EventInterceptionArgs), if defined, is called instead when the event is raised, once for every handler that has been added to the list. When you define OnInvokeHandler(EventInterceptionArgs) method, PostSharp will use a broker object to control access to the event; this broker object will be the unique subscriber of the event, and maintains its own list of subscribers.

Note Note
The aspect works only when caller code access the event through its add/remove semantics. It does not work when the caller code bypasses the event semantics and accesses directly its implementation (the underlying field of the event, typically). The C# compiler is known to bypass the semantics when the event is accessed directly from the class declaring it (it accesses directly the private field whenever it can).

Note Note
All classes implementing IAspect should typically be marked as serializable using the SerializableAttribute or PSerializableAttribute custom attribute . Fields that are only used at runtime (and unknown at compile-time) should be carefully marked with the NonSerializedAttribute or PNonSerializedAttribute custom attribute. When PostSharp is used on a platform that does not support aspect serialization (such as .NET Compact Framework, Silverlight, or Windows Phone), or when another aspect serializer is used, it is not necessary to mark the aspect class as serializable. For more information, see Aspect Serialization .

See Also

Reference

PostSharp.Aspects Namespace

Other Resources

Conceptual: Aspect Serialization
Conceptual: Interception Aspects
Conceptual: Adding Behaviors to Existing Members
Conceptual: Developing Composite Aspects
Conceptual: Intercepting Events
Conceptual: What's New in PostSharp 2.0


EventInterceptionAspect Constructor

Initializes a new instance of the EventInterceptionAspect class

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected EventInterceptionAspect()
See Also

Reference

EventInterceptionAspect Class
PostSharp.Aspects Namespace


EventInterceptionAspect Properties

The EventInterceptionAspect type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

EventInterceptionAspect Class
PostSharp.Aspects Namespace


EventInterceptionAspect Methods

The EventInterceptionAspect type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from EventLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from EventLevelAspect.)
Public method | CompileTimeValidate(EventInfo) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from EventLevelAspect.)
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Overrides AspectCreateAspectConfiguration.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnAddHandler | Method invoked instead of the Add semantic of the event to which the current aspect is applied, i.e. when a new delegate is added to this event.
Public method | OnInvokeHandler | Method invoked when the event to which the current aspect is applied is fired, for each delegate of this event, and instead of invoking this delegate.
Public method | OnRemoveHandler | Method invoked instead of the Remove semantic of the event to which the current aspect is applied, i.e. when a delegate is removed from this event.
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from EventLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from EventLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, EventInfo) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from EventLevelAspect.)
Top
See Also

Reference

EventInterceptionAspect Class
PostSharp.Aspects Namespace


EventInterceptionAspect.CreateAspectConfiguration Method

EventInterceptionAspectCreateAspectConfiguration Method

Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override AspectConfiguration CreateAspectConfiguration()

Return Value

Type: AspectConfiguration
A new and empty instance of AspectConfiguration, whose concrete type corresponds to the concrete type of the Aspect.
Remarks
This method should not set up the returned AspectConfiguration. After the current method has returned, the SetAspectConfiguration(AspectConfiguration, Object) method will be invoked, and this method is responsible for setting up the AspectConfigurationobject.
See Also

Reference

EventInterceptionAspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Configuring Aspects


EventInterceptionAspect.OnAddHandler Method

EventInterceptionAspectOnAddHandler Method

Method invoked instead of the Add semantic of the event to which the current aspect is applied, i.e. when a new delegate is added to this event.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void OnAddHandler(
    EventInterceptionArgs args
)

Parameters

args
Type: PostSharp.AspectsEventInterceptionArgs
Handler arguments.

Implements

IEventInterceptionAspectOnAddHandler(EventInterceptionArgs)
Remarks
Note Note
Because of the way how the C# compiler implements automatic events (i.e. events where you don't implement the Add and Remove semantics manually), the Invoke Event Handler semantic ( OnInvokeHandler(EventInterceptionArgs) or equivalent) shall not be invoked for delegates that have been added from inside the class that declares this event.
See Also

Reference

EventInterceptionAspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Intercepting Events


EventInterceptionAspect.OnInvokeHandler Method

EventInterceptionAspectOnInvokeHandler Method

Method invoked when the event to which the current aspect is applied is fired, for each delegate of this event, and instead of invoking this delegate.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void OnInvokeHandler(
    EventInterceptionArgs args
)

Parameters

args
Type: PostSharp.AspectsEventInterceptionArgs
Handler arguments.

Implements

IEventInterceptionAspectOnInvokeHandler(EventInterceptionArgs)
Remarks
Note Note
Because of the way how the C# compiler implements automatic events (i.e. events where you don't implement the Add and Remove semantics manually), the Invoke Event Handler semantic ( OnInvokeHandler(EventInterceptionArgs) or equivalent) shall not be invoked for delegates that have been added from inside the class that declares this event.

Note Note
The Invoke Event Handler semantic is different from normal event firing. Indeed, when you fire an event, all handlers that were added to this event are fired. However, the current method invokes only a single handler: the one passed to the handler parameter.
See Also

Reference

EventInterceptionAspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Intercepting Events


EventInterceptionAspect.OnRemoveHandler Method

EventInterceptionAspectOnRemoveHandler Method

Method invoked instead of the Remove semantic of the event to which the current aspect is applied, i.e. when a delegate is removed from this event.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void OnRemoveHandler(
    EventInterceptionArgs args
)

Parameters

args
Type: PostSharp.AspectsEventInterceptionArgs
Handler arguments.

Implements

IEventInterceptionAspectOnRemoveHandler(EventInterceptionArgs)
Remarks
Note Note
Because of the way how the C# compiler implements automatic events (i.e. events where you don't implement the Add and Remove semantics manually), the Invoke Event Handler semantic ( OnInvokeHandler(EventInterceptionArgs) or equivalent) shall not be invoked for delegates that have been added from inside the class that declares this event.
See Also

Reference

EventInterceptionAspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Intercepting Events


EventLevelAspect Class

Base class for all aspects applied on events.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsEventLevelAspect
PostSharp.AspectsEventInterceptionAspect

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public abstract class EventLevelAspect : Aspect,
    IEventLevelAspect, IAspect, IEventLevelAspectBuildSemantics, IAspectBuildSemantics, IValidableAnnotation

The EventLevelAspect type exposes the following members.

Constructors
 | Name | Description
Protected method | EventLevelAspect | Initializes a new instance of the EventLevelAspect class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Overrides AspectCompileTimeValidate(Object).)
Public method | CompileTimeValidate(EventInfo) | Method invoked at build time to ensure that the aspect has been applied to the right target.
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Inherited from Aspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | RuntimeInitialize | Initializes the current aspect.
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Overrides AspectSetAspectConfiguration(AspectConfiguration, Object).)
Protected method | SetAspectConfiguration(AspectConfiguration, EventInfo) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.
Top
Remarks
Note Note
This class does not provide any advice. You may derive your aspect class from a class providing predefined advice , or build a composite aspect .

Note Note
All classes implementing IAspect should typically be marked as serializable using the SerializableAttribute or PSerializableAttribute custom attribute . Fields that are only used at runtime (and unknown at compile-time) should be carefully marked with the NonSerializedAttribute or PNonSerializedAttribute custom attribute. When PostSharp is used on a platform that does not support aspect serialization (such as .NET Compact Framework, Silverlight, or Windows Phone), or when another aspect serializer is used, it is not necessary to mark the aspect class as serializable. For more information, see Aspect Serialization .

See Also

Reference

PostSharp.Aspects Namespace
PostSharp.AspectsIEventLevelAspect

Other Resources

Conceptual: Aspect Classes
Conceptual: Developing Complex Aspects
Conceptual: Aspect Serialization
Conceptual: Adding Behaviors to Existing Members
Conceptual: Developing Composite Aspects


EventLevelAspect Constructor

Initializes a new instance of the EventLevelAspect class

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected EventLevelAspect()
See Also

Reference

EventLevelAspect Class
PostSharp.Aspects Namespace


EventLevelAspect Properties

The EventLevelAspect type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

EventLevelAspect Class
PostSharp.Aspects Namespace


EventLevelAspect Methods

The EventLevelAspect type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Overrides AspectCompileTimeValidate(Object).)
Public method | CompileTimeValidate(EventInfo) | Method invoked at build time to ensure that the aspect has been applied to the right target.
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Inherited from Aspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | RuntimeInitialize | Initializes the current aspect.
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Overrides AspectSetAspectConfiguration(AspectConfiguration, Object).)
Protected method | SetAspectConfiguration(AspectConfiguration, EventInfo) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.
Top
See Also

Reference

EventLevelAspect Class
PostSharp.Aspects Namespace


EventLevelAspect.CompileTimeInitialize Method

EventLevelAspectCompileTimeInitialize Method

Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void CompileTimeInitialize(
    EventInfo targetEvent,
    AspectInfo aspectInfo
)

Parameters

targetEvent
Type: System.ReflectionEventInfo
Event to which the current aspect is applied
aspectInfo
Type: PostSharp.AspectsAspectInfo
Reserved for future usage.

Implements

IEventLevelAspectBuildSemanticsCompileTimeInitialize(EventInfo, AspectInfo)
See Also

Reference

EventLevelAspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Initializing Aspects


EventLevelAspect.CompileTimeValidate Method

EventLevelAspectCompileTimeValidate Method

Overload List
 | Name | Description
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Overrides AspectCompileTimeValidate(Object).)
Public method | CompileTimeValidate(EventInfo) | Method invoked at build time to ensure that the aspect has been applied to the right target.
Top
See Also

Reference

EventLevelAspect Class
PostSharp.Aspects Namespace


EventLevelAspect.CompileTimeValidate Method (Object)

EventLevelAspectCompileTimeValidate Method (Object)

Method invoked at build time to ensure that the aspect has been applied to the right target.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override sealed bool CompileTimeValidate(
    Object target
)

Parameters

target
Type: SystemObject
Code element (Assembly, Type, FieldInfo, MethodBase, PropertyInfo, EventInfo, ParameterInfo, or LocationInfo) to which the aspect has been applied.

Return Value

Type: Boolean
true if the aspect was applied to an acceptable target, otherwise false.

Implements

IValidableAnnotationCompileTimeValidate(Object)
Remarks
The implementation of this method is expected to emit an error message (see MessageSource) or an exception in case of error. Returning false without emitting an error message or exception causes the aspect to be silently ignored.
See Also

Reference

EventLevelAspect Class
CompileTimeValidate Overload
PostSharp.Aspects Namespace

Other Resources

Conceptual: Validating Aspects
Conceptual: Adding Aspects to Multiple Declarations Using Attributes
Conceptual: Understanding Attribute Multicasting


EventLevelAspect.CompileTimeValidate Method (EventInfo)

EventLevelAspectCompileTimeValidate Method (EventInfo)

Method invoked at build time to ensure that the aspect has been applied to the right target.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual bool CompileTimeValidate(
    EventInfo targetEvent
)

Parameters

targetEvent
Type: System.ReflectionEventInfo
Event to which the aspect has been applied

Return Value

Type: Boolean
true if the aspect was applied to an acceptable event, otherwise false.
Remarks
The implementation of this method is expected to emit an error message (see MessageSource) or an exception in case of error. Returning false without emitting an error message or exception causes the aspect to be silently ignored.
See Also

Reference

EventLevelAspect Class
CompileTimeValidate Overload
PostSharp.Aspects Namespace

Other Resources

Conceptual: Validating Aspects
Conceptual: Validating Aspect Usage


EventLevelAspect.RuntimeInitialize Method

EventLevelAspectRuntimeInitialize Method

Initializes the current aspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void RuntimeInitialize(
    EventInfo eventInfo
)

Parameters

eventInfo
Type: System.ReflectionEventInfo
Event to which the current aspect is applied.

Implements

IEventLevelAspectRuntimeInitialize(EventInfo)
See Also

Reference

EventLevelAspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Initializing Aspects


EventLevelAspect.SetAspectConfiguration Method

EventLevelAspectSetAspectConfiguration Method

Overload List
 | Name | Description
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Overrides AspectSetAspectConfiguration(AspectConfiguration, Object).)
Protected method | SetAspectConfiguration(AspectConfiguration, EventInfo) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.
Top
See Also

Reference

EventLevelAspect Class
PostSharp.Aspects Namespace


EventLevelAspect.SetAspectConfiguration Method (AspectConfiguration, Object)

EventLevelAspectSetAspectConfiguration Method (AspectConfiguration, Object)

Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override sealed void SetAspectConfiguration(
    AspectConfiguration aspectConfiguration,
    Object targetElement
)

Parameters

aspectConfiguration
Type: PostSharp.Aspects.ConfigurationAspectConfiguration
The AspectConfiguration instance previously returned by the CreateAspectConfiguration method.
targetElement
Type: SystemObject
Code element (Assembly, Type, FieldInfo, MethodBase, PropertyInfo, EventInfo, ParameterInfo, or LocationInfo) to which the current Aspect has been applied.
Remarks

Classes overriding this method must always invoke the base implementation before performing their own changes to the AspectConfiguration.

See Also

Reference

EventLevelAspect Class
SetAspectConfiguration Overload
PostSharp.Aspects Namespace

Other Resources

Conceptual: Configuring Aspects


EventLevelAspect.SetAspectConfiguration Method (AspectConfiguration, EventInfo)

EventLevelAspectSetAspectConfiguration Method (AspectConfiguration, EventInfo)

Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void SetAspectConfiguration(
    AspectConfiguration aspectConfiguration,
    EventInfo targetEvent
)

Parameters

aspectConfiguration
Type: PostSharp.Aspects.ConfigurationAspectConfiguration
The AspectConfiguration instance previously returned by the CreateAspectConfiguration method.
targetEvent
Type: System.ReflectionEventInfo
Event to which the current aspect has been applied.
Remarks

Classes overriding this method must always invoke the base implementation before performing their own changes to the AspectConfiguration.

See Also

Reference

EventLevelAspect Class
SetAspectConfiguration Overload
PostSharp.Aspects Namespace

Other Resources

Conceptual: Configuring Aspects


FieldLevelAspect Class

Base class for all aspects applied on fields.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsFieldLevelAspect

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public abstract class FieldLevelAspect : Aspect,
    IFieldLevelAspect, IAspect, IFieldLevelAspectBuildSemantics, IAspectBuildSemantics, IValidableAnnotation

The FieldLevelAspect type exposes the following members.

Constructors
 | Name | Description
Protected method | FieldLevelAspect | Initializes a new instance of the FieldLevelAspect class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Overrides AspectCompileTimeValidate(Object).)
Public method | CompileTimeValidate(FieldInfo) | Method invoked at build time to ensure that the aspect has been applied to the right target.
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Inherited from Aspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | RuntimeInitialize | Method invoked at runtime before any other method of the aspect is invoked.
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Overrides AspectSetAspectConfiguration(AspectConfiguration, Object).)
Protected method | SetAspectConfiguration(AspectConfiguration, FieldInfo) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.
Top
Remarks
Note Note
Consider deriving your aspects from LocationLevelAspect; locations can abstract both fields and properties, making it possible to apply the same aspect to both.
Note Note
This class does not provide any advice. You may derive your aspect class from a class providing predefined advice , or build a composite aspect .

Note Note
All classes implementing IAspect should typically be marked as serializable using the SerializableAttribute or PSerializableAttribute custom attribute . Fields that are only used at runtime (and unknown at compile-time) should be carefully marked with the NonSerializedAttribute or PNonSerializedAttribute custom attribute. When PostSharp is used on a platform that does not support aspect serialization (such as .NET Compact Framework, Silverlight, or Windows Phone), or when another aspect serializer is used, it is not necessary to mark the aspect class as serializable. For more information, see Aspect Serialization .

See Also

Reference

PostSharp.Aspects Namespace
PostSharp.AspectsIFieldLevelAspect
PostSharp.AspectsLocationLevelAspect

Other Resources

Conceptual: Aspect Classes
Conceptual: Developing Complex Aspects
Conceptual: Aspect Serialization


FieldLevelAspect Constructor

Initializes a new instance of the FieldLevelAspect class

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected FieldLevelAspect()
See Also

Reference

FieldLevelAspect Class
PostSharp.Aspects Namespace


FieldLevelAspect Properties

The FieldLevelAspect type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

FieldLevelAspect Class
PostSharp.Aspects Namespace


FieldLevelAspect Methods

The FieldLevelAspect type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Overrides AspectCompileTimeValidate(Object).)
Public method | CompileTimeValidate(FieldInfo) | Method invoked at build time to ensure that the aspect has been applied to the right target.
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Inherited from Aspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | RuntimeInitialize | Method invoked at runtime before any other method of the aspect is invoked.
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Overrides AspectSetAspectConfiguration(AspectConfiguration, Object).)
Protected method | SetAspectConfiguration(AspectConfiguration, FieldInfo) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.
Top
See Also

Reference

FieldLevelAspect Class
PostSharp.Aspects Namespace


FieldLevelAspect.CompileTimeInitialize Method

FieldLevelAspectCompileTimeInitialize Method

Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void CompileTimeInitialize(
    FieldInfo field,
    AspectInfo aspectInfo
)

Parameters

field
Type: System.ReflectionFieldInfo
Field to which the current aspect is applied
aspectInfo
Type: PostSharp.AspectsAspectInfo
Reserved for future usage.

Implements

IFieldLevelAspectBuildSemanticsCompileTimeInitialize(FieldInfo, AspectInfo)
See Also

Reference

FieldLevelAspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Initializing Aspects


FieldLevelAspect.CompileTimeValidate Method

FieldLevelAspectCompileTimeValidate Method

Overload List
 | Name | Description
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Overrides AspectCompileTimeValidate(Object).)
Public method | CompileTimeValidate(FieldInfo) | Method invoked at build time to ensure that the aspect has been applied to the right target.
Top
See Also

Reference

FieldLevelAspect Class
PostSharp.Aspects Namespace


FieldLevelAspect.CompileTimeValidate Method (Object)

FieldLevelAspectCompileTimeValidate Method (Object)

Method invoked at build time to ensure that the aspect has been applied to the right target.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override sealed bool CompileTimeValidate(
    Object target
)

Parameters

target
Type: SystemObject
Code element (Assembly, Type, FieldInfo, MethodBase, PropertyInfo, EventInfo, ParameterInfo, or LocationInfo) to which the aspect has been applied.

Return Value

Type: Boolean
true if the aspect was applied to an acceptable target, otherwise false.

Implements

IValidableAnnotationCompileTimeValidate(Object)
Remarks
The implementation of this method is expected to emit an error message (see MessageSource) or an exception in case of error. Returning false without emitting an error message or exception causes the aspect to be silently ignored.
See Also

Reference

FieldLevelAspect Class
CompileTimeValidate Overload
PostSharp.Aspects Namespace

Other Resources

Conceptual: Validating Aspects
Conceptual: Adding Aspects to Multiple Declarations Using Attributes
Conceptual: Understanding Attribute Multicasting


FieldLevelAspect.CompileTimeValidate Method (FieldInfo)

FieldLevelAspectCompileTimeValidate Method (FieldInfo)

Method invoked at build time to ensure that the aspect has been applied to the right target.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual bool CompileTimeValidate(
    FieldInfo field
)

Parameters

field
Type: System.ReflectionFieldInfo
Field to which the aspect has been applied

Return Value

Type: Boolean
true if the aspect was applied to an acceptable field, otherwise false.
Remarks
The implementation of this method is expected to emit an error message (see MessageSource) or an exception in case of error. Returning false without emitting an error message or exception causes the aspect to be silently ignored.
See Also

Reference

FieldLevelAspect Class
CompileTimeValidate Overload
PostSharp.Aspects Namespace

Other Resources

Conceptual: Validating Aspects
Conceptual: Validating Aspect Usage


FieldLevelAspect.RuntimeInitialize Method

FieldLevelAspectRuntimeInitialize Method

Method invoked at runtime before any other method of the aspect is invoked.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void RuntimeInitialize(
    FieldInfo field
)

Parameters

field
Type: System.ReflectionFieldInfo
Field on which this instance is applied.

Implements

IFieldLevelAspectRuntimeInitialize(FieldInfo)
See Also

Reference

FieldLevelAspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Initializing Aspects


FieldLevelAspect.SetAspectConfiguration Method

FieldLevelAspectSetAspectConfiguration Method

Overload List
 | Name | Description
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Overrides AspectSetAspectConfiguration(AspectConfiguration, Object).)
Protected method | SetAspectConfiguration(AspectConfiguration, FieldInfo) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.
Top
See Also

Reference

FieldLevelAspect Class
PostSharp.Aspects Namespace


FieldLevelAspect.SetAspectConfiguration Method (AspectConfiguration, Object)

FieldLevelAspectSetAspectConfiguration Method (AspectConfiguration, Object)

Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override sealed void SetAspectConfiguration(
    AspectConfiguration aspectConfiguration,
    Object targetElement
)

Parameters

aspectConfiguration
Type: PostSharp.Aspects.ConfigurationAspectConfiguration
The AspectConfiguration instance previously returned by the CreateAspectConfiguration method.
targetElement
Type: SystemObject
Code element (Assembly, Type, FieldInfo, MethodBase, PropertyInfo, EventInfo, ParameterInfo, or LocationInfo) to which the current Aspect has been applied.
Remarks

Classes overriding this method must always invoke the base implementation before performing their own changes to the AspectConfiguration.

See Also

Reference

FieldLevelAspect Class
SetAspectConfiguration Overload
PostSharp.Aspects Namespace

Other Resources

Conceptual: Configuring Aspects


FieldLevelAspect.SetAspectConfiguration Method (AspectConfiguration, FieldInfo)

FieldLevelAspectSetAspectConfiguration Method (AspectConfiguration, FieldInfo)

Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void SetAspectConfiguration(
    AspectConfiguration aspectConfiguration,
    FieldInfo targetField
)

Parameters

aspectConfiguration
Type: PostSharp.Aspects.ConfigurationAspectConfiguration
The AspectConfiguration instance previously returned by the CreateAspectConfiguration method.
targetField
Type: System.ReflectionFieldInfo
Field to which the current aspect has been applied.
Remarks

Classes overriding this method must always invoke the base implementation before performing their own changes to the AspectConfiguration.

See Also

Reference

FieldLevelAspect Class
SetAspectConfiguration Overload
PostSharp.Aspects Namespace

Other Resources

Conceptual: Configuring Aspects


FlowBehavior Enumeration

Enumerates the possible behaviors of the calling method after the calling method has returned.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum FlowBehavior
Members
Member name | Value | Description
Default | 0 | Default flow behavior for the current method. For OnEntry(MethodExecutionArgs), OnExit(MethodExecutionArgs) and OnSuccess(MethodExecutionArgs), the default flow is Continue, for OnException(MethodExecutionArgs) it is RethrowException.
Continue | 1 | Continue normal method execution. For OnException(MethodExecutionArgs) advice, the Continue behavior works the same way as Return behavior.
RethrowException | 2 | The current exception will be rethrown. Available only for OnException(MethodExecutionArgs).
Return | 3 | Return immediately from the current method. Available only for OnEntry(MethodExecutionArgs) and OnException(MethodExecutionArgs). Note that you may want to set the ReturnValue property, otherwise you may get a NullReferenceException. If there is another OnMethodBoundaryAspect aspect before the current OnMethodBoundaryAspect aspect on the current method, the Return behavior calls the OnSuccess(MethodExecutionArgs) and OnExit(MethodExecutionArgs) methods of the other aspect.
ThrowException | 4 | Throws the exception contained in the Exception property. Available only for OnException(MethodExecutionArgs).
Yield | 5 | Yields a value or awaits for an awaiter. Available only for OnEntry(MethodExecutionArgs) and OnResume(MethodExecutionArgs) advices applied to iterators and async methods.
Remarks

This enumeration is used by the MethodExecutionArgs class.

See Also

Reference

PostSharp.Aspects Namespace

Other Resources

Conceptual: Injecting Behaviors Before and After Method Execution


IAspect Interface

Base interface for run-time semantics of all aspects.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IAspect
See Also

Reference

PostSharp.Aspects Namespace
PostSharp.AspectsIAspectBuildSemantics
PostSharp.Aspects.ConfigurationAspectConfiguration
PostSharp.AspectsAspect


IAspectBuildSemantics Interface

Compile-time semantics of IAspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IAspectBuildSemantics : IValidableAnnotation

The IAspectBuildSemantics type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeValidate | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from IValidableAnnotation.)
Public method | GetAspectConfiguration | Method invoked at build time to get the imperative configuration of the current Aspect.
Top
See Also

Reference

PostSharp.Aspects Namespace


IAspectBuildSemantics Methods

The IAspectBuildSemantics type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeValidate | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from IValidableAnnotation.)
Public method | GetAspectConfiguration | Method invoked at build time to get the imperative configuration of the current Aspect.
Top
See Also

Reference

IAspectBuildSemantics Interface
PostSharp.Aspects Namespace


IAspectBuildSemantics.GetAspectConfiguration Method

IAspectBuildSemanticsGetAspectConfiguration Method

Method invoked at build time to get the imperative configuration of the current Aspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
AspectConfiguration GetAspectConfiguration(
    Object targetElement
)

Parameters

targetElement
Type: SystemObject
Code element (Assembly, Type, FieldInfo, MethodBase, PropertyInfo, EventInfo, ParameterInfo, or LocationInfo) to which the current aspect has been applied.

Return Value

Type: AspectConfiguration
An AspectConfiguration representing the imperative configuration of the current Aspect.
See Also

Reference

IAspectBuildSemantics Interface
PostSharp.Aspects Namespace


IAspectInstance Interface

Represents an instance of an aspect applied to a declaration.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IAspectInstance

The IAspectInstance type exposes the following members.

Properties
 | Name | Description
Public property | Aspect | Gets the aspect instance.
Public property | AspectConfiguration | Gets the aspect configuration.
Public property | AspectConstruction | Gets the aspect construction.
Public property | AspectType | Gets the type of the aspect.
Top
See Also

Reference

PostSharp.Aspects Namespace


IAspectInstance Properties

The IAspectInstance type exposes the following members.

Properties
 | Name | Description
Public property | Aspect | Gets the aspect instance.
Public property | AspectConfiguration | Gets the aspect configuration.
Public property | AspectConstruction | Gets the aspect construction.
Public property | AspectType | Gets the type of the aspect.
Top
See Also

Reference

IAspectInstance Interface
PostSharp.Aspects Namespace


IAspectInstance.Aspect Property

IAspectInstanceAspect Property

Gets the aspect instance.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IAspect Aspect { get; }

Property Value

Type: IAspect
The aspect instance, or null if the AspectConfiguration was provided instead.
See Also

Reference

IAspectInstance Interface
PostSharp.Aspects Namespace


IAspectInstance.AspectConfiguration Property

IAspectInstanceAspectConfiguration Property

Gets the aspect configuration.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
AspectConfiguration AspectConfiguration { get; }

Property Value

Type: AspectConfiguration
The aspect configuration, or null if none was provided.
See Also

Reference

IAspectInstance Interface
PostSharp.Aspects Namespace


IAspectInstance.AspectConstruction Property

IAspectInstanceAspectConstruction Property

Gets the aspect construction.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
ObjectConstruction AspectConstruction { get; }

Property Value

Type: ObjectConstruction
The aspect construction, or null if the aspect instance was provided instead.
See Also

Reference

IAspectInstance Interface
PostSharp.Aspects Namespace


IAspectInstance.AspectType Property

IAspectInstanceAspectType Property

Gets the type of the aspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Type AspectType { get; }

Property Value

Type: Type
See Also

Reference

IAspectInstance Interface
PostSharp.Aspects Namespace


IAspectProvider Interface

Interface that, when implemented by an aspect class, allows aspect instances to provide other aspects to the weaver.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IAspectProvider : IAspect,
    IService

The IAspectProvider type exposes the following members.

Methods
 | Name | Description
Public method | ProvideAspects | Provides new aspects.
Top
See Also

Reference

PostSharp.Aspects Namespace

Other Resources

Conceptual: Adding Aspects Declaratively Using Attributes
Conceptual: Adding Aspects Dynamically
Conceptual: Adding Aspects Programmatically using IAspectProvider
Conceptual: Adding Aspects to Derived Classes and Methods Using Attributes
Conceptual: Breaking Changes in PostSharp 5.0
Conceptual: Developing Composite Aspects
Conceptual: Introducing Custom Attributes
Conceptual: Introducing Managed Resources
Conceptual: Testing that an Aspect has been Applied
Conceptual: What's New in PostSharp 4.0


IAspectProvider Methods

The IAspectProvider type exposes the following members.

Methods
 | Name | Description
Public method | ProvideAspects | Provides new aspects.
Top
See Also

Reference

IAspectProvider Interface
PostSharp.Aspects Namespace


IAspectProvider.ProvideAspects Method

IAspectProviderProvideAspects Method

Provides new aspects.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IEnumerable<AspectInstance> ProvideAspects(
    Object targetElement
)

Parameters

targetElement
Type: SystemObject
Code element (Assembly, Type, FieldInfo, MethodBase, PropertyInfo, EventInfo, ParameterInfo, or LocationInfo) to which the current aspect has been applied.

Return Value

Type: IEnumerable AspectInstance
A set of aspect instances.
Remarks

Implementations of this method are only allowed to return aspect instances applied on elements of code located under the target element of code (targetElement). For instance, a type-level IAspectProvider can provide aspects on methods of the current type, but not of other types.

See Also

Reference

IAspectProvider Interface
PostSharp.Aspects Namespace

Other Resources

Conceptual: Adding Aspects Programmatically using IAspectProvider
Conceptual: Introducing Custom Attributes
Conceptual: Introducing Managed Resources


IAspectRepositoryService Interface

Service that allows to determine which aspects have been applied to a given declaration, whether declaratively through custom attributes or MulticastAttribute, or programmatically using IAspectProvider.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IAspectRepositoryService : IService

The IAspectRepositoryService type exposes the following members.

Methods
 | Name | Description
Public method | GetAspectInstances | Gets the list of aspect instances on a given declaration.
Public method | HasAspect | Determines whether an aspect of a given type has been applied to a given declaration.
Top
Events
 | Name | Description
Public event | AspectDiscoveryCompleted | Event invoked after all the aspects in the current project have been discovered and initialized.
Top
Remarks

To get an instance of this service, use the GetServiceT(Boolean) method from PostSharpEnvironment.CurrentProject.GetService.

See Also

Reference

PostSharp.Aspects Namespace

Other Resources

Conceptual: What's New in PostSharp 4.0


IAspectRepositoryService Methods

The IAspectRepositoryService type exposes the following members.

Methods
 | Name | Description
Public method | GetAspectInstances | Gets the list of aspect instances on a given declaration.
Public method | HasAspect | Determines whether an aspect of a given type has been applied to a given declaration.
Top
See Also

Reference

IAspectRepositoryService Interface
PostSharp.Aspects Namespace


IAspectRepositoryService.GetAspectInstances Method

IAspectRepositoryServiceGetAspectInstances Method

Gets the list of aspect instances on a given declaration.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IAspectInstance[] GetAspectInstances(
    Object declaration
)

Parameters

declaration
Type: SystemObject
The declaration (in the current assembly) for which the list of aspect instances is required.

Return Value

Type: IAspectInstance
The list of aspect instances applied on declaration.
See Also

Reference

IAspectRepositoryService Interface
PostSharp.Aspects Namespace


IAspectRepositoryService.HasAspect Method

IAspectRepositoryServiceHasAspect Method

Determines whether an aspect of a given type has been applied to a given declaration.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
bool HasAspect(
    Object declaration,
    Type aspectType
)

Parameters

declaration
Type: SystemObject
The declaration on which the presence of the aspect must be checked.
aspectType
Type: SystemType
The type of aspect.

Return Value

Type: Boolean
true if an aspect of type aspectType has been applied to declaration, otherwise false.
See Also

Reference

IAspectRepositoryService Interface
PostSharp.Aspects Namespace


IAspectRepositoryService Events

The IAspectRepositoryService type exposes the following members.

Events
 | Name | Description
Public event | AspectDiscoveryCompleted | Event invoked after all the aspects in the current project have been discovered and initialized.
Top
See Also

Reference

IAspectRepositoryService Interface
PostSharp.Aspects Namespace


IAspectRepositoryService.AspectDiscoveryCompleted Event

IAspectRepositoryServiceAspectDiscoveryCompleted Event

Event invoked after all the aspects in the current project have been discovered and initialized.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
event EventHandler AspectDiscoveryCompleted

Value

Type: SystemEventHandler
See Also

Reference

IAspectRepositoryService Interface
PostSharp.Aspects Namespace


IAssemblyLevelAspect Interface

Runtime semantics of aspects applied at assembly level.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IAssemblyLevelAspect : IAspect
Remarks
An assembly-level aspect has no equivalent to RuntimeInitialize since assemblies are never initialized.
See Also

Reference

PostSharp.Aspects Namespace
PostSharp.AspectsIAssemblyLevelAspectBuildSemantics
PostSharp.AspectsAssemblyLevelAspect


IAssemblyLevelAspectBuildSemantics Interface

Build-time semantics of aspects applied at assembly level.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IAssemblyLevelAspectBuildSemantics : IAspect

The IAssemblyLevelAspectBuildSemantics type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.
Top
See Also

Reference

PostSharp.Aspects Namespace
PostSharp.AspectsAssemblyLevelAspect


IAssemblyLevelAspectBuildSemantics Methods

The IAssemblyLevelAspectBuildSemantics type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.
Top
See Also

Reference

IAssemblyLevelAspectBuildSemantics Interface
PostSharp.Aspects Namespace


IAssemblyLevelAspectBuildSemantics.CompileTimeInitialize Method

IAssemblyLevelAspectBuildSemanticsCompileTimeInitialize Method

Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void CompileTimeInitialize(
    Assembly assembly,
    AspectInfo aspectInfo
)

Parameters

assembly
Type: System.ReflectionAssembly
Assembly to which the current aspect is applied
aspectInfo
Type: PostSharp.AspectsAspectInfo
Reserved for future usage.
See Also

Reference

IAssemblyLevelAspectBuildSemantics Interface
PostSharp.Aspects Namespace

Other Resources

Conceptual: Initializing Aspects
Conceptual: Initializing Aspects


IAsyncMethodBinding Interface

Interface through which a method-level aspect or advice can asynchronously invoke the next node in the chain of invocation.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IAsyncMethodBinding : IMethodBinding

The IAsyncMethodBinding type exposes the following members.

Methods
 | Name | Description
Public method | Invoke | Invokes the next node in the chain of invocation. (Inherited from IMethodBinding.)
Public method | InvokeAsync | Invokes asynchronously the next node in the chain of invocation.
Top
See Also

Reference

PostSharp.Aspects Namespace

Other Resources

Conceptual: Aspect Bindings


IAsyncMethodBinding Methods

The IAsyncMethodBinding type exposes the following members.

Methods
 | Name | Description
Public method | Invoke | Invokes the next node in the chain of invocation. (Inherited from IMethodBinding.)
Public method | InvokeAsync | Invokes asynchronously the next node in the chain of invocation.
Top
See Also

Reference

IAsyncMethodBinding Interface
PostSharp.Aspects Namespace


IAsyncMethodBinding.InvokeAsync Method

IAsyncMethodBindingInvokeAsync Method

Invokes asynchronously the next node in the chain of invocation.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
MethodBindingInvokeAwaitable InvokeAsync(
    ref Object instance,
    Arguments arguments
)

Parameters

instance
Type: SystemObject
Target instance on which the method should be invoked (null if the method is static).
arguments
Type: PostSharp.AspectsArguments
Method arguments.

Return Value

Type: MethodBindingInvokeAwaitable
The value that can be awaited to get the result of the underlying method's invocation.
Remarks

The instance parameter is passed by reference so that instance methods of value types ( struct in C#) are allowed to change the value of the instance.

See Also

Reference

IAsyncMethodBinding Interface
PostSharp.Aspects Namespace


IAsyncMethodInterceptionAspect Interface

Runtime semantics of an aspect that, when applied on a method, intercepts invocations of this method. Includes semantics for both async and non-async method interception.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IAsyncMethodInterceptionAspect : IMethodInterceptionAspect,
    IMethodLevelAspect, IAspect

The IAsyncMethodInterceptionAspect type exposes the following members.

Methods
 | Name | Description
Public method | OnInvoke | Method invoked instead of the method to which the aspect has been applied. (Inherited from IMethodInterceptionAspect.)
Public method | OnInvokeAsync | Method invoked instead of the method to which the aspect has been applied.
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from IMethodLevelAspect.)
Top
Remarks
See MethodInterceptionAspect for details.
See Also

Reference

PostSharp.Aspects Namespace


IAsyncMethodInterceptionAspect Methods

The IAsyncMethodInterceptionAspect type exposes the following members.

Methods
 | Name | Description
Public method | OnInvoke | Method invoked instead of the method to which the aspect has been applied. (Inherited from IMethodInterceptionAspect.)
Public method | OnInvokeAsync | Method invoked instead of the method to which the aspect has been applied.
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from IMethodLevelAspect.)
Top
See Also

Reference

IAsyncMethodInterceptionAspect Interface
PostSharp.Aspects Namespace


IAsyncMethodInterceptionAspect.OnInvokeAsync Method

IAsyncMethodInterceptionAspectOnInvokeAsync Method

Method invoked instead of the method to which the aspect has been applied.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Task OnInvokeAsync(
    MethodInterceptionArgs args
)

Parameters

args
Type: PostSharp.AspectsMethodInterceptionArgs
Advice arguments.

Return Value

Type: Task
Remarks

The implementation of OnInvokeAsync(MethodInterceptionArgs) may invoke ProceedAsync, may schedule it for invocation from another thread, or may completely skip its invocation. Alternatively, it may use Binding. Before returning to the caller, the OnInvokeAsync(MethodInterceptionArgs) method must set the return value (property ReturnValue), otherwise the target method may fail with a NullReferenceException. It is normally set by calling ProceedAsync.

See Also

Reference

IAsyncMethodInterceptionAspect Interface
PostSharp.Aspects Namespace
PostSharp.AspectsMethodInterceptionArgs


ICloneAwareAspect Interface

Defines the semantics of aspects that require to be notified after a target object is cloned using MemberwiseClone.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ICloneAwareAspect : IInstanceScopedAspect,
    IAspect

The ICloneAwareAspect type exposes the following members.

Methods
 | Name | Description
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype. (Inherited from IInstanceScopedAspect.)
Public method | OnCloned | Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object.
Public method | RuntimeInitializeInstance | Initializes the aspect instance. This method is invoked when all system elements of the aspect (like member imports) have completed. (Inherited from IInstanceScopedAspect.)
Top
See Also

Reference

PostSharp.Aspects Namespace


ICloneAwareAspect Methods

The ICloneAwareAspect type exposes the following members.

Methods
 | Name | Description
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype. (Inherited from IInstanceScopedAspect.)
Public method | OnCloned | Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object.
Public method | RuntimeInitializeInstance | Initializes the aspect instance. This method is invoked when all system elements of the aspect (like member imports) have completed. (Inherited from IInstanceScopedAspect.)
Top
See Also

Reference

ICloneAwareAspect Interface
PostSharp.Aspects Namespace


ICloneAwareAspect.OnCloned Method

ICloneAwareAspectOnCloned Method

Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void OnCloned(
    ICloneAwareAspect source
)

Parameters

source
Type: PostSharp.AspectsICloneAwareAspect
Aspect instance corresponding to the current aspect instance in the cloned target object.
Remarks

Prior to calling the current method, the aspect framework initializes the source object using CreateInstance(AdviceArgs) and RuntimeInitializeInstance. That is, the aspect instance in the cloned object is not cloned from the source aspect instance, but from the prototype aspect instance.

See Also

Reference

ICloneAwareAspect Interface
PostSharp.Aspects Namespace


ICompositionAspect Interface

Defines the semantics of an aspect that, when applied on a type, introduce one or many new interfaces into that type, and let these interfaces be implemented by an object created at runtime.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ICompositionAspect : ITypeLevelAspect,
    IAspect

The ICompositionAspect type exposes the following members.

Methods
 | Name | Description
Public method | CreateImplementationObject | Method invoked at runtime, during the initialization of instances of the target type, to create the composed object.
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from ITypeLevelAspect.)
Top
Remarks
See CompositionAspect for details.
See Also

Reference

PostSharp.Aspects Namespace
PostSharp.AspectsCompositionAspect


ICompositionAspect Methods

The ICompositionAspect type exposes the following members.

Methods
 | Name | Description
Public method | CreateImplementationObject | Method invoked at runtime, during the initialization of instances of the target type, to create the composed object.
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from ITypeLevelAspect.)
Top
See Also

Reference

ICompositionAspect Interface
PostSharp.Aspects Namespace


ICompositionAspect.CreateImplementationObject Method

ICompositionAspectCreateImplementationObject Method

Method invoked at runtime, during the initialization of instances of the target type, to create the composed object.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Object CreateImplementationObject(
    AdviceArgs args
)

Parameters

args
Type: PostSharp.AspectsAdviceArgs

Return Value

Type: Object
The composed object. This interface should implement the interfaces specified by the PublicInterfaces and [!:CompositionAspectConfiguration.ProtectedInterfaces] collections.
Remarks
This method is invoked during at runtime after the base constructor has executed, and before the constructor of the current type is executed.
See Also

Reference

ICompositionAspect Interface
PostSharp.Aspects Namespace


ICustomAttributeIntroductionAspect Interface

Semantics of an aspect that, when applied to a target, adds a custom attribute to this target.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ICustomAttributeIntroductionAspect : IAspect
Remarks
See CustomAttributeIntroductionAspect for details.
See Also

Reference

PostSharp.Aspects Namespace
PostSharp.AspectsCustomAttributeIntroductionAspect
PostSharp.Aspects.ConfigurationCustomAttributeIntroductionAspectConfiguration


IEventBinding Interface

Interface through which an event-level aspect or advice can invoke the next node in the chain of invocation.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IEventBinding

The IEventBinding type exposes the following members.

Methods
 | Name | Description
Public method | AddHandler | Invoke the Add semantic on the next node in the chain of invocation.
Public method | InvokeHandler | Invoke the Invoke semantic on the next node in the chain of invocation.
Public method | RemoveHandler | Invoke the Remove semantic on the next node in the chain of invocation.
Top
See Also

Reference

PostSharp.Aspects Namespace
PostSharp.Aspects.AdvicesImportMemberAttribute

Other Resources

Conceptual: Aspect Bindings


IEventBinding Methods

The IEventBinding type exposes the following members.

Methods
 | Name | Description
Public method | AddHandler | Invoke the Add semantic on the next node in the chain of invocation.
Public method | InvokeHandler | Invoke the Invoke semantic on the next node in the chain of invocation.
Public method | RemoveHandler | Invoke the Remove semantic on the next node in the chain of invocation.
Top
See Also

Reference

IEventBinding Interface
PostSharp.Aspects Namespace


IEventBinding.AddHandler Method

IEventBindingAddHandler Method

Invoke the Add semantic on the next node in the chain of invocation.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void AddHandler(
    ref Object instance,
    Delegate handler
)

Parameters

instance
Type: SystemObject
Target instance on which the event is defined (null if the event is static).
handler
Type: SystemDelegate
Handler to be added to the event.
Remarks

The instance parameter is passed by reference so that instance methods of value types ( struct in C#) are allowed to change the value of the instance.

See Also

Reference

IEventBinding Interface
PostSharp.Aspects Namespace


IEventBinding.InvokeHandler Method

IEventBindingInvokeHandler Method

Invoke the Invoke semantic on the next node in the chain of invocation.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Object InvokeHandler(
    ref Object instance,
    Delegate handler,
    Arguments arguments
)

Parameters

instance
Type: SystemObject
Target instance on which the event is defined (null if the event is static).
handler
Type: SystemDelegate
Handler to be removed from the event.
arguments
Type: PostSharp.AspectsArguments
Arguments with which the handler should be invoked.

Return Value

Type: Object
The value returned by the handler.
Remarks

The instance parameter is passed by reference so that instance methods of value types ( struct in C#) are allowed to change the value of the instance.

Note Note
The Invoke Event Handler semantic is different from normal event firing. Indeed, when you fire an event, all handlers that were added to this event are fired. However, the current method invokes only a single handler: the one passed to the handler parameter.
See Also

Reference

IEventBinding Interface
PostSharp.Aspects Namespace


IEventBinding.RemoveHandler Method

IEventBindingRemoveHandler Method

Invoke the Remove semantic on the next node in the chain of invocation.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void RemoveHandler(
    ref Object instance,
    Delegate handler
)

Parameters

instance
Type: SystemObject
Target instance on which the event is defined (null if the event is static).
handler
Type: SystemDelegate
Handler to be removed from the event.
Remarks

The instance parameter is passed by reference so that instance methods of value types ( struct in C#) are allowed to change the value of the instance.

See Also

Reference

IEventBinding Interface
PostSharp.Aspects Namespace


IEventInterceptionAspect Interface

Runtime semantics of an aspect that, when applied on an event, intercepts invocations of its semantics Add (OnAddHandler(EventInterceptionArgs)), Remove (OnRemoveHandler(EventInterceptionArgs)) and Invoke (OnInvokeHandler(EventInterceptionArgs)) semantics.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IEventInterceptionAspect : IEventLevelAspect,
    IAspect

The IEventInterceptionAspect type exposes the following members.

Methods
 | Name | Description
Public method | OnAddHandler | Method invoked instead of the Add semantic of the event to which the current aspect is applied, i.e. when a new delegate is added to this event.
Public method | OnInvokeHandler | Method invoked when the event to which the current aspect is applied is fired, for each delegate of this event, and instead of invoking this delegate.
Public method | OnRemoveHandler | Method invoked instead of the Remove semantic of the event to which the current aspect is applied, i.e. when a delegate is removed from this event.
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from IEventLevelAspect.)
Top
Remarks

For details, see EventInterceptionAspect

See Also

Reference

PostSharp.Aspects Namespace


IEventInterceptionAspect Methods

The IEventInterceptionAspect type exposes the following members.

Methods
 | Name | Description
Public method | OnAddHandler | Method invoked instead of the Add semantic of the event to which the current aspect is applied, i.e. when a new delegate is added to this event.
Public method | OnInvokeHandler | Method invoked when the event to which the current aspect is applied is fired, for each delegate of this event, and instead of invoking this delegate.
Public method | OnRemoveHandler | Method invoked instead of the Remove semantic of the event to which the current aspect is applied, i.e. when a delegate is removed from this event.
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from IEventLevelAspect.)
Top
See Also

Reference

IEventInterceptionAspect Interface
PostSharp.Aspects Namespace


IEventInterceptionAspect.OnAddHandler Method

IEventInterceptionAspectOnAddHandler Method

Method invoked instead of the Add semantic of the event to which the current aspect is applied, i.e. when a new delegate is added to this event.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void OnAddHandler(
    EventInterceptionArgs args
)

Parameters

args
Type: PostSharp.AspectsEventInterceptionArgs
Handler arguments.
Remarks
Note Note
Because of the way how the C# compiler implements automatic events (i.e. events where you don't implement the Add and Remove semantics manually), the Invoke Event Handler semantic ( OnInvokeHandler(EventInterceptionArgs) or equivalent) shall not be invoked for delegates that have been added from inside the class that declares this event.
See Also

Reference

IEventInterceptionAspect Interface
PostSharp.Aspects Namespace


IEventInterceptionAspect.OnInvokeHandler Method

IEventInterceptionAspectOnInvokeHandler Method

Method invoked when the event to which the current aspect is applied is fired, for each delegate of this event, and instead of invoking this delegate.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void OnInvokeHandler(
    EventInterceptionArgs args
)

Parameters

args
Type: PostSharp.AspectsEventInterceptionArgs
Handler arguments.
Remarks
Note Note
Because of the way how the C# compiler implements automatic events (i.e. events where you don't implement the Add and Remove semantics manually), the Invoke Event Handler semantic ( OnInvokeHandler(EventInterceptionArgs) or equivalent) shall not be invoked for delegates that have been added from inside the class that declares this event.

Note Note
The Invoke Event Handler semantic is different from normal event firing. Indeed, when you fire an event, all handlers that were added to this event are fired. However, the current method invokes only a single handler: the one passed to the handler parameter.
See Also

Reference

IEventInterceptionAspect Interface
PostSharp.Aspects Namespace


IEventInterceptionAspect.OnRemoveHandler Method

IEventInterceptionAspectOnRemoveHandler Method

Method invoked instead of the Remove semantic of the event to which the current aspect is applied, i.e. when a delegate is removed from this event.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void OnRemoveHandler(
    EventInterceptionArgs args
)

Parameters

args
Type: PostSharp.AspectsEventInterceptionArgs
Handler arguments.
Remarks
Note Note
Because of the way how the C# compiler implements automatic events (i.e. events where you don't implement the Add and Remove semantics manually), the Invoke Event Handler semantic ( OnInvokeHandler(EventInterceptionArgs) or equivalent) shall not be invoked for delegates that have been added from inside the class that declares this event.
See Also

Reference

IEventInterceptionAspect Interface
PostSharp.Aspects Namespace


IEventLevelAspect Interface

Runtime semantics of aspects that can be applied on events.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IEventLevelAspect : IAspect

The IEventLevelAspect type exposes the following members.

Methods
 | Name | Description
Public method | RuntimeInitialize | Initializes the current aspect.
Top
See Also

Reference

PostSharp.Aspects Namespace
PostSharp.AspectsEventLevelAspect
PostSharp.AspectsIEventLevelAspectBuildSemantics


IEventLevelAspect Methods

The IEventLevelAspect type exposes the following members.

Methods
 | Name | Description
Public method | RuntimeInitialize | Initializes the current aspect.
Top
See Also

Reference

IEventLevelAspect Interface
PostSharp.Aspects Namespace


IEventLevelAspect.RuntimeInitialize Method

IEventLevelAspectRuntimeInitialize Method

Initializes the current aspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void RuntimeInitialize(
    EventInfo eventInfo
)

Parameters

eventInfo
Type: System.ReflectionEventInfo
Event to which the current aspect is applied.
See Also

Reference

IEventLevelAspect Interface
PostSharp.Aspects Namespace

Other Resources

Conceptual: Initializing Aspects


IEventLevelAspectBuildSemantics Interface

Build-time semantics of aspects that can be applied on events.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IEventLevelAspectBuildSemantics : IAspectBuildSemantics,
    IValidableAnnotation

The IEventLevelAspectBuildSemantics type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.
Public method | CompileTimeValidate | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from IValidableAnnotation.)
Public method | GetAspectConfiguration | Method invoked at build time to get the imperative configuration of the current Aspect. (Inherited from IAspectBuildSemantics.)
Top
See Also

Reference

PostSharp.Aspects Namespace
PostSharp.AspectsEventLevelAspect
PostSharp.AspectsIEventLevelAspect


IEventLevelAspectBuildSemantics Methods

The IEventLevelAspectBuildSemantics type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.
Public method | CompileTimeValidate | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from IValidableAnnotation.)
Public method | GetAspectConfiguration | Method invoked at build time to get the imperative configuration of the current Aspect. (Inherited from IAspectBuildSemantics.)
Top
See Also

Reference

IEventLevelAspectBuildSemantics Interface
PostSharp.Aspects Namespace


IEventLevelAspectBuildSemantics.CompileTimeInitialize Method

IEventLevelAspectBuildSemanticsCompileTimeInitialize Method

Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void CompileTimeInitialize(
    EventInfo targetEvent,
    AspectInfo aspectInfo
)

Parameters

targetEvent
Type: System.ReflectionEventInfo
Event to which the current aspect is applied
aspectInfo
Type: PostSharp.AspectsAspectInfo
Reserved for future usage.
See Also

Reference

IEventLevelAspectBuildSemantics Interface
PostSharp.Aspects Namespace

Other Resources

Conceptual: Initializing Aspects


IFieldLevelAspect Interface

Run-time semantics of aspects applied to fields.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IFieldLevelAspect : IAspect

The IFieldLevelAspect type exposes the following members.

Methods
 | Name | Description
Public method | RuntimeInitialize | Method invoked at runtime before any other method of the aspect is invoked.
Top
See Also

Reference

PostSharp.Aspects Namespace
PostSharp.AspectsIFieldLevelAspectBuildSemantics
PostSharp.AspectsFieldLevelAspect


IFieldLevelAspect Methods

The IFieldLevelAspect type exposes the following members.

Methods
 | Name | Description
Public method | RuntimeInitialize | Method invoked at runtime before any other method of the aspect is invoked.
Top
See Also

Reference

IFieldLevelAspect Interface
PostSharp.Aspects Namespace


IFieldLevelAspect.RuntimeInitialize Method

IFieldLevelAspectRuntimeInitialize Method

Method invoked at runtime before any other method of the aspect is invoked.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void RuntimeInitialize(
    FieldInfo field
)

Parameters

field
Type: System.ReflectionFieldInfo
Field on which this instance is applied.
See Also

Reference

IFieldLevelAspect Interface
PostSharp.Aspects Namespace

Other Resources

Conceptual: Initializing Aspects


IFieldLevelAspectBuildSemantics Interface

Compile-time semantics of IFieldLevelAspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IFieldLevelAspectBuildSemantics : IAspectBuildSemantics,
    IValidableAnnotation

The IFieldLevelAspectBuildSemantics type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.
Public method | CompileTimeValidate | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from IValidableAnnotation.)
Public method | GetAspectConfiguration | Method invoked at build time to get the imperative configuration of the current Aspect. (Inherited from IAspectBuildSemantics.)
Top
See Also

Reference

PostSharp.Aspects Namespace
PostSharp.AspectsIFieldLevelAspect
PostSharp.AspectsFieldLevelAspect


IFieldLevelAspectBuildSemantics Methods

The IFieldLevelAspectBuildSemantics type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.
Public method | CompileTimeValidate | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from IValidableAnnotation.)
Public method | GetAspectConfiguration | Method invoked at build time to get the imperative configuration of the current Aspect. (Inherited from IAspectBuildSemantics.)
Top
See Also

Reference

IFieldLevelAspectBuildSemantics Interface
PostSharp.Aspects Namespace


IFieldLevelAspectBuildSemantics.CompileTimeInitialize Method

IFieldLevelAspectBuildSemanticsCompileTimeInitialize Method

Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void CompileTimeInitialize(
    FieldInfo field,
    AspectInfo aspectInfo
)

Parameters

field
Type: System.ReflectionFieldInfo
Field to which the current aspect is applied
aspectInfo
Type: PostSharp.AspectsAspectInfo
Reserved for future usage.
See Also

Reference

IFieldLevelAspectBuildSemantics Interface
PostSharp.Aspects Namespace

Other Resources

Conceptual: Initializing Aspects


IInstanceScopedAspect Interface

Runtime semantics of aspects that have the same lifetime as instance of types to which their are applied (or instance of the declaring type of members to which they are applied).

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IInstanceScopedAspect : IAspect

The IInstanceScopedAspect type exposes the following members.

Methods
 | Name | Description
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype.
Public method | RuntimeInitializeInstance | Initializes the aspect instance. This method is invoked when all system elements of the aspect (like member imports) have completed.
Top
Remarks

When an aspect is instance-scoped, a new instance of this aspect is created whenever an instance of the type to which it has been applied is created (concretely, before the call to the base constructor and the own constructor of this type).

New aspect instances are obtained using the prototype design pattern. As any other aspect, an instance-scope aspect has a static instance initialized at build time, then serialized, deserialized at runtime, and initialized by RuntimeInitialize. This static instance then serves as a prototype. When a new instance of the target type is created, the prototype is cloned by the method CreateInstance(AdviceArgs) (typically implemented by a call to MemberwiseClone). Then some system initializations (for instance member import) are performed on the aspect instance, and finally the RuntimeInitializeInstance method is invoked.

When an aspect implementing the IInstanceScopedAspect interface is applied on a static method, field, property, or event, the aspect will be statically scoped and the interface will be ignored.

See Also

Reference

PostSharp.Aspects Namespace

Other Resources

Conceptual: Understanding Aspect Lifetime and Scope
Conceptual: Consuming Dependencies from an Aspect
Conceptual: Importing Dependencies from the Target Object
Conceptual: Understanding Aspect Lifetime and Scope


IInstanceScopedAspect Methods

The IInstanceScopedAspect type exposes the following members.

Methods
 | Name | Description
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype.
Public method | RuntimeInitializeInstance | Initializes the aspect instance. This method is invoked when all system elements of the aspect (like member imports) have completed.
Top
See Also

Reference

IInstanceScopedAspect Interface
PostSharp.Aspects Namespace


IInstanceScopedAspect.CreateInstance Method

IInstanceScopedAspectCreateInstance Method

Creates a new instance of the aspect based on the current instance, serving as a prototype.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Object CreateInstance(
    AdviceArgs adviceArgs
)

Parameters

adviceArgs
Type: PostSharp.AspectsAdviceArgs
Aspect arguments.

Return Value

Type: Object
A new instance of the aspect, typically a clone of the current prototype instance.
Remarks
This method is typically implemented by invoking MemberwiseClone.
See Also

Reference

IInstanceScopedAspect Interface
PostSharp.Aspects Namespace

Other Resources

Conceptual: Initializing Aspects
Conceptual: Understanding Aspect Lifetime and Scope


IInstanceScopedAspect.RuntimeInitializeInstance Method

IInstanceScopedAspectRuntimeInitializeInstance Method

Initializes the aspect instance. This method is invoked when all system elements of the aspect (like member imports) have completed.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void RuntimeInitializeInstance()
See Also

Reference

IInstanceScopedAspect Interface
PostSharp.Aspects Namespace
PostSharp.Aspects.AdvicesInitializeAspectInstanceAdvice

Other Resources

Conceptual: Initializing Aspects
Conceptual: Understanding Aspect Lifetime and Scope
Conceptual: What's New in PostSharp 4.0


ILocationBinding Interface

Interface through which a field- or property-level aspect or advice can invoke the next node in the chain of invocation.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ILocationBinding

The ILocationBinding type exposes the following members.

Properties
 | Name | Description
Public property | DeclarationIdentifier | Gets the DeclarationIdentifier of the declaration that the binding represents.
Public property | LocationInfo | Gets metadata information about the field or property represented by the current binding.
Public property | LocationType | Gets the type of the field or property.
Top
Methods
 | Name | Description
Public method | ExecuteTPayload | Provides a mechanism to execute a strongly-typed action that depends on the type of the current location.
Public method | GetValue | Invokes the Get semantic on the next node in the chain of invocation.
Public method | SetValue | Invokes the Set semantic on the next node in the chain of invocation.
Top
Extension Methods
 | Name | Description
Public Extension Method | GetValue(Object) | Overloaded. Gets the value of a field or property. (Defined by LocationBindingExtensions.)
Public Extension Method | GetValue(Object, Arguments) | Overloaded. Gets the value of an indexer (property with arguments). (Defined by LocationBindingExtensions.)
Public Extension Method | SetValue(Object, Object) | Overloaded. Sets the value of a field or property. (Defined by LocationBindingExtensions.)
Public Extension Method | SetValue(Object, Arguments, Object) | Overloaded. Sets the value of an indexer (property with arguments). (Defined by LocationBindingExtensions.)
Top
See Also

Reference

PostSharp.Aspects Namespace
PostSharp.Aspects.AdvicesImportMemberAttribute
PostSharp.AspectsILocationBindingT

Other Resources

Conceptual: Aspect Bindings


ILocationBinding Properties

The ILocationBinding type exposes the following members.

Properties
 | Name | Description
Public property | DeclarationIdentifier | Gets the DeclarationIdentifier of the declaration that the binding represents.
Public property | LocationInfo | Gets metadata information about the field or property represented by the current binding.
Public property | LocationType | Gets the type of the field or property.
Top
See Also

Reference

ILocationBinding Interface
PostSharp.Aspects Namespace


ILocationBinding.DeclarationIdentifier Property

ILocationBindingDeclarationIdentifier Property

Gets the DeclarationIdentifier of the declaration that the binding represents.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
DeclarationIdentifier DeclarationIdentifier { get; }

Property Value

Type: DeclarationIdentifier
Remarks

For usage information, see the remarks of the DeclarationIdentifier type documentation.

See Also

Reference

ILocationBinding Interface
PostSharp.Aspects Namespace


ILocationBinding.LocationInfo Property

ILocationBindingLocationInfo Property

Gets metadata information about the field or property represented by the current binding.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
LocationInfo LocationInfo { get; }

Property Value

Type: LocationInfo
See Also

Reference

ILocationBinding Interface
PostSharp.Aspects Namespace


ILocationBinding.LocationType Property

ILocationBindingLocationType Property

Gets the type of the field or property.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Type LocationType { get; }

Property Value

Type: Type
See Also

Reference

ILocationBinding Interface
PostSharp.Aspects Namespace


ILocationBinding Methods

The ILocationBinding type exposes the following members.

Methods
 | Name | Description
Public method | ExecuteTPayload | Provides a mechanism to execute a strongly-typed action that depends on the type of the current location.
Public method | GetValue | Invokes the Get semantic on the next node in the chain of invocation.
Public method | SetValue | Invokes the Set semantic on the next node in the chain of invocation.
Top
Extension Methods
 | Name | Description
Public Extension Method | GetValue(Object) | Overloaded. Gets the value of a field or property. (Defined by LocationBindingExtensions.)
Public Extension Method | GetValue(Object, Arguments) | Overloaded. Gets the value of an indexer (property with arguments). (Defined by LocationBindingExtensions.)
Public Extension Method | SetValue(Object, Object) | Overloaded. Sets the value of a field or property. (Defined by LocationBindingExtensions.)
Public Extension Method | SetValue(Object, Arguments, Object) | Overloaded. Sets the value of an indexer (property with arguments). (Defined by LocationBindingExtensions.)
Top
See Also

Reference

ILocationBinding Interface
PostSharp.Aspects Namespace


ILocationBinding.Execute(TPayload) Method

ILocationBindingExecuteTPayload Method

Provides a mechanism to execute a strongly-typed action that depends on the type of the current location.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void Execute<TPayload>(
    ILocationBindingAction<TPayload> action,
    ref TPayload payload
)

Parameters

action
Type: PostSharp.AspectsILocationBindingAction TPayload
Action.
payload
Type: TPayload
Payload.

Type Parameters

TPayload
Type of the payload passed to the payload parameter.
See Also

Reference

ILocationBinding Interface
PostSharp.Aspects Namespace


ILocationBinding.GetValue Method

ILocationBindingGetValue Method

Invokes the Get semantic on the next node in the chain of invocation.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Object GetValue(
    ref Object instance,
    Arguments index
)

Parameters

instance
Type: SystemObject
Target instance from which the field or property should be retrieved (null if the field or property is static).
index
Type: PostSharp.AspectsArguments
Index arguments, if the location is an indexer property.

Return Value

Type: Object
The value stored at the location.
Remarks

The instance parameter is passed by reference so that instance methods of value types ( struct in C#) are allowed to change the value of the instance.

See Also

Reference

ILocationBinding Interface
PostSharp.Aspects Namespace


ILocationBinding.SetValue Method

ILocationBindingSetValue Method

Invokes the Set semantic on the next node in the chain of invocation.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void SetValue(
    ref Object instance,
    Arguments index,
    Object value
)

Parameters

instance
Type: SystemObject
Target instance from which the field or property should be retrieved (null if the field or property is static).
index
Type: PostSharp.AspectsArguments
Index arguments, if the location is an indexer property.
value
Type: SystemObject
New value to be stored at the location.
Remarks

The instance parameter is passed by reference so that instance methods of value types ( struct in C#) are allowed to change the value of the instance.

See Also

Reference

ILocationBinding Interface
PostSharp.Aspects Namespace


ILocationBinding(T) Interface

ILocationBindingT Interface

A strongly-typed variant for ILocationBinding.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ILocationBinding<T> : ILocationBinding

Type Parameters

T

The ILocationBindingT type exposes the following members.

Properties
 | Name | Description
Public property | DeclarationIdentifier | Gets the DeclarationIdentifier of the declaration that the binding represents. (Inherited from ILocationBinding.)
Public property | LocationInfo | Gets metadata information about the field or property represented by the current binding. (Inherited from ILocationBinding.)
Public property | LocationType | Gets the type of the field or property. (Inherited from ILocationBinding.)
Top
Methods
 | Name | Description
Public method | ExecuteTPayload | Provides a mechanism to execute a strongly-typed action that depends on the type of the current location. (Inherited from ILocationBinding.)
Public method | GetValue | Invokes the Get semantic on the next node in the chain of invocation.
Public method | SetValue(Object, Arguments, Object) | Invokes the Set semantic on the next node in the chain of invocation. (Inherited from ILocationBinding.)
Public method | SetValue(Object, Arguments, T) | Invokes the Set semantic on the next node in the chain of invocation.
Top
Extension Methods
 | Name | Description
Public Extension Method | GetValue(Object) | Overloaded. Gets the value of a field or property. (Defined by LocationBindingExtensions.)
Public Extension Method | GetValue(Object, Arguments) | Overloaded. Gets the value of an indexer (property with arguments). (Defined by LocationBindingExtensions.)
Public Extension Method | GetValueT(Object) | Overloaded. Gets the value of a field or property. (Defined by LocationBindingExtensions.)
Public Extension Method | GetValueT(Object, Arguments) | Overloaded. Gets the value of an indexer (property with arguments). (Defined by LocationBindingExtensions.)
Public Extension Method | SetValue(Object, Object) | Overloaded. Sets the value of a field or property. (Defined by LocationBindingExtensions.)
Public Extension Method | SetValue(Object, Arguments, Object) | Overloaded. Sets the value of an indexer (property with arguments). (Defined by LocationBindingExtensions.)
Public Extension Method | SetValueT(Object, T) | Overloaded. Sets the value of a field or property. (Defined by LocationBindingExtensions.)
Public Extension Method | SetValueT(Object, Arguments, T) | Overloaded. Sets the value of an indexer (property with arguments). (Defined by LocationBindingExtensions.)
Top
See Also

Reference

PostSharp.Aspects Namespace


ILocationBinding(T) Properties

ILocationBindingT Properties

The ILocationBindingT generic type exposes the following members.

Properties
 | Name | Description
Public property | DeclarationIdentifier | Gets the DeclarationIdentifier of the declaration that the binding represents. (Inherited from ILocationBinding.)
Public property | LocationInfo | Gets metadata information about the field or property represented by the current binding. (Inherited from ILocationBinding.)
Public property | LocationType | Gets the type of the field or property. (Inherited from ILocationBinding.)
Top
See Also

Reference

ILocationBindingT Interface
PostSharp.Aspects Namespace


ILocationBinding(T) Methods

ILocationBindingT Methods

The ILocationBindingT generic type exposes the following members.

Methods
 | Name | Description
Public method | ExecuteTPayload | Provides a mechanism to execute a strongly-typed action that depends on the type of the current location. (Inherited from ILocationBinding.)
Public method | GetValue | Invokes the Get semantic on the next node in the chain of invocation.
Public method | SetValue(Object, Arguments, Object) | Invokes the Set semantic on the next node in the chain of invocation. (Inherited from ILocationBinding.)
Public method | SetValue(Object, Arguments, T) | Invokes the Set semantic on the next node in the chain of invocation.
Top
Extension Methods
 | Name | Description
Public Extension Method | GetValue(Object) | Overloaded. Gets the value of a field or property. (Defined by LocationBindingExtensions.)
Public Extension Method | GetValue(Object, Arguments) | Overloaded. Gets the value of an indexer (property with arguments). (Defined by LocationBindingExtensions.)
Public Extension Method | GetValueT(Object) | Overloaded. Gets the value of a field or property. (Defined by LocationBindingExtensions.)
Public Extension Method | GetValueT(Object, Arguments) | Overloaded. Gets the value of an indexer (property with arguments). (Defined by LocationBindingExtensions.)
Public Extension Method | SetValue(Object, Object) | Overloaded. Sets the value of a field or property. (Defined by LocationBindingExtensions.)
Public Extension Method | SetValue(Object, Arguments, Object) | Overloaded. Sets the value of an indexer (property with arguments). (Defined by LocationBindingExtensions.)
Public Extension Method | SetValueT(Object, T) | Overloaded. Sets the value of a field or property. (Defined by LocationBindingExtensions.)
Public Extension Method | SetValueT(Object, Arguments, T) | Overloaded. Sets the value of an indexer (property with arguments). (Defined by LocationBindingExtensions.)
Top
See Also

Reference

ILocationBindingT Interface
PostSharp.Aspects Namespace


ILocationBinding(T).GetValue Method

ILocationBindingTGetValue Method

Invokes the Get semantic on the next node in the chain of invocation.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
T GetValue(
    ref Object instance,
    Arguments index
)

Parameters

instance
Type: SystemObject
Target instance from which the field or property should be retrieved (null if the field or property is static).
index
Type: PostSharp.AspectsArguments
Index arguments, if the location is an indexer property.

Return Value

Type: T
The value stored at the location.
Remarks

The instance parameter is passed by reference so that instance methods of value types ( struct in C#) are allowed to change the value of the instance.

See Also

Reference

ILocationBindingT Interface
PostSharp.Aspects Namespace


ILocationBinding(T).SetValue Method

ILocationBindingTSetValue Method

Overload List
 | Name | Description
Public method | SetValue(Object, Arguments, Object) | Invokes the Set semantic on the next node in the chain of invocation. (Inherited from ILocationBinding.)
Public method | SetValue(Object, Arguments, T) | Invokes the Set semantic on the next node in the chain of invocation.
Top
See Also

Reference

ILocationBindingT Interface
PostSharp.Aspects Namespace


ILocationBinding(T).SetValue Method (Object, Arguments, T)

ILocationBindingTSetValue Method (Object, Arguments, T)

Invokes the Set semantic on the next node in the chain of invocation.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void SetValue(
    ref Object instance,
    Arguments index,
    T value
)

Parameters

instance
Type: SystemObject
Target instance from which the field or property should be retrieved (null if the field or property is static).
index
Type: PostSharp.AspectsArguments
Index arguments, if the location is an indexer property.
value
Type: T
New value to be stored at the location.
Remarks

The instance parameter is passed by reference so that instance methods of value types ( struct in C#) are allowed to change the value of the instance.

See Also

Reference

ILocationBindingT Interface
SetValue Overload
PostSharp.Aspects Namespace


ILocationBindingAction(TPayload) Interface

ILocationBindingActionTPayload Interface

Exposes an ExecuteTValue(ILocationBindingTValue, TPayload) method invoked by the ExecuteTPayload(ILocationBindingActionTPayload, TPayload) method, which allows to execute strongly-typed operations and avoid boxing required by the weakly typed ILocationBinding interface.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ILocationBindingAction<TPayload>

Type Parameters

TPayload
Type of the payload of the ExecuteTValue(ILocationBindingTValue, TPayload) method.

The ILocationBindingActionTPayload type exposes the following members.

Methods
 | Name | Description
Public method | ExecuteTValue | Method invoked by the ExecuteTPayload(ILocationBindingActionTPayload, TPayload) method.
Top
See Also

Reference

PostSharp.Aspects Namespace


ILocationBindingAction(TPayload) Methods

ILocationBindingActionTPayload Methods

The ILocationBindingActionTPayload generic type exposes the following members.

Methods
 | Name | Description
Public method | ExecuteTValue | Method invoked by the ExecuteTPayload(ILocationBindingActionTPayload, TPayload) method.
Top
See Also

Reference

ILocationBindingActionTPayload Interface
PostSharp.Aspects Namespace


ILocationBindingAction(TPayload).Execute(TValue) Method

ILocationBindingActionTPayloadExecuteTValue Method

Method invoked by the ExecuteTPayload(ILocationBindingActionTPayload, TPayload) method.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void Execute<TValue>(
    ILocationBinding<TValue> binding,
    ref TPayload payload
)

Parameters

binding
Type: PostSharp.AspectsILocationBinding TValue
The typed ILocationBinding.
payload
Type: TPayload
Payload.

Type Parameters

TValue
Type of the value of the ILocationBinding object.
See Also

Reference

ILocationBindingActionTPayload Interface
PostSharp.Aspects Namespace


ILocationInterceptionArgs Interface

An interface for LocationInterceptionArgs.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ILocationInterceptionArgs

The ILocationInterceptionArgs type exposes the following members.

Properties
 | Name | Description
Public property | Binding | Gets an interface that allows to invoke the next node in the chain of invocation of the intercepted method.
Public property | Index | Gets the current index arguments (in case of a property with parameters).
Public property | Instance | Gets or sets the object instance on which the method is being executed.
Public property | Location | Gets the location (field, property or parameter) related to the aspect or advice being executed.
Public property | LocationFullName | Gets the full name (including the full name of the declaring type) of the location (field, property or parameter) related to the aspect or advice being executed.
Public property | LocationName | Gets the name of the location (field, property or parameter) related to the aspect or advice being executed.
Public property | Value | Gets or sets the location value.
Top
Methods
 | Name | Description
Public method | ExecuteTPayload | Executes a delegate for the current LocationInterceptionArgs. This method allows to execute strongly-typed operations and avoid boxing required by the weakly typed ILocationInterceptionArgs interface.
Public method | GetCurrentValue | Retrieves the current value of the location without overwriting the Value property.
Public method | ProceedGetValue | Invokes the Get Location Value semantic on the next node in the chain of invocation and stores the location value in the Value property.
Public method | ProceedSetValue | Invokes the Set Location Value semantic on the next node in the chain of invocation and stores the value of the Value property into the location.
Public method | SetNewValue | Sets the value of the location without overwriting the Value property.
Top
Remarks

This interface is not generally used directly, but it serves as a base for the strongly-typed ILocationInterceptionArgsT, which is used by ExecuteTPayload(ILocationInterceptionArgsActionTPayload, TPayload).

See Also

Reference

PostSharp.Aspects Namespace


ILocationInterceptionArgs Properties

The ILocationInterceptionArgs type exposes the following members.

Properties
 | Name | Description
Public property | Binding | Gets an interface that allows to invoke the next node in the chain of invocation of the intercepted method.
Public property | Index | Gets the current index arguments (in case of a property with parameters).
Public property | Instance | Gets or sets the object instance on which the method is being executed.
Public property | Location | Gets the location (field, property or parameter) related to the aspect or advice being executed.
Public property | LocationFullName | Gets the full name (including the full name of the declaring type) of the location (field, property or parameter) related to the aspect or advice being executed.
Public property | LocationName | Gets the name of the location (field, property or parameter) related to the aspect or advice being executed.
Public property | Value | Gets or sets the location value.
Top
See Also

Reference

ILocationInterceptionArgs Interface
PostSharp.Aspects Namespace


ILocationInterceptionArgs.Binding Property

ILocationInterceptionArgsBinding Property

Gets an interface that allows to invoke the next node in the chain of invocation of the intercepted method.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
ILocationBinding Binding { get; }

Property Value

Type: ILocationBinding
Remarks

Bindings are thread-safe and context-free singleton instances exposing the next node in the chain of invocation.

See Also

Reference

ILocationInterceptionArgs Interface
PostSharp.Aspects Namespace

Other Resources

Conceptual: Aspect Bindings


ILocationInterceptionArgs.Index Property

ILocationInterceptionArgsIndex Property

Gets the current index arguments (in case of a property with parameters).

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Arguments Index { get; }

Property Value

Type: Arguments
See Also

Reference

ILocationInterceptionArgs Interface
PostSharp.Aspects Namespace


ILocationInterceptionArgs.Instance Property

ILocationInterceptionArgsInstance Property

Gets or sets the object instance on which the method is being executed.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Object Instance { get; set; }

Property Value

Type: Object
Remarks
This set may be set by user code only when the instance is a value type. As usually, user code is responsible for setting an object of the right type.
See Also

Reference

ILocationInterceptionArgs Interface
PostSharp.Aspects Namespace


ILocationInterceptionArgs.Location Property

ILocationInterceptionArgsLocation Property

Gets the location (field, property or parameter) related to the aspect or advice being executed.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
LocationInfo Location { get; set; }

Property Value

Type: LocationInfo
Remarks
Note Note
Using this property causes the aspect weaver to generate code that has non-trivial runtime overhead. Avoid using this property whenever possible. One of the possible solution is to use compile-time initialization of aspect instances and to make use of reflection only at build time.
See Also

Reference

ILocationInterceptionArgs Interface
PostSharp.Aspects Namespace


ILocationInterceptionArgs.LocationFullName Property

ILocationInterceptionArgsLocationFullName Property

Gets the full name (including the full name of the declaring type) of the location (field, property or parameter) related to the aspect or advice being executed.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
string LocationFullName { get; set; }

Property Value

Type: String
See Also

Reference

ILocationInterceptionArgs Interface
PostSharp.Aspects Namespace


ILocationInterceptionArgs.LocationName Property

ILocationInterceptionArgsLocationName Property

Gets the name of the location (field, property or parameter) related to the aspect or advice being executed.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
string LocationName { get; set; }

Property Value

Type: String
See Also

Reference

ILocationInterceptionArgs Interface
PostSharp.Aspects Namespace


ILocationInterceptionArgs.Value Property

ILocationInterceptionArgsValue Property

Gets or sets the location value.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Object Value { get; set; }

Property Value

Type: Object
Remarks

Inside an OnGetValue(LocationInterceptionArgs) advice, this property is available after the next advice in chain has been invoked using ProceedGetValue. However, inside an OnSetValue(LocationInterceptionArgs) advice, the value is available immediately, and is used as input by ProceedSetValue.

See GetCurrentValue and SetNewValue(Object) to get or set the value of the location without affecting the value of this property.

See Also

Reference

ILocationInterceptionArgs Interface
PostSharp.Aspects Namespace


ILocationInterceptionArgs Methods

The ILocationInterceptionArgs type exposes the following members.

Methods
 | Name | Description
Public method | ExecuteTPayload | Executes a delegate for the current LocationInterceptionArgs. This method allows to execute strongly-typed operations and avoid boxing required by the weakly typed ILocationInterceptionArgs interface.
Public method | GetCurrentValue | Retrieves the current value of the location without overwriting the Value property.
Public method | ProceedGetValue | Invokes the Get Location Value semantic on the next node in the chain of invocation and stores the location value in the Value property.
Public method | ProceedSetValue | Invokes the Set Location Value semantic on the next node in the chain of invocation and stores the value of the Value property into the location.
Public method | SetNewValue | Sets the value of the location without overwriting the Value property.
Top
See Also

Reference

ILocationInterceptionArgs Interface
PostSharp.Aspects Namespace


ILocationInterceptionArgs.Execute(TPayload) Method

ILocationInterceptionArgsExecuteTPayload Method

Executes a delegate for the current LocationInterceptionArgs. This method allows to execute strongly-typed operations and avoid boxing required by the weakly typed ILocationInterceptionArgs interface.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void Execute<TPayload>(
    ILocationInterceptionArgsAction<TPayload> action,
    ref TPayload payload
)

Parameters

action
Type: PostSharp.AspectsILocationInterceptionArgsAction TPayload
Class (typically a singleton) that contains the generic method ExecuteTValue(ILocationInterceptionArgsTValue, TPayload) that will be executed with the right method generic argument.
payload
Type: TPayload
An argument being passed to the ExecuteTValue(ILocationInterceptionArgsTValue, TPayload) method of the action parameter.

Type Parameters

TPayload
Type of the payload.
Remarks
Note Note

This method is ignored by the advice optimizer. As a result, the optimizer will not know that the action implementation uses any feature of the LocationInterceptionArgs object, and the code supporting these features won't be generated. If these features are required by action, they must be referenced inside the OnGetValue(LocationInterceptionArgs) or OnSetValue(LocationInterceptionArgs) method.

See Also

Reference

ILocationInterceptionArgs Interface
PostSharp.Aspects Namespace


ILocationInterceptionArgs.GetCurrentValue Method

ILocationInterceptionArgsGetCurrentValue Method

Retrieves the current value of the location without overwriting the Value property.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Object GetCurrentValue()

Return Value

Type: Object
The current value of the location, as returned by the next node in the chain of invocation (see Binding).
Remarks
Note Note
This method is designed to be invoked during the execution of the advice. If you need to retrieve or store the value of the location at a different time, it is recommended to use the Binding . Indeed, a binding is stateless, while LocationInterceptionArgs instances may be shared among different aspects.
See Also

Reference

ILocationInterceptionArgs Interface
PostSharp.Aspects Namespace


ILocationInterceptionArgs.ProceedGetValue Method

ILocationInterceptionArgsProceedGetValue Method

Invokes the Get Location Value semantic on the next node in the chain of invocation and stores the location value in the Value property.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void ProceedGetValue()
Remarks

Note that this method overwrites the content of the Value property. Therefore, you should not call this invoke from a OnSetValue(LocationInterceptionArgs) advice unless you store the value before. If you need to retrieve the current value of the location from a OnSetValue(LocationInterceptionArgs) advice, it is recommended you use the GetCurrentValue method.

Note Note
This method is designed to be invoked during the execution of the advice. If you need to retrieve or store the value of the location at a different time, it is recommended to use the Binding . Indeed, a binding is stateless, while LocationInterceptionArgs instances may be shared among different aspects.
See Also

Reference

ILocationInterceptionArgs Interface
PostSharp.Aspects Namespace


ILocationInterceptionArgs.ProceedSetValue Method

ILocationInterceptionArgsProceedSetValue Method

Invokes the Set Location Value semantic on the next node in the chain of invocation and stores the value of the Value property into the location.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void ProceedSetValue()
Remarks

Note that this method requires the value to be stored in the Value property. If you need to retrieve the current value of the location from a OnSetValue(LocationInterceptionArgs) advice, it is recommended you use the GetCurrentValue method.

Note Note
This method is designed to be invoked during the execution of the advice. If you need to retrieve or store the value of the location at a different time, it is recommended to use the Binding . Indeed, a binding is stateless, while LocationInterceptionArgs instances may be shared among different aspects.
See Also

Reference

ILocationInterceptionArgs Interface
PostSharp.Aspects Namespace


ILocationInterceptionArgs.SetNewValue Method

ILocationInterceptionArgsSetNewValue Method

Sets the value of the location without overwriting the Value property.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void SetNewValue(
    Object value
)

Parameters

value
Type: SystemObject
The value to be passed to the next node in the chain of invocation (see Binding).
Remarks

Note Note
This method is designed to be invoked during the execution of the advice. If you need to retrieve or store the value of the location at a different time, it is recommended to use the Binding . Indeed, a binding is stateless, while LocationInterceptionArgs instances may be shared among different aspects.
See Also

Reference

ILocationInterceptionArgs Interface
PostSharp.Aspects Namespace


ILocationInterceptionArgs(T) Interface

ILocationInterceptionArgsT Interface

A strongly-typed specialization of the ILocationInterceptionArgs interface.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ILocationInterceptionArgs<T> : ILocationInterceptionArgs

Type Parameters

T
Type of the location value.

The ILocationInterceptionArgsT type exposes the following members.

Properties
 | Name | Description
Public property | Binding | Gets an interface that allows to invoke the next node in the chain of invocation of the intercepted method.
Public property | Index | Gets the current index arguments (in case of a property with parameters). (Inherited from ILocationInterceptionArgs.)
Public property | Instance | Gets or sets the object instance on which the method is being executed. (Inherited from ILocationInterceptionArgs.)
Public property | Location | Gets the location (field, property or parameter) related to the aspect or advice being executed. (Inherited from ILocationInterceptionArgs.)
Public property | LocationFullName | Gets the full name (including the full name of the declaring type) of the location (field, property or parameter) related to the aspect or advice being executed. (Inherited from ILocationInterceptionArgs.)
Public property | LocationName | Gets the name of the location (field, property or parameter) related to the aspect or advice being executed. (Inherited from ILocationInterceptionArgs.)
Public property | Value | Gets or sets the location value.
Top
Methods
 | Name | Description
Public method | ExecuteTPayload | Executes a delegate for the current LocationInterceptionArgs. This method allows to execute strongly-typed operations and avoid boxing required by the weakly typed ILocationInterceptionArgs interface. (Inherited from ILocationInterceptionArgs.)
Public method | GetCurrentValue | Retrieves the current value of the location without overwriting the Value property.
Public method | ProceedGetValue | Invokes the Get Location Value semantic on the next node in the chain of invocation and stores the location value in the Value property. (Inherited from ILocationInterceptionArgs.)
Public method | ProceedSetValue | Invokes the Set Location Value semantic on the next node in the chain of invocation and stores the value of the Value property into the location. (Inherited from ILocationInterceptionArgs.)
Public method | SetNewValue(Object) | Sets the value of the location without overwriting the Value property. (Inherited from ILocationInterceptionArgs.)
Public method | SetNewValue(T) | Sets the value of the location without overwriting the Value property.
Top
Remarks
Use the ExecuteTPayload(ILocationInterceptionArgsActionTPayload, TPayload) method to consume this interface.
See Also

Reference

PostSharp.Aspects Namespace


ILocationInterceptionArgs(T) Properties

ILocationInterceptionArgsT Properties

The ILocationInterceptionArgsT generic type exposes the following members.

Properties
 | Name | Description
Public property | Binding | Gets an interface that allows to invoke the next node in the chain of invocation of the intercepted method.
Public property | Index | Gets the current index arguments (in case of a property with parameters). (Inherited from ILocationInterceptionArgs.)
Public property | Instance | Gets or sets the object instance on which the method is being executed. (Inherited from ILocationInterceptionArgs.)
Public property | Location | Gets the location (field, property or parameter) related to the aspect or advice being executed. (Inherited from ILocationInterceptionArgs.)
Public property | LocationFullName | Gets the full name (including the full name of the declaring type) of the location (field, property or parameter) related to the aspect or advice being executed. (Inherited from ILocationInterceptionArgs.)
Public property | LocationName | Gets the name of the location (field, property or parameter) related to the aspect or advice being executed. (Inherited from ILocationInterceptionArgs.)
Public property | Value | Gets or sets the location value.
Top
See Also

Reference

ILocationInterceptionArgsT Interface
PostSharp.Aspects Namespace


ILocationInterceptionArgs(T).Binding Property

ILocationInterceptionArgsTBinding Property

Gets an interface that allows to invoke the next node in the chain of invocation of the intercepted method.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
ILocationBinding<T> Binding { get; }

Property Value

Type: ILocationBinding T
Remarks

Bindings are thread-safe and context-free singleton instances exposing the next node in the chain of invocation.

See Also

Reference

ILocationInterceptionArgsT Interface
PostSharp.Aspects Namespace

Other Resources

Conceptual: Aspect Bindings


ILocationInterceptionArgs(T).Value Property

ILocationInterceptionArgsTValue Property

Gets or sets the location value.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
T Value { get; set; }

Property Value

Type: T
Remarks

Inside an OnGetValue(LocationInterceptionArgs) advice, this property is available after the next advice in chain has been invoked using ProceedGetValue. However, inside an OnSetValue(LocationInterceptionArgs) advice, the value is available immediately, and is used as input by ProceedSetValue.

See GetCurrentValue and SetNewValue(T) to get or set the value of the location without affecting the value of this property.

See Also

Reference

ILocationInterceptionArgsT Interface
PostSharp.Aspects Namespace


ILocationInterceptionArgs(T) Methods

ILocationInterceptionArgsT Methods

The ILocationInterceptionArgsT generic type exposes the following members.

Methods
 | Name | Description
Public method | ExecuteTPayload | Executes a delegate for the current LocationInterceptionArgs. This method allows to execute strongly-typed operations and avoid boxing required by the weakly typed ILocationInterceptionArgs interface. (Inherited from ILocationInterceptionArgs.)
Public method | GetCurrentValue | Retrieves the current value of the location without overwriting the Value property.
Public method | ProceedGetValue | Invokes the Get Location Value semantic on the next node in the chain of invocation and stores the location value in the Value property. (Inherited from ILocationInterceptionArgs.)
Public method | ProceedSetValue | Invokes the Set Location Value semantic on the next node in the chain of invocation and stores the value of the Value property into the location. (Inherited from ILocationInterceptionArgs.)
Public method | SetNewValue(Object) | Sets the value of the location without overwriting the Value property. (Inherited from ILocationInterceptionArgs.)
Public method | SetNewValue(T) | Sets the value of the location without overwriting the Value property.
Top
See Also

Reference

ILocationInterceptionArgsT Interface
PostSharp.Aspects Namespace


ILocationInterceptionArgs(T).GetCurrentValue Method

ILocationInterceptionArgsTGetCurrentValue Method

Retrieves the current value of the location without overwriting the Value property.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
T GetCurrentValue()

Return Value

Type: T
The current value of the location, as returned by the next node in the chain of invocation (see Binding).
Remarks
Note Note
This method is designed to be invoked during the execution of the advice. If you need to retrieve or store the value of the location at a different time, it is recommended to use the Binding . Indeed, a binding is stateless, while LocationInterceptionArgs instances may be shared among different aspects.
See Also

Reference

ILocationInterceptionArgsT Interface
PostSharp.Aspects Namespace


ILocationInterceptionArgs(T).SetNewValue Method

ILocationInterceptionArgsTSetNewValue Method

Overload List
 | Name | Description
Public method | SetNewValue(Object) | Sets the value of the location without overwriting the Value property. (Inherited from ILocationInterceptionArgs.)
Public method | SetNewValue(T) | Sets the value of the location without overwriting the Value property.
Top
See Also

Reference

ILocationInterceptionArgsT Interface
PostSharp.Aspects Namespace


ILocationInterceptionArgs(T).SetNewValue Method (T)

ILocationInterceptionArgsTSetNewValue Method (T)

Sets the value of the location without overwriting the Value property.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void SetNewValue(
    T value
)

Parameters

value
Type: T
The value to be passed to the next node in the chain of invocation (see Binding).
Remarks

Note Note
This method is designed to be invoked during the execution of the advice. If you need to retrieve or store the value of the location at a different time, it is recommended to use the Binding . Indeed, a binding is stateless, while LocationInterceptionArgs instances may be shared among different aspects.
See Also

Reference

ILocationInterceptionArgsT Interface
SetNewValue Overload
PostSharp.Aspects Namespace


ILocationInterceptionArgsAction(TPayload) Interface

ILocationInterceptionArgsActionTPayload Interface

Exposes an ExecuteTValue(ILocationInterceptionArgsTValue, TPayload) method invoked by the ExecuteTPayload(ILocationInterceptionArgsActionTPayload, TPayload) method, which allows to execute strongly-typed operations and avoid boxing required by the weakly typed ILocationInterceptionArgs interface.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ILocationInterceptionArgsAction<TPayload>

Type Parameters

TPayload
Type of the payload of the ExecuteTValue(ILocationInterceptionArgsTValue, TPayload) method.

The ILocationInterceptionArgsActionTPayload type exposes the following members.

Methods
 | Name | Description
Public method | ExecuteTValue | Method invoked by the ExecuteTPayload(ILocationInterceptionArgsActionTPayload, TPayload) method.
Top
See Also

Reference

PostSharp.Aspects Namespace


ILocationInterceptionArgsAction(TPayload) Methods

ILocationInterceptionArgsActionTPayload Methods

The ILocationInterceptionArgsActionTPayload generic type exposes the following members.

Methods
 | Name | Description
Public method | ExecuteTValue | Method invoked by the ExecuteTPayload(ILocationInterceptionArgsActionTPayload, TPayload) method.
Top
See Also

Reference

ILocationInterceptionArgsActionTPayload Interface
PostSharp.Aspects Namespace


ILocationInterceptionArgsAction(TPayload).Execute(TValue) Method

ILocationInterceptionArgsActionTPayloadExecuteTValue Method

Method invoked by the ExecuteTPayload(ILocationInterceptionArgsActionTPayload, TPayload) method.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void Execute<TValue>(
    ILocationInterceptionArgs<TValue> args,
    ref TPayload payload
)

Parameters

args
Type: PostSharp.AspectsILocationInterceptionArgs TValue
The typed LocationInterceptionArgs.
payload
Type: TPayload
Payload passed to the ExecuteTPayload(ILocationInterceptionArgsActionTPayload, TPayload) method.

Type Parameters

TValue
Type of the value of the LocationInterceptionArgs object.
See Also

Reference

ILocationInterceptionArgsActionTPayload Interface
PostSharp.Aspects Namespace


ILocationInterceptionAspect Interface

Runtime semantics of an aspect that, when applied on a location (field or property), intercepts invocations of the Get (OnGetValue(LocationInterceptionArgs)) and Set (OnSetValue(LocationInterceptionArgs)) semantics.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ILocationInterceptionAspect : ILocationLevelAspect,
    IAspect

The ILocationInterceptionAspect type exposes the following members.

Methods
 | Name | Description
Public method | OnGetValue | Method invoked instead of the Get semantic of the field or property to which the current aspect is applied, i.e. when the value of this field or property is retrieved.
Public method | OnSetValue | Method invoked instead of the Set semantic of the field or property to which the current aspect is applied, i.e. when the value of this field or property is changed.
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from ILocationLevelAspect.)
Top
Remarks
See LocationInterceptionAspect for details.
See Also

Reference

PostSharp.Aspects Namespace


ILocationInterceptionAspect Methods

The ILocationInterceptionAspect type exposes the following members.

Methods
 | Name | Description
Public method | OnGetValue | Method invoked instead of the Get semantic of the field or property to which the current aspect is applied, i.e. when the value of this field or property is retrieved.
Public method | OnSetValue | Method invoked instead of the Set semantic of the field or property to which the current aspect is applied, i.e. when the value of this field or property is changed.
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from ILocationLevelAspect.)
Top
See Also

Reference

ILocationInterceptionAspect Interface
PostSharp.Aspects Namespace


ILocationInterceptionAspect.OnGetValue Method

ILocationInterceptionAspectOnGetValue Method

Method invoked instead of the Get semantic of the field or property to which the current aspect is applied, i.e. when the value of this field or property is retrieved.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void OnGetValue(
    LocationInterceptionArgs args
)

Parameters

args
Type: PostSharp.AspectsLocationInterceptionArgs
Advice arguments.
See Also

Reference

ILocationInterceptionAspect Interface
PostSharp.Aspects Namespace
PostSharp.AspectsLocationInterceptionArgs


ILocationInterceptionAspect.OnSetValue Method

ILocationInterceptionAspectOnSetValue Method

Method invoked instead of the Set semantic of the field or property to which the current aspect is applied, i.e. when the value of this field or property is changed.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void OnSetValue(
    LocationInterceptionArgs args
)

Parameters

args
Type: PostSharp.AspectsLocationInterceptionArgs
Advice arguments.
See Also

Reference

ILocationInterceptionAspect Interface
PostSharp.Aspects Namespace
PostSharp.AspectsLocationInterceptionArgs


ILocationLevelAspect Interface

Runtime semantics of aspects defined on a field, property, or parameter.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ILocationLevelAspect : IAspect

The ILocationLevelAspect type exposes the following members.

Methods
 | Name | Description
Public method | RuntimeInitialize | Initializes the current aspect.
Top
See Also

Reference

PostSharp.Aspects Namespace


ILocationLevelAspect Methods

The ILocationLevelAspect type exposes the following members.

Methods
 | Name | Description
Public method | RuntimeInitialize | Initializes the current aspect.
Top
See Also

Reference

ILocationLevelAspect Interface
PostSharp.Aspects Namespace


ILocationLevelAspect.RuntimeInitialize Method

ILocationLevelAspectRuntimeInitialize Method

Initializes the current aspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void RuntimeInitialize(
    LocationInfo locationInfo
)

Parameters

locationInfo
Type: PostSharp.ReflectionLocationInfo
Location to which the current aspect is applied.
See Also

Reference

ILocationLevelAspect Interface
PostSharp.Aspects Namespace

Other Resources

Conceptual: Initializing Aspects


ILocationLevelAspectBuildSemantics Interface

Compile-time semantics of ILocationLevelAspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ILocationLevelAspectBuildSemantics : IAspectBuildSemantics,
    IValidableAnnotation

The ILocationLevelAspectBuildSemantics type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.
Public method | CompileTimeValidate | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from IValidableAnnotation.)
Public method | GetAspectConfiguration | Method invoked at build time to get the imperative configuration of the current Aspect. (Inherited from IAspectBuildSemantics.)
Top
See Also

Reference

PostSharp.Aspects Namespace


ILocationLevelAspectBuildSemantics Methods

The ILocationLevelAspectBuildSemantics type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.
Public method | CompileTimeValidate | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from IValidableAnnotation.)
Public method | GetAspectConfiguration | Method invoked at build time to get the imperative configuration of the current Aspect. (Inherited from IAspectBuildSemantics.)
Top
See Also

Reference

ILocationLevelAspectBuildSemantics Interface
PostSharp.Aspects Namespace


ILocationLevelAspectBuildSemantics.CompileTimeInitialize Method

ILocationLevelAspectBuildSemanticsCompileTimeInitialize Method

Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void CompileTimeInitialize(
    LocationInfo targetLocation,
    AspectInfo aspectInfo
)

Parameters

targetLocation
Type: PostSharp.ReflectionLocationInfo
Location to which the current aspect is applied
aspectInfo
Type: PostSharp.AspectsAspectInfo
Reserved for future usage.
See Also

Reference

ILocationLevelAspectBuildSemantics Interface
PostSharp.Aspects Namespace

Other Resources

Conceptual: Initializing Aspects


ILocationValidationAspect Interface

Ancestor of ILocationValidationAspectT.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ILocationValidationAspect : IAspect
Remarks

This interface exists only because PostSharp SDK requires a common non-generic interface for ILocationValidationAspectT. It should not be used in user code.

See Also

Reference

PostSharp.Aspects Namespace

Other Resources

Conceptual: Contracts
Conceptual: Creating Custom Contracts


ILocationValidationAspect(T) Interface

ILocationValidationAspectT Interface

Runtime semantics of an aspect that, when applied on a location (field, property, or parameter), validates the value assigned to this location using method ValidateValue(T, String, LocationKind, LocationValidationContext), and throws the exception returned by this method if any.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ILocationValidationAspect<T> : ILocationValidationAspect,
    IAspect

Type Parameters

T
Type of values validated by the current aspect.

The ILocationValidationAspectT type exposes the following members.

Methods
 | Name | Description
Public method | ValidateValue | Validates the value being assigned to the location to which the current aspect has been applied.
Top
Remarks

An aspect will typically implement several generic instances of the current interface, with different values of T. The aspect can be applied only to locations for which there is an exact type match. PostSharp does not implement any type conversion, even when this conversion is implicitly supported by the compiler, for instance int to long. Therefore, if your aspect must be able to validate all integers, you may need to implement the interface instances for T ranging in long, int, short, sbyte and possibly their unsigned variant. However, values of a derived type can be validated if T is the base type.

See Also

Reference

PostSharp.Aspects Namespace
PostSharp.Aspects.AdvicesLocationValidationAdvice

Other Resources

Conceptual: Adding Behaviors to Existing Members


ILocationValidationAspect(T) Methods

ILocationValidationAspectT Methods

The ILocationValidationAspectT generic type exposes the following members.

Methods
 | Name | Description
Public method | ValidateValue | Validates the value being assigned to the location to which the current aspect has been applied.
Top
See Also

Reference

ILocationValidationAspectT Interface
PostSharp.Aspects Namespace


ILocationValidationAspect(T).ValidateValue Method

ILocationValidationAspectTValidateValue Method

Validates the value being assigned to the location to which the current aspect has been applied.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Exception ValidateValue(
    T value,
    string locationName,
    LocationKind locationKind,
    LocationValidationContext context
)

Parameters

value
Type: T
Value being applied to the location.
locationName
Type: SystemString
Name of the location.
locationKind
Type: PostSharp.ReflectionLocationKind
Location kind (Field, Property, or Parameter).
context
Type: PostSharp.AspectsLocationValidationContext
Indicates the context in which the value is being validated, such as precondition or postcondition for ref method parameters.

Return Value

Type: Exception
The Exception to be thrown, or null if no exception needs to be thrown.
See Also

Reference

ILocationValidationAspectT Interface
PostSharp.Aspects Namespace


IManagedResourceIntroductionAspect Interface

Semantics of an aspect that, when applied to an assembly, adds a managed resource to this assembly.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IManagedResourceIntroductionAspect : IAspect
Remarks
See ManagedResourceIntroductionAspect for details.
See Also

Reference

PostSharp.Aspects Namespace
PostSharp.AspectsManagedResourceIntroductionAspect
PostSharp.Aspects.ConfigurationManagedResourceIntroductionAspectConfiguration


IMethodBinding Interface

Interface through which a method-level aspect or advice can invoke the next node in the chain of invocation.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IMethodBinding

The IMethodBinding type exposes the following members.

Methods
 | Name | Description
Public method | Invoke | Invokes the next node in the chain of invocation.
Top
See Also

Reference

PostSharp.Aspects Namespace
PostSharp.Aspects.AdvicesImportMemberAttribute

Other Resources

Conceptual: Aspect Bindings


IMethodBinding Methods

The IMethodBinding type exposes the following members.

Methods
 | Name | Description
Public method | Invoke | Invokes the next node in the chain of invocation.
Top
See Also

Reference

IMethodBinding Interface
PostSharp.Aspects Namespace


IMethodBinding.Invoke Method

IMethodBindingInvoke Method

Invokes the next node in the chain of invocation.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Object Invoke(
    ref Object instance,
    Arguments arguments
)

Parameters

instance
Type: SystemObject
Target instance on which the method should be invoked (null if the method is static).
arguments
Type: PostSharp.AspectsArguments
Method arguments.

Return Value

Type: Object
Return value of the method.
Remarks

The instance parameter is passed by reference so that instance methods of value types ( struct in C#) are allowed to change the value of the instance.

See Also

Reference

IMethodBinding Interface
PostSharp.Aspects Namespace


IMethodInterceptionAspect Interface

Runtime semantics of an aspect that, when applied on a method, intercepts invocations of this method.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IMethodInterceptionAspect : IMethodLevelAspect,
    IAspect

The IMethodInterceptionAspect type exposes the following members.

Methods
 | Name | Description
Public method | OnInvoke | Method invoked instead of the method to which the aspect has been applied.
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from IMethodLevelAspect.)
Top
Remarks
See MethodInterceptionAspect for details.
See Also

Reference

PostSharp.Aspects Namespace


IMethodInterceptionAspect Methods

The IMethodInterceptionAspect type exposes the following members.

Methods
 | Name | Description
Public method | OnInvoke | Method invoked instead of the method to which the aspect has been applied.
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from IMethodLevelAspect.)
Top
See Also

Reference

IMethodInterceptionAspect Interface
PostSharp.Aspects Namespace


IMethodInterceptionAspect.OnInvoke Method

IMethodInterceptionAspectOnInvoke Method

Method invoked instead of the method to which the aspect has been applied.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void OnInvoke(
    MethodInterceptionArgs args
)

Parameters

args
Type: PostSharp.AspectsMethodInterceptionArgs
Advice arguments.
Remarks

The implementation of OnInvoke(MethodInterceptionArgs) may invoke Proceed, may schedule it for invocation from another thread, or may completely skip its invocation. Alternatively, it may use Binding. Before returning to the caller, the OnInvoke(MethodInterceptionArgs) method must set the return value (property ReturnValue) and all output arguments (property Arguments), otherwise the target method may fail with a NullReferenceException. These are normally set by calling Proceed.

See Also

Reference

IMethodInterceptionAspect Interface
PostSharp.Aspects Namespace
PostSharp.AspectsMethodInterceptionArgs


IMethodLevelAspect Interface

Runtime semantics of aspects applied to methods.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IMethodLevelAspect : IAspect

The IMethodLevelAspect type exposes the following members.

Methods
 | Name | Description
Public method | RuntimeInitialize | Initializes the current aspect.
Top
See Also

Reference

PostSharp.Aspects Namespace
PostSharp.AspectsIMethodLevelAspectBuildSemantics
PostSharp.AspectsMethodLevelAspect


IMethodLevelAspect Methods

The IMethodLevelAspect type exposes the following members.

Methods
 | Name | Description
Public method | RuntimeInitialize | Initializes the current aspect.
Top
See Also

Reference

IMethodLevelAspect Interface
PostSharp.Aspects Namespace


IMethodLevelAspect.RuntimeInitialize Method

IMethodLevelAspectRuntimeInitialize Method

Initializes the current aspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void RuntimeInitialize(
    MethodBase method
)

Parameters

method
Type: System.ReflectionMethodBase
Method to which the current aspect is applied.
See Also

Reference

IMethodLevelAspect Interface
PostSharp.Aspects Namespace

Other Resources

Conceptual: Initializing Aspects


IMethodLevelAspectBuildSemantics Interface

Compile-time semantics of IMethodLevelAspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IMethodLevelAspectBuildSemantics : IAspectBuildSemantics,
    IValidableAnnotation

The IMethodLevelAspectBuildSemantics type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.
Public method | CompileTimeValidate | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from IValidableAnnotation.)
Public method | GetAspectConfiguration | Method invoked at build time to get the imperative configuration of the current Aspect. (Inherited from IAspectBuildSemantics.)
Top
See Also

Reference

PostSharp.Aspects Namespace


IMethodLevelAspectBuildSemantics Methods

The IMethodLevelAspectBuildSemantics type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.
Public method | CompileTimeValidate | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from IValidableAnnotation.)
Public method | GetAspectConfiguration | Method invoked at build time to get the imperative configuration of the current Aspect. (Inherited from IAspectBuildSemantics.)
Top
See Also

Reference

IMethodLevelAspectBuildSemantics Interface
PostSharp.Aspects Namespace


IMethodLevelAspectBuildSemantics.CompileTimeInitialize Method

IMethodLevelAspectBuildSemanticsCompileTimeInitialize Method

Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void CompileTimeInitialize(
    MethodBase method,
    AspectInfo aspectInfo
)

Parameters

method
Type: System.ReflectionMethodBase
Method to which the current aspect is applied
aspectInfo
Type: PostSharp.AspectsAspectInfo
Reserved for future usage.
See Also

Reference

IMethodLevelAspectBuildSemantics Interface
PostSharp.Aspects Namespace

Other Resources

Conceptual: Initializing Aspects


InstanceLevelAspect Class

Base class for aspects applied on types, but having the same lifetime as instances of the type to which they are applied.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsTypeLevelAspect
PostSharp.AspectsInstanceLevelAspect
PostSharp.Patterns.ModelAggregatableAttribute
PostSharp.Patterns.ModelAggregatableClientAttribute
PostSharp.Patterns.ModelNotifyPropertyChangedAttribute
PostSharp.Patterns.RecordingEditableObjectAttribute
PostSharp.Patterns.RecordingRecordableAttribute

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public abstract class InstanceLevelAspect : TypeLevelAspect,
    ICloneAwareAspect, IInstanceScopedAspect, IAspect

The InstanceLevelAspect type exposes the following members.

Constructors
 | Name | Description
Protected method | InstanceLevelAspect | Initializes a new instance of the InstanceLevelAspect class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | Instance | Gets the object to which the current aspect has been applied.
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Overrides AspectCreateAspectConfiguration.)
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype.
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnCloned | Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object.
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from TypeLevelAspect.)
Public method | RuntimeInitializeInstance | Initializes the aspect instance. This method is invoked when all system elements of the aspect (like member imports) have completed.
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from TypeLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, Type) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from TypeLevelAspect.)
Top
Remarks

This class is provided for convenience. You get the same functionality by deriving your aspect class directly from TypeLevelAspect and implementing the interface IInstanceScopedAspect

See IInstanceScopedAspect for a discussion of instance-scoped aspects.

Note Note
All classes implementing IAspect should typically be marked as serializable using the SerializableAttribute or PSerializableAttribute custom attribute . Fields that are only used at runtime (and unknown at compile-time) should be carefully marked with the NonSerializedAttribute or PNonSerializedAttribute custom attribute. When PostSharp is used on a platform that does not support aspect serialization (such as .NET Compact Framework, Silverlight, or Windows Phone), or when another aspect serializer is used, it is not necessary to mark the aspect class as serializable. For more information, see Aspect Serialization .

See Also

Reference

PostSharp.Aspects Namespace
PostSharp.AspectsIInstanceScopedAspect

Other Resources

Conceptual: Aspect Serialization
Conceptual: Understanding Aspect Lifetime and Scope
Conceptual: Adding Aspects to Derived Classes and Methods Using Attributes
Conceptual: Adding Behaviors to Existing Members
Conceptual: Developing Composite Aspects
Conceptual: Introducing Interfaces, Methods, Properties and Events into Existing Classes
Conceptual: Thread-Unsafe Threading Model


InstanceLevelAspect Constructor

Initializes a new instance of the InstanceLevelAspect class

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected InstanceLevelAspect()
See Also

Reference

InstanceLevelAspect Class
PostSharp.Aspects Namespace


InstanceLevelAspect Properties

The InstanceLevelAspect type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | Instance | Gets the object to which the current aspect has been applied.
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

InstanceLevelAspect Class
PostSharp.Aspects Namespace


InstanceLevelAspect.Instance Property

InstanceLevelAspectInstance Property

Gets the object to which the current aspect has been applied.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Object Instance { get; }

Property Value

Type: Object
See Also

Reference

InstanceLevelAspect Class
PostSharp.Aspects Namespace


InstanceLevelAspect Methods

The InstanceLevelAspect type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Overrides AspectCreateAspectConfiguration.)
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype.
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnCloned | Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object.
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from TypeLevelAspect.)
Public method | RuntimeInitializeInstance | Initializes the aspect instance. This method is invoked when all system elements of the aspect (like member imports) have completed.
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from TypeLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, Type) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from TypeLevelAspect.)
Top
See Also

Reference

InstanceLevelAspect Class
PostSharp.Aspects Namespace


InstanceLevelAspect.CreateAspectConfiguration Method

InstanceLevelAspectCreateAspectConfiguration Method

Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override AspectConfiguration CreateAspectConfiguration()

Return Value

Type: AspectConfiguration
A new and empty instance of AspectConfiguration, whose concrete type corresponds to the concrete type of the Aspect.
Remarks
This method should not set up the returned AspectConfiguration. After the current method has returned, the SetAspectConfiguration(AspectConfiguration, Object) method will be invoked, and this method is responsible for setting up the AspectConfigurationobject.
See Also

Reference

InstanceLevelAspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Configuring Aspects


InstanceLevelAspect.CreateInstance Method

InstanceLevelAspectCreateInstance Method

Creates a new instance of the aspect based on the current instance, serving as a prototype.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual Object CreateInstance(
    AdviceArgs adviceArgs
)

Parameters

adviceArgs
Type: PostSharp.AspectsAdviceArgs
Aspect arguments.

Return Value

Type: Object
A new instance of the aspect, typically a clone of the current prototype instance.

Implements

IInstanceScopedAspectCreateInstance(AdviceArgs)
Remarks
This method is typically implemented by invoking MemberwiseClone.
See Also

Reference

InstanceLevelAspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Initializing Aspects
Conceptual: Understanding Aspect Lifetime and Scope


InstanceLevelAspect.OnCloned Method

InstanceLevelAspectOnCloned Method

Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void OnCloned(
    ICloneAwareAspect source
)

Parameters

source
Type: PostSharp.AspectsICloneAwareAspect
Aspect instance corresponding to the current aspect instance in the cloned target object.

Implements

ICloneAwareAspectOnCloned(ICloneAwareAspect)
Remarks

Prior to calling the current method, the aspect framework initializes the source object using CreateInstance(AdviceArgs) and RuntimeInitializeInstance. That is, the aspect instance in the cloned object is not cloned from the source aspect instance, but from the prototype aspect instance.

See Also

Reference

InstanceLevelAspect Class
PostSharp.Aspects Namespace


InstanceLevelAspect.RuntimeInitializeInstance Method

InstanceLevelAspectRuntimeInitializeInstance Method

Initializes the aspect instance. This method is invoked when all system elements of the aspect (like member imports) have completed.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void RuntimeInitializeInstance()

Implements

IInstanceScopedAspectRuntimeInitializeInstance
See Also

Reference

InstanceLevelAspect Class
PostSharp.Aspects Namespace
PostSharp.Aspects.AdvicesInitializeAspectInstanceAdvice

Other Resources

Conceptual: Initializing Aspects
Conceptual: Understanding Aspect Lifetime and Scope
Conceptual: What's New in PostSharp 4.0


IOnExceptionAspect Interface

Runtime semantics of an aspect that, when applied on a method, defines an exception handler around the whole method body and let the implementation of this interface handle the exception.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IOnExceptionAspect : IMethodLevelAspect,
    IAspect

The IOnExceptionAspect type exposes the following members.

Methods
 | Name | Description
Public method | OnException | Method executed after the body of methods to which this aspect is applied, in case that the method resulted with an exception (i.e., in a catch block).
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from IMethodLevelAspect.)
Top
Remarks

See OnExceptionAspect for details.

See Also

Reference

PostSharp.Aspects Namespace
PostSharp.AspectsOnExceptionAspect
PostSharp.Aspects.ConfigurationOnExceptionAspectConfiguration
PostSharp.Aspects.ConfigurationOnExceptionAspectConfigurationAttribute


IOnExceptionAspect Methods

The IOnExceptionAspect type exposes the following members.

Methods
 | Name | Description
Public method | OnException | Method executed after the body of methods to which this aspect is applied, in case that the method resulted with an exception (i.e., in a catch block).
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from IMethodLevelAspect.)
Top
See Also

Reference

IOnExceptionAspect Interface
PostSharp.Aspects Namespace


IOnExceptionAspect.OnException Method

IOnExceptionAspectOnException Method

Method executed after the body of methods to which this aspect is applied, in case that the method resulted with an exception (i.e., in a catch block).

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void OnException(
    MethodExecutionArgs args
)

Parameters

args
Type: PostSharp.AspectsMethodExecutionArgs
Advice arguments.
See Also

Reference

IOnExceptionAspect Interface
PostSharp.Aspects Namespace


IOnMethodBoundaryAspect Interface

Runtime semantics of OnMethodBoundaryAspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IOnMethodBoundaryAspect : IMethodLevelAspect,
    IAspect

The IOnMethodBoundaryAspect type exposes the following members.

Methods
 | Name | Description
Public method | OnEntry | Method executed before the body of methods to which this aspect is applied.
Public method | OnException | Method executed after the body of methods to which this aspect is applied, in case that the method resulted with an exception.
Public method | OnExit | Method executed after the body of methods to which this aspect is applied, even when the method exists with an exception (this method is invoked from the finally block).
Public method | OnSuccess | Method executed after the body of methods to which this aspect is applied, but only when the method successfully returns (i.e. when no exception flies out the method.).
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from IMethodLevelAspect.)
Top
Remarks

See OnMethodBoundaryAspect for details.

See Also

Reference

PostSharp.Aspects Namespace
PostSharp.AspectsOnMethodBoundaryAspect
PostSharp.Aspects.ConfigurationOnMethodBoundaryAspectConfiguration
PostSharp.Aspects.ConfigurationOnMethodBoundaryAspectConfigurationAttribute


IOnMethodBoundaryAspect Methods

The IOnMethodBoundaryAspect type exposes the following members.

Methods
 | Name | Description
Public method | OnEntry | Method executed before the body of methods to which this aspect is applied.
Public method | OnException | Method executed after the body of methods to which this aspect is applied, in case that the method resulted with an exception.
Public method | OnExit | Method executed after the body of methods to which this aspect is applied, even when the method exists with an exception (this method is invoked from the finally block).
Public method | OnSuccess | Method executed after the body of methods to which this aspect is applied, but only when the method successfully returns (i.e. when no exception flies out the method.).
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from IMethodLevelAspect.)
Top
See Also

Reference

IOnMethodBoundaryAspect Interface
PostSharp.Aspects Namespace


IOnMethodBoundaryAspect.OnEntry Method

IOnMethodBoundaryAspectOnEntry Method

Method executed before the body of methods to which this aspect is applied.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void OnEntry(
    MethodExecutionArgs args
)

Parameters

args
Type: PostSharp.AspectsMethodExecutionArgs
Event arguments specifying which method is being executed, which are its arguments, and how should the execution continue after the execution of OnEntry(MethodExecutionArgs).
Remarks
If the aspect is applied to a constructor, the current method is invoked after the this pointer has been initialized, that is, after the base constructor has been called.
See Also

Reference

IOnMethodBoundaryAspect Interface
PostSharp.Aspects Namespace


IOnMethodBoundaryAspect.OnException Method

IOnMethodBoundaryAspectOnException Method

Method executed after the body of methods to which this aspect is applied, in case that the method resulted with an exception.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void OnException(
    MethodExecutionArgs args
)

Parameters

args
Type: PostSharp.AspectsMethodExecutionArgs
Event arguments specifying which method is being executed and which are its arguments.
See Also

Reference

IOnMethodBoundaryAspect Interface
PostSharp.Aspects Namespace


IOnMethodBoundaryAspect.OnExit Method

IOnMethodBoundaryAspectOnExit Method

Method executed after the body of methods to which this aspect is applied, even when the method exists with an exception (this method is invoked from the finally block).

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void OnExit(
    MethodExecutionArgs args
)

Parameters

args
Type: PostSharp.AspectsMethodExecutionArgs
Event arguments specifying which method is being executed and which are its arguments.
See Also

Reference

IOnMethodBoundaryAspect Interface
PostSharp.Aspects Namespace

Other Resources

Conceptual: Injecting Behaviors Before and After Method Execution


IOnMethodBoundaryAspect.OnSuccess Method

IOnMethodBoundaryAspectOnSuccess Method

Method executed after the body of methods to which this aspect is applied, but only when the method successfully returns (i.e. when no exception flies out the method.).

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void OnSuccess(
    MethodExecutionArgs args
)

Parameters

args
Type: PostSharp.AspectsMethodExecutionArgs
Event arguments specifying which method is being executed and which are its arguments.
See Also

Reference

IOnMethodBoundaryAspect Interface
PostSharp.Aspects Namespace


IOnStateMachineBoundaryAspect Interface

Extends the IOnMethodBoundaryAspect interface with two advises to be applied on state machines.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IOnStateMachineBoundaryAspect : IOnMethodBoundaryAspect,
    IMethodLevelAspect, IAspect

The IOnStateMachineBoundaryAspect type exposes the following members.

Methods
 | Name | Description
Public method | OnEntry | Method executed before the body of methods to which this aspect is applied. (Inherited from IOnMethodBoundaryAspect.)
Public method | OnException | Method executed after the body of methods to which this aspect is applied, in case that the method resulted with an exception. (Inherited from IOnMethodBoundaryAspect.)
Public method | OnExit | Method executed after the body of methods to which this aspect is applied, even when the method exists with an exception (this method is invoked from the finally block). (Inherited from IOnMethodBoundaryAspect.)
Public method | OnResume | Method executed when a state machine resumes execution after an yield return or await statement.
Public method | OnSuccess | Method executed after the body of methods to which this aspect is applied, but only when the method successfully returns (i.e. when no exception flies out the method.). (Inherited from IOnMethodBoundaryAspect.)
Public method | OnYield | Method executed when a state machine yields, as the result of an yield return or await statement.
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from IMethodLevelAspect.)
Top
See Also

Reference

PostSharp.Aspects Namespace


IOnStateMachineBoundaryAspect Methods

The IOnStateMachineBoundaryAspect type exposes the following members.

Methods
 | Name | Description
Public method | OnEntry | Method executed before the body of methods to which this aspect is applied. (Inherited from IOnMethodBoundaryAspect.)
Public method | OnException | Method executed after the body of methods to which this aspect is applied, in case that the method resulted with an exception. (Inherited from IOnMethodBoundaryAspect.)
Public method | OnExit | Method executed after the body of methods to which this aspect is applied, even when the method exists with an exception (this method is invoked from the finally block). (Inherited from IOnMethodBoundaryAspect.)
Public method | OnResume | Method executed when a state machine resumes execution after an yield return or await statement.
Public method | OnSuccess | Method executed after the body of methods to which this aspect is applied, but only when the method successfully returns (i.e. when no exception flies out the method.). (Inherited from IOnMethodBoundaryAspect.)
Public method | OnYield | Method executed when a state machine yields, as the result of an yield return or await statement.
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from IMethodLevelAspect.)
Top
See Also

Reference

IOnStateMachineBoundaryAspect Interface
PostSharp.Aspects Namespace


IOnStateMachineBoundaryAspect.OnResume Method

IOnStateMachineBoundaryAspectOnResume Method

Method executed when a state machine resumes execution after an yield return or await statement.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void OnResume(
    MethodExecutionArgs args
)

Parameters

args
Type: PostSharp.AspectsMethodExecutionArgs
Event arguments specifying which method is being executed and which are its arguments.
Remarks

For iterator methods, this advice is executed before the MoveNext method. However, the very first call of MoveNext maps to OnEntry(MethodExecutionArgs).

In async methods, the advice is executed just after the state machine restarts execution after having waited as a result of the await statement.

See Also

Reference

IOnStateMachineBoundaryAspect Interface
PostSharp.Aspects Namespace


IOnStateMachineBoundaryAspect.OnYield Method

IOnStateMachineBoundaryAspectOnYield Method

Method executed when a state machine yields, as the result of an yield return or await statement.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void OnYield(
    MethodExecutionArgs args
)

Parameters

args
Type: PostSharp.AspectsMethodExecutionArgs
Event arguments specifying which method is being executed and which are its arguments. In iterator methods, the YieldValue property gives access to the operand of the yield return statement.
Remarks

In iterator methods, this advise is exactly executed at the yield return statement.

In async methods, the advice is executed just after the state machine starts waiting as a result of the await statement. In case the operand of the await statement is an operation that completed synchronously, the state machine does not yield, and the OnYield(MethodExecutionArgs) advise won't be invoked.

See Also

Reference

IOnStateMachineBoundaryAspect Interface
PostSharp.Aspects Namespace


ITypeLevelAspect Interface

Run-time semantics of aspects applied to types.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ITypeLevelAspect : IAspect

The ITypeLevelAspect type exposes the following members.

Methods
 | Name | Description
Public method | RuntimeInitialize | Initializes the current aspect.
Top
See Also

Reference

PostSharp.Aspects Namespace
PostSharp.AspectsITypeLevelAspectBuildSemantics


ITypeLevelAspect Methods

The ITypeLevelAspect type exposes the following members.

Methods
 | Name | Description
Public method | RuntimeInitialize | Initializes the current aspect.
Top
See Also

Reference

ITypeLevelAspect Interface
PostSharp.Aspects Namespace


ITypeLevelAspect.RuntimeInitialize Method

ITypeLevelAspectRuntimeInitialize Method

Initializes the current aspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void RuntimeInitialize(
    Type type
)

Parameters

type
Type: SystemType
Type to which the current aspect is applied.
See Also

Reference

ITypeLevelAspect Interface
PostSharp.Aspects Namespace

Other Resources

Conceptual: Initializing Aspects


ITypeLevelAspectBuildSemantics Interface

Compile-time semantics of ITypeLevelAspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ITypeLevelAspectBuildSemantics : IAspectBuildSemantics,
    IValidableAnnotation

The ITypeLevelAspectBuildSemantics type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.
Public method | CompileTimeValidate | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from IValidableAnnotation.)
Public method | GetAspectConfiguration | Method invoked at build time to get the imperative configuration of the current Aspect. (Inherited from IAspectBuildSemantics.)
Top
See Also

Reference

PostSharp.Aspects Namespace


ITypeLevelAspectBuildSemantics Methods

The ITypeLevelAspectBuildSemantics type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.
Public method | CompileTimeValidate | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from IValidableAnnotation.)
Public method | GetAspectConfiguration | Method invoked at build time to get the imperative configuration of the current Aspect. (Inherited from IAspectBuildSemantics.)
Top
See Also

Reference

ITypeLevelAspectBuildSemantics Interface
PostSharp.Aspects Namespace


ITypeLevelAspectBuildSemantics.CompileTimeInitialize Method

ITypeLevelAspectBuildSemanticsCompileTimeInitialize Method

Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void CompileTimeInitialize(
    Type type,
    AspectInfo aspectInfo
)

Parameters

type
Type: SystemType
Type to which the current aspect is applied
aspectInfo
Type: PostSharp.AspectsAspectInfo
Reserved for future usage.
See Also

Reference

ITypeLevelAspectBuildSemantics Interface
PostSharp.Aspects Namespace

Other Resources

Conceptual: Initializing Aspects


LinesOfCodeAvoidedAttribute Class

Custom attribute that, when applied to an aspect class, specifies how many manual lines of code are avoided every time the aspect is being used.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.AspectsLinesOfCodeAvoidedAttribute

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class LinesOfCodeAvoidedAttribute : Attribute

The LinesOfCodeAvoidedAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | LinesOfCodeAvoidedAttribute | Initializes a new LinesOfCodeAvoidedAttribute.
Top
Properties
 | Name | Description
Public property | Count | Gets the number of lines of code saved every time the aspect is applied to a target class.
Top
See Also

Reference

PostSharp.Aspects Namespace

Other Resources

Conceptual: Estimating Code Savings


LinesOfCodeAvoidedAttribute Constructor

Initializes a new LinesOfCodeAvoidedAttribute.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LinesOfCodeAvoidedAttribute(
    int lines
)

Parameters

lines
Type: SystemInt32
Number of lines of code saved every time the aspect is applied to a target class.
See Also

Reference

LinesOfCodeAvoidedAttribute Class
PostSharp.Aspects Namespace


LinesOfCodeAvoidedAttribute Properties

The LinesOfCodeAvoidedAttribute type exposes the following members.

Properties
 | Name | Description
Public property | Count | Gets the number of lines of code saved every time the aspect is applied to a target class.
Top
See Also

Reference

LinesOfCodeAvoidedAttribute Class
PostSharp.Aspects Namespace


LinesOfCodeAvoidedAttribute.Count Property

LinesOfCodeAvoidedAttributeCount Property

Gets the number of lines of code saved every time the aspect is applied to a target class.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int Count { get; }

Property Value

Type: Int32
See Also

Reference

LinesOfCodeAvoidedAttribute Class
PostSharp.Aspects Namespace


LocationBindingExtensions Class

Extension methods for the ILocationBinding interface.
Inheritance Hierarchy
SystemObject
PostSharp.AspectsLocationBindingExtensions

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static class LocationBindingExtensions
Methods
Name | Description
GetValue(ILocationBinding, Object) | Gets the value of a field or property.
GetValue(ILocationBinding, Object, Arguments) | Gets the value of an indexer (property with arguments).
GetValueT(ILocationBindingT, Object) | Gets the value of a field or property.
GetValueT(ILocationBindingT, Object, Arguments) | Gets the value of an indexer (property with arguments).
SetValue(ILocationBinding, Object, Object) | Sets the value of a field or property.
SetValue(ILocationBinding, Object, Arguments, Object) | Sets the value of an indexer (property with arguments).
SetValueT(ILocationBindingT, Object, T) | Sets the value of a field or property.
SetValueT(ILocationBindingT, Object, Arguments, T) | Sets the value of an indexer (property with arguments).
Top
See Also

Reference

PostSharp.Aspects Namespace


LocationBindingExtensions Methods

Methods
Name | Description
GetValue(ILocationBinding, Object) | Gets the value of a field or property.
GetValue(ILocationBinding, Object, Arguments) | Gets the value of an indexer (property with arguments).
GetValueT(ILocationBindingT, Object) | Gets the value of a field or property.
GetValueT(ILocationBindingT, Object, Arguments) | Gets the value of an indexer (property with arguments).
SetValue(ILocationBinding, Object, Object) | Sets the value of a field or property.
SetValue(ILocationBinding, Object, Arguments, Object) | Sets the value of an indexer (property with arguments).
SetValueT(ILocationBindingT, Object, T) | Sets the value of a field or property.
SetValueT(ILocationBindingT, Object, Arguments, T) | Sets the value of an indexer (property with arguments).
Top
See Also

Reference

LocationBindingExtensions Class
PostSharp.Aspects Namespace


LocationBindingExtensions.GetValue Method

LocationBindingExtensionsGetValue Method

Overload List
Name | Description
GetValue(ILocationBinding, Object) | Gets the value of a field or property.
GetValueT(ILocationBindingT, Object) | Gets the value of a field or property.
GetValue(ILocationBinding, Object, Arguments) | Gets the value of an indexer (property with arguments).
GetValueT(ILocationBindingT, Object, Arguments) | Gets the value of an indexer (property with arguments).
Top
See Also

Reference

LocationBindingExtensions Class
PostSharp.Aspects Namespace


LocationBindingExtensions.GetValue Method (ILocationBinding, Object)

LocationBindingExtensionsGetValue Method (ILocationBinding, Object)

Gets the value of a field or property.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Object GetValue(
    this ILocationBinding locationBinding,
    Object instance
)

Parameters

locationBinding
Type: PostSharp.AspectsILocationBinding
The binding for the field or property.
instance
Type: SystemObject
The instance for which the field or property is evaluated, or null if the location is static.

Return Value

Type: Object
The field or property value.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ILocationBinding. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

LocationBindingExtensions Class
GetValue Overload
PostSharp.Aspects Namespace
ILocationBindingGetValue(Object, Arguments)


LocationBindingExtensions.GetValue(T) Method (ILocationBinding(T), Object)

LocationBindingExtensionsGetValueT Method (ILocationBindingT, Object)

Gets the value of a field or property.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static T GetValue<T>(
    this ILocationBinding<T> locationBinding,
    Object instance
)

Parameters

locationBinding
Type: PostSharp.AspectsILocationBinding T
The binding for the field or property.
instance
Type: SystemObject
The instance for which the field or property is evaluated, or null if the location is static.

Type Parameters

T

Return Value

Type: T
The field or property value.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ILocationBinding T. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

LocationBindingExtensions Class
GetValue Overload
PostSharp.Aspects Namespace
ILocationBindingGetValue(Object, Arguments)


LocationBindingExtensions.GetValue Method (ILocationBinding, Object, Arguments)

LocationBindingExtensionsGetValue Method (ILocationBinding, Object, Arguments)

Gets the value of an indexer (property with arguments).

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Object GetValue(
    this ILocationBinding locationBinding,
    Object instance,
    Arguments index
)

Parameters

locationBinding
Type: PostSharp.AspectsILocationBinding
The binding for the indexer.
instance
Type: SystemObject
The instance for which the indexer is evaluated, or null if the indexer is static.
index
Type: PostSharp.AspectsArguments
The arguments of the indexer.

Return Value

Type: Object
The indexer value.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ILocationBinding. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

LocationBindingExtensions Class
GetValue Overload
PostSharp.Aspects Namespace
ILocationBindingGetValue(Object, Arguments)


LocationBindingExtensions.GetValue(T) Method (ILocationBinding(T), Object, Arguments)

LocationBindingExtensionsGetValueT Method (ILocationBindingT, Object, Arguments)

Gets the value of an indexer (property with arguments).

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static T GetValue<T>(
    this ILocationBinding<T> locationBinding,
    Object instance,
    Arguments index
)

Parameters

locationBinding
Type: PostSharp.AspectsILocationBinding T
The binding for the indexer.
instance
Type: SystemObject
The instance for which the indexer is evaluated, or null if the indexer is static.
index
Type: PostSharp.AspectsArguments
The arguments of the indexer.

Type Parameters

T

Return Value

Type: T
The indexer value.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ILocationBinding T. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

LocationBindingExtensions Class
GetValue Overload
PostSharp.Aspects Namespace
ILocationBindingGetValue(Object, Arguments)


LocationBindingExtensions.SetValue Method

LocationBindingExtensionsSetValue Method

Overload List
Name | Description
SetValue(ILocationBinding, Object, Object) | Sets the value of a field or property.
SetValueT(ILocationBindingT, Object, T) | Sets the value of a field or property.
SetValue(ILocationBinding, Object, Arguments, Object) | Sets the value of an indexer (property with arguments).
SetValueT(ILocationBindingT, Object, Arguments, T) | Sets the value of an indexer (property with arguments).
Top
See Also

Reference

LocationBindingExtensions Class
PostSharp.Aspects Namespace


LocationBindingExtensions.SetValue Method (ILocationBinding, Object, Object)

LocationBindingExtensionsSetValue Method (ILocationBinding, Object, Object)

Sets the value of a field or property.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void SetValue(
    this ILocationBinding locationBinding,
    Object instance,
    Object value
)

Parameters

locationBinding
Type: PostSharp.AspectsILocationBinding
The binding for the field or property.
instance
Type: SystemObject
The instance for which the field or property is set, or null if the location is static.
value
Type: SystemObject
The new value assigned to the field or property.

Return Value

Type:
The field or property value.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ILocationBinding. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

LocationBindingExtensions Class
SetValue Overload
PostSharp.Aspects Namespace
ILocationBindingGetValue(Object, Arguments)


LocationBindingExtensions.SetValue(T) Method (ILocationBinding(T), Object, T)

LocationBindingExtensionsSetValueT Method (ILocationBindingT, Object, T)

Sets the value of a field or property.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void SetValue<T>(
    this ILocationBinding<T> locationBinding,
    Object instance,
    T value
)

Parameters

locationBinding
Type: PostSharp.AspectsILocationBinding T
The binding for the field or property.
instance
Type: SystemObject
The instance for which the field or property is set, or null if the location is static.
value
Type: T
The new value assigned to the field or property.

Type Parameters

T

Return Value

Type:
The field or property value.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ILocationBinding T. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

LocationBindingExtensions Class
SetValue Overload
PostSharp.Aspects Namespace
ILocationBindingGetValue(Object, Arguments)


LocationBindingExtensions.SetValue Method (ILocationBinding, Object, Arguments, Object)

LocationBindingExtensionsSetValue Method (ILocationBinding, Object, Arguments, Object)

Sets the value of an indexer (property with arguments).

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void SetValue(
    this ILocationBinding locationBinding,
    Object instance,
    Arguments index,
    Object value
)

Parameters

locationBinding
Type: PostSharp.AspectsILocationBinding
The binding for the indexer.
instance
Type: SystemObject
The instance for which the indexer is set, or null if the indexer is static.
index
Type: PostSharp.AspectsArguments
The arguments of the indexer.
value
Type: SystemObject
The new value.

Return Value

Type:
The indexer value.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ILocationBinding. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

LocationBindingExtensions Class
SetValue Overload
PostSharp.Aspects Namespace
ILocationBindingGetValue(Object, Arguments)


LocationBindingExtensions.SetValue(T) Method (ILocationBinding(T), Object, Arguments, T)

LocationBindingExtensionsSetValueT Method (ILocationBindingT, Object, Arguments, T)

Sets the value of an indexer (property with arguments).

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void SetValue<T>(
    this ILocationBinding<T> locationBinding,
    Object instance,
    Arguments index,
    T value
)

Parameters

locationBinding
Type: PostSharp.AspectsILocationBinding T
The binding for the indexer.
instance
Type: SystemObject
The instance for which the indexer is set, or null if the indexer is static.
index
Type: PostSharp.AspectsArguments
The arguments of the indexer.
value
Type: T
The new value.

Type Parameters

T

Return Value

Type:
The indexer value.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ILocationBinding T. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

LocationBindingExtensions Class
SetValue Overload
PostSharp.Aspects Namespace
ILocationBindingGetValue(Object, Arguments)


LocationInterceptionArgs Class

Arguments of advices of aspect type LocationInterceptionAspect.
Inheritance Hierarchy
SystemObject
PostSharp.AspectsAdviceArgs
PostSharp.AspectsLocationInterceptionArgs

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class LocationInterceptionArgs : AdviceArgs,
    ILocationInterceptionArgs

The LocationInterceptionArgs type exposes the following members.

Properties
 | Name | Description
Public property | Binding | Gets an interface that allows to invoke the next node in the chain of invocation of the intercepted method.
Public property | DeclarationIdentifier | Gets the DeclarationIdentifier of the declaration to which the advice has been applied. (Inherited from AdviceArgs.)
Public property | Index | Gets the current index arguments (in case of a property with parameters).
Public property | Instance | Gets or sets the object instance on which the method is being executed. (Inherited from AdviceArgs.)
Public property | Location | Gets the location (field, property or parameter) related to the aspect or advice being executed.
Public property | LocationFullName | Gets the full name (including the full name of the declaring type) of the location (field, property or parameter) related to the aspect or advice being executed.
Public property | LocationName | Gets the name of the location (field, property or parameter) related to the aspect or advice being executed.
Public property | Value | Gets or sets the location value.
Top
Methods
 | Name | Description
Public method | ExecuteTPayload | Executes a delegate for the current LocationInterceptionArgs. This method allows to
Public method | GetCurrentValue | Retrieves the current value of the location without overwriting the Value property.
Public method | ProceedGetValue | Invokes the Get Location Value semantic on the next node in the chain of invocation and stores the location value in the Value property.
Public method | ProceedSetValue | Invokes the Set Location Value semantic on the next node in the chain of invocation and stores the value of the Value property into the location.
Public method | SetNewValue | Sets the value of the location without overwriting the Value property.
Top
Remarks
Note Note
As a result of weaving optimizations, instances of classes derived from AdviceArgs may be shared among different aspects. Therefore, aspect code should not attempt to access this object once the control has been given over to the next node in the chain of invocation. Consider working with aspect bindings if you need such deferred execution.
Note Note
Aspect weaving optimizations may also cause an advice parameter of this type to be seen null when inspecting it in a debugger. If you need to inspect the instance in runtime, consider disabling aspect optimizations in the debug build configuration.
See Also

Reference

PostSharp.Aspects Namespace
PostSharp.AspectsLocationInterceptionAspect

Other Resources

Conceptual: Aspect Bindings
Conceptual: Intercepting Properties and Fields


LocationInterceptionArgs Properties

The LocationInterceptionArgs type exposes the following members.

Properties
 | Name | Description
Public property | Binding | Gets an interface that allows to invoke the next node in the chain of invocation of the intercepted method.
Public property | DeclarationIdentifier | Gets the DeclarationIdentifier of the declaration to which the advice has been applied. (Inherited from AdviceArgs.)
Public property | Index | Gets the current index arguments (in case of a property with parameters).
Public property | Instance | Gets or sets the object instance on which the method is being executed. (Inherited from AdviceArgs.)
Public property | Location | Gets the location (field, property or parameter) related to the aspect or advice being executed.
Public property | LocationFullName | Gets the full name (including the full name of the declaring type) of the location (field, property or parameter) related to the aspect or advice being executed.
Public property | LocationName | Gets the name of the location (field, property or parameter) related to the aspect or advice being executed.
Public property | Value | Gets or sets the location value.
Top
See Also

Reference

LocationInterceptionArgs Class
PostSharp.Aspects Namespace


LocationInterceptionArgs.Binding Property

LocationInterceptionArgsBinding Property

Gets an interface that allows to invoke the next node in the chain of invocation of the intercepted method.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract ILocationBinding Binding { get; }

Property Value

Type: ILocationBinding

Implements

ILocationInterceptionArgsBinding
Remarks

Bindings are thread-safe and context-free singleton instances exposing the next node in the chain of invocation.

See Also

Reference

LocationInterceptionArgs Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Aspect Bindings


LocationInterceptionArgs.Index Property

LocationInterceptionArgsIndex Property

Gets the current index arguments (in case of a property with parameters).

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Arguments Index { get; }

Property Value

Type: Arguments

Implements

ILocationInterceptionArgsIndex
See Also

Reference

LocationInterceptionArgs Class
PostSharp.Aspects Namespace


LocationInterceptionArgs.Location Property

LocationInterceptionArgsLocation Property

Gets the location (field, property or parameter) related to the aspect or advice being executed.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LocationInfo Location { get; set; }

Property Value

Type: LocationInfo

Implements

ILocationInterceptionArgsLocation
Remarks
Note Note
Using this property causes the aspect weaver to generate code that has non-trivial runtime overhead. Avoid using this property whenever possible. One of the possible solution is to use compile-time initialization of aspect instances and to make use of reflection only at build time.
See Also

Reference

LocationInterceptionArgs Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Intercepting Properties and Fields


LocationInterceptionArgs.LocationFullName Property

LocationInterceptionArgsLocationFullName Property

Gets the full name (including the full name of the declaring type) of the location (field, property or parameter) related to the aspect or advice being executed.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string LocationFullName { get; set; }

Property Value

Type: String

Implements

ILocationInterceptionArgsLocationFullName
See Also

Reference

LocationInterceptionArgs Class
PostSharp.Aspects Namespace


LocationInterceptionArgs.LocationName Property

LocationInterceptionArgsLocationName Property

Gets the name of the location (field, property or parameter) related to the aspect or advice being executed.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string LocationName { get; set; }

Property Value

Type: String

Implements

ILocationInterceptionArgsLocationName
See Also

Reference

LocationInterceptionArgs Class
PostSharp.Aspects Namespace


LocationInterceptionArgs.Value Property

LocationInterceptionArgsValue Property

Gets or sets the location value.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract Object Value { get; set; }

Property Value

Type: Object

Implements

ILocationInterceptionArgsValue
Remarks

Inside an OnGetValue(LocationInterceptionArgs) advice, this property is available after the next advice in chain has been invoked using ProceedGetValue. However, inside an OnSetValue(LocationInterceptionArgs) advice, the value is available immediately, and is used as input by ProceedSetValue.

See GetCurrentValue and SetNewValue(Object) to get or set the value of the location without affecting the value of this property.

See Also

Reference

LocationInterceptionArgs Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Intercepting Properties and Fields


LocationInterceptionArgs Methods

The LocationInterceptionArgs type exposes the following members.

Methods
 | Name | Description
Public method | ExecuteTPayload | Executes a delegate for the current LocationInterceptionArgs. This method allows to
Public method | GetCurrentValue | Retrieves the current value of the location without overwriting the Value property.
Public method | ProceedGetValue | Invokes the Get Location Value semantic on the next node in the chain of invocation and stores the location value in the Value property.
Public method | ProceedSetValue | Invokes the Set Location Value semantic on the next node in the chain of invocation and stores the value of the Value property into the location.
Public method | SetNewValue | Sets the value of the location without overwriting the Value property.
Top
See Also

Reference

LocationInterceptionArgs Class
PostSharp.Aspects Namespace


LocationInterceptionArgs.Execute(TPayload) Method

LocationInterceptionArgsExecuteTPayload Method

Executes a delegate for the current LocationInterceptionArgs. This method allows to

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract void Execute<TPayload>(
    ILocationInterceptionArgsAction<TPayload> action,
    ref TPayload payload
)

Parameters

action
Type: PostSharp.AspectsILocationInterceptionArgsAction TPayload
payload
Type: TPayload

Type Parameters

TPayload

Implements

ILocationInterceptionArgsExecuteTPayload(ILocationInterceptionArgsActionTPayload, TPayload)
See Also

Reference

LocationInterceptionArgs Class
PostSharp.Aspects Namespace


LocationInterceptionArgs.GetCurrentValue Method

LocationInterceptionArgsGetCurrentValue Method

Retrieves the current value of the location without overwriting the Value property.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract Object GetCurrentValue()

Return Value

Type: Object
The current value of the location, as returned by the next node in the chain of invocation (see Binding).

Implements

ILocationInterceptionArgsGetCurrentValue
Remarks
Note Note
This method is designed to be invoked during the execution of the advice. If you need to retrieve or store the value of the location at a different time, it is recommended to use the Binding . Indeed, a binding is stateless, while LocationInterceptionArgs instances may be shared among different aspects.
See Also

Reference

LocationInterceptionArgs Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Intercepting Properties and Fields


LocationInterceptionArgs.ProceedGetValue Method

LocationInterceptionArgsProceedGetValue Method

Invokes the Get Location Value semantic on the next node in the chain of invocation and stores the location value in the Value property.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract void ProceedGetValue()

Implements

ILocationInterceptionArgsProceedGetValue
Remarks

Note that this method overwrites the content of the Value property. Therefore, you should not call this invoke from a OnSetValue(LocationInterceptionArgs) advice unless you store the value before. If you need to retrieve the current value of the location from a OnSetValue(LocationInterceptionArgs) advice, it is recommended you use the GetCurrentValue method.

Note Note
This method is designed to be invoked during the execution of the advice. If you need to retrieve or store the value of the location at a different time, it is recommended to use the Binding . Indeed, a binding is stateless, while LocationInterceptionArgs instances may be shared among different aspects.
See Also

Reference

LocationInterceptionArgs Class
PostSharp.Aspects Namespace


LocationInterceptionArgs.ProceedSetValue Method

LocationInterceptionArgsProceedSetValue Method

Invokes the Set Location Value semantic on the next node in the chain of invocation and stores the value of the Value property into the location.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract void ProceedSetValue()

Implements

ILocationInterceptionArgsProceedSetValue
Remarks

Note that this method requires the value to be stored in the Value property. If you need to retrieve the current value of the location from a OnSetValue(LocationInterceptionArgs) advice, it is recommended you use the GetCurrentValue method.

Note Note
This method is designed to be invoked during the execution of the advice. If you need to retrieve or store the value of the location at a different time, it is recommended to use the Binding . Indeed, a binding is stateless, while LocationInterceptionArgs instances may be shared among different aspects.
See Also

Reference

LocationInterceptionArgs Class
PostSharp.Aspects Namespace


LocationInterceptionArgs.SetNewValue Method

LocationInterceptionArgsSetNewValue Method

Sets the value of the location without overwriting the Value property.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract void SetNewValue(
    Object value
)

Parameters

value
Type: SystemObject
The value to be passed to the next node in the chain of invocation (see Binding).

Implements

ILocationInterceptionArgsSetNewValue(Object)
Remarks

Note Note
This method is designed to be invoked during the execution of the advice. If you need to retrieve or store the value of the location at a different time, it is recommended to use the Binding . Indeed, a binding is stateless, while LocationInterceptionArgs instances may be shared among different aspects.
See Also

Reference

LocationInterceptionArgs Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Intercepting Properties and Fields


LocationInterceptionAspect Class

Aspect that, when applied on a location (field or property), intercepts invocations of the Get (OnGetValue(LocationInterceptionArgs)) and Set (OnSetValue(LocationInterceptionArgs)) semantics.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsLocationLevelAspect
PostSharp.AspectsLocationInterceptionAspect

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public abstract class LocationInterceptionAspect : LocationLevelAspect,
    ILocationInterceptionAspect, ILocationLevelAspect, IAspect

The LocationInterceptionAspect type exposes the following members.

Constructors
 | Name | Description
Protected method | LocationInterceptionAspect | Initializes a new instance of the LocationInterceptionAspect class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from LocationLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from LocationLevelAspect.)
Public method | CompileTimeValidate(LocationInfo) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from LocationLevelAspect.)
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Overrides AspectCreateAspectConfiguration.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnGetValue | Method invoked instead of the Get semantic of the field or property to which the current aspect is applied, i.e. when the value of this field or property is retrieved.
Public method | OnSetValue | Method invoked instead of the Set semantic of the field or property to which the current aspect is applied, i.e. when the value of this field or property is changed.
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from LocationLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, LocationInfo) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from LocationLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from LocationLevelAspect.)
Top
Remarks

This aspect can be applied indifferently to fields and properties, called locations because they both have the semantics of a slot where a value can be stored and retrieved.

Applying the Aspect on Properties

Applying an aspect of type LocationInterceptionAspect to a property results in the accessors of this property to be replaced by a call to the method OnGetValue(LocationInterceptionArgs) or OnSetValue(LocationInterceptionArgs) of the current class. The original body of the accessor is moved into a new method, which can be called by the aspect by invoking one of the methods ProceedGetValue, ProceedSetValue, GetCurrentValue or SetNewValue(Object), or by using the Binding object.

Applying the Aspect on Fields

Applying this aspect on a field transforms the field into a property of the same name, scope and visibility as the original field. The original field is removed. Aspect code can get or set the value of the field by calling the methods ProceedGetValue, ProceedSetValue, GetCurrentValue or SetNewValue(Object), or by using the Binding object.

Note Note
Remember to use PropertyInfo instead of FieldInfo at runtime to reflect the original field. For this reason, you cannot store a FieldInfo in the aspect. Store a LocationInfo instead; even if a LocationInfo represents a field at build time, it will represent the corresponding PropertyInfo at runtime.

Note Note
When you apply an aspect derived from LocationInterceptionAspect to a value-type field, you should not pass the value of this field by reference (as an argument to out and ref parameters in C#). Indeed, PostSharp is unable to detect read and write accesses through references.

Note Note
All classes implementing IAspect should typically be marked as serializable using the SerializableAttribute or PSerializableAttribute custom attribute . Fields that are only used at runtime (and unknown at compile-time) should be carefully marked with the NonSerializedAttribute or PNonSerializedAttribute custom attribute. When PostSharp is used on a platform that does not support aspect serialization (such as .NET Compact Framework, Silverlight, or Windows Phone), or when another aspect serializer is used, it is not necessary to mark the aspect class as serializable. For more information, see Aspect Serialization .

See Also

Reference

PostSharp.Aspects Namespace
PostSharp.Aspects.ConfigurationLocationInterceptionAspectConfigurationAttribute

Other Resources

Conceptual: Aspect Serialization
Conceptual: Interception Aspects
Conceptual: Adding Behaviors to Existing Members
Conceptual: Developing Composite Aspects
Conceptual: Intercepting Properties and Fields
Conceptual: What's New in PostSharp 2.0


LocationInterceptionAspect Constructor

Initializes a new instance of the LocationInterceptionAspect class

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected LocationInterceptionAspect()
See Also

Reference

LocationInterceptionAspect Class
PostSharp.Aspects Namespace


LocationInterceptionAspect Properties

The LocationInterceptionAspect type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

LocationInterceptionAspect Class
PostSharp.Aspects Namespace


LocationInterceptionAspect Methods

The LocationInterceptionAspect type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from LocationLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from LocationLevelAspect.)
Public method | CompileTimeValidate(LocationInfo) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from LocationLevelAspect.)
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Overrides AspectCreateAspectConfiguration.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnGetValue | Method invoked instead of the Get semantic of the field or property to which the current aspect is applied, i.e. when the value of this field or property is retrieved.
Public method | OnSetValue | Method invoked instead of the Set semantic of the field or property to which the current aspect is applied, i.e. when the value of this field or property is changed.
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from LocationLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, LocationInfo) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from LocationLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from LocationLevelAspect.)
Top
See Also

Reference

LocationInterceptionAspect Class
PostSharp.Aspects Namespace


LocationInterceptionAspect.CreateAspectConfiguration Method

LocationInterceptionAspectCreateAspectConfiguration Method

Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override sealed AspectConfiguration CreateAspectConfiguration()

Return Value

Type: AspectConfiguration
A new and empty instance of AspectConfiguration, whose concrete type corresponds to the concrete type of the Aspect.
Remarks
This method should not set up the returned AspectConfiguration. After the current method has returned, the SetAspectConfiguration(AspectConfiguration, Object) method will be invoked, and this method is responsible for setting up the AspectConfigurationobject.
See Also

Reference

LocationInterceptionAspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Configuring Aspects


LocationInterceptionAspect.OnGetValue Method

LocationInterceptionAspectOnGetValue Method

Method invoked instead of the Get semantic of the field or property to which the current aspect is applied, i.e. when the value of this field or property is retrieved.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void OnGetValue(
    LocationInterceptionArgs args
)

Parameters

args
Type: PostSharp.AspectsLocationInterceptionArgs
Advice arguments.

Implements

ILocationInterceptionAspectOnGetValue(LocationInterceptionArgs)
See Also

Reference

LocationInterceptionAspect Class
PostSharp.Aspects Namespace
PostSharp.AspectsLocationInterceptionArgs

Other Resources

Conceptual: Intercepting Properties and Fields


LocationInterceptionAspect.OnSetValue Method

LocationInterceptionAspectOnSetValue Method

Method invoked instead of the Set semantic of the field or property to which the current aspect is applied, i.e. when the value of this field or property is changed.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void OnSetValue(
    LocationInterceptionArgs args
)

Parameters

args
Type: PostSharp.AspectsLocationInterceptionArgs
Advice arguments.

Implements

ILocationInterceptionAspectOnSetValue(LocationInterceptionArgs)
See Also

Reference

LocationInterceptionAspect Class
PostSharp.Aspects Namespace
PostSharp.AspectsLocationInterceptionArgs

Other Resources

Conceptual: Intercepting Properties and Fields


LocationLevelAspect Class

Base class for aspects defined in fields, properties, or parameters.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsLocationLevelAspect
PostSharp.AspectsLocationInterceptionAspect
PostSharp.Patterns.DiagnosticsLogValueAttribute
PostSharp.Patterns.ThreadingRequiresThreadSafeAttribute
PostSharp.Patterns.XamlCommandAttribute

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public abstract class LocationLevelAspect : Aspect,
    ILocationLevelAspect, IAspect, ILocationLevelAspectBuildSemantics, IAspectBuildSemantics, IValidableAnnotation

The LocationLevelAspect type exposes the following members.

Constructors
 | Name | Description
Protected method | LocationLevelAspect | Initializes a new instance of the LocationLevelAspect class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Overrides AspectCompileTimeValidate(Object).)
Public method | CompileTimeValidate(LocationInfo) | Method invoked at build time to ensure that the aspect has been applied to the right target.
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Inherited from Aspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | RuntimeInitialize | Initializes the current aspect.
Protected method | SetAspectConfiguration(AspectConfiguration, LocationInfo) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Overrides AspectSetAspectConfiguration(AspectConfiguration, Object).)
Top
Remarks
Note Note
This class does not provide any advice. You may derive your aspect class from a class providing predefined advice , or build a composite aspect .

Note Note
All classes implementing IAspect should typically be marked as serializable using the SerializableAttribute or PSerializableAttribute custom attribute . Fields that are only used at runtime (and unknown at compile-time) should be carefully marked with the NonSerializedAttribute or PNonSerializedAttribute custom attribute. When PostSharp is used on a platform that does not support aspect serialization (such as .NET Compact Framework, Silverlight, or Windows Phone), or when another aspect serializer is used, it is not necessary to mark the aspect class as serializable. For more information, see Aspect Serialization .

See Also

Reference

PostSharp.Aspects Namespace
PostSharp.AspectsILocationLevelAspect

Other Resources

Conceptual: Aspect Classes
Conceptual: Developing Complex Aspects
Conceptual: Aspect Serialization
Conceptual: Adding Behaviors to Existing Members
Conceptual: Developing Composite Aspects


LocationLevelAspect Constructor

Initializes a new instance of the LocationLevelAspect class

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected LocationLevelAspect()
See Also

Reference

LocationLevelAspect Class
PostSharp.Aspects Namespace


LocationLevelAspect Properties

The LocationLevelAspect type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

LocationLevelAspect Class
PostSharp.Aspects Namespace


LocationLevelAspect Methods

The LocationLevelAspect type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Overrides AspectCompileTimeValidate(Object).)
Public method | CompileTimeValidate(LocationInfo) | Method invoked at build time to ensure that the aspect has been applied to the right target.
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Inherited from Aspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | RuntimeInitialize | Initializes the current aspect.
Protected method | SetAspectConfiguration(AspectConfiguration, LocationInfo) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Overrides AspectSetAspectConfiguration(AspectConfiguration, Object).)
Top
See Also

Reference

LocationLevelAspect Class
PostSharp.Aspects Namespace


LocationLevelAspect.CompileTimeInitialize Method

LocationLevelAspectCompileTimeInitialize Method

Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void CompileTimeInitialize(
    LocationInfo targetLocation,
    AspectInfo aspectInfo
)

Parameters

targetLocation
Type: PostSharp.ReflectionLocationInfo
Location to which the current aspect is applied
aspectInfo
Type: PostSharp.AspectsAspectInfo
Reserved for future usage.

Implements

ILocationLevelAspectBuildSemanticsCompileTimeInitialize(LocationInfo, AspectInfo)
See Also

Reference

LocationLevelAspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Initializing Aspects


LocationLevelAspect.CompileTimeValidate Method

LocationLevelAspectCompileTimeValidate Method

Overload List
 | Name | Description
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Overrides AspectCompileTimeValidate(Object).)
Public method | CompileTimeValidate(LocationInfo) | Method invoked at build time to ensure that the aspect has been applied to the right target.
Top
See Also

Reference

LocationLevelAspect Class
PostSharp.Aspects Namespace


LocationLevelAspect.CompileTimeValidate Method (Object)

LocationLevelAspectCompileTimeValidate Method (Object)

Method invoked at build time to ensure that the aspect has been applied to the right target.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override sealed bool CompileTimeValidate(
    Object target
)

Parameters

target
Type: SystemObject
Code element (Assembly, Type, FieldInfo, MethodBase, PropertyInfo, EventInfo, ParameterInfo, or LocationInfo) to which the aspect has been applied.

Return Value

Type: Boolean
true if the aspect was applied to an acceptable target, otherwise false.

Implements

IValidableAnnotationCompileTimeValidate(Object)
Remarks
The implementation of this method is expected to emit an error message (see MessageSource) or an exception in case of error. Returning false without emitting an error message or exception causes the aspect to be silently ignored.
See Also

Reference

LocationLevelAspect Class
CompileTimeValidate Overload
PostSharp.Aspects Namespace

Other Resources

Conceptual: Validating Aspects
Conceptual: Adding Aspects to Multiple Declarations Using Attributes
Conceptual: Understanding Attribute Multicasting


LocationLevelAspect.CompileTimeValidate Method (LocationInfo)

LocationLevelAspectCompileTimeValidate Method (LocationInfo)

Method invoked at build time to ensure that the aspect has been applied to the right target.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual bool CompileTimeValidate(
    LocationInfo locationInfo
)

Parameters

locationInfo
Type: PostSharp.ReflectionLocationInfo
Location to which the aspect has been applied

Return Value

Type: Boolean
true if the aspect was applied to an acceptable field, otherwise false.
Remarks
The implementation of this method is expected to emit an error message (see MessageSource) or an exception in case of error. Returning false without emitting an error message or exception causes the aspect to be silently ignored.
See Also

Reference

LocationLevelAspect Class
CompileTimeValidate Overload
PostSharp.Aspects Namespace

Other Resources

Conceptual: Validating Aspects
Conceptual: Validating Aspect Usage


LocationLevelAspect.RuntimeInitialize Method

LocationLevelAspectRuntimeInitialize Method

Initializes the current aspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void RuntimeInitialize(
    LocationInfo locationInfo
)

Parameters

locationInfo
Type: PostSharp.ReflectionLocationInfo
Location to which the current aspect is applied.

Implements

ILocationLevelAspectRuntimeInitialize(LocationInfo)
See Also

Reference

LocationLevelAspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Initializing Aspects


LocationLevelAspect.SetAspectConfiguration Method

LocationLevelAspectSetAspectConfiguration Method

Overload List
 | Name | Description
Protected method | SetAspectConfiguration(AspectConfiguration, LocationInfo) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Overrides AspectSetAspectConfiguration(AspectConfiguration, Object).)
Top
See Also

Reference

LocationLevelAspect Class
PostSharp.Aspects Namespace


LocationLevelAspect.SetAspectConfiguration Method (AspectConfiguration, LocationInfo)

LocationLevelAspectSetAspectConfiguration Method (AspectConfiguration, LocationInfo)

Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void SetAspectConfiguration(
    AspectConfiguration aspectConfiguration,
    LocationInfo targetLocation
)

Parameters

aspectConfiguration
Type: PostSharp.Aspects.ConfigurationAspectConfiguration
The AspectConfiguration instance previously returned by the CreateAspectConfiguration method.
targetLocation
Type: PostSharp.ReflectionLocationInfo
Location to which the current aspect has been applied.
Remarks

Classes overriding this method must always invoke the base implementation before performing their own changes to the AspectConfiguration.

See Also

Reference

LocationLevelAspect Class
SetAspectConfiguration Overload
PostSharp.Aspects Namespace

Other Resources

Conceptual: Configuring Aspects


LocationLevelAspect.SetAspectConfiguration Method (AspectConfiguration, Object)

LocationLevelAspectSetAspectConfiguration Method (AspectConfiguration, Object)

Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override sealed void SetAspectConfiguration(
    AspectConfiguration aspectConfiguration,
    Object targetElement
)

Parameters

aspectConfiguration
Type: PostSharp.Aspects.ConfigurationAspectConfiguration
The AspectConfiguration instance previously returned by the CreateAspectConfiguration method.
targetElement
Type: SystemObject
Code element (Assembly, Type, FieldInfo, MethodBase, PropertyInfo, EventInfo, ParameterInfo, or LocationInfo) to which the current Aspect has been applied.
Remarks

Classes overriding this method must always invoke the base implementation before performing their own changes to the AspectConfiguration.

See Also

Reference

LocationLevelAspect Class
SetAspectConfiguration Overload
PostSharp.Aspects Namespace

Other Resources

Conceptual: Configuring Aspects


LocationValidationContext Enumeration

Enumerates the possible contexts in which the location validation advices can be invoked.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum LocationValidationContext
Members
Member name | Value | Description
Precondition | 1 | The value is being validated on method entry.
SuccessPostcondition | 2 | The value is being validated just before the method successfully returns.
Remarks
This enumeration can be passed as an argument to the method marked with the LocationValidationAdvice attribute.
See Also

Reference

PostSharp.Aspects Namespace


ManagedResourceIntroductionAspect Class

Aspect that, when applied to an assembly, adds a custom attribute to this assembly.
Inheritance Hierarchy
SystemObject
PostSharp.AspectsManagedResourceIntroductionAspect

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ManagedResourceIntroductionAspect : IManagedResourceIntroductionAspect,
    IAspect, IAspectBuildSemantics, IValidableAnnotation

The ManagedResourceIntroductionAspect type exposes the following members.

Constructors
 | Name | Description
Public method | ManagedResourceIntroductionAspect | Initializes a new ManagedResourceIntroductionAspect.
Top
Properties
 | Name | Description
Public property | Data | Gets the content of the managed resource.
Public property | Name | Gets the name of the managed resource.
Top
See Also

Reference

PostSharp.Aspects Namespace

Other Resources

Conceptual: Adding Aspects Dynamically
Conceptual: Introducing Managed Resources


ManagedResourceIntroductionAspect Constructor

Initializes a new ManagedResourceIntroductionAspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ManagedResourceIntroductionAspect(
    string name,
    byte[] data
)

Parameters

name
Type: SystemString
Name of the managed resource.
data
Type: SystemByte
Content of the managed resource.
See Also

Reference

ManagedResourceIntroductionAspect Class
PostSharp.Aspects Namespace


ManagedResourceIntroductionAspect Properties

The ManagedResourceIntroductionAspect type exposes the following members.

Properties
 | Name | Description
Public property | Data | Gets the content of the managed resource.
Public property | Name | Gets the name of the managed resource.
Top
See Also

Reference

ManagedResourceIntroductionAspect Class
PostSharp.Aspects Namespace


ManagedResourceIntroductionAspect.Data Property

ManagedResourceIntroductionAspectData Property

Gets the content of the managed resource.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public byte[] Data { get; }

Property Value

Type: Byte
See Also

Reference

ManagedResourceIntroductionAspect Class
PostSharp.Aspects Namespace


ManagedResourceIntroductionAspect.Name Property

ManagedResourceIntroductionAspectName Property

Gets the name of the managed resource.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string Name { get; }

Property Value

Type: String
See Also

Reference

ManagedResourceIntroductionAspect Class
PostSharp.Aspects Namespace


MethodBindingInvokeAwaitable Structure

Represents the awaitable result of the asynchronous method invocation. Await this value to get the System.Object instance containing the return value of the async method. The result of the await is null for async methods that do not return any value.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public struct MethodBindingInvokeAwaitable

The MethodBindingInvokeAwaitable type exposes the following members.

Methods
 | Name | Description
Public method | GetAwaiter | Gets an awaiter used to await the asynchronous method invocation.
Public method | GetTask | Gets the underlying task that was returned by the asynchronous method invocation.
Top
See Also

Reference

PostSharp.Aspects Namespace


MethodBindingInvokeAwaitable Methods

The MethodBindingInvokeAwaitable type exposes the following members.

Methods
 | Name | Description
Public method | GetAwaiter | Gets an awaiter used to await the asynchronous method invocation.
Public method | GetTask | Gets the underlying task that was returned by the asynchronous method invocation.
Top
See Also

Reference

MethodBindingInvokeAwaitable Structure
PostSharp.Aspects Namespace


MethodBindingInvokeAwaitable.GetAwaiter Method

MethodBindingInvokeAwaitableGetAwaiter Method

Gets an awaiter used to await the asynchronous method invocation.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MethodBindingInvokeAwaiter GetAwaiter()

Return Value

Type: MethodBindingInvokeAwaiter
MethodBindingInvokeAwaiter used to await the asynchronous method invocation.
See Also

Reference

MethodBindingInvokeAwaitable Structure
PostSharp.Aspects Namespace


MethodBindingInvokeAwaitable.GetTask Method

MethodBindingInvokeAwaitableGetTask Method

Gets the underlying task that was returned by the asynchronous method invocation.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Task GetTask()

Return Value

Type: Task
The Task instance returned by the asynchronous method.
See Also

Reference

MethodBindingInvokeAwaitable Structure
PostSharp.Aspects Namespace


MethodBindingInvokeAwaiter Structure

Represents the awaiter for the result of the asynchronous method invocation.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public struct MethodBindingInvokeAwaiter : ICriticalNotifyCompletion,
    INotifyCompletion

The MethodBindingInvokeAwaiter type exposes the following members.

Properties
 | Name | Description
Public property | IsCompleted | Gets a value that indicates whether a yield is not required.
Top
Methods
 | Name | Description
Public method | GetResult | Ends the await operation.
Public method | OnCompleted | Schedules the continuation action that's invoked when the instance completes.
Public method | UnsafeOnCompleted | Schedules the continuation action that's invoked when the instance completes.
Top
See Also

Reference

PostSharp.Aspects Namespace


MethodBindingInvokeAwaiter Properties

The MethodBindingInvokeAwaiter type exposes the following members.

Properties
 | Name | Description
Public property | IsCompleted | Gets a value that indicates whether a yield is not required.
Top
See Also

Reference

MethodBindingInvokeAwaiter Structure
PostSharp.Aspects Namespace


MethodBindingInvokeAwaiter.IsCompleted Property

MethodBindingInvokeAwaiterIsCompleted Property

Gets a value that indicates whether a yield is not required.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsCompleted { get; }

Property Value

Type: Boolean
See Also

Reference

MethodBindingInvokeAwaiter Structure
PostSharp.Aspects Namespace


MethodBindingInvokeAwaiter Methods

The MethodBindingInvokeAwaiter type exposes the following members.

Methods
 | Name | Description
Public method | GetResult | Ends the await operation.
Public method | OnCompleted | Schedules the continuation action that's invoked when the instance completes.
Public method | UnsafeOnCompleted | Schedules the continuation action that's invoked when the instance completes.
Top
See Also

Reference

MethodBindingInvokeAwaiter Structure
PostSharp.Aspects Namespace


MethodBindingInvokeAwaiter.GetResult Method

MethodBindingInvokeAwaiterGetResult Method

Ends the await operation.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Object GetResult()

Return Value

Type: Object
The result of the asynchronous invocation.
See Also

Reference

MethodBindingInvokeAwaiter Structure
PostSharp.Aspects Namespace


MethodBindingInvokeAwaiter.OnCompleted Method

MethodBindingInvokeAwaiterOnCompleted Method

Schedules the continuation action that's invoked when the instance completes.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void OnCompleted(
    Action continuation
)

Parameters

continuation
Type: SystemAction
The action to invoke when the operation completes.

Implements

INotifyCompletionOnCompleted(Action)
Exceptions
Exception | Condition
ArgumentNullException | The continuation argument is null (Nothing in Visual Basic).
See Also

Reference

MethodBindingInvokeAwaiter Structure
PostSharp.Aspects Namespace


MethodBindingInvokeAwaiter.UnsafeOnCompleted Method

MethodBindingInvokeAwaiterUnsafeOnCompleted Method

Schedules the continuation action that's invoked when the instance completes.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void UnsafeOnCompleted(
    Action continuation
)

Parameters

continuation
Type: SystemAction
The action to invoke when the operation completes.

Implements

ICriticalNotifyCompletionUnsafeOnCompleted(Action)
Exceptions
Exception | Condition
ArgumentNullException | The continuation argument is null (Nothing in Visual Basic).
See Also

Reference

MethodBindingInvokeAwaiter Structure
PostSharp.Aspects Namespace


MethodExecutionArgs Class

Arguments of advices of aspects of type OnMethodBoundaryAspect and OnExceptionAspect
Inheritance Hierarchy
SystemObject
PostSharp.AspectsAdviceArgs
PostSharp.AspectsMethodExecutionArgs

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class MethodExecutionArgs : AdviceArgs

The MethodExecutionArgs type exposes the following members.

Properties
 | Name | Description
Public property | Arguments | Gets the arguments with which the method has been invoked.
Public property | DeclarationIdentifier | Gets the DeclarationIdentifier of the declaration to which the advice has been applied. (Inherited from AdviceArgs.)
Public property | Exception | Gets the exception currently flying.
Public property | FlowBehavior | Determines the control flow of the target method once the advice is exited.
Public property | Instance | Gets or sets the object instance on which the method is being executed. (Inherited from AdviceArgs.)
Public property | Method | Gets the method being executed.
Public property | MethodExecutionTag | User-defined state information whose lifetime is linked to the current method execution. Aspects derived from IOnMethodBoundaryAspect should use this property to save state information between different events (OnEntry(MethodExecutionArgs), OnExit(MethodExecutionArgs) and OnException(MethodExecutionArgs)).
Public property | ReturnValue | Gets or sets the method return value.
Public property | YieldValue | Gets or sets the value yielded by the iterator method.
Top
Remarks
Note Note
As a result of weaving optimizations, instances of classes derived from AdviceArgs may be shared among different aspects. Therefore, aspect code should not attempt to access this object once the control has been given over to the next node in the chain of invocation. Consider working with aspect bindings if you need such deferred execution.
Note Note
Aspect weaving optimizations may also cause an advice parameter of this type to be seen null when inspecting it in a debugger. If you need to inspect the instance in runtime, consider disabling aspect optimizations in the debug build configuration.
See Also

Reference

PostSharp.Aspects Namespace

Other Resources

Conceptual: Aspect Bindings
Conceptual: Handling Exceptions
Conceptual: Injecting Behaviors Before and After Method Execution
Conceptual: Semantic Advising of Iterator and Async Methods


MethodExecutionArgs Properties

The MethodExecutionArgs type exposes the following members.

Properties
 | Name | Description
Public property | Arguments | Gets the arguments with which the method has been invoked.
Public property | DeclarationIdentifier | Gets the DeclarationIdentifier of the declaration to which the advice has been applied. (Inherited from AdviceArgs.)
Public property | Exception | Gets the exception currently flying.
Public property | FlowBehavior | Determines the control flow of the target method once the advice is exited.
Public property | Instance | Gets or sets the object instance on which the method is being executed. (Inherited from AdviceArgs.)
Public property | Method | Gets the method being executed.
Public property | MethodExecutionTag | User-defined state information whose lifetime is linked to the current method execution. Aspects derived from IOnMethodBoundaryAspect should use this property to save state information between different events (OnEntry(MethodExecutionArgs), OnExit(MethodExecutionArgs) and OnException(MethodExecutionArgs)).
Public property | ReturnValue | Gets or sets the method return value.
Public property | YieldValue | Gets or sets the value yielded by the iterator method.
Top
See Also

Reference

MethodExecutionArgs Class
PostSharp.Aspects Namespace


MethodExecutionArgs.Arguments Property

MethodExecutionArgsArguments Property

Gets the arguments with which the method has been invoked.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Arguments Arguments { get; set; }

Property Value

Type: Arguments
Remarks
Note Note
The property setter should never be used in user code.
Note Note
As a result of weaving optimizations, value of this property may be seen null in a debugger. If you need to inspect the value in runtime, consider disabling aspect optimizations in the debug build configuration.
See Also

Reference

MethodExecutionArgs Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Handling Exceptions
Conceptual: Injecting Behaviors Before and After Method Execution


MethodExecutionArgs.Exception Property

MethodExecutionArgsException Property

Gets the exception currently flying.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Exception Exception { get; set; }

Property Value

Type: Exception
An Exception, or null if the method is exiting normally.
Remarks

You cannot replace the exception by setting this property. Throw a new exception from the aspect if you need to replace the current exception.

See Also

Reference

MethodExecutionArgs Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Handling Exceptions
Conceptual: Injecting Behaviors Before and After Method Execution


MethodExecutionArgs.FlowBehavior Property

MethodExecutionArgsFlowBehavior Property

Determines the control flow of the target method once the advice is exited.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public FlowBehavior FlowBehavior { get; set; }

Property Value

Type: FlowBehavior
Remarks
Note Note
As a result of weaving optimizations, value of this property may be seen null in a debugger. If you need to inspect the value in runtime, consider disabling aspect optimizations in the debug build configuration.
See Also

Reference

MethodExecutionArgs Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Handling Exceptions
Conceptual: Injecting Behaviors Before and After Method Execution
Conceptual: What's New in PostSharp 5.0


MethodExecutionArgs.Method Property

MethodExecutionArgsMethod Property

Gets the method being executed.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MethodBase Method { get; set; }

Property Value

Type: MethodBase
Remarks

If the executed method is generic or if its declaring type is generic, the current property contains the generic instance being executed.

Note Note
Using this property causes the aspect weaver to generate code that has non-trivial runtime overhead. Avoid using this property whenever possible. One of the possible solution is to use compile-time initialization of aspect instances and to make use of reflection only at build time. See CompileTimeInitialize(MethodBase, AspectInfo) for details.
Note Note
As a result of weaving optimizations, value of this property may be seen null in a debugger. If you need to inspect the value in runtime, consider disabling aspect optimizations in the debug build configuration.
See Also

Reference

MethodExecutionArgs Class
PostSharp.Aspects Namespace
MethodLevelAspectCompileTimeInitialize(MethodBase, AspectInfo)

Other Resources

Conceptual: Handling Exceptions
Conceptual: Injecting Behaviors Before and After Method Execution


MethodExecutionArgs.MethodExecutionTag Property

MethodExecutionArgsMethodExecutionTag Property

User-defined state information whose lifetime is linked to the current method execution. Aspects derived from IOnMethodBoundaryAspect should use this property to save state information between different events (OnEntry(MethodExecutionArgs), OnExit(MethodExecutionArgs) and OnException(MethodExecutionArgs)).

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Object MethodExecutionTag { get; set; }

Property Value

Type: Object
Remarks
Note Note
As a result of weaving optimizations, value of this property may be seen null in a debugger. If you need to inspect the value in runtime, consider disabling aspect optimizations in the debug build configuration.
See Also

Reference

MethodExecutionArgs Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Adding Behaviors to Existing Members
Conceptual: Injecting Behaviors Before and After Method Execution
Conceptual: Semantic Advising of Iterator and Async Methods


MethodExecutionArgs.ReturnValue Property

MethodExecutionArgsReturnValue Property

Gets or sets the method return value.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Object ReturnValue { get; set; }

Property Value

Type: Object
Remarks

You can modify the return value only when the join point is located after a method execution (OnSuccess(MethodExecutionArgs), OnException(MethodExecutionArgs) or OnExit(MethodExecutionArgs), or in case you force the method to exit using the FlowBehavior property.

Note Note
As a result of weaving optimizations, value of this property may be seen null in a debugger. If you need to inspect the value in runtime, consider disabling aspect optimizations in the debug build configuration.
See Also

Reference

MethodExecutionArgs Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Handling Exceptions
Conceptual: Injecting Behaviors Before and After Method Execution
Conceptual: What's New in PostSharp 5.0


MethodExecutionArgs.YieldValue Property

MethodExecutionArgsYieldValue Property

Gets or sets the value yielded by the iterator method.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Object YieldValue { get; set; }

Property Value

Type: Object
Remarks

This property is only available inside the OnYield(MethodExecutionArgs) advice when the current method is an iterator method.

Note Note
As a result of weaving optimizations, value of this property may be seen null in a debugger. If you need to inspect the value in runtime, consider disabling aspect optimizations in the debug build configuration.
See Also

Reference

MethodExecutionArgs Class
PostSharp.Aspects Namespace
PostSharp.AspectsIOnStateMachineBoundaryAspect

Other Resources

Conceptual: Injecting Behaviors Before and After Method Execution


MethodImplementationAspect Class

Aspect that, when applied on an abstract or extern method, creates an implementation for this method.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsMethodLevelAspect
PostSharp.AspectsMethodImplementationAspect

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public abstract class MethodImplementationAspect : MethodLevelAspect,
    IMethodInterceptionAspect, IMethodLevelAspect, IAspect

The MethodImplementationAspect type exposes the following members.

Constructors
 | Name | Description
Protected method | MethodImplementationAspect | Initializes a new instance of the MethodImplementationAspect class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(MethodBase) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Overrides AspectCreateAspectConfiguration.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnInvoke | Method invoked instead of the method to which the aspect has been applied.
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from MethodLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from MethodLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, MethodBase) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from MethodLevelAspect.)
Top
Remarks

This aspect is exactly identical to MethodInterceptionAspect, with the difference that it applies to abstract methods.

Note Note
All classes implementing IAspect should typically be marked as serializable using the SerializableAttribute or PSerializableAttribute custom attribute . Fields that are only used at runtime (and unknown at compile-time) should be carefully marked with the NonSerializedAttribute or PNonSerializedAttribute custom attribute. When PostSharp is used on a platform that does not support aspect serialization (such as .NET Compact Framework, Silverlight, or Windows Phone), or when another aspect serializer is used, it is not necessary to mark the aspect class as serializable. For more information, see Aspect Serialization .

See Also

Reference

PostSharp.Aspects Namespace
PostSharp.Aspects.ConfigurationMethodInterceptionAspectConfigurationAttribute

Other Resources

Conceptual: Aspect Serialization


MethodImplementationAspect Constructor

Initializes a new instance of the MethodImplementationAspect class

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected MethodImplementationAspect()
See Also

Reference

MethodImplementationAspect Class
PostSharp.Aspects Namespace


MethodImplementationAspect Properties

The MethodImplementationAspect type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

MethodImplementationAspect Class
PostSharp.Aspects Namespace


MethodImplementationAspect Methods

The MethodImplementationAspect type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(MethodBase) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Overrides AspectCreateAspectConfiguration.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnInvoke | Method invoked instead of the method to which the aspect has been applied.
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from MethodLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from MethodLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, MethodBase) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from MethodLevelAspect.)
Top
See Also

Reference

MethodImplementationAspect Class
PostSharp.Aspects Namespace


MethodImplementationAspect.CreateAspectConfiguration Method

MethodImplementationAspectCreateAspectConfiguration Method

Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override AspectConfiguration CreateAspectConfiguration()

Return Value

Type: AspectConfiguration
A new and empty instance of AspectConfiguration, whose concrete type corresponds to the concrete type of the Aspect.
Remarks
This method should not set up the returned AspectConfiguration. After the current method has returned, the SetAspectConfiguration(AspectConfiguration, Object) method will be invoked, and this method is responsible for setting up the AspectConfigurationobject.
See Also

Reference

MethodImplementationAspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Configuring Aspects


MethodImplementationAspect.OnInvoke Method

MethodImplementationAspectOnInvoke Method

Method invoked instead of the method to which the aspect has been applied.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract void OnInvoke(
    MethodInterceptionArgs args
)

Parameters

args
Type: PostSharp.AspectsMethodInterceptionArgs
Advice arguments.

Implements

IMethodInterceptionAspectOnInvoke(MethodInterceptionArgs)
Remarks

The implementation of OnInvoke(MethodInterceptionArgs) may invoke Proceed, may schedule it for invocation from another thread, or may completely skip its invocation. Alternatively, it may use Binding. Before returning to the caller, the OnInvoke(MethodInterceptionArgs) method must set the return value (property ReturnValue) and all output arguments (property Arguments), otherwise the target method may fail with a NullReferenceException. These are normally set by calling Proceed.

See Also

Reference

MethodImplementationAspect Class
PostSharp.Aspects Namespace
PostSharp.AspectsMethodInterceptionArgs


MethodInterceptionArgs Class

Arguments of advices of aspect type MethodInterceptionAspect.
Inheritance Hierarchy
SystemObject
PostSharp.AspectsAdviceArgs
PostSharp.AspectsMethodInterceptionArgs

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class MethodInterceptionArgs : AdviceArgs

The MethodInterceptionArgs type exposes the following members.

Properties
 | Name | Description
Public property | Arguments | Gets the list of arguments with which the method has been invoked.
Public property | AsyncBinding | Gets an interface that allows to invoke asynchronously the next node in the chain of invocation of the intercepted method.
Public property | Binding | Gets an interface that allows to invoke the next node in the chain of invocation of the intercepted method.
Public property | DeclarationIdentifier | Gets the DeclarationIdentifier of the declaration to which the advice has been applied. (Inherited from AdviceArgs.)
Public property | Instance | Gets or sets the object instance on which the method is being executed. (Inherited from AdviceArgs.)
Public property | IsAsync | Determines whether the intercepted method is async, and therefore whether the AsyncBinding property and ProceedAsync method are available.
Public property | Method | Gets the method being executed.
Public property | ReturnValue | Gets or sets the return value of the method.
Top
Methods
 | Name | Description
Public method | Invoke | Invokes the method that has been intercepted by calling the next node in the chain of invocation with given arguments, without affecting the property ReturnValue.
Public method | InvokeAsync | Invokes asynchronously the method that has been intercepted by calling the next node in the chain of invocation with given arguments, without affecting the property ReturnValue.
Public method | Proceed | Proceeds with invocation of the method that has been intercepted by calling the next node in the chain of invocation, passing the current Arguments to that method and storing its return value into the property ReturnValue.
Public method | ProceedAsync | Proceeds asynchronously with invocation of the method that has been intercepted by calling the next node in the chain of invocation, passing the current Arguments to that method and storing its return value into the property ReturnValue upon the completion of the intercepted async method.
Top
Remarks
Note Note
As a result of weaving optimizations, instances of classes derived from AdviceArgs may be shared among different aspects. Therefore, aspect code should not attempt to access this object once the control has been given over to the next node in the chain of invocation. Consider working with aspect bindings if you need such deferred execution.
Note Note
Aspect weaving optimizations may also cause an advice parameter of this type to be seen null when inspecting it in a debugger. If you need to inspect the instance in runtime, consider disabling aspect optimizations in the debug build configuration.
See Also

Reference

PostSharp.Aspects Namespace
PostSharp.AspectsMethodInterceptionAspect

Other Resources

Conceptual: Aspect Bindings
Conceptual: Intercepting Methods


MethodInterceptionArgs Properties

The MethodInterceptionArgs type exposes the following members.

Properties
 | Name | Description
Public property | Arguments | Gets the list of arguments with which the method has been invoked.
Public property | AsyncBinding | Gets an interface that allows to invoke asynchronously the next node in the chain of invocation of the intercepted method.
Public property | Binding | Gets an interface that allows to invoke the next node in the chain of invocation of the intercepted method.
Public property | DeclarationIdentifier | Gets the DeclarationIdentifier of the declaration to which the advice has been applied. (Inherited from AdviceArgs.)
Public property | Instance | Gets or sets the object instance on which the method is being executed. (Inherited from AdviceArgs.)
Public property | IsAsync | Determines whether the intercepted method is async, and therefore whether the AsyncBinding property and ProceedAsync method are available.
Public property | Method | Gets the method being executed.
Public property | ReturnValue | Gets or sets the return value of the method.
Top
See Also

Reference

MethodInterceptionArgs Class
PostSharp.Aspects Namespace


MethodInterceptionArgs.Arguments Property

MethodInterceptionArgsArguments Property

Gets the list of arguments with which the method has been invoked.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Arguments Arguments { get; protected set; }

Property Value

Type: Arguments
Remarks
Note Note
As a result of weaving optimizations, value of this property may be seen null in a debugger. If you need to inspect the value in runtime, consider disabling aspect optimizations in the debug build configuration.
See Also

Reference

MethodInterceptionArgs Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Intercepting Methods


MethodInterceptionArgs.AsyncBinding Property

MethodInterceptionArgsAsyncBinding Property

Gets an interface that allows to invoke asynchronously the next node in the chain of invocation of the intercepted method.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract IAsyncMethodBinding AsyncBinding { get; }

Property Value

Type: IAsyncMethodBinding
Remarks

Bindings are thread-safe and context-free singleton instances exposing the next node in the chain of invocation.

Note Note
As a result of weaving optimizations, value of this property may be seen null in a debugger. If you need to inspect the value in runtime, consider disabling aspect optimizations in the debug build configuration.
See Also

Reference

MethodInterceptionArgs Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Aspect Bindings


MethodInterceptionArgs.Binding Property

MethodInterceptionArgsBinding Property

Gets an interface that allows to invoke the next node in the chain of invocation of the intercepted method.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract IMethodBinding Binding { get; }

Property Value

Type: IMethodBinding
Remarks

Bindings are thread-safe and context-free singleton instances exposing the next node in the chain of invocation.

Note Note
As a result of weaving optimizations, value of this property may be seen null in a debugger. If you need to inspect the value in runtime, consider disabling aspect optimizations in the debug build configuration.
See Also

Reference

MethodInterceptionArgs Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Aspect Bindings
Conceptual: Intercepting Methods


MethodInterceptionArgs.IsAsync Property

MethodInterceptionArgsIsAsync Property

Determines whether the intercepted method is async, and therefore whether the AsyncBinding property and ProceedAsync method are available.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract bool IsAsync { get; }

Property Value

Type: Boolean
See Also

Reference

MethodInterceptionArgs Class
PostSharp.Aspects Namespace


MethodInterceptionArgs.Method Property

MethodInterceptionArgsMethod Property

Gets the method being executed.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MethodBase Method { get; set; }

Property Value

Type: MethodBase
Remarks

If the executed method is generic or if its declaring type is generic, the current property contains the generic instance being executed.

Note Note
Using this property causes the aspect weaver to generate code that has non-trivial runtime overhead. Avoid using this property whenever possible. One of the possible solution is to use compile-time initialization of aspect instances and to make use of reflection only at build time. See CompileTimeInitialize(MethodBase, AspectInfo) for details.
Note Note
As a result of weaving optimizations, value of this property may be seen null in a debugger. If you need to inspect the value in runtime, consider disabling aspect optimizations in the debug build configuration.
See Also

Reference

MethodInterceptionArgs Class
PostSharp.Aspects Namespace
MethodLevelAspectCompileTimeInitialize(MethodBase, AspectInfo)

Other Resources

Conceptual: Intercepting Methods


MethodInterceptionArgs.ReturnValue Property

MethodInterceptionArgsReturnValue Property

Gets or sets the return value of the method.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract Object ReturnValue { get; set; }

Property Value

Type: Object
Remarks
Note Note
As a result of weaving optimizations, value of this property may be seen null in a debugger. If you need to inspect the value in runtime, consider disabling aspect optimizations in the debug build configuration.
See Also

Reference

MethodInterceptionArgs Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Intercepting Methods


MethodInterceptionArgs Methods

The MethodInterceptionArgs type exposes the following members.

Methods
 | Name | Description
Public method | Invoke | Invokes the method that has been intercepted by calling the next node in the chain of invocation with given arguments, without affecting the property ReturnValue.
Public method | InvokeAsync | Invokes asynchronously the method that has been intercepted by calling the next node in the chain of invocation with given arguments, without affecting the property ReturnValue.
Public method | Proceed | Proceeds with invocation of the method that has been intercepted by calling the next node in the chain of invocation, passing the current Arguments to that method and storing its return value into the property ReturnValue.
Public method | ProceedAsync | Proceeds asynchronously with invocation of the method that has been intercepted by calling the next node in the chain of invocation, passing the current Arguments to that method and storing its return value into the property ReturnValue upon the completion of the intercepted async method.
Top
See Also

Reference

MethodInterceptionArgs Class
PostSharp.Aspects Namespace


MethodInterceptionArgs.Invoke Method

MethodInterceptionArgsInvoke Method

Invokes the method that has been intercepted by calling the next node in the chain of invocation with given arguments, without affecting the property ReturnValue.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract Object Invoke(
    Arguments arguments
)

Parameters

arguments
Type: PostSharp.AspectsArguments
Arguments passed to the intercepted method.

Return Value

Type: Object
Value returned by the intercepted method.
See Also

Reference

MethodInterceptionArgs Class
PostSharp.Aspects Namespace


MethodInterceptionArgs.InvokeAsync Method

MethodInterceptionArgsInvokeAsync Method

Invokes asynchronously the method that has been intercepted by calling the next node in the chain of invocation with given arguments, without affecting the property ReturnValue.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract MethodBindingInvokeAwaitable InvokeAsync(
    Arguments arguments
)

Parameters

arguments
Type: PostSharp.AspectsArguments
Arguments passed to the intercepted method.

Return Value

Type: MethodBindingInvokeAwaitable
The value that can be awaited to get the result of the intercepted method's invocation.
See Also

Reference

MethodInterceptionArgs Class
PostSharp.Aspects Namespace


MethodInterceptionArgs.Proceed Method

MethodInterceptionArgsProceed Method

Proceeds with invocation of the method that has been intercepted by calling the next node in the chain of invocation, passing the current Arguments to that method and storing its return value into the property ReturnValue.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract void Proceed()
See Also

Reference

MethodInterceptionArgs Class
PostSharp.Aspects Namespace


MethodInterceptionArgs.ProceedAsync Method

MethodInterceptionArgsProceedAsync Method

Proceeds asynchronously with invocation of the method that has been intercepted by calling the next node in the chain of invocation, passing the current Arguments to that method and storing its return value into the property ReturnValue upon the completion of the intercepted async method.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract MethodInterceptionProceedAwaitable ProceedAsync()

Return Value

Type: MethodInterceptionProceedAwaitable
See Also

Reference

MethodInterceptionArgs Class
PostSharp.Aspects Namespace


MethodInterceptionAspect Class

Aspect that, when applied on a method, intercepts invocations of this method.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsMethodLevelAspect
PostSharp.AspectsMethodInterceptionAspect
PostSharp.Patterns.CachingCacheAttribute
PostSharp.Patterns.CachingInvalidateCacheAttribute
PostSharp.Patterns.ThreadingBackgroundAttribute

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public abstract class MethodInterceptionAspect : MethodLevelAspect,
    IMethodInterceptionAspect, IMethodLevelAspect, IAspect, IAsyncMethodInterceptionAspect

The MethodInterceptionAspect type exposes the following members.

Constructors
 | Name | Description
Protected method | MethodInterceptionAspect | Initializes a new instance of the MethodInterceptionAspect class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | SemanticallyAdvisedMethodKinds | Determines which target methods will be advised semantically. This affects the behavior of the aspect when it's applied to iterator or async methods, which are compiled into state machines.
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an async method with unsupported return value type.
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(MethodBase) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Overrides AspectCreateAspectConfiguration.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnInvoke | Method invoked instead of the method to which the aspect has been applied.
Public method | OnInvokeAsync | Method invoked instead of the method to which the aspect has been applied.
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from MethodLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, MethodBase) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Overrides MethodLevelAspectSetAspectConfiguration(AspectConfiguration, MethodBase).)
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from MethodLevelAspect.)
Top
Remarks

Applying a MethodInterceptionAspect to a method results in the body of this method to be replaced by a call to the aspect OnInvoke(MethodInterceptionArgs) method of the current class. The original method body is moved into a new method, which can be called by the aspect by invoking the Proceed method, or by using the object Binding.

Note Note
All classes implementing IAspect should typically be marked as serializable using the SerializableAttribute or PSerializableAttribute custom attribute . Fields that are only used at runtime (and unknown at compile-time) should be carefully marked with the NonSerializedAttribute or PNonSerializedAttribute custom attribute. When PostSharp is used on a platform that does not support aspect serialization (such as .NET Compact Framework, Silverlight, or Windows Phone), or when another aspect serializer is used, it is not necessary to mark the aspect class as serializable. For more information, see Aspect Serialization .

See Also

Reference

PostSharp.Aspects Namespace
PostSharp.Aspects.ConfigurationMethodInterceptionAspectConfigurationAttribute

Other Resources

Conceptual: Aspect Serialization
Conceptual: Interception Aspects
Conceptual: Adding Behaviors to Existing Members
Conceptual: Developing Composite Aspects
Conceptual: Intercepting Methods
Conceptual: Semantic Advising of Iterator and Async Methods
Conceptual: What's New in PostSharp 5.0


MethodInterceptionAspect Constructor

Initializes a new instance of the MethodInterceptionAspect class

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected MethodInterceptionAspect()
See Also

Reference

MethodInterceptionAspect Class
PostSharp.Aspects Namespace


MethodInterceptionAspect Properties

The MethodInterceptionAspect type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | SemanticallyAdvisedMethodKinds | Determines which target methods will be advised semantically. This affects the behavior of the aspect when it's applied to iterator or async methods, which are compiled into state machines.
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an async method with unsupported return value type.
Top
See Also

Reference

MethodInterceptionAspect Class
PostSharp.Aspects Namespace


MethodInterceptionAspect.SemanticallyAdvisedMethodKinds Property

MethodInterceptionAspectSemanticallyAdvisedMethodKinds Property

Determines which target methods will be advised semantically. This affects the behavior of the aspect when it's applied to iterator or async methods, which are compiled into state machines.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected SemanticallyAdvisedMethodKinds SemanticallyAdvisedMethodKinds { get; set; }

Property Value

Type: SemanticallyAdvisedMethodKinds
Remarks

Semantic advising results in an aspect that is consistent with the level of abstraction of the programming language. This is the default behavior. You can disable semantic advising using this property to be consistent with the level of abstraction of MSIL and for backward-compatibility with the versions of PostSharp prior to 3.1.

See Also

Reference

MethodInterceptionAspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Breaking Changes in PostSharp 5.0
Conceptual: Intercepting Methods
Conceptual: What's New in PostSharp 5.0


MethodInterceptionAspect.UnsupportedTargetAction Property

MethodInterceptionAspectUnsupportedTargetAction Property

Specifies the action to take when the aspect is applied to an async method with unsupported return value type.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public UnsupportedTargetAction UnsupportedTargetAction { get; set; }

Property Value

Type: UnsupportedTargetAction
Remarks

Starting with C#7 async methods can have return types other than Task or TaskTResult. Async method interception does not support this type of async methods. By default, the build error is raised whenever async method interception is applied to a method that returns awaitable type other than Task or TaskTResult.

Set this property to change how unsupported async methods are handled during compile time.

See Also

Reference

MethodInterceptionAspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: What's New in PostSharp 5.0


MethodInterceptionAspect Methods

The MethodInterceptionAspect type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(MethodBase) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Overrides AspectCreateAspectConfiguration.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnInvoke | Method invoked instead of the method to which the aspect has been applied.
Public method | OnInvokeAsync | Method invoked instead of the method to which the aspect has been applied.
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from MethodLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, MethodBase) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Overrides MethodLevelAspectSetAspectConfiguration(AspectConfiguration, MethodBase).)
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from MethodLevelAspect.)
Top
See Also

Reference

MethodInterceptionAspect Class
PostSharp.Aspects Namespace


MethodInterceptionAspect.CreateAspectConfiguration Method

MethodInterceptionAspectCreateAspectConfiguration Method

Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override AspectConfiguration CreateAspectConfiguration()

Return Value

Type: AspectConfiguration
A new and empty instance of AspectConfiguration, whose concrete type corresponds to the concrete type of the Aspect.
Remarks
This method should not set up the returned AspectConfiguration. After the current method has returned, the SetAspectConfiguration(AspectConfiguration, Object) method will be invoked, and this method is responsible for setting up the AspectConfigurationobject.
See Also

Reference

MethodInterceptionAspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Configuring Aspects


MethodInterceptionAspect.OnInvoke Method

MethodInterceptionAspectOnInvoke Method

Method invoked instead of the method to which the aspect has been applied.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void OnInvoke(
    MethodInterceptionArgs args
)

Parameters

args
Type: PostSharp.AspectsMethodInterceptionArgs
Advice arguments.

Implements

IMethodInterceptionAspectOnInvoke(MethodInterceptionArgs)
Remarks

The implementation of OnInvoke(MethodInterceptionArgs) may invoke Proceed, may schedule it for invocation from another thread, or may completely skip its invocation. Alternatively, it may use Binding. Before returning to the caller, the OnInvoke(MethodInterceptionArgs) method must set the return value (property ReturnValue) and all output arguments (property Arguments), otherwise the target method may fail with a NullReferenceException. These are normally set by calling Proceed.

See Also

Reference

MethodInterceptionAspect Class
PostSharp.Aspects Namespace
PostSharp.AspectsMethodInterceptionArgs

Other Resources

Conceptual: Intercepting Methods


MethodInterceptionAspect.OnInvokeAsync Method

MethodInterceptionAspectOnInvokeAsync Method

Method invoked instead of the method to which the aspect has been applied.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual Task OnInvokeAsync(
    MethodInterceptionArgs args
)

Parameters

args
Type: PostSharp.AspectsMethodInterceptionArgs
Advice arguments.

Return Value

Type: Task

Implements

IAsyncMethodInterceptionAspectOnInvokeAsync(MethodInterceptionArgs)
Remarks

The implementation of OnInvokeAsync(MethodInterceptionArgs) may invoke ProceedAsync, may schedule it for invocation from another thread, or may completely skip its invocation. Alternatively, it may use Binding. Before returning to the caller, the OnInvokeAsync(MethodInterceptionArgs) method must set the return value (property ReturnValue), otherwise the target method may fail with a NullReferenceException. It is normally set by calling ProceedAsync.

See Also

Reference

MethodInterceptionAspect Class
PostSharp.Aspects Namespace
PostSharp.AspectsMethodInterceptionArgs

Other Resources

Conceptual: Intercepting Methods
Conceptual: Semantic Advising of Iterator and Async Methods
Conceptual: What's New in PostSharp 5.0


MethodInterceptionAspect.SetAspectConfiguration Method

MethodInterceptionAspectSetAspectConfiguration Method

Overload List
 | Name | Description
Protected method | SetAspectConfiguration(AspectConfiguration, MethodBase) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Overrides MethodLevelAspectSetAspectConfiguration(AspectConfiguration, MethodBase).)
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from MethodLevelAspect.)
Top
See Also

Reference

MethodInterceptionAspect Class
PostSharp.Aspects Namespace


MethodInterceptionAspect.SetAspectConfiguration Method (AspectConfiguration, MethodBase)

MethodInterceptionAspectSetAspectConfiguration Method (AspectConfiguration, MethodBase)

Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void SetAspectConfiguration(
    AspectConfiguration aspectConfiguration,
    MethodBase targetMethod
)

Parameters

aspectConfiguration
Type: PostSharp.Aspects.ConfigurationAspectConfiguration
The AspectConfiguration instance previously returned by the CreateAspectConfiguration method.
targetMethod
Type: System.ReflectionMethodBase
Method to which the current aspect has been applied.
Remarks

Classes overriding this method must always invoke the base implementation before performing their own changes to the AspectConfiguration.

See Also

Reference

MethodInterceptionAspect Class
SetAspectConfiguration Overload
PostSharp.Aspects Namespace

Other Resources

Conceptual: Configuring Aspects


MethodInterceptionProceedAwaitable Structure

Represents the asynchronous proceed operation that calls the next node in the chain of invocation.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public struct MethodInterceptionProceedAwaitable

The MethodInterceptionProceedAwaitable type exposes the following members.

Methods
 | Name | Description
Public method | GetAwaiter | Gets an awaiter used to await the asynchronous method invocation.
Public method | GetTask | Gets the underlying task that represents the asynchronous proceed operation.
Top
See Also

Reference

PostSharp.Aspects Namespace


MethodInterceptionProceedAwaitable Methods

The MethodInterceptionProceedAwaitable type exposes the following members.

Methods
 | Name | Description
Public method | GetAwaiter | Gets an awaiter used to await the asynchronous method invocation.
Public method | GetTask | Gets the underlying task that represents the asynchronous proceed operation.
Top
See Also

Reference

MethodInterceptionProceedAwaitable Structure
PostSharp.Aspects Namespace


MethodInterceptionProceedAwaitable.GetAwaiter Method

MethodInterceptionProceedAwaitableGetAwaiter Method

Gets an awaiter used to await the asynchronous method invocation.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MethodInterceptionProceedAwaiter GetAwaiter()

Return Value

Type: MethodInterceptionProceedAwaiter
MethodInterceptionProceedAwaiter used to await the asynchronous method invocation.
See Also

Reference

MethodInterceptionProceedAwaitable Structure
PostSharp.Aspects Namespace


MethodInterceptionProceedAwaitable.GetTask Method

MethodInterceptionProceedAwaitableGetTask Method

Gets the underlying task that represents the asynchronous proceed operation.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Task GetTask()

Return Value

Type: Task
The Task instance that represents the asynchronous proceed operation.
See Also

Reference

MethodInterceptionProceedAwaitable Structure
PostSharp.Aspects Namespace


MethodInterceptionProceedAwaiter Structure

Represents the awaiter for the completion of the asynchronous proceed operation.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public struct MethodInterceptionProceedAwaiter : ICriticalNotifyCompletion,
    INotifyCompletion

The MethodInterceptionProceedAwaiter type exposes the following members.

Properties
 | Name | Description
Public property | IsCompleted | Gets a value that indicates whether a yield is not required.
Top
Methods
 | Name | Description
Public method | GetResult | Ends the await operation.
Public method | OnCompleted | Schedules the continuation action that's invoked when the instance completes.
Public method | UnsafeOnCompleted | Schedules the continuation action that's invoked when the instance completes.
Top
See Also

Reference

PostSharp.Aspects Namespace


MethodInterceptionProceedAwaiter Properties

The MethodInterceptionProceedAwaiter type exposes the following members.

Properties
 | Name | Description
Public property | IsCompleted | Gets a value that indicates whether a yield is not required.
Top
See Also

Reference

MethodInterceptionProceedAwaiter Structure
PostSharp.Aspects Namespace


MethodInterceptionProceedAwaiter.IsCompleted Property

MethodInterceptionProceedAwaiterIsCompleted Property

Gets a value that indicates whether a yield is not required.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsCompleted { get; }

Property Value

Type: Boolean
See Also

Reference

MethodInterceptionProceedAwaiter Structure
PostSharp.Aspects Namespace


MethodInterceptionProceedAwaiter Methods

The MethodInterceptionProceedAwaiter type exposes the following members.

Methods
 | Name | Description
Public method | GetResult | Ends the await operation.
Public method | OnCompleted | Schedules the continuation action that's invoked when the instance completes.
Public method | UnsafeOnCompleted | Schedules the continuation action that's invoked when the instance completes.
Top
See Also

Reference

MethodInterceptionProceedAwaiter Structure
PostSharp.Aspects Namespace


MethodInterceptionProceedAwaiter.GetResult Method

MethodInterceptionProceedAwaiterGetResult Method

Ends the await operation.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void GetResult()
See Also

Reference

MethodInterceptionProceedAwaiter Structure
PostSharp.Aspects Namespace


MethodInterceptionProceedAwaiter.OnCompleted Method

MethodInterceptionProceedAwaiterOnCompleted Method

Schedules the continuation action that's invoked when the instance completes.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void OnCompleted(
    Action continuation
)

Parameters

continuation
Type: SystemAction
The action to invoke when the operation completes.

Implements

INotifyCompletionOnCompleted(Action)
Exceptions
Exception | Condition
ArgumentNullException | The continuation argument is null (Nothing in Visual Basic).
See Also

Reference

MethodInterceptionProceedAwaiter Structure
PostSharp.Aspects Namespace


MethodInterceptionProceedAwaiter.UnsafeOnCompleted Method

MethodInterceptionProceedAwaiterUnsafeOnCompleted Method

Schedules the continuation action that's invoked when the instance completes.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void UnsafeOnCompleted(
    Action continuation
)

Parameters

continuation
Type: SystemAction
The action to invoke when the operation completes.

Implements

ICriticalNotifyCompletionUnsafeOnCompleted(Action)
Exceptions
Exception | Condition
ArgumentNullException | The continuation argument is null (Nothing in Visual Basic).
See Also

Reference

MethodInterceptionProceedAwaiter Structure
PostSharp.Aspects Namespace


MethodLevelAspect Class

Base class for all aspects applied on methods.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsMethodLevelAspect
More...

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public abstract class MethodLevelAspect : Aspect,
    IMethodLevelAspect, IAspect, IMethodLevelAspectBuildSemantics, IAspectBuildSemantics, IValidableAnnotation

The MethodLevelAspect type exposes the following members.

Constructors
 | Name | Description
Protected method | MethodLevelAspect | Initializes a new instance of the MethodLevelAspect class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Overrides AspectCompileTimeValidate(Object).)
Public method | CompileTimeValidate(MethodBase) | Method invoked at build time to ensure that the aspect has been applied to the right target.
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Inherited from Aspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | RuntimeInitialize | Initializes the current aspect.
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Overrides AspectSetAspectConfiguration(AspectConfiguration, Object).)
Protected method | SetAspectConfiguration(AspectConfiguration, MethodBase) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.
Top
Remarks
Note Note
This class does not provide any advice. You may derive your aspect class from a class providing predefined advice , or build a composite aspect .

Note Note
All classes implementing IAspect should typically be marked as serializable using the SerializableAttribute or PSerializableAttribute custom attribute . Fields that are only used at runtime (and unknown at compile-time) should be carefully marked with the NonSerializedAttribute or PNonSerializedAttribute custom attribute. When PostSharp is used on a platform that does not support aspect serialization (such as .NET Compact Framework, Silverlight, or Windows Phone), or when another aspect serializer is used, it is not necessary to mark the aspect class as serializable. For more information, see Aspect Serialization .

See Also

Reference

PostSharp.Aspects Namespace
PostSharp.AspectsIMethodLevelAspect

Other Resources

Conceptual: Aspect Classes
Conceptual: Developing Complex Aspects
Conceptual: Aspect Serialization
Conceptual: Adding Behaviors to Existing Members
Conceptual: Developing Composite Aspects
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsMethodLevelAspect
PostSharp.AspectsMethodImplementationAspect
PostSharp.AspectsMethodInterceptionAspect
PostSharp.AspectsOnExceptionAspect
PostSharp.AspectsOnMethodBoundaryAspect
PostSharp.Patterns.DiagnosticsLogAttributeBase
PostSharp.Patterns.ThreadingDispatchedAttribute


MethodLevelAspect Constructor

Initializes a new instance of the MethodLevelAspect class

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected MethodLevelAspect()
See Also

Reference

MethodLevelAspect Class
PostSharp.Aspects Namespace


MethodLevelAspect Properties

The MethodLevelAspect type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

MethodLevelAspect Class
PostSharp.Aspects Namespace


MethodLevelAspect Methods

The MethodLevelAspect type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Overrides AspectCompileTimeValidate(Object).)
Public method | CompileTimeValidate(MethodBase) | Method invoked at build time to ensure that the aspect has been applied to the right target.
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Inherited from Aspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | RuntimeInitialize | Initializes the current aspect.
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Overrides AspectSetAspectConfiguration(AspectConfiguration, Object).)
Protected method | SetAspectConfiguration(AspectConfiguration, MethodBase) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.
Top
See Also

Reference

MethodLevelAspect Class
PostSharp.Aspects Namespace


MethodLevelAspect.CompileTimeInitialize Method

MethodLevelAspectCompileTimeInitialize Method

Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void CompileTimeInitialize(
    MethodBase method,
    AspectInfo aspectInfo
)

Parameters

method
Type: System.ReflectionMethodBase
Method to which the current aspect is applied
aspectInfo
Type: PostSharp.AspectsAspectInfo
Reserved for future usage.

Implements

IMethodLevelAspectBuildSemanticsCompileTimeInitialize(MethodBase, AspectInfo)
See Also

Reference

MethodLevelAspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Semantic Advising of Iterator and Async Methods
Conceptual: Initializing Aspects


MethodLevelAspect.CompileTimeValidate Method

MethodLevelAspectCompileTimeValidate Method

Overload List
 | Name | Description
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Overrides AspectCompileTimeValidate(Object).)
Public method | CompileTimeValidate(MethodBase) | Method invoked at build time to ensure that the aspect has been applied to the right target.
Top
See Also

Reference

MethodLevelAspect Class
PostSharp.Aspects Namespace


MethodLevelAspect.CompileTimeValidate Method (Object)

MethodLevelAspectCompileTimeValidate Method (Object)

Method invoked at build time to ensure that the aspect has been applied to the right target.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override sealed bool CompileTimeValidate(
    Object target
)

Parameters

target
Type: SystemObject
Code element (Assembly, Type, FieldInfo, MethodBase, PropertyInfo, EventInfo, ParameterInfo, or LocationInfo) to which the aspect has been applied.

Return Value

Type: Boolean
true if the aspect was applied to an acceptable target, otherwise false.

Implements

IValidableAnnotationCompileTimeValidate(Object)
Remarks
The implementation of this method is expected to emit an error message (see MessageSource) or an exception in case of error. Returning false without emitting an error message or exception causes the aspect to be silently ignored.
See Also

Reference

MethodLevelAspect Class
CompileTimeValidate Overload
PostSharp.Aspects Namespace

Other Resources

Conceptual: Validating Aspects
Conceptual: Adding Aspects to Multiple Declarations Using Attributes
Conceptual: Understanding Attribute Multicasting


MethodLevelAspect.CompileTimeValidate Method (MethodBase)

MethodLevelAspectCompileTimeValidate Method (MethodBase)

Method invoked at build time to ensure that the aspect has been applied to the right target.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual bool CompileTimeValidate(
    MethodBase method
)

Parameters

method
Type: System.ReflectionMethodBase
Method to which the aspect has been applied

Return Value

Type: Boolean
true if the aspect was applied to an acceptable field, otherwise false.
Remarks
The implementation of this method is expected to emit an error message (see MessageSource) or an exception in case of error. Returning false without emitting an error message or exception causes the aspect to be silently ignored.
See Also

Reference

MethodLevelAspect Class
CompileTimeValidate Overload
PostSharp.Aspects Namespace

Other Resources

Conceptual: Validating Aspects
Conceptual: Testing that an Aspect has been Applied
Conceptual: Validating Aspect Usage


MethodLevelAspect.RuntimeInitialize Method

MethodLevelAspectRuntimeInitialize Method

Initializes the current aspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void RuntimeInitialize(
    MethodBase method
)

Parameters

method
Type: System.ReflectionMethodBase
Method to which the current aspect is applied.

Implements

IMethodLevelAspectRuntimeInitialize(MethodBase)
See Also

Reference

MethodLevelAspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Using a Global Composition Container
Conceptual: Initializing Aspects


MethodLevelAspect.SetAspectConfiguration Method

MethodLevelAspectSetAspectConfiguration Method

Overload List
 | Name | Description
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Overrides AspectSetAspectConfiguration(AspectConfiguration, Object).)
Protected method | SetAspectConfiguration(AspectConfiguration, MethodBase) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.
Top
See Also

Reference

MethodLevelAspect Class
PostSharp.Aspects Namespace


MethodLevelAspect.SetAspectConfiguration Method (AspectConfiguration, Object)

MethodLevelAspectSetAspectConfiguration Method (AspectConfiguration, Object)

Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override sealed void SetAspectConfiguration(
    AspectConfiguration aspectConfiguration,
    Object targetElement
)

Parameters

aspectConfiguration
Type: PostSharp.Aspects.ConfigurationAspectConfiguration
The AspectConfiguration instance previously returned by the CreateAspectConfiguration method.
targetElement
Type: SystemObject
Code element (Assembly, Type, FieldInfo, MethodBase, PropertyInfo, EventInfo, ParameterInfo, or LocationInfo) to which the current Aspect has been applied.
Remarks

Classes overriding this method must always invoke the base implementation before performing their own changes to the AspectConfiguration.

See Also

Reference

MethodLevelAspect Class
SetAspectConfiguration Overload
PostSharp.Aspects Namespace

Other Resources

Conceptual: Configuring Aspects


MethodLevelAspect.SetAspectConfiguration Method (AspectConfiguration, MethodBase)

MethodLevelAspectSetAspectConfiguration Method (AspectConfiguration, MethodBase)

Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void SetAspectConfiguration(
    AspectConfiguration aspectConfiguration,
    MethodBase targetMethod
)

Parameters

aspectConfiguration
Type: PostSharp.Aspects.ConfigurationAspectConfiguration
The AspectConfiguration instance previously returned by the CreateAspectConfiguration method.
targetMethod
Type: System.ReflectionMethodBase
Method to which the current aspect has been applied.
Remarks

Classes overriding this method must always invoke the base implementation before performing their own changes to the AspectConfiguration.

See Also

Reference

MethodLevelAspect Class
SetAspectConfiguration Overload
PostSharp.Aspects Namespace

Other Resources

Conceptual: Configuring Aspects


ModuleInitializerAttribute Class

Custom attribute that, when added to a static method, causes the method to be executed immediately after the assembly is loaded by the CLR. The target method must be public, parameterless, void, and non-generic.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.AspectsModuleInitializerAttribute

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ModuleInitializerAttribute : Attribute

The ModuleInitializerAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | ModuleInitializerAttribute | Initializes a new ModuleInitializerAttribute.
Top
Properties
 | Name | Description
Public property | Order | Gets the order in which the ModuleInitializerAttribute will be executed if the current project contains several initializers. Initializers with smaller values of the Order property get invoked first.
Top
See Also

Reference

PostSharp.Aspects Namespace

Other Resources

Conceptual: Adding Detailed Logging to your Solution
Conceptual: Executing Code Just After the Assembly is Loaded
Conceptual: What's New in PostSharp 4.2


ModuleInitializerAttribute Constructor

Initializes a new ModuleInitializerAttribute.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ModuleInitializerAttribute(
    int order
)

Parameters

order
Type: SystemInt32
Order in which the ModuleInitializerAttribute will be executed if the current project contains several initializers. Initializers with smaller values of the order parameter get invoked first.
See Also

Reference

ModuleInitializerAttribute Class
PostSharp.Aspects Namespace


ModuleInitializerAttribute Properties

The ModuleInitializerAttribute type exposes the following members.

Properties
 | Name | Description
Public property | Order | Gets the order in which the ModuleInitializerAttribute will be executed if the current project contains several initializers. Initializers with smaller values of the Order property get invoked first.
Top
See Also

Reference

ModuleInitializerAttribute Class
PostSharp.Aspects Namespace


ModuleInitializerAttribute.Order Property

ModuleInitializerAttributeOrder Property

Gets the order in which the ModuleInitializerAttribute will be executed if the current project contains several initializers. Initializers with smaller values of the Order property get invoked first.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int Order { get; }

Property Value

Type: Int32
See Also

Reference

ModuleInitializerAttribute Class
PostSharp.Aspects Namespace


NullTaskSentinel Class

The singleton instance of this class is assigned to the ReturnValue property when an OnMethodBoundaryAspect aspect is applied semantically to a method and the target method returns a null task.
Inheritance Hierarchy
SystemObject
PostSharp.AspectsNullTaskSentinel

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class NullTaskSentinel

The NullTaskSentinel type exposes the following members.

Constructors
 | Name | Description
Public method | NullTaskSentinel | Initializes a new instance of the NullTaskSentinel class
Top
Properties
Name | Description
Instance | The singleton instance that is assigned to the ReturnValue property when an OnMethodBoundaryAspect aspect is applied semantically to a method and the target method returns a null task.
Top
Remarks
When an OnMethodBoundaryAspect aspect is applied semantically to a method, then the ReturnValue property represents the result of executing the task returned by the method. If the method returns a null task, then the result is undefined. The Instance is used to represent this case.
See Also

Reference

PostSharp.Aspects Namespace


NullTaskSentinel Constructor

Initializes a new instance of the NullTaskSentinel class

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public NullTaskSentinel()
See Also

Reference

NullTaskSentinel Class
PostSharp.Aspects Namespace


NullTaskSentinel Properties

The NullTaskSentinel type exposes the following members.

Properties
Name | Description
Instance | The singleton instance that is assigned to the ReturnValue property when an OnMethodBoundaryAspect aspect is applied semantically to a method and the target method returns a null task.
Top
See Also

Reference

NullTaskSentinel Class
PostSharp.Aspects Namespace


NullTaskSentinel.Instance Property

NullTaskSentinelInstance Property

The singleton instance that is assigned to the ReturnValue property when an OnMethodBoundaryAspect aspect is applied semantically to a method and the target method returns a null task.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static NullTaskSentinel Instance { get; }

Property Value

Type: NullTaskSentinel
See Also

Reference

NullTaskSentinel Class
PostSharp.Aspects Namespace


OnExceptionAspect Class

Aspect that, when applied to a method, defines an exception handler around the whole method and calls a custom method in this exception handler.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsMethodLevelAspect
PostSharp.AspectsOnExceptionAspect

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public abstract class OnExceptionAspect : MethodLevelAspect,
    IOnExceptionAspect, IMethodLevelAspect, IAspect

The OnExceptionAspect type exposes the following members.

Constructors
 | Name | Description
Protected method | OnExceptionAspect | Initializes a new instance of the OnExceptionAspect class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | SemanticallyAdvisedMethodKinds | Determines which target methods will be advised semantically. This affects the behavior of the aspect when it's applied to iterator or async methods, which are compiled into state machines.
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target method.
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(MethodBase) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Overrides AspectCreateAspectConfiguration.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | GetExceptionType | Gets the type of exception handled by this aspect.
Public method | OnException | Method executed after the body of methods to which this aspect is applied, in case that the method resulted with an exception (i.e., in a catch block).
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from MethodLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from MethodLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, MethodBase) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Overrides MethodLevelAspectSetAspectConfiguration(AspectConfiguration, MethodBase).)
Top
Remarks

The OnExceptionAspect aspect adds an exception handler to the method to which it is applied. It allows you to easily encapsulate exception handling policies as a custom attribute.

The most important method is OnException(MethodExecutionArgs). It is the exception handler in itself.

The current exception is available from the Exception property of the MethodExecutionArgs> object. This property is read-only. If you need to replace the current exception by another one, you should throw a new exception from the handler. If you need to ignore the exception, set the FlowBehavior property to Continue.

An object of type MethodExecutionArgs is passed to every advice of this aspect. This object allows you to:

  • Get or set arguments . Input and output arguments are available on the property Arguments . You can change output ( out ) and by-reference ( ref ) arguments, but not input arguments. If you need to modify arguments passed by value, consider using a MethodInterceptionAspect . (see property );
  • Get the current exception . The current exception is available on property Exception , but from the OnException(MethodExecutionArgs) advice. You cannot replace the exception by setting this property. Throw a new exception from the aspect if you need to replace the current exception.
  • Get or set the return value . The return value is available on the ReturnValue property.
  • Change the method control flow . You can change the value of the FlowBehavior property to specify whether the target method should execute after the execution of the current advice. This may be useful to implement a caching aspect or an exception handler.
  • Share state between advices . You can use the MethodExecutionTag property to store state between the execution of different advices related to the same execution of a method. For instance, you can store a cache key in OnEntry(MethodExecutionArgs) and find it back on OnSuccess(MethodExecutionArgs) . Using MethodExecutionTag is the only way to share state that is both thread-safe and reentrant. All other implementations are buggy.

Note Note
All classes implementing IAspect should typically be marked as serializable using the SerializableAttribute or PSerializableAttribute custom attribute . Fields that are only used at runtime (and unknown at compile-time) should be carefully marked with the NonSerializedAttribute or PNonSerializedAttribute custom attribute. When PostSharp is used on a platform that does not support aspect serialization (such as .NET Compact Framework, Silverlight, or Windows Phone), or when another aspect serializer is used, it is not necessary to mark the aspect class as serializable. For more information, see Aspect Serialization .

See Also

Reference

PostSharp.Aspects Namespace
PostSharp.Aspects.ConfigurationOnExceptionAspectConfigurationAttribute

Other Resources

Conceptual: Aspect Serialization
Conceptual: Handling Exceptions
Conceptual: Semantic Advising of Iterator and Async Methods


OnExceptionAspect Constructor

Initializes a new instance of the OnExceptionAspect class

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected OnExceptionAspect()
See Also

Reference

OnExceptionAspect Class
PostSharp.Aspects Namespace


OnExceptionAspect Properties

The OnExceptionAspect type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | SemanticallyAdvisedMethodKinds | Determines which target methods will be advised semantically. This affects the behavior of the aspect when it's applied to iterator or async methods, which are compiled into state machines.
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target method.
Top
See Also

Reference

OnExceptionAspect Class
PostSharp.Aspects Namespace


OnExceptionAspect.SemanticallyAdvisedMethodKinds Property

OnExceptionAspectSemanticallyAdvisedMethodKinds Property

Determines which target methods will be advised semantically. This affects the behavior of the aspect when it's applied to iterator or async methods, which are compiled into state machines.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected SemanticallyAdvisedMethodKinds SemanticallyAdvisedMethodKinds { get; set; }

Property Value

Type: SemanticallyAdvisedMethodKinds
Remarks

Semantic advising results in an aspect that is consistent with the level of abstraction of the programming language. This is the default behavior. You can disable semantic advising using this property to be consistent with the level of abstraction of MSIL and for backward-compatibility with the versions of PostSharp prior to 3.1.

See Also

Reference

OnExceptionAspect Class
PostSharp.Aspects Namespace


OnExceptionAspect.UnsupportedTargetAction Property

OnExceptionAspectUnsupportedTargetAction Property

Specifies the action to take when the aspect is applied to an unsupported target method.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public UnsupportedTargetAction UnsupportedTargetAction { get; set; }

Property Value

Type: UnsupportedTargetAction
See Also

Reference

OnExceptionAspect Class
PostSharp.Aspects Namespace


OnExceptionAspect Methods

The OnExceptionAspect type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(MethodBase) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Overrides AspectCreateAspectConfiguration.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | GetExceptionType | Gets the type of exception handled by this aspect.
Public method | OnException | Method executed after the body of methods to which this aspect is applied, in case that the method resulted with an exception (i.e., in a catch block).
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from MethodLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from MethodLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, MethodBase) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Overrides MethodLevelAspectSetAspectConfiguration(AspectConfiguration, MethodBase).)
Top
See Also

Reference

OnExceptionAspect Class
PostSharp.Aspects Namespace


OnExceptionAspect.CreateAspectConfiguration Method

OnExceptionAspectCreateAspectConfiguration Method

Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override sealed AspectConfiguration CreateAspectConfiguration()

Return Value

Type: AspectConfiguration
A new and empty instance of AspectConfiguration, whose concrete type corresponds to the concrete type of the Aspect.
Remarks
This method should not set up the returned AspectConfiguration. After the current method has returned, the SetAspectConfiguration(AspectConfiguration, Object) method will be invoked, and this method is responsible for setting up the AspectConfigurationobject.
See Also

Reference

OnExceptionAspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Configuring Aspects


OnExceptionAspect.GetExceptionType Method

OnExceptionAspectGetExceptionType Method

Gets the type of exception handled by this aspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual Type GetExceptionType(
    MethodBase targetMethod
)

Parameters

targetMethod
Type: System.ReflectionMethodBase
Method to which the current aspect is applied.

Return Value

Type: Type
The type (derived from Exception) of exceptions handled by this aspect.
See Also

Reference

OnExceptionAspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Handling Exceptions


OnExceptionAspect.OnException Method

OnExceptionAspectOnException Method

Method executed after the body of methods to which this aspect is applied, in case that the method resulted with an exception (i.e., in a catch block).

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void OnException(
    MethodExecutionArgs args
)

Parameters

args
Type: PostSharp.AspectsMethodExecutionArgs
Advice arguments.

Implements

IOnExceptionAspectOnException(MethodExecutionArgs)
See Also

Reference

OnExceptionAspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Handling Exceptions


OnExceptionAspect.SetAspectConfiguration Method

OnExceptionAspectSetAspectConfiguration Method

Overload List
 | Name | Description
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from MethodLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, MethodBase) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Overrides MethodLevelAspectSetAspectConfiguration(AspectConfiguration, MethodBase).)
Top
See Also

Reference

OnExceptionAspect Class
PostSharp.Aspects Namespace


OnExceptionAspect.SetAspectConfiguration Method (AspectConfiguration, MethodBase)

OnExceptionAspectSetAspectConfiguration Method (AspectConfiguration, MethodBase)

Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void SetAspectConfiguration(
    AspectConfiguration aspectConfiguration,
    MethodBase targetMethod
)

Parameters

aspectConfiguration
Type: PostSharp.Aspects.ConfigurationAspectConfiguration
The AspectConfiguration instance previously returned by the CreateAspectConfiguration method.
targetMethod
Type: System.ReflectionMethodBase
Method to which the current aspect has been applied.
Remarks

Classes overriding this method must always invoke the base implementation before performing their own changes to the AspectConfiguration.

See Also

Reference

OnExceptionAspect Class
SetAspectConfiguration Overload
PostSharp.Aspects Namespace

Other Resources

Conceptual: Configuring Aspects


OnMethodBoundaryAspect Class

Aspect that, when applied to a method defined in the current assembly, inserts a piece of code before and after the body of these methods.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsMethodLevelAspect
PostSharp.AspectsOnMethodBoundaryAspect

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public abstract class OnMethodBoundaryAspect : MethodLevelAspect,
    IOnStateMachineBoundaryAspect, IOnMethodBoundaryAspect, IMethodLevelAspect, IAspect

The OnMethodBoundaryAspect type exposes the following members.

Constructors
 | Name | Description
Protected method | OnMethodBoundaryAspect | Initializes a new instance of the OnMethodBoundaryAspect class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | SemanticallyAdvisedMethodKinds | Determines which target methods will be advised semantically. This affects the behavior of the aspect when it's applied to iterator or async methods, which are compiled into state machines.
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target method.
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(MethodBase) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Overrides AspectCreateAspectConfiguration.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnEntry | Method executed before the body of methods to which this aspect is applied.
Public method | OnException | Method executed after the body of methods to which this aspect is applied, in case that the method resulted with an exception.
Public method | OnExit | Method executed after the body of methods to which this aspect is applied, even when the method exists with an exception (this method is invoked from the finally block).
Public method | OnResume | Method executed when a state machine resumes execution after an yield return or await statement.
Public method | OnSuccess | Method executed after the body of methods to which this aspect is applied, but only when the method successfully returns (i.e. when no exception flies out the method.).
Public method | OnYield | Method executed when a state machine yields, as the result of an yield return or await statement.
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from MethodLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from MethodLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, MethodBase) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Overrides MethodLevelAspectSetAspectConfiguration(AspectConfiguration, MethodBase).)
Top
Remarks

The OnMethodBoundaryAspect aspect results in the target method to be wrapped into a try ... catch ... finally block. You can implement four advices: OnEntry(MethodExecutionArgs), executed at the beginning of the block; OnSuccess(MethodExecutionArgs), executed only when the method is successful (i.e. does not result in an exception); OnException(MethodExecutionArgs), invoked when the method results in an exception; and OnExit(MethodExecutionArgs), always executed after method execution (whether the method resulted in an exception or not).

Schematically, the aspect transforms the original method as follows:

C#
Copy
int MyMethod(object arg0, int arg1)
{
   OnEntry();
   try
   {
    // Original method body.
    OnSuccess();
    return returnValue;
  }
  catch ( Exception e )
  {
    OnException();
  }
  finally
  {
    OnExit();
  }
}

Note that this code is only schematic; actually generated instructions are more complex because they have to cope with parameter boxing and control flow modification, among others.

An object of type MethodExecutionArgs is passed to every advice of this aspect. This object allows you to:

  • Get or set arguments . Input and output arguments are available on the property Arguments . You can change output ( out ) and by-reference ( ref ) arguments, but not input arguments. If you need to modify arguments passed by value, consider using a MethodInterceptionAspect . (see property );
  • Get the current exception . The current exception is available on property Exception , but from the OnException(MethodExecutionArgs) advice. You cannot replace the exception by setting this property. Throw a new exception from the aspect if you need to replace the current exception.
  • Get or set the return value . The return value is available on the ReturnValue property.
  • Change the method control flow . You can change the value of the FlowBehavior property to specify whether the target method should execute after the execution of the current advice. This may be useful to implement a caching aspect or an exception handler.
  • Share state between advices . You can use the MethodExecutionTag property to store state between the execution of different advices related to the same execution of a method. For instance, you can store a cache key in OnEntry(MethodExecutionArgs) and find it back on OnSuccess(MethodExecutionArgs) . Using MethodExecutionTag is the only way to share state that is both thread-safe and reentrant. All other implementations are buggy.

Note Note
All classes implementing IAspect should typically be marked as serializable using the SerializableAttribute or PSerializableAttribute custom attribute . Fields that are only used at runtime (and unknown at compile-time) should be carefully marked with the NonSerializedAttribute or PNonSerializedAttribute custom attribute. When PostSharp is used on a platform that does not support aspect serialization (such as .NET Compact Framework, Silverlight, or Windows Phone), or when another aspect serializer is used, it is not necessary to mark the aspect class as serializable. For more information, see Aspect Serialization .

See Also

Reference

PostSharp.Aspects Namespace

Other Resources

Conceptual: Aspect Serialization
Conceptual: Adding Behaviors to Existing Members
Conceptual: Breaking Changes in PostSharp 5.0
Conceptual: Customizing Aspect Description in Tooltips
Conceptual: Developing Composite Aspects
Conceptual: Estimating Code Savings
Conceptual: Injecting Behaviors Before and After Method Execution
Conceptual: Semantic Advising of Iterator and Async Methods
Conceptual: Understanding Aspect Serialization
Conceptual: Validating Aspect Usage
Conceptual: What's New in PostSharp 3.1
Conceptual: What's New in PostSharp 4.2
Conceptual: What's New in PostSharp 5.0


OnMethodBoundaryAspect Constructor

Initializes a new instance of the OnMethodBoundaryAspect class

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected OnMethodBoundaryAspect()
See Also

Reference

OnMethodBoundaryAspect Class
PostSharp.Aspects Namespace


OnMethodBoundaryAspect Properties

The OnMethodBoundaryAspect type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | SemanticallyAdvisedMethodKinds | Determines which target methods will be advised semantically. This affects the behavior of the aspect when it's applied to iterator or async methods, which are compiled into state machines.
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target method.
Top
See Also

Reference

OnMethodBoundaryAspect Class
PostSharp.Aspects Namespace


OnMethodBoundaryAspect.SemanticallyAdvisedMethodKinds Property

OnMethodBoundaryAspectSemanticallyAdvisedMethodKinds Property

Determines which target methods will be advised semantically. This affects the behavior of the aspect when it's applied to iterator or async methods, which are compiled into state machines.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected SemanticallyAdvisedMethodKinds SemanticallyAdvisedMethodKinds { get; set; }

Property Value

Type: SemanticallyAdvisedMethodKinds
Remarks

Semantic advising results in an aspect that is consistent with the level of abstraction of the programming language. This is the default behavior. You can disable semantic advising using this property to be consistent with the level of abstraction of MSIL and for backward-compatibility with the versions of PostSharp prior to 3.1.

See Also

Reference

OnMethodBoundaryAspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Semantic Advising of Iterator and Async Methods


OnMethodBoundaryAspect.UnsupportedTargetAction Property

OnMethodBoundaryAspectUnsupportedTargetAction Property

Specifies the action to take when the aspect is applied to an unsupported target method.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public UnsupportedTargetAction UnsupportedTargetAction { get; set; }

Property Value

Type: UnsupportedTargetAction
See Also

Reference

OnMethodBoundaryAspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Semantic Advising of Iterator and Async Methods


OnMethodBoundaryAspect Methods

The OnMethodBoundaryAspect type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(MethodBase) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Overrides AspectCreateAspectConfiguration.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnEntry | Method executed before the body of methods to which this aspect is applied.
Public method | OnException | Method executed after the body of methods to which this aspect is applied, in case that the method resulted with an exception.
Public method | OnExit | Method executed after the body of methods to which this aspect is applied, even when the method exists with an exception (this method is invoked from the finally block).
Public method | OnResume | Method executed when a state machine resumes execution after an yield return or await statement.
Public method | OnSuccess | Method executed after the body of methods to which this aspect is applied, but only when the method successfully returns (i.e. when no exception flies out the method.).
Public method | OnYield | Method executed when a state machine yields, as the result of an yield return or await statement.
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from MethodLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from MethodLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, MethodBase) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Overrides MethodLevelAspectSetAspectConfiguration(AspectConfiguration, MethodBase).)
Top
See Also

Reference

OnMethodBoundaryAspect Class
PostSharp.Aspects Namespace


OnMethodBoundaryAspect.CreateAspectConfiguration Method

OnMethodBoundaryAspectCreateAspectConfiguration Method

Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override sealed AspectConfiguration CreateAspectConfiguration()

Return Value

Type: AspectConfiguration
A new and empty instance of AspectConfiguration, whose concrete type corresponds to the concrete type of the Aspect.
Remarks
This method should not set up the returned AspectConfiguration. After the current method has returned, the SetAspectConfiguration(AspectConfiguration, Object) method will be invoked, and this method is responsible for setting up the AspectConfigurationobject.
See Also

Reference

OnMethodBoundaryAspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Configuring Aspects


OnMethodBoundaryAspect.OnEntry Method

OnMethodBoundaryAspectOnEntry Method

Method executed before the body of methods to which this aspect is applied.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void OnEntry(
    MethodExecutionArgs args
)

Parameters

args
Type: PostSharp.AspectsMethodExecutionArgs
Event arguments specifying which method is being executed, which are its arguments, and how should the execution continue after the execution of OnEntry(MethodExecutionArgs).

Implements

IOnMethodBoundaryAspectOnEntry(MethodExecutionArgs)
Remarks
If the aspect is applied to a constructor, the current method is invoked after the this pointer has been initialized, that is, after the base constructor has been called.
See Also

Reference

OnMethodBoundaryAspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Adding Behaviors to Existing Members
Conceptual: Customizing Aspect Description in Tooltips
Conceptual: Estimating Code Savings
Conceptual: Injecting Behaviors Before and After Method Execution
Conceptual: Semantic Advising of Iterator and Async Methods
Conceptual: Understanding Aspect Lifetime and Scope


OnMethodBoundaryAspect.OnException Method

OnMethodBoundaryAspectOnException Method

Method executed after the body of methods to which this aspect is applied, in case that the method resulted with an exception.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void OnException(
    MethodExecutionArgs args
)

Parameters

args
Type: PostSharp.AspectsMethodExecutionArgs
Event arguments specifying which method is being executed and which are its arguments.

Implements

IOnMethodBoundaryAspectOnException(MethodExecutionArgs)
See Also

Reference

OnMethodBoundaryAspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Injecting Behaviors Before and After Method Execution


OnMethodBoundaryAspect.OnExit Method

OnMethodBoundaryAspectOnExit Method

Method executed after the body of methods to which this aspect is applied, even when the method exists with an exception (this method is invoked from the finally block).

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void OnExit(
    MethodExecutionArgs args
)

Parameters

args
Type: PostSharp.AspectsMethodExecutionArgs
Event arguments specifying which method is being executed and which are its arguments.

Implements

IOnMethodBoundaryAspectOnExit(MethodExecutionArgs)
See Also

Reference

OnMethodBoundaryAspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Injecting Behaviors Before and After Method Execution
Conceptual: Semantic Advising of Iterator and Async Methods


OnMethodBoundaryAspect.OnResume Method

OnMethodBoundaryAspectOnResume Method

Method executed when a state machine resumes execution after an yield return or await statement.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void OnResume(
    MethodExecutionArgs args
)

Parameters

args
Type: PostSharp.AspectsMethodExecutionArgs
Event arguments specifying which method is being executed and which are its arguments.

Implements

IOnStateMachineBoundaryAspectOnResume(MethodExecutionArgs)
Remarks

For iterator methods, this advice is executed before the MoveNext method. However, the very first call of MoveNext maps to OnEntry(MethodExecutionArgs).

In async methods, the advice is executed just after the state machine restarts execution after having waited as a result of the await statement.

See Also

Reference

OnMethodBoundaryAspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Injecting Behaviors Before and After Method Execution
Conceptual: Semantic Advising of Iterator and Async Methods


OnMethodBoundaryAspect.OnSuccess Method

OnMethodBoundaryAspectOnSuccess Method

Method executed after the body of methods to which this aspect is applied, but only when the method successfully returns (i.e. when no exception flies out the method.).

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void OnSuccess(
    MethodExecutionArgs args
)

Parameters

args
Type: PostSharp.AspectsMethodExecutionArgs
Event arguments specifying which method is being executed and which are its arguments.

Implements

IOnMethodBoundaryAspectOnSuccess(MethodExecutionArgs)
See Also

Reference

OnMethodBoundaryAspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Injecting Behaviors Before and After Method Execution
Conceptual: Semantic Advising of Iterator and Async Methods


OnMethodBoundaryAspect.OnYield Method

OnMethodBoundaryAspectOnYield Method

Method executed when a state machine yields, as the result of an yield return or await statement.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void OnYield(
    MethodExecutionArgs args
)

Parameters

args
Type: PostSharp.AspectsMethodExecutionArgs
Event arguments specifying which method is being executed and which are its arguments. In iterator methods, the YieldValue property gives access to the operand of the yield return statement.

Implements

IOnStateMachineBoundaryAspectOnYield(MethodExecutionArgs)
Remarks

In iterator methods, this advise is exactly executed at the yield return statement.

In async methods, the advice is executed just after the state machine starts waiting as a result of the await statement. In case the operand of the await statement is an operation that completed synchronously, the state machine does not yield, and the OnYield(MethodExecutionArgs) advise won't be invoked.

See Also

Reference

OnMethodBoundaryAspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Injecting Behaviors Before and After Method Execution
Conceptual: Semantic Advising of Iterator and Async Methods


OnMethodBoundaryAspect.SetAspectConfiguration Method

OnMethodBoundaryAspectSetAspectConfiguration Method

Overload List
 | Name | Description
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from MethodLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, MethodBase) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Overrides MethodLevelAspectSetAspectConfiguration(AspectConfiguration, MethodBase).)
Top
See Also

Reference

OnMethodBoundaryAspect Class
PostSharp.Aspects Namespace


OnMethodBoundaryAspect.SetAspectConfiguration Method (AspectConfiguration, MethodBase)

OnMethodBoundaryAspectSetAspectConfiguration Method (AspectConfiguration, MethodBase)

Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void SetAspectConfiguration(
    AspectConfiguration aspectConfiguration,
    MethodBase targetMethod
)

Parameters

aspectConfiguration
Type: PostSharp.Aspects.ConfigurationAspectConfiguration
The AspectConfiguration instance previously returned by the CreateAspectConfiguration method.
targetMethod
Type: System.ReflectionMethodBase
Method to which the current aspect has been applied.
Remarks

Classes overriding this method must always invoke the base implementation before performing their own changes to the AspectConfiguration.

See Also

Reference

OnMethodBoundaryAspect Class
SetAspectConfiguration Overload
PostSharp.Aspects Namespace

Other Resources

Conceptual: Configuring Aspects


SemanticallyAdvisedMethodKinds Enumeration

Enumerates possible target methods for semantic advising.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[FlagsAttribute]
public enum SemanticallyAdvisedMethodKinds
Members
Member name | Value | Description
None | 0 | Do not use semantic advising.
Async | 1 | Apply semantic advising to async methods.
ReturnsAwaitable | 2 | Apply semantic advising to methods that return any awaitable type (e.g. System.Threading.Tasks.Task).
Iterator | 4 | Apply semantic advising to iterator methods (methods that use yield statements).
ReturnsEnumerable | 8 | Apply semantic advising to methods that return IEnumerable, IEnumerator, IEnumerableT, IEnumeratorT.
Default | 7 | The default behavior includes Async, ReturnsAwaitable, Iterator.
All | 15 | Apply semantic advising to all possible target methods.
Remarks
When semantic advising is enabled the advices work at the abstraction level of the original programming language. For example, advices are applied to the underlying async state machine instead of the public async method the starts the state machine.
See Also

Reference

PostSharp.Aspects Namespace

Other Resources

Conceptual: Semantic Advising of Iterator and Async Methods


TypeIdentity Class

Wraps a Type or a type name.
Inheritance Hierarchy
SystemObject
PostSharp.AspectsTypeIdentity

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class TypeIdentity

The TypeIdentity type exposes the following members.

Properties
 | Name | Description
Public property | Type | Gets the wrapped Type, or null it the TypeName property is set.
Public property | TypeName | Gets the wrapped type name, or null it the Type property is set.
Top
Methods
 | Name | Description
 | FromType | Wraps a Type into a TypeIdentity.
 | FromTypeName | Wraps a type name into a TypeIdentity.
 | FromTypeNames | Wraps an array of type names into an array of TypeIdentity.
 | FromTypes | Wraps an array of Type into an array of TypeIdentity.
Public method | ToType | Converts a TypeIdentity into a Type.
Top
See Also

Reference

PostSharp.Aspects Namespace


TypeIdentity Properties

The TypeIdentity type exposes the following members.

Properties
 | Name | Description
Public property | Type | Gets the wrapped Type, or null it the TypeName property is set.
Public property | TypeName | Gets the wrapped type name, or null it the Type property is set.
Top
See Also

Reference

TypeIdentity Class
PostSharp.Aspects Namespace


TypeIdentity.Type Property

TypeIdentityType Property

Gets the wrapped Type, or null it the TypeName property is set.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Type Type { get; }

Property Value

Type: Type
See Also

Reference

TypeIdentity Class
PostSharp.Aspects Namespace


TypeIdentity.TypeName Property

TypeIdentityTypeName Property

Gets the wrapped type name, or null it the Type property is set.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string TypeName { get; }

Property Value

Type: String
See Also

Reference

TypeIdentity Class
PostSharp.Aspects Namespace


TypeIdentity Methods

The TypeIdentity type exposes the following members.

Methods
 | Name | Description
 | FromType | Wraps a Type into a TypeIdentity.
 | FromTypeName | Wraps a type name into a TypeIdentity.
 | FromTypeNames | Wraps an array of type names into an array of TypeIdentity.
 | FromTypes | Wraps an array of Type into an array of TypeIdentity.
Public method | ToType | Converts a TypeIdentity into a Type.
Top
See Also

Reference

TypeIdentity Class
PostSharp.Aspects Namespace


TypeIdentity.FromType Method

TypeIdentityFromType Method

Wraps a Type into a TypeIdentity.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static TypeIdentity FromType(
    Type type
)

Parameters

type
Type: SystemType
A Type.

Return Value

Type: TypeIdentity
A TypeIdentity wrapping .
See Also

Reference

TypeIdentity Class
PostSharp.Aspects Namespace


TypeIdentity.FromTypeName Method

TypeIdentityFromTypeName Method

Wraps a type name into a TypeIdentity.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static TypeIdentity FromTypeName(
    string typeName
)

Parameters

typeName
Type: SystemString
The type name.

Return Value

Type: TypeIdentity
A TypeIdentity wrapping the type name.
See Also

Reference

TypeIdentity Class
PostSharp.Aspects Namespace


TypeIdentity.FromTypeNames Method

TypeIdentityFromTypeNames Method

Wraps an array of type names into an array of TypeIdentity.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static TypeIdentity[] FromTypeNames(
    string[] typeNames
)

Parameters

typeNames
Type: SystemString
An array of type names.

Return Value

Type: TypeIdentity
An array of TypeIdentity wrapping typeNames.
See Also

Reference

TypeIdentity Class
PostSharp.Aspects Namespace


TypeIdentity.FromTypes Method

TypeIdentityFromTypes Method

Wraps an array of Type into an array of TypeIdentity.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static TypeIdentity[] FromTypes(
    Type[] types
)

Parameters

types
Type: SystemType
An array of Type.

Return Value

Type: TypeIdentity
An array of TypeIdentity wrapping types.
See Also

Reference

TypeIdentity Class
PostSharp.Aspects Namespace


TypeIdentity.ToType Method

TypeIdentityToType Method

Converts a TypeIdentity into a Type.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Type ToType()

Return Value

Type: Type
See Also

Reference

TypeIdentity Class
PostSharp.Aspects Namespace


TypeLevelAspect Class

Base class for all aspects applied on types.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsTypeLevelAspect
PostSharp.AspectsCompositionAspect
PostSharp.AspectsInstanceLevelAspect

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public abstract class TypeLevelAspect : Aspect,
    ITypeLevelAspect, IAspect, ITypeLevelAspectBuildSemantics, IAspectBuildSemantics, IValidableAnnotation

The TypeLevelAspect type exposes the following members.

Constructors
 | Name | Description
Protected method | TypeLevelAspect | Initializes a new instance of the TypeLevelAspect class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Overrides AspectCompileTimeValidate(Object).)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target.
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Inherited from Aspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | RuntimeInitialize | Initializes the current aspect.
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Overrides AspectSetAspectConfiguration(AspectConfiguration, Object).)
Protected method | SetAspectConfiguration(AspectConfiguration, Type) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.
Top
Remarks
Note Note
This class does not provide any advice. You may derive your aspect class from a class providing predefined advice , or build a composite aspect .

Note Note
All classes implementing IAspect should typically be marked as serializable using the SerializableAttribute or PSerializableAttribute custom attribute . Fields that are only used at runtime (and unknown at compile-time) should be carefully marked with the NonSerializedAttribute or PNonSerializedAttribute custom attribute. When PostSharp is used on a platform that does not support aspect serialization (such as .NET Compact Framework, Silverlight, or Windows Phone), or when another aspect serializer is used, it is not necessary to mark the aspect class as serializable. For more information, see Aspect Serialization .

See Also

Reference

PostSharp.Aspects Namespace
PostSharp.AspectsITypeLevelAspect

Other Resources

Conceptual: Aspect Classes
Conceptual: Developing Complex Aspects
Conceptual: Aspect Serialization
Conceptual: Adding Aspects to Derived Classes and Methods Using Attributes
Conceptual: Adding Behaviors to Existing Members
Conceptual: Developing Composite Aspects
Conceptual: Introducing Custom Attributes


TypeLevelAspect Constructor

Initializes a new instance of the TypeLevelAspect class

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected TypeLevelAspect()
See Also

Reference

TypeLevelAspect Class
PostSharp.Aspects Namespace


TypeLevelAspect Properties

The TypeLevelAspect type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

TypeLevelAspect Class
PostSharp.Aspects Namespace


TypeLevelAspect Methods

The TypeLevelAspect type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Overrides AspectCompileTimeValidate(Object).)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target.
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Inherited from Aspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | RuntimeInitialize | Initializes the current aspect.
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Overrides AspectSetAspectConfiguration(AspectConfiguration, Object).)
Protected method | SetAspectConfiguration(AspectConfiguration, Type) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.
Top
See Also

Reference

TypeLevelAspect Class
PostSharp.Aspects Namespace


TypeLevelAspect.CompileTimeInitialize Method

TypeLevelAspectCompileTimeInitialize Method

Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void CompileTimeInitialize(
    Type type,
    AspectInfo aspectInfo
)

Parameters

type
Type: SystemType
Type to which the current aspect is applied
aspectInfo
Type: PostSharp.AspectsAspectInfo
Reserved for future usage.

Implements

ITypeLevelAspectBuildSemanticsCompileTimeInitialize(Type, AspectInfo)
See Also

Reference

TypeLevelAspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Initializing Aspects


TypeLevelAspect.CompileTimeValidate Method

TypeLevelAspectCompileTimeValidate Method

Overload List
 | Name | Description
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Overrides AspectCompileTimeValidate(Object).)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target.
Top
See Also

Reference

TypeLevelAspect Class
PostSharp.Aspects Namespace


TypeLevelAspect.CompileTimeValidate Method (Object)

TypeLevelAspectCompileTimeValidate Method (Object)

Method invoked at build time to ensure that the aspect has been applied to the right target.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override sealed bool CompileTimeValidate(
    Object target
)

Parameters

target
Type: SystemObject
Code element (Assembly, Type, FieldInfo, MethodBase, PropertyInfo, EventInfo, ParameterInfo, or LocationInfo) to which the aspect has been applied.

Return Value

Type: Boolean
true if the aspect was applied to an acceptable target, otherwise false.

Implements

IValidableAnnotationCompileTimeValidate(Object)
Remarks
The implementation of this method is expected to emit an error message (see MessageSource) or an exception in case of error. Returning false without emitting an error message or exception causes the aspect to be silently ignored.
See Also

Reference

TypeLevelAspect Class
CompileTimeValidate Overload
PostSharp.Aspects Namespace

Other Resources

Conceptual: Validating Aspects
Conceptual: Adding Aspects to Multiple Declarations Using Attributes
Conceptual: Understanding Attribute Multicasting


TypeLevelAspect.CompileTimeValidate Method (Type)

TypeLevelAspectCompileTimeValidate Method (Type)

Method invoked at build time to ensure that the aspect has been applied to the right target.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual bool CompileTimeValidate(
    Type type
)

Parameters

type
Type: SystemType
Type to which the aspect has been applied

Return Value

Type: Boolean
true if the aspect was applied to an acceptable field, otherwise false.
Remarks
The implementation of this method is expected to emit an error message (see MessageSource) or an exception in case of error. Returning false without emitting an error message or exception causes the aspect to be silently ignored.
See Also

Reference

TypeLevelAspect Class
CompileTimeValidate Overload
PostSharp.Aspects Namespace

Other Resources

Conceptual: Validating Aspects
Conceptual: Validating Aspect Usage


TypeLevelAspect.RuntimeInitialize Method

TypeLevelAspectRuntimeInitialize Method

Initializes the current aspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void RuntimeInitialize(
    Type type
)

Parameters

type
Type: SystemType
Type to which the current aspect is applied.

Implements

ITypeLevelAspectRuntimeInitialize(Type)
See Also

Reference

TypeLevelAspect Class
PostSharp.Aspects Namespace

Other Resources

Conceptual: Initializing Aspects


TypeLevelAspect.SetAspectConfiguration Method

TypeLevelAspectSetAspectConfiguration Method

Overload List
 | Name | Description
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Overrides AspectSetAspectConfiguration(AspectConfiguration, Object).)
Protected method | SetAspectConfiguration(AspectConfiguration, Type) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.
Top
See Also

Reference

TypeLevelAspect Class
PostSharp.Aspects Namespace


TypeLevelAspect.SetAspectConfiguration Method (AspectConfiguration, Object)

TypeLevelAspectSetAspectConfiguration Method (AspectConfiguration, Object)

Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override sealed void SetAspectConfiguration(
    AspectConfiguration aspectConfiguration,
    Object targetElement
)

Parameters

aspectConfiguration
Type: PostSharp.Aspects.ConfigurationAspectConfiguration
The AspectConfiguration instance previously returned by the CreateAspectConfiguration method.
targetElement
Type: SystemObject
Code element (Assembly, Type, FieldInfo, MethodBase, PropertyInfo, EventInfo, ParameterInfo, or LocationInfo) to which the current Aspect has been applied.
Remarks

Classes overriding this method must always invoke the base implementation before performing their own changes to the AspectConfiguration.

See Also

Reference

TypeLevelAspect Class
SetAspectConfiguration Overload
PostSharp.Aspects Namespace

Other Resources

Conceptual: Configuring Aspects


TypeLevelAspect.SetAspectConfiguration Method (AspectConfiguration, Type)

TypeLevelAspectSetAspectConfiguration Method (AspectConfiguration, Type)

Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void SetAspectConfiguration(
    AspectConfiguration aspectConfiguration,
    Type targetType
)

Parameters

aspectConfiguration
Type: PostSharp.Aspects.ConfigurationAspectConfiguration
The AspectConfiguration instance previously returned by the CreateAspectConfiguration method.
targetType
Type: SystemType
Type to which the current aspect has been applied.
Remarks

Classes overriding this method must always invoke the base implementation before performing their own changes to the AspectConfiguration.

See Also

Reference

TypeLevelAspect Class
SetAspectConfiguration Overload
PostSharp.Aspects Namespace

Other Resources

Conceptual: Configuring Aspects


UnsupportedTargetAction Enumeration

Enumerates actions that can be taken when an aspect is applied to a target element that is not currently supported.

Namespace: PostSharp.Aspects
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum UnsupportedTargetAction
Members
Member name | Value | Description
Default | 0 | Fail
Fail | 0 | Emit a build-time error when the target declaration is not supported by the aspect. This is the default behavior.
Ignore | 1 | Do not apply the advise when the target declaration is not supported but do not emit a build error.
Fallback | 2 | Fall back to a supported advising strategy if any is available, e.g. from semantic advising (taking into account async semantics) to non-semantic advising.
See Also

Reference

PostSharp.Aspects Namespace


PostSharp.Aspects.Advices Namespace

The PostSharp.Aspects.Advices provides custom attributes that allow developing composite aspects with advices and pointcuts.
Classes
 | Class | Description
Public class | Advice | Base class for all custom attributes representing an advice.
Public class | AdviceInstance | Base class for advice instances, which can be provided dynamically by the aspect thanks to the IAdviceProvider interface.
Public class | CopyCustomAttributesAttribute | Custom attribute that, when applied on an aspect class, requires custom attributes present on the aspect class to be copied to the target of this class. When applied on an introduced member (see IntroduceMemberAttribute), this custom attribute requires custom attributes present on the aspect member to be copied to the introduced member.
Public class | EventTDelegate | Exposes the semantics of an event for use with the ImportMemberAttribute aspect extension.
Public class | GroupingAdvice | Base class for all advices that are possibly composed of multiple advices that can be grouped together using the Master property.
Public class | ImportLocationAdviceInstance | Represents an advice that imports a field or property (represented by a LocationInfo) of the target class into a field of the aspect class. This class is the imperative equivalent of the ImportMemberAttribute declarative advise.
Public class | ImportMemberAdviceInstance | Base class for ImportLocationAdviceInstance and ImportMethodAdviceInstance.
Public class | ImportMemberAttribute | Custom attribute that, when applied to an instance field of an aspect class, determines that this field should be bound to a method, event or property, of the target class of this aspect. Valid types for fields are a concrete Delegate (to bind to a method), PropertyTValue or PropertyTValue, TIndex (to bind to a property), or EventTDelegate (to bind to an event).
Public class | ImportMethodAdviceInstance | Represents an advises that import a method of the target class into the aspect class.
Public class | InitializeAspectInstanceAdvice | Custom attribute that, when applied to a method of an aspect class, specifies that this method should be invoked whenever the aspect instance needs to be initialized. The target method must have a void return value and have a single parameter of type AspectInitializationReason. This method is equivalent to RuntimeInitializeInstance
Public class | IntroduceInterfaceAdviceInstance | Represents an advise that introduces an interface into the target class. The interface must be implemented by the aspect class.
Public class | IntroduceInterfaceAttribute | Custom attribute that, when applied to an aspect class, specifies that the aspect should introduce a given interface into the type to which the aspect is applied.
Public class | IntroduceMemberAdviceInstance | Base class for IntroduceMethodAdviceInstance.
Public class | IntroduceMemberAttribute | Custom attribute that, when applied on a method, event or property of an aspect class, specifies that this method, event or property should be introduced into the types to which the aspect is applied.
Public class | IntroduceMethodAdviceInstance | Represents an advice that introduces a method of the aspect class into the target class.
Public class | LocationValidationAdvice | Custom attribute that, when applied on a method of an aspect class, specifies that this method has the same semantic as the ValidateValue(T, String, LocationKind, LocationValidationContext) method of the ILocationValidationAspectT interface.
Public class | MethodPointcut | Custom attribute that, when applied on an advice method, specifies the name of the method that will be invoked at build-time to return the set of elements of code to which the advice applies.
Public class | MulticastPointcut | Custom attribute that, when applied on an advice method, specifies to which elements of code this advice applies, based on the kind, name and attributes of code elements. Works similarly as MulticastAttribute.
Public class | OnAspectsInitializedAdvice | Custom attribute that, when applied to a method of an aspect class, specifies that this method should be invoked after the instances of all the aspects applied on the same target has been initialized. The target method must have a void return value and have a single parameter of type AspectInitializationReason.
Public class | OnEventAddHandlerAdvice | Custom attribute that, when applied on a method of an aspect class, specifies that this method is an advice having the same semantics as OnAddHandler(EventInterceptionArgs).
Public class | OnEventInvokeHandlerAdvice | Custom attribute that, when applied on a method of an aspect class, specifies that this method is an advice having the same semantics as OnInvokeHandler(EventInterceptionArgs).
Public class | OnEventRemoveHandlerAdvice | Custom attribute that, when applied on a method of an aspect class, specifies that this method is an advice having the same semantics as OnRemoveHandler(EventInterceptionArgs).
Public class | OnInstanceConstructedAdvice | Custom attribute that, when applied to a method of an aspect implementing , specifies that this method should be executed after the last instance constructor of the target class of the aspect has completed execution. That is, this method will be invoked when the target object will be fully constructed. This custom attribute can be applied only on methods that have void return type and accepts no parameter.
Public class | OnLocationGetValueAdvice | Custom attribute that, when applied on a method of an aspect class, specifies that this method is an advice having the same semantics as OnGetValue(LocationInterceptionArgs).
Public class | OnLocationSetValueAdvice | Custom attribute that, when applied on a method of an aspect class, specifies that this method is an advice having the same semantics as OnSetValue(LocationInterceptionArgs).
Public class | OnMethodBoundaryAdvice | Base class for OnMethodEntryAdvice, OnMethodExceptionAdvice, OnMethodSuccessAdvice or OnMethodExitAdvice.
Public class | OnMethodEntryAdvice | Custom attribute that, when applied on a method of an aspect class, specifies that this method is an advice having the same semantics as OnEntry(MethodExecutionArgs).
Public class | OnMethodExceptionAdvice | Custom attribute that, when applied on a method of an aspect class, specifies that this method is an advice having the same semantics as OnException(MethodExecutionArgs).
Public class | OnMethodExitAdvice | Custom attribute that, when applied on a method of an aspect class, specifies that this method is an advice having the same semantics as OnExit(MethodExecutionArgs).
Public class | OnMethodInvokeAdvice | Custom attribute that, when applied on a method of an aspect class, specifies that this method is an advice having the same semantics as OnInvoke(MethodInterceptionArgs).
Public class | OnMethodInvokeAsyncAdvice | Custom attribute that, when applied on a method of an aspect class, specifies that this method is an advice having the same semantics as OnInvokeAsync(MethodInterceptionArgs).
Public class | OnMethodInvokeBaseAdvice | The base class for method interception advices.
Public class | OnMethodResumeAdvice | Custom attribute that, when applied on a method of an aspect class, specifies that this method is an advice having the same semantics as OnResume(MethodExecutionArgs).
Public class | OnMethodSuccessAdvice | Custom attribute that, when applied on a method of an aspect class, specifies that this method is an advice having the same semantics as OnSuccess(MethodExecutionArgs).
Public class | OnMethodYieldAdvice | Custom attribute that, when applied on a method of an aspect class, specifies that this method is an advice having the same semantics as OnYield(MethodExecutionArgs).
Public class | Pointcut | Custom attribute, typically accompanying an advice, specifying to which code elements the advice applies.
Public class | PropertyTValue | Exposes the semantics of a parameterless property for use with the ImportMemberAttribute aspect extension.
Public class | PropertyTValue, TIndex | Mimics the semantics of a property accepting a single index parameter, for use with the ImportMemberAttribute aspect extension.
Public class | SelfPointcut | Pointcut that selects exactly the aspect target.
Public class | SignaturePointcut | A Pointcut that matches target methods by name and signature. This works only with non-generic methods.
Interfaces
 | Interface | Description
Public interface | IAdviceProvider | Interface that allows an aspect to provide aspects dynamically, instead of declaratively using custom attributes.
Public interface | IProperty | A weakly-typed interface for the class.
Delegates
 | Delegate | Description
Public delegate | EventAccessorTDelegate | Defines the signature of methods implementing the Add and Remove semantics of an event.
Public delegate | PropertyGetterTValue | Defines the signature of methods implementing the Get semantic of a parameterless property.
Public delegate | PropertyGetterTValue, TIndex | Defines the signature of methods implementing the Get semantic of a property with a single index parameter.
Public delegate | PropertySetterTValue | Defines the signature of methods implementing the Set semantic of a parameterless property.
Public delegate | PropertySetterTValue, TIndex | Defines the signature of methods implementing the Set semantic of a property with a single index parameter.
Enumerations
 | Enumeration | Description
Public enumeration | AspectInitializationReason | Enumerates the reasons why the target method of the InitializeAspectInstanceAdvice has been invoked.
Public enumeration | CustomAttributeOverrideAction | Behavior of CopyCustomAttributesAttribute when a custom attribute of the same type already exists on the target declaration.
Public enumeration | ImportMemberOrder | Enumeration of moments when members should be imported into an aspect.
Public enumeration | InterfaceOverrideAction | Enumeration of actions to be overtaken when an interface that should be introduced into a type is already implemented by that type.
Public enumeration | MemberOverrideAction | Enumeration of actions to be overtaken by the IntroduceMemberAttribute aspect extension when the member to be introduced already exists in the aspect target type or its base type.


Advice Class

Base class for all custom attributes representing an advice.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.AdvicesAdvice
More...

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class Advice : Attribute

The Advice type exposes the following members.

Constructors
 | Name | Description
Protected method | Advice | Initializes a new instance of the Advice class
Top
Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice.
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element.
Top
Remarks

Advices are behaviors added to aspects by the way of custom attributes. Other ways to add behaviors is to implement interface methods.

Advice custom attributes are typically used on aspect classes, or on members of aspect classes.

See Also

Reference

PostSharp.Aspects.Advices Namespace

Other Resources

Conceptual: Developing Complex Aspects
Conceptual: Estimating Code Savings
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.AdvicesAdvice
PostSharp.Aspects.AdvicesCopyCustomAttributesAttribute
PostSharp.Aspects.AdvicesGroupingAdvice
PostSharp.Aspects.AdvicesImportMemberAttribute
PostSharp.Aspects.AdvicesInitializeAspectInstanceAdvice
PostSharp.Aspects.AdvicesIntroduceInterfaceAttribute
PostSharp.Aspects.AdvicesIntroduceMemberAttribute
PostSharp.Aspects.AdvicesOnAspectsInitializedAdvice
PostSharp.Aspects.AdvicesOnInstanceConstructedAdvice


Advice Constructor

Initializes a new instance of the Advice class

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected Advice()
See Also

Reference

Advice Class
PostSharp.Aspects.Advices Namespace


Advice Properties

The Advice type exposes the following members.

Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice.
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element.
Top
See Also

Reference

Advice Class
PostSharp.Aspects.Advices Namespace


Advice.Description Property

AdviceDescription Property

A human-readable description of the current advice.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string Description { get; set; }

Property Value

Type: String
Remarks
Set this property only on the master advice of the advice group.
See Also

Reference

Advice Class
PostSharp.Aspects.Advices Namespace

Other Resources

Conceptual: Customizing Aspect Description in Tooltips


Advice.LinesOfCodeAvoided Property

AdviceLinesOfCodeAvoided Property

Reduction in the code lines count achieved by applying the advice instance to one code element.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int LinesOfCodeAvoided { get; set; }

Property Value

Type: Int32
See Also

Reference

Advice Class
PostSharp.Aspects.Advices Namespace


AdviceInstance Class

Base class for advice instances, which can be provided dynamically by the aspect thanks to the IAdviceProvider interface.
Inheritance Hierarchy
SystemObject
PostSharp.Aspects.AdvicesAdviceInstance
PostSharp.Aspects.AdvicesImportMemberAdviceInstance
PostSharp.Aspects.AdvicesIntroduceInterfaceAdviceInstance
PostSharp.Aspects.AdvicesIntroduceMemberAdviceInstance

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class AdviceInstance

The AdviceInstance type exposes the following members.

Constructors
 | Name | Description
Protected method | AdviceInstance | Initializes a new instance of the AdviceInstance class
Top
Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice instance.
Public property | LinesOfCodeAvoided | The number of lines of hand-written code avoided by this specific AdviceInstance.
Public property | MasterAspectMember | Gets the main field or method of the aspect class that the current AdviceInstance relates to.
Top
Remarks

The only supported dynamic advice currently is ImportLocationAdviceInstance.

See Also

Reference

PostSharp.Aspects.Advices Namespace


AdviceInstance Constructor

Initializes a new instance of the AdviceInstance class

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected AdviceInstance()
See Also

Reference

AdviceInstance Class
PostSharp.Aspects.Advices Namespace


AdviceInstance Properties

The AdviceInstance type exposes the following members.

Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice instance.
Public property | LinesOfCodeAvoided | The number of lines of hand-written code avoided by this specific AdviceInstance.
Public property | MasterAspectMember | Gets the main field or method of the aspect class that the current AdviceInstance relates to.
Top
See Also

Reference

AdviceInstance Class
PostSharp.Aspects.Advices Namespace


AdviceInstance.Description Property

AdviceInstanceDescription Property

A human-readable description of the current advice instance.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string Description { get; set; }

Property Value

Type: String
See Also

Reference

AdviceInstance Class
PostSharp.Aspects.Advices Namespace


AdviceInstance.LinesOfCodeAvoided Property

AdviceInstanceLinesOfCodeAvoided Property

The number of lines of hand-written code avoided by this specific AdviceInstance.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int LinesOfCodeAvoided { get; set; }

Property Value

Type: Int32
See Also

Reference

AdviceInstance Class
PostSharp.Aspects.Advices Namespace


AdviceInstance.MasterAspectMember Property

AdviceInstanceMasterAspectMember Property

Gets the main field or method of the aspect class that the current AdviceInstance relates to.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract Object MasterAspectMember { get; }

Property Value

Type: Object
See Also

Reference

AdviceInstance Class
PostSharp.Aspects.Advices Namespace


AspectInitializationReason Enumeration

Enumerates the reasons why the target method of the InitializeAspectInstanceAdvice has been invoked.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum AspectInitializationReason
Members
Member name | Value | Description
None | 0 | None.
Manual | 1 | Manual call of the InitializeAspects method.
Constructor | 2 | Call from the instance constructor.
Clone | 3 | Call from MemberwiseClone.
Deserialize | 4 | Call during deserialization.
See Also

Reference

PostSharp.Aspects.Advices Namespace


CopyCustomAttributesAttribute Class

Custom attribute that, when applied on an aspect class, requires custom attributes present on the aspect class to be copied to the target of this class. When applied on an introduced member (see IntroduceMemberAttribute), this custom attribute requires custom attributes present on the aspect member to be copied to the introduced member.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.AdvicesAdvice
PostSharp.Aspects.AdvicesCopyCustomAttributesAttribute

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class CopyCustomAttributesAttribute : Advice

The CopyCustomAttributesAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | CopyCustomAttributesAttribute(Type) | Requires custom attributes present on the aspect class or aspect class member to be copied to the aspect target or to the introduced member, respectively.
Public method | CopyCustomAttributesAttribute(Type) | Requires custom attributes present on the aspect class or aspect class member to be copied to the aspect target or to the introduced member, respectively.
Top
Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | OverrideAction | Determines what should happen when a custom attribute of the same type is already present on the target declaration.
Public property | Types | Gets the list of custom attribute types to be copied.
Top
Remarks
See Also

Reference

PostSharp.Aspects.Advices Namespace
PostSharp.Aspects.AdvicesIntroduceMemberAttribute

Other Resources

Conceptual: Introducing, Overriding and Importing Members
Conceptual: Importing Dependencies from the Target Object
Conceptual: Introducing Custom Attributes


CopyCustomAttributesAttribute Constructor

Overload List
 | Name | Description
Public method | CopyCustomAttributesAttribute(Type) | Requires custom attributes present on the aspect class or aspect class member to be copied to the aspect target or to the introduced member, respectively.
Public method | CopyCustomAttributesAttribute(Type) | Requires custom attributes present on the aspect class or aspect class member to be copied to the aspect target or to the introduced member, respectively.
Top
See Also

Reference

CopyCustomAttributesAttribute Class
PostSharp.Aspects.Advices Namespace


CopyCustomAttributesAttribute Constructor (Type)

Requires custom attributes present on the aspect class or aspect class member to be copied to the aspect target or to the introduced member, respectively.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CopyCustomAttributesAttribute(
    Type type
)

Parameters

type
Type: SystemType
Base type of custom attributes to be copied.
See Also

Reference

CopyCustomAttributesAttribute Class
CopyCustomAttributesAttribute Overload
PostSharp.Aspects.Advices Namespace


CopyCustomAttributesAttribute Constructor (Type[])

CopyCustomAttributesAttribute Constructor (Type)

Requires custom attributes present on the aspect class or aspect class member to be copied to the aspect target or to the introduced member, respectively.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CopyCustomAttributesAttribute(
    params Type[] types
)

Parameters

types
Type: SystemType
Base types of custom attributes to be copied.
See Also

Reference

CopyCustomAttributesAttribute Class
CopyCustomAttributesAttribute Overload
PostSharp.Aspects.Advices Namespace


CopyCustomAttributesAttribute Properties

The CopyCustomAttributesAttribute type exposes the following members.

Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | OverrideAction | Determines what should happen when a custom attribute of the same type is already present on the target declaration.
Public property | Types | Gets the list of custom attribute types to be copied.
Top
See Also

Reference

CopyCustomAttributesAttribute Class
PostSharp.Aspects.Advices Namespace


CopyCustomAttributesAttribute.OverrideAction Property

CopyCustomAttributesAttributeOverrideAction Property

Determines what should happen when a custom attribute of the same type is already present on the target declaration.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CustomAttributeOverrideAction OverrideAction { get; set; }

Property Value

Type: CustomAttributeOverrideAction
See Also

Reference

CopyCustomAttributesAttribute Class
PostSharp.Aspects.Advices Namespace


CopyCustomAttributesAttribute.Types Property

CopyCustomAttributesAttributeTypes Property

Gets the list of custom attribute types to be copied.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Type[] Types { get; }

Property Value

Type: Type
See Also

Reference

CopyCustomAttributesAttribute Class
PostSharp.Aspects.Advices Namespace


CustomAttributeOverrideAction Enumeration

Behavior of CopyCustomAttributesAttribute when a custom attribute of the same type already exists on the target declaration.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum CustomAttributeOverrideAction
Members
Member name | Value | Description
Default | 0 | Default (Fail).
Fail | 0 | Emits an error message.
Ignore | 1 | Silently ignore this custom attribute (does not copy it, without error message).
Add | 2 | Adds a new copy (possibly duplicate) of the custom attribute.
MergeAddProperty | 3 | Merges the existing custom attribute with the template custom attribute by adding properties and fields. If the existing custom attribute defines the same properties and fields as the template custom attribute, they are not overridden.
MergeReplaceProperty | 4 | Merges the existing custom attribute with the template custom attribute by adding and replacing properties and fields. If the existing custom attribute defines the same properties and fields as the template custom attribute, they are replaced by the values defined in the template custom attribute.
See Also

Reference

PostSharp.Aspects.Advices Namespace
PostSharp.Aspects.AdvicesCopyCustomAttributesAttribute


Event(TDelegate) Class

EventTDelegate Class

Exposes the semantics of an event for use with the ImportMemberAttribute aspect extension.
Inheritance Hierarchy
SystemObject
PostSharp.Aspects.AdvicesEventTDelegate

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public sealed class Event<TDelegate>

Type Parameters

TDelegate
Handler type (derived from Delegate).

The EventTDelegate type exposes the following members.

Properties
 | Name | Description
Public property | Add | Gets a delegate enabling to invoke the add accessor of the imported event.
Public property | Remove | Gets a delegate enabling to invoke the remove accessor of the imported event.
Top
Remarks
See Also

Reference

PostSharp.Aspects.Advices Namespace
PostSharp.Aspects.AdvicesImportMemberAttribute

Other Resources

Conceptual: Introducing, Overriding and Importing Members
Conceptual: Accessing Members of the Target Class


Event(TDelegate) Properties

EventTDelegate Properties

The EventTDelegate generic type exposes the following members.

Properties
 | Name | Description
Public property | Add | Gets a delegate enabling to invoke the add accessor of the imported event.
Public property | Remove | Gets a delegate enabling to invoke the remove accessor of the imported event.
Top
See Also

Reference

EventTDelegate Class
PostSharp.Aspects.Advices Namespace


Event(TDelegate).Add Property

EventTDelegateAdd Property

Gets a delegate enabling to invoke the add accessor of the imported event.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public EventAccessor<TDelegate> Add { get; }

Property Value

Type: EventAccessor TDelegate
See Also

Reference

EventTDelegate Class
PostSharp.Aspects.Advices Namespace

Other Resources

Conceptual: Accessing Members of the Target Class


Event(TDelegate).Remove Property

EventTDelegateRemove Property

Gets a delegate enabling to invoke the remove accessor of the imported event.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public EventAccessor<TDelegate> Remove { get; }

Property Value

Type: EventAccessor TDelegate
See Also

Reference

EventTDelegate Class
PostSharp.Aspects.Advices Namespace

Other Resources

Conceptual: Accessing Members of the Target Class


EventAccessor(TDelegate) Delegate

EventAccessorTDelegate Delegate

Defines the signature of methods implementing the Add and Remove semantics of an event.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public delegate void EventAccessor<TDelegate>(
    TDelegate delegate
)

Parameters

delegate
Type: TDelegate
Handler.

Type Parameters

TDelegate
Handler type (derived from Delegate).
See Also

Reference

PostSharp.Aspects.Advices Namespace
PostSharp.Aspects.AdvicesEventTDelegate


GroupingAdvice Class

Base class for all advices that are possibly composed of multiple advices that can be grouped together using the Master property.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.AdvicesAdvice
PostSharp.Aspects.AdvicesGroupingAdvice
More...

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class GroupingAdvice : Advice

The GroupingAdvice type exposes the following members.

Constructors
 | Name | Description
Protected method | GroupingAdvice | Initializes a new instance of the GroupingAdvice class
Top
Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | Master | Name of the master advice method. If this property is not set, the current method is itself the master of the group. Only master methods can define selectors (Pointcut) and dependencies (AspectDependencyAttribute).
Top
Remarks
See Also

Reference

PostSharp.Aspects.Advices Namespace
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.AdvicesAdvice
PostSharp.Aspects.AdvicesGroupingAdvice
PostSharp.Aspects.AdvicesLocationValidationAdvice
PostSharp.Aspects.AdvicesOnEventAddHandlerAdvice
PostSharp.Aspects.AdvicesOnEventInvokeHandlerAdvice
PostSharp.Aspects.AdvicesOnEventRemoveHandlerAdvice
PostSharp.Aspects.AdvicesOnLocationGetValueAdvice
PostSharp.Aspects.AdvicesOnLocationSetValueAdvice
PostSharp.Aspects.AdvicesOnMethodBoundaryAdvice
PostSharp.Aspects.AdvicesOnMethodInvokeBaseAdvice


GroupingAdvice Constructor

Initializes a new instance of the GroupingAdvice class

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected GroupingAdvice()
See Also

Reference

GroupingAdvice Class
PostSharp.Aspects.Advices Namespace


GroupingAdvice Properties

The GroupingAdvice type exposes the following members.

Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | Master | Name of the master advice method. If this property is not set, the current method is itself the master of the group. Only master methods can define selectors (Pointcut) and dependencies (AspectDependencyAttribute).
Top
See Also

Reference

GroupingAdvice Class
PostSharp.Aspects.Advices Namespace


GroupingAdvice.Master Property

GroupingAdviceMaster Property

Name of the master advice method. If this property is not set, the current method is itself the master of the group. Only master methods can define selectors (Pointcut) and dependencies (AspectDependencyAttribute).

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string Master { get; set; }

Property Value

Type: String
See Also

Reference

GroupingAdvice Class
PostSharp.Aspects.Advices Namespace

Other Resources

Conceptual: Adding Behaviors to Existing Members


IAdviceProvider Interface

Interface that allows an aspect to provide aspects dynamically, instead of declaratively using custom attributes.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IAdviceProvider : IAspect

The IAdviceProvider type exposes the following members.

Methods
 | Name | Description
Public method | ProvideAdvices | Provides an enumeration of advices, represented as instances of the AdviceInstance class, for the current aspect instance.
Top
See Also

Reference

PostSharp.Aspects.Advices Namespace

Other Resources

Conceptual: What's New in PostSharp 4.0


IAdviceProvider Methods

The IAdviceProvider type exposes the following members.

Methods
 | Name | Description
Public method | ProvideAdvices | Provides an enumeration of advices, represented as instances of the AdviceInstance class, for the current aspect instance.
Top
See Also

Reference

IAdviceProvider Interface
PostSharp.Aspects.Advices Namespace


IAdviceProvider.ProvideAdvices Method

IAdviceProviderProvideAdvices Method

Provides an enumeration of advices, represented as instances of the AdviceInstance class, for the current aspect instance.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IEnumerable<AdviceInstance> ProvideAdvices(
    Object targetElement
)

Parameters

targetElement
Type: SystemObject
Element of code to which the current aspect has been applied.

Return Value

Type: IEnumerable AdviceInstance
A collection of advices to be added to the current aspect instance.
See Also

Reference

IAdviceProvider Interface
PostSharp.Aspects.Advices Namespace


ImportLocationAdviceInstance Class

Represents an advice that imports a field or property (represented by a LocationInfo) of the target class into a field of the aspect class. This class is the imperative equivalent of the ImportMemberAttribute declarative advise.
Inheritance Hierarchy
SystemObject
PostSharp.Aspects.AdvicesAdviceInstance
PostSharp.Aspects.AdvicesImportMemberAdviceInstance
PostSharp.Aspects.AdvicesImportLocationAdviceInstance

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ImportLocationAdviceInstance : ImportMemberAdviceInstance

The ImportLocationAdviceInstance type exposes the following members.

Constructors
 | Name | Description
Public method | ImportLocationAdviceInstance(FieldInfo, LocationInfo) | Initializes a new instance of the ImportLocationAdviceInstance class and specifies which field or property should be imported by giving its reflection representation.
Public method | ImportLocationAdviceInstance(FieldInfo, String, Boolean, ImportMemberOrder) | Initializes a new instance of the ImportLocationAdviceInstance class and specifies the name of the property to be imported; the type of this property will be matched according to the type of the aspect field.
Public method | ImportLocationAdviceInstance(FieldInfo, String, Boolean, ImportMemberOrder) | Initializes a new instance of the ImportLocationAdviceInstance class and specifies the name of the property to be imported; the type of this property will be matched according to the type of the aspect field.
Top
Properties
 | Name | Description
Public property | AspectField | Gets the field of the aspect class to which the field or property needs to be bound. (Inherited from ImportMemberAdviceInstance.)
Public property | Description | A human-readable description of the current advice instance. (Inherited from AdviceInstance.)
Public property | IsRequired | Determines whether a build-time error should be emitted if the member cannot be found. If false, the binding field will be null in case the imported member is absent. (Inherited from ImportMemberAdviceInstance.)
Public property | LinesOfCodeAvoided | The number of lines of hand-written code avoided by this specific AdviceInstance. (Inherited from AdviceInstance.)
Public property | Location | Gets the field or property of the target class that needs to be imported into the aspect.
Public property | MasterAspectMember | Gets the main field or method of the aspect class that the current AdviceInstance relates to. (Inherited from ImportMemberAdviceInstance.)
Public property | Member | Gets the reflection object (LocationInfo or MethodInfo) that needs to be imported, or null if the exact member is unknown and must be matched by name and signature. (Overrides ImportMemberAdviceInstanceMember.)
Public property | MemberNames | Gets the fallback list of possible names of the member to be imported. (Overrides ImportMemberAdviceInstanceMemberNames.)
Public property | Order | Determines whether the AspectField should be bound to the member as resolved before or after introduction of new members into the target class by the current advise. (Inherited from ImportMemberAdviceInstance.)
Top
See Also

Reference

PostSharp.Aspects.Advices Namespace
PostSharp.Aspects.AdvicesIAdviceProvider
PostSharp.Aspects.AdvicesImportMemberAttribute

Other Resources

Conceptual: What's New in PostSharp 4.0


ImportLocationAdviceInstance Constructor

Overload List
 | Name | Description
Public method | ImportLocationAdviceInstance(FieldInfo, LocationInfo) | Initializes a new instance of the ImportLocationAdviceInstance class and specifies which field or property should be imported by giving its reflection representation.
Public method | ImportLocationAdviceInstance(FieldInfo, String, Boolean, ImportMemberOrder) | Initializes a new instance of the ImportLocationAdviceInstance class and specifies the name of the property to be imported; the type of this property will be matched according to the type of the aspect field.
Public method | ImportLocationAdviceInstance(FieldInfo, String, Boolean, ImportMemberOrder) | Initializes a new instance of the ImportLocationAdviceInstance class and specifies the name of the property to be imported; the type of this property will be matched according to the type of the aspect field.
Top
See Also

Reference

ImportLocationAdviceInstance Class
PostSharp.Aspects.Advices Namespace


ImportLocationAdviceInstance Constructor (FieldInfo, LocationInfo)

Initializes a new instance of the ImportLocationAdviceInstance class and specifies which field or property should be imported by giving its reflection representation.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ImportLocationAdviceInstance(
    FieldInfo aspectField,
    LocationInfo location
)

Parameters

aspectField
Type: System.ReflectionFieldInfo
A field of the aspect class to which location should be bound at runtime. This field can be of type ILocationBinding, PropertyTValue, or a type that is both (a) derived from ICollection<ILocationBinding> and (b) has a parameterless constructor.
location
Type: PostSharp.ReflectionLocationInfo
The field or property to import.
See Also

Reference

ImportLocationAdviceInstance Class
ImportLocationAdviceInstance Overload
PostSharp.Aspects.Advices Namespace


ImportLocationAdviceInstance Constructor (FieldInfo, String, Boolean, ImportMemberOrder)

Initializes a new instance of the ImportLocationAdviceInstance class and specifies the name of the property to be imported; the type of this property will be matched according to the type of the aspect field.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ImportLocationAdviceInstance(
    FieldInfo aspectField,
    string propertyName,
    bool isRequired = false,
    ImportMemberOrder order = ImportMemberOrder.Default
)

Parameters

aspectField
Type: System.ReflectionFieldInfo
A field of the aspect class to which the field or property should be bound at build time. This field must be of type PropertyTValue.
propertyName
Type: SystemString
The name of the property to import.
isRequired (Optional)
Type: SystemBoolean
Determines whether a build-time error should be emitted if the member cannot be found. If false, the binding field will be null in case the imported member is absent.
order (Optional)
Type: PostSharp.Aspects.AdvicesImportMemberOrder
Determines whether the aspectField should be bound to the member as resolved before or after introduction of new members into the target class by the current advise.
See Also

Reference

ImportLocationAdviceInstance Class
ImportLocationAdviceInstance Overload
PostSharp.Aspects.Advices Namespace


ImportLocationAdviceInstance Constructor (FieldInfo, String[], Boolean, ImportMemberOrder)

ImportLocationAdviceInstance Constructor (FieldInfo, String, Boolean, ImportMemberOrder)

Initializes a new instance of the ImportLocationAdviceInstance class and specifies the name of the property to be imported; the type of this property will be matched according to the type of the aspect field.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ImportLocationAdviceInstance(
    FieldInfo aspectField,
    string[] propertyNames,
    bool isRequired = false,
    ImportMemberOrder order = ImportMemberOrder.Default
)

Parameters

aspectField
Type: System.ReflectionFieldInfo
A field of the aspect class to which the field or property should be bound at build time. This field must be of type PropertyTValue.
propertyNames
Type: SystemString
Fallback list of possible names of the property to import.
isRequired (Optional)
Type: SystemBoolean
Determines whether a build-time error should be emitted if the member cannot be found. If false, the binding field will be null in case the imported member is absent.
order (Optional)
Type: PostSharp.Aspects.AdvicesImportMemberOrder
Determines whether the aspectField should be bound to the member as resolved before or after introduction of new members into the target class by the current advise.
See Also

Reference

ImportLocationAdviceInstance Class
ImportLocationAdviceInstance Overload
PostSharp.Aspects.Advices Namespace


ImportLocationAdviceInstance Properties

The ImportLocationAdviceInstance type exposes the following members.

Properties
 | Name | Description
Public property | AspectField | Gets the field of the aspect class to which the field or property needs to be bound. (Inherited from ImportMemberAdviceInstance.)
Public property | Description | A human-readable description of the current advice instance. (Inherited from AdviceInstance.)
Public property | IsRequired | Determines whether a build-time error should be emitted if the member cannot be found. If false, the binding field will be null in case the imported member is absent. (Inherited from ImportMemberAdviceInstance.)
Public property | LinesOfCodeAvoided | The number of lines of hand-written code avoided by this specific AdviceInstance. (Inherited from AdviceInstance.)
Public property | Location | Gets the field or property of the target class that needs to be imported into the aspect.
Public property | MasterAspectMember | Gets the main field or method of the aspect class that the current AdviceInstance relates to. (Inherited from ImportMemberAdviceInstance.)
Public property | Member | Gets the reflection object (LocationInfo or MethodInfo) that needs to be imported, or null if the exact member is unknown and must be matched by name and signature. (Overrides ImportMemberAdviceInstanceMember.)
Public property | MemberNames | Gets the fallback list of possible names of the member to be imported. (Overrides ImportMemberAdviceInstanceMemberNames.)
Public property | Order | Determines whether the AspectField should be bound to the member as resolved before or after introduction of new members into the target class by the current advise. (Inherited from ImportMemberAdviceInstance.)
Top
See Also

Reference

ImportLocationAdviceInstance Class
PostSharp.Aspects.Advices Namespace


ImportLocationAdviceInstance.Location Property

ImportLocationAdviceInstanceLocation Property

Gets the field or property of the target class that needs to be imported into the aspect.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LocationInfo Location { get; }

Property Value

Type: LocationInfo
See Also

Reference

ImportLocationAdviceInstance Class
PostSharp.Aspects.Advices Namespace


ImportLocationAdviceInstance.Member Property

ImportLocationAdviceInstanceMember Property

Gets the reflection object (LocationInfo or MethodInfo) that needs to be imported, or null if the exact member is unknown and must be matched by name and signature.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Object Member { get; }

Property Value

Type: Object
See Also

Reference

ImportLocationAdviceInstance Class
PostSharp.Aspects.Advices Namespace


ImportLocationAdviceInstance.MemberNames Property

ImportLocationAdviceInstanceMemberNames Property

Gets the fallback list of possible names of the member to be imported.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override string[] MemberNames { get; }

Property Value

Type: String
See Also

Reference

ImportLocationAdviceInstance Class
PostSharp.Aspects.Advices Namespace


ImportMemberAdviceInstance Class

Base class for ImportLocationAdviceInstance and ImportMethodAdviceInstance.
Inheritance Hierarchy
SystemObject
PostSharp.Aspects.AdvicesAdviceInstance
PostSharp.Aspects.AdvicesImportMemberAdviceInstance
PostSharp.Aspects.AdvicesImportLocationAdviceInstance
PostSharp.Aspects.AdvicesImportMethodAdviceInstance

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class ImportMemberAdviceInstance : AdviceInstance

The ImportMemberAdviceInstance type exposes the following members.

Properties
 | Name | Description
Public property | AspectField | Gets the field of the aspect class to which the field or property needs to be bound.
Public property | Description | A human-readable description of the current advice instance. (Inherited from AdviceInstance.)
Public property | IsRequired | Determines whether a build-time error should be emitted if the member cannot be found. If false, the binding field will be null in case the imported member is absent.
Public property | LinesOfCodeAvoided | The number of lines of hand-written code avoided by this specific AdviceInstance. (Inherited from AdviceInstance.)
Public property | MasterAspectMember | Gets the main field or method of the aspect class that the current AdviceInstance relates to. (Overrides AdviceInstanceMasterAspectMember.)
Public property | Member | Gets the reflection object (LocationInfo or MethodInfo) that needs to be imported, or null if the exact member is unknown and must be matched by name and signature.
Public property | MemberNames | Gets the fallback list of possible names of the member to be imported.
Public property | Order | Determines whether the AspectField should be bound to the member as resolved before or after introduction of new members into the target class by the current advise.
Top
See Also

Reference

PostSharp.Aspects.Advices Namespace
PostSharp.Aspects.AdvicesIAdviceProvider
PostSharp.Aspects.AdvicesImportMemberAttribute


ImportMemberAdviceInstance Properties

The ImportMemberAdviceInstance type exposes the following members.

Properties
 | Name | Description
Public property | AspectField | Gets the field of the aspect class to which the field or property needs to be bound.
Public property | Description | A human-readable description of the current advice instance. (Inherited from AdviceInstance.)
Public property | IsRequired | Determines whether a build-time error should be emitted if the member cannot be found. If false, the binding field will be null in case the imported member is absent.
Public property | LinesOfCodeAvoided | The number of lines of hand-written code avoided by this specific AdviceInstance. (Inherited from AdviceInstance.)
Public property | MasterAspectMember | Gets the main field or method of the aspect class that the current AdviceInstance relates to. (Overrides AdviceInstanceMasterAspectMember.)
Public property | Member | Gets the reflection object (LocationInfo or MethodInfo) that needs to be imported, or null if the exact member is unknown and must be matched by name and signature.
Public property | MemberNames | Gets the fallback list of possible names of the member to be imported.
Public property | Order | Determines whether the AspectField should be bound to the member as resolved before or after introduction of new members into the target class by the current advise.
Top
See Also

Reference

ImportMemberAdviceInstance Class
PostSharp.Aspects.Advices Namespace


ImportMemberAdviceInstance.AspectField Property

ImportMemberAdviceInstanceAspectField Property

Gets the field of the aspect class to which the field or property needs to be bound.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public FieldInfo AspectField { get; }

Property Value

Type: FieldInfo
See Also

Reference

ImportMemberAdviceInstance Class
PostSharp.Aspects.Advices Namespace


ImportMemberAdviceInstance.IsRequired Property

ImportMemberAdviceInstanceIsRequired Property

Determines whether a build-time error should be emitted if the member cannot be found. If false, the binding field will be null in case the imported member is absent.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsRequired { get; }

Property Value

Type: Boolean
Remarks

This property is always true when the Member property is set.

See Also

Reference

ImportMemberAdviceInstance Class
PostSharp.Aspects.Advices Namespace


ImportMemberAdviceInstance.MasterAspectMember Property

ImportMemberAdviceInstanceMasterAspectMember Property

Gets the main field or method of the aspect class that the current AdviceInstance relates to.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Object MasterAspectMember { get; }

Property Value

Type: Object
See Also

Reference

ImportMemberAdviceInstance Class
PostSharp.Aspects.Advices Namespace


ImportMemberAdviceInstance.Member Property

ImportMemberAdviceInstanceMember Property

Gets the reflection object (LocationInfo or MethodInfo) that needs to be imported, or null if the exact member is unknown and must be matched by name and signature.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract Object Member { get; }

Property Value

Type: Object
See Also

Reference

ImportMemberAdviceInstance Class
PostSharp.Aspects.Advices Namespace


ImportMemberAdviceInstance.MemberNames Property

ImportMemberAdviceInstanceMemberNames Property

Gets the fallback list of possible names of the member to be imported.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract string[] MemberNames { get; }

Property Value

Type: String
See Also

Reference

ImportMemberAdviceInstance Class
PostSharp.Aspects.Advices Namespace


ImportMemberAdviceInstance.Order Property

ImportMemberAdviceInstanceOrder Property

Determines whether the AspectField should be bound to the member as resolved before or after introduction of new members into the target class by the current advise.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ImportMemberOrder Order { get; }

Property Value

Type: ImportMemberOrder
See Also

Reference

ImportMemberAdviceInstance Class
PostSharp.Aspects.Advices Namespace


ImportMemberAttribute Class

Custom attribute that, when applied to an instance field of an aspect class, determines that this field should be bound to a method, event or property, of the target class of this aspect. Valid types for fields are a concrete Delegate (to bind to a method), PropertyTValue or PropertyTValue, TIndex (to bind to a property), or EventTDelegate (to bind to an event).
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.AdvicesAdvice
PostSharp.Aspects.AdvicesImportMemberAttribute

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ImportMemberAttribute : Advice

The ImportMemberAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | ImportMemberAttribute(String) | Initializes a new ImportMemberAttribute and specifies a single name for the member to import.
Public method | ImportMemberAttribute(String) | Initializes a new ImportMemberAttribute and specifies several possible names for the member to import.
Top
Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | IsRequired | Determines whether a build time error must be issued if the member to be imported is absent. If false, the binding field will be null in case the imported member is absent.
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | MemberNames | Array of possible names of imported member in the order of precedence.
Public property | Order | Determines when the member should be imported: either before (BeforeIntroductions) or after (AfterIntroductions) members have been introduced by the current aspect. Default is BeforeIntroductions.
Top
Remarks

Fields annotated with the ImportMemberAttribute custom attribute must be public and must not be read only.

At runtime, these fields are assigned to a delegate (in case of method binding) or a pair of delegates (in case of event or property binding) allowing to invoke the imported member.

When IsRequired property is set to true and the target type does not contain a member of the required name and signature, then a build error will be raised.

When multiple member names are specified, the first existing member satisfying all conditions is used.

See Also

Reference

PostSharp.Aspects.Advices Namespace

Other Resources

Conceptual: Introducing, Overriding and Importing Members
Conceptual: Accessing Members of the Target Class
Conceptual: Coping with Custom Object Serializers
Conceptual: Importing Dependencies from the Target Object
Conceptual: What's New in PostSharp 4.0


ImportMemberAttribute Constructor

Overload List
 | Name | Description
Public method | ImportMemberAttribute(String) | Initializes a new ImportMemberAttribute and specifies a single name for the member to import.
Public method | ImportMemberAttribute(String) | Initializes a new ImportMemberAttribute and specifies several possible names for the member to import.
Top
See Also

Reference

ImportMemberAttribute Class
PostSharp.Aspects.Advices Namespace


ImportMemberAttribute Constructor (String)

Initializes a new ImportMemberAttribute and specifies a single name for the member to import.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ImportMemberAttribute(
    string memberName
)

Parameters

memberName
Type: SystemString
The name of the member to import.
See Also

Reference

ImportMemberAttribute Class
ImportMemberAttribute Overload
PostSharp.Aspects.Advices Namespace


ImportMemberAttribute Constructor (String[])

ImportMemberAttribute Constructor (String)

Initializes a new ImportMemberAttribute and specifies several possible names for the member to import.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ImportMemberAttribute(
    params string[] memberNames
)

Parameters

memberNames
Type: SystemString
Possible names of the member to import in the order of precedence.
See Also

Reference

ImportMemberAttribute Class
ImportMemberAttribute Overload
PostSharp.Aspects.Advices Namespace


ImportMemberAttribute Properties

The ImportMemberAttribute type exposes the following members.

Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | IsRequired | Determines whether a build time error must be issued if the member to be imported is absent. If false, the binding field will be null in case the imported member is absent.
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | MemberNames | Array of possible names of imported member in the order of precedence.
Public property | Order | Determines when the member should be imported: either before (BeforeIntroductions) or after (AfterIntroductions) members have been introduced by the current aspect. Default is BeforeIntroductions.
Top
See Also

Reference

ImportMemberAttribute Class
PostSharp.Aspects.Advices Namespace


ImportMemberAttribute.IsRequired Property

ImportMemberAttributeIsRequired Property

Determines whether a build time error must be issued if the member to be imported is absent. If false, the binding field will be null in case the imported member is absent.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsRequired { get; set; }

Property Value

Type: Boolean
See Also

Reference

ImportMemberAttribute Class
PostSharp.Aspects.Advices Namespace

Other Resources

Conceptual: Accessing Members of the Target Class


ImportMemberAttribute.MemberNames Property

ImportMemberAttributeMemberNames Property

Array of possible names of imported member in the order of precedence.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string[] MemberNames { get; }

Property Value

Type: String
See Also

Reference

ImportMemberAttribute Class
PostSharp.Aspects.Advices Namespace


ImportMemberAttribute.Order Property

ImportMemberAttributeOrder Property

Determines when the member should be imported: either before (BeforeIntroductions) or after (AfterIntroductions) members have been introduced by the current aspect. Default is BeforeIntroductions.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ImportMemberOrder Order { get; set; }

Property Value

Type: ImportMemberOrder
Remarks
Sometimes it makes sense for an aspect to import a member after the same aspect has introduced member. This allows the aspect to invoke a member that could be overridden by later aspects.
See Also

Reference

ImportMemberAttribute Class
PostSharp.Aspects.Advices Namespace

Other Resources

Conceptual: Accessing Members of the Target Class


ImportMemberOrder Enumeration

Enumeration of moments when members should be imported into an aspect.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum ImportMemberOrder
Members
Member name | Value | Description
Default | 0 | AfterIntroductions
BeforeIntroductions | 1 | Before the aspect introduces its own members. This is similar to calling the overridden method using the base keyword in C#. The overridden method implementation is always selected, even if the method is virtual.
AfterIntroductions | 0 | After the aspect introduces its own members. Note that importing a member introduced by the current aspect makes sense only if the member has been introduced as virtual; in this case, the the imported member is dynamically resolved using the virtual table of the target object.
See Also

Reference

PostSharp.Aspects.Advices Namespace
PostSharp.Aspects.AdvicesImportMemberAttribute


ImportMethodAdviceInstance Class

Represents an advises that import a method of the target class into the aspect class.
Inheritance Hierarchy
SystemObject
PostSharp.Aspects.AdvicesAdviceInstance
PostSharp.Aspects.AdvicesImportMemberAdviceInstance
PostSharp.Aspects.AdvicesImportMethodAdviceInstance

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ImportMethodAdviceInstance : ImportMemberAdviceInstance

The ImportMethodAdviceInstance type exposes the following members.

Constructors
 | Name | Description
Public method | ImportMethodAdviceInstance(FieldInfo, String, Boolean, ImportMemberOrder) | Initializes a new instance of the ImportMethodAdviceInstance.
Public method | ImportMethodAdviceInstance(FieldInfo, String, Boolean, ImportMemberOrder) | Initializes a new instance of the ImportMethodAdviceInstance.
Top
Properties
 | Name | Description
Public property | AspectField | Gets the field of the aspect class to which the field or property needs to be bound. (Inherited from ImportMemberAdviceInstance.)
Public property | Description | A human-readable description of the current advice instance. (Inherited from AdviceInstance.)
Public property | IsRequired | Determines whether a build-time error should be emitted if the member cannot be found. If false, the binding field will be null in case the imported member is absent. (Inherited from ImportMemberAdviceInstance.)
Public property | LinesOfCodeAvoided | The number of lines of hand-written code avoided by this specific AdviceInstance. (Inherited from AdviceInstance.)
Public property | MasterAspectMember | Gets the main field or method of the aspect class that the current AdviceInstance relates to. (Inherited from ImportMemberAdviceInstance.)
Public property | Member | Gets the reflection object (LocationInfo or MethodInfo) that needs to be imported, or null if the exact member is unknown and must be matched by name and signature. (Overrides ImportMemberAdviceInstanceMember.)
Public property | MemberNames | Gets the fallback list of possible names of the member to be imported. (Overrides ImportMemberAdviceInstanceMemberNames.)
Public property | Order | Determines whether the AspectField should be bound to the member as resolved before or after introduction of new members into the target class by the current advise. (Inherited from ImportMemberAdviceInstance.)
Top
See Also

Reference

PostSharp.Aspects.Advices Namespace


ImportMethodAdviceInstance Constructor

Overload List
 | Name | Description
Public method | ImportMethodAdviceInstance(FieldInfo, String, Boolean, ImportMemberOrder) | Initializes a new instance of the ImportMethodAdviceInstance.
Public method | ImportMethodAdviceInstance(FieldInfo, String, Boolean, ImportMemberOrder) | Initializes a new instance of the ImportMethodAdviceInstance.
Top
See Also

Reference

ImportMethodAdviceInstance Class
PostSharp.Aspects.Advices Namespace


ImportMethodAdviceInstance Constructor (FieldInfo, String, Boolean, ImportMemberOrder)

Initializes a new instance of the ImportMethodAdviceInstance.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ImportMethodAdviceInstance(
    FieldInfo aspectField,
    string methodName,
    bool isRequired = false,
    ImportMemberOrder order = ImportMemberOrder.Default
)

Parameters

aspectField
Type: System.ReflectionFieldInfo
A field of the aspect class into that will be assigned to a delegate of the imported method at runtime. The field type should be a delegate of the same signature than the method to import.
methodName
Type: SystemString
Name of the method to import.
isRequired (Optional)
Type: SystemBoolean
true if the build should fail if there no matching method in the target class, false to set aspectField to null in this case.
order (Optional)
Type: PostSharp.Aspects.AdvicesImportMemberOrder
Determines whether the aspectField should be bound to the member as resolved before or after introduction of new members into the target class by the current advise.
See Also

Reference

ImportMethodAdviceInstance Class
ImportMethodAdviceInstance Overload
PostSharp.Aspects.Advices Namespace


ImportMethodAdviceInstance Constructor (FieldInfo, String[], Boolean, ImportMemberOrder)

ImportMethodAdviceInstance Constructor (FieldInfo, String, Boolean, ImportMemberOrder)

Initializes a new instance of the ImportMethodAdviceInstance.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ImportMethodAdviceInstance(
    FieldInfo aspectField,
    string[] methodNames,
    bool isRequired = false,
    ImportMemberOrder order = ImportMemberOrder.Default
)

Parameters

aspectField
Type: System.ReflectionFieldInfo
A field of the aspect class into that will be assigned to a delegate of the imported method at runtime. The field type should be a delegate of the same signature than the method to import.
methodNames
Type: SystemString
Fallback list of possible names of the member to be imported.
isRequired (Optional)
Type: SystemBoolean
true if the build should fail if there no matching method in the target class, false to set aspectField to null in this case.
order (Optional)
Type: PostSharp.Aspects.AdvicesImportMemberOrder
Determines whether the aspectField should be bound to the member as resolved before or after introduction of new members into the target class by the current advise.
See Also

Reference

ImportMethodAdviceInstance Class
ImportMethodAdviceInstance Overload
PostSharp.Aspects.Advices Namespace


ImportMethodAdviceInstance Properties

The ImportMethodAdviceInstance type exposes the following members.

Properties
 | Name | Description
Public property | AspectField | Gets the field of the aspect class to which the field or property needs to be bound. (Inherited from ImportMemberAdviceInstance.)
Public property | Description | A human-readable description of the current advice instance. (Inherited from AdviceInstance.)
Public property | IsRequired | Determines whether a build-time error should be emitted if the member cannot be found. If false, the binding field will be null in case the imported member is absent. (Inherited from ImportMemberAdviceInstance.)
Public property | LinesOfCodeAvoided | The number of lines of hand-written code avoided by this specific AdviceInstance. (Inherited from AdviceInstance.)
Public property | MasterAspectMember | Gets the main field or method of the aspect class that the current AdviceInstance relates to. (Inherited from ImportMemberAdviceInstance.)
Public property | Member | Gets the reflection object (LocationInfo or MethodInfo) that needs to be imported, or null if the exact member is unknown and must be matched by name and signature. (Overrides ImportMemberAdviceInstanceMember.)
Public property | MemberNames | Gets the fallback list of possible names of the member to be imported. (Overrides ImportMemberAdviceInstanceMemberNames.)
Public property | Order | Determines whether the AspectField should be bound to the member as resolved before or after introduction of new members into the target class by the current advise. (Inherited from ImportMemberAdviceInstance.)
Top
See Also

Reference

ImportMethodAdviceInstance Class
PostSharp.Aspects.Advices Namespace


ImportMethodAdviceInstance.Member Property

ImportMethodAdviceInstanceMember Property

Gets the reflection object (LocationInfo or MethodInfo) that needs to be imported, or null if the exact member is unknown and must be matched by name and signature.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Object Member { get; }

Property Value

Type: Object
See Also

Reference

ImportMethodAdviceInstance Class
PostSharp.Aspects.Advices Namespace


ImportMethodAdviceInstance.MemberNames Property

ImportMethodAdviceInstanceMemberNames Property

Gets the fallback list of possible names of the member to be imported.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override string[] MemberNames { get; }

Property Value

Type: String
See Also

Reference

ImportMethodAdviceInstance Class
PostSharp.Aspects.Advices Namespace


InitializeAspectInstanceAdvice Class

Custom attribute that, when applied to a method of an aspect class, specifies that this method should be invoked whenever the aspect instance needs to be initialized. The target method must have a void return value and have a single parameter of type AspectInitializationReason. This method is equivalent to RuntimeInitializeInstance
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.AdvicesAdvice
PostSharp.Aspects.AdvicesInitializeAspectInstanceAdvice

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class InitializeAspectInstanceAdvice : Advice

The InitializeAspectInstanceAdvice type exposes the following members.

Constructors
 | Name | Description
Public method | InitializeAspectInstanceAdvice | Initializes a new instance of the InitializeAspectInstanceAdvice class
Top
Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Top
Remarks
See Also

Reference

PostSharp.Aspects.Advices Namespace

Other Resources

Conceptual: What's New in PostSharp 4.0


InitializeAspectInstanceAdvice Constructor

Initializes a new instance of the InitializeAspectInstanceAdvice class

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public InitializeAspectInstanceAdvice()
See Also

Reference

InitializeAspectInstanceAdvice Class
PostSharp.Aspects.Advices Namespace


InitializeAspectInstanceAdvice Properties

The InitializeAspectInstanceAdvice type exposes the following members.

Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Top
See Also

Reference

InitializeAspectInstanceAdvice Class
PostSharp.Aspects.Advices Namespace


InterfaceOverrideAction Enumeration

Enumeration of actions to be overtaken when an interface that should be introduced into a type is already implemented by that type.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum InterfaceOverrideAction
Members
Member name | Value | Description
Default | 0 | Fail.
Fail | 0 | Fails and emits an error message.
Ignore | 1 | Silently ignore this interface (does not introduce it).
Remarks
See Also

Reference

PostSharp.Aspects.Advices Namespace
PostSharp.Aspects.AdvicesIntroduceInterfaceAttribute


IntroduceInterfaceAdviceInstance Class

Represents an advise that introduces an interface into the target class. The interface must be implemented by the aspect class.
Inheritance Hierarchy
SystemObject
PostSharp.Aspects.AdvicesAdviceInstance
PostSharp.Aspects.AdvicesIntroduceInterfaceAdviceInstance

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class IntroduceInterfaceAdviceInstance : AdviceInstance

The IntroduceInterfaceAdviceInstance type exposes the following members.

Constructors
 | Name | Description
Public method | IntroduceInterfaceAdviceInstance | Initializes a new instance of the IntroduceInterfaceAdviceInstance class.
Top
Properties
 | Name | Description
Public property | AncestorOverrideAction | Specifies the action (Fail or Ignore) to be overtaken when an ancestor of the interface specified in the constructor of this custom attribute is already implemented by the type to which the current aspect is applied.
Public property | Description | A human-readable description of the current advice instance. (Inherited from AdviceInstance.)
Public property | InterfaceType | Gets the interface to be introduced into the target class.
Public property | LinesOfCodeAvoided | The number of lines of hand-written code avoided by this specific AdviceInstance. (Inherited from AdviceInstance.)
Public property | MasterAspectMember | (Overrides AdviceInstanceMasterAspectMember.)
Public property | OverrideAction | Specifies the action (Fail or Ignore) to be overtaken when the interface specified in the constructor of this custom attribute is already implemented by the type to which the current aspect is applied.
Top
See Also

Reference

PostSharp.Aspects.Advices Namespace
PostSharp.Aspects.AdvicesIAdviceProvider
PostSharp.Aspects.AdvicesIntroduceInterfaceAttribute


IntroduceInterfaceAdviceInstance Constructor

Initializes a new instance of the IntroduceInterfaceAdviceInstance class.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IntroduceInterfaceAdviceInstance(
    Type interfaceType,
    InterfaceOverrideAction overrideAction = InterfaceOverrideAction.Default,
    InterfaceOverrideAction ancestorOverrideAction = InterfaceOverrideAction.Default
)

Parameters

interfaceType
Type: SystemType
Interface to introduce to the target class. Must be implemented by the aspect class itself.
overrideAction (Optional)
Type: PostSharp.Aspects.AdvicesInterfaceOverrideAction
Specifies the action (Fail or Ignore) to be overtaken when the interface specified in the constructor of this custom attribute is already implemented by the type to which the current aspect is applied.
ancestorOverrideAction (Optional)
Type: PostSharp.Aspects.AdvicesInterfaceOverrideAction
Specifies the action (Fail or Ignore) to be overtaken when an ancestor of the interface specified in the constructor of this custom attribute is already implemented by the type to which the current aspect is applied.
See Also

Reference

IntroduceInterfaceAdviceInstance Class
PostSharp.Aspects.Advices Namespace


IntroduceInterfaceAdviceInstance Properties

The IntroduceInterfaceAdviceInstance type exposes the following members.

Properties
 | Name | Description
Public property | AncestorOverrideAction | Specifies the action (Fail or Ignore) to be overtaken when an ancestor of the interface specified in the constructor of this custom attribute is already implemented by the type to which the current aspect is applied.
Public property | Description | A human-readable description of the current advice instance. (Inherited from AdviceInstance.)
Public property | InterfaceType | Gets the interface to be introduced into the target class.
Public property | LinesOfCodeAvoided | The number of lines of hand-written code avoided by this specific AdviceInstance. (Inherited from AdviceInstance.)
Public property | MasterAspectMember | (Overrides AdviceInstanceMasterAspectMember.)
Public property | OverrideAction | Specifies the action (Fail or Ignore) to be overtaken when the interface specified in the constructor of this custom attribute is already implemented by the type to which the current aspect is applied.
Top
See Also

Reference

IntroduceInterfaceAdviceInstance Class
PostSharp.Aspects.Advices Namespace


IntroduceInterfaceAdviceInstance.AncestorOverrideAction Property

IntroduceInterfaceAdviceInstanceAncestorOverrideAction Property

Specifies the action (Fail or Ignore) to be overtaken when an ancestor of the interface specified in the constructor of this custom attribute is already implemented by the type to which the current aspect is applied.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public InterfaceOverrideAction AncestorOverrideAction { get; }

Property Value

Type: InterfaceOverrideAction
See Also

Reference

IntroduceInterfaceAdviceInstance Class
PostSharp.Aspects.Advices Namespace
IntroduceInterfaceAdviceInstanceOverrideAction


IntroduceInterfaceAdviceInstance.InterfaceType Property

IntroduceInterfaceAdviceInstanceInterfaceType Property

Gets the interface to be introduced into the target class.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Type InterfaceType { get; }

Property Value

Type: Type
See Also

Reference

IntroduceInterfaceAdviceInstance Class
PostSharp.Aspects.Advices Namespace


IntroduceInterfaceAdviceInstance.MasterAspectMember Property

IntroduceInterfaceAdviceInstanceMasterAspectMember Property

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Object MasterAspectMember { get; }

Property Value

Type: Object
See Also

Reference

IntroduceInterfaceAdviceInstance Class
PostSharp.Aspects.Advices Namespace


IntroduceInterfaceAdviceInstance.OverrideAction Property

IntroduceInterfaceAdviceInstanceOverrideAction Property

Specifies the action (Fail or Ignore) to be overtaken when the interface specified in the constructor of this custom attribute is already implemented by the type to which the current aspect is applied.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public InterfaceOverrideAction OverrideAction { get; }

Property Value

Type: InterfaceOverrideAction
See Also

Reference

IntroduceInterfaceAdviceInstance Class
PostSharp.Aspects.Advices Namespace
IntroduceInterfaceAdviceInstanceAncestorOverrideAction


IntroduceInterfaceAttribute Class

Custom attribute that, when applied to an aspect class, specifies that the aspect should introduce a given interface into the type to which the aspect is applied.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.AdvicesAdvice
PostSharp.Aspects.AdvicesIntroduceInterfaceAttribute

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class IntroduceInterfaceAttribute : Advice

The IntroduceInterfaceAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | IntroduceInterfaceAttribute | Initializes a new IntroduceInterfaceAttribute.
Top
Properties
 | Name | Description
Public property | AncestorOverrideAction | Specifies the action (Fail or Ignore) to be overtaken when an ancestor of the interface specified in the constructor of this custom attribute is already implemented by the type to which the current aspect is applied.
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | OverrideAction | Specifies the action (Fail or Ignore) to be overtaken when the interface specified in the constructor of this custom attribute is already implemented by the type to which the current aspect is applied.
Top
Remarks

The introduced interface will be implemented explicitly by the type to which the aspect is applied.

See Also

Reference

PostSharp.Aspects.Advices Namespace

Other Resources

Conceptual: Introducing Interfaces
Conceptual: Estimating Code Savings
Conceptual: Introducing Interfaces, Methods, Properties and Events into Existing Classes


IntroduceInterfaceAttribute Constructor

Initializes a new IntroduceInterfaceAttribute.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IntroduceInterfaceAttribute(
    Type interfaceType
)

Parameters

interfaceType
Type: SystemType
Interface that should be introduced into the types to which the aspect is applied.
See Also

Reference

IntroduceInterfaceAttribute Class
PostSharp.Aspects.Advices Namespace


IntroduceInterfaceAttribute Properties

The IntroduceInterfaceAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AncestorOverrideAction | Specifies the action (Fail or Ignore) to be overtaken when an ancestor of the interface specified in the constructor of this custom attribute is already implemented by the type to which the current aspect is applied.
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | OverrideAction | Specifies the action (Fail or Ignore) to be overtaken when the interface specified in the constructor of this custom attribute is already implemented by the type to which the current aspect is applied.
Top
See Also

Reference

IntroduceInterfaceAttribute Class
PostSharp.Aspects.Advices Namespace


IntroduceInterfaceAttribute.AncestorOverrideAction Property

IntroduceInterfaceAttributeAncestorOverrideAction Property

Specifies the action (Fail or Ignore) to be overtaken when an ancestor of the interface specified in the constructor of this custom attribute is already implemented by the type to which the current aspect is applied.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public InterfaceOverrideAction AncestorOverrideAction { get; set; }

Property Value

Type: InterfaceOverrideAction
See Also

Reference

IntroduceInterfaceAttribute Class
PostSharp.Aspects.Advices Namespace
IntroduceInterfaceAttributeOverrideAction


IntroduceInterfaceAttribute.OverrideAction Property

IntroduceInterfaceAttributeOverrideAction Property

Specifies the action (Fail or Ignore) to be overtaken when the interface specified in the constructor of this custom attribute is already implemented by the type to which the current aspect is applied.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public InterfaceOverrideAction OverrideAction { get; set; }

Property Value

Type: InterfaceOverrideAction
See Also

Reference

IntroduceInterfaceAttribute Class
PostSharp.Aspects.Advices Namespace
IntroduceInterfaceAttributeAncestorOverrideAction


IntroduceMemberAdviceInstance Class

Base class for IntroduceMethodAdviceInstance.
Inheritance Hierarchy
SystemObject
PostSharp.Aspects.AdvicesAdviceInstance
PostSharp.Aspects.AdvicesIntroduceMemberAdviceInstance
PostSharp.Aspects.AdvicesIntroduceMethodAdviceInstance

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class IntroduceMemberAdviceInstance : AdviceInstance

The IntroduceMemberAdviceInstance type exposes the following members.

Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice instance. (Inherited from AdviceInstance.)
Public property | IsVirtual | Determines whether the introduced member should be virtual.
Public property | LinesOfCodeAvoided | The number of lines of hand-written code avoided by this specific AdviceInstance. (Inherited from AdviceInstance.)
Public property | MasterAspectMember | Gets the main field or method of the aspect class that the current AdviceInstance relates to. (Inherited from AdviceInstance.)
Public property | OverrideAction | Determines the action to be overtaken when the member to be introduced already exists in the type to which the aspect is applied, or to a base type.
Public property | Visibility | Gets the visibility of the introduced member.
Top
See Also

Reference

PostSharp.Aspects.Advices Namespace


IntroduceMemberAdviceInstance Properties

The IntroduceMemberAdviceInstance type exposes the following members.

Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice instance. (Inherited from AdviceInstance.)
Public property | IsVirtual | Determines whether the introduced member should be virtual.
Public property | LinesOfCodeAvoided | The number of lines of hand-written code avoided by this specific AdviceInstance. (Inherited from AdviceInstance.)
Public property | MasterAspectMember | Gets the main field or method of the aspect class that the current AdviceInstance relates to. (Inherited from AdviceInstance.)
Public property | OverrideAction | Determines the action to be overtaken when the member to be introduced already exists in the type to which the aspect is applied, or to a base type.
Public property | Visibility | Gets the visibility of the introduced member.
Top
See Also

Reference

IntroduceMemberAdviceInstance Class
PostSharp.Aspects.Advices Namespace


IntroduceMemberAdviceInstance.IsVirtual Property

IntroduceMemberAdviceInstanceIsVirtual Property

Determines whether the introduced member should be virtual.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Nullable<bool> IsVirtual { get; }

Property Value

Type: Nullable Boolean
Remarks

When this property is false and the member already exists in a base type and is virtual, the member is overridden and marked as sealed.

When this property is set to null, the introduced member is virtual if it exists in a base type as a virtual member, otherwise non-virtual.

See Also

Reference

IntroduceMemberAdviceInstance Class
PostSharp.Aspects.Advices Namespace


IntroduceMemberAdviceInstance.OverrideAction Property

IntroduceMemberAdviceInstanceOverrideAction Property

Determines the action to be overtaken when the member to be introduced already exists in the type to which the aspect is applied, or to a base type.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MemberOverrideAction OverrideAction { get; }

Property Value

Type: MemberOverrideAction
See Also

Reference

IntroduceMemberAdviceInstance Class
PostSharp.Aspects.Advices Namespace


IntroduceMemberAdviceInstance.Visibility Property

IntroduceMemberAdviceInstanceVisibility Property

Gets the visibility of the introduced member.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Visibility Visibility { get; }

Property Value

Type: Visibility
See Also

Reference

IntroduceMemberAdviceInstance Class
PostSharp.Aspects.Advices Namespace


IntroduceMemberAttribute Class

Custom attribute that, when applied on a method, event or property of an aspect class, specifies that this method, event or property should be introduced into the types to which the aspect is applied.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.AdvicesAdvice
PostSharp.Aspects.AdvicesIntroduceMemberAttribute

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class IntroduceMemberAttribute : Advice

The IntroduceMemberAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | IntroduceMemberAttribute | Initializes a new instance of the IntroduceMemberAttribute class
Top
Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | IsIsVirtualSpecified | Determines whether the IsVirtual property has been specified.
Public property | IsVirtual | Determines whether the introduced member should be virtual.
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | OverrideAction | Determines the action to be overtaken when the member to be introduced already exists in the type to which the aspect is applied, or to a base type.
Public property | Visibility | Determines the visibility (Public, (Family, ...) of the introduced member.
Top
Remarks

Methods, properties and events annotated with IntroduceMemberAttribute must be public.

See Also

Reference

PostSharp.Aspects.Advices Namespace
PostSharp.Aspects.AdvicesCopyCustomAttributesAttribute

Other Resources

Conceptual: Introducing, Overriding and Importing Members
Conceptual: Accessing Members of the Target Class
Conceptual: Importing Dependencies from the Target Object
Conceptual: Introducing Interfaces, Methods, Properties and Events into Existing Classes


IntroduceMemberAttribute Constructor

Initializes a new instance of the IntroduceMemberAttribute class

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IntroduceMemberAttribute()
See Also

Reference

IntroduceMemberAttribute Class
PostSharp.Aspects.Advices Namespace


IntroduceMemberAttribute Properties

The IntroduceMemberAttribute type exposes the following members.

Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | IsIsVirtualSpecified | Determines whether the IsVirtual property has been specified.
Public property | IsVirtual | Determines whether the introduced member should be virtual.
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | OverrideAction | Determines the action to be overtaken when the member to be introduced already exists in the type to which the aspect is applied, or to a base type.
Public property | Visibility | Determines the visibility (Public, (Family, ...) of the introduced member.
Top
See Also

Reference

IntroduceMemberAttribute Class
PostSharp.Aspects.Advices Namespace


IntroduceMemberAttribute.IsIsVirtualSpecified Property

IntroduceMemberAttributeIsIsVirtualSpecified Property

Determines whether the IsVirtual property has been specified.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsIsVirtualSpecified { get; }

Property Value

Type: Boolean
See Also

Reference

IntroduceMemberAttribute Class
PostSharp.Aspects.Advices Namespace


IntroduceMemberAttribute.IsVirtual Property

IntroduceMemberAttributeIsVirtual Property

Determines whether the introduced member should be virtual.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsVirtual { get; set; }

Property Value

Type: Boolean
Remarks

Value of this property is ignored when the member to be introduced already exists in the aspect target type or its base type.

See Also

Reference

IntroduceMemberAttribute Class
PostSharp.Aspects.Advices Namespace

Other Resources

Conceptual: Introducing Interfaces, Methods, Properties and Events into Existing Classes


IntroduceMemberAttribute.OverrideAction Property

IntroduceMemberAttributeOverrideAction Property

Determines the action to be overtaken when the member to be introduced already exists in the type to which the aspect is applied, or to a base type.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MemberOverrideAction OverrideAction { get; set; }

Property Value

Type: MemberOverrideAction
See Also

Reference

IntroduceMemberAttribute Class
PostSharp.Aspects.Advices Namespace

Other Resources

Conceptual: Accessing Members of the Target Class
Conceptual: Introducing Interfaces, Methods, Properties and Events into Existing Classes


IntroduceMemberAttribute.Visibility Property

IntroduceMemberAttributeVisibility Property

Determines the visibility (Public, (Family, ...) of the introduced member.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Visibility Visibility { get; set; }

Property Value

Type: Visibility
See Also

Reference

IntroduceMemberAttribute Class
PostSharp.Aspects.Advices Namespace

Other Resources

Conceptual: Introducing Interfaces, Methods, Properties and Events into Existing Classes


IntroduceMethodAdviceInstance Class

Represents an advice that introduces a method of the aspect class into the target class.
Inheritance Hierarchy
SystemObject
PostSharp.Aspects.AdvicesAdviceInstance
PostSharp.Aspects.AdvicesIntroduceMemberAdviceInstance
PostSharp.Aspects.AdvicesIntroduceMethodAdviceInstance

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class IntroduceMethodAdviceInstance : IntroduceMemberAdviceInstance

The IntroduceMethodAdviceInstance type exposes the following members.

Constructors
 | Name | Description
Public method | IntroduceMethodAdviceInstance | Initializes a new instance of the IntroduceMethodAdviceInstance class.
Top
Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice instance. (Inherited from AdviceInstance.)
Public property | IsVirtual | Determines whether the introduced member should be virtual. (Inherited from IntroduceMemberAdviceInstance.)
Public property | LinesOfCodeAvoided | The number of lines of hand-written code avoided by this specific AdviceInstance. (Inherited from AdviceInstance.)
Public property | MasterAspectMember | Gets the main field or method of the aspect class that the current AdviceInstance relates to. (Overrides AdviceInstanceMasterAspectMember.)
Public property | OverrideAction | Determines the action to be overtaken when the member to be introduced already exists in the type to which the aspect is applied, or to a base type. (Inherited from IntroduceMemberAdviceInstance.)
Public property | Visibility | Gets the visibility of the introduced member. (Inherited from IntroduceMemberAdviceInstance.)
Top
See Also

Reference

PostSharp.Aspects.Advices Namespace
PostSharp.Aspects.AdvicesIAdviceProvider


IntroduceMethodAdviceInstance Constructor

Initializes a new instance of the IntroduceMethodAdviceInstance class.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IntroduceMethodAdviceInstance(
    MethodInfo method,
    Visibility visibility,
    Nullable<bool> isVirtual,
    MemberOverrideAction overrideAction
)

Parameters

method
Type: System.ReflectionMethodInfo
A public method of the aspect class.
visibility
Type: PostSharp.ReflectionVisibility
Visibility of the introduced method.
isVirtual
Type: SystemNullable Boolean
true if the introduced method should be virtual, false if it should be non-virtual (or sealed, if the method is overriding another one), or null if the method should be virtual only if the overridden method is also virtual. See IsVirtual for details.
overrideAction
Type: PostSharp.Aspects.AdvicesMemberOverrideAction
Determines the action to be overtaken when the member to be introduced already exists in the type to which the aspect is applied, or to a base type.
See Also

Reference

IntroduceMethodAdviceInstance Class
PostSharp.Aspects.Advices Namespace


IntroduceMethodAdviceInstance Properties

The IntroduceMethodAdviceInstance type exposes the following members.

Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice instance. (Inherited from AdviceInstance.)
Public property | IsVirtual | Determines whether the introduced member should be virtual. (Inherited from IntroduceMemberAdviceInstance.)
Public property | LinesOfCodeAvoided | The number of lines of hand-written code avoided by this specific AdviceInstance. (Inherited from AdviceInstance.)
Public property | MasterAspectMember | Gets the main field or method of the aspect class that the current AdviceInstance relates to. (Overrides AdviceInstanceMasterAspectMember.)
Public property | OverrideAction | Determines the action to be overtaken when the member to be introduced already exists in the type to which the aspect is applied, or to a base type. (Inherited from IntroduceMemberAdviceInstance.)
Public property | Visibility | Gets the visibility of the introduced member. (Inherited from IntroduceMemberAdviceInstance.)
Top
See Also

Reference

IntroduceMethodAdviceInstance Class
PostSharp.Aspects.Advices Namespace


IntroduceMethodAdviceInstance.MasterAspectMember Property

IntroduceMethodAdviceInstanceMasterAspectMember Property

Gets the main field or method of the aspect class that the current AdviceInstance relates to.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Object MasterAspectMember { get; }

Property Value

Type: Object
See Also

Reference

IntroduceMethodAdviceInstance Class
PostSharp.Aspects.Advices Namespace


IProperty Interface

A weakly-typed interface for the class.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IProperty

The IProperty type exposes the following members.

Methods
 | Name | Description
Public method | GetValue | Gets the property value.
Public method | SetValue | Sets the property value.
Top
See Also

Reference

PostSharp.Aspects.Advices Namespace
PostSharp.Aspects.AdvicesPropertyTValue


IProperty Methods

The IProperty type exposes the following members.

Methods
 | Name | Description
Public method | GetValue | Gets the property value.
Public method | SetValue | Sets the property value.
Top
See Also

Reference

IProperty Interface
PostSharp.Aspects.Advices Namespace


IProperty.GetValue Method

IPropertyGetValue Method

Gets the property value.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Object GetValue()

Return Value

Type: Object
The property value.
See Also

Reference

IProperty Interface
PostSharp.Aspects.Advices Namespace


IProperty.SetValue Method

IPropertySetValue Method

Sets the property value.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void SetValue(
    Object value
)

Parameters

value
Type: SystemObject
The new property value.
See Also

Reference

IProperty Interface
PostSharp.Aspects.Advices Namespace


LocationValidationAdvice Class

Custom attribute that, when applied on a method of an aspect class, specifies that this method has the same semantic as the ValidateValue(T, String, LocationKind, LocationValidationContext) method of the ILocationValidationAspectT interface.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.AdvicesAdvice
PostSharp.Aspects.AdvicesGroupingAdvice
PostSharp.Aspects.AdvicesLocationValidationAdvice

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class LocationValidationAdvice : GroupingAdvice

The LocationValidationAdvice type exposes the following members.

Constructors
 | Name | Description
Public method | LocationValidationAdvice | Initializes a new instance of the LocationValidationAdvice class
Top
Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | Master | Name of the master advice method. If this property is not set, the current method is itself the master of the group. Only master methods can define selectors (Pointcut) and dependencies (AspectDependencyAttribute). (Inherited from GroupingAdvice.)
Top
Remarks

The method to which this custom attribute is applied must be public and must have the same signature as ValidateValue(T, String, LocationKind, LocationValidationContext), where T can be any type. However, the method can be static.

See Also

Reference

PostSharp.Aspects.Advices Namespace
PostSharp.AspectsILocationValidationAspectT

Other Resources

Conceptual: Adding Behaviors to Members
Conceptual: Adding Behaviors to Existing Members


LocationValidationAdvice Constructor

Initializes a new instance of the LocationValidationAdvice class

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LocationValidationAdvice()
See Also

Reference

LocationValidationAdvice Class
PostSharp.Aspects.Advices Namespace


LocationValidationAdvice Properties

The LocationValidationAdvice type exposes the following members.

Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | Master | Name of the master advice method. If this property is not set, the current method is itself the master of the group. Only master methods can define selectors (Pointcut) and dependencies (AspectDependencyAttribute). (Inherited from GroupingAdvice.)
Top
See Also

Reference

LocationValidationAdvice Class
PostSharp.Aspects.Advices Namespace


MemberOverrideAction Enumeration

Enumeration of actions to be overtaken by the IntroduceMemberAttribute aspect extension when the member to be introduced already exists in the aspect target type or its base type.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum MemberOverrideAction
Members
Member name | Value | Description
Default | 0 | Fail
Fail | 0 | Emits a build time error.
Ignore | 1 | Silently ignore the member introduction.
OverrideOrFail | 2 | Tries to override the member, and fails if it is impossible (i.e. if the existing member is defined in a base type and is sealed or non-virtual).
OverrideOrIgnore | 3 | Tries to override the member, and silently ignore if it is impossible (i.e. if the existing member is defined in a base type and is sealed or non-virtual).
See Also

Reference

PostSharp.Aspects.Advices Namespace


MethodPointcut Class

Custom attribute that, when applied on an advice method, specifies the name of the method that will be invoked at build-time to return the set of elements of code to which the advice applies.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.AdvicesPointcut
PostSharp.Aspects.AdvicesMethodPointcut

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class MethodPointcut : Pointcut

The MethodPointcut type exposes the following members.

Constructors
 | Name | Description
Public method | MethodPointcut | Initializes a new MethodPointcut.
Top
Properties
 | Name | Description
Public property | MethodName | Gets the name of the method returning the set of code elements.
Top
Remarks

This method should have the signature IEnumerable<AdviceTargetType> SelectCodeElements(AspectTargetType target) , where AspectTargetType is either object either a reflection type corresponding to the kind of targets of the aspect (for instance System.Type for a type-level aspect), and AdviceTargetType is either object either a reflection type of the kind of targets of the advice (for instance System.MethodInfo for a method-level advice).

See Also

Reference

PostSharp.Aspects.Advices Namespace

Other Resources

Conceptual: Adding Behaviors to Members
Conceptual: Adding Behaviors to Existing Members
Conceptual: Customizing Aspect Description in Tooltips
Conceptual: Estimating Code Savings


MethodPointcut Constructor

Initializes a new MethodPointcut.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MethodPointcut(
    string methodName
)

Parameters

methodName
Type: SystemString
Name of the method returning the set of targets. This method should have a specific signature as discussed in the class documentation.
See Also

Reference

MethodPointcut Class
PostSharp.Aspects.Advices Namespace


MethodPointcut Properties

The MethodPointcut type exposes the following members.

Properties
 | Name | Description
Public property | MethodName | Gets the name of the method returning the set of code elements.
Top
See Also

Reference

MethodPointcut Class
PostSharp.Aspects.Advices Namespace


MethodPointcut.MethodName Property

MethodPointcutMethodName Property

Gets the name of the method returning the set of code elements.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string MethodName { get; }

Property Value

Type: String
See Also

Reference

MethodPointcut Class
PostSharp.Aspects.Advices Namespace


MulticastPointcut Class

Custom attribute that, when applied on an advice method, specifies to which elements of code this advice applies, based on the kind, name and attributes of code elements. Works similarly as MulticastAttribute.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.AdvicesPointcut
PostSharp.Aspects.AdvicesMulticastPointcut

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class MulticastPointcut : Pointcut

The MulticastPointcut type exposes the following members.

Constructors
 | Name | Description
Public method | MulticastPointcut | Initializes a new instance of the MulticastPointcut class
Top
Properties
 | Name | Description
Public property | Attributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies.
Public property | MemberName | Gets or sets the expression specifying to which members the aspect extension applies.
Public property | Targets | Gets or sets the kind of elements to which this aspect extension applies.
Top
Remarks
See Also

Reference

PostSharp.Aspects.Advices Namespace

Other Resources

Conceptual: Adding Behaviors to Members
Conceptual: Adding Behaviors to Existing Members


MulticastPointcut Constructor

Initializes a new instance of the MulticastPointcut class

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MulticastPointcut()
See Also

Reference

MulticastPointcut Class
PostSharp.Aspects.Advices Namespace


MulticastPointcut Properties

The MulticastPointcut type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies.
Public property | MemberName | Gets or sets the expression specifying to which members the aspect extension applies.
Public property | Targets | Gets or sets the kind of elements to which this aspect extension applies.
Top
See Also

Reference

MulticastPointcut Class
PostSharp.Aspects.Advices Namespace


MulticastPointcut.Attributes Property

MulticastPointcutAttributes Property

Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MulticastAttributes Attributes { get; set; }

Property Value

Type: MulticastAttributes
Remarks

The MulticastAttributes enumeration is a multi-part flag: there is one part for visibility, one for scope, one for virtuality, and one for implementation. If you specify one part, it will override the values defined on the custom attribute definition.

See Also

Reference

MulticastPointcut Class
PostSharp.Aspects.Advices Namespace


MulticastPointcut.MemberName Property

MulticastPointcutMemberName Property

Gets or sets the expression specifying to which members the aspect extension applies.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string MemberName { get; set; }

Property Value

Type: String
A wildcard or regular expression specifying to which members this instance applies, or null this instance applies either to all members whose kind is given in Targets. Regular expressions should start with the regex: prefix.
See Also

Reference

MulticastPointcut Class
PostSharp.Aspects.Advices Namespace


MulticastPointcut.Targets Property

MulticastPointcutTargets Property

Gets or sets the kind of elements to which this aspect extension applies.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MulticastTargets Targets { get; set; }

Property Value

Type: MulticastTargets
See Also

Reference

MulticastPointcut Class
PostSharp.Aspects.Advices Namespace


OnAspectsInitializedAdvice Class

Custom attribute that, when applied to a method of an aspect class, specifies that this method should be invoked after the instances of all the aspects applied on the same target has been initialized. The target method must have a void return value and have a single parameter of type AspectInitializationReason.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.AdvicesAdvice
PostSharp.Aspects.AdvicesOnAspectsInitializedAdvice

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class OnAspectsInitializedAdvice : Advice

The OnAspectsInitializedAdvice type exposes the following members.

Constructors
 | Name | Description
Public method | OnAspectsInitializedAdvice | Initializes a new instance of the OnAspectsInitializedAdvice class
Top
Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Top
Remarks
See Also

Reference

PostSharp.Aspects.Advices Namespace

Other Resources

Conceptual: What's New in PostSharp 4.2


OnAspectsInitializedAdvice Constructor

Initializes a new instance of the OnAspectsInitializedAdvice class

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public OnAspectsInitializedAdvice()
See Also

Reference

OnAspectsInitializedAdvice Class
PostSharp.Aspects.Advices Namespace


OnAspectsInitializedAdvice Properties

The OnAspectsInitializedAdvice type exposes the following members.

Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Top
See Also

Reference

OnAspectsInitializedAdvice Class
PostSharp.Aspects.Advices Namespace


OnEventAddHandlerAdvice Class

Custom attribute that, when applied on a method of an aspect class, specifies that this method is an advice having the same semantics as OnAddHandler(EventInterceptionArgs).
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.AdvicesAdvice
PostSharp.Aspects.AdvicesGroupingAdvice
PostSharp.Aspects.AdvicesOnEventAddHandlerAdvice

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class OnEventAddHandlerAdvice : GroupingAdvice

The OnEventAddHandlerAdvice type exposes the following members.

Constructors
 | Name | Description
Public method | OnEventAddHandlerAdvice | Initializes a new instance of the OnEventAddHandlerAdvice class
Top
Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | Master | Name of the master advice method. If this property is not set, the current method is itself the master of the group. Only master methods can define selectors (Pointcut) and dependencies (AspectDependencyAttribute). (Inherited from GroupingAdvice.)
Top
Remarks

The method to which this custom attribute is applied must be public and must have the same signature as OnAddHandler(EventInterceptionArgs). However, it can be static.

If an aspect defines many advices (among OnEventAddHandlerAdvice , OnEventRemoveHandlerAdvice and OnEventInvokeHandlerAdvice ) that are meant to be applied to the same events with consistent ordering, these advices should be grouped together (see Master property).

Note Note
Standalone advices or group masters should also be annotated by a custom attribute derived from Pointcut .

Note Note
Because of the way how the C# compiler implements automatic events (i.e. events where you don't implement the Add and Remove semantics manually), the Invoke Event Handler semantic ( OnInvokeHandler(EventInterceptionArgs) or equivalent) shall not be invoked for delegates that have been added from inside the class that declares this event.
See Also

Reference

PostSharp.Aspects.Advices Namespace
PostSharp.AspectsIEventInterceptionAspect
PostSharp.Aspects.AdvicesOnEventAddHandlerAdvice
PostSharp.Aspects.AdvicesOnEventInvokeHandlerAdvice
PostSharp.AspectsEventInterceptionAspect
PostSharp.Aspects.AdvicesOnEventRemoveHandlerAdvice
PostSharp.Aspects.AdvicesOnEventInvokeHandlerAdvice

Other Resources

Conceptual: Adding Behaviors to Members
Conceptual: Adding Behaviors to Existing Members


OnEventAddHandlerAdvice Constructor

Initializes a new instance of the OnEventAddHandlerAdvice class

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public OnEventAddHandlerAdvice()
See Also

Reference

OnEventAddHandlerAdvice Class
PostSharp.Aspects.Advices Namespace


OnEventAddHandlerAdvice Properties

The OnEventAddHandlerAdvice type exposes the following members.

Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | Master | Name of the master advice method. If this property is not set, the current method is itself the master of the group. Only master methods can define selectors (Pointcut) and dependencies (AspectDependencyAttribute). (Inherited from GroupingAdvice.)
Top
See Also

Reference

OnEventAddHandlerAdvice Class
PostSharp.Aspects.Advices Namespace


OnEventInvokeHandlerAdvice Class

Custom attribute that, when applied on a method of an aspect class, specifies that this method is an advice having the same semantics as OnInvokeHandler(EventInterceptionArgs).
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.AdvicesAdvice
PostSharp.Aspects.AdvicesGroupingAdvice
PostSharp.Aspects.AdvicesOnEventInvokeHandlerAdvice

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class OnEventInvokeHandlerAdvice : GroupingAdvice

The OnEventInvokeHandlerAdvice type exposes the following members.

Constructors
 | Name | Description
Public method | OnEventInvokeHandlerAdvice | Initializes a new instance of the OnEventInvokeHandlerAdvice class
Top
Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | Master | Name of the master advice method. If this property is not set, the current method is itself the master of the group. Only master methods can define selectors (Pointcut) and dependencies (AspectDependencyAttribute). (Inherited from GroupingAdvice.)
Top
Remarks

The method to which this custom attribute is applied must be public and must have the same signature as OnInvokeHandler(EventInterceptionArgs). However, it can be static.

If an aspect defines many advices (among OnEventAddHandlerAdvice , OnEventRemoveHandlerAdvice and OnEventInvokeHandlerAdvice ) that are meant to be applied to the same events with consistent ordering, these advices should be grouped together (see Master property).

Note Note
Standalone advices or group masters should also be annotated by a custom attribute derived from Pointcut .

Note Note
Because of the way how the C# compiler implements automatic events (i.e. events where you don't implement the Add and Remove semantics manually), the Invoke Event Handler semantic ( OnInvokeHandler(EventInterceptionArgs) or equivalent) shall not be invoked for delegates that have been added from inside the class that declares this event.
See Also

Reference

PostSharp.Aspects.Advices Namespace
PostSharp.AspectsIEventInterceptionAspect
PostSharp.Aspects.AdvicesOnEventAddHandlerAdvice
PostSharp.Aspects.AdvicesOnEventInvokeHandlerAdvice
PostSharp.AspectsEventInterceptionAspect
PostSharp.Aspects.AdvicesOnEventRemoveHandlerAdvice
PostSharp.Aspects.AdvicesOnEventAddHandlerAdvice

Other Resources

Conceptual: Adding Behaviors to Members
Conceptual: Adding Behaviors to Existing Members


OnEventInvokeHandlerAdvice Constructor

Initializes a new instance of the OnEventInvokeHandlerAdvice class

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public OnEventInvokeHandlerAdvice()
See Also

Reference

OnEventInvokeHandlerAdvice Class
PostSharp.Aspects.Advices Namespace


OnEventInvokeHandlerAdvice Properties

The OnEventInvokeHandlerAdvice type exposes the following members.

Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | Master | Name of the master advice method. If this property is not set, the current method is itself the master of the group. Only master methods can define selectors (Pointcut) and dependencies (AspectDependencyAttribute). (Inherited from GroupingAdvice.)
Top
See Also

Reference

OnEventInvokeHandlerAdvice Class
PostSharp.Aspects.Advices Namespace


OnEventRemoveHandlerAdvice Class

Custom attribute that, when applied on a method of an aspect class, specifies that this method is an advice having the same semantics as OnRemoveHandler(EventInterceptionArgs).
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.AdvicesAdvice
PostSharp.Aspects.AdvicesGroupingAdvice
PostSharp.Aspects.AdvicesOnEventRemoveHandlerAdvice

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class OnEventRemoveHandlerAdvice : GroupingAdvice

The OnEventRemoveHandlerAdvice type exposes the following members.

Constructors
 | Name | Description
Public method | OnEventRemoveHandlerAdvice | Initializes a new instance of the OnEventRemoveHandlerAdvice class
Top
Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | Master | Name of the master advice method. If this property is not set, the current method is itself the master of the group. Only master methods can define selectors (Pointcut) and dependencies (AspectDependencyAttribute). (Inherited from GroupingAdvice.)
Top
Remarks

The method to which this custom attribute is applied must be public and must have the same signature as OnRemoveHandler(EventInterceptionArgs). However, it can be static.

If an aspect defines many advices (among OnEventAddHandlerAdvice , OnEventRemoveHandlerAdvice and OnEventInvokeHandlerAdvice ) that are meant to be applied to the same events with consistent ordering, these advices should be grouped together (see Master property).

Note Note
Standalone advices or group masters should also be annotated by a custom attribute derived from Pointcut .

Note Note
Because of the way how the C# compiler implements automatic events (i.e. events where you don't implement the Add and Remove semantics manually), the Invoke Event Handler semantic ( OnInvokeHandler(EventInterceptionArgs) or equivalent) shall not be invoked for delegates that have been added from inside the class that declares this event.
Remarks
See Also

Reference

PostSharp.Aspects.Advices Namespace
PostSharp.AspectsIEventInterceptionAspect
PostSharp.Aspects.AdvicesOnEventAddHandlerAdvice
PostSharp.Aspects.AdvicesOnEventInvokeHandlerAdvice
PostSharp.AspectsEventInterceptionAspect
PostSharp.Aspects.AdvicesOnEventAddHandlerAdvice
PostSharp.Aspects.AdvicesOnEventInvokeHandlerAdvice

Other Resources

Conceptual: Adding Behaviors to Members
Conceptual: Adding Behaviors to Existing Members


OnEventRemoveHandlerAdvice Constructor

Initializes a new instance of the OnEventRemoveHandlerAdvice class

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public OnEventRemoveHandlerAdvice()
See Also

Reference

OnEventRemoveHandlerAdvice Class
PostSharp.Aspects.Advices Namespace


OnEventRemoveHandlerAdvice Properties

The OnEventRemoveHandlerAdvice type exposes the following members.

Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | Master | Name of the master advice method. If this property is not set, the current method is itself the master of the group. Only master methods can define selectors (Pointcut) and dependencies (AspectDependencyAttribute). (Inherited from GroupingAdvice.)
Top
See Also

Reference

OnEventRemoveHandlerAdvice Class
PostSharp.Aspects.Advices Namespace


OnInstanceConstructedAdvice Class

Custom attribute that, when applied to a method of an aspect implementing , specifies that this method should be executed after the last instance constructor of the target class of the aspect has completed execution. That is, this method will be invoked when the target object will be fully constructed. This custom attribute can be applied only on methods that have void return type and accepts no parameter.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.AdvicesAdvice
PostSharp.Aspects.AdvicesOnInstanceConstructedAdvice

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class OnInstanceConstructedAdvice : Advice

The OnInstanceConstructedAdvice type exposes the following members.

Constructors
 | Name | Description
Public method | OnInstanceConstructedAdvice | Initializes a new instance of the OnInstanceConstructedAdvice class
Top
Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Top
Remarks
See Also

Reference

PostSharp.Aspects.Advices Namespace
PostSharp.AspectsIInstanceScopedAspect

Other Resources

Conceptual: What's New in PostSharp 4.0


OnInstanceConstructedAdvice Constructor

Initializes a new instance of the OnInstanceConstructedAdvice class

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public OnInstanceConstructedAdvice()
See Also

Reference

OnInstanceConstructedAdvice Class
PostSharp.Aspects.Advices Namespace


OnInstanceConstructedAdvice Properties

The OnInstanceConstructedAdvice type exposes the following members.

Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Top
See Also

Reference

OnInstanceConstructedAdvice Class
PostSharp.Aspects.Advices Namespace


OnLocationGetValueAdvice Class

Custom attribute that, when applied on a method of an aspect class, specifies that this method is an advice having the same semantics as OnGetValue(LocationInterceptionArgs).
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.AdvicesAdvice
PostSharp.Aspects.AdvicesGroupingAdvice
PostSharp.Aspects.AdvicesOnLocationGetValueAdvice

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class OnLocationGetValueAdvice : GroupingAdvice

The OnLocationGetValueAdvice type exposes the following members.

Constructors
 | Name | Description
Public method | OnLocationGetValueAdvice | Initializes a new instance of the OnLocationGetValueAdvice class
Top
Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | Master | Name of the master advice method. If this property is not set, the current method is itself the master of the group. Only master methods can define selectors (Pointcut) and dependencies (AspectDependencyAttribute). (Inherited from GroupingAdvice.)
Top
Remarks

The method to which this custom attribute is applied must be public and must have the same signature as OnGetValue(LocationInterceptionArgs). However, it can be static.

If an aspect defines many advices (among OnLocationSetValueAdvice, OnLocationGetValueAdvice) and if these advices are meant to be applied to the same properties with consistent ordering, they should be grouped together (see Master property).

Standalone advices or group masters should also be annotated by a custom attribute derived from Pointcut.

See Also

Reference

PostSharp.Aspects.Advices Namespace
PostSharp.AspectsLocationLevelAspect
PostSharp.Aspects.AdvicesOnLocationSetValueAdvice

Other Resources

Conceptual: Adding Behaviors to Members
Conceptual: Adding Behaviors to Existing Members


OnLocationGetValueAdvice Constructor

Initializes a new instance of the OnLocationGetValueAdvice class

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public OnLocationGetValueAdvice()
See Also

Reference

OnLocationGetValueAdvice Class
PostSharp.Aspects.Advices Namespace


OnLocationGetValueAdvice Properties

The OnLocationGetValueAdvice type exposes the following members.

Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | Master | Name of the master advice method. If this property is not set, the current method is itself the master of the group. Only master methods can define selectors (Pointcut) and dependencies (AspectDependencyAttribute). (Inherited from GroupingAdvice.)
Top
See Also

Reference

OnLocationGetValueAdvice Class
PostSharp.Aspects.Advices Namespace


OnLocationSetValueAdvice Class

Custom attribute that, when applied on a method of an aspect class, specifies that this method is an advice having the same semantics as OnSetValue(LocationInterceptionArgs).
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.AdvicesAdvice
PostSharp.Aspects.AdvicesGroupingAdvice
PostSharp.Aspects.AdvicesOnLocationSetValueAdvice

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class OnLocationSetValueAdvice : GroupingAdvice

The OnLocationSetValueAdvice type exposes the following members.

Constructors
 | Name | Description
Public method | OnLocationSetValueAdvice | Initializes a new instance of the OnLocationSetValueAdvice class
Top
Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | Master | Name of the master advice method. If this property is not set, the current method is itself the master of the group. Only master methods can define selectors (Pointcut) and dependencies (AspectDependencyAttribute). (Inherited from GroupingAdvice.)
Top
Remarks

The method to which this custom attribute is applied must be public and must have the same signature as OnSetValue(LocationInterceptionArgs). However, it can be static.

If an aspect defines many advices (among OnLocationSetValueAdvice, OnLocationGetValueAdvice) and if these advices are meant to be applied to the same properties with consistent ordering, they should be grouped together (see Master property).

Standalone advices or group masters should also be annotated by a custom attribute derived from Pointcut.

See Also

Reference

PostSharp.Aspects.Advices Namespace
PostSharp.AspectsLocationLevelAspect
PostSharp.Aspects.AdvicesOnLocationGetValueAdvice

Other Resources

Conceptual: Adding Behaviors to Members
Conceptual: Adding Behaviors to Existing Members


OnLocationSetValueAdvice Constructor

Initializes a new instance of the OnLocationSetValueAdvice class

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public OnLocationSetValueAdvice()
See Also

Reference

OnLocationSetValueAdvice Class
PostSharp.Aspects.Advices Namespace


OnLocationSetValueAdvice Properties

The OnLocationSetValueAdvice type exposes the following members.

Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | Master | Name of the master advice method. If this property is not set, the current method is itself the master of the group. Only master methods can define selectors (Pointcut) and dependencies (AspectDependencyAttribute). (Inherited from GroupingAdvice.)
Top
See Also

Reference

OnLocationSetValueAdvice Class
PostSharp.Aspects.Advices Namespace


OnMethodBoundaryAdvice Class

Base class for OnMethodEntryAdvice, OnMethodExceptionAdvice, OnMethodSuccessAdvice or OnMethodExitAdvice.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.AdvicesAdvice
PostSharp.Aspects.AdvicesGroupingAdvice
PostSharp.Aspects.AdvicesOnMethodBoundaryAdvice
More...

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class OnMethodBoundaryAdvice : GroupingAdvice

The OnMethodBoundaryAdvice type exposes the following members.

Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | Master | Name of the master advice method. If this property is not set, the current method is itself the master of the group. Only master methods can define selectors (Pointcut) and dependencies (AspectDependencyAttribute). (Inherited from GroupingAdvice.)
Public property | SemanticallyAdvisedMethodKinds | Determines which target methods will be advised semantically. This affects the behavior of the advice when it's applied to iterator or async methods, which are compiled into state machines.
Public property | UnsupportedTargetAction | Specifies the action to take when the advice is applied to an unsupported target method.
Top
Remarks
See Also

Reference

PostSharp.Aspects.Advices Namespace
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.AdvicesAdvice
PostSharp.Aspects.AdvicesGroupingAdvice
PostSharp.Aspects.AdvicesOnMethodBoundaryAdvice
PostSharp.Aspects.AdvicesOnMethodEntryAdvice
PostSharp.Aspects.AdvicesOnMethodExceptionAdvice
PostSharp.Aspects.AdvicesOnMethodExitAdvice
PostSharp.Aspects.AdvicesOnMethodResumeAdvice
PostSharp.Aspects.AdvicesOnMethodSuccessAdvice
PostSharp.Aspects.AdvicesOnMethodYieldAdvice


OnMethodBoundaryAdvice Properties

The OnMethodBoundaryAdvice type exposes the following members.

Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | Master | Name of the master advice method. If this property is not set, the current method is itself the master of the group. Only master methods can define selectors (Pointcut) and dependencies (AspectDependencyAttribute). (Inherited from GroupingAdvice.)
Public property | SemanticallyAdvisedMethodKinds | Determines which target methods will be advised semantically. This affects the behavior of the advice when it's applied to iterator or async methods, which are compiled into state machines.
Public property | UnsupportedTargetAction | Specifies the action to take when the advice is applied to an unsupported target method.
Top
See Also

Reference

OnMethodBoundaryAdvice Class
PostSharp.Aspects.Advices Namespace


OnMethodBoundaryAdvice.SemanticallyAdvisedMethodKinds Property

OnMethodBoundaryAdviceSemanticallyAdvisedMethodKinds Property

Determines which target methods will be advised semantically. This affects the behavior of the advice when it's applied to iterator or async methods, which are compiled into state machines.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SemanticallyAdvisedMethodKinds SemanticallyAdvisedMethodKinds { get; set; }

Property Value

Type: SemanticallyAdvisedMethodKinds
Remarks

Semantic advising results in an aspect that is consistent with the level of abstraction of the programming language. This is the default behavior. You can disable semantic advising using this property to be consistent with the level of abstraction of MSIL and for backward-compatibility with the versions of PostSharp prior to 3.1.

See Also

Reference

OnMethodBoundaryAdvice Class
PostSharp.Aspects.Advices Namespace


OnMethodBoundaryAdvice.UnsupportedTargetAction Property

OnMethodBoundaryAdviceUnsupportedTargetAction Property

Specifies the action to take when the advice is applied to an unsupported target method.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public UnsupportedTargetAction UnsupportedTargetAction { get; set; }

Property Value

Type: UnsupportedTargetAction
See Also

Reference

OnMethodBoundaryAdvice Class
PostSharp.Aspects.Advices Namespace


OnMethodEntryAdvice Class

Custom attribute that, when applied on a method of an aspect class, specifies that this method is an advice having the same semantics as OnEntry(MethodExecutionArgs).
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.AdvicesAdvice
PostSharp.Aspects.AdvicesGroupingAdvice
PostSharp.Aspects.AdvicesOnMethodBoundaryAdvice
PostSharp.Aspects.AdvicesOnMethodEntryAdvice

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class OnMethodEntryAdvice : OnMethodBoundaryAdvice

The OnMethodEntryAdvice type exposes the following members.

Constructors
 | Name | Description
Public method | OnMethodEntryAdvice | Initializes a new instance of the OnMethodEntryAdvice class
Top
Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | Master | Name of the master advice method. If this property is not set, the current method is itself the master of the group. Only master methods can define selectors (Pointcut) and dependencies (AspectDependencyAttribute). (Inherited from GroupingAdvice.)
Public property | SemanticallyAdvisedMethodKinds | Determines which target methods will be advised semantically. This affects the behavior of the advice when it's applied to iterator or async methods, which are compiled into state machines. (Inherited from OnMethodBoundaryAdvice.)
Public property | UnsupportedTargetAction | Specifies the action to take when the advice is applied to an unsupported target method. (Inherited from OnMethodBoundaryAdvice.)
Top
Remarks

The method to which this custom attribute is applied must be public and must have the same signature as OnEntry(MethodExecutionArgs). However, it can be static.

If an aspect defines many advices (among OnMethodEntryAdvice , OnMethodExitAdvice , OnMethodSuccessAdvice and OnMethodExceptionAdvice ) that are meant to be applied to the same methods with consistent ordering, these advices should be grouped together (see Master property).

Note Note
Standalone advices or group masters should also be annotated by a custom attribute derived from Pointcut .
See Also

Reference

PostSharp.Aspects.Advices Namespace
PostSharp.AspectsOnMethodBoundaryAspect
PostSharp.Aspects.AdvicesOnMethodExitAdvice
PostSharp.Aspects.AdvicesOnMethodSuccessAdvice
PostSharp.Aspects.AdvicesOnMethodExceptionAdvice
PostSharp.Aspects.AdvicesOnMethodYieldAdvice
PostSharp.Aspects.AdvicesOnMethodResumeAdvice

Other Resources

Conceptual: Adding Behaviors to Members
Conceptual: Adding Behaviors to Existing Members
Conceptual: Customizing Aspect Description in Tooltips
Conceptual: Estimating Code Savings


OnMethodEntryAdvice Constructor

Initializes a new instance of the OnMethodEntryAdvice class

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public OnMethodEntryAdvice()
See Also

Reference

OnMethodEntryAdvice Class
PostSharp.Aspects.Advices Namespace


OnMethodEntryAdvice Properties

The OnMethodEntryAdvice type exposes the following members.

Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | Master | Name of the master advice method. If this property is not set, the current method is itself the master of the group. Only master methods can define selectors (Pointcut) and dependencies (AspectDependencyAttribute). (Inherited from GroupingAdvice.)
Public property | SemanticallyAdvisedMethodKinds | Determines which target methods will be advised semantically. This affects the behavior of the advice when it's applied to iterator or async methods, which are compiled into state machines. (Inherited from OnMethodBoundaryAdvice.)
Public property | UnsupportedTargetAction | Specifies the action to take when the advice is applied to an unsupported target method. (Inherited from OnMethodBoundaryAdvice.)
Top
See Also

Reference

OnMethodEntryAdvice Class
PostSharp.Aspects.Advices Namespace


OnMethodExceptionAdvice Class

Custom attribute that, when applied on a method of an aspect class, specifies that this method is an advice having the same semantics as OnException(MethodExecutionArgs).
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.AdvicesAdvice
PostSharp.Aspects.AdvicesGroupingAdvice
PostSharp.Aspects.AdvicesOnMethodBoundaryAdvice
PostSharp.Aspects.AdvicesOnMethodExceptionAdvice

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class OnMethodExceptionAdvice : OnMethodBoundaryAdvice

The OnMethodExceptionAdvice type exposes the following members.

Constructors
 | Name | Description
Public method | OnMethodExceptionAdvice | Initializes a new instance of the OnMethodExceptionAdvice class
Top
Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | Master | Name of the master advice method. If this property is not set, the current method is itself the master of the group. Only master methods can define selectors (Pointcut) and dependencies (AspectDependencyAttribute). (Inherited from GroupingAdvice.)
Public property | SemanticallyAdvisedMethodKinds | Determines which target methods will be advised semantically. This affects the behavior of the advice when it's applied to iterator or async methods, which are compiled into state machines. (Inherited from OnMethodBoundaryAdvice.)
Public property | UnsupportedTargetAction | Specifies the action to take when the advice is applied to an unsupported target method. (Inherited from OnMethodBoundaryAdvice.)
Top
Remarks

The method to which this custom attribute is applied must be public and must have the same signature as OnException(MethodExecutionArgs). However, it can be static.

If an aspect defines many advices (among OnMethodEntryAdvice , OnMethodExitAdvice , OnMethodSuccessAdvice and OnMethodExceptionAdvice ) that are meant to be applied to the same methods with consistent ordering, these advices should be grouped together (see Master property).

Note Note
Standalone advices or group masters should also be annotated by a custom attribute derived from Pointcut .
See Also

Reference

PostSharp.Aspects.Advices Namespace
PostSharp.AspectsOnMethodBoundaryAspect
PostSharp.Aspects.AdvicesOnMethodExitAdvice
PostSharp.Aspects.AdvicesOnMethodSuccessAdvice
PostSharp.Aspects.AdvicesOnMethodEntryAdvice

Other Resources

Conceptual: Adding Behaviors to Members
Conceptual: Adding Behaviors to Existing Members


OnMethodExceptionAdvice Constructor

Initializes a new instance of the OnMethodExceptionAdvice class

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public OnMethodExceptionAdvice()
See Also

Reference

OnMethodExceptionAdvice Class
PostSharp.Aspects.Advices Namespace


OnMethodExceptionAdvice Properties

The OnMethodExceptionAdvice type exposes the following members.

Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | Master | Name of the master advice method. If this property is not set, the current method is itself the master of the group. Only master methods can define selectors (Pointcut) and dependencies (AspectDependencyAttribute). (Inherited from GroupingAdvice.)
Public property | SemanticallyAdvisedMethodKinds | Determines which target methods will be advised semantically. This affects the behavior of the advice when it's applied to iterator or async methods, which are compiled into state machines. (Inherited from OnMethodBoundaryAdvice.)
Public property | UnsupportedTargetAction | Specifies the action to take when the advice is applied to an unsupported target method. (Inherited from OnMethodBoundaryAdvice.)
Top
See Also

Reference

OnMethodExceptionAdvice Class
PostSharp.Aspects.Advices Namespace


OnMethodExitAdvice Class

Custom attribute that, when applied on a method of an aspect class, specifies that this method is an advice having the same semantics as OnExit(MethodExecutionArgs).
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.AdvicesAdvice
PostSharp.Aspects.AdvicesGroupingAdvice
PostSharp.Aspects.AdvicesOnMethodBoundaryAdvice
PostSharp.Aspects.AdvicesOnMethodExitAdvice

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class OnMethodExitAdvice : OnMethodBoundaryAdvice

The OnMethodExitAdvice type exposes the following members.

Constructors
 | Name | Description
Public method | OnMethodExitAdvice | Initializes a new instance of the OnMethodExitAdvice class
Top
Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | Master | Name of the master advice method. If this property is not set, the current method is itself the master of the group. Only master methods can define selectors (Pointcut) and dependencies (AspectDependencyAttribute). (Inherited from GroupingAdvice.)
Public property | SemanticallyAdvisedMethodKinds | Determines which target methods will be advised semantically. This affects the behavior of the advice when it's applied to iterator or async methods, which are compiled into state machines. (Inherited from OnMethodBoundaryAdvice.)
Public property | UnsupportedTargetAction | Specifies the action to take when the advice is applied to an unsupported target method. (Inherited from OnMethodBoundaryAdvice.)
Top
Remarks

The method to which this custom attribute is applied must be public and must have the same signature as OnExit(MethodExecutionArgs). However, it can be static.

If an aspect defines many advices (among OnMethodEntryAdvice , OnMethodExitAdvice , OnMethodSuccessAdvice and OnMethodExceptionAdvice ) that are meant to be applied to the same methods with consistent ordering, these advices should be grouped together (see Master property).

Note Note
Standalone advices or group masters should also be annotated by a custom attribute derived from Pointcut .
See Also

Reference

PostSharp.Aspects.Advices Namespace
PostSharp.AspectsOnMethodBoundaryAspect
PostSharp.Aspects.AdvicesOnMethodExceptionAdvice
PostSharp.Aspects.AdvicesOnMethodSuccessAdvice
PostSharp.Aspects.AdvicesOnMethodEntryAdvice

Other Resources

Conceptual: Adding Behaviors to Members
Conceptual: Adding Behaviors to Existing Members


OnMethodExitAdvice Constructor

Initializes a new instance of the OnMethodExitAdvice class

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public OnMethodExitAdvice()
See Also

Reference

OnMethodExitAdvice Class
PostSharp.Aspects.Advices Namespace


OnMethodExitAdvice Properties

The OnMethodExitAdvice type exposes the following members.

Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | Master | Name of the master advice method. If this property is not set, the current method is itself the master of the group. Only master methods can define selectors (Pointcut) and dependencies (AspectDependencyAttribute). (Inherited from GroupingAdvice.)
Public property | SemanticallyAdvisedMethodKinds | Determines which target methods will be advised semantically. This affects the behavior of the advice when it's applied to iterator or async methods, which are compiled into state machines. (Inherited from OnMethodBoundaryAdvice.)
Public property | UnsupportedTargetAction | Specifies the action to take when the advice is applied to an unsupported target method. (Inherited from OnMethodBoundaryAdvice.)
Top
See Also

Reference

OnMethodExitAdvice Class
PostSharp.Aspects.Advices Namespace


OnMethodInvokeAdvice Class

Custom attribute that, when applied on a method of an aspect class, specifies that this method is an advice having the same semantics as OnInvoke(MethodInterceptionArgs).
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.AdvicesAdvice
PostSharp.Aspects.AdvicesGroupingAdvice
PostSharp.Aspects.AdvicesOnMethodInvokeBaseAdvice
PostSharp.Aspects.AdvicesOnMethodInvokeAdvice

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class OnMethodInvokeAdvice : OnMethodInvokeBaseAdvice

The OnMethodInvokeAdvice type exposes the following members.

Constructors
 | Name | Description
Public method | OnMethodInvokeAdvice | Initializes a new instance of the OnMethodInvokeAdvice class
Top
Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | Master | Name of the master advice method. If this property is not set, the current method is itself the master of the group. Only master methods can define selectors (Pointcut) and dependencies (AspectDependencyAttribute). (Inherited from GroupingAdvice.)
Public property | SemanticallyAdvisedMethodKinds | Determines which target methods will be advised semantically. This affects the behavior of the advice when it's applied to iterator or async methods, which are compiled into state machines. (Inherited from OnMethodInvokeBaseAdvice.)
Public property | UnsupportedTargetAction | Specifies the action to take when the advice is applied to an async method with unsupported return value type. (Inherited from OnMethodInvokeBaseAdvice.)
Top
Remarks

The method to which this custom attribute is applied must be public and must have the same signature as OnInvoke(MethodInterceptionArgs). However, it can be static.

See Also

Reference

PostSharp.Aspects.Advices Namespace
PostSharp.AspectsMethodInterceptionAspect

Other Resources

Conceptual: Adding Behaviors to Members
Conceptual: Adding Behaviors to Existing Members


OnMethodInvokeAdvice Constructor

Initializes a new instance of the OnMethodInvokeAdvice class

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public OnMethodInvokeAdvice()
See Also

Reference

OnMethodInvokeAdvice Class
PostSharp.Aspects.Advices Namespace


OnMethodInvokeAdvice Properties

The OnMethodInvokeAdvice type exposes the following members.

Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | Master | Name of the master advice method. If this property is not set, the current method is itself the master of the group. Only master methods can define selectors (Pointcut) and dependencies (AspectDependencyAttribute). (Inherited from GroupingAdvice.)
Public property | SemanticallyAdvisedMethodKinds | Determines which target methods will be advised semantically. This affects the behavior of the advice when it's applied to iterator or async methods, which are compiled into state machines. (Inherited from OnMethodInvokeBaseAdvice.)
Public property | UnsupportedTargetAction | Specifies the action to take when the advice is applied to an async method with unsupported return value type. (Inherited from OnMethodInvokeBaseAdvice.)
Top
See Also

Reference

OnMethodInvokeAdvice Class
PostSharp.Aspects.Advices Namespace


OnMethodInvokeAsyncAdvice Class

Custom attribute that, when applied on a method of an aspect class, specifies that this method is an advice having the same semantics as OnInvokeAsync(MethodInterceptionArgs).
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.AdvicesAdvice
PostSharp.Aspects.AdvicesGroupingAdvice
PostSharp.Aspects.AdvicesOnMethodInvokeBaseAdvice
PostSharp.Aspects.AdvicesOnMethodInvokeAsyncAdvice

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class OnMethodInvokeAsyncAdvice : OnMethodInvokeBaseAdvice

The OnMethodInvokeAsyncAdvice type exposes the following members.

Constructors
 | Name | Description
Public method | OnMethodInvokeAsyncAdvice | Initializes a new instance of the OnMethodInvokeAsyncAdvice class
Top
Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | Master | Name of the master advice method. If this property is not set, the current method is itself the master of the group. Only master methods can define selectors (Pointcut) and dependencies (AspectDependencyAttribute). (Inherited from GroupingAdvice.)
Public property | SemanticallyAdvisedMethodKinds | Determines which target methods will be advised semantically. This affects the behavior of the advice when it's applied to iterator or async methods, which are compiled into state machines. (Inherited from OnMethodInvokeBaseAdvice.)
Public property | UnsupportedTargetAction | Specifies the action to take when the advice is applied to an async method with unsupported return value type. (Inherited from OnMethodInvokeBaseAdvice.)
Top
Remarks

The method to which this custom attribute is applied must be public and must have the same signature as OnInvokeAsync(MethodInterceptionArgs). However, it can be static.

See Also

Reference

PostSharp.Aspects.Advices Namespace
PostSharp.AspectsMethodInterceptionAspect

Other Resources

Conceptual: Adding Behaviors to Members


OnMethodInvokeAsyncAdvice Constructor

Initializes a new instance of the OnMethodInvokeAsyncAdvice class

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public OnMethodInvokeAsyncAdvice()
See Also

Reference

OnMethodInvokeAsyncAdvice Class
PostSharp.Aspects.Advices Namespace


OnMethodInvokeAsyncAdvice Properties

The OnMethodInvokeAsyncAdvice type exposes the following members.

Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | Master | Name of the master advice method. If this property is not set, the current method is itself the master of the group. Only master methods can define selectors (Pointcut) and dependencies (AspectDependencyAttribute). (Inherited from GroupingAdvice.)
Public property | SemanticallyAdvisedMethodKinds | Determines which target methods will be advised semantically. This affects the behavior of the advice when it's applied to iterator or async methods, which are compiled into state machines. (Inherited from OnMethodInvokeBaseAdvice.)
Public property | UnsupportedTargetAction | Specifies the action to take when the advice is applied to an async method with unsupported return value type. (Inherited from OnMethodInvokeBaseAdvice.)
Top
See Also

Reference

OnMethodInvokeAsyncAdvice Class
PostSharp.Aspects.Advices Namespace


OnMethodInvokeBaseAdvice Class

The base class for method interception advices.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.AdvicesAdvice
PostSharp.Aspects.AdvicesGroupingAdvice
PostSharp.Aspects.AdvicesOnMethodInvokeBaseAdvice
PostSharp.Aspects.AdvicesOnMethodInvokeAdvice
PostSharp.Aspects.AdvicesOnMethodInvokeAsyncAdvice

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class OnMethodInvokeBaseAdvice : GroupingAdvice

The OnMethodInvokeBaseAdvice type exposes the following members.

Constructors
 | Name | Description
Protected method | OnMethodInvokeBaseAdvice | Initializes a new instance of the OnMethodInvokeBaseAdvice class
Top
Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | Master | Name of the master advice method. If this property is not set, the current method is itself the master of the group. Only master methods can define selectors (Pointcut) and dependencies (AspectDependencyAttribute). (Inherited from GroupingAdvice.)
Public property | SemanticallyAdvisedMethodKinds | Determines which target methods will be advised semantically. This affects the behavior of the advice when it's applied to iterator or async methods, which are compiled into state machines.
Public property | UnsupportedTargetAction | Specifies the action to take when the advice is applied to an async method with unsupported return value type.
Top
See Also

Reference

PostSharp.Aspects.Advices Namespace


OnMethodInvokeBaseAdvice Constructor

Initializes a new instance of the OnMethodInvokeBaseAdvice class

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected OnMethodInvokeBaseAdvice()
See Also

Reference

OnMethodInvokeBaseAdvice Class
PostSharp.Aspects.Advices Namespace


OnMethodInvokeBaseAdvice Properties

The OnMethodInvokeBaseAdvice type exposes the following members.

Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | Master | Name of the master advice method. If this property is not set, the current method is itself the master of the group. Only master methods can define selectors (Pointcut) and dependencies (AspectDependencyAttribute). (Inherited from GroupingAdvice.)
Public property | SemanticallyAdvisedMethodKinds | Determines which target methods will be advised semantically. This affects the behavior of the advice when it's applied to iterator or async methods, which are compiled into state machines.
Public property | UnsupportedTargetAction | Specifies the action to take when the advice is applied to an async method with unsupported return value type.
Top
See Also

Reference

OnMethodInvokeBaseAdvice Class
PostSharp.Aspects.Advices Namespace


OnMethodInvokeBaseAdvice.SemanticallyAdvisedMethodKinds Property

OnMethodInvokeBaseAdviceSemanticallyAdvisedMethodKinds Property

Determines which target methods will be advised semantically. This affects the behavior of the advice when it's applied to iterator or async methods, which are compiled into state machines.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SemanticallyAdvisedMethodKinds SemanticallyAdvisedMethodKinds { get; set; }

Property Value

Type: SemanticallyAdvisedMethodKinds
Remarks

Semantic advising results in an aspect that is consistent with the level of abstraction of the programming language. This is the default behavior. You can disable semantic advising using this property to be consistent with the level of abstraction of MSIL and for backward-compatibility with the versions of PostSharp prior to 3.1.

See Also

Reference

OnMethodInvokeBaseAdvice Class
PostSharp.Aspects.Advices Namespace


OnMethodInvokeBaseAdvice.UnsupportedTargetAction Property

OnMethodInvokeBaseAdviceUnsupportedTargetAction Property

Specifies the action to take when the advice is applied to an async method with unsupported return value type.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public UnsupportedTargetAction UnsupportedTargetAction { get; set; }

Property Value

Type: UnsupportedTargetAction
Remarks

Starting with C#7 async methods can have return types other than Task or TaskTResult. Async method interception does not support this type of async methods. By default, the build error is raised whenever async method interception is applied to a method that returns awaitable type other than Task or TaskTResult.

Set this property to change how unsupported async methods are handled during compile time.

See Also

Reference

OnMethodInvokeBaseAdvice Class
PostSharp.Aspects.Advices Namespace


OnMethodResumeAdvice Class

Custom attribute that, when applied on a method of an aspect class, specifies that this method is an advice having the same semantics as OnResume(MethodExecutionArgs).
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.AdvicesAdvice
PostSharp.Aspects.AdvicesGroupingAdvice
PostSharp.Aspects.AdvicesOnMethodBoundaryAdvice
PostSharp.Aspects.AdvicesOnMethodResumeAdvice

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class OnMethodResumeAdvice : OnMethodBoundaryAdvice

The OnMethodResumeAdvice type exposes the following members.

Constructors
 | Name | Description
Public method | OnMethodResumeAdvice | Initializes a new instance of the OnMethodResumeAdvice class
Top
Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | Master | Name of the master advice method. If this property is not set, the current method is itself the master of the group. Only master methods can define selectors (Pointcut) and dependencies (AspectDependencyAttribute). (Inherited from GroupingAdvice.)
Public property | SemanticallyAdvisedMethodKinds | Determines which target methods will be advised semantically. This affects the behavior of the advice when it's applied to iterator or async methods, which are compiled into state machines. (Inherited from OnMethodBoundaryAdvice.)
Public property | UnsupportedTargetAction | Specifies the action to take when the advice is applied to an unsupported target method. (Inherited from OnMethodBoundaryAdvice.)
Top
Remarks

The method to which this custom attribute is applied must be public and must have the same signature as OnResume(MethodExecutionArgs). However, it can be static.

If an aspect defines many advices (among OnMethodEntryAdvice , OnMethodExitAdvice , OnMethodSuccessAdvice and OnMethodExceptionAdvice ) that are meant to be applied to the same methods with consistent ordering, these advices should be grouped together (see Master property).

Note Note
Standalone advices or group masters should also be annotated by a custom attribute derived from Pointcut .
See Also

Reference

PostSharp.Aspects.Advices Namespace
PostSharp.Aspects.AdvicesOnMethodEntryAdvice
PostSharp.AspectsOnMethodBoundaryAspect
PostSharp.Aspects.AdvicesOnMethodExitAdvice
PostSharp.Aspects.AdvicesOnMethodSuccessAdvice
PostSharp.Aspects.AdvicesOnMethodExceptionAdvice
PostSharp.Aspects.AdvicesOnMethodYieldAdvice

Other Resources

Conceptual: Adding Behaviors to Members


OnMethodResumeAdvice Constructor

Initializes a new instance of the OnMethodResumeAdvice class

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public OnMethodResumeAdvice()
See Also

Reference

OnMethodResumeAdvice Class
PostSharp.Aspects.Advices Namespace


OnMethodResumeAdvice Properties

The OnMethodResumeAdvice type exposes the following members.

Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | Master | Name of the master advice method. If this property is not set, the current method is itself the master of the group. Only master methods can define selectors (Pointcut) and dependencies (AspectDependencyAttribute). (Inherited from GroupingAdvice.)
Public property | SemanticallyAdvisedMethodKinds | Determines which target methods will be advised semantically. This affects the behavior of the advice when it's applied to iterator or async methods, which are compiled into state machines. (Inherited from OnMethodBoundaryAdvice.)
Public property | UnsupportedTargetAction | Specifies the action to take when the advice is applied to an unsupported target method. (Inherited from OnMethodBoundaryAdvice.)
Top
See Also

Reference

OnMethodResumeAdvice Class
PostSharp.Aspects.Advices Namespace


OnMethodSuccessAdvice Class

Custom attribute that, when applied on a method of an aspect class, specifies that this method is an advice having the same semantics as OnSuccess(MethodExecutionArgs).
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.AdvicesAdvice
PostSharp.Aspects.AdvicesGroupingAdvice
PostSharp.Aspects.AdvicesOnMethodBoundaryAdvice
PostSharp.Aspects.AdvicesOnMethodSuccessAdvice

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class OnMethodSuccessAdvice : OnMethodBoundaryAdvice

The OnMethodSuccessAdvice type exposes the following members.

Constructors
 | Name | Description
Public method | OnMethodSuccessAdvice | Initializes a new instance of the OnMethodSuccessAdvice class
Top
Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | Master | Name of the master advice method. If this property is not set, the current method is itself the master of the group. Only master methods can define selectors (Pointcut) and dependencies (AspectDependencyAttribute). (Inherited from GroupingAdvice.)
Public property | SemanticallyAdvisedMethodKinds | Determines which target methods will be advised semantically. This affects the behavior of the advice when it's applied to iterator or async methods, which are compiled into state machines. (Inherited from OnMethodBoundaryAdvice.)
Public property | UnsupportedTargetAction | Specifies the action to take when the advice is applied to an unsupported target method. (Inherited from OnMethodBoundaryAdvice.)
Top
Remarks

The method to which this custom attribute is applied must be public and must have the same signature as OnSuccess(MethodExecutionArgs). However, it can be static.

If an aspect defines many advices (among OnMethodEntryAdvice , OnMethodExitAdvice , OnMethodSuccessAdvice and OnMethodExceptionAdvice ) that are meant to be applied to the same methods with consistent ordering, these advices should be grouped together (see Master property).

Note Note
Standalone advices or group masters should also be annotated by a custom attribute derived from Pointcut .
See Also

Reference

PostSharp.Aspects.Advices Namespace
PostSharp.AspectsOnMethodBoundaryAspect
PostSharp.Aspects.AdvicesOnMethodExitAdvice
PostSharp.Aspects.AdvicesOnMethodExceptionAdvice
PostSharp.Aspects.AdvicesOnMethodEntryAdvice

Other Resources

Conceptual: Adding Behaviors to Members
Conceptual: Adding Behaviors to Existing Members


OnMethodSuccessAdvice Constructor

Initializes a new instance of the OnMethodSuccessAdvice class

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public OnMethodSuccessAdvice()
See Also

Reference

OnMethodSuccessAdvice Class
PostSharp.Aspects.Advices Namespace


OnMethodSuccessAdvice Properties

The OnMethodSuccessAdvice type exposes the following members.

Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | Master | Name of the master advice method. If this property is not set, the current method is itself the master of the group. Only master methods can define selectors (Pointcut) and dependencies (AspectDependencyAttribute). (Inherited from GroupingAdvice.)
Public property | SemanticallyAdvisedMethodKinds | Determines which target methods will be advised semantically. This affects the behavior of the advice when it's applied to iterator or async methods, which are compiled into state machines. (Inherited from OnMethodBoundaryAdvice.)
Public property | UnsupportedTargetAction | Specifies the action to take when the advice is applied to an unsupported target method. (Inherited from OnMethodBoundaryAdvice.)
Top
See Also

Reference

OnMethodSuccessAdvice Class
PostSharp.Aspects.Advices Namespace


OnMethodYieldAdvice Class

Custom attribute that, when applied on a method of an aspect class, specifies that this method is an advice having the same semantics as OnYield(MethodExecutionArgs).
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.AdvicesAdvice
PostSharp.Aspects.AdvicesGroupingAdvice
PostSharp.Aspects.AdvicesOnMethodBoundaryAdvice
PostSharp.Aspects.AdvicesOnMethodYieldAdvice

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class OnMethodYieldAdvice : OnMethodBoundaryAdvice

The OnMethodYieldAdvice type exposes the following members.

Constructors
 | Name | Description
Public method | OnMethodYieldAdvice | Initializes a new instance of the OnMethodYieldAdvice class
Top
Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | Master | Name of the master advice method. If this property is not set, the current method is itself the master of the group. Only master methods can define selectors (Pointcut) and dependencies (AspectDependencyAttribute). (Inherited from GroupingAdvice.)
Public property | SemanticallyAdvisedMethodKinds | Determines which target methods will be advised semantically. This affects the behavior of the advice when it's applied to iterator or async methods, which are compiled into state machines. (Inherited from OnMethodBoundaryAdvice.)
Public property | UnsupportedTargetAction | Specifies the action to take when the advice is applied to an unsupported target method. (Inherited from OnMethodBoundaryAdvice.)
Top
Remarks

The method to which this custom attribute is applied must be public and must have the same signature as OnYield(MethodExecutionArgs). However, it can be static.

If an aspect defines many advices (among OnMethodEntryAdvice , OnMethodExitAdvice , OnMethodSuccessAdvice and OnMethodExceptionAdvice ) that are meant to be applied to the same methods with consistent ordering, these advices should be grouped together (see Master property).

Note Note
Standalone advices or group masters should also be annotated by a custom attribute derived from Pointcut .
See Also

Reference

PostSharp.Aspects.Advices Namespace
PostSharp.AspectsOnMethodBoundaryAspect
PostSharp.Aspects.AdvicesOnMethodEntryAdvice
PostSharp.Aspects.AdvicesOnMethodExitAdvice
PostSharp.Aspects.AdvicesOnMethodSuccessAdvice
PostSharp.Aspects.AdvicesOnMethodExceptionAdvice
PostSharp.Aspects.AdvicesOnMethodResumeAdvice

Other Resources

Conceptual: Adding Behaviors to Members


OnMethodYieldAdvice Constructor

Initializes a new instance of the OnMethodYieldAdvice class

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public OnMethodYieldAdvice()
See Also

Reference

OnMethodYieldAdvice Class
PostSharp.Aspects.Advices Namespace


OnMethodYieldAdvice Properties

The OnMethodYieldAdvice type exposes the following members.

Properties
 | Name | Description
Public property | Description | A human-readable description of the current advice. (Inherited from Advice.)
Public property | LinesOfCodeAvoided | Reduction in the code lines count achieved by applying the advice instance to one code element. (Inherited from Advice.)
Public property | Master | Name of the master advice method. If this property is not set, the current method is itself the master of the group. Only master methods can define selectors (Pointcut) and dependencies (AspectDependencyAttribute). (Inherited from GroupingAdvice.)
Public property | SemanticallyAdvisedMethodKinds | Determines which target methods will be advised semantically. This affects the behavior of the advice when it's applied to iterator or async methods, which are compiled into state machines. (Inherited from OnMethodBoundaryAdvice.)
Public property | UnsupportedTargetAction | Specifies the action to take when the advice is applied to an unsupported target method. (Inherited from OnMethodBoundaryAdvice.)
Top
See Also

Reference

OnMethodYieldAdvice Class
PostSharp.Aspects.Advices Namespace


Pointcut Class

Custom attribute, typically accompanying an advice, specifying to which code elements the advice applies.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.AdvicesPointcut
PostSharp.Aspects.AdvicesMethodPointcut
PostSharp.Aspects.AdvicesMulticastPointcut
PostSharp.Aspects.AdvicesSelfPointcut
PostSharp.Aspects.AdvicesSignaturePointcut

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class Pointcut : Attribute

The Pointcut type exposes the following members.

Constructors
 | Name | Description
Protected method | Pointcut | Initializes a new instance of the Pointcut class
Top
Remarks
See Also

Reference

PostSharp.Aspects.Advices Namespace

Other Resources

Conceptual: Adding Behaviors to Members


Pointcut Constructor

Initializes a new instance of the Pointcut class

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected Pointcut()
See Also

Reference

Pointcut Class
PostSharp.Aspects.Advices Namespace


Property(TValue) Class

PropertyTValue Class

Exposes the semantics of a parameterless property for use with the ImportMemberAttribute aspect extension.
Inheritance Hierarchy
SystemObject
PostSharp.Aspects.AdvicesPropertyTValue

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public sealed class Property<TValue> : IProperty

Type Parameters

TValue
Property value type.

The PropertyTValue type exposes the following members.

Properties
 | Name | Description
Public property | Get | Gets a delegate enabling to invoke the get accessor of the imported property.
Public property | Set | Gets a delegate enabling to invoke the set accessor of the imported property.
Top
Remarks
See Also

Reference

PostSharp.Aspects.Advices Namespace
PostSharp.Aspects.AdvicesPropertyTValue, TIndex
PostSharp.Aspects.AdvicesPropertyGetterTValue
PostSharp.Aspects.AdvicesPropertySetterTValue
PostSharp.Aspects.AdvicesImportMemberAttribute

Other Resources

Conceptual: Introducing, Overriding and Importing Members
Conceptual: Accessing Members of the Target Class


Property(TValue) Properties

PropertyTValue Properties

The PropertyTValue generic type exposes the following members.

Properties
 | Name | Description
Public property | Get | Gets a delegate enabling to invoke the get accessor of the imported property.
Public property | Set | Gets a delegate enabling to invoke the set accessor of the imported property.
Top
See Also

Reference

PropertyTValue Class
PostSharp.Aspects.Advices Namespace


Property(TValue).Get Property

PropertyTValueGet Property

Gets a delegate enabling to invoke the get accessor of the imported property.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public PropertyGetter<TValue> Get { get; }

Property Value

Type: PropertyGetter TValue
See Also

Reference

PropertyTValue Class
PostSharp.Aspects.Advices Namespace

Other Resources

Conceptual: Accessing Members of the Target Class


Property(TValue).Set Property

PropertyTValueSet Property

Gets a delegate enabling to invoke the set accessor of the imported property.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public PropertySetter<TValue> Set { get; }

Property Value

Type: PropertySetter TValue
See Also

Reference

PropertyTValue Class
PostSharp.Aspects.Advices Namespace

Other Resources

Conceptual: Accessing Members of the Target Class


Property(TValue, TIndex) Class

PropertyTValue, TIndex Class

Mimics the semantics of a property accepting a single index parameter, for use with the ImportMemberAttribute aspect extension.
Inheritance Hierarchy
SystemObject
PostSharp.Aspects.AdvicesPropertyTValue, TIndex

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public sealed class Property<TValue, TIndex>

Type Parameters

TValue
Property value type.
TIndex
Property index type.

The PropertyTValue, TIndex type exposes the following members.

Properties
 | Name | Description
Public property | Get | Gets a delegate enabling to invoke the get accessor of the imported property.
Public property | Set | Gets a delegate enabling to invoke the set accessor of the imported property.
Top
See Also

Reference

PostSharp.Aspects.Advices Namespace
PostSharp.Aspects.AdvicesPropertyTValue
PostSharp.Aspects.AdvicesPropertyGetterTValue, TIndex
PostSharp.Aspects.AdvicesPropertySetterTValue, TIndex

Other Resources

Conceptual: Accessing Members of the Target Class


Property(TValue, TIndex) Properties

PropertyTValue, TIndex Properties

The PropertyTValue, TIndex generic type exposes the following members.

Properties
 | Name | Description
Public property | Get | Gets a delegate enabling to invoke the get accessor of the imported property.
Public property | Set | Gets a delegate enabling to invoke the set accessor of the imported property.
Top
See Also

Reference

PropertyTValue, TIndex Class
PostSharp.Aspects.Advices Namespace


Property(TValue, TIndex).Get Property

PropertyTValue, TIndexGet Property

Gets a delegate enabling to invoke the get accessor of the imported property.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public PropertyGetter<TValue, TIndex> Get { get; }

Property Value

Type: PropertyGetter TValue, TIndex
See Also

Reference

PropertyTValue, TIndex Class
PostSharp.Aspects.Advices Namespace


Property(TValue, TIndex).Set Property

PropertyTValue, TIndexSet Property

Gets a delegate enabling to invoke the set accessor of the imported property.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public PropertySetter<TValue, TIndex> Set { get; }

Property Value

Type: PropertySetter TValue, TIndex
See Also

Reference

PropertyTValue, TIndex Class
PostSharp.Aspects.Advices Namespace


PropertyGetter(TValue) Delegate

PropertyGetterTValue Delegate

Defines the signature of methods implementing the Get semantic of a parameterless property.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public delegate TValue PropertyGetter<TValue>()

Type Parameters

TValue
Property value type.

Return Value

Type: TValue
The property value.
See Also

Reference

PostSharp.Aspects.Advices Namespace
PostSharp.Aspects.AdvicesPropertyTValue


PropertyGetter(TValue, TIndex) Delegate

PropertyGetterTValue, TIndex Delegate

Defines the signature of methods implementing the Get semantic of a property with a single index parameter.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public delegate TValue PropertyGetter<TValue, TIndex>(
    TIndex index
)

Parameters

index
Type: TIndex
Index.

Type Parameters

TValue
Property value type.
TIndex
Property index type.

Return Value

Type: TValue
The property value.
See Also

Reference

PostSharp.Aspects.Advices Namespace
PostSharp.Aspects.AdvicesPropertyTValue, TIndex


PropertySetter(TValue) Delegate

PropertySetterTValue Delegate

Defines the signature of methods implementing the Set semantic of a parameterless property.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public delegate void PropertySetter<TValue>(
    TValue value
)

Parameters

value
Type: TValue
The property value.

Type Parameters

TValue
Property value type.
See Also

Reference

PostSharp.Aspects.Advices Namespace
PostSharp.Aspects.AdvicesPropertyTValue


PropertySetter(TValue, TIndex) Delegate

PropertySetterTValue, TIndex Delegate

Defines the signature of methods implementing the Set semantic of a property with a single index parameter.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public delegate void PropertySetter<TValue, TIndex>(
    TIndex index,
    TValue value
)

Parameters

index
Type: TIndex
Index.
value
Type: TValue
The property value.

Type Parameters

TValue
Property value type.
TIndex
Property index type.
See Also

Reference

PostSharp.Aspects.Advices Namespace
PostSharp.Aspects.AdvicesPropertyTValue, TIndex


SelfPointcut Class

Pointcut that selects exactly the aspect target.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.AdvicesPointcut
PostSharp.Aspects.AdvicesSelfPointcut

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class SelfPointcut : Pointcut

The SelfPointcut type exposes the following members.

Constructors
 | Name | Description
Public method | SelfPointcut | Initializes a new instance of the SelfPointcut class
Top
Remarks
See Also

Reference

PostSharp.Aspects.Advices Namespace

Other Resources

Conceptual: Adding Behaviors to Members
Conceptual: Adding Behaviors to Existing Members


SelfPointcut Constructor

Initializes a new instance of the SelfPointcut class

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SelfPointcut()
See Also

Reference

SelfPointcut Class
PostSharp.Aspects.Advices Namespace


SignaturePointcut Class

A Pointcut that matches target methods by name and signature. This works only with non-generic methods.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.AdvicesPointcut
PostSharp.Aspects.AdvicesSignaturePointcut

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class SignaturePointcut : Pointcut

The SignaturePointcut type exposes the following members.

Constructors
 | Name | Description
Public method | SignaturePointcut | Initializes a new SignaturePointcut.
Top
Properties
 | Name | Description
Public property | ArgumentTypes | Gets the exact types of parameters of the target method.
Public property | Name | Gets the name of the target method.
Top
See Also

Reference

PostSharp.Aspects.Advices Namespace


SignaturePointcut Constructor

Initializes a new SignaturePointcut.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SignaturePointcut(
    string name,
    params Type[] parameterTypes
)

Parameters

name
Type: SystemString
The name of the target method.
parameterTypes
Type: SystemType
The exact type of parameters of this method.
See Also

Reference

SignaturePointcut Class
PostSharp.Aspects.Advices Namespace


SignaturePointcut Properties

The SignaturePointcut type exposes the following members.

Properties
 | Name | Description
Public property | ArgumentTypes | Gets the exact types of parameters of the target method.
Public property | Name | Gets the name of the target method.
Top
See Also

Reference

SignaturePointcut Class
PostSharp.Aspects.Advices Namespace


SignaturePointcut.ArgumentTypes Property

SignaturePointcutArgumentTypes Property

Gets the exact types of parameters of the target method.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Type[] ArgumentTypes { get; }

Property Value

Type: Type
See Also

Reference

SignaturePointcut Class
PostSharp.Aspects.Advices Namespace


SignaturePointcut.Name Property

SignaturePointcutName Property

Gets the name of the target method.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string Name { get; }

Property Value

Type: String
See Also

Reference

SignaturePointcut Class
PostSharp.Aspects.Advices Namespace


PostSharp.Aspects.Configuration Namespace

The PostSharp.Aspects.Configuration namespace contains classes and custom attributes configuring the aspects of the PostSharp.Aspects namespace.
Classes
 | Class | Description
Public class | AspectConfiguration | Configuration of an IAspect.
Public class | AspectConfigurationAttribute | Configures an aspect of type IAspect.
Public class | AspectConfigurationAttributeTypeAttribute | Custom attribute that, when applied to an aspect, specifies which custom attribute type (derived from AspectConfigurationAttribute) can provide declarative configuration for the aspect.
Public class | CompositionAspectConfiguration | Configuration of aspects of type ICompositionAspect.
Public class | CompositionAspectConfigurationAttribute | Custom attribute that, when applied on a class implementing ICompositionAspect, defines the declarative configuration of that aspect.
Public class | CustomAttributeIntroductionAspectConfiguration | Configuration of aspects of type CustomAttributeIntroductionAspect.
Public class | EventInterceptionAspectConfiguration | Configuration of aspects of type IEventInterceptionAspect.
Public class | EventInterceptionAspectConfigurationAttribute | Custom attribute that, when applied on a class implementing IEventInterceptionAspect, defines the declarative configuration of that aspect.
Public class | LocationInterceptionAspectConfiguration | Configuration of aspects of type ILocationLevelAspect.
Public class | LocationInterceptionAspectConfigurationAttribute | Custom attribute that, when applied on a class implementing ILocationInterceptionAspect, defines the declarative configuration of that aspect.
Public class | ManagedResourceIntroductionAspectConfiguration | Configuration of aspects of type ManagedResourceIntroductionAspect.
Public class | MethodInterceptionAspectConfiguration | Configuration of aspects of type IMethodInterceptionAspect.
Public class | MethodInterceptionAspectConfigurationAttribute | Custom attribute that, when applied on a class implementing IMethodInterceptionAspect, defines the declarative configuration of that aspect.
Public class | OnExceptionAspectConfiguration | Configuration of the IOnExceptionAspect aspect.
Public class | OnExceptionAspectConfigurationAttribute | Custom attribute that, when applied on a class implementing IOnExceptionAspect, defines the configuration of that aspect.
Public class | OnMethodBoundaryAspectConfiguration | Configuration of the IOnMethodBoundaryAspect aspect.
Public class | OnMethodBoundaryAspectConfigurationAttribute | Custom attribute that, when applied on a class implementing IOnMethodBoundaryAspect, defines the configuration of that aspect.


AspectConfiguration Class

Configuration of an IAspect.
Inheritance Hierarchy
SystemObject
PostSharp.Aspects.ConfigurationAspectConfiguration
More...

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class AspectConfiguration

The AspectConfiguration type exposes the following members.

Constructors
 | Name | Description
Public method | AspectConfiguration | Initializes a new instance of the AspectConfiguration class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the aspect priority. Aspects with smaller priority are processed first. The default priority is zero.
Public property | Dependencies | Gets or sets the collection of dependencies.
Public property | SerializerType | Gets or sets the type of the serializer that will be used to configure the current aspect.
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element.
Top
Remarks
Every concrete aspect class has a corresponding configuration class derived from AspectConfiguration.
See Also

Reference

PostSharp.Aspects.Configuration Namespace

Other Resources

Conceptual: Configuring Aspects
Inheritance Hierarchy
SystemObject
PostSharp.Aspects.ConfigurationAspectConfiguration
PostSharp.Aspects.ConfigurationCompositionAspectConfiguration
PostSharp.Aspects.ConfigurationCustomAttributeIntroductionAspectConfiguration
PostSharp.Aspects.ConfigurationEventInterceptionAspectConfiguration
PostSharp.Aspects.ConfigurationLocationInterceptionAspectConfiguration
PostSharp.Aspects.ConfigurationManagedResourceIntroductionAspectConfiguration
PostSharp.Aspects.ConfigurationMethodInterceptionAspectConfiguration
PostSharp.Aspects.ConfigurationOnExceptionAspectConfiguration
PostSharp.Aspects.ConfigurationOnMethodBoundaryAspectConfiguration


AspectConfiguration Constructor

Initializes a new instance of the AspectConfiguration class

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AspectConfiguration()
See Also

Reference

AspectConfiguration Class
PostSharp.Aspects.Configuration Namespace


AspectConfiguration Properties

The AspectConfiguration type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the aspect priority. Aspects with smaller priority are processed first. The default priority is zero.
Public property | Dependencies | Gets or sets the collection of dependencies.
Public property | SerializerType | Gets or sets the type of the serializer that will be used to configure the current aspect.
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element.
Top
See Also

Reference

AspectConfiguration Class
PostSharp.Aspects.Configuration Namespace


AspectConfiguration.AspectPriority Property

AspectConfigurationAspectPriority Property

Gets or sets the aspect priority. Aspects with smaller priority are processed first. The default priority is zero.

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Nullable<int> AspectPriority { get; set; }

Property Value

Type: Nullable Int32
Remarks
Whenever possible, use dependencies (Dependencies collection) to specify the ordering of aspects. Unlike priorities, dependencies scale up in complexity, which can be important in larger projects.
See Also

Reference

AspectConfiguration Class
PostSharp.Aspects.Configuration Namespace

Other Resources

Conceptual: Coping with Several Aspects on the Same Target


AspectConfiguration.Dependencies Property

AspectConfigurationDependencies Property

Gets or sets the collection of dependencies.

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AspectDependencyAttributeCollection Dependencies { get; set; }

Property Value

Type: AspectDependencyAttributeCollection
See Also

Reference

AspectConfiguration Class
PostSharp.Aspects.Configuration Namespace


AspectConfiguration.SerializerType Property

AspectConfigurationSerializerType Property

Gets or sets the type of the serializer that will be used to configure the current aspect.

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TypeIdentity SerializerType { get; set; }

Property Value

Type: TypeIdentity
Remarks
The type assigned to this property must derive from the AspectSerializer class and have a default constructor. Use MsilAspectSerializer to specify that the aspect will not be serialized, but will be constructed using MSIL instructions.
See Also

Reference

AspectConfiguration Class
PostSharp.Aspects.Configuration Namespace

Other Resources

Conceptual: Understanding Aspect Serialization


AspectConfiguration.UnsupportedTargetAction Property

AspectConfigurationUnsupportedTargetAction Property

Specifies the action to take when the aspect is applied to an unsupported target element.

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Nullable<UnsupportedTargetAction> UnsupportedTargetAction { get; set; }

Property Value

Type: Nullable UnsupportedTargetAction
See Also

Reference

AspectConfiguration Class
PostSharp.Aspects.Configuration Namespace


AspectConfigurationAttribute Class

Configures an aspect of type IAspect.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.ConfigurationAspectConfigurationAttribute
More...

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class AspectConfigurationAttribute : Attribute

The AspectConfigurationAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | AspectConfigurationAttribute | Initializes a new instance of the AspectConfigurationAttribute class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect.
Public property | SerializerType | Gets or sets the Type of the serializer that will be used to configure the current aspect.
Top
Methods
 | Name | Description
Protected method | CreateAspectConfiguration | Creates a concrete AspectConfiguration instance specifically for the current AspectConfigurationAttribute type.
Public method | GetAspectConfiguration | Gets the AspectConfiguration corresponding to the current custom attribute.
Protected method | SetAspectConfiguration | Sets up an AspectConfiguration object according to the current custom attribute instance.
Top
See Also

Reference

PostSharp.Aspects.Configuration Namespace

Other Resources

Conceptual: Configuring Aspects
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.ConfigurationAspectConfigurationAttribute
PostSharp.Aspects.ConfigurationCompositionAspectConfigurationAttribute
PostSharp.Aspects.ConfigurationEventInterceptionAspectConfigurationAttribute
PostSharp.Aspects.ConfigurationLocationInterceptionAspectConfigurationAttribute
PostSharp.Aspects.ConfigurationMethodInterceptionAspectConfigurationAttribute
PostSharp.Aspects.ConfigurationOnExceptionAspectConfigurationAttribute
PostSharp.Aspects.ConfigurationOnMethodBoundaryAspectConfigurationAttribute


AspectConfigurationAttribute Constructor

Initializes a new instance of the AspectConfigurationAttribute class

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AspectConfigurationAttribute()
See Also

Reference

AspectConfigurationAttribute Class
PostSharp.Aspects.Configuration Namespace


AspectConfigurationAttribute Properties

The AspectConfigurationAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect.
Public property | SerializerType | Gets or sets the Type of the serializer that will be used to configure the current aspect.
Top
See Also

Reference

AspectConfigurationAttribute Class
PostSharp.Aspects.Configuration Namespace


AspectConfigurationAttribute.AspectPriority Property

AspectConfigurationAttributeAspectPriority Property

Gets or sets the weaving priority of the aspect.

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int AspectPriority { get; set; }

Property Value

Type: Int32
The aspect priority, or null if the aspect priority is not specified.
Remarks

Advices with lower priority are executed before in case of 'entry' semantics (entering or invoking a method, setting a field value), but this order is inverted for advices of 'exit' semantics (leaving a method, getting a field value).

This property must not be confused with AttributePriority, which solely influences the multicasting process.

See Also

Reference

AspectConfigurationAttribute Class
PostSharp.Aspects.Configuration Namespace


AspectConfigurationAttribute.SerializerType Property

AspectConfigurationAttributeSerializerType Property

Gets or sets the Type of the serializer that will be used to configure the current aspect.

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Type SerializerType { get; set; }

Property Value

Type: Type
Remarks

The type assigned to this property must derive from the AspectSerializer class and have a default constructor. Use MsilAspectSerializer to specify that the aspect will not be serialized, but will be constructed using MSIL instructions.

See Also

Reference

AspectConfigurationAttribute Class
PostSharp.Aspects.Configuration Namespace


AspectConfigurationAttribute Methods

The AspectConfigurationAttribute type exposes the following members.

Methods
 | Name | Description
Protected method | CreateAspectConfiguration | Creates a concrete AspectConfiguration instance specifically for the current AspectConfigurationAttribute type.
Public method | GetAspectConfiguration | Gets the AspectConfiguration corresponding to the current custom attribute.
Protected method | SetAspectConfiguration | Sets up an AspectConfiguration object according to the current custom attribute instance.
Top
See Also

Reference

AspectConfigurationAttribute Class
PostSharp.Aspects.Configuration Namespace


AspectConfigurationAttribute.CreateAspectConfiguration Method

AspectConfigurationAttributeCreateAspectConfiguration Method

Creates a concrete AspectConfiguration instance specifically for the current AspectConfigurationAttribute type.

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual AspectConfiguration CreateAspectConfiguration()

Return Value

Type: AspectConfiguration
A new and empty instance of AspectConfiguration, whose concrete type corresponds to the concrete type of the AspectConfigurationAttribute.
Remarks
This method should not set up the returned AspectConfiguration. After the current method has returned, the SetAspectConfiguration(AspectConfiguration) method will be invoked, and this method is responsible for setting up the AspectConfigurationobject.
See Also

Reference

AspectConfigurationAttribute Class
PostSharp.Aspects.Configuration Namespace


AspectConfigurationAttribute.GetAspectConfiguration Method

AspectConfigurationAttributeGetAspectConfiguration Method

Gets the AspectConfiguration corresponding to the current custom attribute.

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AspectConfiguration GetAspectConfiguration()

Return Value

Type: AspectConfiguration
An AspectConfiguration corresponding to the current custom attribute.
Remarks

This method can be customized by overriding CreateAspectConfiguration and/or SetAspectConfiguration(AspectConfiguration)

.
See Also

Reference

AspectConfigurationAttribute Class
PostSharp.Aspects.Configuration Namespace


AspectConfigurationAttribute.SetAspectConfiguration Method

AspectConfigurationAttributeSetAspectConfiguration Method

Sets up an AspectConfiguration object according to the current custom attribute instance.

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void SetAspectConfiguration(
    AspectConfiguration aspectConfiguration
)

Parameters

aspectConfiguration
Type: PostSharp.Aspects.ConfigurationAspectConfiguration
The AspectConfiguration instance previously returned by the CreateAspectConfiguration method.
Remarks

Classes overriding this method must always invoke the base implementation before performing their own changes to the AspectConfiguration.

See Also

Reference

AspectConfigurationAttribute Class
PostSharp.Aspects.Configuration Namespace


AspectConfigurationAttributeTypeAttribute Class

Custom attribute that, when applied to an aspect, specifies which custom attribute type (derived from AspectConfigurationAttribute) can provide declarative configuration for the aspect.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.ConfigurationAspectConfigurationAttributeTypeAttribute

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class AspectConfigurationAttributeTypeAttribute : Attribute

The AspectConfigurationAttributeTypeAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | AspectConfigurationAttributeTypeAttribute | Initializes a new AspectConfigurationAttribute.
Top
See Also

Reference

PostSharp.Aspects.Configuration Namespace


AspectConfigurationAttributeTypeAttribute Constructor

Initializes a new AspectConfigurationAttribute.

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AspectConfigurationAttributeTypeAttribute(
    Type type
)

Parameters

type
Type: SystemType
Custom attribute type (derived from AspectConfigurationAttribute).
See Also

Reference

AspectConfigurationAttributeTypeAttribute Class
PostSharp.Aspects.Configuration Namespace


CompositionAspectConfiguration Class

Configuration of aspects of type ICompositionAspect.
Inheritance Hierarchy
SystemObject
PostSharp.Aspects.ConfigurationAspectConfiguration
PostSharp.Aspects.ConfigurationCompositionAspectConfiguration

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class CompositionAspectConfiguration : AspectConfiguration

The CompositionAspectConfiguration type exposes the following members.

Constructors
 | Name | Description
Public method | CompositionAspectConfiguration | Initializes a new instance of the CompositionAspectConfiguration class
Top
Properties
 | Name | Description
Public property | AncestorOverrideAction | Specifies the action (Fail or Ignore) to be overtaken when an ancestor of one of the interfaces specified by PublicInterfaces is already implemented by the type to which the current aspect is applied.
Public property | AspectPriority | Gets or sets the aspect priority. Aspects with smaller priority are processed first. The default priority is zero. (Inherited from AspectConfiguration.)
Public property | Dependencies | Gets or sets the collection of dependencies. (Inherited from AspectConfiguration.)
Public property | GenerateImplementationAccessor | Determines whether the interface [!:IComposed<T>] should be introduced into the type to which the aspect is applied for each interface specified by the PublicInterfaces property.
Public property | NonSerializedImplementation | Determines whether the field containing the interface implementation (and storing the object returned by CreateImplementationObject(AdviceArgs)) should be excluded from serialization by BinaryFormatter. The same effect is typically obtained by applying the NonSerializedAttribute custom attribute to the field.
Public property | OverrideAction | Specifies the action (Fail or Ignore) to be overtaken when one of the interfaces specified by PublicInterfaces is already implemented by the type to which the aspect is applied.
Public property | PublicInterfaces | Gets or sets the array of interfaces that should be introduced publicly into the target type of the aspect.
Public property | SerializerType | Gets or sets the type of the serializer that will be used to configure the current aspect. (Inherited from AspectConfiguration.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from AspectConfiguration.)
Top
See Also

Reference

PostSharp.Aspects.Configuration Namespace
PostSharp.Aspects.ConfigurationCompositionAspectConfigurationAttribute

Other Resources

Conceptual: Configuring Aspects


CompositionAspectConfiguration Constructor

Initializes a new instance of the CompositionAspectConfiguration class

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CompositionAspectConfiguration()
See Also

Reference

CompositionAspectConfiguration Class
PostSharp.Aspects.Configuration Namespace


CompositionAspectConfiguration Properties

The CompositionAspectConfiguration type exposes the following members.

Properties
 | Name | Description
Public property | AncestorOverrideAction | Specifies the action (Fail or Ignore) to be overtaken when an ancestor of one of the interfaces specified by PublicInterfaces is already implemented by the type to which the current aspect is applied.
Public property | AspectPriority | Gets or sets the aspect priority. Aspects with smaller priority are processed first. The default priority is zero. (Inherited from AspectConfiguration.)
Public property | Dependencies | Gets or sets the collection of dependencies. (Inherited from AspectConfiguration.)
Public property | GenerateImplementationAccessor | Determines whether the interface [!:IComposed<T>] should be introduced into the type to which the aspect is applied for each interface specified by the PublicInterfaces property.
Public property | NonSerializedImplementation | Determines whether the field containing the interface implementation (and storing the object returned by CreateImplementationObject(AdviceArgs)) should be excluded from serialization by BinaryFormatter. The same effect is typically obtained by applying the NonSerializedAttribute custom attribute to the field.
Public property | OverrideAction | Specifies the action (Fail or Ignore) to be overtaken when one of the interfaces specified by PublicInterfaces is already implemented by the type to which the aspect is applied.
Public property | PublicInterfaces | Gets or sets the array of interfaces that should be introduced publicly into the target type of the aspect.
Public property | SerializerType | Gets or sets the type of the serializer that will be used to configure the current aspect. (Inherited from AspectConfiguration.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from AspectConfiguration.)
Top
See Also

Reference

CompositionAspectConfiguration Class
PostSharp.Aspects.Configuration Namespace


CompositionAspectConfiguration.AncestorOverrideAction Property

CompositionAspectConfigurationAncestorOverrideAction Property

Specifies the action (Fail or Ignore) to be overtaken when an ancestor of one of the interfaces specified by PublicInterfaces is already implemented by the type to which the current aspect is applied.

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Nullable<InterfaceOverrideAction> AncestorOverrideAction { get; set; }

Property Value

Type: Nullable InterfaceOverrideAction
See Also

Reference

CompositionAspectConfiguration Class
PostSharp.Aspects.Configuration Namespace
CompositionAspectConfigurationOverrideAction


CompositionAspectConfiguration.GenerateImplementationAccessor Property

CompositionAspectConfigurationGenerateImplementationAccessor Property

Determines whether the interface [!:IComposed<T>] should be introduced into the type to which the aspect is applied for each interface specified by the PublicInterfaces property.

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Nullable<bool> GenerateImplementationAccessor { get; set; }

Property Value

Type: Nullable Boolean
See Also

Reference

CompositionAspectConfiguration Class
PostSharp.Aspects.Configuration Namespace


CompositionAspectConfiguration.NonSerializedImplementation Property

CompositionAspectConfigurationNonSerializedImplementation Property

Determines whether the field containing the interface implementation (and storing the object returned by CreateImplementationObject(AdviceArgs)) should be excluded from serialization by BinaryFormatter. The same effect is typically obtained by applying the NonSerializedAttribute custom attribute to the field.

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Nullable<bool> NonSerializedImplementation { get; set; }

Property Value

Type: Nullable Boolean
See Also

Reference

CompositionAspectConfiguration Class
PostSharp.Aspects.Configuration Namespace


CompositionAspectConfiguration.OverrideAction Property

CompositionAspectConfigurationOverrideAction Property

Specifies the action (Fail or Ignore) to be overtaken when one of the interfaces specified by PublicInterfaces is already implemented by the type to which the aspect is applied.

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Nullable<InterfaceOverrideAction> OverrideAction { get; set; }

Property Value

Type: Nullable InterfaceOverrideAction
See Also

Reference

CompositionAspectConfiguration Class
PostSharp.Aspects.Configuration Namespace
CompositionAspectConfigurationAncestorOverrideAction


CompositionAspectConfiguration.PublicInterfaces Property

CompositionAspectConfigurationPublicInterfaces Property

Gets or sets the array of interfaces that should be introduced publicly into the target type of the aspect.

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TypeIdentity[] PublicInterfaces { get; set; }

Property Value

Type: TypeIdentity
See Also

Reference

CompositionAspectConfiguration Class
PostSharp.Aspects.Configuration Namespace


CompositionAspectConfigurationAttribute Class

Custom attribute that, when applied on a class implementing ICompositionAspect, defines the declarative configuration of that aspect.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.ConfigurationAspectConfigurationAttribute
PostSharp.Aspects.ConfigurationCompositionAspectConfigurationAttribute

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class CompositionAspectConfigurationAttribute : AspectConfigurationAttribute

The CompositionAspectConfigurationAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | CompositionAspectConfigurationAttribute | Initializes a new instance of the CompositionAspectConfigurationAttribute class
Top
Properties
 | Name | Description
Public property | AncestorOverrideAction | Specifies the action (Fail or Ignore) to be overtaken when an ancestor of one of the interfaces specified by PublicInterfaces is already implemented by the type to which the current aspect is applied.
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from AspectConfigurationAttribute.)
Public property | GenerateImplementationAccessor | Determines whether the interface [!:IComposed<T>] should be introduced into the type to which the aspect is applied for each interface specified by the PublicInterfaces property.
Public property | NonSerializedImplementation | Determines whether the field containing the interface implementation (and storing the object returned by CreateImplementationObject(AdviceArgs)) should be excluded from serialization by BinaryFormatter. The same effect is typically obtained by applying the NonSerializedAttribute custom attribute to the field.
Public property | OverrideAction | Specifies the action (Fail or Ignore) to be overtaken when one of the interfaces specified by PublicInterfaces or ProtectedInterfaces is already implemented by the type to which the aspect is applied.
Public property | ProtectedInterfaces | Gets or sets the array of type names of interfaces to be introduced indirectly into the target type of the aspect. These interfaces will become accessible through the [!:IProtectedInterface<T>] interface.
Public property | PublicInterfaces | Gets or sets the array of type names of interfaces that should be introduced publicly into the target type of the aspect.
Public property | SerializerType | Gets or sets the Type of the serializer that will be used to configure the current aspect. (Inherited from AspectConfigurationAttribute.)
Top
Methods
 | Name | Description
Public method | GetAspectConfiguration | Gets the AspectConfiguration corresponding to the current custom attribute. (Inherited from AspectConfigurationAttribute.)
Top
See Also

Reference

PostSharp.Aspects.Configuration Namespace
PostSharp.Aspects.ConfigurationAspectConfigurationAttribute
PostSharp.AspectsCompositionAspect

Other Resources

Conceptual: Configuring Aspects


CompositionAspectConfigurationAttribute Constructor

Initializes a new instance of the CompositionAspectConfigurationAttribute class

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CompositionAspectConfigurationAttribute()
See Also

Reference

CompositionAspectConfigurationAttribute Class
PostSharp.Aspects.Configuration Namespace


CompositionAspectConfigurationAttribute Properties

The CompositionAspectConfigurationAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AncestorOverrideAction | Specifies the action (Fail or Ignore) to be overtaken when an ancestor of one of the interfaces specified by PublicInterfaces is already implemented by the type to which the current aspect is applied.
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from AspectConfigurationAttribute.)
Public property | GenerateImplementationAccessor | Determines whether the interface [!:IComposed<T>] should be introduced into the type to which the aspect is applied for each interface specified by the PublicInterfaces property.
Public property | NonSerializedImplementation | Determines whether the field containing the interface implementation (and storing the object returned by CreateImplementationObject(AdviceArgs)) should be excluded from serialization by BinaryFormatter. The same effect is typically obtained by applying the NonSerializedAttribute custom attribute to the field.
Public property | OverrideAction | Specifies the action (Fail or Ignore) to be overtaken when one of the interfaces specified by PublicInterfaces or ProtectedInterfaces is already implemented by the type to which the aspect is applied.
Public property | ProtectedInterfaces | Gets or sets the array of type names of interfaces to be introduced indirectly into the target type of the aspect. These interfaces will become accessible through the [!:IProtectedInterface<T>] interface.
Public property | PublicInterfaces | Gets or sets the array of type names of interfaces that should be introduced publicly into the target type of the aspect.
Public property | SerializerType | Gets or sets the Type of the serializer that will be used to configure the current aspect. (Inherited from AspectConfigurationAttribute.)
Top
See Also

Reference

CompositionAspectConfigurationAttribute Class
PostSharp.Aspects.Configuration Namespace


CompositionAspectConfigurationAttribute.AncestorOverrideAction Property

CompositionAspectConfigurationAttributeAncestorOverrideAction Property

Specifies the action (Fail or Ignore) to be overtaken when an ancestor of one of the interfaces specified by PublicInterfaces is already implemented by the type to which the current aspect is applied.

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public InterfaceOverrideAction AncestorOverrideAction { get; set; }

Property Value

Type: InterfaceOverrideAction
See Also

Reference

CompositionAspectConfigurationAttribute Class
PostSharp.Aspects.Configuration Namespace
CompositionAspectConfigurationAttributeOverrideAction


CompositionAspectConfigurationAttribute.GenerateImplementationAccessor Property

CompositionAspectConfigurationAttributeGenerateImplementationAccessor Property

Determines whether the interface [!:IComposed<T>] should be introduced into the type to which the aspect is applied for each interface specified by the PublicInterfaces property.

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool GenerateImplementationAccessor { get; set; }

Property Value

Type: Boolean
See Also

Reference

CompositionAspectConfigurationAttribute Class
PostSharp.Aspects.Configuration Namespace


CompositionAspectConfigurationAttribute.NonSerializedImplementation Property

CompositionAspectConfigurationAttributeNonSerializedImplementation Property

Determines whether the field containing the interface implementation (and storing the object returned by CreateImplementationObject(AdviceArgs)) should be excluded from serialization by BinaryFormatter. The same effect is typically obtained by applying the NonSerializedAttribute custom attribute to the field.

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool NonSerializedImplementation { get; set; }

Property Value

Type: Boolean
See Also

Reference

CompositionAspectConfigurationAttribute Class
PostSharp.Aspects.Configuration Namespace


CompositionAspectConfigurationAttribute.OverrideAction Property

CompositionAspectConfigurationAttributeOverrideAction Property

Specifies the action (Fail or Ignore) to be overtaken when one of the interfaces specified by PublicInterfaces or ProtectedInterfaces is already implemented by the type to which the aspect is applied.

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public InterfaceOverrideAction OverrideAction { get; set; }

Property Value

Type: InterfaceOverrideAction
See Also

Reference

CompositionAspectConfigurationAttribute Class
PostSharp.Aspects.Configuration Namespace
CompositionAspectConfigurationAttributeAncestorOverrideAction


CompositionAspectConfigurationAttribute.ProtectedInterfaces Property

CompositionAspectConfigurationAttributeProtectedInterfaces Property

Gets or sets the array of type names of interfaces to be introduced indirectly into the target type of the aspect. These interfaces will become accessible through the [!:IProtectedInterface<T>] interface.

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string[] ProtectedInterfaces { get; set; }

Property Value

Type: String
See Also

Reference

CompositionAspectConfigurationAttribute Class
PostSharp.Aspects.Configuration Namespace


CompositionAspectConfigurationAttribute.PublicInterfaces Property

CompositionAspectConfigurationAttributePublicInterfaces Property

Gets or sets the array of type names of interfaces that should be introduced publicly into the target type of the aspect.

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string[] PublicInterfaces { get; set; }

Property Value

Type: String
See Also

Reference

CompositionAspectConfigurationAttribute Class
PostSharp.Aspects.Configuration Namespace


CompositionAspectConfigurationAttribute Methods

The CompositionAspectConfigurationAttribute type exposes the following members.

Methods
 | Name | Description
Public method | GetAspectConfiguration | Gets the AspectConfiguration corresponding to the current custom attribute. (Inherited from AspectConfigurationAttribute.)
Top
See Also

Reference

CompositionAspectConfigurationAttribute Class
PostSharp.Aspects.Configuration Namespace


CustomAttributeIntroductionAspectConfiguration Class

Configuration of aspects of type CustomAttributeIntroductionAspect.
Inheritance Hierarchy
SystemObject
PostSharp.Aspects.ConfigurationAspectConfiguration
PostSharp.Aspects.ConfigurationCustomAttributeIntroductionAspectConfiguration

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class CustomAttributeIntroductionAspectConfiguration : AspectConfiguration

The CustomAttributeIntroductionAspectConfiguration type exposes the following members.

Constructors
 | Name | Description
Public method | CustomAttributeIntroductionAspectConfiguration | Initializes a new instance of the CustomAttributeIntroductionAspectConfiguration class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the aspect priority. Aspects with smaller priority are processed first. The default priority is zero. (Inherited from AspectConfiguration.)
Public property | Dependencies | Gets or sets the collection of dependencies. (Inherited from AspectConfiguration.)
Public property | ObjectConstruction | Gets or sets the construction of the custom attribute that must be applied to the target of this aspect.
Public property | SerializerType | Gets or sets the type of the serializer that will be used to configure the current aspect. (Inherited from AspectConfiguration.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from AspectConfiguration.)
Top
See Also

Reference

PostSharp.Aspects.Configuration Namespace

Other Resources

Conceptual: Configuring Aspects


CustomAttributeIntroductionAspectConfiguration Constructor

Initializes a new instance of the CustomAttributeIntroductionAspectConfiguration class

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CustomAttributeIntroductionAspectConfiguration()
See Also

Reference

CustomAttributeIntroductionAspectConfiguration Class
PostSharp.Aspects.Configuration Namespace


CustomAttributeIntroductionAspectConfiguration Properties

The CustomAttributeIntroductionAspectConfiguration type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the aspect priority. Aspects with smaller priority are processed first. The default priority is zero. (Inherited from AspectConfiguration.)
Public property | Dependencies | Gets or sets the collection of dependencies. (Inherited from AspectConfiguration.)
Public property | ObjectConstruction | Gets or sets the construction of the custom attribute that must be applied to the target of this aspect.
Public property | SerializerType | Gets or sets the type of the serializer that will be used to configure the current aspect. (Inherited from AspectConfiguration.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from AspectConfiguration.)
Top
See Also

Reference

CustomAttributeIntroductionAspectConfiguration Class
PostSharp.Aspects.Configuration Namespace


CustomAttributeIntroductionAspectConfiguration.ObjectConstruction Property

CustomAttributeIntroductionAspectConfigurationObjectConstruction Property

Gets or sets the construction of the custom attribute that must be applied to the target of this aspect.

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ObjectConstruction ObjectConstruction { get; set; }

Property Value

Type: ObjectConstruction
See Also

Reference

CustomAttributeIntroductionAspectConfiguration Class
PostSharp.Aspects.Configuration Namespace


EventInterceptionAspectConfiguration Class

Configuration of aspects of type IEventInterceptionAspect.
Inheritance Hierarchy
SystemObject
PostSharp.Aspects.ConfigurationAspectConfiguration
PostSharp.Aspects.ConfigurationEventInterceptionAspectConfiguration

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class EventInterceptionAspectConfiguration : AspectConfiguration

The EventInterceptionAspectConfiguration type exposes the following members.

Constructors
 | Name | Description
Public method | EventInterceptionAspectConfiguration | Initializes a new instance of the EventInterceptionAspectConfiguration class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the aspect priority. Aspects with smaller priority are processed first. The default priority is zero. (Inherited from AspectConfiguration.)
Public property | Dependencies | Gets or sets the collection of dependencies. (Inherited from AspectConfiguration.)
Public property | SerializerType | Gets or sets the type of the serializer that will be used to configure the current aspect. (Inherited from AspectConfiguration.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from AspectConfiguration.)
Top
See Also

Reference

PostSharp.Aspects.Configuration Namespace
PostSharp.Aspects.ConfigurationEventInterceptionAspectConfigurationAttribute

Other Resources

Conceptual: Configuring Aspects


EventInterceptionAspectConfiguration Constructor

Initializes a new instance of the EventInterceptionAspectConfiguration class

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public EventInterceptionAspectConfiguration()
See Also

Reference

EventInterceptionAspectConfiguration Class
PostSharp.Aspects.Configuration Namespace


EventInterceptionAspectConfiguration Properties

The EventInterceptionAspectConfiguration type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the aspect priority. Aspects with smaller priority are processed first. The default priority is zero. (Inherited from AspectConfiguration.)
Public property | Dependencies | Gets or sets the collection of dependencies. (Inherited from AspectConfiguration.)
Public property | SerializerType | Gets or sets the type of the serializer that will be used to configure the current aspect. (Inherited from AspectConfiguration.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from AspectConfiguration.)
Top
See Also

Reference

EventInterceptionAspectConfiguration Class
PostSharp.Aspects.Configuration Namespace


EventInterceptionAspectConfigurationAttribute Class

Custom attribute that, when applied on a class implementing IEventInterceptionAspect, defines the declarative configuration of that aspect.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.ConfigurationAspectConfigurationAttribute
PostSharp.Aspects.ConfigurationEventInterceptionAspectConfigurationAttribute

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class EventInterceptionAspectConfigurationAttribute : AspectConfigurationAttribute

The EventInterceptionAspectConfigurationAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | EventInterceptionAspectConfigurationAttribute | Initializes a new instance of the EventInterceptionAspectConfigurationAttribute class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from AspectConfigurationAttribute.)
Public property | SerializerType | Gets or sets the Type of the serializer that will be used to configure the current aspect. (Inherited from AspectConfigurationAttribute.)
Top
Methods
 | Name | Description
Public method | GetAspectConfiguration | Gets the AspectConfiguration corresponding to the current custom attribute. (Inherited from AspectConfigurationAttribute.)
Top
See Also

Reference

PostSharp.Aspects.Configuration Namespace
PostSharp.Aspects.ConfigurationEventInterceptionAspectConfiguration
PostSharp.AspectsEventInterceptionAspect

Other Resources

Conceptual: Configuring Aspects


EventInterceptionAspectConfigurationAttribute Constructor

Initializes a new instance of the EventInterceptionAspectConfigurationAttribute class

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public EventInterceptionAspectConfigurationAttribute()
See Also

Reference

EventInterceptionAspectConfigurationAttribute Class
PostSharp.Aspects.Configuration Namespace


EventInterceptionAspectConfigurationAttribute Properties

The EventInterceptionAspectConfigurationAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from AspectConfigurationAttribute.)
Public property | SerializerType | Gets or sets the Type of the serializer that will be used to configure the current aspect. (Inherited from AspectConfigurationAttribute.)
Top
See Also

Reference

EventInterceptionAspectConfigurationAttribute Class
PostSharp.Aspects.Configuration Namespace


EventInterceptionAspectConfigurationAttribute Methods

The EventInterceptionAspectConfigurationAttribute type exposes the following members.

Methods
 | Name | Description
Public method | GetAspectConfiguration | Gets the AspectConfiguration corresponding to the current custom attribute. (Inherited from AspectConfigurationAttribute.)
Top
See Also

Reference

EventInterceptionAspectConfigurationAttribute Class
PostSharp.Aspects.Configuration Namespace


LocationInterceptionAspectConfiguration Class

Configuration of aspects of type ILocationLevelAspect.
Inheritance Hierarchy
SystemObject
PostSharp.Aspects.ConfigurationAspectConfiguration
PostSharp.Aspects.ConfigurationLocationInterceptionAspectConfiguration

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class LocationInterceptionAspectConfiguration : AspectConfiguration

The LocationInterceptionAspectConfiguration type exposes the following members.

Constructors
 | Name | Description
Public method | LocationInterceptionAspectConfiguration | Initializes a new instance of the LocationInterceptionAspectConfiguration class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the aspect priority. Aspects with smaller priority are processed first. The default priority is zero. (Inherited from AspectConfiguration.)
Public property | Dependencies | Gets or sets the collection of dependencies. (Inherited from AspectConfiguration.)
Public property | SerializerType | Gets or sets the type of the serializer that will be used to configure the current aspect. (Inherited from AspectConfiguration.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from AspectConfiguration.)
Top
See Also

Reference

PostSharp.Aspects.Configuration Namespace

Other Resources

Conceptual: Configuring Aspects


LocationInterceptionAspectConfiguration Constructor

Initializes a new instance of the LocationInterceptionAspectConfiguration class

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LocationInterceptionAspectConfiguration()
See Also

Reference

LocationInterceptionAspectConfiguration Class
PostSharp.Aspects.Configuration Namespace


LocationInterceptionAspectConfiguration Properties

The LocationInterceptionAspectConfiguration type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the aspect priority. Aspects with smaller priority are processed first. The default priority is zero. (Inherited from AspectConfiguration.)
Public property | Dependencies | Gets or sets the collection of dependencies. (Inherited from AspectConfiguration.)
Public property | SerializerType | Gets or sets the type of the serializer that will be used to configure the current aspect. (Inherited from AspectConfiguration.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from AspectConfiguration.)
Top
See Also

Reference

LocationInterceptionAspectConfiguration Class
PostSharp.Aspects.Configuration Namespace


LocationInterceptionAspectConfigurationAttribute Class

Custom attribute that, when applied on a class implementing ILocationInterceptionAspect, defines the declarative configuration of that aspect.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.ConfigurationAspectConfigurationAttribute
PostSharp.Aspects.ConfigurationLocationInterceptionAspectConfigurationAttribute

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class LocationInterceptionAspectConfigurationAttribute : AspectConfigurationAttribute

The LocationInterceptionAspectConfigurationAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | LocationInterceptionAspectConfigurationAttribute | Initializes a new instance of the LocationInterceptionAspectConfigurationAttribute class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from AspectConfigurationAttribute.)
Public property | SerializerType | Gets or sets the Type of the serializer that will be used to configure the current aspect. (Inherited from AspectConfigurationAttribute.)
Top
Methods
 | Name | Description
Public method | GetAspectConfiguration | Gets the AspectConfiguration corresponding to the current custom attribute. (Inherited from AspectConfigurationAttribute.)
Top
See Also

Reference

PostSharp.Aspects.Configuration Namespace
PostSharp.Aspects.ConfigurationLocationInterceptionAspectConfiguration
PostSharp.AspectsLocationLevelAspect

Other Resources

Conceptual: Configuring Aspects


LocationInterceptionAspectConfigurationAttribute Constructor

Initializes a new instance of the LocationInterceptionAspectConfigurationAttribute class

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LocationInterceptionAspectConfigurationAttribute()
See Also

Reference

LocationInterceptionAspectConfigurationAttribute Class
PostSharp.Aspects.Configuration Namespace


LocationInterceptionAspectConfigurationAttribute Properties

The LocationInterceptionAspectConfigurationAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from AspectConfigurationAttribute.)
Public property | SerializerType | Gets or sets the Type of the serializer that will be used to configure the current aspect. (Inherited from AspectConfigurationAttribute.)
Top
See Also

Reference

LocationInterceptionAspectConfigurationAttribute Class
PostSharp.Aspects.Configuration Namespace


LocationInterceptionAspectConfigurationAttribute Methods

The LocationInterceptionAspectConfigurationAttribute type exposes the following members.

Methods
 | Name | Description
Public method | GetAspectConfiguration | Gets the AspectConfiguration corresponding to the current custom attribute. (Inherited from AspectConfigurationAttribute.)
Top
See Also

Reference

LocationInterceptionAspectConfigurationAttribute Class
PostSharp.Aspects.Configuration Namespace


ManagedResourceIntroductionAspectConfiguration Class

Configuration of aspects of type ManagedResourceIntroductionAspect.
Inheritance Hierarchy
SystemObject
PostSharp.Aspects.ConfigurationAspectConfiguration
PostSharp.Aspects.ConfigurationManagedResourceIntroductionAspectConfiguration

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ManagedResourceIntroductionAspectConfiguration : AspectConfiguration

The ManagedResourceIntroductionAspectConfiguration type exposes the following members.

Constructors
 | Name | Description
Public method | ManagedResourceIntroductionAspectConfiguration | Initializes a new ManagedResourceIntroductionAspectConfiguration.
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the aspect priority. Aspects with smaller priority are processed first. The default priority is zero. (Inherited from AspectConfiguration.)
Public property | Data | Gets the content of the managed resource.
Public property | Dependencies | Gets or sets the collection of dependencies. (Inherited from AspectConfiguration.)
Public property | Name | Gets the name of the managed resource.
Public property | SerializerType | Gets or sets the type of the serializer that will be used to configure the current aspect. (Inherited from AspectConfiguration.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from AspectConfiguration.)
Top
See Also

Reference

PostSharp.Aspects.Configuration Namespace

Other Resources

Conceptual: Configuring Aspects


ManagedResourceIntroductionAspectConfiguration Constructor

Initializes a new ManagedResourceIntroductionAspectConfiguration.

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ManagedResourceIntroductionAspectConfiguration(
    string name,
    byte[] data
)

Parameters

name
Type: SystemString
Name of the managed resource.
data
Type: SystemByte
Content of the managed resource.
See Also

Reference

ManagedResourceIntroductionAspectConfiguration Class
PostSharp.Aspects.Configuration Namespace


ManagedResourceIntroductionAspectConfiguration Properties

The ManagedResourceIntroductionAspectConfiguration type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the aspect priority. Aspects with smaller priority are processed first. The default priority is zero. (Inherited from AspectConfiguration.)
Public property | Data | Gets the content of the managed resource.
Public property | Dependencies | Gets or sets the collection of dependencies. (Inherited from AspectConfiguration.)
Public property | Name | Gets the name of the managed resource.
Public property | SerializerType | Gets or sets the type of the serializer that will be used to configure the current aspect. (Inherited from AspectConfiguration.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from AspectConfiguration.)
Top
See Also

Reference

ManagedResourceIntroductionAspectConfiguration Class
PostSharp.Aspects.Configuration Namespace


ManagedResourceIntroductionAspectConfiguration.Data Property

ManagedResourceIntroductionAspectConfigurationData Property

Gets the content of the managed resource.

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public byte[] Data { get; }

Property Value

Type: Byte
See Also

Reference

ManagedResourceIntroductionAspectConfiguration Class
PostSharp.Aspects.Configuration Namespace


ManagedResourceIntroductionAspectConfiguration.Name Property

ManagedResourceIntroductionAspectConfigurationName Property

Gets the name of the managed resource.

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string Name { get; }

Property Value

Type: String
See Also

Reference

ManagedResourceIntroductionAspectConfiguration Class
PostSharp.Aspects.Configuration Namespace


MethodInterceptionAspectConfiguration Class

Configuration of aspects of type IMethodInterceptionAspect.
Inheritance Hierarchy
SystemObject
PostSharp.Aspects.ConfigurationAspectConfiguration
PostSharp.Aspects.ConfigurationMethodInterceptionAspectConfiguration

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class MethodInterceptionAspectConfiguration : AspectConfiguration

The MethodInterceptionAspectConfiguration type exposes the following members.

Constructors
 | Name | Description
Public method | MethodInterceptionAspectConfiguration | Initializes a new instance of the MethodInterceptionAspectConfiguration class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the aspect priority. Aspects with smaller priority are processed first. The default priority is zero. (Inherited from AspectConfiguration.)
Public property | Dependencies | Gets or sets the collection of dependencies. (Inherited from AspectConfiguration.)
Public property | SemanticallyAdvisedMethodKinds | Determines which target methods will be advised semantically. This affects the behavior of the aspect when it's applied to iterator or async methods, which are compiled into state machines.
Public property | SerializerType | Gets or sets the type of the serializer that will be used to configure the current aspect. (Inherited from AspectConfiguration.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from AspectConfiguration.)
Top
See Also

Reference

PostSharp.Aspects.Configuration Namespace
PostSharp.Aspects.ConfigurationMethodInterceptionAspectConfigurationAttribute
PostSharp.AspectsMethodInterceptionAspect

Other Resources

Conceptual: Configuring Aspects


MethodInterceptionAspectConfiguration Constructor

Initializes a new instance of the MethodInterceptionAspectConfiguration class

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MethodInterceptionAspectConfiguration()
See Also

Reference

MethodInterceptionAspectConfiguration Class
PostSharp.Aspects.Configuration Namespace


MethodInterceptionAspectConfiguration Properties

The MethodInterceptionAspectConfiguration type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the aspect priority. Aspects with smaller priority are processed first. The default priority is zero. (Inherited from AspectConfiguration.)
Public property | Dependencies | Gets or sets the collection of dependencies. (Inherited from AspectConfiguration.)
Public property | SemanticallyAdvisedMethodKinds | Determines which target methods will be advised semantically. This affects the behavior of the aspect when it's applied to iterator or async methods, which are compiled into state machines.
Public property | SerializerType | Gets or sets the type of the serializer that will be used to configure the current aspect. (Inherited from AspectConfiguration.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from AspectConfiguration.)
Top
See Also

Reference

MethodInterceptionAspectConfiguration Class
PostSharp.Aspects.Configuration Namespace


MethodInterceptionAspectConfiguration.SemanticallyAdvisedMethodKinds Property

MethodInterceptionAspectConfigurationSemanticallyAdvisedMethodKinds Property

Determines which target methods will be advised semantically. This affects the behavior of the aspect when it's applied to iterator or async methods, which are compiled into state machines.

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Nullable<SemanticallyAdvisedMethodKinds> SemanticallyAdvisedMethodKinds { get; set; }

Property Value

Type: Nullable SemanticallyAdvisedMethodKinds
Remarks

Semantic advising results in an aspect that is consistent with the level of abstraction of the programming language. This is the default behavior. You can disable semantic advising using this property to be consistent with the level of abstraction of MSIL and for backward-compatibility with the versions of PostSharp prior to 3.1.

See Also

Reference

MethodInterceptionAspectConfiguration Class
PostSharp.Aspects.Configuration Namespace


MethodInterceptionAspectConfigurationAttribute Class

Custom attribute that, when applied on a class implementing IMethodInterceptionAspect, defines the declarative configuration of that aspect.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.ConfigurationAspectConfigurationAttribute
PostSharp.Aspects.ConfigurationMethodInterceptionAspectConfigurationAttribute

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class MethodInterceptionAspectConfigurationAttribute : AspectConfigurationAttribute

The MethodInterceptionAspectConfigurationAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | MethodInterceptionAspectConfigurationAttribute | Initializes a new instance of the MethodInterceptionAspectConfigurationAttribute class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from AspectConfigurationAttribute.)
Public property | SerializerType | Gets or sets the Type of the serializer that will be used to configure the current aspect. (Inherited from AspectConfigurationAttribute.)
Top
Methods
 | Name | Description
Public method | GetAspectConfiguration | Gets the AspectConfiguration corresponding to the current custom attribute. (Inherited from AspectConfigurationAttribute.)
Top
See Also

Reference

PostSharp.Aspects.Configuration Namespace
PostSharp.AspectsMethodInterceptionAspect
PostSharp.Aspects.ConfigurationMethodInterceptionAspectConfiguration

Other Resources

Conceptual: Configuring Aspects


MethodInterceptionAspectConfigurationAttribute Constructor

Initializes a new instance of the MethodInterceptionAspectConfigurationAttribute class

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MethodInterceptionAspectConfigurationAttribute()
See Also

Reference

MethodInterceptionAspectConfigurationAttribute Class
PostSharp.Aspects.Configuration Namespace


MethodInterceptionAspectConfigurationAttribute Properties

The MethodInterceptionAspectConfigurationAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from AspectConfigurationAttribute.)
Public property | SerializerType | Gets or sets the Type of the serializer that will be used to configure the current aspect. (Inherited from AspectConfigurationAttribute.)
Top
See Also

Reference

MethodInterceptionAspectConfigurationAttribute Class
PostSharp.Aspects.Configuration Namespace


MethodInterceptionAspectConfigurationAttribute Methods

The MethodInterceptionAspectConfigurationAttribute type exposes the following members.

Methods
 | Name | Description
Public method | GetAspectConfiguration | Gets the AspectConfiguration corresponding to the current custom attribute. (Inherited from AspectConfigurationAttribute.)
Top
See Also

Reference

MethodInterceptionAspectConfigurationAttribute Class
PostSharp.Aspects.Configuration Namespace


OnExceptionAspectConfiguration Class

Configuration of the IOnExceptionAspect aspect.
Inheritance Hierarchy
SystemObject
PostSharp.Aspects.ConfigurationAspectConfiguration
PostSharp.Aspects.ConfigurationOnExceptionAspectConfiguration

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class OnExceptionAspectConfiguration : AspectConfiguration

The OnExceptionAspectConfiguration type exposes the following members.

Constructors
 | Name | Description
Public method | OnExceptionAspectConfiguration | Initializes a new instance of the OnExceptionAspectConfiguration class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the aspect priority. Aspects with smaller priority are processed first. The default priority is zero. (Inherited from AspectConfiguration.)
Public property | Dependencies | Gets or sets the collection of dependencies. (Inherited from AspectConfiguration.)
Public property | ExceptionType | Gets or sets the type of exceptions that are caught by this aspect.
Public property | SemanticallyAdvisedMethodKinds | Determines which target methods will be advised semantically. This affects the behavior of the aspect when it's applied to iterator or async methods, which are compiled into state machines.
Public property | SerializerType | Gets or sets the type of the serializer that will be used to configure the current aspect. (Inherited from AspectConfiguration.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from AspectConfiguration.)
Top
See Also

Reference

PostSharp.Aspects.Configuration Namespace
PostSharp.AspectsOnExceptionAspect
PostSharp.Aspects.ConfigurationOnExceptionAspectConfigurationAttribute

Other Resources

Conceptual: Configuring Aspects


OnExceptionAspectConfiguration Constructor

Initializes a new instance of the OnExceptionAspectConfiguration class

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public OnExceptionAspectConfiguration()
See Also

Reference

OnExceptionAspectConfiguration Class
PostSharp.Aspects.Configuration Namespace


OnExceptionAspectConfiguration Properties

The OnExceptionAspectConfiguration type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the aspect priority. Aspects with smaller priority are processed first. The default priority is zero. (Inherited from AspectConfiguration.)
Public property | Dependencies | Gets or sets the collection of dependencies. (Inherited from AspectConfiguration.)
Public property | ExceptionType | Gets or sets the type of exceptions that are caught by this aspect.
Public property | SemanticallyAdvisedMethodKinds | Determines which target methods will be advised semantically. This affects the behavior of the aspect when it's applied to iterator or async methods, which are compiled into state machines.
Public property | SerializerType | Gets or sets the type of the serializer that will be used to configure the current aspect. (Inherited from AspectConfiguration.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from AspectConfiguration.)
Top
See Also

Reference

OnExceptionAspectConfiguration Class
PostSharp.Aspects.Configuration Namespace


OnExceptionAspectConfiguration.ExceptionType Property

OnExceptionAspectConfigurationExceptionType Property

Gets or sets the type of exceptions that are caught by this aspect.

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TypeIdentity ExceptionType { get; set; }

Property Value

Type: TypeIdentity
Remarks
If this property is null, any Exception shall be caught.
See Also

Reference

OnExceptionAspectConfiguration Class
PostSharp.Aspects.Configuration Namespace


OnExceptionAspectConfiguration.SemanticallyAdvisedMethodKinds Property

OnExceptionAspectConfigurationSemanticallyAdvisedMethodKinds Property

Determines which target methods will be advised semantically. This affects the behavior of the aspect when it's applied to iterator or async methods, which are compiled into state machines.

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Nullable<SemanticallyAdvisedMethodKinds> SemanticallyAdvisedMethodKinds { get; set; }

Property Value

Type: Nullable SemanticallyAdvisedMethodKinds
Remarks

Semantic advising results in an aspect that is consistent with the level of abstraction of the programming language. This is the default behavior. You can disable semantic advising using this property to be consistent with the level of abstraction of MSIL and for backward-compatibility with the versions of PostSharp prior to 3.1.

See Also

Reference

OnExceptionAspectConfiguration Class
PostSharp.Aspects.Configuration Namespace


OnExceptionAspectConfigurationAttribute Class

Custom attribute that, when applied on a class implementing IOnExceptionAspect, defines the configuration of that aspect.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.ConfigurationAspectConfigurationAttribute
PostSharp.Aspects.ConfigurationOnExceptionAspectConfigurationAttribute

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class OnExceptionAspectConfigurationAttribute : AspectConfigurationAttribute

The OnExceptionAspectConfigurationAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | OnExceptionAspectConfigurationAttribute | Initializes a new instance of the OnExceptionAspectConfigurationAttribute class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from AspectConfigurationAttribute.)
Public property | ExceptionType | Gets or sets the type of exceptions that are caught by this aspect.
Public property | SerializerType | Gets or sets the Type of the serializer that will be used to configure the current aspect. (Inherited from AspectConfigurationAttribute.)
Top
Methods
 | Name | Description
Public method | GetAspectConfiguration | Gets the AspectConfiguration corresponding to the current custom attribute. (Inherited from AspectConfigurationAttribute.)
Top
See Also

Reference

PostSharp.Aspects.Configuration Namespace
PostSharp.AspectsOnExceptionAspect

Other Resources

Conceptual: Configuring Aspects


OnExceptionAspectConfigurationAttribute Constructor

Initializes a new instance of the OnExceptionAspectConfigurationAttribute class

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public OnExceptionAspectConfigurationAttribute()
See Also

Reference

OnExceptionAspectConfigurationAttribute Class
PostSharp.Aspects.Configuration Namespace


OnExceptionAspectConfigurationAttribute Properties

The OnExceptionAspectConfigurationAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from AspectConfigurationAttribute.)
Public property | ExceptionType | Gets or sets the type of exceptions that are caught by this aspect.
Public property | SerializerType | Gets or sets the Type of the serializer that will be used to configure the current aspect. (Inherited from AspectConfigurationAttribute.)
Top
See Also

Reference

OnExceptionAspectConfigurationAttribute Class
PostSharp.Aspects.Configuration Namespace


OnExceptionAspectConfigurationAttribute.ExceptionType Property

OnExceptionAspectConfigurationAttributeExceptionType Property

Gets or sets the type of exceptions that are caught by this aspect.

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Type ExceptionType { get; set; }

Property Value

Type: Type
Remarks
If this property is null, any Exception shall be caught.
See Also

Reference

OnExceptionAspectConfigurationAttribute Class
PostSharp.Aspects.Configuration Namespace


OnExceptionAspectConfigurationAttribute Methods

The OnExceptionAspectConfigurationAttribute type exposes the following members.

Methods
 | Name | Description
Public method | GetAspectConfiguration | Gets the AspectConfiguration corresponding to the current custom attribute. (Inherited from AspectConfigurationAttribute.)
Top
See Also

Reference

OnExceptionAspectConfigurationAttribute Class
PostSharp.Aspects.Configuration Namespace


OnMethodBoundaryAspectConfiguration Class

Configuration of the IOnMethodBoundaryAspect aspect.
Inheritance Hierarchy
SystemObject
PostSharp.Aspects.ConfigurationAspectConfiguration
PostSharp.Aspects.ConfigurationOnMethodBoundaryAspectConfiguration

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class OnMethodBoundaryAspectConfiguration : AspectConfiguration

The OnMethodBoundaryAspectConfiguration type exposes the following members.

Constructors
 | Name | Description
Public method | OnMethodBoundaryAspectConfiguration | Initializes a new instance of the OnMethodBoundaryAspectConfiguration class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the aspect priority. Aspects with smaller priority are processed first. The default priority is zero. (Inherited from AspectConfiguration.)
Public property | Dependencies | Gets or sets the collection of dependencies. (Inherited from AspectConfiguration.)
Public property | SemanticallyAdvisedMethodKinds | Determines which target methods will be advised semantically. This affects the behavior of the aspect when it's applied to iterator or async methods, which are compiled into state machines.
Public property | SerializerType | Gets or sets the type of the serializer that will be used to configure the current aspect. (Inherited from AspectConfiguration.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from AspectConfiguration.)
Top
See Also

Reference

PostSharp.Aspects.Configuration Namespace
PostSharp.Aspects.ConfigurationOnMethodBoundaryAspectConfigurationAttribute
PostSharp.AspectsOnMethodBoundaryAspect

Other Resources

Conceptual: Configuring Aspects


OnMethodBoundaryAspectConfiguration Constructor

Initializes a new instance of the OnMethodBoundaryAspectConfiguration class

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public OnMethodBoundaryAspectConfiguration()
See Also

Reference

OnMethodBoundaryAspectConfiguration Class
PostSharp.Aspects.Configuration Namespace


OnMethodBoundaryAspectConfiguration Properties

The OnMethodBoundaryAspectConfiguration type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the aspect priority. Aspects with smaller priority are processed first. The default priority is zero. (Inherited from AspectConfiguration.)
Public property | Dependencies | Gets or sets the collection of dependencies. (Inherited from AspectConfiguration.)
Public property | SemanticallyAdvisedMethodKinds | Determines which target methods will be advised semantically. This affects the behavior of the aspect when it's applied to iterator or async methods, which are compiled into state machines.
Public property | SerializerType | Gets or sets the type of the serializer that will be used to configure the current aspect. (Inherited from AspectConfiguration.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from AspectConfiguration.)
Top
See Also

Reference

OnMethodBoundaryAspectConfiguration Class
PostSharp.Aspects.Configuration Namespace


OnMethodBoundaryAspectConfiguration.SemanticallyAdvisedMethodKinds Property

OnMethodBoundaryAspectConfigurationSemanticallyAdvisedMethodKinds Property

Determines which target methods will be advised semantically. This affects the behavior of the aspect when it's applied to iterator or async methods, which are compiled into state machines.

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Nullable<SemanticallyAdvisedMethodKinds> SemanticallyAdvisedMethodKinds { get; set; }

Property Value

Type: Nullable SemanticallyAdvisedMethodKinds
Remarks

Semantic advising results in an aspect that is consistent with the level of abstraction of the programming language. This is the default behavior. You can disable semantic advising using this property to be consistent with the level of abstraction of MSIL and for backward-compatibility with the versions of PostSharp prior to 3.1.

See Also

Reference

OnMethodBoundaryAspectConfiguration Class
PostSharp.Aspects.Configuration Namespace


OnMethodBoundaryAspectConfigurationAttribute Class

Custom attribute that, when applied on a class implementing IOnMethodBoundaryAspect, defines the configuration of that aspect.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.ConfigurationAspectConfigurationAttribute
PostSharp.Aspects.ConfigurationOnMethodBoundaryAspectConfigurationAttribute

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class OnMethodBoundaryAspectConfigurationAttribute : AspectConfigurationAttribute

The OnMethodBoundaryAspectConfigurationAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | OnMethodBoundaryAspectConfigurationAttribute | Initializes a new instance of the OnMethodBoundaryAspectConfigurationAttribute class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from AspectConfigurationAttribute.)
Public property | SerializerType | Gets or sets the Type of the serializer that will be used to configure the current aspect. (Inherited from AspectConfigurationAttribute.)
Top
Methods
 | Name | Description
Public method | GetAspectConfiguration | Gets the AspectConfiguration corresponding to the current custom attribute. (Inherited from AspectConfigurationAttribute.)
Top
See Also

Reference

PostSharp.Aspects.Configuration Namespace
PostSharp.Aspects.ConfigurationOnMethodBoundaryAspectConfiguration
PostSharp.AspectsOnMethodBoundaryAspect

Other Resources

Conceptual: Configuring Aspects


OnMethodBoundaryAspectConfigurationAttribute Constructor

Initializes a new instance of the OnMethodBoundaryAspectConfigurationAttribute class

Namespace: PostSharp.Aspects.Configuration
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public OnMethodBoundaryAspectConfigurationAttribute()
See Also

Reference

OnMethodBoundaryAspectConfigurationAttribute Class
PostSharp.Aspects.Configuration Namespace


OnMethodBoundaryAspectConfigurationAttribute Properties

The OnMethodBoundaryAspectConfigurationAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from AspectConfigurationAttribute.)
Public property | SerializerType | Gets or sets the Type of the serializer that will be used to configure the current aspect. (Inherited from AspectConfigurationAttribute.)
Top
See Also

Reference

OnMethodBoundaryAspectConfigurationAttribute Class
PostSharp.Aspects.Configuration Namespace


OnMethodBoundaryAspectConfigurationAttribute Methods

The OnMethodBoundaryAspectConfigurationAttribute type exposes the following members.

Methods
 | Name | Description
Public method | GetAspectConfiguration | Gets the AspectConfiguration corresponding to the current custom attribute. (Inherited from AspectConfigurationAttribute.)
Top
See Also

Reference

OnMethodBoundaryAspectConfigurationAttribute Class
PostSharp.Aspects.Configuration Namespace


PostSharp.Aspects.Dependencies Namespace

The PostSharp.Aspects.Dependencies namespace contains types and custom attributes that allow to define dependencies between aspects and advices, so that the aspect weaver behaves determistically even if the same element of code is the target of several aspects provided by multiple vendors.
Classes
 | Class | Description
Public class | AdviceDependencyAttribute | Specifies an aspect dependency matching an advice of the same aspect instance.
Public class | AspectDependencyAttribute | Base class for all custom attributes defining aspect dependencies. An aspect dependency determines the behavior of aspects or advices when used in conjunction with other aspects and advices. Aspect dependencies determine ordering, requirements, conflicts, and commutativity of aspects and advices.
Public class | AspectDependencyAttributeCollection | Collection of AspectDependencyAttribute.
Public class | AspectEffectDependencyAttribute | Specifies an aspect dependency matching aspects or advices having a given effect.
Public class | AspectRoleDependencyAttribute | Specifies an aspect dependency matching aspects or advices that are a part of a given role.
Public class | AspectTypeDependencyAttribute | Specifies an aspect dependency matching aspects of a specified type, and all its advices.
Public class | ProvideAspectRoleAttribute | Specifies that the aspect or aspect advice to which this custom attribute is applied is a part of a given role. This aspect or advice can then be matched by AspectRoleDependencyAttribute/
Public class | StandardEffects | List of standard effects.
Public class | StandardRoles | List of standard roles.
Public class | WaiveAspectEffectAttribute | Declares that the aspect class or advice to which this custom attribute is applied is exempt of a given effect.
Enumerations
 | Enumeration | Description
Public enumeration | AspectDependencyAction | Enumeration of the different kinds of relationships of specified by aspect dependencies.
Public enumeration | AspectDependencyPosition | Enumeration of the direction of the relationship specified by an aspect dependency.
Public enumeration | AspectDependencyTarget | Enumeration of targets (Default or Type) to which the aspect dependency apply.


AdviceDependencyAttribute Class

Specifies an aspect dependency matching an advice of the same aspect instance.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.DependenciesAspectDependencyAttribute
PostSharp.Aspects.DependenciesAdviceDependencyAttribute

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class AdviceDependencyAttribute : AspectDependencyAttribute

The AdviceDependencyAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | AdviceDependencyAttribute(AspectDependencyAction, String) | Initializes a new AdviceDependencyAttribute without specifying the position, implicitly set to Any.
Public method | AdviceDependencyAttribute(AspectDependencyAction, AspectDependencyPosition, String) | Initializes a new AdviceDependencyAttribute and specifies a position.
Top
Properties
 | Name | Description
Public property | Action | Gets the dependency action, i.e. the kind of relationship specified by the dependency (Order, Require, Conflict, or Commute). (Inherited from AspectDependencyAttribute.)
Public property | AdviceMethodName | Gets the name of the method implementing the advice.
Public property | IsWarning | If true, specifies that the constraint (of type Require or Conflict) should emit a warning instead of an error if not respected. (Inherited from AspectDependencyAttribute.)
Public property | Position | Gets the position of the current dependency, i.e. actually the position of the other aspect or advices with respect to the one related to this dependency. (Inherited from AspectDependencyAttribute.)
Public property | Target | Determines the target (Default or Type) to which the aspect dependency apply. (Inherited from AspectDependencyAttribute.)
Public property | TargetType | Aspect type to which this dependency applies. This property is required when the custom attribute is applied at assembly level. It is ignored when applied on class or method level. (Inherited from AspectDependencyAttribute.)
Top
Remarks
See Also

Reference

PostSharp.Aspects.Dependencies Namespace

Other Resources

Conceptual: Configuring Aspects
Conceptual: Ordering Advices


AdviceDependencyAttribute Constructor

Overload List
 | Name | Description
Public method | AdviceDependencyAttribute(AspectDependencyAction, String) | Initializes a new AdviceDependencyAttribute without specifying the position, implicitly set to Any.
Public method | AdviceDependencyAttribute(AspectDependencyAction, AspectDependencyPosition, String) | Initializes a new AdviceDependencyAttribute and specifies a position.
Top
See Also

Reference

AdviceDependencyAttribute Class
PostSharp.Aspects.Dependencies Namespace


AdviceDependencyAttribute Constructor (AspectDependencyAction, String)

Initializes a new AdviceDependencyAttribute without specifying the position, implicitly set to Any.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AdviceDependencyAttribute(
    AspectDependencyAction action,
    string adviceMethodName
)

Parameters

action
Type: PostSharp.Aspects.DependenciesAspectDependencyAction
Dependency action.
adviceMethodName
Type: SystemString
Name of the advice method.
See Also

Reference

AdviceDependencyAttribute Class
AdviceDependencyAttribute Overload
PostSharp.Aspects.Dependencies Namespace


AdviceDependencyAttribute Constructor (AspectDependencyAction, AspectDependencyPosition, String)

Initializes a new AdviceDependencyAttribute and specifies a position.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AdviceDependencyAttribute(
    AspectDependencyAction action,
    AspectDependencyPosition position,
    string adviceMethodName
)

Parameters

action
Type: PostSharp.Aspects.DependenciesAspectDependencyAction
Dependency action.
position
Type: PostSharp.Aspects.DependenciesAspectDependencyPosition
Dependency position.
adviceMethodName
Type: SystemString
Name of the advice method.
See Also

Reference

AdviceDependencyAttribute Class
AdviceDependencyAttribute Overload
PostSharp.Aspects.Dependencies Namespace


AdviceDependencyAttribute Properties

The AdviceDependencyAttribute type exposes the following members.

Properties
 | Name | Description
Public property | Action | Gets the dependency action, i.e. the kind of relationship specified by the dependency (Order, Require, Conflict, or Commute). (Inherited from AspectDependencyAttribute.)
Public property | AdviceMethodName | Gets the name of the method implementing the advice.
Public property | IsWarning | If true, specifies that the constraint (of type Require or Conflict) should emit a warning instead of an error if not respected. (Inherited from AspectDependencyAttribute.)
Public property | Position | Gets the position of the current dependency, i.e. actually the position of the other aspect or advices with respect to the one related to this dependency. (Inherited from AspectDependencyAttribute.)
Public property | Target | Determines the target (Default or Type) to which the aspect dependency apply. (Inherited from AspectDependencyAttribute.)
Public property | TargetType | Aspect type to which this dependency applies. This property is required when the custom attribute is applied at assembly level. It is ignored when applied on class or method level. (Inherited from AspectDependencyAttribute.)
Top
See Also

Reference

AdviceDependencyAttribute Class
PostSharp.Aspects.Dependencies Namespace


AdviceDependencyAttribute.AdviceMethodName Property

AdviceDependencyAttributeAdviceMethodName Property

Gets the name of the method implementing the advice.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string AdviceMethodName { get; }

Property Value

Type: String
See Also

Reference

AdviceDependencyAttribute Class
PostSharp.Aspects.Dependencies Namespace


AspectDependencyAction Enumeration

Enumeration of the different kinds of relationships of specified by aspect dependencies.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum AspectDependencyAction
Members
Member name | Value | Description
None | 0 | The dependency is ignored.
Order | 1 | The dependency specifies an order relationship.
Require | 2 | The dependency specifies that the current aspect or advice requires another aspect or advice.
Conflict | 3 | The dependency specifies that the current aspect or advice conflicts with another aspect or advice.
Commute | 4 | The dependency specifies that the current aspect or advice commutes with another aspect or advice.
Remarks

The combined values of AspectDependencyAction and AspectDependencyPosition is interpreted as follows:

Action | Position | Description
Order | After | The current aspect or advice should be positioned after the other aspect or advice matched by the custom attribute.
Order | Before | The current aspect or advice should be positioned before the other aspect or advice matched by the custom attribute.
Require | Any | The current aspect or advice requires another aspect or advice matched by the custom attribute, at any position.
Require | After | The current aspect or advice requires another aspect or advice matched by the custom attribute positioned after the current one.
Require | Before | The current aspect or advice requires another aspect or advice matched by the custom attribute positioned before the current one.
Conflict | Any | The current aspect or advice conflicts with any aspect or advice matched by the custom attribute, at any position.
Conflict | After | The current aspect or advice conflicts with any aspect or advice matched by the custom attribute, if positioned after the current one.
Conflict | Before | The current aspect or advice conflicts with any aspect or advice matched by the custom attribute, if positioned before the current one.
Commute |  | The current aspect or advice commute with any other aspect or advice matched by the custom attribute.
See Also

Reference

PostSharp.Aspects.Dependencies Namespace

Other Resources

Conceptual: Coping with Several Aspects on the Same Target


AspectDependencyAttribute Class

Base class for all custom attributes defining aspect dependencies. An aspect dependency determines the behavior of aspects or advices when used in conjunction with other aspects and advices. Aspect dependencies determine ordering, requirements, conflicts, and commutativity of aspects and advices.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.DependenciesAspectDependencyAttribute
PostSharp.Aspects.DependenciesAdviceDependencyAttribute
PostSharp.Aspects.DependenciesAspectEffectDependencyAttribute
PostSharp.Aspects.DependenciesAspectRoleDependencyAttribute
PostSharp.Aspects.DependenciesAspectTypeDependencyAttribute
PostSharp.Aspects.DependenciesProvideAspectRoleAttribute

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class AspectDependencyAttribute : Attribute

The AspectDependencyAttribute type exposes the following members.

Constructors
 | Name | Description
Protected method | AspectDependencyAttribute(AspectDependencyAction) | Initializes a new AspectDependencyAttribute without specifying the position, implicitly set to Any.
Protected method | AspectDependencyAttribute(AspectDependencyAction, AspectDependencyPosition) | Initializes a new AspectDependencyAttribute and specifies a position.
Top
Properties
 | Name | Description
Public property | Action | Gets the dependency action, i.e. the kind of relationship specified by the dependency (Order, Require, Conflict, or Commute).
Public property | IsWarning | If true, specifies that the constraint (of type Require or Conflict) should emit a warning instead of an error if not respected.
Public property | Position | Gets the position of the current dependency, i.e. actually the position of the other aspect or advices with respect to the one related to this dependency.
Public property | Target | Determines the target (Default or Type) to which the aspect dependency apply.
Public property | TargetType | Aspect type to which this dependency applies. This property is required when the custom attribute is applied at assembly level. It is ignored when applied on class or method level.
Top
Remarks
See Also

Reference

PostSharp.Aspects.Dependencies Namespace

Other Resources

Conceptual: Configuring Aspects
Conceptual: Coping with Several Aspects on the Same Target
Conceptual: Ordering Advices


AspectDependencyAttribute Constructor

Overload List
 | Name | Description
Protected method | AspectDependencyAttribute(AspectDependencyAction) | Initializes a new AspectDependencyAttribute without specifying the position, implicitly set to Any.
Protected method | AspectDependencyAttribute(AspectDependencyAction, AspectDependencyPosition) | Initializes a new AspectDependencyAttribute and specifies a position.
Top
See Also

Reference

AspectDependencyAttribute Class
PostSharp.Aspects.Dependencies Namespace


AspectDependencyAttribute Constructor (AspectDependencyAction)

Initializes a new AspectDependencyAttribute without specifying the position, implicitly set to Any.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected AspectDependencyAttribute(
    AspectDependencyAction action
)

Parameters

action
Type: PostSharp.Aspects.DependenciesAspectDependencyAction
Dependency action.
See Also

Reference

AspectDependencyAttribute Class
AspectDependencyAttribute Overload
PostSharp.Aspects.Dependencies Namespace


AspectDependencyAttribute Constructor (AspectDependencyAction, AspectDependencyPosition)

Initializes a new AspectDependencyAttribute and specifies a position.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected AspectDependencyAttribute(
    AspectDependencyAction action,
    AspectDependencyPosition position
)

Parameters

action
Type: PostSharp.Aspects.DependenciesAspectDependencyAction
Dependency action.
position
Type: PostSharp.Aspects.DependenciesAspectDependencyPosition
Dependency position.
See Also

Reference

AspectDependencyAttribute Class
AspectDependencyAttribute Overload
PostSharp.Aspects.Dependencies Namespace


AspectDependencyAttribute Properties

The AspectDependencyAttribute type exposes the following members.

Properties
 | Name | Description
Public property | Action | Gets the dependency action, i.e. the kind of relationship specified by the dependency (Order, Require, Conflict, or Commute).
Public property | IsWarning | If true, specifies that the constraint (of type Require or Conflict) should emit a warning instead of an error if not respected.
Public property | Position | Gets the position of the current dependency, i.e. actually the position of the other aspect or advices with respect to the one related to this dependency.
Public property | Target | Determines the target (Default or Type) to which the aspect dependency apply.
Public property | TargetType | Aspect type to which this dependency applies. This property is required when the custom attribute is applied at assembly level. It is ignored when applied on class or method level.
Top
See Also

Reference

AspectDependencyAttribute Class
PostSharp.Aspects.Dependencies Namespace


AspectDependencyAttribute.Action Property

AspectDependencyAttributeAction Property

Gets the dependency action, i.e. the kind of relationship specified by the dependency (Order, Require, Conflict, or Commute).

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AspectDependencyAction Action { get; }

Property Value

Type: AspectDependencyAction
Remarks
See documentation of AspectDependencyAction for a description of the meaning of combined Action and Position properties.
See Also

Reference

AspectDependencyAttribute Class
PostSharp.Aspects.Dependencies Namespace


AspectDependencyAttribute.IsWarning Property

AspectDependencyAttributeIsWarning Property

If true, specifies that the constraint (of type Require or Conflict) should emit a warning instead of an error if not respected.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsWarning { get; set; }

Property Value

Type: Boolean
See Also

Reference

AspectDependencyAttribute Class
PostSharp.Aspects.Dependencies Namespace


AspectDependencyAttribute.Position Property

AspectDependencyAttributePosition Property

Gets the position of the current dependency, i.e. actually the position of the other aspect or advices with respect to the one related to this dependency.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AspectDependencyPosition Position { get; }

Property Value

Type: AspectDependencyPosition
Remarks
See documentation of AspectDependencyAction for a description of the meaning of combined Action and Position properties.
See Also

Reference

AspectDependencyAttribute Class
PostSharp.Aspects.Dependencies Namespace


AspectDependencyAttribute.Target Property

AspectDependencyAttributeTarget Property

Determines the target (Default or Type) to which the aspect dependency apply.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AspectDependencyTarget Target { get; set; }

Property Value

Type: AspectDependencyTarget
Remarks
See the documentation of AspectDependencyTarget for details.
See Also

Reference

AspectDependencyAttribute Class
PostSharp.Aspects.Dependencies Namespace


AspectDependencyAttribute.TargetType Property

AspectDependencyAttributeTargetType Property

Aspect type to which this dependency applies. This property is required when the custom attribute is applied at assembly level. It is ignored when applied on class or method level.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Type TargetType { get; set; }

Property Value

Type: Type
See Also

Reference

AspectDependencyAttribute Class
PostSharp.Aspects.Dependencies Namespace

Other Resources

Conceptual: Coping with Several Aspects on the Same Target


AspectDependencyAttributeCollection Class

Collection of AspectDependencyAttribute.
Inheritance Hierarchy
SystemObject
System.Collections.ObjectModelCollection AspectDependencyAttribute
PostSharp.Aspects.DependenciesAspectDependencyAttributeCollection

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class AspectDependencyAttributeCollection : Collection<AspectDependencyAttribute>

The AspectDependencyAttributeCollection type exposes the following members.

Constructors
 | Name | Description
Public method | AspectDependencyAttributeCollection | Initializes a new instance of the AspectDependencyAttributeCollection class
Top
See Also

Reference

PostSharp.Aspects.Dependencies Namespace


AspectDependencyAttributeCollection Constructor

Initializes a new instance of the AspectDependencyAttributeCollection class

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AspectDependencyAttributeCollection()
See Also

Reference

AspectDependencyAttributeCollection Class
PostSharp.Aspects.Dependencies Namespace


AspectDependencyPosition Enumeration

Enumeration of the direction of the relationship specified by an aspect dependency.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum AspectDependencyPosition
Members
Member name | Value | Description
Any | 0 | Any order possible (or order not relevant).
Before | -1 | The current aspect or advice is positioned before the other aspect or handler.
After | 1 | The current aspect or advice is positioned after the other aspect or handler.
See Also

Reference

PostSharp.Aspects.Dependencies Namespace

Other Resources

Conceptual: Coping with Several Aspects on the Same Target


AspectDependencyTarget Enumeration

Enumeration of targets (Default or Type) to which the aspect dependency apply.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum AspectDependencyTarget
Members
Member name | Value | Description
Default | 0 | Natural target of the aspect.
Type | 1 | Declaring type of the natural target of the aspect.
Remarks

This property is meaningful only for aspects that apply to type members. For aspects that apply to types, type-level and default-level dependencies are the same thing.

Member-level aspects may have semantics that actually apply at type level (for instance member introductions and imports). By setting the dependency target to Type, you can specify that the aspect dependency applies to type-level semantics. Otherwise, it will apply to member-level semantics.

See Also

Reference

PostSharp.Aspects.Dependencies Namespace


AspectEffectDependencyAttribute Class

Specifies an aspect dependency matching aspects or advices having a given effect.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.DependenciesAspectDependencyAttribute
PostSharp.Aspects.DependenciesAspectEffectDependencyAttribute

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class AspectEffectDependencyAttribute : AspectDependencyAttribute

The AspectEffectDependencyAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | AspectEffectDependencyAttribute(AspectDependencyAction, String) | Initializes a new AspectEffectDependencyAttribute without specifying the position, implicitly set to Any.
Public method | AspectEffectDependencyAttribute(AspectDependencyAction, AspectDependencyPosition, String) | Initializes a new AspectEffectDependencyAttribute and specifies a position.
Top
Properties
 | Name | Description
Public property | Action | Gets the dependency action, i.e. the kind of relationship specified by the dependency (Order, Require, Conflict, or Commute). (Inherited from AspectDependencyAttribute.)
Public property | Effect | Gets the effect that the aspects or advices must have in order to match the current dependency.
Public property | IsWarning | If true, specifies that the constraint (of type Require or Conflict) should emit a warning instead of an error if not respected. (Inherited from AspectDependencyAttribute.)
Public property | Position | Gets the position of the current dependency, i.e. actually the position of the other aspect or advices with respect to the one related to this dependency. (Inherited from AspectDependencyAttribute.)
Public property | Target | Determines the target (Default or Type) to which the aspect dependency apply. (Inherited from AspectDependencyAttribute.)
Public property | TargetType | Aspect type to which this dependency applies. This property is required when the custom attribute is applied at assembly level. It is ignored when applied on class or method level. (Inherited from AspectDependencyAttribute.)
Top
Remarks

All aspects (except the ones that have an empty implementation) have an effect on the program execution. The current custom attribute allows to express dependencies to aspects according to their effect.

The list of standard effects is given in class StandardEffects. All advices have implicitly the effect Custom. Most advices also have the effect ChangeControlFlow, because they are able to modify the control flow (for instance, skip the execution of the intercepted method or throwing an exception). An aspect or advice can declare it does not have a given effect by using the WaiveAspectEffectAttribute custom attribute.

Remarks
See Also

Reference

PostSharp.Aspects.Dependencies Namespace
PostSharp.Aspects.DependenciesStandardEffects
PostSharp.Aspects.DependenciesWaiveAspectEffectAttribute

Other Resources

Conceptual: Configuring Aspects
Conceptual: Coping with Several Aspects on the Same Target


AspectEffectDependencyAttribute Constructor

Overload List
 | Name | Description
Public method | AspectEffectDependencyAttribute(AspectDependencyAction, String) | Initializes a new AspectEffectDependencyAttribute without specifying the position, implicitly set to Any.
Public method | AspectEffectDependencyAttribute(AspectDependencyAction, AspectDependencyPosition, String) | Initializes a new AspectEffectDependencyAttribute and specifies a position.
Top
See Also

Reference

AspectEffectDependencyAttribute Class
PostSharp.Aspects.Dependencies Namespace


AspectEffectDependencyAttribute Constructor (AspectDependencyAction, String)

Initializes a new AspectEffectDependencyAttribute without specifying the position, implicitly set to Any.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AspectEffectDependencyAttribute(
    AspectDependencyAction action,
    string effect
)

Parameters

action
Type: PostSharp.Aspects.DependenciesAspectDependencyAction
Dependency action.
effect
Type: SystemString
Effect (see StandardEffects).
See Also

Reference

AspectEffectDependencyAttribute Class
AspectEffectDependencyAttribute Overload
PostSharp.Aspects.Dependencies Namespace


AspectEffectDependencyAttribute Constructor (AspectDependencyAction, AspectDependencyPosition, String)

Initializes a new AspectEffectDependencyAttribute and specifies a position.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AspectEffectDependencyAttribute(
    AspectDependencyAction action,
    AspectDependencyPosition position,
    string effect
)

Parameters

action
Type: PostSharp.Aspects.DependenciesAspectDependencyAction
Dependency action.
position
Type: PostSharp.Aspects.DependenciesAspectDependencyPosition
Dependency position.
effect
Type: SystemString
Effect (see StandardEffects).
See Also

Reference

AspectEffectDependencyAttribute Class
AspectEffectDependencyAttribute Overload
PostSharp.Aspects.Dependencies Namespace


AspectEffectDependencyAttribute Properties

The AspectEffectDependencyAttribute type exposes the following members.

Properties
 | Name | Description
Public property | Action | Gets the dependency action, i.e. the kind of relationship specified by the dependency (Order, Require, Conflict, or Commute). (Inherited from AspectDependencyAttribute.)
Public property | Effect | Gets the effect that the aspects or advices must have in order to match the current dependency.
Public property | IsWarning | If true, specifies that the constraint (of type Require or Conflict) should emit a warning instead of an error if not respected. (Inherited from AspectDependencyAttribute.)
Public property | Position | Gets the position of the current dependency, i.e. actually the position of the other aspect or advices with respect to the one related to this dependency. (Inherited from AspectDependencyAttribute.)
Public property | Target | Determines the target (Default or Type) to which the aspect dependency apply. (Inherited from AspectDependencyAttribute.)
Public property | TargetType | Aspect type to which this dependency applies. This property is required when the custom attribute is applied at assembly level. It is ignored when applied on class or method level. (Inherited from AspectDependencyAttribute.)
Top
See Also

Reference

AspectEffectDependencyAttribute Class
PostSharp.Aspects.Dependencies Namespace


AspectEffectDependencyAttribute.Effect Property

AspectEffectDependencyAttributeEffect Property

Gets the effect that the aspects or advices must have in order to match the current dependency.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string Effect { get; }

Property Value

Type: String
See Also

Reference

AspectEffectDependencyAttribute Class
PostSharp.Aspects.Dependencies Namespace


AspectRoleDependencyAttribute Class

Specifies an aspect dependency matching aspects or advices that are a part of a given role.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.DependenciesAspectDependencyAttribute
PostSharp.Aspects.DependenciesAspectRoleDependencyAttribute

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class AspectRoleDependencyAttribute : AspectDependencyAttribute

The AspectRoleDependencyAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | AspectRoleDependencyAttribute(AspectDependencyAction, String) | Initializes a new AspectEffectDependencyAttribute without specifying the position, implicitly set to Any.
Public method | AspectRoleDependencyAttribute(AspectDependencyAction, AspectDependencyPosition, String) | Initializes a new AspectRoleDependencyAttribute and specifies a position.
Top
Properties
 | Name | Description
Public property | Action | Gets the dependency action, i.e. the kind of relationship specified by the dependency (Order, Require, Conflict, or Commute). (Inherited from AspectDependencyAttribute.)
Public property | IsWarning | If true, specifies that the constraint (of type Require or Conflict) should emit a warning instead of an error if not respected. (Inherited from AspectDependencyAttribute.)
Public property | Position | Gets the position of the current dependency, i.e. actually the position of the other aspect or advices with respect to the one related to this dependency. (Inherited from AspectDependencyAttribute.)
Public property | Role | Gets the role that the aspects or advices must be a part of in order to match the current dependency.
Public property | Target | Determines the target (Default or Type) to which the aspect dependency apply. (Inherited from AspectDependencyAttribute.)
Public property | TargetType | Aspect type to which this dependency applies. This property is required when the custom attribute is applied at assembly level. It is ignored when applied on class or method level. (Inherited from AspectDependencyAttribute.)
Top
Remarks

A role describes what the aspect actually does. A list of standard roles is available on the class StandardRoles. Aspect vendors are encouraged to enroll their aspects in one of these roles whenever it makes sense, and to document the other roles they have used.

An aspect or advice can be enrolled in a role by using the ProvideAspectRoleAttribute custom attribute.

See Also

Reference

PostSharp.Aspects.Dependencies Namespace
PostSharp.Aspects.DependenciesProvideAspectRoleAttribute
PostSharp.Aspects.DependenciesStandardRoles

Other Resources

Conceptual: Configuring Aspects
Conceptual: Coping with Several Aspects on the Same Target


AspectRoleDependencyAttribute Constructor

Overload List
 | Name | Description
Public method | AspectRoleDependencyAttribute(AspectDependencyAction, String) | Initializes a new AspectEffectDependencyAttribute without specifying the position, implicitly set to Any.
Public method | AspectRoleDependencyAttribute(AspectDependencyAction, AspectDependencyPosition, String) | Initializes a new AspectRoleDependencyAttribute and specifies a position.
Top
See Also

Reference

AspectRoleDependencyAttribute Class
PostSharp.Aspects.Dependencies Namespace


AspectRoleDependencyAttribute Constructor (AspectDependencyAction, String)

Initializes a new AspectEffectDependencyAttribute without specifying the position, implicitly set to Any.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AspectRoleDependencyAttribute(
    AspectDependencyAction action,
    string role
)

Parameters

action
Type: PostSharp.Aspects.DependenciesAspectDependencyAction
Dependency action.
role
Type: SystemString
Role.
See Also

Reference

AspectRoleDependencyAttribute Class
AspectRoleDependencyAttribute Overload
PostSharp.Aspects.Dependencies Namespace


AspectRoleDependencyAttribute Constructor (AspectDependencyAction, AspectDependencyPosition, String)

Initializes a new AspectRoleDependencyAttribute and specifies a position.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AspectRoleDependencyAttribute(
    AspectDependencyAction action,
    AspectDependencyPosition position,
    string role
)

Parameters

action
Type: PostSharp.Aspects.DependenciesAspectDependencyAction
Dependency action.
position
Type: PostSharp.Aspects.DependenciesAspectDependencyPosition
Dependency position.
role
Type: SystemString
Role.
See Also

Reference

AspectRoleDependencyAttribute Class
AspectRoleDependencyAttribute Overload
PostSharp.Aspects.Dependencies Namespace


AspectRoleDependencyAttribute Properties

The AspectRoleDependencyAttribute type exposes the following members.

Properties
 | Name | Description
Public property | Action | Gets the dependency action, i.e. the kind of relationship specified by the dependency (Order, Require, Conflict, or Commute). (Inherited from AspectDependencyAttribute.)
Public property | IsWarning | If true, specifies that the constraint (of type Require or Conflict) should emit a warning instead of an error if not respected. (Inherited from AspectDependencyAttribute.)
Public property | Position | Gets the position of the current dependency, i.e. actually the position of the other aspect or advices with respect to the one related to this dependency. (Inherited from AspectDependencyAttribute.)
Public property | Role | Gets the role that the aspects or advices must be a part of in order to match the current dependency.
Public property | Target | Determines the target (Default or Type) to which the aspect dependency apply. (Inherited from AspectDependencyAttribute.)
Public property | TargetType | Aspect type to which this dependency applies. This property is required when the custom attribute is applied at assembly level. It is ignored when applied on class or method level. (Inherited from AspectDependencyAttribute.)
Top
See Also

Reference

AspectRoleDependencyAttribute Class
PostSharp.Aspects.Dependencies Namespace


AspectRoleDependencyAttribute.Role Property

AspectRoleDependencyAttributeRole Property

Gets the role that the aspects or advices must be a part of in order to match the current dependency.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string Role { get; }

Property Value

Type: String
See Also

Reference

AspectRoleDependencyAttribute Class
PostSharp.Aspects.Dependencies Namespace


AspectTypeDependencyAttribute Class

Specifies an aspect dependency matching aspects of a specified type, and all its advices.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.DependenciesAspectDependencyAttribute
PostSharp.Aspects.DependenciesAspectTypeDependencyAttribute

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class AspectTypeDependencyAttribute : AspectDependencyAttribute

The AspectTypeDependencyAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | AspectTypeDependencyAttribute(AspectDependencyAction, Type) | Initializes a new AspectTypeDependencyAttribute without specifying the position, implicitly set to Any.
Public method | AspectTypeDependencyAttribute(AspectDependencyAction, AspectDependencyPosition, Type) | Initializes a new AspectTypeDependencyAttribute and specifies a position.
Top
Properties
 | Name | Description
Public property | Action | Gets the dependency action, i.e. the kind of relationship specified by the dependency (Order, Require, Conflict, or Commute). (Inherited from AspectDependencyAttribute.)
Public property | AspectType | Gets the type from which the aspects should be derived in order to match the current dependency.
Public property | IsWarning | If true, specifies that the constraint (of type Require or Conflict) should emit a warning instead of an error if not respected. (Inherited from AspectDependencyAttribute.)
Public property | Position | Gets the position of the current dependency, i.e. actually the position of the other aspect or advices with respect to the one related to this dependency. (Inherited from AspectDependencyAttribute.)
Public property | Target | Determines the target (Default or Type) to which the aspect dependency apply. (Inherited from AspectDependencyAttribute.)
Public property | TargetType | Aspect type to which this dependency applies. This property is required when the custom attribute is applied at assembly level. It is ignored when applied on class or method level. (Inherited from AspectDependencyAttribute.)
Top
See Also

Reference

PostSharp.Aspects.Dependencies Namespace

Other Resources

Conceptual: Configuring Aspects
Conceptual: Coping with Several Aspects on the Same Target


AspectTypeDependencyAttribute Constructor

Overload List
 | Name | Description
Public method | AspectTypeDependencyAttribute(AspectDependencyAction, Type) | Initializes a new AspectTypeDependencyAttribute without specifying the position, implicitly set to Any.
Public method | AspectTypeDependencyAttribute(AspectDependencyAction, AspectDependencyPosition, Type) | Initializes a new AspectTypeDependencyAttribute and specifies a position.
Top
See Also

Reference

AspectTypeDependencyAttribute Class
PostSharp.Aspects.Dependencies Namespace


AspectTypeDependencyAttribute Constructor (AspectDependencyAction, Type)

Initializes a new AspectTypeDependencyAttribute without specifying the position, implicitly set to Any.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AspectTypeDependencyAttribute(
    AspectDependencyAction action,
    Type aspectType
)

Parameters

action
Type: PostSharp.Aspects.DependenciesAspectDependencyAction
Dependency action.
aspectType
Type: SystemType
Aspect type (derived from IAspect).
See Also

Reference

AspectTypeDependencyAttribute Class
AspectTypeDependencyAttribute Overload
PostSharp.Aspects.Dependencies Namespace


AspectTypeDependencyAttribute Constructor (AspectDependencyAction, AspectDependencyPosition, Type)

Initializes a new AspectTypeDependencyAttribute and specifies a position.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AspectTypeDependencyAttribute(
    AspectDependencyAction action,
    AspectDependencyPosition position,
    Type aspectType
)

Parameters

action
Type: PostSharp.Aspects.DependenciesAspectDependencyAction
Dependency action.
position
Type: PostSharp.Aspects.DependenciesAspectDependencyPosition
Dependency position.
aspectType
Type: SystemType
Aspect type (derived from IAspect).
Remarks
See Also

Reference

AspectTypeDependencyAttribute Class
AspectTypeDependencyAttribute Overload
PostSharp.Aspects.Dependencies Namespace


AspectTypeDependencyAttribute Properties

The AspectTypeDependencyAttribute type exposes the following members.

Properties
 | Name | Description
Public property | Action | Gets the dependency action, i.e. the kind of relationship specified by the dependency (Order, Require, Conflict, or Commute). (Inherited from AspectDependencyAttribute.)
Public property | AspectType | Gets the type from which the aspects should be derived in order to match the current dependency.
Public property | IsWarning | If true, specifies that the constraint (of type Require or Conflict) should emit a warning instead of an error if not respected. (Inherited from AspectDependencyAttribute.)
Public property | Position | Gets the position of the current dependency, i.e. actually the position of the other aspect or advices with respect to the one related to this dependency. (Inherited from AspectDependencyAttribute.)
Public property | Target | Determines the target (Default or Type) to which the aspect dependency apply. (Inherited from AspectDependencyAttribute.)
Public property | TargetType | Aspect type to which this dependency applies. This property is required when the custom attribute is applied at assembly level. It is ignored when applied on class or method level. (Inherited from AspectDependencyAttribute.)
Top
See Also

Reference

AspectTypeDependencyAttribute Class
PostSharp.Aspects.Dependencies Namespace


AspectTypeDependencyAttribute.AspectType Property

AspectTypeDependencyAttributeAspectType Property

Gets the type from which the aspects should be derived in order to match the current dependency.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Type AspectType { get; }

Property Value

Type: Type
See Also

Reference

AspectTypeDependencyAttribute Class
PostSharp.Aspects.Dependencies Namespace


ProvideAspectRoleAttribute Class

Specifies that the aspect or aspect advice to which this custom attribute is applied is a part of a given role. This aspect or advice can then be matched by AspectRoleDependencyAttribute/
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.DependenciesAspectDependencyAttribute
PostSharp.Aspects.DependenciesProvideAspectRoleAttribute

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ProvideAspectRoleAttribute : AspectDependencyAttribute

The ProvideAspectRoleAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | ProvideAspectRoleAttribute | Initializes a new ProvideAspectRoleAttribute.
Top
Properties
 | Name | Description
Public property | Action | Gets the dependency action, i.e. the kind of relationship specified by the dependency (Order, Require, Conflict, or Commute). (Inherited from AspectDependencyAttribute.)
Public property | IsWarning | If true, specifies that the constraint (of type Require or Conflict) should emit a warning instead of an error if not respected. (Inherited from AspectDependencyAttribute.)
Public property | Position | Gets the position of the current dependency, i.e. actually the position of the other aspect or advices with respect to the one related to this dependency. (Inherited from AspectDependencyAttribute.)
Public property | Role | Gets the role into which the aspect or advice to which this custom attribute is applied will be enrolled.
Public property | Target | Determines the target (Default or Type) to which the aspect dependency apply. (Inherited from AspectDependencyAttribute.)
Public property | TargetType | Aspect type to which this dependency applies. This property is required when the custom attribute is applied at assembly level. It is ignored when applied on class or method level. (Inherited from AspectDependencyAttribute.)
Top
Remarks
See Also

Reference

PostSharp.Aspects.Dependencies Namespace
PostSharp.Aspects.DependenciesAspectRoleDependencyAttribute

Other Resources

Conceptual: Configuring Aspects
Conceptual: Coping with Several Aspects on the Same Target


ProvideAspectRoleAttribute Constructor

Initializes a new ProvideAspectRoleAttribute.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ProvideAspectRoleAttribute(
    string role
)

Parameters

role
Type: SystemString
Role.
See Also

Reference

ProvideAspectRoleAttribute Class
PostSharp.Aspects.Dependencies Namespace


ProvideAspectRoleAttribute Properties

The ProvideAspectRoleAttribute type exposes the following members.

Properties
 | Name | Description
Public property | Action | Gets the dependency action, i.e. the kind of relationship specified by the dependency (Order, Require, Conflict, or Commute). (Inherited from AspectDependencyAttribute.)
Public property | IsWarning | If true, specifies that the constraint (of type Require or Conflict) should emit a warning instead of an error if not respected. (Inherited from AspectDependencyAttribute.)
Public property | Position | Gets the position of the current dependency, i.e. actually the position of the other aspect or advices with respect to the one related to this dependency. (Inherited from AspectDependencyAttribute.)
Public property | Role | Gets the role into which the aspect or advice to which this custom attribute is applied will be enrolled.
Public property | Target | Determines the target (Default or Type) to which the aspect dependency apply. (Inherited from AspectDependencyAttribute.)
Public property | TargetType | Aspect type to which this dependency applies. This property is required when the custom attribute is applied at assembly level. It is ignored when applied on class or method level. (Inherited from AspectDependencyAttribute.)
Top
See Also

Reference

ProvideAspectRoleAttribute Class
PostSharp.Aspects.Dependencies Namespace


ProvideAspectRoleAttribute.Role Property

ProvideAspectRoleAttributeRole Property

Gets the role into which the aspect or advice to which this custom attribute is applied will be enrolled.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string Role { get; }

Property Value

Type: String
See Also

Reference

ProvideAspectRoleAttribute Class
PostSharp.Aspects.Dependencies Namespace


StandardEffects Class

List of standard effects.
Inheritance Hierarchy
SystemObject
PostSharp.Aspects.DependenciesStandardEffects

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static class StandardEffects

The StandardEffects type exposes the following members.

Methods
Name | Description
GetInterfaceIntroductionEffect | Gets a string representing the effect of introducing an interface into a type.
GetMemberImportEffect | Gets a string representing the effect of importing a member into from the target type into the aspect.
GetMemberIntroductionEffect | Gets a string representing the effect of introducing a member into a type.
Top
Fields
Name | Description
ChangeControlFlow | Change the flow control (for instance by having the possibility to skip execution of an intercepted method).
Custom | Custom effect (implemented in an aspect advice). All advices have this effect by default, unless they are annotated by WaiveAspectEffectAttribute.
CustomAttributeIntroduction | Introduction of a custom attribute.
InterfaceIntroduction | Introduction of an interface.
MemberImport | Import of a type member.
MemberIntroduction | Introduction of a type member.
Top
Remarks

See AspectEffectDependencyAttribute for a discussion of effects.

This list is not meant to be extended by vendors providing concrete aspects (implementing some business functionality). Roles should be used to categorized the business effect of concrete aspects. However, if you implement a new kind of abstract aspect (for instance member suppression), you may need to define new effects.

In that case, we at PostSharp encourage you contact us to define a new role string. If you define a new role string, we recommend you clearly define it so that users of your aspect can express dependencies with their own aspects, or third-party aspects.

See Also

Reference

PostSharp.Aspects.Dependencies Namespace
PostSharp.Aspects.DependenciesAspectEffectDependencyAttribute
PostSharp.Aspects.DependenciesWaiveAspectEffectAttribute
PostSharp.Aspects.DependenciesStandardRoles

Other Resources

Conceptual: Configuring Aspects
Conceptual: Coping with Several Aspects on the Same Target


StandardEffects Methods

The StandardEffects type exposes the following members.

Methods
Name | Description
GetInterfaceIntroductionEffect | Gets a string representing the effect of introducing an interface into a type.
GetMemberImportEffect | Gets a string representing the effect of importing a member into from the target type into the aspect.
GetMemberIntroductionEffect | Gets a string representing the effect of introducing a member into a type.
Top
See Also

Reference

StandardEffects Class
PostSharp.Aspects.Dependencies Namespace


StandardEffects.GetInterfaceIntroductionEffect Method

StandardEffectsGetInterfaceIntroductionEffect Method

Gets a string representing the effect of introducing an interface into a type.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static string GetInterfaceIntroductionEffect(
    string typeName
)

Parameters

typeName
Type: SystemString
Name of the introduced interface.

Return Value

Type: String
A string that, by convention, represents the introduction of an interface named typeName into a type.
See Also

Reference

StandardEffects Class
PostSharp.Aspects.Dependencies Namespace


StandardEffects.GetMemberImportEffect Method

StandardEffectsGetMemberImportEffect Method

Gets a string representing the effect of importing a member into from the target type into the aspect.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static string GetMemberImportEffect(
    string memberName
)

Parameters

memberName
Type: SystemString
Name of the imported member.

Return Value

Type: String
A string that, by convention, represents the import of a member named memberName from the target type into the aspect.
See Also

Reference

StandardEffects Class
PostSharp.Aspects.Dependencies Namespace


StandardEffects.GetMemberIntroductionEffect Method

StandardEffectsGetMemberIntroductionEffect Method

Gets a string representing the effect of introducing a member into a type.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static string GetMemberIntroductionEffect(
    string memberName
)

Parameters

memberName
Type: SystemString
Name of the introduced member.

Return Value

Type: String
A string that, by convention, represents the introduction of a member named memberName into a type.
See Also

Reference

StandardEffects Class
PostSharp.Aspects.Dependencies Namespace


StandardEffects Fields

The StandardEffects type exposes the following members.

Fields
Name | Description
ChangeControlFlow | Change the flow control (for instance by having the possibility to skip execution of an intercepted method).
Custom | Custom effect (implemented in an aspect advice). All advices have this effect by default, unless they are annotated by WaiveAspectEffectAttribute.
CustomAttributeIntroduction | Introduction of a custom attribute.
InterfaceIntroduction | Introduction of an interface.
MemberImport | Import of a type member.
MemberIntroduction | Introduction of a type member.
Top
See Also

Reference

StandardEffects Class
PostSharp.Aspects.Dependencies Namespace


StandardEffects.ChangeControlFlow Field

StandardEffectsChangeControlFlow Field

Change the flow control (for instance by having the possibility to skip execution of an intercepted method).

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string ChangeControlFlow = "ChangeControlFlow"

Field Value

Type: String
See Also

Reference

StandardEffects Class
PostSharp.Aspects.Dependencies Namespace


StandardEffects.Custom Field

StandardEffectsCustom Field

Custom effect (implemented in an aspect advice). All advices have this effect by default, unless they are annotated by WaiveAspectEffectAttribute.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string Custom = "Custom"

Field Value

Type: String
See Also

Reference

StandardEffects Class
PostSharp.Aspects.Dependencies Namespace


StandardEffects.CustomAttributeIntroduction Field

StandardEffectsCustomAttributeIntroduction Field

Introduction of a custom attribute.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string CustomAttributeIntroduction = "CustomAttributeIntroduction"

Field Value

Type: String
See Also

Reference

StandardEffects Class
PostSharp.Aspects.Dependencies Namespace


StandardEffects.InterfaceIntroduction Field

StandardEffectsInterfaceIntroduction Field

Introduction of an interface.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string InterfaceIntroduction = "InterfaceIntroduction"

Field Value

Type: String
See Also

Reference

StandardEffects Class
PostSharp.Aspects.Dependencies Namespace


StandardEffects.MemberImport Field

StandardEffectsMemberImport Field

Import of a type member.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string MemberImport = "MemberImport"

Field Value

Type: String
See Also

Reference

StandardEffects Class
PostSharp.Aspects.Dependencies Namespace


StandardEffects.MemberIntroduction Field

StandardEffectsMemberIntroduction Field

Introduction of a type member.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string MemberIntroduction = "MemberIntroduction"

Field Value

Type: String
See Also

Reference

StandardEffects Class
PostSharp.Aspects.Dependencies Namespace


StandardRoles Class

List of standard roles.
Inheritance Hierarchy
SystemObject
PostSharp.Aspects.DependenciesStandardRoles

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static class StandardRoles

The StandardRoles type exposes the following members.

Fields
Name | Description
Caching | Caching.
DataBinding | Data binding (for instance implementation of INotifyPropertyChanged).
EventBroker | Event broker (a system role used internally by PostSharp to realize the OnInvokeHandler(EventInterceptionArgs) handler).
ExceptionHandling | Exception handling.
PerformanceInstrumentation | Performance instrumentation (for instance performance counters).
Persistence | Object persistence (for instance Object-Relational Mapper).
Security | Security enforcing (typically authorization).
Threading | Threading (locking).
Tracing | Tracing and logging.
TransactionHandling | Transaction handling.
Validation | Validation of field, property, or parameter value.
Top
Remarks

See AspectRoleDependencyAttribute for a discussion of aspect roles.

Roles are used to categorize aspects according to their function. This class defines standard names for the most commonly used aspect roles. If you are an aspect vendor, you are encouraged to enroll your aspects (using ProvideAspectRoleAttribute) into one of these roles.

If this list is not sufficient, we at PostSharp encourage you contact us to define a new role string. In any case, if you define a new role string, we recommend you clearly define it so that users of your aspect can express dependencies with their own aspects, or third-party aspects.

See Also

Reference

PostSharp.Aspects.Dependencies Namespace

Other Resources

Conceptual: Configuring Aspects
Conceptual: Coping with Several Aspects on the Same Target


StandardRoles Fields

The StandardRoles type exposes the following members.

Fields
Name | Description
Caching | Caching.
DataBinding | Data binding (for instance implementation of INotifyPropertyChanged).
EventBroker | Event broker (a system role used internally by PostSharp to realize the OnInvokeHandler(EventInterceptionArgs) handler).
ExceptionHandling | Exception handling.
PerformanceInstrumentation | Performance instrumentation (for instance performance counters).
Persistence | Object persistence (for instance Object-Relational Mapper).
Security | Security enforcing (typically authorization).
Threading | Threading (locking).
Tracing | Tracing and logging.
TransactionHandling | Transaction handling.
Validation | Validation of field, property, or parameter value.
Top
See Also

Reference

StandardRoles Class
PostSharp.Aspects.Dependencies Namespace


StandardRoles.Caching Field

StandardRolesCaching Field

Caching.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string Caching = "Caching"

Field Value

Type: String
See Also

Reference

StandardRoles Class
PostSharp.Aspects.Dependencies Namespace


StandardRoles.DataBinding Field

StandardRolesDataBinding Field

Data binding (for instance implementation of INotifyPropertyChanged).

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string DataBinding = "DataBinding"

Field Value

Type: String
See Also

Reference

StandardRoles Class
PostSharp.Aspects.Dependencies Namespace


StandardRoles.EventBroker Field

StandardRolesEventBroker Field

Event broker (a system role used internally by PostSharp to realize the OnInvokeHandler(EventInterceptionArgs) handler).

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string EventBroker = "Event Broker"

Field Value

Type: String
See Also

Reference

StandardRoles Class
PostSharp.Aspects.Dependencies Namespace


StandardRoles.ExceptionHandling Field

StandardRolesExceptionHandling Field

Exception handling.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string ExceptionHandling = "ExceptionHandling"

Field Value

Type: String
See Also

Reference

StandardRoles Class
PostSharp.Aspects.Dependencies Namespace


StandardRoles.PerformanceInstrumentation Field

StandardRolesPerformanceInstrumentation Field

Performance instrumentation (for instance performance counters).

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string PerformanceInstrumentation = "PerformanceInstrumentation"

Field Value

Type: String
See Also

Reference

StandardRoles Class
PostSharp.Aspects.Dependencies Namespace


StandardRoles.Persistence Field

StandardRolesPersistence Field

Object persistence (for instance Object-Relational Mapper).

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string Persistence = "Persistence"

Field Value

Type: String
See Also

Reference

StandardRoles Class
PostSharp.Aspects.Dependencies Namespace


StandardRoles.Security Field

StandardRolesSecurity Field

Security enforcing (typically authorization).

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string Security = "Security"

Field Value

Type: String
See Also

Reference

StandardRoles Class
PostSharp.Aspects.Dependencies Namespace


StandardRoles.Threading Field

StandardRolesThreading Field

Threading (locking).

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string Threading = "Threading"

Field Value

Type: String
See Also

Reference

StandardRoles Class
PostSharp.Aspects.Dependencies Namespace


StandardRoles.Tracing Field

StandardRolesTracing Field

Tracing and logging.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string Tracing = "Tracing"

Field Value

Type: String
See Also

Reference

StandardRoles Class
PostSharp.Aspects.Dependencies Namespace


StandardRoles.TransactionHandling Field

StandardRolesTransactionHandling Field

Transaction handling.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string TransactionHandling = "Transaction"

Field Value

Type: String
See Also

Reference

StandardRoles Class
PostSharp.Aspects.Dependencies Namespace


StandardRoles.Validation Field

StandardRolesValidation Field

Validation of field, property, or parameter value.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string Validation = "Validation"

Field Value

Type: String
See Also

Reference

StandardRoles Class
PostSharp.Aspects.Dependencies Namespace


WaiveAspectEffectAttribute Class

Declares that the aspect class or advice to which this custom attribute is applied is exempt of a given effect.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Aspects.DependenciesWaiveAspectEffectAttribute

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class WaiveAspectEffectAttribute : Attribute
Constructors
 | Name | Description
Public method | WaiveAspectEffectAttribute | Initializes a new WaiveAspectEffectAttribute declaring that the aspect class or advice to which this custom attribute is applied has no effect at all.
Public method | WaiveAspectEffectAttribute(String) | Initializes a new WaiveAspectEffectAttribute declaring that the aspect class or advice to which this custom attribute is applied is exempt of the specified effects.
Top
Remarks
See AspectEffectDependencyAttribute for details about effects.
Remarks
See Also

Reference

PostSharp.Aspects.Dependencies Namespace

Other Resources

Conceptual: Configuring Aspects
Conceptual: Coping with Several Aspects on the Same Target


WaiveAspectEffectAttribute Constructor

Overload List
 | Name | Description
Public method | WaiveAspectEffectAttribute | Initializes a new WaiveAspectEffectAttribute declaring that the aspect class or advice to which this custom attribute is applied has no effect at all.
Public method | WaiveAspectEffectAttribute(String) | Initializes a new WaiveAspectEffectAttribute declaring that the aspect class or advice to which this custom attribute is applied is exempt of the specified effects.
Top
See Also

Reference

WaiveAspectEffectAttribute Class
PostSharp.Aspects.Dependencies Namespace


WaiveAspectEffectAttribute Constructor

Initializes a new WaiveAspectEffectAttribute declaring that the aspect class or advice to which this custom attribute is applied has no effect at all.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public WaiveAspectEffectAttribute()
See Also

Reference

WaiveAspectEffectAttribute Class
WaiveAspectEffectAttribute Overload
PostSharp.Aspects.Dependencies Namespace


WaiveAspectEffectAttribute Constructor (String[])

WaiveAspectEffectAttribute Constructor (String)

Initializes a new WaiveAspectEffectAttribute declaring that the aspect class or advice to which this custom attribute is applied is exempt of the specified effects.

Namespace: PostSharp.Aspects.Dependencies
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public WaiveAspectEffectAttribute(
    params string[] effects
)

Parameters

effects
Type: SystemString
List of effects of which the aspect class or advice to which this custom attribute is applied is guaranteed to be exempt.
See Also

Reference

WaiveAspectEffectAttribute Class
WaiveAspectEffectAttribute Overload
PostSharp.Aspects.Dependencies Namespace


PostSharp.Aspects.Internals Namespace

Classes
 | Class | Description
Public class | ArgumentsTArg0 | Implementation of Arguments representing a list of 1 argument.
Public class | ArgumentsTArg0, TArg1 | Implementation of Arguments representing a list of 2 arguments.
Public class | ArgumentsTArg0, TArg1, TArg2 | Implementation of Arguments representing a list of 3 arguments.
Public class | ArgumentsTArg0, TArg1, TArg2, TArg3 | Implementation of Arguments representing a list of 4 arguments.
Public class | ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4 | Implementation of Arguments representing a list of 5 arguments.
Public class | ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5 | Implementation of Arguments representing a list of 6 arguments.
Public class | ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6 | Implementation of Arguments representing a list of 7 arguments.
Public class | ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7 | Implementation of Arguments representing a list of 8 arguments.
Public class | ArgumentsArray | Implementation of Arguments representing a list of arguments of arbitrary length and type.
Public class | EventInterceptor |
Public class | SafeEventBroker |


Arguments(TArg0) Class

ArgumentsTArg0 Class

Implementation of Arguments representing a list of 1 argument.
Inheritance Hierarchy
SystemObject
PostSharp.AspectsArguments
PostSharp.Aspects.InternalsArgumentsTArg0

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class Arguments<TArg0> : Arguments

Type Parameters

TArg0
Type of the first argument.

The ArgumentsTArg0 type exposes the following members.

Constructors
 | Name | Description
Public method | ArgumentsTArg0 | Initializes a new ArgumentsTArg0.
Top
Properties
 | Name | Description
Public property | Count | Gets the number of arguments encapsulated by the current object. (Inherited from Arguments.)
Public property | Item | Gets or sets the value of an argument. (Inherited from Arguments.)
Top
Methods
 | Name | Description
Public method | Clone | Returns a shallow copy of the current object. (Inherited from Arguments.)
Public method | CopyFrom | Copies all the argument values from the elements of Array. (Overrides ArgumentsCopyFrom(Object, Int32).)
Public method | CopyTo | Copies all arguments values to the specified Array starting at the specified destination Array index. (Overrides ArgumentsCopyTo(Object, Int32).)
Public method | GetArgument | Gets the value of the argument at a given index. (Overrides ArgumentsGetArgument(Int32).)
Public method | GetEnumerator | Returns an enumerator that iterates through the collection. (Inherited from Arguments.)
Public method | SetArgument | Sets the value of the argument at a given index. (Overrides ArgumentsSetArgument(Int32, Object).)
Public method | ToArray | Converts the current argument list into an Array. (Inherited from Arguments.)
Top
Fields
 | Name | Description
Public field | Arg0 | First Argument.
Top
See Also

Reference

PostSharp.Aspects.Internals Namespace


Arguments(TArg0) Constructor

ArgumentsTArg0 Constructor

Initializes a new ArgumentsTArg0.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Arguments()
See Also

Reference

ArgumentsTArg0 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0) Properties

ArgumentsTArg0 Properties

The ArgumentsTArg0 generic type exposes the following members.

Properties
 | Name | Description
Public property | Count | Gets the number of arguments encapsulated by the current object. (Inherited from Arguments.)
Public property | Item | Gets or sets the value of an argument. (Inherited from Arguments.)
Top
See Also

Reference

ArgumentsTArg0 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0) Methods

ArgumentsTArg0 Methods

The ArgumentsTArg0 generic type exposes the following members.

Methods
 | Name | Description
Public method | Clone | Returns a shallow copy of the current object. (Inherited from Arguments.)
Public method | CopyFrom | Copies all the argument values from the elements of Array. (Overrides ArgumentsCopyFrom(Object, Int32).)
Public method | CopyTo | Copies all arguments values to the specified Array starting at the specified destination Array index. (Overrides ArgumentsCopyTo(Object, Int32).)
Public method | GetArgument | Gets the value of the argument at a given index. (Overrides ArgumentsGetArgument(Int32).)
Public method | GetEnumerator | Returns an enumerator that iterates through the collection. (Inherited from Arguments.)
Public method | SetArgument | Sets the value of the argument at a given index. (Overrides ArgumentsSetArgument(Int32, Object).)
Public method | ToArray | Converts the current argument list into an Array. (Inherited from Arguments.)
Top
See Also

Reference

ArgumentsTArg0 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0).CopyFrom Method

ArgumentsTArg0CopyFrom Method

Copies all the argument values from the elements of Array.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void CopyFrom(
    Object[] array,
    int index
)

Parameters

array
Type: SystemObject
The array that is the source of the argument values copied into the current Arguments.
index
Type: SystemInt32
An integer that represents the index in array at which copying begins.
Exceptions
Exception | Condition
ArgumentNullException | array is null.
ArgumentOutOfRangeException | index is lower than zero.
See Also

Reference

ArgumentsTArg0 Class
PostSharp.Aspects.Internals Namespace
ArgumentsCopyTo(Object, Int32)


Arguments(TArg0).CopyTo Method

ArgumentsTArg0CopyTo Method

Copies all arguments values to the specified Array starting at the specified destination Array index.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void CopyTo(
    Object[] array,
    int index
)

Parameters

array
Type: SystemObject
The array that is the destination of argument values copied from the current Arguments.
index
Type: SystemInt32
An integer that represents the index in array at which copying begins

Implements

ICollectionTCopyTo(T, Int32)
Exceptions
Exception | Condition
ArgumentNullException | array is null.
ArgumentOutOfRangeException | arrayIndex is less than 0.
ArgumentException | The number of elements in the source ICollectionT is greater than the available space from arrayIndex to the end of the destination array.
See Also

Reference

ArgumentsTArg0 Class
PostSharp.Aspects.Internals Namespace
ArgumentsCopyFrom(Object, Int32)


Arguments(TArg0).GetArgument Method

ArgumentsTArg0GetArgument Method

Gets the value of the argument at a given index.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Object GetArgument(
    int index
)

Parameters

index
Type: SystemInt32
Argument index.

Return Value

Type: Object
The value of the argument at position index.
Exceptions
Exception | Condition
ArgumentOutOfRangeException | index is lower than zero or greater or equal than Count.
See Also

Reference

ArgumentsTArg0 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0).SetArgument Method

ArgumentsTArg0SetArgument Method

Sets the value of the argument at a given index.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void SetArgument(
    int index,
    Object value
)

Parameters

index
Type: SystemInt32
Argument index.
value
Type: SystemObject
New value of the argument at position index.
Exceptions
Exception | Condition
InvalidCastException | value is not assignable to parameter at position index.
ArgumentOutOfRangeException | index is lower than zero or greater or equal than Count.
See Also

Reference

ArgumentsTArg0 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0) Fields

ArgumentsTArg0 Fields

The ArgumentsTArg0 generic type exposes the following members.

Fields
 | Name | Description
Public field | Arg0 | First Argument.
Top
See Also

Reference

ArgumentsTArg0 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0).Arg0 Field

ArgumentsTArg0Arg0 Field

First Argument.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TArg0 Arg0

Field Value

Type: TArg0
See Also

Reference

ArgumentsTArg0 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1) Class

ArgumentsTArg0, TArg1 Class

Implementation of Arguments representing a list of 2 arguments.
Inheritance Hierarchy
SystemObject
PostSharp.AspectsArguments
PostSharp.Aspects.InternalsArgumentsTArg0, TArg1

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class Arguments<TArg0, TArg1> : Arguments

Type Parameters

TArg0
Type of the first argument.
TArg1
Type of the second argument.

The ArgumentsTArg0, TArg1 type exposes the following members.

Constructors
 | Name | Description
Public method | ArgumentsTArg0, TArg1 | Initializes a new ArgumentsTArg0, TArg1.
Top
Properties
 | Name | Description
Public property | Count | Gets the number of arguments encapsulated by the current object. (Inherited from Arguments.)
Public property | Item | Gets or sets the value of an argument. (Inherited from Arguments.)
Top
Methods
 | Name | Description
Public method | Clone | Returns a shallow copy of the current object. (Inherited from Arguments.)
Public method | CopyFrom | Copies all the argument values from the elements of Array. (Overrides ArgumentsCopyFrom(Object, Int32).)
Public method | CopyTo | Copies all arguments values to the specified Array starting at the specified destination Array index. (Overrides ArgumentsCopyTo(Object, Int32).)
Public method | GetArgument | Gets the value of the argument at a given index. (Overrides ArgumentsGetArgument(Int32).)
Public method | GetEnumerator | Returns an enumerator that iterates through the collection. (Inherited from Arguments.)
Public method | SetArgument | Sets the value of the argument at a given index. (Overrides ArgumentsSetArgument(Int32, Object).)
Public method | ToArray | Converts the current argument list into an Array. (Inherited from Arguments.)
Top
Fields
 | Name | Description
Public field | Arg0 | First argument.
Public field | Arg1 | Second argument.
Top
See Also

Reference

PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1) Constructor

ArgumentsTArg0, TArg1 Constructor

Initializes a new ArgumentsTArg0, TArg1.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Arguments()
See Also

Reference

ArgumentsTArg0, TArg1 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1) Properties

ArgumentsTArg0, TArg1 Properties

The ArgumentsTArg0, TArg1 generic type exposes the following members.

Properties
 | Name | Description
Public property | Count | Gets the number of arguments encapsulated by the current object. (Inherited from Arguments.)
Public property | Item | Gets or sets the value of an argument. (Inherited from Arguments.)
Top
See Also

Reference

ArgumentsTArg0, TArg1 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1) Methods

ArgumentsTArg0, TArg1 Methods

The ArgumentsTArg0, TArg1 generic type exposes the following members.

Methods
 | Name | Description
Public method | Clone | Returns a shallow copy of the current object. (Inherited from Arguments.)
Public method | CopyFrom | Copies all the argument values from the elements of Array. (Overrides ArgumentsCopyFrom(Object, Int32).)
Public method | CopyTo | Copies all arguments values to the specified Array starting at the specified destination Array index. (Overrides ArgumentsCopyTo(Object, Int32).)
Public method | GetArgument | Gets the value of the argument at a given index. (Overrides ArgumentsGetArgument(Int32).)
Public method | GetEnumerator | Returns an enumerator that iterates through the collection. (Inherited from Arguments.)
Public method | SetArgument | Sets the value of the argument at a given index. (Overrides ArgumentsSetArgument(Int32, Object).)
Public method | ToArray | Converts the current argument list into an Array. (Inherited from Arguments.)
Top
See Also

Reference

ArgumentsTArg0, TArg1 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1).CopyFrom Method

ArgumentsTArg0, TArg1CopyFrom Method

Copies all the argument values from the elements of Array.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void CopyFrom(
    Object[] array,
    int index
)

Parameters

array
Type: SystemObject
The array that is the source of the argument values copied into the current Arguments.
index
Type: SystemInt32
An integer that represents the index in array at which copying begins.
Exceptions
Exception | Condition
ArgumentNullException | array is null.
ArgumentOutOfRangeException | index is lower than zero.
See Also

Reference

ArgumentsTArg0, TArg1 Class
PostSharp.Aspects.Internals Namespace
ArgumentsCopyTo(Object, Int32)


Arguments(TArg0, TArg1).CopyTo Method

ArgumentsTArg0, TArg1CopyTo Method

Copies all arguments values to the specified Array starting at the specified destination Array index.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void CopyTo(
    Object[] array,
    int index
)

Parameters

array
Type: SystemObject
The array that is the destination of argument values copied from the current Arguments.
index
Type: SystemInt32
An integer that represents the index in array at which copying begins

Implements

ICollectionTCopyTo(T, Int32)
Exceptions
Exception | Condition
ArgumentNullException | array is null.
ArgumentOutOfRangeException | arrayIndex is less than 0.
ArgumentException | The number of elements in the source ICollectionT is greater than the available space from arrayIndex to the end of the destination array.
See Also

Reference

ArgumentsTArg0, TArg1 Class
PostSharp.Aspects.Internals Namespace
ArgumentsCopyFrom(Object, Int32)


Arguments(TArg0, TArg1).GetArgument Method

ArgumentsTArg0, TArg1GetArgument Method

Gets the value of the argument at a given index.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Object GetArgument(
    int index
)

Parameters

index
Type: SystemInt32
Argument index.

Return Value

Type: Object
The value of the argument at position index.
Exceptions
Exception | Condition
ArgumentOutOfRangeException | index is lower than zero or greater or equal than Count.
See Also

Reference

ArgumentsTArg0, TArg1 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1).SetArgument Method

ArgumentsTArg0, TArg1SetArgument Method

Sets the value of the argument at a given index.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void SetArgument(
    int index,
    Object value
)

Parameters

index
Type: SystemInt32
Argument index.
value
Type: SystemObject
New value of the argument at position index.
Exceptions
Exception | Condition
InvalidCastException | value is not assignable to parameter at position index.
ArgumentOutOfRangeException | index is lower than zero or greater or equal than Count.
See Also

Reference

ArgumentsTArg0, TArg1 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1) Fields

ArgumentsTArg0, TArg1 Fields

The ArgumentsTArg0, TArg1 generic type exposes the following members.

Fields
 | Name | Description
Public field | Arg0 | First argument.
Public field | Arg1 | Second argument.
Top
See Also

Reference

ArgumentsTArg0, TArg1 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1).Arg0 Field

ArgumentsTArg0, TArg1Arg0 Field

First argument.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TArg0 Arg0

Field Value

Type: TArg0
See Also

Reference

ArgumentsTArg0, TArg1 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1).Arg1 Field

ArgumentsTArg0, TArg1Arg1 Field

Second argument.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TArg1 Arg1

Field Value

Type: TArg1
See Also

Reference

ArgumentsTArg0, TArg1 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2) Class

ArgumentsTArg0, TArg1, TArg2 Class

Implementation of Arguments representing a list of 3 arguments.
Inheritance Hierarchy
SystemObject
PostSharp.AspectsArguments
PostSharp.Aspects.InternalsArgumentsTArg0, TArg1, TArg2

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class Arguments<TArg0, TArg1, TArg2> : Arguments

Type Parameters

TArg0
Type of the first argument.
TArg1
Type of the second argument.
TArg2
Type of the third argument.

The ArgumentsTArg0, TArg1, TArg2 type exposes the following members.

Constructors
 | Name | Description
Public method | ArgumentsTArg0, TArg1, TArg2 | Initializes a new ArgumentsTArg0, TArg1, TArg2.
Top
Properties
 | Name | Description
Public property | Count | Gets the number of arguments encapsulated by the current object. (Inherited from Arguments.)
Public property | Item | Gets or sets the value of an argument. (Inherited from Arguments.)
Top
Methods
 | Name | Description
Public method | Clone | Returns a shallow copy of the current object. (Inherited from Arguments.)
Public method | CopyFrom | Copies all the argument values from the elements of Array. (Overrides ArgumentsCopyFrom(Object, Int32).)
Public method | CopyTo | Copies all arguments values to the specified Array starting at the specified destination Array index. (Overrides ArgumentsCopyTo(Object, Int32).)
Public method | GetArgument | Gets the value of the argument at a given index. (Overrides ArgumentsGetArgument(Int32).)
Public method | GetEnumerator | Returns an enumerator that iterates through the collection. (Inherited from Arguments.)
Public method | SetArgument | Sets the value of the argument at a given index. (Overrides ArgumentsSetArgument(Int32, Object).)
Public method | ToArray | Converts the current argument list into an Array. (Inherited from Arguments.)
Top
Fields
 | Name | Description
Public field | Arg0 | First argument.
Public field | Arg1 | Second argument.
Public field | Arg2 | Third argument.
Top
See Also

Reference

PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2) Constructor

ArgumentsTArg0, TArg1, TArg2 Constructor

Initializes a new ArgumentsTArg0, TArg1, TArg2.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Arguments()
See Also

Reference

ArgumentsTArg0, TArg1, TArg2 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2) Properties

ArgumentsTArg0, TArg1, TArg2 Properties

The ArgumentsTArg0, TArg1, TArg2 generic type exposes the following members.

Properties
 | Name | Description
Public property | Count | Gets the number of arguments encapsulated by the current object. (Inherited from Arguments.)
Public property | Item | Gets or sets the value of an argument. (Inherited from Arguments.)
Top
See Also

Reference

ArgumentsTArg0, TArg1, TArg2 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2) Methods

ArgumentsTArg0, TArg1, TArg2 Methods

The ArgumentsTArg0, TArg1, TArg2 generic type exposes the following members.

Methods
 | Name | Description
Public method | Clone | Returns a shallow copy of the current object. (Inherited from Arguments.)
Public method | CopyFrom | Copies all the argument values from the elements of Array. (Overrides ArgumentsCopyFrom(Object, Int32).)
Public method | CopyTo | Copies all arguments values to the specified Array starting at the specified destination Array index. (Overrides ArgumentsCopyTo(Object, Int32).)
Public method | GetArgument | Gets the value of the argument at a given index. (Overrides ArgumentsGetArgument(Int32).)
Public method | GetEnumerator | Returns an enumerator that iterates through the collection. (Inherited from Arguments.)
Public method | SetArgument | Sets the value of the argument at a given index. (Overrides ArgumentsSetArgument(Int32, Object).)
Public method | ToArray | Converts the current argument list into an Array. (Inherited from Arguments.)
Top
See Also

Reference

ArgumentsTArg0, TArg1, TArg2 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2).CopyFrom Method

ArgumentsTArg0, TArg1, TArg2CopyFrom Method

Copies all the argument values from the elements of Array.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void CopyFrom(
    Object[] array,
    int index
)

Parameters

array
Type: SystemObject
The array that is the source of the argument values copied into the current Arguments.
index
Type: SystemInt32
An integer that represents the index in array at which copying begins.
Exceptions
Exception | Condition
ArgumentNullException | array is null.
ArgumentOutOfRangeException | index is lower than zero.
See Also

Reference

ArgumentsTArg0, TArg1, TArg2 Class
PostSharp.Aspects.Internals Namespace
ArgumentsCopyTo(Object, Int32)


Arguments(TArg0, TArg1, TArg2).CopyTo Method

ArgumentsTArg0, TArg1, TArg2CopyTo Method

Copies all arguments values to the specified Array starting at the specified destination Array index.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void CopyTo(
    Object[] array,
    int index
)

Parameters

array
Type: SystemObject
The array that is the destination of argument values copied from the current Arguments.
index
Type: SystemInt32
An integer that represents the index in array at which copying begins

Implements

ICollectionTCopyTo(T, Int32)
Exceptions
Exception | Condition
ArgumentNullException | array is null.
ArgumentOutOfRangeException | arrayIndex is less than 0.
ArgumentException | The number of elements in the source ICollectionT is greater than the available space from arrayIndex to the end of the destination array.
See Also

Reference

ArgumentsTArg0, TArg1, TArg2 Class
PostSharp.Aspects.Internals Namespace
ArgumentsCopyFrom(Object, Int32)


Arguments(TArg0, TArg1, TArg2).GetArgument Method

ArgumentsTArg0, TArg1, TArg2GetArgument Method

Gets the value of the argument at a given index.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Object GetArgument(
    int index
)

Parameters

index
Type: SystemInt32
Argument index.

Return Value

Type: Object
The value of the argument at position index.
Exceptions
Exception | Condition
ArgumentOutOfRangeException | index is lower than zero or greater or equal than Count.
See Also

Reference

ArgumentsTArg0, TArg1, TArg2 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2).SetArgument Method

ArgumentsTArg0, TArg1, TArg2SetArgument Method

Sets the value of the argument at a given index.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void SetArgument(
    int index,
    Object value
)

Parameters

index
Type: SystemInt32
Argument index.
value
Type: SystemObject
New value of the argument at position index.
Exceptions
Exception | Condition
InvalidCastException | value is not assignable to parameter at position index.
ArgumentOutOfRangeException | index is lower than zero or greater or equal than Count.
See Also

Reference

ArgumentsTArg0, TArg1, TArg2 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2) Fields

ArgumentsTArg0, TArg1, TArg2 Fields

The ArgumentsTArg0, TArg1, TArg2 generic type exposes the following members.

Fields
 | Name | Description
Public field | Arg0 | First argument.
Public field | Arg1 | Second argument.
Public field | Arg2 | Third argument.
Top
See Also

Reference

ArgumentsTArg0, TArg1, TArg2 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2).Arg0 Field

ArgumentsTArg0, TArg1, TArg2Arg0 Field

First argument.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TArg0 Arg0

Field Value

Type: TArg0
See Also

Reference

ArgumentsTArg0, TArg1, TArg2 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2).Arg1 Field

ArgumentsTArg0, TArg1, TArg2Arg1 Field

Second argument.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TArg1 Arg1

Field Value

Type: TArg1
See Also

Reference

ArgumentsTArg0, TArg1, TArg2 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2).Arg2 Field

ArgumentsTArg0, TArg1, TArg2Arg2 Field

Third argument.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TArg2 Arg2

Field Value

Type: TArg2
See Also

Reference

ArgumentsTArg0, TArg1, TArg2 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3) Class

ArgumentsTArg0, TArg1, TArg2, TArg3 Class

Implementation of Arguments representing a list of 4 arguments.
Inheritance Hierarchy
SystemObject
PostSharp.AspectsArguments
PostSharp.Aspects.InternalsArgumentsTArg0, TArg1, TArg2, TArg3

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class Arguments<TArg0, TArg1, TArg2, TArg3> : Arguments

Type Parameters

TArg0
Type of the first argument.
TArg1
Type of the second argument.
TArg2
Type of the third argument.
TArg3
Type of the fourth argument.

The ArgumentsTArg0, TArg1, TArg2, TArg3 type exposes the following members.

Constructors
 | Name | Description
Public method | ArgumentsTArg0, TArg1, TArg2, TArg3 | Initializes a new ArgumentsTArg0, TArg1, TArg2, TArg3.
Top
Properties
 | Name | Description
Public property | Count | Gets the number of arguments encapsulated by the current object. (Inherited from Arguments.)
Public property | Item | Gets or sets the value of an argument. (Inherited from Arguments.)
Top
Methods
 | Name | Description
Public method | Clone | Returns a shallow copy of the current object. (Inherited from Arguments.)
Public method | CopyFrom | Copies all the argument values from the elements of Array. (Overrides ArgumentsCopyFrom(Object, Int32).)
Public method | CopyTo | Copies all arguments values to the specified Array starting at the specified destination Array index. (Overrides ArgumentsCopyTo(Object, Int32).)
Public method | GetArgument | Gets the value of the argument at a given index. (Overrides ArgumentsGetArgument(Int32).)
Public method | GetEnumerator | Returns an enumerator that iterates through the collection. (Inherited from Arguments.)
Public method | SetArgument | Sets the value of the argument at a given index. (Overrides ArgumentsSetArgument(Int32, Object).)
Public method | ToArray | Converts the current argument list into an Array. (Inherited from Arguments.)
Top
Fields
 | Name | Description
Public field | Arg0 | First argument.
Public field | Arg1 | Second argument.
Public field | Arg2 | Third argument.
Public field | Arg3 | Fourth argument.
Top
See Also

Reference

PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3) Constructor

ArgumentsTArg0, TArg1, TArg2, TArg3 Constructor

Initializes a new ArgumentsTArg0, TArg1, TArg2, TArg3.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Arguments()
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3) Properties

ArgumentsTArg0, TArg1, TArg2, TArg3 Properties

The ArgumentsTArg0, TArg1, TArg2, TArg3 generic type exposes the following members.

Properties
 | Name | Description
Public property | Count | Gets the number of arguments encapsulated by the current object. (Inherited from Arguments.)
Public property | Item | Gets or sets the value of an argument. (Inherited from Arguments.)
Top
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3) Methods

ArgumentsTArg0, TArg1, TArg2, TArg3 Methods

The ArgumentsTArg0, TArg1, TArg2, TArg3 generic type exposes the following members.

Methods
 | Name | Description
Public method | Clone | Returns a shallow copy of the current object. (Inherited from Arguments.)
Public method | CopyFrom | Copies all the argument values from the elements of Array. (Overrides ArgumentsCopyFrom(Object, Int32).)
Public method | CopyTo | Copies all arguments values to the specified Array starting at the specified destination Array index. (Overrides ArgumentsCopyTo(Object, Int32).)
Public method | GetArgument | Gets the value of the argument at a given index. (Overrides ArgumentsGetArgument(Int32).)
Public method | GetEnumerator | Returns an enumerator that iterates through the collection. (Inherited from Arguments.)
Public method | SetArgument | Sets the value of the argument at a given index. (Overrides ArgumentsSetArgument(Int32, Object).)
Public method | ToArray | Converts the current argument list into an Array. (Inherited from Arguments.)
Top
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3).CopyFrom Method

ArgumentsTArg0, TArg1, TArg2, TArg3CopyFrom Method

Copies all the argument values from the elements of Array.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void CopyFrom(
    Object[] array,
    int index
)

Parameters

array
Type: SystemObject
The array that is the source of the argument values copied into the current Arguments.
index
Type: SystemInt32
An integer that represents the index in array at which copying begins.
Exceptions
Exception | Condition
ArgumentNullException | array is null.
ArgumentOutOfRangeException | index is lower than zero.
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3 Class
PostSharp.Aspects.Internals Namespace
ArgumentsCopyTo(Object, Int32)


Arguments(TArg0, TArg1, TArg2, TArg3).CopyTo Method

ArgumentsTArg0, TArg1, TArg2, TArg3CopyTo Method

Copies all arguments values to the specified Array starting at the specified destination Array index.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void CopyTo(
    Object[] array,
    int index
)

Parameters

array
Type: SystemObject
The array that is the destination of argument values copied from the current Arguments.
index
Type: SystemInt32
An integer that represents the index in array at which copying begins

Implements

ICollectionTCopyTo(T, Int32)
Exceptions
Exception | Condition
ArgumentNullException | array is null.
ArgumentOutOfRangeException | arrayIndex is less than 0.
ArgumentException | The number of elements in the source ICollectionT is greater than the available space from arrayIndex to the end of the destination array.
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3 Class
PostSharp.Aspects.Internals Namespace
ArgumentsCopyFrom(Object, Int32)


Arguments(TArg0, TArg1, TArg2, TArg3).GetArgument Method

ArgumentsTArg0, TArg1, TArg2, TArg3GetArgument Method

Gets the value of the argument at a given index.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Object GetArgument(
    int index
)

Parameters

index
Type: SystemInt32
Argument index.

Return Value

Type: Object
The value of the argument at position index.
Exceptions
Exception | Condition
ArgumentOutOfRangeException | index is lower than zero or greater or equal than Count.
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3).SetArgument Method

ArgumentsTArg0, TArg1, TArg2, TArg3SetArgument Method

Sets the value of the argument at a given index.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void SetArgument(
    int index,
    Object value
)

Parameters

index
Type: SystemInt32
Argument index.
value
Type: SystemObject
New value of the argument at position index.
Exceptions
Exception | Condition
InvalidCastException | value is not assignable to parameter at position index.
ArgumentOutOfRangeException | index is lower than zero or greater or equal than Count.
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3) Fields

ArgumentsTArg0, TArg1, TArg2, TArg3 Fields

The ArgumentsTArg0, TArg1, TArg2, TArg3 generic type exposes the following members.

Fields
 | Name | Description
Public field | Arg0 | First argument.
Public field | Arg1 | Second argument.
Public field | Arg2 | Third argument.
Public field | Arg3 | Fourth argument.
Top
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3).Arg0 Field

ArgumentsTArg0, TArg1, TArg2, TArg3Arg0 Field

First argument.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TArg0 Arg0

Field Value

Type: TArg0
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3).Arg1 Field

ArgumentsTArg0, TArg1, TArg2, TArg3Arg1 Field

Second argument.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TArg1 Arg1

Field Value

Type: TArg1
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3).Arg2 Field

ArgumentsTArg0, TArg1, TArg2, TArg3Arg2 Field

Third argument.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TArg2 Arg2

Field Value

Type: TArg2
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3).Arg3 Field

ArgumentsTArg0, TArg1, TArg2, TArg3Arg3 Field

Fourth argument.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TArg3 Arg3

Field Value

Type: TArg3
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4) Class

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4 Class

Implementation of Arguments representing a list of 5 arguments.
Inheritance Hierarchy
SystemObject
PostSharp.AspectsArguments
PostSharp.Aspects.InternalsArgumentsTArg0, TArg1, TArg2, TArg3, TArg4

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class Arguments<TArg0, TArg1, TArg2, TArg3, TArg4> : Arguments

Type Parameters

TArg0
Type of the first argument.
TArg1
Type of the second argument.
TArg2
Type of the third argument.
TArg3
Type of the fourth argument.
TArg4
Type of the fifth argument.

The ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4 type exposes the following members.

Constructors
 | Name | Description
Public method | ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4 | Initializes a new ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4.
Top
Properties
 | Name | Description
Public property | Count | Gets the number of arguments encapsulated by the current object. (Inherited from Arguments.)
Public property | Item | Gets or sets the value of an argument. (Inherited from Arguments.)
Top
Methods
 | Name | Description
Public method | Clone | Returns a shallow copy of the current object. (Inherited from Arguments.)
Public method | CopyFrom | Copies all the argument values from the elements of Array. (Overrides ArgumentsCopyFrom(Object, Int32).)
Public method | CopyTo | Copies all arguments values to the specified Array starting at the specified destination Array index. (Overrides ArgumentsCopyTo(Object, Int32).)
Public method | GetArgument | Gets the value of the argument at a given index. (Overrides ArgumentsGetArgument(Int32).)
Public method | GetEnumerator | Returns an enumerator that iterates through the collection. (Inherited from Arguments.)
Public method | SetArgument | Sets the value of the argument at a given index. (Overrides ArgumentsSetArgument(Int32, Object).)
Public method | ToArray | Converts the current argument list into an Array. (Inherited from Arguments.)
Top
Fields
 | Name | Description
Public field | Arg0 | First argument.
Public field | Arg1 | Second argument.
Public field | Arg2 | Third argument.
Public field | Arg3 | Fourth argument.
Public field | Arg4 | Fifth argument.
Top
See Also

Reference

PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4) Constructor

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4 Constructor

Initializes a new ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Arguments()
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4) Properties

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4 Properties

The ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4 generic type exposes the following members.

Properties
 | Name | Description
Public property | Count | Gets the number of arguments encapsulated by the current object. (Inherited from Arguments.)
Public property | Item | Gets or sets the value of an argument. (Inherited from Arguments.)
Top
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4) Methods

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4 Methods

The ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4 generic type exposes the following members.

Methods
 | Name | Description
Public method | Clone | Returns a shallow copy of the current object. (Inherited from Arguments.)
Public method | CopyFrom | Copies all the argument values from the elements of Array. (Overrides ArgumentsCopyFrom(Object, Int32).)
Public method | CopyTo | Copies all arguments values to the specified Array starting at the specified destination Array index. (Overrides ArgumentsCopyTo(Object, Int32).)
Public method | GetArgument | Gets the value of the argument at a given index. (Overrides ArgumentsGetArgument(Int32).)
Public method | GetEnumerator | Returns an enumerator that iterates through the collection. (Inherited from Arguments.)
Public method | SetArgument | Sets the value of the argument at a given index. (Overrides ArgumentsSetArgument(Int32, Object).)
Public method | ToArray | Converts the current argument list into an Array. (Inherited from Arguments.)
Top
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4).CopyFrom Method

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4CopyFrom Method

Copies all the argument values from the elements of Array.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void CopyFrom(
    Object[] array,
    int index
)

Parameters

array
Type: SystemObject
The array that is the source of the argument values copied into the current Arguments.
index
Type: SystemInt32
An integer that represents the index in array at which copying begins.
Exceptions
Exception | Condition
ArgumentNullException | array is null.
ArgumentOutOfRangeException | index is lower than zero.
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4 Class
PostSharp.Aspects.Internals Namespace
ArgumentsCopyTo(Object, Int32)


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4).CopyTo Method

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4CopyTo Method

Copies all arguments values to the specified Array starting at the specified destination Array index.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void CopyTo(
    Object[] array,
    int index
)

Parameters

array
Type: SystemObject
The array that is the destination of argument values copied from the current Arguments.
index
Type: SystemInt32
An integer that represents the index in array at which copying begins

Implements

ICollectionTCopyTo(T, Int32)
Exceptions
Exception | Condition
ArgumentNullException | array is null.
ArgumentOutOfRangeException | arrayIndex is less than 0.
ArgumentException | The number of elements in the source ICollectionT is greater than the available space from arrayIndex to the end of the destination array.
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4 Class
PostSharp.Aspects.Internals Namespace
ArgumentsCopyFrom(Object, Int32)


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4).GetArgument Method

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4GetArgument Method

Gets the value of the argument at a given index.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Object GetArgument(
    int index
)

Parameters

index
Type: SystemInt32
Argument index.

Return Value

Type: Object
The value of the argument at position index.
Exceptions
Exception | Condition
ArgumentOutOfRangeException | index is lower than zero or greater or equal than Count.
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4).SetArgument Method

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4SetArgument Method

Sets the value of the argument at a given index.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void SetArgument(
    int index,
    Object value
)

Parameters

index
Type: SystemInt32
Argument index.
value
Type: SystemObject
New value of the argument at position index.
Exceptions
Exception | Condition
InvalidCastException | value is not assignable to parameter at position index.
ArgumentOutOfRangeException | index is lower than zero or greater or equal than Count.
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4) Fields

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4 Fields

The ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4 generic type exposes the following members.

Fields
 | Name | Description
Public field | Arg0 | First argument.
Public field | Arg1 | Second argument.
Public field | Arg2 | Third argument.
Public field | Arg3 | Fourth argument.
Public field | Arg4 | Fifth argument.
Top
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4).Arg0 Field

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4Arg0 Field

First argument.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TArg0 Arg0

Field Value

Type: TArg0
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4).Arg1 Field

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4Arg1 Field

Second argument.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TArg1 Arg1

Field Value

Type: TArg1
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4).Arg2 Field

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4Arg2 Field

Third argument.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TArg2 Arg2

Field Value

Type: TArg2
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4).Arg3 Field

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4Arg3 Field

Fourth argument.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TArg3 Arg3

Field Value

Type: TArg3
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4).Arg4 Field

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4Arg4 Field

Fifth argument.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TArg4 Arg4

Field Value

Type: TArg4
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5) Class

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5 Class

Implementation of Arguments representing a list of 6 arguments.
Inheritance Hierarchy
SystemObject
PostSharp.AspectsArguments
PostSharp.Aspects.InternalsArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class Arguments<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5> : Arguments

Type Parameters

TArg0
Type of the first argument.
TArg1
Type of the second argument.
TArg2
Type of the third argument.
TArg3
Type of the fourth argument.
TArg4
Type of the fifth argument.
TArg5
Type of the sixth argument.

The ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5 type exposes the following members.

Constructors
 | Name | Description
Public method | ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5 | Initializes a new ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5.
Top
Properties
 | Name | Description
Public property | Count | Gets the number of arguments encapsulated by the current object. (Inherited from Arguments.)
Public property | Item | Gets or sets the value of an argument. (Inherited from Arguments.)
Top
Methods
 | Name | Description
Public method | Clone | Returns a shallow copy of the current object. (Inherited from Arguments.)
Public method | CopyFrom | Copies all the argument values from the elements of Array. (Overrides ArgumentsCopyFrom(Object, Int32).)
Public method | CopyTo | Copies all arguments values to the specified Array starting at the specified destination Array index. (Overrides ArgumentsCopyTo(Object, Int32).)
Public method | GetArgument | Gets the value of the argument at a given index. (Overrides ArgumentsGetArgument(Int32).)
Public method | GetEnumerator | Returns an enumerator that iterates through the collection. (Inherited from Arguments.)
Public method | SetArgument | Sets the value of the argument at a given index. (Overrides ArgumentsSetArgument(Int32, Object).)
Public method | ToArray | Converts the current argument list into an Array. (Inherited from Arguments.)
Top
Fields
 | Name | Description
Public field | Arg0 | First argument.
Public field | Arg1 | Second argument.
Public field | Arg2 | Third argument.
Public field | Arg3 | Fourth argument.
Public field | Arg4 | Fifth argument.
Public field | Arg5 | Sixth argument.
Top
See Also

Reference

PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5) Constructor

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5 Constructor

Initializes a new ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Arguments()
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5) Properties

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5 Properties

The ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5 generic type exposes the following members.

Properties
 | Name | Description
Public property | Count | Gets the number of arguments encapsulated by the current object. (Inherited from Arguments.)
Public property | Item | Gets or sets the value of an argument. (Inherited from Arguments.)
Top
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5) Methods

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5 Methods

The ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5 generic type exposes the following members.

Methods
 | Name | Description
Public method | Clone | Returns a shallow copy of the current object. (Inherited from Arguments.)
Public method | CopyFrom | Copies all the argument values from the elements of Array. (Overrides ArgumentsCopyFrom(Object, Int32).)
Public method | CopyTo | Copies all arguments values to the specified Array starting at the specified destination Array index. (Overrides ArgumentsCopyTo(Object, Int32).)
Public method | GetArgument | Gets the value of the argument at a given index. (Overrides ArgumentsGetArgument(Int32).)
Public method | GetEnumerator | Returns an enumerator that iterates through the collection. (Inherited from Arguments.)
Public method | SetArgument | Sets the value of the argument at a given index. (Overrides ArgumentsSetArgument(Int32, Object).)
Public method | ToArray | Converts the current argument list into an Array. (Inherited from Arguments.)
Top
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5).CopyFrom Method

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5CopyFrom Method

Copies all the argument values from the elements of Array.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void CopyFrom(
    Object[] array,
    int index
)

Parameters

array
Type: SystemObject
The array that is the source of the argument values copied into the current Arguments.
index
Type: SystemInt32
An integer that represents the index in array at which copying begins.
Exceptions
Exception | Condition
ArgumentNullException | array is null.
ArgumentOutOfRangeException | index is lower than zero.
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5 Class
PostSharp.Aspects.Internals Namespace
ArgumentsCopyTo(Object, Int32)


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5).CopyTo Method

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5CopyTo Method

Copies all arguments values to the specified Array starting at the specified destination Array index.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void CopyTo(
    Object[] array,
    int index
)

Parameters

array
Type: SystemObject
The array that is the destination of argument values copied from the current Arguments.
index
Type: SystemInt32
An integer that represents the index in array at which copying begins

Implements

ICollectionTCopyTo(T, Int32)
Exceptions
Exception | Condition
ArgumentNullException | array is null.
ArgumentOutOfRangeException | arrayIndex is less than 0.
ArgumentException | The number of elements in the source ICollectionT is greater than the available space from arrayIndex to the end of the destination array.
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5 Class
PostSharp.Aspects.Internals Namespace
ArgumentsCopyFrom(Object, Int32)


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5).GetArgument Method

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5GetArgument Method

Gets the value of the argument at a given index.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Object GetArgument(
    int index
)

Parameters

index
Type: SystemInt32
Argument index.

Return Value

Type: Object
The value of the argument at position index.
Exceptions
Exception | Condition
ArgumentOutOfRangeException | index is lower than zero or greater or equal than Count.
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5).SetArgument Method

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5SetArgument Method

Sets the value of the argument at a given index.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void SetArgument(
    int index,
    Object value
)

Parameters

index
Type: SystemInt32
Argument index.
value
Type: SystemObject
New value of the argument at position index.
Exceptions
Exception | Condition
InvalidCastException | value is not assignable to parameter at position index.
ArgumentOutOfRangeException | index is lower than zero or greater or equal than Count.
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5) Fields

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5 Fields

The ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5 generic type exposes the following members.

Fields
 | Name | Description
Public field | Arg0 | First argument.
Public field | Arg1 | Second argument.
Public field | Arg2 | Third argument.
Public field | Arg3 | Fourth argument.
Public field | Arg4 | Fifth argument.
Public field | Arg5 | Sixth argument.
Top
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5).Arg0 Field

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5Arg0 Field

First argument.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TArg0 Arg0

Field Value

Type: TArg0
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5).Arg1 Field

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5Arg1 Field

Second argument.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TArg1 Arg1

Field Value

Type: TArg1
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5).Arg2 Field

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5Arg2 Field

Third argument.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TArg2 Arg2

Field Value

Type: TArg2
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5).Arg3 Field

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5Arg3 Field

Fourth argument.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TArg3 Arg3

Field Value

Type: TArg3
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5).Arg4 Field

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5Arg4 Field

Fifth argument.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TArg4 Arg4

Field Value

Type: TArg4
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5).Arg5 Field

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5Arg5 Field

Sixth argument.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TArg5 Arg5

Field Value

Type: TArg5
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6) Class

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6 Class

Implementation of Arguments representing a list of 7 arguments.
Inheritance Hierarchy
SystemObject
PostSharp.AspectsArguments
PostSharp.Aspects.InternalsArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class Arguments<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6> : Arguments

Type Parameters

TArg0
Type of the first argument.
TArg1
Type of the second argument.
TArg2
Type of the third argument.
TArg3
Type of the fourth argument.
TArg4
Type of the fifth argument.
TArg5
Type of the sixth argument.
TArg6
Type of the seventh argument.

The ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6 type exposes the following members.

Constructors
 | Name | Description
Public method | ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6 | Initializes a new ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6.
Top
Properties
 | Name | Description
Public property | Count | Gets the number of arguments encapsulated by the current object. (Inherited from Arguments.)
Public property | Item | Gets or sets the value of an argument. (Inherited from Arguments.)
Top
Methods
 | Name | Description
Public method | Clone | Returns a shallow copy of the current object. (Inherited from Arguments.)
Public method | CopyFrom | Copies all the argument values from the elements of Array. (Overrides ArgumentsCopyFrom(Object, Int32).)
Public method | CopyTo | Copies all arguments values to the specified Array starting at the specified destination Array index. (Overrides ArgumentsCopyTo(Object, Int32).)
Public method | GetArgument | Gets the value of the argument at a given index. (Overrides ArgumentsGetArgument(Int32).)
Public method | GetEnumerator | Returns an enumerator that iterates through the collection. (Inherited from Arguments.)
Public method | SetArgument | Sets the value of the argument at a given index. (Overrides ArgumentsSetArgument(Int32, Object).)
Public method | ToArray | Converts the current argument list into an Array. (Inherited from Arguments.)
Top
Fields
 | Name | Description
Public field | Arg0 | First argument.
Public field | Arg1 | Second argument.
Public field | Arg2 | Third argument.
Public field | Arg3 | Fourth argument.
Public field | Arg4 | Fifth argument.
Public field | Arg5 | Sixth argument.
Public field | Arg6 | Seventh argument.
Top
See Also

Reference

PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6) Constructor

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6 Constructor

Initializes a new ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Arguments()
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6) Properties

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6 Properties

The ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6 generic type exposes the following members.

Properties
 | Name | Description
Public property | Count | Gets the number of arguments encapsulated by the current object. (Inherited from Arguments.)
Public property | Item | Gets or sets the value of an argument. (Inherited from Arguments.)
Top
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6) Methods

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6 Methods

The ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6 generic type exposes the following members.

Methods
 | Name | Description
Public method | Clone | Returns a shallow copy of the current object. (Inherited from Arguments.)
Public method | CopyFrom | Copies all the argument values from the elements of Array. (Overrides ArgumentsCopyFrom(Object, Int32).)
Public method | CopyTo | Copies all arguments values to the specified Array starting at the specified destination Array index. (Overrides ArgumentsCopyTo(Object, Int32).)
Public method | GetArgument | Gets the value of the argument at a given index. (Overrides ArgumentsGetArgument(Int32).)
Public method | GetEnumerator | Returns an enumerator that iterates through the collection. (Inherited from Arguments.)
Public method | SetArgument | Sets the value of the argument at a given index. (Overrides ArgumentsSetArgument(Int32, Object).)
Public method | ToArray | Converts the current argument list into an Array. (Inherited from Arguments.)
Top
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6).CopyFrom Method

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6CopyFrom Method

Copies all the argument values from the elements of Array.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void CopyFrom(
    Object[] array,
    int index
)

Parameters

array
Type: SystemObject
The array that is the source of the argument values copied into the current Arguments.
index
Type: SystemInt32
An integer that represents the index in array at which copying begins.
Exceptions
Exception | Condition
ArgumentNullException | array is null.
ArgumentOutOfRangeException | index is lower than zero.
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6 Class
PostSharp.Aspects.Internals Namespace
ArgumentsCopyTo(Object, Int32)


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6).CopyTo Method

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6CopyTo Method

Copies all arguments values to the specified Array starting at the specified destination Array index.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void CopyTo(
    Object[] array,
    int index
)

Parameters

array
Type: SystemObject
The array that is the destination of argument values copied from the current Arguments.
index
Type: SystemInt32
An integer that represents the index in array at which copying begins

Implements

ICollectionTCopyTo(T, Int32)
Exceptions
Exception | Condition
ArgumentNullException | array is null.
ArgumentOutOfRangeException | arrayIndex is less than 0.
ArgumentException | The number of elements in the source ICollectionT is greater than the available space from arrayIndex to the end of the destination array.
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6 Class
PostSharp.Aspects.Internals Namespace
ArgumentsCopyFrom(Object, Int32)


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6).GetArgument Method

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6GetArgument Method

Gets the value of the argument at a given index.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Object GetArgument(
    int index
)

Parameters

index
Type: SystemInt32
Argument index.

Return Value

Type: Object
The value of the argument at position index.
Exceptions
Exception | Condition
ArgumentOutOfRangeException | index is lower than zero or greater or equal than Count.
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6).SetArgument Method

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6SetArgument Method

Sets the value of the argument at a given index.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void SetArgument(
    int index,
    Object value
)

Parameters

index
Type: SystemInt32
Argument index.
value
Type: SystemObject
New value of the argument at position index.
Exceptions
Exception | Condition
InvalidCastException | value is not assignable to parameter at position index.
ArgumentOutOfRangeException | index is lower than zero or greater or equal than Count.
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6) Fields

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6 Fields

The ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6 generic type exposes the following members.

Fields
 | Name | Description
Public field | Arg0 | First argument.
Public field | Arg1 | Second argument.
Public field | Arg2 | Third argument.
Public field | Arg3 | Fourth argument.
Public field | Arg4 | Fifth argument.
Public field | Arg5 | Sixth argument.
Public field | Arg6 | Seventh argument.
Top
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6).Arg0 Field

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6Arg0 Field

First argument.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TArg0 Arg0

Field Value

Type: TArg0
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6).Arg1 Field

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6Arg1 Field

Second argument.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TArg1 Arg1

Field Value

Type: TArg1
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6).Arg2 Field

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6Arg2 Field

Third argument.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TArg2 Arg2

Field Value

Type: TArg2
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6).Arg3 Field

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6Arg3 Field

Fourth argument.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TArg3 Arg3

Field Value

Type: TArg3
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6).Arg4 Field

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6Arg4 Field

Fifth argument.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TArg4 Arg4

Field Value

Type: TArg4
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6).Arg5 Field

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6Arg5 Field

Sixth argument.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TArg5 Arg5

Field Value

Type: TArg5
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6).Arg6 Field

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6Arg6 Field

Seventh argument.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TArg6 Arg6

Field Value

Type: TArg6
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7) Class

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7 Class

Implementation of Arguments representing a list of 8 arguments.
Inheritance Hierarchy
SystemObject
PostSharp.AspectsArguments
PostSharp.Aspects.InternalsArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class Arguments<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7> : Arguments

Type Parameters

TArg0
Type of the first argument.
TArg1
Type of the second argument.
TArg2
Type of the third argument.
TArg3
Type of the fourth argument.
TArg4
Type of the fifth argument.
TArg5
Type of the sixth argument.
TArg6
Type of the seventh argument.
TArg7
Type of the eighth argument.

The ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7 type exposes the following members.

Constructors
 | Name | Description
Public method | ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7 | Initializes a new ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7.
Top
Properties
 | Name | Description
Public property | Count | Gets the number of arguments encapsulated by the current object. (Inherited from Arguments.)
Public property | Item | Gets or sets the value of an argument. (Inherited from Arguments.)
Top
Methods
 | Name | Description
Public method | Clone | Returns a shallow copy of the current object. (Inherited from Arguments.)
Public method | CopyFrom | Copies all the argument values from the elements of Array. (Overrides ArgumentsCopyFrom(Object, Int32).)
Public method | CopyTo | Copies all arguments values to the specified Array starting at the specified destination Array index. (Overrides ArgumentsCopyTo(Object, Int32).)
Public method | GetArgument | Gets the value of the argument at a given index. (Overrides ArgumentsGetArgument(Int32).)
Public method | GetEnumerator | Returns an enumerator that iterates through the collection. (Inherited from Arguments.)
Public method | SetArgument | Sets the value of the argument at a given index. (Overrides ArgumentsSetArgument(Int32, Object).)
Public method | ToArray | Converts the current argument list into an Array. (Inherited from Arguments.)
Top
Fields
 | Name | Description
Public field | Arg0 | First argument.
Public field | Arg1 | Second argument.
Public field | Arg2 | Third argument.
Public field | Arg3 | Fourth argument.
Public field | Arg4 | Fifth argument.
Public field | Arg5 | Sixth argument.
Public field | Arg6 | Seventh argument.
Public field | Arg7 | Eighth argument.
Top
See Also

Reference

PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7) Constructor

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7 Constructor

Initializes a new ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Arguments()
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7) Properties

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7 Properties

The ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7 generic type exposes the following members.

Properties
 | Name | Description
Public property | Count | Gets the number of arguments encapsulated by the current object. (Inherited from Arguments.)
Public property | Item | Gets or sets the value of an argument. (Inherited from Arguments.)
Top
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7) Methods

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7 Methods

The ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7 generic type exposes the following members.

Methods
 | Name | Description
Public method | Clone | Returns a shallow copy of the current object. (Inherited from Arguments.)
Public method | CopyFrom | Copies all the argument values from the elements of Array. (Overrides ArgumentsCopyFrom(Object, Int32).)
Public method | CopyTo | Copies all arguments values to the specified Array starting at the specified destination Array index. (Overrides ArgumentsCopyTo(Object, Int32).)
Public method | GetArgument | Gets the value of the argument at a given index. (Overrides ArgumentsGetArgument(Int32).)
Public method | GetEnumerator | Returns an enumerator that iterates through the collection. (Inherited from Arguments.)
Public method | SetArgument | Sets the value of the argument at a given index. (Overrides ArgumentsSetArgument(Int32, Object).)
Public method | ToArray | Converts the current argument list into an Array. (Inherited from Arguments.)
Top
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7).CopyFrom Method

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7CopyFrom Method

Copies all the argument values from the elements of Array.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void CopyFrom(
    Object[] array,
    int index
)

Parameters

array
Type: SystemObject
The array that is the source of the argument values copied into the current Arguments.
index
Type: SystemInt32
An integer that represents the index in array at which copying begins.
Exceptions
Exception | Condition
ArgumentNullException | array is null.
ArgumentOutOfRangeException | index is lower than zero.
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7 Class
PostSharp.Aspects.Internals Namespace
ArgumentsCopyTo(Object, Int32)


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7).CopyTo Method

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7CopyTo Method

Copies all arguments values to the specified Array starting at the specified destination Array index.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void CopyTo(
    Object[] array,
    int index
)

Parameters

array
Type: SystemObject
The array that is the destination of argument values copied from the current Arguments.
index
Type: SystemInt32
An integer that represents the index in array at which copying begins

Implements

ICollectionTCopyTo(T, Int32)
Exceptions
Exception | Condition
ArgumentNullException | array is null.
ArgumentOutOfRangeException | arrayIndex is less than 0.
ArgumentException | The number of elements in the source ICollectionT is greater than the available space from arrayIndex to the end of the destination array.
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7 Class
PostSharp.Aspects.Internals Namespace
ArgumentsCopyFrom(Object, Int32)


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7).GetArgument Method

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7GetArgument Method

Gets the value of the argument at a given index.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Object GetArgument(
    int index
)

Parameters

index
Type: SystemInt32
Argument index.

Return Value

Type: Object
The value of the argument at position index.
Exceptions
Exception | Condition
ArgumentOutOfRangeException | index is lower than zero or greater or equal than Count.
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7).SetArgument Method

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7SetArgument Method

Sets the value of the argument at a given index.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void SetArgument(
    int index,
    Object value
)

Parameters

index
Type: SystemInt32
Argument index.
value
Type: SystemObject
New value of the argument at position index.
Exceptions
Exception | Condition
InvalidCastException | value is not assignable to parameter at position index.
ArgumentOutOfRangeException | index is lower than zero or greater or equal than Count.
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7) Fields

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7 Fields

The ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7 generic type exposes the following members.

Fields
 | Name | Description
Public field | Arg0 | First argument.
Public field | Arg1 | Second argument.
Public field | Arg2 | Third argument.
Public field | Arg3 | Fourth argument.
Public field | Arg4 | Fifth argument.
Public field | Arg5 | Sixth argument.
Public field | Arg6 | Seventh argument.
Public field | Arg7 | Eighth argument.
Top
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7).Arg0 Field

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7Arg0 Field

First argument.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TArg0 Arg0

Field Value

Type: TArg0
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7).Arg1 Field

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7Arg1 Field

Second argument.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TArg1 Arg1

Field Value

Type: TArg1
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7).Arg2 Field

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7Arg2 Field

Third argument.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TArg2 Arg2

Field Value

Type: TArg2
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7).Arg3 Field

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7Arg3 Field

Fourth argument.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TArg3 Arg3

Field Value

Type: TArg3
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7).Arg4 Field

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7Arg4 Field

Fifth argument.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TArg4 Arg4

Field Value

Type: TArg4
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7).Arg5 Field

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7Arg5 Field

Sixth argument.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TArg5 Arg5

Field Value

Type: TArg5
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7).Arg6 Field

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7Arg6 Field

Seventh argument.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TArg6 Arg6

Field Value

Type: TArg6
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7 Class
PostSharp.Aspects.Internals Namespace


Arguments(TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7).Arg7 Field

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7Arg7 Field

Eighth argument.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TArg7 Arg7

Field Value

Type: TArg7
See Also

Reference

ArgumentsTArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7 Class
PostSharp.Aspects.Internals Namespace


ArgumentsArray Class

Implementation of Arguments representing a list of arguments of arbitrary length and type.
Inheritance Hierarchy
SystemObject
PostSharp.AspectsArguments
PostSharp.Aspects.InternalsArgumentsArray

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ArgumentsArray : Arguments

The ArgumentsArray type exposes the following members.

Constructors
 | Name | Description
Public method | ArgumentsArray | Initializes a new ArgumentsArray.
Top
Properties
 | Name | Description
Public property | Arguments | Gets or sets the underlying array of arguments.
Public property | Count | Gets the number of arguments encapsulated by the current object. (Inherited from Arguments.)
Public property | Item | Gets or sets the value of an argument. (Inherited from Arguments.)
Top
Methods
 | Name | Description
Public method | Clone | Returns a shallow copy of the current object. (Inherited from Arguments.)
Public method | CopyFrom | Copies all the argument values from the elements of Array. (Overrides ArgumentsCopyFrom(Object, Int32).)
Public method | CopyTo | Copies all arguments values to the specified Array starting at the specified destination Array index. (Overrides ArgumentsCopyTo(Object, Int32).)
Public method | GetArgument | Gets the value of the argument at a given index. (Overrides ArgumentsGetArgument(Int32).)
Public method | GetEnumerator | Returns an enumerator that iterates through the collection. (Inherited from Arguments.)
Public method | SetArgument | Sets the value of the argument at a given index. (Overrides ArgumentsSetArgument(Int32, Object).)
Public method | ToArray | Converts the current argument list into an Array. (Inherited from Arguments.)
Top
Remarks
Unless generic implementations of Arguments, ArgumentsArray boxes all arguments into an Array, resulting in lower performance and higher memory usage.
See Also

Reference

PostSharp.Aspects.Internals Namespace


ArgumentsArray Constructor

Initializes a new ArgumentsArray.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ArgumentsArray(
    Object[] arguments
)

Parameters

arguments
Type: SystemObject
Array containing the argument values.
See Also

Reference

ArgumentsArray Class
PostSharp.Aspects.Internals Namespace


ArgumentsArray Properties

The ArgumentsArray type exposes the following members.

Properties
 | Name | Description
Public property | Arguments | Gets or sets the underlying array of arguments.
Public property | Count | Gets the number of arguments encapsulated by the current object. (Inherited from Arguments.)
Public property | Item | Gets or sets the value of an argument. (Inherited from Arguments.)
Top
See Also

Reference

ArgumentsArray Class
PostSharp.Aspects.Internals Namespace


ArgumentsArray.Arguments Property

ArgumentsArrayArguments Property

Gets or sets the underlying array of arguments.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Object[] Arguments { get; set; }

Property Value

Type: Object
Remarks
When you set this property, the new Array must have the same length as the previous one.
See Also

Reference

ArgumentsArray Class
PostSharp.Aspects.Internals Namespace


ArgumentsArray Methods

The ArgumentsArray type exposes the following members.

Methods
 | Name | Description
Public method | Clone | Returns a shallow copy of the current object. (Inherited from Arguments.)
Public method | CopyFrom | Copies all the argument values from the elements of Array. (Overrides ArgumentsCopyFrom(Object, Int32).)
Public method | CopyTo | Copies all arguments values to the specified Array starting at the specified destination Array index. (Overrides ArgumentsCopyTo(Object, Int32).)
Public method | GetArgument | Gets the value of the argument at a given index. (Overrides ArgumentsGetArgument(Int32).)
Public method | GetEnumerator | Returns an enumerator that iterates through the collection. (Inherited from Arguments.)
Public method | SetArgument | Sets the value of the argument at a given index. (Overrides ArgumentsSetArgument(Int32, Object).)
Public method | ToArray | Converts the current argument list into an Array. (Inherited from Arguments.)
Top
See Also

Reference

ArgumentsArray Class
PostSharp.Aspects.Internals Namespace


ArgumentsArray.CopyFrom Method

ArgumentsArrayCopyFrom Method

Copies all the argument values from the elements of Array.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void CopyFrom(
    Object[] array,
    int index
)

Parameters

array
Type: SystemObject
The array that is the source of the argument values copied into the current Arguments.
index
Type: SystemInt32
An integer that represents the index in array at which copying begins.
Exceptions
Exception | Condition
ArgumentNullException | array is null.
ArgumentOutOfRangeException | index is lower than zero.
See Also

Reference

ArgumentsArray Class
PostSharp.Aspects.Internals Namespace
ArgumentsCopyTo(Object, Int32)


ArgumentsArray.CopyTo Method

ArgumentsArrayCopyTo Method

Copies all arguments values to the specified Array starting at the specified destination Array index.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void CopyTo(
    Object[] array,
    int index
)

Parameters

array
Type: SystemObject
The array that is the destination of argument values copied from the current Arguments.
index
Type: SystemInt32
An integer that represents the index in array at which copying begins

Implements

ICollectionTCopyTo(T, Int32)
Exceptions
Exception | Condition
ArgumentNullException | array is null.
ArgumentOutOfRangeException | arrayIndex is less than 0.
ArgumentException | The number of elements in the source ICollectionT is greater than the available space from arrayIndex to the end of the destination array.
See Also

Reference

ArgumentsArray Class
PostSharp.Aspects.Internals Namespace
ArgumentsCopyFrom(Object, Int32)


ArgumentsArray.GetArgument Method

ArgumentsArrayGetArgument Method

Gets the value of the argument at a given index.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Object GetArgument(
    int index
)

Parameters

index
Type: SystemInt32
Argument index.

Return Value

Type: Object
The value of the argument at position index.
Exceptions
Exception | Condition
ArgumentOutOfRangeException | index is lower than zero or greater or equal than Count.
See Also

Reference

ArgumentsArray Class
PostSharp.Aspects.Internals Namespace


ArgumentsArray.SetArgument Method

ArgumentsArraySetArgument Method

Sets the value of the argument at a given index.

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void SetArgument(
    int index,
    Object value
)

Parameters

index
Type: SystemInt32
Argument index.
value
Type: SystemObject
New value of the argument at position index.
Exceptions
Exception | Condition
InvalidCastException | value is not assignable to parameter at position index.
ArgumentOutOfRangeException | index is lower than zero or greater or equal than Count.
See Also

Reference

ArgumentsArray Class
PostSharp.Aspects.Internals Namespace


EventInterceptor Class

Inheritance Hierarchy
SystemObject
PostSharp.Aspects.InternalsEventInterceptor

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class EventInterceptor

The EventInterceptor type exposes the following members.

Constructors
 | Name | Description
Public method | EventInterceptor | Initializes a new instance of the EventInterceptor class
Top
See Also

Reference

PostSharp.Aspects.Internals Namespace


EventInterceptor Constructor

Initializes a new instance of the EventInterceptor class

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public EventInterceptor(
    Object instance,
    Delegate handler
)

Parameters

instance
Type: SystemObject
handler
Type: SystemDelegate
See Also

Reference

EventInterceptor Class
PostSharp.Aspects.Internals Namespace


SafeEventBroker Class

Inheritance Hierarchy
SystemObject
PostSharp.Aspects.InternalsSafeEventBroker

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class SafeEventBroker

The SafeEventBroker type exposes the following members.

Constructors
 | Name | Description
Protected method | SafeEventBroker | Initializes a new instance of the SafeEventBroker class
Top
Methods
 | Name | Description
Public method | AddHandler |
Protected method | CreateInterceptor |
Public method | RemoveHandler |
Top
See Also

Reference

PostSharp.Aspects.Internals Namespace


SafeEventBroker Constructor

Initializes a new instance of the SafeEventBroker class

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected SafeEventBroker(
    Object instance
)

Parameters

instance
Type: SystemObject
See Also

Reference

SafeEventBroker Class
PostSharp.Aspects.Internals Namespace


SafeEventBroker Methods

The SafeEventBroker type exposes the following members.

Methods
 | Name | Description
Public method | AddHandler |
Protected method | CreateInterceptor |
Public method | RemoveHandler |
Top
See Also

Reference

SafeEventBroker Class
PostSharp.Aspects.Internals Namespace


SafeEventBroker.AddHandler Method

SafeEventBrokerAddHandler Method

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void AddHandler(
    Delegate handler
)

Parameters

handler
Type: SystemDelegate
See Also

Reference

SafeEventBroker Class
PostSharp.Aspects.Internals Namespace


SafeEventBroker.CreateInterceptor Method

SafeEventBrokerCreateInterceptor Method

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected abstract EventInterceptor CreateInterceptor(
    Delegate handler
)

Parameters

handler
Type: SystemDelegate

Return Value

Type: EventInterceptor
See Also

Reference

SafeEventBroker Class
PostSharp.Aspects.Internals Namespace


SafeEventBroker.RemoveHandler Method

SafeEventBrokerRemoveHandler Method

Namespace: PostSharp.Aspects.Internals
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void RemoveHandler(
    Delegate handler
)

Parameters

handler
Type: SystemDelegate
See Also

Reference

SafeEventBroker Class
PostSharp.Aspects.Internals Namespace


PostSharp.Aspects.Serialization Namespace

The PostSharp.Aspects.Serialization namespace contains types taking care of the process of serializing aspects at build time and deserializing them at run time.
Classes
 | Class | Description
Public class | AspectSerializer | Base class for Laos serializers, whose role is to serialize aspect instances at compile-time and deserialize them at runtime.
Public class | BinaryAspectSerializationBinder | Implementation of SerializationBinder used at runtime when aspect instances are deserialized. By overriding the default binder, you can resolve assembly names differently. This can be useful if assemblies have been renamed or merged between PostSharp run and execution
Public class | BinaryAspectSerializer | Implementation of AspectSerializer based on the BinaryFormatter provided by the full version of the .NET Framework.
Public class | MsilAspectSerializer | When used as a value of AspectConfigurationAttribute.SerializerType property, specifies that the aspect should not be serialized but should instead be constructed at runtime using MSIL instructions.
Public class | PortableAspectSerializer | Implementation of AspectSerializer based on the PortableFormatter, for use on any supported .NET platform.
Interfaces
 | Interface | Description
Public interface | IMetadataAwareSurrogateSelector | A SurrogateSelector that receives an IMetadataEmitter before serialization.


AspectSerializer Class

Base class for Laos serializers, whose role is to serialize aspect instances at compile-time and deserialize them at runtime.
Inheritance Hierarchy
SystemObject
PostSharp.Aspects.SerializationAspectSerializer
PostSharp.Aspects.SerializationBinaryAspectSerializer
PostSharp.Aspects.SerializationMsilAspectSerializer
PostSharp.Aspects.SerializationPortableAspectSerializer

Namespace: PostSharp.Aspects.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class AspectSerializer

The AspectSerializer type exposes the following members.

Constructors
 | Name | Description
Protected method | AspectSerializer | Initializes a new instance of the AspectSerializer class
Top
Methods
 | Name | Description
Protected method | Deserialize(Stream, IMetadataDispenser) | Deserializes a stream into an array if aspects.
Public method | Deserialize(Assembly, String, IMetadataDispenser) | Deserializes aspects contained in a managed resource of an assembly.
Public method | Serialize | Serializes an array of aspects into a stream.
Top
See Also

Reference

PostSharp.Aspects.Serialization Namespace

Other Resources

Conceptual: Understanding Aspect Serialization


AspectSerializer Constructor

Initializes a new instance of the AspectSerializer class

Namespace: PostSharp.Aspects.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected AspectSerializer()
See Also

Reference

AspectSerializer Class
PostSharp.Aspects.Serialization Namespace


AspectSerializer Methods

The AspectSerializer type exposes the following members.

Methods
 | Name | Description
Protected method | Deserialize(Stream, IMetadataDispenser) | Deserializes a stream into an array if aspects.
Public method | Deserialize(Assembly, String, IMetadataDispenser) | Deserializes aspects contained in a managed resource of an assembly.
Public method | Serialize | Serializes an array of aspects into a stream.
Top
See Also

Reference

AspectSerializer Class
PostSharp.Aspects.Serialization Namespace


AspectSerializer.Deserialize Method

AspectSerializerDeserialize Method

Overload List
 | Name | Description
Protected method | Deserialize(Stream, IMetadataDispenser) | Deserializes a stream into an array if aspects.
Public method | Deserialize(Assembly, String, IMetadataDispenser) | Deserializes aspects contained in a managed resource of an assembly.
Top
See Also

Reference

AspectSerializer Class
PostSharp.Aspects.Serialization Namespace


AspectSerializer.Deserialize Method (Stream, IMetadataDispenser)

AspectSerializerDeserialize Method (Stream, IMetadataDispenser)

Deserializes a stream into an array if aspects.

Namespace: PostSharp.Aspects.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected abstract IAspect[] Deserialize(
    Stream stream,
    IMetadataDispenser metadataDispenser
)

Parameters

stream
Type: System.IOStream
Stream containing serialized aspects.
metadataDispenser
Type: PostSharp.ReflectionIMetadataDispenser
Metadata dispenser to be used to resolve serialized metadata references in stream.

Return Value

Type: IAspect
An array of aspects.
Remarks
The implementation is not allowed to change the order or array elements.
See Also

Reference

AspectSerializer Class
Deserialize Overload
PostSharp.Aspects.Serialization Namespace


AspectSerializer.Deserialize Method (Assembly, String, IMetadataDispenser)

AspectSerializerDeserialize Method (Assembly, String, IMetadataDispenser)

Deserializes aspects contained in a managed resource of an assembly.

Namespace: PostSharp.Aspects.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IAspect[] Deserialize(
    Assembly assembly,
    string resourceName,
    IMetadataDispenser metadataDispenser
)

Parameters

assembly
Type: System.ReflectionAssembly
Assembly containing the serialized aspects.
resourceName
Type: SystemString
Name of the managed resources into which aspects have been serialized.
metadataDispenser
Type: PostSharp.ReflectionIMetadataDispenser
Metadata dispenser to be used to resolve serialized metadata references in this resource.

Return Value

Type: IAspect
An array of aspects.
See Also

Reference

AspectSerializer Class
Deserialize Overload
PostSharp.Aspects.Serialization Namespace


AspectSerializer.Serialize Method

AspectSerializerSerialize Method

Serializes an array of aspects into a stream.

Namespace: PostSharp.Aspects.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract void Serialize(
    IAspect[] aspects,
    Stream stream,
    IMetadataEmitter metadataEmitter
)

Parameters

aspects
Type: PostSharp.AspectsIAspect
Array of aspects to be serialized.
stream
Type: System.IOStream
Stream into which aspects have to be serialized.
metadataEmitter
Type: PostSharp.ReflectionIMetadataEmitter
A metadata emitter for the current module.
See Also

Reference

AspectSerializer Class
PostSharp.Aspects.Serialization Namespace


BinaryAspectSerializationBinder Class

Implementation of SerializationBinder used at runtime when aspect instances are deserialized. By overriding the default binder, you can resolve assembly names differently. This can be useful if assemblies have been renamed or merged between PostSharp run and execution
Inheritance Hierarchy
SystemObject
System.Runtime.SerializationSerializationBinder
PostSharp.Aspects.SerializationBinaryAspectSerializationBinder

Namespace: PostSharp.Aspects.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class BinaryAspectSerializationBinder : SerializationBinder

The BinaryAspectSerializationBinder type exposes the following members.

Constructors
 | Name | Description
Public method | BinaryAspectSerializationBinder | Initializes a new .
Top
Methods
 | Name | Description
Public method | BindToType | When overridden in a derived class, controls the binding of a serialized object to a type. (Overrides SerializationBinderBindToType(String, String).)
Top
See Also

Reference

PostSharp.Aspects.Serialization Namespace


BinaryAspectSerializationBinder Constructor

Initializes a new .

Namespace: PostSharp.Aspects.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public BinaryAspectSerializationBinder()
See Also

Reference

BinaryAspectSerializationBinder Class
PostSharp.Aspects.Serialization Namespace
PostSharp.Aspects.SerializationBinaryAspectSerializationBinder


BinaryAspectSerializationBinder Methods

The BinaryAspectSerializationBinder type exposes the following members.

Methods
 | Name | Description
Public method | BindToType | When overridden in a derived class, controls the binding of a serialized object to a type. (Overrides SerializationBinderBindToType(String, String).)
Top
See Also

Reference

BinaryAspectSerializationBinder Class
PostSharp.Aspects.Serialization Namespace


BinaryAspectSerializationBinder.BindToType Method

BinaryAspectSerializationBinderBindToType Method

When overridden in a derived class, controls the binding of a serialized object to a type.

Namespace: PostSharp.Aspects.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Type BindToType(
    string assemblyName,
    string typeName
)

Parameters

assemblyName
Type: SystemString
Specifies the Assembly name of the serialized object.
typeName
Type: SystemString
Specifies the Type name of the serialized object.

Return Value

Type: Type
The type of the object the formatter creates a new instance of.
See Also

Reference

BinaryAspectSerializationBinder Class
PostSharp.Aspects.Serialization Namespace


BinaryAspectSerializer Class

Implementation of AspectSerializer based on the BinaryFormatter provided by the full version of the .NET Framework.
Inheritance Hierarchy
SystemObject
PostSharp.Aspects.SerializationAspectSerializer
PostSharp.Aspects.SerializationBinaryAspectSerializer

Namespace: PostSharp.Aspects.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class BinaryAspectSerializer : AspectSerializer

The BinaryAspectSerializer type exposes the following members.

Constructors
 | Name | Description
Public method | BinaryAspectSerializer | Initializes a new instance of the BinaryAspectSerializer class
Top
Methods
 | Name | Description
 | ChainSurrogateSelector | Adds an item to the chain of surrogate selectors used during the process of serializing aspects.
Protected method | Deserialize(Stream, IMetadataDispenser) | Deserializes a stream into an array if aspects. (Overrides AspectSerializerDeserialize(Stream, IMetadataDispenser).)
Public method | Deserialize(Assembly, String, IMetadataDispenser) | Deserializes aspects contained in a managed resource of an assembly. (Inherited from AspectSerializer.)
Public method | Serialize | Serializes an array of aspects into a stream. (Overrides AspectSerializerSerialize(IAspect, Stream, IMetadataEmitter).)
Top
See Also

Reference

PostSharp.Aspects.Serialization Namespace

Other Resources

Conceptual: Understanding Aspect Serialization


BinaryAspectSerializer Constructor

Initializes a new instance of the BinaryAspectSerializer class

Namespace: PostSharp.Aspects.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public BinaryAspectSerializer()
See Also

Reference

BinaryAspectSerializer Class
PostSharp.Aspects.Serialization Namespace


BinaryAspectSerializer Methods

The BinaryAspectSerializer type exposes the following members.

Methods
 | Name | Description
 | ChainSurrogateSelector | Adds an item to the chain of surrogate selectors used during the process of serializing aspects.
Protected method | Deserialize(Stream, IMetadataDispenser) | Deserializes a stream into an array if aspects. (Overrides AspectSerializerDeserialize(Stream, IMetadataDispenser).)
Public method | Deserialize(Assembly, String, IMetadataDispenser) | Deserializes aspects contained in a managed resource of an assembly. (Inherited from AspectSerializer.)
Public method | Serialize | Serializes an array of aspects into a stream. (Overrides AspectSerializerSerialize(IAspect, Stream, IMetadataEmitter).)
Top
See Also

Reference

BinaryAspectSerializer Class
PostSharp.Aspects.Serialization Namespace


BinaryAspectSerializer.ChainSurrogateSelector Method

BinaryAspectSerializerChainSurrogateSelector Method

Adds an item to the chain of surrogate selectors used during the process of serializing aspects.

Namespace: PostSharp.Aspects.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void ChainSurrogateSelector(
    ISurrogateSelector selector
)

Parameters

selector
Type: System.Runtime.SerializationISurrogateSelector
A new surrogate selector.
See Also

Reference

BinaryAspectSerializer Class
PostSharp.Aspects.Serialization Namespace


BinaryAspectSerializer.Deserialize Method

BinaryAspectSerializerDeserialize Method

Overload List
 | Name | Description
Protected method | Deserialize(Stream, IMetadataDispenser) | Deserializes a stream into an array if aspects. (Overrides AspectSerializerDeserialize(Stream, IMetadataDispenser).)
Public method | Deserialize(Assembly, String, IMetadataDispenser) | Deserializes aspects contained in a managed resource of an assembly. (Inherited from AspectSerializer.)
Top
See Also

Reference

BinaryAspectSerializer Class
PostSharp.Aspects.Serialization Namespace


BinaryAspectSerializer.Deserialize Method (Stream, IMetadataDispenser)

BinaryAspectSerializerDeserialize Method (Stream, IMetadataDispenser)

Deserializes a stream into an array if aspects.

Namespace: PostSharp.Aspects.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override IAspect[] Deserialize(
    Stream stream,
    IMetadataDispenser metadataDispenser
)

Parameters

stream
Type: System.IOStream
Stream containing serialized aspects.
metadataDispenser
Type: PostSharp.ReflectionIMetadataDispenser
Metadata dispenser to be used to resolve serialized metadata references in stream.

Return Value

Type: IAspect
An array of aspects.
Remarks
The implementation is not allowed to change the order or array elements.
See Also

Reference

BinaryAspectSerializer Class
Deserialize Overload
PostSharp.Aspects.Serialization Namespace


BinaryAspectSerializer.Serialize Method

BinaryAspectSerializerSerialize Method

Serializes an array of aspects into a stream.

Namespace: PostSharp.Aspects.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void Serialize(
    IAspect[] aspects,
    Stream stream,
    IMetadataEmitter metadataEmitter
)

Parameters

aspects
Type: PostSharp.AspectsIAspect
Array of aspects to be serialized.
stream
Type: System.IOStream
Stream into which aspects have to be serialized.
metadataEmitter
Type: PostSharp.ReflectionIMetadataEmitter
A metadata emitter for the current module.
See Also

Reference

BinaryAspectSerializer Class
PostSharp.Aspects.Serialization Namespace


IMetadataAwareSurrogateSelector Interface

A SurrogateSelector that receives an IMetadataEmitter before serialization.

Namespace: PostSharp.Aspects.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IMetadataAwareSurrogateSelector : ISurrogateSelector

The IMetadataAwareSurrogateSelector type exposes the following members.

Methods
 | Name | Description
Public method | SetMetadataEmitter | Sets the IMetadataEmitter.
Top
See Also

Reference

PostSharp.Aspects.Serialization Namespace


IMetadataAwareSurrogateSelector Methods

The IMetadataAwareSurrogateSelector type exposes the following members.

Methods
 | Name | Description
Public method | SetMetadataEmitter | Sets the IMetadataEmitter.
Top
See Also

Reference

IMetadataAwareSurrogateSelector Interface
PostSharp.Aspects.Serialization Namespace


IMetadataAwareSurrogateSelector.SetMetadataEmitter Method

IMetadataAwareSurrogateSelectorSetMetadataEmitter Method

Sets the IMetadataEmitter.

Namespace: PostSharp.Aspects.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void SetMetadataEmitter(
    IMetadataEmitter metadataEmitter
)

Parameters

metadataEmitter
Type: PostSharp.ReflectionIMetadataEmitter
An IMetadataEmitter.
See Also

Reference

IMetadataAwareSurrogateSelector Interface
PostSharp.Aspects.Serialization Namespace


MsilAspectSerializer Class

When used as a value of AspectConfigurationAttribute.SerializerType property, specifies that the aspect should not be serialized but should instead be constructed at runtime using MSIL instructions.
Inheritance Hierarchy
SystemObject
PostSharp.Aspects.SerializationAspectSerializer
PostSharp.Aspects.SerializationMsilAspectSerializer

Namespace: PostSharp.Aspects.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class MsilAspectSerializer : AspectSerializer

The MsilAspectSerializer type exposes the following members.

Constructors
 | Name | Description
Public method | MsilAspectSerializer | Initializes a new instance of the MsilAspectSerializer class
Top
Methods
 | Name | Description
Public method | Deserialize(Assembly, String, IMetadataDispenser) | Deserializes aspects contained in a managed resource of an assembly. (Inherited from AspectSerializer.)
Public method | Serialize | Serializes an array of aspects into a stream. (Overrides AspectSerializerSerialize(IAspect, Stream, IMetadataEmitter).)
Top
Remarks
This class is not a serializer. When you use MSIL aspect construction, the aspect is instantiated at runtime just as a normal custom attribute, and any initialization made at build time is lost.
See Also

Reference

PostSharp.Aspects.Serialization Namespace

Other Resources

Conceptual: Understanding Aspect Serialization


MsilAspectSerializer Constructor

Initializes a new instance of the MsilAspectSerializer class

Namespace: PostSharp.Aspects.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MsilAspectSerializer()
See Also

Reference

MsilAspectSerializer Class
PostSharp.Aspects.Serialization Namespace


MsilAspectSerializer Methods

The MsilAspectSerializer type exposes the following members.

Methods
 | Name | Description
Public method | Deserialize(Assembly, String, IMetadataDispenser) | Deserializes aspects contained in a managed resource of an assembly. (Inherited from AspectSerializer.)
Public method | Serialize | Serializes an array of aspects into a stream. (Overrides AspectSerializerSerialize(IAspect, Stream, IMetadataEmitter).)
Top
See Also

Reference

MsilAspectSerializer Class
PostSharp.Aspects.Serialization Namespace


MsilAspectSerializer.Serialize Method

MsilAspectSerializerSerialize Method

Serializes an array of aspects into a stream.

Namespace: PostSharp.Aspects.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void Serialize(
    IAspect[] aspects,
    Stream stream,
    IMetadataEmitter metadataEmitter
)

Parameters

aspects
Type: PostSharp.AspectsIAspect
Array of aspects to be serialized.
stream
Type: System.IOStream
Stream into which aspects have to be serialized.
metadataEmitter
Type: PostSharp.ReflectionIMetadataEmitter
A metadata emitter for the current module.
See Also

Reference

MsilAspectSerializer Class
PostSharp.Aspects.Serialization Namespace


PortableAspectSerializer Class

Implementation of AspectSerializer based on the PortableFormatter, for use on any supported .NET platform.
Inheritance Hierarchy
SystemObject
PostSharp.Aspects.SerializationAspectSerializer
PostSharp.Aspects.SerializationPortableAspectSerializer

Namespace: PostSharp.Aspects.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class PortableAspectSerializer : AspectSerializer

The PortableAspectSerializer type exposes the following members.

Constructors
 | Name | Description
Public method | PortableAspectSerializer | Initializes a new instance of the PortableAspectSerializer class
Top
Methods
 | Name | Description
Public method | Deserialize(Assembly, String, IMetadataDispenser) | Deserializes aspects contained in a managed resource of an assembly. (Inherited from AspectSerializer.)
Public method | Serialize | Serializes an array of aspects into a stream. (Overrides AspectSerializerSerialize(IAspect, Stream, IMetadataEmitter).)
Top
See Also

Reference

PostSharp.Aspects.Serialization Namespace
PostSharp.Aspects.SerializationAspectSerializer

Other Resources

Conceptual: Understanding Aspect Serialization


PortableAspectSerializer Constructor

Initializes a new instance of the PortableAspectSerializer class

Namespace: PostSharp.Aspects.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public PortableAspectSerializer()
See Also

Reference

PortableAspectSerializer Class
PostSharp.Aspects.Serialization Namespace


PortableAspectSerializer Methods

The PortableAspectSerializer type exposes the following members.

Methods
 | Name | Description
Public method | Deserialize(Assembly, String, IMetadataDispenser) | Deserializes aspects contained in a managed resource of an assembly. (Inherited from AspectSerializer.)
Public method | Serialize | Serializes an array of aspects into a stream. (Overrides AspectSerializerSerialize(IAspect, Stream, IMetadataEmitter).)
Top
See Also

Reference

PortableAspectSerializer Class
PostSharp.Aspects.Serialization Namespace


PortableAspectSerializer.Serialize Method

PortableAspectSerializerSerialize Method

Serializes an array of aspects into a stream.

Namespace: PostSharp.Aspects.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void Serialize(
    IAspect[] aspects,
    Stream stream,
    IMetadataEmitter metadataEmitter
)

Parameters

aspects
Type: PostSharp.AspectsIAspect
Array of aspects to be serialized.
stream
Type: System.IOStream
Stream into which aspects have to be serialized.
metadataEmitter
Type: PostSharp.ReflectionIMetadataEmitter
A metadata emitter for the current module.
See Also

Reference

PortableAspectSerializer Class
PostSharp.Aspects.Serialization Namespace


PostSharp.Collections Namespace

The PostSharp.Collections namespace contains collection types used by the PostSharp library.
Classes
 | Class | Description
Public class | LinkedListExtensions | Extensions to the IReadOnlyLinkedListT interface.
Structures
 | Structure | Description
Public structure | ReadOnlyLinkedListT | A value-type implementation of the IReadOnlyLinkedListT interface.
Public structure | ReadOnlySinglyLinkedListT | Represents a single-listed link.
Public structure | ReadOnlySinglyLinkedListTEnumerator | An enumerator allowing to enumerate a ReadOnlySinglyLinkedListT.
Interfaces
 | Interface | Description
Public interface | ILinkedListNodeT | Represents a node in a double-linked list.
Public interface | IReadOnlyLinkedListT | Represents a double linked list.
Public interface | ISinglyLinkedListNodeT | Represents a node in a singly linked list.


ILinkedListNode(T) Interface

ILinkedListNodeT Interface

Represents a node in a double-linked list.

Namespace: PostSharp.Collections
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ILinkedListNode<out T>

Type Parameters

T
Type of values stored in the list.

The ILinkedListNodeT type exposes the following members.

Properties
 | Name | Description
Public property | Next | Gets the next node in the list, or null if the current node is the last one in the list.
Public property | Previous | Gets the previous node in the list, or null if the current node is the first one in the list.
Public property | Value | Gets the value stored in the current node.
Top
See Also

Reference

PostSharp.Collections Namespace


ILinkedListNode(T) Properties

ILinkedListNodeT Properties

The ILinkedListNodeT generic type exposes the following members.

Properties
 | Name | Description
Public property | Next | Gets the next node in the list, or null if the current node is the last one in the list.
Public property | Previous | Gets the previous node in the list, or null if the current node is the first one in the list.
Public property | Value | Gets the value stored in the current node.
Top
See Also

Reference

ILinkedListNodeT Interface
PostSharp.Collections Namespace


ILinkedListNode(T).Next Property

ILinkedListNodeTNext Property

Gets the next node in the list, or null if the current node is the last one in the list.

Namespace: PostSharp.Collections
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
ILinkedListNode<T> Next { get; }

Property Value

Type: ILinkedListNode T
See Also

Reference

ILinkedListNodeT Interface
PostSharp.Collections Namespace


ILinkedListNode(T).Previous Property

ILinkedListNodeTPrevious Property

Gets the previous node in the list, or null if the current node is the first one in the list.

Namespace: PostSharp.Collections
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
ILinkedListNode<T> Previous { get; }

Property Value

Type: ILinkedListNode T
See Also

Reference

ILinkedListNodeT Interface
PostSharp.Collections Namespace


ILinkedListNode(T).Value Property

ILinkedListNodeTValue Property

Gets the value stored in the current node.

Namespace: PostSharp.Collections
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
T Value { get; }

Property Value

Type: T
See Also

Reference

ILinkedListNodeT Interface
PostSharp.Collections Namespace


IReadOnlyLinkedList(T) Interface

IReadOnlyLinkedListT Interface

Represents a double linked list.

Namespace: PostSharp.Collections
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IReadOnlyLinkedList<out T>

Type Parameters

T
Type of values stored in the link list.

The IReadOnlyLinkedListT type exposes the following members.

Properties
 | Name | Description
Public property | First | Gets the first node in the list, or null if the list is empty.
Public property | IsEmpty | Determines whether the list is empty.
Public property | Last | Gets the last node in the list, or null if the list is empty.
Top
See Also

Reference

PostSharp.Collections Namespace
PostSharp.CollectionsLinkedListExtensions


IReadOnlyLinkedList(T) Properties

IReadOnlyLinkedListT Properties

The IReadOnlyLinkedListT generic type exposes the following members.

Properties
 | Name | Description
Public property | First | Gets the first node in the list, or null if the list is empty.
Public property | IsEmpty | Determines whether the list is empty.
Public property | Last | Gets the last node in the list, or null if the list is empty.
Top
See Also

Reference

IReadOnlyLinkedListT Interface
PostSharp.Collections Namespace


IReadOnlyLinkedList(T).First Property

IReadOnlyLinkedListTFirst Property

Gets the first node in the list, or null if the list is empty.

Namespace: PostSharp.Collections
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
ILinkedListNode<T> First { get; }

Property Value

Type: ILinkedListNode T
See Also

Reference

IReadOnlyLinkedListT Interface
PostSharp.Collections Namespace


IReadOnlyLinkedList(T).IsEmpty Property

IReadOnlyLinkedListTIsEmpty Property

Determines whether the list is empty.

Namespace: PostSharp.Collections
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
bool IsEmpty { get; }

Property Value

Type: Boolean
See Also

Reference

IReadOnlyLinkedListT Interface
PostSharp.Collections Namespace


IReadOnlyLinkedList(T).Last Property

IReadOnlyLinkedListTLast Property

Gets the last node in the list, or null if the list is empty.

Namespace: PostSharp.Collections
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
ILinkedListNode<T> Last { get; }

Property Value

Type: ILinkedListNode T
See Also

Reference

IReadOnlyLinkedListT Interface
PostSharp.Collections Namespace


ISinglyLinkedListNode(T) Interface

ISinglyLinkedListNodeT Interface

Represents a node in a singly linked list.

Namespace: PostSharp.Collections
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ISinglyLinkedListNode<out T>

Type Parameters

T
Type of values stored in the list.

The ISinglyLinkedListNodeT type exposes the following members.

Properties
 | Name | Description
Public property | Next | Gets the next node in the list, or null if the current node is the last one in the list.
Public property | Value | Gets the value stored in the current node.
Top
See Also

Reference

PostSharp.Collections Namespace


ISinglyLinkedListNode(T) Properties

ISinglyLinkedListNodeT Properties

The ISinglyLinkedListNodeT generic type exposes the following members.

Properties
 | Name | Description
Public property | Next | Gets the next node in the list, or null if the current node is the last one in the list.
Public property | Value | Gets the value stored in the current node.
Top
See Also

Reference

ISinglyLinkedListNodeT Interface
PostSharp.Collections Namespace


ISinglyLinkedListNode(T).Next Property

ISinglyLinkedListNodeTNext Property

Gets the next node in the list, or null if the current node is the last one in the list.

Namespace: PostSharp.Collections
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
ISinglyLinkedListNode<T> Next { get; }

Property Value

Type: ISinglyLinkedListNode T
See Also

Reference

ISinglyLinkedListNodeT Interface
PostSharp.Collections Namespace


ISinglyLinkedListNode(T).Value Property

ISinglyLinkedListNodeTValue Property

Gets the value stored in the current node.

Namespace: PostSharp.Collections
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
T Value { get; }

Property Value

Type: T
See Also

Reference

ISinglyLinkedListNodeT Interface
PostSharp.Collections Namespace


LinkedListExtensions Class

Extensions to the IReadOnlyLinkedListT interface.
Inheritance Hierarchy
SystemObject
PostSharp.CollectionsLinkedListExtensions

Namespace: PostSharp.Collections
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static class LinkedListExtensions
Methods
Name | Description
ToEnumerableT(IReadOnlyLinkedListT) | Transforms an IReadOnlyLinkedListT into an IEnumerableT.
ToEnumerableT(ReadOnlyLinkedListT) | Transforms a ReadOnlyLinkedListT into an IEnumerableT.
Top
See Also

Reference

PostSharp.Collections Namespace


LinkedListExtensions Methods

Methods
Name | Description
ToEnumerableT(IReadOnlyLinkedListT) | Transforms an IReadOnlyLinkedListT into an IEnumerableT.
ToEnumerableT(ReadOnlyLinkedListT) | Transforms a ReadOnlyLinkedListT into an IEnumerableT.
Top
See Also

Reference

LinkedListExtensions Class
PostSharp.Collections Namespace


LinkedListExtensions.ToEnumerable Method

LinkedListExtensionsToEnumerable Method

Overload List
Name | Description
ToEnumerableT(IReadOnlyLinkedListT) | Transforms an IReadOnlyLinkedListT into an IEnumerableT.
ToEnumerableT(ReadOnlyLinkedListT) | Transforms a ReadOnlyLinkedListT into an IEnumerableT.
Top
See Also

Reference

LinkedListExtensions Class
PostSharp.Collections Namespace


LinkedListExtensions.ToEnumerable(T) Method (IReadOnlyLinkedList(T))

LinkedListExtensionsToEnumerableT Method (IReadOnlyLinkedListT)

Transforms an IReadOnlyLinkedListT into an IEnumerableT.

Namespace: PostSharp.Collections
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static IEnumerable<T> ToEnumerable<T>(
    IReadOnlyLinkedList<T> linkedList
)

Parameters

linkedList
Type: PostSharp.CollectionsIReadOnlyLinkedList T
A IReadOnlyLinkedListT, or null.

Type Parameters

T
Type of values.

Return Value

Type: IEnumerable T
An IEnumerableT that can enumerate all elements in linkedList. If linkedList is null, an empty enumerable is returned.
See Also

Reference

LinkedListExtensions Class
ToEnumerable Overload
PostSharp.Collections Namespace


LinkedListExtensions.ToEnumerable(T) Method (ReadOnlyLinkedList(T))

LinkedListExtensionsToEnumerableT Method (ReadOnlyLinkedListT)

Transforms a ReadOnlyLinkedListT into an IEnumerableT.

Namespace: PostSharp.Collections
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static IEnumerable<T> ToEnumerable<T>(
    ReadOnlyLinkedList<T> linkedList
)

Parameters

linkedList
Type: PostSharp.CollectionsReadOnlyLinkedList T
An ReadOnlyLinkedListT.

Type Parameters

T
Type of values.

Return Value

Type: IEnumerable T
An IEnumerableT that can enumerate all elements in linkedList. If linkedList is null, an empty enumerable is returned.
See Also

Reference

LinkedListExtensions Class
ToEnumerable Overload
PostSharp.Collections Namespace


ReadOnlyLinkedList(T) Structure

ReadOnlyLinkedListT Structure

A value-type implementation of the IReadOnlyLinkedListT interface.

Namespace: PostSharp.Collections
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public struct ReadOnlyLinkedList<T> : IReadOnlyLinkedList<T>

Type Parameters

T

The ReadOnlyLinkedListT type exposes the following members.

Properties
 | Name | Description
Public property | First |
Public property | IsEmpty |
Public property | Last |
Top
See Also

Reference

PostSharp.Collections Namespace


ReadOnlyLinkedList(T) Properties

ReadOnlyLinkedListT Properties

The ReadOnlyLinkedListT generic type exposes the following members.

Properties
 | Name | Description
Public property | First |
Public property | IsEmpty |
Public property | Last |
Top
See Also

Reference

ReadOnlyLinkedListT Structure
PostSharp.Collections Namespace


ReadOnlyLinkedList(T).First Property

ReadOnlyLinkedListTFirst Property

Namespace: PostSharp.Collections
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ILinkedListNode<T> First { get; }

Property Value

Type: ILinkedListNode T

Implements

IReadOnlyLinkedListTFirst
See Also

Reference

ReadOnlyLinkedListT Structure
PostSharp.Collections Namespace


ReadOnlyLinkedList(T).IsEmpty Property

ReadOnlyLinkedListTIsEmpty Property

Namespace: PostSharp.Collections
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsEmpty { get; }

Property Value

Type: Boolean

Implements

IReadOnlyLinkedListTIsEmpty
See Also

Reference

ReadOnlyLinkedListT Structure
PostSharp.Collections Namespace


ReadOnlyLinkedList(T).Last Property

ReadOnlyLinkedListTLast Property

Namespace: PostSharp.Collections
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ILinkedListNode<T> Last { get; }

Property Value

Type: ILinkedListNode T

Implements

IReadOnlyLinkedListTLast
See Also

Reference

ReadOnlyLinkedListT Structure
PostSharp.Collections Namespace


ReadOnlySinglyLinkedList(T) Structure

ReadOnlySinglyLinkedListT Structure

Represents a single-listed link.

Namespace: PostSharp.Collections
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public struct ReadOnlySinglyLinkedList<T> : IEnumerable<T>,
    IEnumerable

Type Parameters

T
Type of values stored in the list.

The ReadOnlySinglyLinkedListT type exposes the following members.

Properties
 | Name | Description
Public property | FirstNode | Gets the first node of the list.
Public property | IsEmpty | Determines whether the list is empty.
Top
Methods
 | Name | Description
Public method | GetEnumerator | Gets a value-type enumerator.
Top
Extension Methods
 | Name | Description
Public Extension Method | ToAdvisableCollectionT | Converts an IEnumerableT into an AdvisableCollectionT. (Defined by Extensions.)
Public Extension Method | ToAdvisableDictionaryT, TKey, TValue | Converts an IEnumerableT into a AdvisableDictionaryTKey, TValue given a method returning the item key and a method returning the item value. (Defined by Extensions.)
Public Extension Method | ToAdvisableHashSetT | Converts an IEnumerableT into an AdvisableHashSetT. (Defined by Extensions.)
Top
See Also

Reference

PostSharp.Collections Namespace


ReadOnlySinglyLinkedList(T) Properties

ReadOnlySinglyLinkedListT Properties

The ReadOnlySinglyLinkedListT generic type exposes the following members.

Properties
 | Name | Description
Public property | FirstNode | Gets the first node of the list.
Public property | IsEmpty | Determines whether the list is empty.
Top
See Also

Reference

ReadOnlySinglyLinkedListT Structure
PostSharp.Collections Namespace


ReadOnlySinglyLinkedList(T).FirstNode Property

ReadOnlySinglyLinkedListTFirstNode Property

Gets the first node of the list.

Namespace: PostSharp.Collections
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ISinglyLinkedListNode<T> FirstNode { get; }

Property Value

Type: ISinglyLinkedListNode T
See Also

Reference

ReadOnlySinglyLinkedListT Structure
PostSharp.Collections Namespace


ReadOnlySinglyLinkedList(T).IsEmpty Property

ReadOnlySinglyLinkedListTIsEmpty Property

Determines whether the list is empty.

Namespace: PostSharp.Collections
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsEmpty { get; }

Property Value

Type: Boolean
See Also

Reference

ReadOnlySinglyLinkedListT Structure
PostSharp.Collections Namespace


ReadOnlySinglyLinkedList(T) Methods

ReadOnlySinglyLinkedListT Methods

The ReadOnlySinglyLinkedListT generic type exposes the following members.

Methods
 | Name | Description
Public method | GetEnumerator | Gets a value-type enumerator.
Top
Extension Methods
 | Name | Description
Public Extension Method | ToAdvisableCollectionT | Converts an IEnumerableT into an AdvisableCollectionT. (Defined by Extensions.)
Public Extension Method | ToAdvisableDictionaryT, TKey, TValue | Converts an IEnumerableT into a AdvisableDictionaryTKey, TValue given a method returning the item key and a method returning the item value. (Defined by Extensions.)
Public Extension Method | ToAdvisableHashSetT | Converts an IEnumerableT into an AdvisableHashSetT. (Defined by Extensions.)
Top
See Also

Reference

ReadOnlySinglyLinkedListT Structure
PostSharp.Collections Namespace


ReadOnlySinglyLinkedList(T).GetEnumerator Method

ReadOnlySinglyLinkedListTGetEnumerator Method

Gets a value-type enumerator.

Namespace: PostSharp.Collections
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ReadOnlySinglyLinkedListTEnumerator GetEnumerator()

Return Value

Type: ReadOnlySinglyLinkedListTEnumerator
An enumerator.
See Also

Reference

ReadOnlySinglyLinkedListT Structure
PostSharp.Collections Namespace


ReadOnlySinglyLinkedList(T).Enumerator Structure

ReadOnlySinglyLinkedListTEnumerator Structure

An enumerator allowing to enumerate a ReadOnlySinglyLinkedListT.

Namespace: PostSharp.Collections
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public struct Enumerator : IEnumerator<T>,
    IDisposable, IEnumerator

The ReadOnlySinglyLinkedListTEnumerator generic type exposes the following members.

Properties
 | Name | Description
Public property | Current | Gets the element in the collection at the current position of the enumerator.
Top
Methods
 | Name | Description
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Public method | MoveNext | Advances the enumerator to the next element of the collection.
Top
See Also

Reference

PostSharp.Collections Namespace


Enumerator Properties

The ReadOnlySinglyLinkedListTEnumerator type exposes the following members.

Properties
 | Name | Description
Public property | Current | Gets the element in the collection at the current position of the enumerator.
Top
See Also

Reference

ReadOnlySinglyLinkedListTEnumerator Structure
PostSharp.Collections Namespace


ReadOnlySinglyLinkedList(T).Enumerator.Current Property

ReadOnlySinglyLinkedListTEnumeratorCurrent Property

Gets the element in the collection at the current position of the enumerator.

Namespace: PostSharp.Collections
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public T Current { get; }

Return Value

Type: T
The element in the collection at the current position of the enumerator.

Implements

IEnumeratorTCurrent
See Also

Reference

ReadOnlySinglyLinkedListTEnumerator Structure
PostSharp.Collections Namespace


Enumerator Methods

The ReadOnlySinglyLinkedListTEnumerator type exposes the following members.

Methods
 | Name | Description
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Public method | MoveNext | Advances the enumerator to the next element of the collection.
Top
See Also

Reference

ReadOnlySinglyLinkedListTEnumerator Structure
PostSharp.Collections Namespace


ReadOnlySinglyLinkedList(T).Enumerator.Dispose Method

ReadOnlySinglyLinkedListTEnumeratorDispose Method

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Namespace: PostSharp.Collections
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Dispose()

Implements

IDisposableDispose
See Also

Reference

ReadOnlySinglyLinkedListTEnumerator Structure
PostSharp.Collections Namespace


ReadOnlySinglyLinkedList(T).Enumerator.MoveNext Method

ReadOnlySinglyLinkedListTEnumeratorMoveNext Method

Advances the enumerator to the next element of the collection.

Namespace: PostSharp.Collections
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool MoveNext()

Return Value

Type: Boolean
true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.

Implements

IEnumeratorMoveNext
Exceptions
Exception | Condition
InvalidOperationException | The collection was modified after the enumerator was created.
See Also

Reference

ReadOnlySinglyLinkedListTEnumerator Structure
PostSharp.Collections Namespace


PostSharp.Constraints Namespace

The PostSharp.Constraints namespace allows you to validate your code against predefined or custom design rules.
Classes
 | Class | Description
Public class | ComponentInternalAttribute | ReferentialConstraint that, when applied on a declaration, limits the scope (namespace or type) in which this declaration can be used. This constraint is useful to isolate several components from each other, even if they are implemented in the same assembly. The ComponentInternal constraint sets the visibility of a declaration between internal and private.
Public class | Constraint | Root class for all constraints based on MulticastAttribute. A constraint is a piece validation logic executed at build time. Constraints are applied to elements of code ((Assembly, Type, MethodInfo, ConstructorInfo, PropertyInfo, EventInfo, FieldInfo, ParameterInfo) typically using multicast custom attributes, and verified at build time for every assembly using this element of code.
Public class | ExperimentalAttribute | Custom attribute that, when applied on a declaration, causes PostSharp to emit a warning if the declaration is being used.
Public class | InternalAttribute | ReferentialConstraint, when applied to a declaration, prevents it to be used from a different assembly. This constraint can be used when a declaration must be made public for technical reasons, but its author does not want it to be used in external code.
Public class | InternalImplementAttribute | ReferentialConstraint that, when applied on an interface, prevents it to be implemented in a different assembly. This constraint should be used when the author of an interface does not expect users to implement the interface and wants to reserve the possibility to add new methods to the interface.
Public class | NamingConventionAttribute | Custom attribute that, when applied to a target class or an interface, validates that classes and interfaces derived from this target class or interface respect a giving naming convention, i.e. that their names matches a given pattern.
Public class | ParameterValueConstraint | Base class to create architecture constraints that validate the value passed to a method parameter.
Public class | ProtectedAttribute | Custom attribute that, when applied to a target declaration, causes PostSharp to emit a warning if the declaration is being referenced from classes that are not derived from the target class. This constraint is similar to the C# keyword protected and should be used only when the target declaration must be made public or internal for non-architectural reasons.
Public class | ReferenceConstraint | Base class for constraints validating code references.
Public class | ReferentialConstraint | Implementation of IReferentialConstraint based on MulticastAttribute.
Public class | ScalarConstraint | Implementation of IScalarConstraint based on MulticastAttribute.
Interfaces
 | Interface | Description
Public interface | IConstraint | A constraint is a piece of validation logic executed at build time. Constraints are applied to elements of code (Assembly, Type, MethodInfo, ConstructorInfo, PropertyInfo, EventInfo, FieldInfo, ParameterInfo), typically (but not necessarily) using custom attributes or MulticastAttribute.
Public interface | IReferentialConstraint | A constraint is a piece validation logic executed at build time. Constraints are applied to elements of code ((Assembly, Type, MethodInfo, ConstructorInfo, PropertyInfo, EventInfo, FieldInfo, ParameterInfo), typically using custom attributes or MulticastAttribute, and verified at build time for every assembly using this element of code.
Public interface | IScalarConstraint | A constraint that validates a specific element of code. Use an IReferentialConstraint to validate relationships between elements of code.


ComponentInternalAttribute Class

ReferentialConstraint that, when applied on a declaration, limits the scope (namespace or type) in which this declaration can be used. This constraint is useful to isolate several components from each other, even if they are implemented in the same assembly. The ComponentInternal constraint sets the visibility of a declaration between internal and private.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.ConstraintsConstraint
PostSharp.ConstraintsReferentialConstraint
PostSharp.ConstraintsReferenceConstraint
PostSharp.ConstraintsComponentInternalAttribute

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ComponentInternalAttribute : ReferenceConstraint

The ComponentInternalAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | ComponentInternalAttribute | Initializes a ComponentInternalAttribute restricting the target declaration from being used from another namespace than the namespace of the declaration.
Public method | ComponentInternalAttribute(String) | Initializes a ComponentInternalAttribute restricting the target declaration from being used outside of given types or namespaces, given by strings.
Public method | ComponentInternalAttribute(Type) | Initializes a ComponentInternalAttribute restricting the target declaration from being used outside of given types or namespaces, given as Type.
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | Severity | Gets or sets the severity of messages emitted by this constraint.
Top
Methods
 | Name | Description
Public method | ValidateConstraint | Validates the fact that the constraint has been applied on a valid element of code. When this method returns false, the constraint is silently ignored. (Inherited from Constraint.)
Top
Remarks
See Also

Reference

PostSharp.Constraints Namespace

Other Resources

Conceptual: Controlling Component Visibility Beyond Private and Internal


ComponentInternalAttribute Constructor

Overload List
 | Name | Description
Public method | ComponentInternalAttribute | Initializes a ComponentInternalAttribute restricting the target declaration from being used from another namespace than the namespace of the declaration.
Public method | ComponentInternalAttribute(String) | Initializes a ComponentInternalAttribute restricting the target declaration from being used outside of given types or namespaces, given by strings.
Public method | ComponentInternalAttribute(Type) | Initializes a ComponentInternalAttribute restricting the target declaration from being used outside of given types or namespaces, given as Type.
Top
See Also

Reference

ComponentInternalAttribute Class
PostSharp.Constraints Namespace


ComponentInternalAttribute Constructor

Initializes a ComponentInternalAttribute restricting the target declaration from being used from another namespace than the namespace of the declaration.

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ComponentInternalAttribute()
See Also

Reference

ComponentInternalAttribute Class
ComponentInternalAttribute Overload
PostSharp.Constraints Namespace


ComponentInternalAttribute Constructor (String[])

ComponentInternalAttribute Constructor (String)

Initializes a ComponentInternalAttribute restricting the target declaration from being used outside of given types or namespaces, given by strings.

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ComponentInternalAttribute(
    params string[] friendNamespaces
)

Parameters

friendNamespaces
Type: SystemString
List of types or namespaces from which the target declaration can be used.
See Also

Reference

ComponentInternalAttribute Class
ComponentInternalAttribute Overload
PostSharp.Constraints Namespace


ComponentInternalAttribute Constructor (Type[])

ComponentInternalAttribute Constructor (Type)

Initializes a ComponentInternalAttribute restricting the target declaration from being used outside of given types or namespaces, given as Type.

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ComponentInternalAttribute(
    params Type[] friendTypes
)

Parameters

friendTypes
Type: SystemType
List of types from which the target declaration can be used. If the name of a type is NamespaceType, the whole namespace of this type is allowed.
See Also

Reference

ComponentInternalAttribute Class
ComponentInternalAttribute Overload
PostSharp.Constraints Namespace


ComponentInternalAttribute Properties

The ComponentInternalAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | Severity | Gets or sets the severity of messages emitted by this constraint.
Top
See Also

Reference

ComponentInternalAttribute Class
PostSharp.Constraints Namespace


ComponentInternalAttribute.Severity Property

ComponentInternalAttributeSeverity Property

Gets or sets the severity of messages emitted by this constraint.

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SeverityType Severity { get; set; }

Property Value

Type: SeverityType
Remarks

The default value is Warning.

See Also

Reference

ComponentInternalAttribute Class
PostSharp.Constraints Namespace

Other Resources

Conceptual: Controlling Component Visibility Beyond Private and Internal


ComponentInternalAttribute Methods

The ComponentInternalAttribute type exposes the following members.

Methods
 | Name | Description
Public method | ValidateConstraint | Validates the fact that the constraint has been applied on a valid element of code. When this method returns false, the constraint is silently ignored. (Inherited from Constraint.)
Top
See Also

Reference

ComponentInternalAttribute Class
PostSharp.Constraints Namespace


Constraint Class

Root class for all constraints based on MulticastAttribute. A constraint is a piece validation logic executed at build time. Constraints are applied to elements of code ((Assembly, Type, MethodInfo, ConstructorInfo, PropertyInfo, EventInfo, FieldInfo, ParameterInfo) typically using multicast custom attributes, and verified at build time for every assembly using this element of code.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.ConstraintsConstraint
PostSharp.ConstraintsReferentialConstraint
PostSharp.ConstraintsScalarConstraint

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class Constraint : MulticastAttribute,
    IConstraint

The Constraint type exposes the following members.

Constructors
 | Name | Description
Protected method | Constraint | Initializes a new instance of the Constraint class
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Top
Methods
 | Name | Description
Public method | ValidateConstraint | Validates the fact that the constraint has been applied on a valid element of code. When this method returns false, the constraint is silently ignored.
Top
Remarks
See Also

Reference

PostSharp.Constraints Namespace


Constraint Constructor

Initializes a new instance of the Constraint class

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected Constraint()
See Also

Reference

Constraint Class
PostSharp.Constraints Namespace


Constraint Properties

The Constraint type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Top
See Also

Reference

Constraint Class
PostSharp.Constraints Namespace


Constraint Methods

The Constraint type exposes the following members.

Methods
 | Name | Description
Public method | ValidateConstraint | Validates the fact that the constraint has been applied on a valid element of code. When this method returns false, the constraint is silently ignored.
Top
See Also

Reference

Constraint Class
PostSharp.Constraints Namespace


Constraint.ValidateConstraint Method

ConstraintValidateConstraint Method

Validates the fact that the constraint has been applied on a valid element of code. When this method returns false, the constraint is silently ignored.

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual bool ValidateConstraint(
    Object target
)

Parameters

target
Type: SystemObject

Return Value

Type: Boolean
true if the constraint has been applied on a valid element of code, otherwise false.

Implements

IConstraintValidateConstraint(Object)
See Also

Reference

Constraint Class
PostSharp.Constraints Namespace

Other Resources

Conceptual: Developing Custom Architectural Constraints


ExperimentalAttribute Class

Custom attribute that, when applied on a declaration, causes PostSharp to emit a warning if the declaration is being used.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.ConstraintsConstraint
PostSharp.ConstraintsReferentialConstraint
PostSharp.ConstraintsExperimentalAttribute

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ExperimentalAttribute : ReferentialConstraint

The ExperimentalAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | ExperimentalAttribute | Initializes a new instance of the ExperimentalAttribute class
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Top
Methods
 | Name | Description
Public method | ValidateCode | Validates the constraint. (Overrides ReferentialConstraintValidateCode(Object, Assembly).)
Public method | ValidateConstraint | Validates the fact that the constraint has been applied on a valid element of code. When this method returns false, the constraint is silently ignored. (Inherited from Constraint.)
Top
Remarks
See Also

Reference

PostSharp.Constraints Namespace


ExperimentalAttribute Constructor

Initializes a new instance of the ExperimentalAttribute class

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ExperimentalAttribute()
See Also

Reference

ExperimentalAttribute Class
PostSharp.Constraints Namespace


ExperimentalAttribute Properties

The ExperimentalAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Top
See Also

Reference

ExperimentalAttribute Class
PostSharp.Constraints Namespace


ExperimentalAttribute Methods

The ExperimentalAttribute type exposes the following members.

Methods
 | Name | Description
Public method | ValidateCode | Validates the constraint. (Overrides ReferentialConstraintValidateCode(Object, Assembly).)
Public method | ValidateConstraint | Validates the fact that the constraint has been applied on a valid element of code. When this method returns false, the constraint is silently ignored. (Inherited from Constraint.)
Top
See Also

Reference

ExperimentalAttribute Class
PostSharp.Constraints Namespace


ExperimentalAttribute.ValidateCode Method

ExperimentalAttributeValidateCode Method

Validates the constraint.

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void ValidateCode(
    Object target,
    Assembly assembly
)

Parameters

target
Type: SystemObject
Declaration (Assembly, Type, MethodInfo, ConstructorInfo, PropertyInfo, EventInfo, FieldInfo, ParameterInfo) to which the constraint has been applied.
assembly
Type: System.ReflectionAssembly
The assembly being currently processed.

Implements

IReferentialConstraintValidateCode(Object, Assembly)
See Also

Reference

ExperimentalAttribute Class
PostSharp.Constraints Namespace

Other Resources

Conceptual: Developing Custom Architectural Constraints


IConstraint Interface

A constraint is a piece of validation logic executed at build time. Constraints are applied to elements of code (Assembly, Type, MethodInfo, ConstructorInfo, PropertyInfo, EventInfo, FieldInfo, ParameterInfo), typically (but not necessarily) using custom attributes or MulticastAttribute.

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IConstraint

The IConstraint type exposes the following members.

Methods
 | Name | Description
Public method | ValidateConstraint | Validates the fact that the constraint has been applied on a valid element of code. When this method returns false, the constraint is silently ignored.
Top
Remarks
See Also

Reference

PostSharp.Constraints Namespace


IConstraint Methods

The IConstraint type exposes the following members.

Methods
 | Name | Description
Public method | ValidateConstraint | Validates the fact that the constraint has been applied on a valid element of code. When this method returns false, the constraint is silently ignored.
Top
See Also

Reference

IConstraint Interface
PostSharp.Constraints Namespace


IConstraint.ValidateConstraint Method

IConstraintValidateConstraint Method

Validates the fact that the constraint has been applied on a valid element of code. When this method returns false, the constraint is silently ignored.

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
bool ValidateConstraint(
    Object target
)

Parameters

target
Type: SystemObject

Return Value

Type: Boolean
true if the constraint has been applied on a valid element of code, otherwise false.
See Also

Reference

IConstraint Interface
PostSharp.Constraints Namespace


InternalAttribute Class

ReferentialConstraint, when applied to a declaration, prevents it to be used from a different assembly. This constraint can be used when a declaration must be made public for technical reasons, but its author does not want it to be used in external code.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.ConstraintsConstraint
PostSharp.ConstraintsReferentialConstraint
PostSharp.ConstraintsInternalAttribute

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class InternalAttribute : ReferentialConstraint

The InternalAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | InternalAttribute | Initializes a new InternalAttribute.
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | Severity | Gets or sets the severity of messages emitted by this constraint.
Top
Methods
 | Name | Description
Public method | ValidateCode | Validates the constraint. (Overrides ReferentialConstraintValidateCode(Object, Assembly).)
Public method | ValidateConstraint | Validates the fact that the constraint has been applied on a valid element of code. When this method returns false, the constraint is silently ignored. (Overrides ConstraintValidateConstraint(Object).)
Top
Remarks
See Also

Reference

PostSharp.Constraints Namespace

Other Resources

Conceptual: Controlling Component Visibility Beyond Private and Internal


InternalAttribute Constructor

Initializes a new InternalAttribute.

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public InternalAttribute()
See Also

Reference

InternalAttribute Class
PostSharp.Constraints Namespace


InternalAttribute Properties

The InternalAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | Severity | Gets or sets the severity of messages emitted by this constraint.
Top
See Also

Reference

InternalAttribute Class
PostSharp.Constraints Namespace


InternalAttribute.Severity Property

InternalAttributeSeverity Property

Gets or sets the severity of messages emitted by this constraint.

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SeverityType Severity { get; set; }

Property Value

Type: SeverityType
Remarks

The default value is Warning.

See Also

Reference

InternalAttribute Class
PostSharp.Constraints Namespace


InternalAttribute Methods

The InternalAttribute type exposes the following members.

Methods
 | Name | Description
Public method | ValidateCode | Validates the constraint. (Overrides ReferentialConstraintValidateCode(Object, Assembly).)
Public method | ValidateConstraint | Validates the fact that the constraint has been applied on a valid element of code. When this method returns false, the constraint is silently ignored. (Overrides ConstraintValidateConstraint(Object).)
Top
See Also

Reference

InternalAttribute Class
PostSharp.Constraints Namespace


InternalAttribute.ValidateCode Method

InternalAttributeValidateCode Method

Validates the constraint.

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void ValidateCode(
    Object target,
    Assembly assembly
)

Parameters

target
Type: SystemObject
Declaration (Assembly, Type, MethodInfo, ConstructorInfo, PropertyInfo, EventInfo, FieldInfo, ParameterInfo) to which the constraint has been applied.
assembly
Type: System.ReflectionAssembly
The assembly being currently processed.

Implements

IReferentialConstraintValidateCode(Object, Assembly)
See Also

Reference

InternalAttribute Class
PostSharp.Constraints Namespace

Other Resources

Conceptual: Developing Custom Architectural Constraints


InternalAttribute.ValidateConstraint Method

InternalAttributeValidateConstraint Method

Validates the fact that the constraint has been applied on a valid element of code. When this method returns false, the constraint is silently ignored.

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool ValidateConstraint(
    Object target
)

Parameters

target
Type: SystemObject

Return Value

Type: Boolean
true if the constraint has been applied on a valid element of code, otherwise false.

Implements

IConstraintValidateConstraint(Object)
See Also

Reference

InternalAttribute Class
PostSharp.Constraints Namespace

Other Resources

Conceptual: Developing Custom Architectural Constraints


InternalImplementAttribute Class

ReferentialConstraint that, when applied on an interface, prevents it to be implemented in a different assembly. This constraint should be used when the author of an interface does not expect users to implement the interface and wants to reserve the possibility to add new methods to the interface.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.ConstraintsConstraint
PostSharp.ConstraintsReferentialConstraint
PostSharp.ConstraintsInternalImplementAttribute

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class InternalImplementAttribute : ReferentialConstraint

The InternalImplementAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | InternalImplementAttribute | Initializes a new InternalImplementAttribute.
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | Severity | Gets or sets the severity of messages emitted by this constraint.
Top
Methods
 | Name | Description
Public method | ValidateCode | Validates the constraint. (Overrides ReferentialConstraintValidateCode(Object, Assembly).)
Public method | ValidateConstraint | Validates the fact that the constraint has been applied on a valid element of code. When this method returns false, the constraint is silently ignored. (Inherited from Constraint.)
Top
Remarks
See Also

Reference

PostSharp.Constraints Namespace

Other Resources

Conceptual: Quick Examples
Conceptual: Restricting Interface Implementation


InternalImplementAttribute Constructor

Initializes a new InternalImplementAttribute.

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public InternalImplementAttribute()
See Also

Reference

InternalImplementAttribute Class
PostSharp.Constraints Namespace


InternalImplementAttribute Properties

The InternalImplementAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | Severity | Gets or sets the severity of messages emitted by this constraint.
Top
See Also

Reference

InternalImplementAttribute Class
PostSharp.Constraints Namespace


InternalImplementAttribute.Severity Property

InternalImplementAttributeSeverity Property

Gets or sets the severity of messages emitted by this constraint.

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SeverityType Severity { get; set; }

Property Value

Type: SeverityType
Remarks

The default value is Warning.

See Also

Reference

InternalImplementAttribute Class
PostSharp.Constraints Namespace


InternalImplementAttribute Methods

The InternalImplementAttribute type exposes the following members.

Methods
 | Name | Description
Public method | ValidateCode | Validates the constraint. (Overrides ReferentialConstraintValidateCode(Object, Assembly).)
Public method | ValidateConstraint | Validates the fact that the constraint has been applied on a valid element of code. When this method returns false, the constraint is silently ignored. (Inherited from Constraint.)
Top
See Also

Reference

InternalImplementAttribute Class
PostSharp.Constraints Namespace


InternalImplementAttribute.ValidateCode Method

InternalImplementAttributeValidateCode Method

Validates the constraint.

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void ValidateCode(
    Object target,
    Assembly assembly
)

Parameters

target
Type: SystemObject
Declaration (Assembly, Type, MethodInfo, ConstructorInfo, PropertyInfo, EventInfo, FieldInfo, ParameterInfo) to which the constraint has been applied.
assembly
Type: System.ReflectionAssembly
The assembly being currently processed.

Implements

IReferentialConstraintValidateCode(Object, Assembly)
See Also

Reference

InternalImplementAttribute Class
PostSharp.Constraints Namespace

Other Resources

Conceptual: Developing Custom Architectural Constraints


IReferentialConstraint Interface

A constraint is a piece validation logic executed at build time. Constraints are applied to elements of code ((Assembly, Type, MethodInfo, ConstructorInfo, PropertyInfo, EventInfo, FieldInfo, ParameterInfo), typically using custom attributes or MulticastAttribute, and verified at build time for every assembly using this element of code.

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IReferentialConstraint : IConstraint

The IReferentialConstraint type exposes the following members.

Methods
 | Name | Description
Public method | ValidateCode | Validates the constraint.
Public method | ValidateConstraint | Validates the fact that the constraint has been applied on a valid element of code. When this method returns false, the constraint is silently ignored. (Inherited from IConstraint.)
Top
Remarks
See Also

Reference

PostSharp.Constraints Namespace


IReferentialConstraint Methods

The IReferentialConstraint type exposes the following members.

Methods
 | Name | Description
Public method | ValidateCode | Validates the constraint.
Public method | ValidateConstraint | Validates the fact that the constraint has been applied on a valid element of code. When this method returns false, the constraint is silently ignored. (Inherited from IConstraint.)
Top
See Also

Reference

IReferentialConstraint Interface
PostSharp.Constraints Namespace


IReferentialConstraint.ValidateCode Method

IReferentialConstraintValidateCode Method

Validates the constraint.

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void ValidateCode(
    Object target,
    Assembly assembly
)

Parameters

target
Type: SystemObject
Declaration (Assembly, Type, MethodInfo, ConstructorInfo, PropertyInfo, EventInfo, FieldInfo, ParameterInfo) to which the constraint has been applied.
assembly
Type: System.ReflectionAssembly
The assembly being currently processed.
See Also

Reference

IReferentialConstraint Interface
PostSharp.Constraints Namespace


IScalarConstraint Interface

A constraint that validates a specific element of code. Use an IReferentialConstraint to validate relationships between elements of code.

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IScalarConstraint : IConstraint

The IScalarConstraint type exposes the following members.

Methods
 | Name | Description
Public method | ValidateCode | Validates the element of code to which the constraint is applied.
Public method | ValidateConstraint | Validates the fact that the constraint has been applied on a valid element of code. When this method returns false, the constraint is silently ignored. (Inherited from IConstraint.)
Top
Remarks
See Also

Reference

PostSharp.Constraints Namespace
PostSharp.ConstraintsScalarConstraint


IScalarConstraint Methods

The IScalarConstraint type exposes the following members.

Methods
 | Name | Description
Public method | ValidateCode | Validates the element of code to which the constraint is applied.
Public method | ValidateConstraint | Validates the fact that the constraint has been applied on a valid element of code. When this method returns false, the constraint is silently ignored. (Inherited from IConstraint.)
Top
See Also

Reference

IScalarConstraint Interface
PostSharp.Constraints Namespace


IScalarConstraint.ValidateCode Method

IScalarConstraintValidateCode Method

Validates the element of code to which the constraint is applied.

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void ValidateCode(
    Object target
)

Parameters

target
Type: SystemObject
Element of code to which the constraint is applied (Assembly, Type, MethodInfo, ConstructorInfo, PropertyInfo, EventInfo, FieldInfo, ParameterInfo).
See Also

Reference

IScalarConstraint Interface
PostSharp.Constraints Namespace


NamingConventionAttribute Class

Custom attribute that, when applied to a target class or an interface, validates that classes and interfaces derived from this target class or interface respect a giving naming convention, i.e. that their names matches a given pattern.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.ConstraintsConstraint
PostSharp.ConstraintsScalarConstraint
PostSharp.ConstraintsNamingConventionAttribute

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class NamingConventionAttribute : ScalarConstraint

The NamingConventionAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | NamingConventionAttribute | Initializes a new NamingConventionAttribute.
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | Severity | Gets or sets the severity of messages reporting violations of the current naming convention.
Top
Methods
 | Name | Description
Public method | ValidateCode | Validates the element of code to which the constraint is applied. (Overrides ScalarConstraintValidateCode(Object).)
Public method | ValidateConstraint | Validates the fact that the constraint has been applied on a valid element of code. When this method returns false, the constraint is silently ignored. (Overrides ConstraintValidateConstraint(Object).)
Top
See Also

Reference

PostSharp.Constraints Namespace

Other Resources

Conceptual: What's New in PostSharp 5.0


NamingConventionAttribute Constructor

Initializes a new NamingConventionAttribute.

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public NamingConventionAttribute(
    string pattern
)

Parameters

pattern
Type: SystemString
A wildcard pattern containing a
Copy
*
, or, if the parameter starts with the
Copy
regex:
prefix, a regular expression.
See Also

Reference

NamingConventionAttribute Class
PostSharp.Constraints Namespace


NamingConventionAttribute Properties

The NamingConventionAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | Severity | Gets or sets the severity of messages reporting violations of the current naming convention.
Top
See Also

Reference

NamingConventionAttribute Class
PostSharp.Constraints Namespace


NamingConventionAttribute.Severity Property

NamingConventionAttributeSeverity Property

Gets or sets the severity of messages reporting violations of the current naming convention.

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SeverityType Severity { get; set; }

Property Value

Type: SeverityType
See Also

Reference

NamingConventionAttribute Class
PostSharp.Constraints Namespace


NamingConventionAttribute Methods

The NamingConventionAttribute type exposes the following members.

Methods
 | Name | Description
Public method | ValidateCode | Validates the element of code to which the constraint is applied. (Overrides ScalarConstraintValidateCode(Object).)
Public method | ValidateConstraint | Validates the fact that the constraint has been applied on a valid element of code. When this method returns false, the constraint is silently ignored. (Overrides ConstraintValidateConstraint(Object).)
Top
See Also

Reference

NamingConventionAttribute Class
PostSharp.Constraints Namespace


NamingConventionAttribute.ValidateCode Method

NamingConventionAttributeValidateCode Method

Validates the element of code to which the constraint is applied.

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void ValidateCode(
    Object target
)

Parameters

target
Type: SystemObject
Element of code to which the constraint is applied (Assembly, Type, MethodInfo, ConstructorInfo, PropertyInfo, EventInfo, FieldInfo, ParameterInfo).

Implements

IScalarConstraintValidateCode(Object)
See Also

Reference

NamingConventionAttribute Class
PostSharp.Constraints Namespace

Other Resources

Conceptual: Developing Custom Architectural Constraints


NamingConventionAttribute.ValidateConstraint Method

NamingConventionAttributeValidateConstraint Method

Validates the fact that the constraint has been applied on a valid element of code. When this method returns false, the constraint is silently ignored.

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool ValidateConstraint(
    Object target
)

Parameters

target
Type: SystemObject

Return Value

Type: Boolean
true if the constraint has been applied on a valid element of code, otherwise false.

Implements

IConstraintValidateConstraint(Object)
See Also

Reference

NamingConventionAttribute Class
PostSharp.Constraints Namespace

Other Resources

Conceptual: Developing Custom Architectural Constraints


ParameterValueConstraint Class

Base class to create architecture constraints that validate the value passed to a method parameter.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.ConstraintsConstraint
PostSharp.ConstraintsReferentialConstraint
PostSharp.ConstraintsParameterValueConstraint

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class ParameterValueConstraint : ReferentialConstraint

The ParameterValueConstraint type exposes the following members.

Constructors
 | Name | Description
Protected method | ParameterValueConstraint | Initializes a new instance of the ParameterValueConstraint class
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Top
Methods
 | Name | Description
Protected method | ValidateParameterValue | Validates the value passed to the parameter.
Protected method | ValidateTargetParameter | Validates the parameter to which the current constraint has been applied. A typical use of this method is to validate the parameter type. Overriding implementations should call the base implementation.
Top
See Also

Reference

PostSharp.Constraints Namespace

Other Resources

Conceptual: What's New in PostSharp 5.0


ParameterValueConstraint Constructor

Initializes a new instance of the ParameterValueConstraint class

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected ParameterValueConstraint()
See Also

Reference

ParameterValueConstraint Class
PostSharp.Constraints Namespace


ParameterValueConstraint Properties

The ParameterValueConstraint type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Top
See Also

Reference

ParameterValueConstraint Class
PostSharp.Constraints Namespace


ParameterValueConstraint Methods

The ParameterValueConstraint type exposes the following members.

Methods
 | Name | Description
Protected method | ValidateParameterValue | Validates the value passed to the parameter.
Protected method | ValidateTargetParameter | Validates the parameter to which the current constraint has been applied. A typical use of this method is to validate the parameter type. Overriding implementations should call the base implementation.
Top
See Also

Reference

ParameterValueConstraint Class
PostSharp.Constraints Namespace


ParameterValueConstraint.ValidateParameterValue Method

ParameterValueConstraintValidateParameterValue Method

Validates the value passed to the parameter.

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected abstract void ValidateParameterValue(
    ParameterInfo parameter,
    IExpression expression
)

Parameters

parameter
Type: System.ReflectionParameterInfo
The parameter to which the current constraint has been applied.
expression
Type: PostSharp.Reflection.MethodBodyIExpression
The expression passed to the parameter.
See Also

Reference

ParameterValueConstraint Class
PostSharp.Constraints Namespace


ParameterValueConstraint.ValidateTargetParameter Method

ParameterValueConstraintValidateTargetParameter Method

Validates the parameter to which the current constraint has been applied. A typical use of this method is to validate the parameter type. Overriding implementations should call the base implementation.

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual bool ValidateTargetParameter(
    ParameterInfo parameter
)

Parameters

parameter
Type: System.ReflectionParameterInfo
The parameter to which the custom attribute has been applied.

Return Value

Type: Boolean
true if the current constraint can legally be applied to parameter, false otherwise. No error message is emitted if the method returns false. The method should emit its own error message.
See Also

Reference

ParameterValueConstraint Class
PostSharp.Constraints Namespace


ProtectedAttribute Class

Custom attribute that, when applied to a target declaration, causes PostSharp to emit a warning if the declaration is being referenced from classes that are not derived from the target class. This constraint is similar to the C# keyword protected and should be used only when the target declaration must be made public or internal for non-architectural reasons.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.ConstraintsConstraint
PostSharp.ConstraintsReferentialConstraint
PostSharp.ConstraintsProtectedAttribute

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ProtectedAttribute : ReferentialConstraint

The ProtectedAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | ProtectedAttribute | Initializes a new ProtectedAttribute.
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | Severity | Gets or sets the severity of messages emitted by this constraint.
Top
Methods
 | Name | Description
Public method | ValidateCode | Validates the constraint. (Overrides ReferentialConstraintValidateCode(Object, Assembly).)
Public method | ValidateConstraint | Validates the fact that the constraint has been applied on a valid element of code. When this method returns false, the constraint is silently ignored. (Overrides ConstraintValidateConstraint(Object).)
Top
Remarks
See Also

Reference

PostSharp.Constraints Namespace


ProtectedAttribute Constructor

Initializes a new ProtectedAttribute.

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ProtectedAttribute()
See Also

Reference

ProtectedAttribute Class
PostSharp.Constraints Namespace


ProtectedAttribute Properties

The ProtectedAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | Severity | Gets or sets the severity of messages emitted by this constraint.
Top
See Also

Reference

ProtectedAttribute Class
PostSharp.Constraints Namespace


ProtectedAttribute.Severity Property

ProtectedAttributeSeverity Property

Gets or sets the severity of messages emitted by this constraint.

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SeverityType Severity { get; set; }

Property Value

Type: SeverityType
Remarks

The default value is Warning.

See Also

Reference

ProtectedAttribute Class
PostSharp.Constraints Namespace


ProtectedAttribute Methods

The ProtectedAttribute type exposes the following members.

Methods
 | Name | Description
Public method | ValidateCode | Validates the constraint. (Overrides ReferentialConstraintValidateCode(Object, Assembly).)
Public method | ValidateConstraint | Validates the fact that the constraint has been applied on a valid element of code. When this method returns false, the constraint is silently ignored. (Overrides ConstraintValidateConstraint(Object).)
Top
See Also

Reference

ProtectedAttribute Class
PostSharp.Constraints Namespace


ProtectedAttribute.ValidateCode Method

ProtectedAttributeValidateCode Method

Validates the constraint.

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void ValidateCode(
    Object target,
    Assembly assembly
)

Parameters

target
Type: SystemObject
Declaration (Assembly, Type, MethodInfo, ConstructorInfo, PropertyInfo, EventInfo, FieldInfo, ParameterInfo) to which the constraint has been applied.
assembly
Type: System.ReflectionAssembly
The assembly being currently processed.

Implements

IReferentialConstraintValidateCode(Object, Assembly)
See Also

Reference

ProtectedAttribute Class
PostSharp.Constraints Namespace

Other Resources

Conceptual: Developing Custom Architectural Constraints


ProtectedAttribute.ValidateConstraint Method

ProtectedAttributeValidateConstraint Method

Validates the fact that the constraint has been applied on a valid element of code. When this method returns false, the constraint is silently ignored.

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool ValidateConstraint(
    Object target
)

Parameters

target
Type: SystemObject

Return Value

Type: Boolean
true if the constraint has been applied on a valid element of code, otherwise false.

Implements

IConstraintValidateConstraint(Object)
See Also

Reference

ProtectedAttribute Class
PostSharp.Constraints Namespace

Other Resources

Conceptual: Developing Custom Architectural Constraints


ReferenceConstraint Class

Base class for constraints validating code references.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.ConstraintsConstraint
PostSharp.ConstraintsReferentialConstraint
PostSharp.ConstraintsReferenceConstraint
PostSharp.ConstraintsComponentInternalAttribute

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class ReferenceConstraint : ReferentialConstraint

The ReferenceConstraint type exposes the following members.

Constructors
 | Name | Description
Protected method | ReferenceConstraint | Initializes a new instance of the ReferenceConstraint class
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Top
Methods
 | Name | Description
Public method | ValidateConstraint | Validates the fact that the constraint has been applied on a valid element of code. When this method returns false, the constraint is silently ignored. (Inherited from Constraint.)
Protected method | ValidateReference | Validates a reference to the target declaration of the current constraint.
Top
See Also

Reference

PostSharp.Constraints Namespace

Other Resources

Conceptual: What's New in PostSharp 5.0


ReferenceConstraint Constructor

Initializes a new instance of the ReferenceConstraint class

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected ReferenceConstraint()
See Also

Reference

ReferenceConstraint Class
PostSharp.Constraints Namespace


ReferenceConstraint Properties

The ReferenceConstraint type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Top
See Also

Reference

ReferenceConstraint Class
PostSharp.Constraints Namespace


ReferenceConstraint Methods

The ReferenceConstraint type exposes the following members.

Methods
 | Name | Description
Public method | ValidateConstraint | Validates the fact that the constraint has been applied on a valid element of code. When this method returns false, the constraint is silently ignored. (Inherited from Constraint.)
Protected method | ValidateReference | Validates a reference to the target declaration of the current constraint.
Top
See Also

Reference

ReferenceConstraint Class
PostSharp.Constraints Namespace


ReferenceConstraint.ValidateReference Method

ReferenceConstraintValidateReference Method

Validates a reference to the target declaration of the current constraint.

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected abstract void ValidateReference(
    ICodeReference reference
)

Parameters

reference
Type: PostSharp.ReflectionICodeReference
Represents a reference to the target of the current constraint.
See Also

Reference

ReferenceConstraint Class
PostSharp.Constraints Namespace


ReferentialConstraint Class

Implementation of IReferentialConstraint based on MulticastAttribute.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.ConstraintsConstraint
PostSharp.ConstraintsReferentialConstraint
More...

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class ReferentialConstraint : Constraint,
    IReferentialConstraint, IConstraint

The ReferentialConstraint type exposes the following members.

Constructors
 | Name | Description
Protected method | ReferentialConstraint | Initializes a new instance of the ReferentialConstraint class
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Top
Methods
 | Name | Description
Public method | ValidateCode | Validates the constraint.
Public method | ValidateConstraint | Validates the fact that the constraint has been applied on a valid element of code. When this method returns false, the constraint is silently ignored. (Inherited from Constraint.)
Top
Remarks
See Also

Reference

PostSharp.Constraints Namespace

Other Resources

Conceptual: Developing Custom Architectural Constraints
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.ConstraintsConstraint
PostSharp.ConstraintsReferentialConstraint
PostSharp.ConstraintsExperimentalAttribute
PostSharp.ConstraintsInternalAttribute
PostSharp.ConstraintsInternalImplementAttribute
PostSharp.ConstraintsParameterValueConstraint
PostSharp.ConstraintsProtectedAttribute
PostSharp.ConstraintsReferenceConstraint


ReferentialConstraint Constructor

Initializes a new instance of the ReferentialConstraint class

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected ReferentialConstraint()
See Also

Reference

ReferentialConstraint Class
PostSharp.Constraints Namespace


ReferentialConstraint Properties

The ReferentialConstraint type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Top
See Also

Reference

ReferentialConstraint Class
PostSharp.Constraints Namespace


ReferentialConstraint Methods

The ReferentialConstraint type exposes the following members.

Methods
 | Name | Description
Public method | ValidateCode | Validates the constraint.
Public method | ValidateConstraint | Validates the fact that the constraint has been applied on a valid element of code. When this method returns false, the constraint is silently ignored. (Inherited from Constraint.)
Top
See Also

Reference

ReferentialConstraint Class
PostSharp.Constraints Namespace


ReferentialConstraint.ValidateCode Method

ReferentialConstraintValidateCode Method

Validates the constraint.

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void ValidateCode(
    Object target,
    Assembly assembly
)

Parameters

target
Type: SystemObject
Declaration (Assembly, Type, MethodInfo, ConstructorInfo, PropertyInfo, EventInfo, FieldInfo, ParameterInfo) to which the constraint has been applied.
assembly
Type: System.ReflectionAssembly
The assembly being currently processed.

Implements

IReferentialConstraintValidateCode(Object, Assembly)
See Also

Reference

ReferentialConstraint Class
PostSharp.Constraints Namespace

Other Resources

Conceptual: Developing Custom Architectural Constraints


ScalarConstraint Class

Implementation of IScalarConstraint based on MulticastAttribute.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.ConstraintsConstraint
PostSharp.ConstraintsScalarConstraint
PostSharp.ConstraintsNamingConventionAttribute
PostSharp.Patterns.ThreadingThreadSafetyPolicy

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class ScalarConstraint : Constraint,
    IScalarConstraint, IConstraint

The ScalarConstraint type exposes the following members.

Constructors
 | Name | Description
Public method | ScalarConstraint | Initializes a new instance of the ScalarConstraint class
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Top
Methods
 | Name | Description
Public method | ValidateCode | Validates the element of code to which the constraint is applied.
Public method | ValidateConstraint | Validates the fact that the constraint has been applied on a valid element of code. When this method returns false, the constraint is silently ignored. (Inherited from Constraint.)
Top
Remarks
See Also

Reference

PostSharp.Constraints Namespace

Other Resources

Conceptual: Developing Custom Architectural Constraints


ScalarConstraint Constructor

Initializes a new instance of the ScalarConstraint class

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ScalarConstraint()
See Also

Reference

ScalarConstraint Class
PostSharp.Constraints Namespace


ScalarConstraint Properties

The ScalarConstraint type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Top
See Also

Reference

ScalarConstraint Class
PostSharp.Constraints Namespace


ScalarConstraint Methods

The ScalarConstraint type exposes the following members.

Methods
 | Name | Description
Public method | ValidateCode | Validates the element of code to which the constraint is applied.
Public method | ValidateConstraint | Validates the fact that the constraint has been applied on a valid element of code. When this method returns false, the constraint is silently ignored. (Inherited from Constraint.)
Top
See Also

Reference

ScalarConstraint Class
PostSharp.Constraints Namespace


ScalarConstraint.ValidateCode Method

ScalarConstraintValidateCode Method

Validates the element of code to which the constraint is applied.

Namespace: PostSharp.Constraints
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void ValidateCode(
    Object target
)

Parameters

target
Type: SystemObject
Element of code to which the constraint is applied (Assembly, Type, MethodInfo, ConstructorInfo, PropertyInfo, EventInfo, FieldInfo, ParameterInfo).

Implements

IScalarConstraintValidateCode(Object)
See Also

Reference

ScalarConstraint Class
PostSharp.Constraints Namespace

Other Resources

Conceptual: Developing Custom Architectural Constraints


PostSharp.Extensibility Namespace

The PostSharp.Extensibility namespace defines the semantics of the attribute multicasting mechanism and exposes other types that allow user code to interact with the PostSharp,platform.
Classes
 | Class | Description
Public class | AssemblyIdAttribute | Assigns a unique identifier to an assembly. This assembly identifier is used to generate unique attribute identifiers.
Public class | EscalatePostSharpMessageAttribute | Custom attribute that, when applied on an assembly, means that a given message should be escalated to an error during the current PostSharp session.
Public class | HasInheritedAttributeAttribute | Internal Only. Custom attribute used internally by PostSharp to mark elements having inherited custom attributes. This custom attribute should not be used in custom code, otherwise PostSharp may not work properly.
Public class | ImplementationBoundAttributeAttribute | Custom attribute meaning that custom attributes of a given type are bound to the implementation, not to the semantics.
Public class | InvalidAnnotationException | Exception thrown at build time by implementation of CompileTimeValidate(Object) when an annotation is invalid.
Public class | Message | Encapsulates a message (error, warning, info, ...).
Public class | MessageDispenser | Provides a base implementation of IMessageDispenser where the message key is supposed to be in format PRE0000, where PRE is a prefix and 0000 is an integer. Keys for help URLs have the format PRE0000?.
Public class | MessageException | Exception embedding a Message.
Public class | MessageLocation | Represents the location of a message, which means, for the end-user, a line in a file of source code. From the aspect developer, the location can be known as an object representing an element of code (for instance a Type or MethodInfo). Such implicit locations are resolved by PostSharp to a file and line number.
Public class | MessageSource | Provides commodity methods to work with an IMessageSink.
Public class | MetricAttribute | Custom attribute that, when applied on an aspect, causes the aspect to increment some metric at build time.
Public class | MulticastAttribute | Custom attribute that can be applied to multiple elements using wildcards.
Public class | MulticastAttributeUsageAttribute | Custom attribute that determines the usage of a MulticastAttribute.
Public class | PostSharpEnvironment | Provides access to the current PostSharp environment (IPostSharpEnvironment).
Public class | ProjectExtensionElement | Represents a custom element (or section) in the XML project type.
Public class | RequirePostSharpAttribute | Custom attribute that, when applied on another custom attribute (a class derived from Attribute), means that assemblies with elements annotated with that custom attribute should be processed by PostSharp.
Public class | SuppressAnnotationValidationAttribute | Instructs PostSharp that the validation of IValidableAnnotation is done by another component, and should not be processed by the default component.
Public class | SuppressWarningAttribute | Instructs PostSharp to ignore warnings and information messages. Errors cannot be ignored.
Interfaces
 | Interface | Description
Public interface | ICompatibilityLevelService | Exposes the PostSharp version with which the current version of PostSharp should be backward compatible.
Public interface | IFormattingService | Provides a service similar to Format(String, Object), but uses the same formatter as the one used by PostSharp for error messages. This formatter does a better job at formatting objects like Type or MethodInfo.
Public interface | IMessageDispenser | Gets a text given its key.
Public interface | IMessageLocationResolver | Provides a method that returns the file and line where a declaration (such as a Type or MethodInfo) is declared.
Public interface | IMessageSink | Receives messages.
Public interface | IPostSharpEnvironment | Provides information about the current PostSharp environment.
Public interface | IProject | Provides information about the currently executing project.
Public interface | IReflectionBindingManagerService | Exposes the ResolveAssembly(Type) method, which gets the reference identity of the assembly declaring a given type.
Public interface | IService | A service exposed by the build-time part of PostSharp.
Public interface | IServiceLocator | Exposes build-time services.
Public interface | IStateStore | A context that provides storage for arbitrary items.
Public interface | IValidableAnnotation | Interface that, when implemented by a custom attribute (Attribute), causes PostSharp to invoke a validation method for every instance of that custom attribute.
Public interface | IWeavingSymbolsService | Service that allows build-time code to push annotations (both programmatic and user-visible) to PostSharp Tools for Visual Studio.
Enumerations
 | Enumeration | Description
Public enumeration | BindingContext | Enumeration of contexts in which assemblies can be loaded.
Public enumeration | MulticastAttributes | Attributes of elements to which multicast custom attributes (MulticastAttribute) apply.
Public enumeration | MulticastInheritance | Kind of inheritance of MulticastAttribute.
Public enumeration | MulticastTargets | Kinds of targets to which multicast custom attributes (MulticastAttribute) can apply.
Public enumeration | SeverityType | Types of message severities.


AssemblyIdAttribute Class

Assigns a unique identifier to an assembly. This assembly identifier is used to generate unique attribute identifiers.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityAssemblyIdAttribute

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class AssemblyIdAttribute : Attribute

The AssemblyIdAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | AssemblyIdAttribute | Initializes a new AssemblyIdAttribute.
Top
Remarks
By default, the assembly identifier is computed from the module name (by using the first 4 bytes of the MD5 sum of the module name).
See Also

Reference

PostSharp.Extensibility Namespace


AssemblyIdAttribute Constructor

Initializes a new AssemblyIdAttribute.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AssemblyIdAttribute(
    int id
)

Parameters

id
Type: SystemInt32
Assembly identifier.
See Also

Reference

AssemblyIdAttribute Class
PostSharp.Extensibility Namespace


BindingContext Enumeration

Enumeration of contexts in which assemblies can be loaded.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum BindingContext
Members
Member name | Value | Description
None | 0 | Unspecified.
Reference | 1 | Reference assemblies the ones the project is being linked against. They are typically located in directory C:\Program Files\Reference Assemblies for the proper target platform.
Runtime | 2 | Runtime assemblies are the ones loaded at build time in the CLR. They are typically located in GAC.
See Also

Reference

PostSharp.Extensibility Namespace


EscalatePostSharpMessageAttribute Class

Custom attribute that, when applied on an assembly, means that a given message should be escalated to an error during the current PostSharp session.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityEscalatePostSharpMessageAttribute

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class EscalatePostSharpMessageAttribute : Attribute

The EscalatePostSharpMessageAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | EscalatePostSharpMessageAttribute | Initializes a new EscalatePostSharpMessageAttribute.
Top
Properties
 | Name | Description
Public property | MessageId | Gets the identifier of the message to be disabled.
Top
Remarks
Errors and fatal errors cannot be disabled.
See Also

Reference

PostSharp.Extensibility Namespace


EscalatePostSharpMessageAttribute Constructor

Initializes a new EscalatePostSharpMessageAttribute.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public EscalatePostSharpMessageAttribute(
    string messageId
)

Parameters

messageId
Type: SystemString
Identifier of the message to be disabled.
See Also

Reference

EscalatePostSharpMessageAttribute Class
PostSharp.Extensibility Namespace


EscalatePostSharpMessageAttribute Properties

The EscalatePostSharpMessageAttribute type exposes the following members.

Properties
 | Name | Description
Public property | MessageId | Gets the identifier of the message to be disabled.
Top
See Also

Reference

EscalatePostSharpMessageAttribute Class
PostSharp.Extensibility Namespace


EscalatePostSharpMessageAttribute.MessageId Property

EscalatePostSharpMessageAttributeMessageId Property

Gets the identifier of the message to be disabled.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string MessageId { get; }

Property Value

Type: String
See Also

Reference

EscalatePostSharpMessageAttribute Class
PostSharp.Extensibility Namespace


HasInheritedAttributeAttribute Class

Internal Only. Custom attribute used internally by PostSharp to mark elements having inherited custom attributes. This custom attribute should not be used in custom code, otherwise PostSharp may not work properly.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityHasInheritedAttributeAttribute

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class HasInheritedAttributeAttribute : Attribute
See Also

Reference

PostSharp.Extensibility Namespace


ICompatibilityLevelService Interface

Exposes the PostSharp version with which the current version of PostSharp should be backward compatible.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ICompatibilityLevelService : IService

The ICompatibilityLevelService type exposes the following members.

Properties
 | Name | Description
Public property | CompatibilityLevel | Gets the PostSharp version with which the current version of PostSharp should be backward compatible.
Top
See Also

Reference

PostSharp.Extensibility Namespace


ICompatibilityLevelService Properties

The ICompatibilityLevelService type exposes the following members.

Properties
 | Name | Description
Public property | CompatibilityLevel | Gets the PostSharp version with which the current version of PostSharp should be backward compatible.
Top
See Also

Reference

ICompatibilityLevelService Interface
PostSharp.Extensibility Namespace


ICompatibilityLevelService.CompatibilityLevel Property

ICompatibilityLevelServiceCompatibilityLevel Property

Gets the PostSharp version with which the current version of PostSharp should be backward compatible.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Version CompatibilityLevel { get; }

Property Value

Type: Version
Remarks

Some breaking changes may ignore this property.

See Also

Reference

ICompatibilityLevelService Interface
PostSharp.Extensibility Namespace


IFormattingService Interface

Provides a service similar to Format(String, Object), but uses the same formatter as the one used by PostSharp for error messages. This formatter does a better job at formatting objects like Type or MethodInfo.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IFormattingService : IService
Methods
 | Name | Description
Public method | Format(String, Object) | Formats a string with the default IFormatProvider.
Public method | Format(IFormatProvider, String, Object) | Formats a string and specifies the IFormatProvider.
Top
See Also

Reference

PostSharp.Extensibility Namespace


IFormattingService Methods

Methods
 | Name | Description
Public method | Format(String, Object) | Formats a string with the default IFormatProvider.
Public method | Format(IFormatProvider, String, Object) | Formats a string and specifies the IFormatProvider.
Top
See Also

Reference

IFormattingService Interface
PostSharp.Extensibility Namespace


IFormattingService.Format Method

IFormattingServiceFormat Method

Overload List
 | Name | Description
Public method | Format(String, Object) | Formats a string with the default IFormatProvider.
Public method | Format(IFormatProvider, String, Object) | Formats a string and specifies the IFormatProvider.
Top
See Also

Reference

IFormattingService Interface
PostSharp.Extensibility Namespace


IFormattingService.Format Method (String, Object[])

IFormattingServiceFormat Method (String, Object)

Formats a string with the default IFormatProvider.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
string Format(
    string format,
    params Object[] arguments
)

Parameters

format
Type: SystemString
The formatting string.
arguments
Type: SystemObject
Arguments.

Return Value

Type: String
The formatted string where parameters in format are replaced by formatted [!:arguments].
See Also

Reference

IFormattingService Interface
Format Overload
PostSharp.Extensibility Namespace


IFormattingService.Format Method (IFormatProvider, String, Object[])

IFormattingServiceFormat Method (IFormatProvider, String, Object)

Formats a string and specifies the IFormatProvider.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
string Format(
    IFormatProvider provider,
    string format,
    params Object[] arguments
)

Parameters

provider
Type: SystemIFormatProvider
An IFormatProvider.
format
Type: SystemString
The formatting string.
arguments
Type: SystemObject
Arguments.

Return Value

Type: String
The formatted string where parameters in format are replaced by formatted [!:arguments].
See Also

Reference

IFormattingService Interface
Format Overload
PostSharp.Extensibility Namespace


IMessageDispenser Interface

Gets a text given its key.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IMessageDispenser

The IMessageDispenser type exposes the following members.

Methods
 | Name | Description
Public method | GetMessage | Gets a message text given a message key.
Top
See Also

Reference

PostSharp.Extensibility Namespace
PostSharp.ExtensibilityMessageDispenser

Other Resources

Conceptual: Emitting Errors, Warnings, and Messages
Conceptual: Validating Aspect Usage


IMessageDispenser Methods

The IMessageDispenser type exposes the following members.

Methods
 | Name | Description
Public method | GetMessage | Gets a message text given a message key.
Top
See Also

Reference

IMessageDispenser Interface
PostSharp.Extensibility Namespace


IMessageDispenser.GetMessage Method

IMessageDispenserGetMessage Method

Gets a message text given a message key.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
string GetMessage(
    string key
)

Parameters

key
Type: SystemString
Message key.

Return Value

Type: String
The text corresponding to key.
See Also

Reference

IMessageDispenser Interface
PostSharp.Extensibility Namespace

Other Resources

Conceptual: Validating Aspect Usage


IMessageLocationResolver Interface

Provides a method that returns the file and line where a declaration (such as a Type or MethodInfo) is declared.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IMessageLocationResolver : IService

The IMessageLocationResolver type exposes the following members.

Methods
 | Name | Description
Public method | GetMessageLocation | Gets the file and line where a declaration is declared.
Top
See Also

Reference

PostSharp.Extensibility Namespace


IMessageLocationResolver Methods

The IMessageLocationResolver type exposes the following members.

Methods
 | Name | Description
Public method | GetMessageLocation | Gets the file and line where a declaration is declared.
Top
See Also

Reference

IMessageLocationResolver Interface
PostSharp.Extensibility Namespace


IMessageLocationResolver.GetMessageLocation Method

IMessageLocationResolverGetMessageLocation Method

Gets the file and line where a declaration is declared.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
MessageLocation GetMessageLocation(
    Object codeElement
)

Parameters

codeElement
Type: SystemObject
A MemberInfo, Type, ParameterInfo or LocationInfo.

Return Value

Type: MessageLocation
A MessageLocation describing where codeElement is declared, or Unknown if the location cannot be determined.
See Also

Reference

IMessageLocationResolver Interface
PostSharp.Extensibility Namespace


IMessageSink Interface

Receives messages.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IMessageSink

The IMessageSink type exposes the following members.

Methods
 | Name | Description
Public method | Write | Writes a message to the sink.
Top
Remarks
Use this interface instead of events for cross-domain communication.
See Also

Reference

PostSharp.Extensibility Namespace


IMessageSink Methods

The IMessageSink type exposes the following members.

Methods
 | Name | Description
Public method | Write | Writes a message to the sink.
Top
See Also

Reference

IMessageSink Interface
PostSharp.Extensibility Namespace


IMessageSink.Write Method

IMessageSinkWrite Method

Writes a message to the sink.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void Write(
    Message message
)

Parameters

message
Type: PostSharp.ExtensibilityMessage
A message.
See Also

Reference

IMessageSink Interface
PostSharp.Extensibility Namespace


ImplementationBoundAttributeAttribute Class

Custom attribute meaning that custom attributes of a given type are bound to the implementation, not to the semantics.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityImplementationBoundAttributeAttribute

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ImplementationBoundAttributeAttribute : Attribute

The ImplementationBoundAttributeAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | ImplementationBoundAttributeAttribute | Initializes the new ImplementationBoundAttributeAttribute.
Top
Properties
 | Name | Description
Public property | AttributeType | Gets the type of the custom attribute that should not be moved from implementation to semantic
Top
Remarks

This custom attribute influences whether instances of a given other custom attribute should be moved from the semantic to the implementation, when the semantic is detached from the implementation. This happens for instance when a property is generated from a field; the property become the semantic (and is made public) and the field the implementation (and is made private). Most custom attributes apply to semantics, so they are moved from the field to the property. If a custom attribute must not be moved, it should be marked with the ImplementationBoundAttributeAttribute custom attribute.

See Also

Reference

PostSharp.Extensibility Namespace


ImplementationBoundAttributeAttribute Constructor

Initializes the new ImplementationBoundAttributeAttribute.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ImplementationBoundAttributeAttribute(
    Type attributeType
)

Parameters

attributeType
Type: SystemType
Type of the custom attribute that should not be moved from implementation to semantic.
See Also

Reference

ImplementationBoundAttributeAttribute Class
PostSharp.Extensibility Namespace


ImplementationBoundAttributeAttribute Properties

The ImplementationBoundAttributeAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeType | Gets the type of the custom attribute that should not be moved from implementation to semantic
Top
See Also

Reference

ImplementationBoundAttributeAttribute Class
PostSharp.Extensibility Namespace


ImplementationBoundAttributeAttribute.AttributeType Property

ImplementationBoundAttributeAttributeAttributeType Property

Gets the type of the custom attribute that should not be moved from implementation to semantic

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Type AttributeType { get; }

Property Value

Type: Type
See Also

Reference

ImplementationBoundAttributeAttribute Class
PostSharp.Extensibility Namespace


InvalidAnnotationException Class

Exception thrown at build time by implementation of CompileTimeValidate(Object) when an annotation is invalid.
Inheritance Hierarchy
SystemObject
SystemException
PostSharp.ExtensibilityInvalidAnnotationException

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public class InvalidAnnotationException : Exception
Constructors
 | Name | Description
Public method | InvalidAnnotationException | Initializes a new InvalidAnnotationException with default message.
Public method | InvalidAnnotationException(String) | Initializes a new InvalidAnnotationException and with a specified exception message.
Protected method | InvalidAnnotationException(SerializationInfo, StreamingContext) | Deserialization constructor.
Public method | InvalidAnnotationException(String, Exception) | Initializes a new InvalidAnnotationException with a specified exception message and inner Exception.
Top
See Also

Reference

PostSharp.Extensibility Namespace

Other Resources

Conceptual: Validating Aspect Usage


InvalidAnnotationException Constructor

Overload List
 | Name | Description
Public method | InvalidAnnotationException | Initializes a new InvalidAnnotationException with default message.
Public method | InvalidAnnotationException(String) | Initializes a new InvalidAnnotationException and with a specified exception message.
Protected method | InvalidAnnotationException(SerializationInfo, StreamingContext) | Deserialization constructor.
Public method | InvalidAnnotationException(String, Exception) | Initializes a new InvalidAnnotationException with a specified exception message and inner Exception.
Top
See Also

Reference

InvalidAnnotationException Class
PostSharp.Extensibility Namespace


InvalidAnnotationException Constructor

Initializes a new InvalidAnnotationException with default message.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public InvalidAnnotationException()
See Also

Reference

InvalidAnnotationException Class
InvalidAnnotationException Overload
PostSharp.Extensibility Namespace


InvalidAnnotationException Constructor (String)

Initializes a new InvalidAnnotationException and with a specified exception message.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public InvalidAnnotationException(
    string message
)

Parameters

message
Type: SystemString
Exception message
See Also

Reference

InvalidAnnotationException Class
InvalidAnnotationException Overload
PostSharp.Extensibility Namespace


InvalidAnnotationException Constructor (SerializationInfo, StreamingContext)

Deserialization constructor.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected InvalidAnnotationException(
    SerializationInfo info,
    StreamingContext context
)

Parameters

info
Type: System.Runtime.SerializationSerializationInfo
Info.
context
Type: System.Runtime.SerializationStreamingContext
Context.
See Also

Reference

InvalidAnnotationException Class
InvalidAnnotationException Overload
PostSharp.Extensibility Namespace


InvalidAnnotationException Constructor (String, Exception)

Initializes a new InvalidAnnotationException with a specified exception message and inner Exception.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public InvalidAnnotationException(
    string message,
    Exception inner
)

Parameters

message
Type: SystemString
Exception message.
inner
Type: SystemException
Inner exception.
See Also

Reference

InvalidAnnotationException Class
InvalidAnnotationException Overload
PostSharp.Extensibility Namespace


IPostSharpEnvironment Interface

Provides information about the current PostSharp environment.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IPostSharpEnvironment

The IPostSharpEnvironment type exposes the following members.

Properties
 | Name | Description
Public property | CurrentProject | Gets the currently executing project.
Top
Methods
 | Name | Description
Public method | LoadAssemblyFromFile | Loads an Assembly given its file name.
Top
See Also

Reference

PostSharp.Extensibility Namespace


IPostSharpEnvironment Properties

The IPostSharpEnvironment type exposes the following members.

Properties
 | Name | Description
Public property | CurrentProject | Gets the currently executing project.
Top
See Also

Reference

IPostSharpEnvironment Interface
PostSharp.Extensibility Namespace


IPostSharpEnvironment.CurrentProject Property

IPostSharpEnvironmentCurrentProject Property

Gets the currently executing project.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IProject CurrentProject { get; }

Property Value

Type: IProject
The current project, or null if there is no current project.
See Also

Reference

IPostSharpEnvironment Interface
PostSharp.Extensibility Namespace


IPostSharpEnvironment Methods

The IPostSharpEnvironment type exposes the following members.

Methods
 | Name | Description
Public method | LoadAssemblyFromFile | Loads an Assembly given its file name.
Top
See Also

Reference

IPostSharpEnvironment Interface
PostSharp.Extensibility Namespace


IPostSharpEnvironment.LoadAssemblyFromFile Method

IPostSharpEnvironmentLoadAssemblyFromFile Method

Loads an Assembly given its file name.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Assembly LoadAssemblyFromFile(
    string fileName
)

Parameters

fileName
Type: SystemString
Full assembly path.

Return Value

Type: Assembly
The Assembly.
Remarks

Use this method instead of LoadFile(String).

Note Note
You cannot load two assemblies with a different path and the same identity (strong name) into PostSharp.
See Also

Reference

IPostSharpEnvironment Interface
PostSharp.Extensibility Namespace


IProject Interface

Provides information about the currently executing project.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IProject : IServiceLocator,
    IService

The IProject type exposes the following members.

Properties
 | Name | Description
Public property | StateStore | Gets the context of the current project that serves as a project-scoped cache.
Public property | TargetAssembly | Gets the assembly that is being transformed by PostSharp.
Top
Methods
 | Name | Description
Public method | EvaluateExpression | Evaluates an expression (that is, replace parameters by their actual value).
Public method | GetExtensionElements | Gets the set of project extension elements (ProjectExtensionElement) given their name and XML namespace.
Public method | GetServiceT | Gets a build-time service exposed by PostSharp.
Top
See Also

Reference

PostSharp.Extensibility Namespace


IProject Properties

The IProject type exposes the following members.

Properties
 | Name | Description
Public property | StateStore | Gets the context of the current project that serves as a project-scoped cache.
Public property | TargetAssembly | Gets the assembly that is being transformed by PostSharp.
Top
See Also

Reference

IProject Interface
PostSharp.Extensibility Namespace


IProject.StateStore Property

IProjectStateStore Property

Gets the context of the current project that serves as a project-scoped cache.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IStateStore StateStore { get; }

Property Value

Type: IStateStore
See Also

Reference

IProject Interface
PostSharp.Extensibility Namespace

Other Resources

Conceptual: Enabling Solution-Wide Build


IProject.TargetAssembly Property

IProjectTargetAssembly Property

Gets the assembly that is being transformed by PostSharp.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Assembly TargetAssembly { get; }

Return Value

Type: Assembly
The assembly being processed.
See Also

Reference

IProject Interface
PostSharp.Extensibility Namespace


IProject Methods

The IProject type exposes the following members.

Methods
 | Name | Description
Public method | EvaluateExpression | Evaluates an expression (that is, replace parameters by their actual value).
Public method | GetExtensionElements | Gets the set of project extension elements (ProjectExtensionElement) given their name and XML namespace.
Public method | GetServiceT | Gets a build-time service exposed by PostSharp.
Top
See Also

Reference

IProject Interface
PostSharp.Extensibility Namespace


IProject.EvaluateExpression Method

IProjectEvaluateExpression Method

Evaluates an expression (that is, replace parameters by their actual value).

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
string EvaluateExpression(
    string expression
)

Parameters

expression
Type: SystemString
An expression.

Return Value

Type: String
The evaluated expression, or null if one parameter could not be resolved.
See Also

Reference

IProject Interface
PostSharp.Extensibility Namespace

Other Resources

Conceptual: Accessing Configuration from Source Code


IProject.GetExtensionElements Method

IProjectGetExtensionElements Method

Gets the set of project extension elements (ProjectExtensionElement) given their name and XML namespace.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IEnumerable<ProjectExtensionElement> GetExtensionElements(
    string name,
    string ns
)

Parameters

name
Type: SystemString
Local name of the project extension element.
ns
Type: SystemString
XML namespace of the project extension element.

Return Value

Type: IEnumerable ProjectExtensionElement
The set of project elements named name in all loaded projects.
See Also

Reference

IProject Interface
PostSharp.Extensibility Namespace

Other Resources

Conceptual: Accessing Configuration from Source Code


IProject.GetService(T) Method

IProjectGetServiceT Method

Gets a build-time service exposed by PostSharp.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
T GetService<T>(
    bool throwing = true
)
where T : class, IService

Parameters

throwing (Optional)
Type: SystemBoolean
true whether an exception should be thrown in case the service cannot be acquired, otherwise false. The default value is true.

Type Parameters

T
An interface derived from IService.

Return Value

Type: T
The service T, or null if the service could not be acquired and throwing was set to false.

Implements

IServiceLocatorGetServiceT(Boolean)
See Also

Reference

IProject Interface
PostSharp.Extensibility Namespace

Other Resources

Conceptual: Pushing Information to PostSharp Tools Programmatically


IReflectionBindingManagerService Interface

Exposes the ResolveAssembly(Type) method, which gets the reference identity of the assembly declaring a given type.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IReflectionBindingManagerService : IService

The IReflectionBindingManagerService type exposes the following members.

Methods
 | Name | Description
Public method | ResolveAssembly | Returns the reference identity of the assembly declaring a type.
Top
See Also

Reference

PostSharp.Extensibility Namespace


IReflectionBindingManagerService Methods

The IReflectionBindingManagerService type exposes the following members.

Methods
 | Name | Description
Public method | ResolveAssembly | Returns the reference identity of the assembly declaring a type.
Top
See Also

Reference

IReflectionBindingManagerService Interface
PostSharp.Extensibility Namespace


IReflectionBindingManagerService.ResolveAssembly Method

IReflectionBindingManagerServiceResolveAssembly Method

Returns the reference identity of the assembly declaring a type.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
string ResolveAssembly(
    Type type
)

Parameters

type
Type: SystemType
A Type.

Return Value

Type: String
The identity of the reference assembly defining Type. This assembly is possibly different than the runtime assembly, which is available from the Assembly property of the Type class. This method may return null if type is an internal type of a system assembly.
See Also

Reference

IReflectionBindingManagerService Interface
PostSharp.Extensibility Namespace


IService Interface

A service exposed by the build-time part of PostSharp.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IService
See Also

Reference

PostSharp.Extensibility Namespace

Other Resources

Conceptual: Configuration File Schema Reference


IServiceLocator Interface

Exposes build-time services.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IServiceLocator : IService

The IServiceLocator type exposes the following members.

Methods
 | Name | Description
Public method | GetServiceT | Gets a build-time service exposed by PostSharp.
Top
See Also

Reference

PostSharp.Extensibility Namespace


IServiceLocator Methods

The IServiceLocator type exposes the following members.

Methods
 | Name | Description
Public method | GetServiceT | Gets a build-time service exposed by PostSharp.
Top
See Also

Reference

IServiceLocator Interface
PostSharp.Extensibility Namespace


IServiceLocator.GetService(T) Method

IServiceLocatorGetServiceT Method

Gets a build-time service exposed by PostSharp.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
T GetService<T>(
    bool throwing = true
)
where T : class, IService

Parameters

throwing (Optional)
Type: SystemBoolean
true whether an exception should be thrown in case the service cannot be acquired, otherwise false. The default value is true.

Type Parameters

T
An interface derived from IService.

Return Value

Type: T
The service T, or null if the service could not be acquired and throwing was set to false.
See Also

Reference

IServiceLocator Interface
PostSharp.Extensibility Namespace


IStateStore Interface

A context that provides storage for arbitrary items.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IStateStore

The IStateStore type exposes the following members.

Methods
 | Name | Description
Public method | GetT | Gets a value of a given type from the store.
Public method | GetOrAddT | Gets a value from the cache or adds it if it does not exist yet.
Public method | GetOrNewT | Gets a value from the cache or adds a default value if it does not exist yet.
Public method | SetT | Adds a value to the store or replace it if a value of the same type already exists.
Top
See Also

Reference

PostSharp.Extensibility Namespace

Other Resources

Conceptual: Enabling Solution-Wide Build


IStateStore Methods

The IStateStore type exposes the following members.

Methods
 | Name | Description
Public method | GetT | Gets a value of a given type from the store.
Public method | GetOrAddT | Gets a value from the cache or adds it if it does not exist yet.
Public method | GetOrNewT | Gets a value from the cache or adds a default value if it does not exist yet.
Public method | SetT | Adds a value to the store or replace it if a value of the same type already exists.
Top
See Also

Reference

IStateStore Interface
PostSharp.Extensibility Namespace


IStateStore.Get(T) Method

IStateStoreGetT Method

Gets a value of a given type from the store.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
T Get<T>()
where T : class

Type Parameters

T
Type of the value.

Return Value

Type: T
The value whose type is T, or null if the store does not contain such value.
See Also

Reference

IStateStore Interface
PostSharp.Extensibility Namespace


IStateStore.GetOrAdd(T) Method

IStateStoreGetOrAddT Method

Gets a value from the cache or adds it if it does not exist yet.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
T GetOrAdd<T>(
    Func<T> getter
)

Parameters

getter
Type: SystemFunc T
The delegate invoked if no value of type T is present in the cache.

Type Parameters

T
Type of the value.

Return Value

Type: T
Either the value of type T present in the cache, either the result of the getter delegate.
See Also

Reference

IStateStore Interface
PostSharp.Extensibility Namespace


IStateStore.GetOrNew(T) Method

IStateStoreGetOrNewT Method

Gets a value from the cache or adds a default value if it does not exist yet.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
T GetOrNew<T>()
where T : new()

Type Parameters

T
Type of value.

Return Value

Type: T
Either the value of type T present in the cache, either a new object of type T.
See Also

Reference

IStateStore Interface
PostSharp.Extensibility Namespace


IStateStore.Set(T) Method

IStateStoreSetT Method

Adds a value to the store or replace it if a value of the same type already exists.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void Set<T>(
    T value
)
where T : class

Parameters

value
Type: T
The new value.

Type Parameters

T
Type of the new value.
See Also

Reference

IStateStore Interface
PostSharp.Extensibility Namespace


IValidableAnnotation Interface

Interface that, when implemented by a custom attribute (Attribute), causes PostSharp to invoke a validation method for every instance of that custom attribute.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IValidableAnnotation

The IValidableAnnotation type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeValidate | Method invoked at build time to ensure that the aspect has been applied to the right target.
Top
See Also

Reference

PostSharp.Extensibility Namespace

Other Resources

Conceptual: Understanding Attribute Multicasting
Conceptual: Validating Aspect Usage


IValidableAnnotation Methods

The IValidableAnnotation type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeValidate | Method invoked at build time to ensure that the aspect has been applied to the right target.
Top
See Also

Reference

IValidableAnnotation Interface
PostSharp.Extensibility Namespace


IValidableAnnotation.CompileTimeValidate Method

IValidableAnnotationCompileTimeValidate Method

Method invoked at build time to ensure that the aspect has been applied to the right target.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
bool CompileTimeValidate(
    Object target
)

Parameters

target
Type: SystemObject
Target element.

Return Value

Type: Boolean
true if the aspect was applied to an acceptable target, otherwise false.
Remarks
The implementation of this method is expected to emit an error message or an exception of type InvalidAnnotationException in case of error. Only returning false causes the aspect to be silently ignored.
See Also

Reference

IValidableAnnotation Interface
PostSharp.Extensibility Namespace


IWeavingSymbolsService Interface

Service that allows build-time code to push annotations (both programmatic and user-visible) to PostSharp Tools for Visual Studio.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IWeavingSymbolsService : IService

The IWeavingSymbolsService type exposes the following members.

Methods
 | Name | Description
Public method | PushAnnotation | Pushes an annotation to PostSharp Tools for Visual Studio.
Top
See Also

Reference

PostSharp.Extensibility Namespace

Other Resources

Conceptual: Pushing Information to PostSharp Tools Programmatically


IWeavingSymbolsService Methods

The IWeavingSymbolsService type exposes the following members.

Methods
 | Name | Description
Public method | PushAnnotation | Pushes an annotation to PostSharp Tools for Visual Studio.
Top
See Also

Reference

IWeavingSymbolsService Interface
PostSharp.Extensibility Namespace


IWeavingSymbolsService.PushAnnotation Method

IWeavingSymbolsServicePushAnnotation Method

Pushes an annotation to PostSharp Tools for Visual Studio.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void PushAnnotation(
    Object targetDeclaration,
    Type annotationClass = null,
    string arguments = null,
    string description = null,
    int linesOfCodeAvoided = 0
)

Parameters

targetDeclaration
Type: SystemObject
The declaration to which the annotation relate.
annotationClass (Optional)
Type: SystemType
The type of the annotation.
arguments (Optional)
Type: SystemString
Arguments of the annotation.
description (Optional)
Type: SystemString
A human-readable description of the annotation.
linesOfCodeAvoided (Optional)
Type: SystemInt32
A number incrementing the number of lines of code saved on targetDeclaration.
See Also

Reference

IWeavingSymbolsService Interface
PostSharp.Extensibility Namespace


Message Class

Encapsulates a message (error, warning, info, ...).
Inheritance Hierarchy
SystemObject
PostSharp.ExtensibilityMessage

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public sealed class Message

The Message type exposes the following members.

Constructors
 | Name | Description
Public method | Message(MessageLocation, SeverityType, String, String, String, String, Exception) | Initializes a new Message and specifies all its properties.
Public method | Message(SeverityType, String, String, String, String, String, Int32, Int32, Exception) | Initializes a new Message and specifies all its properties.
Public method | Message(SeverityType, String, String, String, String, String, Int32, Int32, Int32, Int32, Exception) | Initializes a new Message and specifies all its properties.
Top
Properties
 | Name | Description
Public property | HelpLink | Gets the help link.
Public property | InnerException | Gets the
Public property | Location | Location of the source code artifact causing the message.
Public property | MessageId | Gets the message type identifier.
Public property | MessageText | Gets the message formatted text.
Public property | Severity | Gets the message severity.
Public property | Source | Gets or sets the name of the source component.
Top
Methods
Name | Description
GetExceptionStackMessage | Returns a string composed of the messages of all inner exceptions.
Write(Message) | Writes a message by providing a Message object.
Write(MessageLocation, SeverityType, String, String) | Writes a message.
Write(Assembly, SeverityType, String, String, Object) | Writes a message.
Write(MemberInfo, SeverityType, String, String, Object) | Writes a message.
Write(ParameterInfo, SeverityType, String, String, Object) | Writes a message.
Write(Type, SeverityType, String, String, Object) | Writes a message.
Write(LocationInfo, SeverityType, String, String, Object) | Writes a message.
Write(MessageLocation, SeverityType, String, String, Object) | Writes a message.
Top
Fields
Name | Description
NotAvailable | When set to the locationLine or locationColumn constructor parameter or the [!:LocationStartColumn], [!:LocationEndColumn], [!:LocationStartLine], [!:LocationEndLine], means that the value of this property is unknown.
Top
See Also

Reference

PostSharp.Extensibility Namespace

Other Resources

Conceptual: Emitting Errors, Warnings, and Messages
Conceptual: Validating Aspect Usage


Message Constructor

Overload List
 | Name | Description
Public method | Message(MessageLocation, SeverityType, String, String, String, String, Exception) | Initializes a new Message and specifies all its properties.
Public method | Message(SeverityType, String, String, String, String, String, Int32, Int32, Exception) | Initializes a new Message and specifies all its properties.
Public method | Message(SeverityType, String, String, String, String, String, Int32, Int32, Int32, Int32, Exception) | Initializes a new Message and specifies all its properties.
Top
See Also

Reference

Message Class
PostSharp.Extensibility Namespace


Message Constructor (MessageLocation, SeverityType, String, String, String, String, Exception)

Initializes a new Message and specifies all its properties.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Message(
    MessageLocation location,
    SeverityType severity,
    string messageId,
    string messageText,
    string helpLink,
    string source,
    Exception innerException
)

Parameters

location
Type: PostSharp.ExtensibilityMessageLocation
Element of code (Assembly, Type, MethodInfo, ConstructorInfo, PropertyInfo, EventInfo or ParameterInfo) to which the message applies. When called from PostSharp.Sdk, the parameter can also contain a MetadataDeclaration.
severity
Type: PostSharp.ExtensibilitySeverityType
Message severity (fatal error, error, info, debug).
messageId
Type: SystemString
Identifier of the message type.
messageText
Type: SystemString
Fully formatted message text.
helpLink
Type: SystemString
Link to the help file page associated to this message.
source
Type: SystemString
Name of the component emitting the message.
innerException
Type: SystemException
The Exception that caused this message, or null if this message was not caused by an exception.
See Also

Reference

Message Class
Message Overload
PostSharp.Extensibility Namespace


Message Constructor (SeverityType, String, String, String, String, String, Int32, Int32, Exception)

Initializes a new Message and specifies all its properties.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Message(
    SeverityType severity,
    string messageId,
    string messageText,
    string helpLink,
    string source,
    string locationFile,
    int locationLine,
    int locationColumn,
    Exception innerException
)

Parameters

severity
Type: PostSharp.ExtensibilitySeverityType
Message severity (fatal error, error, info, debug).
messageId
Type: SystemString
Identifier of the message type.
messageText
Type: SystemString
Fully formatted message text.
helpLink
Type: SystemString
Link to the help file page associated to this message.
source
Type: SystemString
Name of the component emitting the message.
locationFile
Type: SystemString
File that caused the error, or null if the file is unknown or does not apply.
locationLine
Type: SystemInt32
Position (line) in the file that caused the error, or NotAvailable if the line is unknown or does not apply.
locationColumn
Type: SystemInt32
Position (column) in the file that caused the error, or NotAvailable if the line is unknown or does not apply.
innerException
Type: SystemException
The Exception that caused this message, or null if this message was not caused by an exception.
See Also

Reference

Message Class
Message Overload
PostSharp.Extensibility Namespace


Message Constructor (SeverityType, String, String, String, String, String, Int32, Int32, Int32, Int32, Exception)

Initializes a new Message and specifies all its properties.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Message(
    SeverityType severity,
    string messageId,
    string messageText,
    string helpLink,
    string source,
    string locationFile,
    int locationStartLine,
    int locationStartColumn,
    int locationEndLine,
    int locationEndColumn,
    Exception innerException
)

Parameters

severity
Type: PostSharp.ExtensibilitySeverityType
Message severity (fatal error, error, info, debug).
messageId
Type: SystemString
Identifier of the message type.
messageText
Type: SystemString
Fully formatted message text.
helpLink
Type: SystemString
Link to the help file page associated to this message.
source
Type: SystemString
Name of the component emitting the message.
locationFile
Type: SystemString
File that caused the error, or null if the file is unknown or does not apply.
locationStartLine
Type: SystemInt32
Start position (line) in the file that caused the error, or NotAvailable if the line is unknown or does not apply.
locationStartColumn
Type: SystemInt32
Start position (column) in the file that caused the error, or NotAvailable if the line is unknown or does not apply.
locationEndLine
Type: SystemInt32
End position (line) in the file that caused the error, or NotAvailable if the line is unknown or does not apply.
locationEndColumn
Type: SystemInt32
End position (column) in the file that caused the error, or NotAvailable if the line is unknown or does not apply.
innerException
Type: SystemException
The Exception that caused this message, or null if this message was not caused by an exception.
See Also

Reference

Message Class
Message Overload
PostSharp.Extensibility Namespace


Message Properties

The Message type exposes the following members.

Properties
 | Name | Description
Public property | HelpLink | Gets the help link.
Public property | InnerException | Gets the
Public property | Location | Location of the source code artifact causing the message.
Public property | MessageId | Gets the message type identifier.
Public property | MessageText | Gets the message formatted text.
Public property | Severity | Gets the message severity.
Public property | Source | Gets or sets the name of the source component.
Top
See Also

Reference

Message Class
PostSharp.Extensibility Namespace


Message.HelpLink Property

MessageHelpLink Property

Gets the help link.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string HelpLink { get; }

Property Value

Type: String
See Also

Reference

Message Class
PostSharp.Extensibility Namespace


Message.InnerException Property

MessageInnerException Property

Gets the

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Exception InnerException { get; }

Property Value

Type: Exception
See Also

Reference

Message Class
PostSharp.Extensibility Namespace


Message.Location Property

MessageLocation Property

Location of the source code artifact causing the message.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MessageLocation Location { get; set; }

Property Value

Type: MessageLocation
See Also

Reference

Message Class
PostSharp.Extensibility Namespace


Message.MessageId Property

MessageMessageId Property

Gets the message type identifier.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string MessageId { get; }

Property Value

Type: String
See Also

Reference

Message Class
PostSharp.Extensibility Namespace


Message.MessageText Property

MessageMessageText Property

Gets the message formatted text.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string MessageText { get; }

Property Value

Type: String
See Also

Reference

Message Class
PostSharp.Extensibility Namespace


Message.Severity Property

MessageSeverity Property

Gets the message severity.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SeverityType Severity { get; }

Property Value

Type: SeverityType
See Also

Reference

Message Class
PostSharp.Extensibility Namespace


Message.Source Property

MessageSource Property

Gets or sets the name of the source component.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string Source { get; }

Property Value

Type: String
See Also

Reference

Message Class
PostSharp.Extensibility Namespace


Message Methods

The Message type exposes the following members.

Methods
Name | Description
GetExceptionStackMessage | Returns a string composed of the messages of all inner exceptions.
Write(Message) | Writes a message by providing a Message object.
Write(MessageLocation, SeverityType, String, String) | Writes a message.
Write(Assembly, SeverityType, String, String, Object) | Writes a message.
Write(MemberInfo, SeverityType, String, String, Object) | Writes a message.
Write(ParameterInfo, SeverityType, String, String, Object) | Writes a message.
Write(Type, SeverityType, String, String, Object) | Writes a message.
Write(LocationInfo, SeverityType, String, String, Object) | Writes a message.
Write(MessageLocation, SeverityType, String, String, Object) | Writes a message.
Top
See Also

Reference

Message Class
PostSharp.Extensibility Namespace


Message.GetExceptionStackMessage Method

MessageGetExceptionStackMessage Method

Returns a string composed of the messages of all inner exceptions.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static string GetExceptionStackMessage(
    Exception outerException
)

Parameters

outerException
Type: SystemException
The outer exception.

Return Value

Type: String
A string composed of the messages of all outerException and all inner exceptions, concatenated by the string -->.
See Also

Reference

Message Class
PostSharp.Extensibility Namespace


Message.Write Method

MessageWrite Method

Overload List
Name | Description
Write(Message) | Writes a message by providing a Message object.
Write(MessageLocation, SeverityType, String, String) | Writes a message.
Write(Assembly, SeverityType, String, String, Object) | Writes a message.
Write(MemberInfo, SeverityType, String, String, Object) | Writes a message.
Write(ParameterInfo, SeverityType, String, String, Object) | Writes a message.
Write(Type, SeverityType, String, String, Object) | Writes a message.
Write(LocationInfo, SeverityType, String, String, Object) | Writes a message.
Write(MessageLocation, SeverityType, String, String, Object) | Writes a message.
Top
See Also

Reference

Message Class
PostSharp.Extensibility Namespace


Message.Write Method (Message)

MessageWrite Method (Message)

Writes a message by providing a Message object.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void Write(
    Message message
)

Parameters

message
Type: PostSharp.ExtensibilityMessage
A Message.
See Also

Reference

Message Class
Write Overload
PostSharp.Extensibility Namespace


Message.Write Method (MessageLocation, SeverityType, String, String)

MessageWrite Method (MessageLocation, SeverityType, String, String)

Writes a message.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void Write(
    MessageLocation messageLocation,
    SeverityType severity,
    string errorCode,
    string message
)

Parameters

messageLocation
Type: PostSharp.ExtensibilityMessageLocation
Element of code (Assembly, Type, MethodInfo, ConstructorInfo, PropertyInfo, EventInfo or ParameterInfo) to which the message applies. When called from PostSharp.Sdk, the parameter can also contain a MetadataDeclaration.
severity
Type: PostSharp.ExtensibilitySeverityType
Severity.
errorCode
Type: SystemString
Error code.
message
Type: SystemString
Error message.
See Also

Reference

Message Class
Write Overload
PostSharp.Extensibility Namespace


Message.Write Method (Assembly, SeverityType, String, String, Object[])

MessageWrite Method (Assembly, SeverityType, String, String, Object)

Writes a message.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void Write(
    Assembly codeElement,
    SeverityType severity,
    string errorCode,
    string format,
    params Object[] arguments
)

Parameters

codeElement
Type: System.ReflectionAssembly
Element of code to which the message applies.
severity
Type: PostSharp.ExtensibilitySeverityType
Severity.
errorCode
Type: SystemString
Error code.
format
Type: SystemString
Error message formatting string.
arguments
Type: SystemObject
Formatting string arguments.
See Also

Reference

Message Class
Write Overload
PostSharp.Extensibility Namespace


Message.Write Method (MemberInfo, SeverityType, String, String, Object[])

MessageWrite Method (MemberInfo, SeverityType, String, String, Object)

Writes a message.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void Write(
    MemberInfo codeElement,
    SeverityType severity,
    string errorCode,
    string format,
    params Object[] arguments
)

Parameters

codeElement
Type: System.ReflectionMemberInfo
Element of code to which the message applies.
severity
Type: PostSharp.ExtensibilitySeverityType
Severity.
errorCode
Type: SystemString
Error code.
format
Type: SystemString
Error message formatting string.
arguments
Type: SystemObject
Formatting string arguments.
See Also

Reference

Message Class
Write Overload
PostSharp.Extensibility Namespace


Message.Write Method (ParameterInfo, SeverityType, String, String, Object[])

MessageWrite Method (ParameterInfo, SeverityType, String, String, Object)

Writes a message.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void Write(
    ParameterInfo codeElement,
    SeverityType severity,
    string errorCode,
    string format,
    params Object[] arguments
)

Parameters

codeElement
Type: System.ReflectionParameterInfo
Element of code to which the message applies.
severity
Type: PostSharp.ExtensibilitySeverityType
Severity.
errorCode
Type: SystemString
Error code.
format
Type: SystemString
Error message formatting string.
arguments
Type: SystemObject
Formatting string arguments.
See Also

Reference

Message Class
Write Overload
PostSharp.Extensibility Namespace


Message.Write Method (Type, SeverityType, String, String, Object[])

MessageWrite Method (Type, SeverityType, String, String, Object)

Writes a message.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void Write(
    Type type,
    SeverityType severity,
    string errorCode,
    string format,
    params Object[] arguments
)

Parameters

type
Type: SystemType
Element of code to which the message applies.
severity
Type: PostSharp.ExtensibilitySeverityType
Severity.
errorCode
Type: SystemString
Error code.
format
Type: SystemString
Error message formatting string.
arguments
Type: SystemObject
Formatting string arguments.
See Also

Reference

Message Class
Write Overload
PostSharp.Extensibility Namespace


Message.Write Method (LocationInfo, SeverityType, String, String, Object[])

MessageWrite Method (LocationInfo, SeverityType, String, String, Object)

Writes a message.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void Write(
    LocationInfo codeElement,
    SeverityType severity,
    string errorCode,
    string format,
    params Object[] arguments
)

Parameters

codeElement
Type: PostSharp.ReflectionLocationInfo
Element of code to which the message applies.
severity
Type: PostSharp.ExtensibilitySeverityType
Severity.
errorCode
Type: SystemString
Error code.
format
Type: SystemString
Error message formatting string.
arguments
Type: SystemObject
Formatting string arguments.
See Also

Reference

Message Class
Write Overload
PostSharp.Extensibility Namespace


Message.Write Method (MessageLocation, SeverityType, String, String, Object[])

MessageWrite Method (MessageLocation, SeverityType, String, String, Object)

Writes a message.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void Write(
    MessageLocation messageLocation,
    SeverityType severity,
    string errorCode,
    string format,
    params Object[] arguments
)

Parameters

messageLocation
Type: PostSharp.ExtensibilityMessageLocation
Element of code (Assembly, Type, MethodInfo, ConstructorInfo, PropertyInfo, EventInfo or ParameterInfo) to which the message applies. When called from PostSharp.Sdk, the parameter can also contain a MetadataDeclaration.
severity
Type: PostSharp.ExtensibilitySeverityType
Severity.
errorCode
Type: SystemString
Error code.
format
Type: SystemString
Error message formatting string.
arguments
Type: SystemObject
Formatting string arguments.
See Also

Reference

Message Class
Write Overload
PostSharp.Extensibility Namespace


Message Fields

The Message type exposes the following members.

Fields
Name | Description
NotAvailable | When set to the locationLine or locationColumn constructor parameter or the [!:LocationStartColumn], [!:LocationEndColumn], [!:LocationStartLine], [!:LocationEndLine], means that the value of this property is unknown.
Top
See Also

Reference

Message Class
PostSharp.Extensibility Namespace


Message.NotAvailable Field

MessageNotAvailable Field

When set to the locationLine or locationColumn constructor parameter or the [!:LocationStartColumn], [!:LocationEndColumn], [!:LocationStartLine], [!:LocationEndLine], means that the value of this property is unknown.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const int NotAvailable = 0

Field Value

Type: Int32
See Also

Reference

Message Class
PostSharp.Extensibility Namespace


MessageDispenser Class

Provides a base implementation of IMessageDispenser where the message key is supposed to be in format PRE0000, where PRE is a prefix and 0000 is an integer. Keys for help URLs have the format PRE0000?.
Inheritance Hierarchy
SystemObject
PostSharp.ExtensibilityMessageDispenser

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class MessageDispenser : IMessageDispenser

The MessageDispenser type exposes the following members.

Constructors
 | Name | Description
Protected method | MessageDispenser | Initializes a new MessageDispenser.
Top
Properties
 | Name | Description
Public property | Prefix | Gets the message prefix.
Top
Methods
 | Name | Description
Protected method | GetHelpUrl | Gets the message help URL of a given number.
Protected method | GetMessage(Int32) | Gets the message text of a given number.
Public method | GetMessage(String) | Gets a message text given a message key.
Top
See Also

Reference

PostSharp.Extensibility Namespace

Other Resources

Conceptual: Emitting Errors, Warnings, and Messages


MessageDispenser Constructor

Initializes a new MessageDispenser.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected MessageDispenser(
    string prefix
)

Parameters

prefix
Type: SystemString
Prefix of all messages provided by the new dispenser.
See Also

Reference

MessageDispenser Class
PostSharp.Extensibility Namespace


MessageDispenser Properties

The MessageDispenser type exposes the following members.

Properties
 | Name | Description
Public property | Prefix | Gets the message prefix.
Top
See Also

Reference

MessageDispenser Class
PostSharp.Extensibility Namespace


MessageDispenser.Prefix Property

MessageDispenserPrefix Property

Gets the message prefix.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string Prefix { get; }

Property Value

Type: String
See Also

Reference

MessageDispenser Class
PostSharp.Extensibility Namespace


MessageDispenser Methods

The MessageDispenser type exposes the following members.

Methods
 | Name | Description
Protected method | GetHelpUrl | Gets the message help URL of a given number.
Protected method | GetMessage(Int32) | Gets the message text of a given number.
Public method | GetMessage(String) | Gets a message text given a message key.
Top
See Also

Reference

MessageDispenser Class
PostSharp.Extensibility Namespace


MessageDispenser.GetHelpUrl Method

MessageDispenserGetHelpUrl Method

Gets the message help URL of a given number.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual string GetHelpUrl(
    int number
)

Parameters

number
Type: SystemInt32
Message number.

Return Value

Type: String
The message help URL corresponding to number.
See Also

Reference

MessageDispenser Class
PostSharp.Extensibility Namespace


MessageDispenser.GetMessage Method

MessageDispenserGetMessage Method

Overload List
 | Name | Description
Protected method | GetMessage(Int32) | Gets the message text of a given number.
Public method | GetMessage(String) | Gets a message text given a message key.
Top
See Also

Reference

MessageDispenser Class
PostSharp.Extensibility Namespace


MessageDispenser.GetMessage Method (Int32)

MessageDispenserGetMessage Method (Int32)

Gets the message text of a given number.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected abstract string GetMessage(
    int number
)

Parameters

number
Type: SystemInt32
Message number.

Return Value

Type: String
The message text corresponding to number.
See Also

Reference

MessageDispenser Class
GetMessage Overload
PostSharp.Extensibility Namespace


MessageDispenser.GetMessage Method (String)

MessageDispenserGetMessage Method (String)

Gets a message text given a message key.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string GetMessage(
    string key
)

Parameters

key
Type: SystemString
Message key.

Return Value

Type: String
The text corresponding to key.

Implements

IMessageDispenserGetMessage(String)
See Also

Reference

MessageDispenser Class
GetMessage Overload
PostSharp.Extensibility Namespace

Other Resources

Conceptual: Validating Aspect Usage


MessageException Class

Exception embedding a Message.
Inheritance Hierarchy
SystemObject
SystemException
PostSharp.ExtensibilityMessageException

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public sealed class MessageException : Exception

The MessageException type exposes the following members.

Constructors
 | Name | Description
Public method | MessageException | Initializes a new MessageException from an existing Message.
Top
Properties
 | Name | Description
Public property | MessageObject | Gets the Message em
Top
Methods
 | Name | Description
Public method | GetObjectData | Serializes the current object. (Overrides ExceptionGetObjectData(SerializationInfo, StreamingContext).)
Top
See Also

Reference

PostSharp.Extensibility Namespace


MessageException Constructor

Initializes a new MessageException from an existing Message.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MessageException(
    Message message
)

Parameters

message
Type: PostSharp.ExtensibilityMessage
A Message.
See Also

Reference

MessageException Class
PostSharp.Extensibility Namespace


MessageException Properties

The MessageException type exposes the following members.

Properties
 | Name | Description
Public property | MessageObject | Gets the Message em
Top
See Also

Reference

MessageException Class
PostSharp.Extensibility Namespace


MessageException.MessageObject Property

MessageExceptionMessageObject Property

Gets the Message em

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Message MessageObject { get; }

Property Value

Type: Message
See Also

Reference

MessageException Class
PostSharp.Extensibility Namespace


MessageException Methods

The MessageException type exposes the following members.

Methods
 | Name | Description
Public method | GetObjectData | Serializes the current object. (Overrides ExceptionGetObjectData(SerializationInfo, StreamingContext).)
Top
See Also

Reference

MessageException Class
PostSharp.Extensibility Namespace


MessageException.GetObjectData Method

MessageExceptionGetObjectData Method

Serializes the current object.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void GetObjectData(
    SerializationInfo info,
    StreamingContext context
)

Parameters

info
Type: System.Runtime.SerializationSerializationInfo
Serialization information.
context
Type: System.Runtime.SerializationStreamingContext
Serialization context.

Implements

ISerializableGetObjectData(SerializationInfo, StreamingContext)
_ExceptionGetObjectData(SerializationInfo, StreamingContext)
See Also

Reference

MessageException Class
PostSharp.Extensibility Namespace


MessageLocation Class

Represents the location of a message, which means, for the end-user, a line in a file of source code. From the aspect developer, the location can be known as an object representing an element of code (for instance a Type or MethodInfo). Such implicit locations are resolved by PostSharp to a file and line number.
Inheritance Hierarchy
SystemObject
PostSharp.ExtensibilityMessageLocation

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public class MessageLocation

The MessageLocation type exposes the following members.

Properties
 | Name | Description
Public property | CodeElement | Element of code (reflection object or Declaration) from which the location must be resolved.
Public property | EndColumn | Gets the ending column in the file that caused the message.
Public property | EndLine | Gets the ending line in the file that caused the message.
Public property | File | Gets the name of the file that caused the message.
Public property | StartColumn | Gets the starting column in the file that caused the message.
Public property | StartLine | Gets the starting line in the file that caused the message.
Top
Methods
Name | Description
Explicit(String) | Builds a MessageLocation explicitly by specifying a filename, when the
Explicit(String, Int32, Int32) | Builds a MessageLocation explicitly by specifying a filename, line, and column.
Explicit(String, Int32, Int32, Int32, Int32) | Builds a MessageLocation explicitly by specifying a filename, line, and column.
Of(Object) | Builds a MessageLocation from an object representing an element of code (Type, MethodInfo, ConstructorInfo, FieldInfo, IExpression, Assembly, ParameterInfo, EventInfo, PropertyInfo or, if you are using PostSharp SDK, any Declaration).
Of(Assembly) | Builds a MessageLocation from an Assembly.
Of(MemberInfo) | Builds a MessageLocation from a MemberInfo (Type, MethodInfo, ConstructorInfo, FieldInfo, PropertyInfo, EventInfo).
Of(ParameterInfo) | Builds a MessageLocation from a ParameterInfo.
Of(IExpression) | Builds a MessageLocation from an IExpression.
Of(LocationInfo) | Builds a MessageLocation from a LocationInfo.
Of(SymbolSequencePoint) | Builds a MessageLocation from a SymbolSequencePoint.
Top
Fields
Name | Description
Unknown | Represents an unknown or indeterminate location of the error message.
Top
See Also

Reference

PostSharp.Extensibility Namespace


MessageLocation Properties

The MessageLocation type exposes the following members.

Properties
 | Name | Description
Public property | CodeElement | Element of code (reflection object or Declaration) from which the location must be resolved.
Public property | EndColumn | Gets the ending column in the file that caused the message.
Public property | EndLine | Gets the ending line in the file that caused the message.
Public property | File | Gets the name of the file that caused the message.
Public property | StartColumn | Gets the starting column in the file that caused the message.
Public property | StartLine | Gets the starting line in the file that caused the message.
Top
See Also

Reference

MessageLocation Class
PostSharp.Extensibility Namespace


MessageLocation.CodeElement Property

MessageLocationCodeElement Property

Element of code (reflection object or Declaration) from which the location must be resolved.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Object CodeElement { get; }

Property Value

Type: Object
See Also

Reference

MessageLocation Class
PostSharp.Extensibility Namespace


MessageLocation.EndColumn Property

MessageLocationEndColumn Property

Gets the ending column in the file that caused the message.
An integer greater or equal to 1, or 0 if the column is unknown or does not apply.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int EndColumn { get; }

Property Value

Type: Int32
See Also

Reference

MessageLocation Class
PostSharp.Extensibility Namespace


MessageLocation.EndLine Property

MessageLocationEndLine Property

Gets the ending line in the file that caused the message.
An integer greater or equal to 1, or 0 if the line is unknown or does not apply.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int EndLine { get; }

Property Value

Type: Int32
See Also

Reference

MessageLocation Class
PostSharp.Extensibility Namespace


MessageLocation.File Property

MessageLocationFile Property

Gets the name of the file that caused the message.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string File { get; }

Property Value

Type: String
A full file name, or null if the file name is unknown or not applicable.
See Also

Reference

MessageLocation Class
PostSharp.Extensibility Namespace


MessageLocation.StartColumn Property

MessageLocationStartColumn Property

Gets the starting column in the file that caused the message.
An integer greater or equal to 1, or 0 if the column is unknown or does not apply.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int StartColumn { get; }

Property Value

Type: Int32
See Also

Reference

MessageLocation Class
PostSharp.Extensibility Namespace


MessageLocation.StartLine Property

MessageLocationStartLine Property

Gets the starting line in the file that caused the message.
An integer greater or equal to 1, or 0 if the line is unknown or does not apply.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int StartLine { get; }

Property Value

Type: Int32
See Also

Reference

MessageLocation Class
PostSharp.Extensibility Namespace


MessageLocation Methods

Methods
Name | Description
Explicit(String) | Builds a MessageLocation explicitly by specifying a filename, when the
Explicit(String, Int32, Int32) | Builds a MessageLocation explicitly by specifying a filename, line, and column.
Explicit(String, Int32, Int32, Int32, Int32) | Builds a MessageLocation explicitly by specifying a filename, line, and column.
Of(Object) | Builds a MessageLocation from an object representing an element of code (Type, MethodInfo, ConstructorInfo, FieldInfo, IExpression, Assembly, ParameterInfo, EventInfo, PropertyInfo or, if you are using PostSharp SDK, any Declaration).
Of(Assembly) | Builds a MessageLocation from an Assembly.
Of(MemberInfo) | Builds a MessageLocation from a MemberInfo (Type, MethodInfo, ConstructorInfo, FieldInfo, PropertyInfo, EventInfo).
Of(ParameterInfo) | Builds a MessageLocation from a ParameterInfo.
Of(IExpression) | Builds a MessageLocation from an IExpression.
Of(LocationInfo) | Builds a MessageLocation from a LocationInfo.
Of(SymbolSequencePoint) | Builds a MessageLocation from a SymbolSequencePoint.
Top
See Also

Reference

MessageLocation Class
PostSharp.Extensibility Namespace


MessageLocation.Explicit Method

MessageLocationExplicit Method

Overload List
Name | Description
Explicit(String) | Builds a MessageLocation explicitly by specifying a filename, when the
Explicit(String, Int32, Int32) | Builds a MessageLocation explicitly by specifying a filename, line, and column.
Explicit(String, Int32, Int32, Int32, Int32) | Builds a MessageLocation explicitly by specifying a filename, line, and column.
Top
See Also

Reference

MessageLocation Class
PostSharp.Extensibility Namespace


MessageLocation.Explicit Method (String)

MessageLocationExplicit Method (String)

Builds a MessageLocation explicitly by specifying a filename, when the

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static MessageLocation Explicit(
    string file
)

Parameters

file
Type: SystemString
File name.

Return Value

Type: MessageLocation
A MessageLocation.
See Also

Reference

MessageLocation Class
Explicit Overload
PostSharp.Extensibility Namespace


MessageLocation.Explicit Method (String, Int32, Int32)

MessageLocationExplicit Method (String, Int32, Int32)

Builds a MessageLocation explicitly by specifying a filename, line, and column.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static MessageLocation Explicit(
    string file,
    int line,
    int column
)

Parameters

file
Type: SystemString
File name.
line
Type: SystemInt32
Line number.
column
Type: SystemInt32
Column number.

Return Value

Type: MessageLocation
A MessageLocation.
See Also

Reference

MessageLocation Class
Explicit Overload
PostSharp.Extensibility Namespace


MessageLocation.Explicit Method (String, Int32, Int32, Int32, Int32)

MessageLocationExplicit Method (String, Int32, Int32, Int32, Int32)

Builds a MessageLocation explicitly by specifying a filename, line, and column.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static MessageLocation Explicit(
    string file,
    int lineStart,
    int columnStart,
    int lineEnd,
    int columnEnd
)

Parameters

file
Type: SystemString
File name.
lineStart
Type: SystemInt32
Starting line number.
columnStart
Type: SystemInt32
Starting column number.
lineEnd
Type: SystemInt32
Ending line number.
columnEnd
Type: SystemInt32
Ending column number.

Return Value

Type: MessageLocation
A MessageLocation.
See Also

Reference

MessageLocation Class
Explicit Overload
PostSharp.Extensibility Namespace


MessageLocation.Of Method

MessageLocationOf Method

Overload List
Name | Description
Of(Object) | Builds a MessageLocation from an object representing an element of code (Type, MethodInfo, ConstructorInfo, FieldInfo, IExpression, Assembly, ParameterInfo, EventInfo, PropertyInfo or, if you are using PostSharp SDK, any Declaration).
Of(Assembly) | Builds a MessageLocation from an Assembly.
Of(MemberInfo) | Builds a MessageLocation from a MemberInfo (Type, MethodInfo, ConstructorInfo, FieldInfo, PropertyInfo, EventInfo).
Of(ParameterInfo) | Builds a MessageLocation from a ParameterInfo.
Of(IExpression) | Builds a MessageLocation from an IExpression.
Of(LocationInfo) | Builds a MessageLocation from a LocationInfo.
Of(SymbolSequencePoint) | Builds a MessageLocation from a SymbolSequencePoint.
Top
See Also

Reference

MessageLocation Class
PostSharp.Extensibility Namespace


MessageLocation.Of Method (Object)

MessageLocationOf Method (Object)

Builds a MessageLocation from an object representing an element of code (Type, MethodInfo, ConstructorInfo, FieldInfo, IExpression, Assembly, ParameterInfo, EventInfo, PropertyInfo or, if you are using PostSharp SDK, any Declaration).

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static MessageLocation Of(
    Object codeElement
)

Parameters

codeElement
Type: SystemObject
an object representing an element of code (Type, MethodInfo, ConstructorInfo, FieldInfo, Assembly, ParameterInfo, EventInfo, PropertyInfo, IExpression or, if you are using PostSharp SDK, any Declaration.

Return Value

Type: MessageLocation
A MessageLocation representing codeElement.
Remarks

If codeElement is null or cannot mapped to a location of code, this method silently returns Unknown.

See Also

Reference

MessageLocation Class
Of Overload
PostSharp.Extensibility Namespace


MessageLocation.Of Method (Assembly)

MessageLocationOf Method (Assembly)

Builds a MessageLocation from an Assembly.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static MessageLocation Of(
    Assembly assembly
)

Parameters

assembly
Type: System.ReflectionAssembly
An Assembly (Assembly or its wrapper).

Return Value

Type: MessageLocation
A MessageLocation.
See Also

Reference

MessageLocation Class
Of Overload
PostSharp.Extensibility Namespace


MessageLocation.Of Method (MemberInfo)

MessageLocationOf Method (MemberInfo)

Builds a MessageLocation from a MemberInfo (Type, MethodInfo, ConstructorInfo, FieldInfo, PropertyInfo, EventInfo).

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static MessageLocation Of(
    MemberInfo member
)

Parameters

member
Type: System.ReflectionMemberInfo
An element of code (Type, MethodInfo, ConstructorInfo, FieldInfo, PropertyInfo, EventInfo).

Return Value

Type: MessageLocation
A MessageLocation.
See Also

Reference

MessageLocation Class
Of Overload
PostSharp.Extensibility Namespace


MessageLocation.Of Method (ParameterInfo)

MessageLocationOf Method (ParameterInfo)

Builds a MessageLocation from a ParameterInfo.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static MessageLocation Of(
    ParameterInfo parameter
)

Parameters

parameter
Type: System.ReflectionParameterInfo
A ParameterInfo.

Return Value

Type: MessageLocation
A MessageLocation.
See Also

Reference

MessageLocation Class
Of Overload
PostSharp.Extensibility Namespace


MessageLocation.Of Method (IExpression)

MessageLocationOf Method (IExpression)

Builds a MessageLocation from an IExpression.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static MessageLocation Of(
    IExpression expression
)

Parameters

expression
Type: PostSharp.Reflection.MethodBodyIExpression
An IExpression.

Return Value

Type: MessageLocation
A MessageLocation.
See Also

Reference

MessageLocation Class
Of Overload
PostSharp.Extensibility Namespace


MessageLocation.Of Method (LocationInfo)

MessageLocationOf Method (LocationInfo)

Builds a MessageLocation from a LocationInfo.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static MessageLocation Of(
    LocationInfo location
)

Parameters

location
Type: PostSharp.ReflectionLocationInfo
A LocationInfo.

Return Value

Type: MessageLocation
A MessageLocation.
See Also

Reference

MessageLocation Class
Of Overload
PostSharp.Extensibility Namespace


MessageLocation.Of Method (SymbolSequencePoint)

MessageLocationOf Method (SymbolSequencePoint)

Builds a MessageLocation from a SymbolSequencePoint.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static MessageLocation Of(
    SymbolSequencePoint symbolSequencePoint
)

Parameters

symbolSequencePoint
Type: PostSharp.ReflectionSymbolSequencePoint
A SymbolSequencePoint.

Return Value

Type: MessageLocation
A MessageLocation corresponding to symbolSequencePoint.
See Also

Reference

MessageLocation Class
Of Overload
PostSharp.Extensibility Namespace


MessageLocation Fields

The MessageLocation type exposes the following members.

Fields
Name | Description
Unknown | Represents an unknown or indeterminate location of the error message.
Top
See Also

Reference

MessageLocation Class
PostSharp.Extensibility Namespace


MessageLocation.Unknown Field

MessageLocationUnknown Field

Represents an unknown or indeterminate location of the error message.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static readonly MessageLocation Unknown

Field Value

Type: MessageLocation
See Also

Reference

MessageLocation Class
PostSharp.Extensibility Namespace


MessageSource Class

Provides commodity methods to work with an IMessageSink.
Inheritance Hierarchy
SystemObject
SystemMarshalByRefObject
PostSharp.ExtensibilityMessageSource

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class MessageSource : MarshalByRefObject,
    IMessageSink

The MessageSource type exposes the following members.

Constructors
 | Name | Description
Public method | MessageSource(String, IMessageDispenser) | Initializes a new MessageSource backed by a IMessageDispenser.
Public method | MessageSource(String, ResourceManager) | Instantiates a MessageSource backed by a ResourceManager.
Top
Properties
Name | Description
MessageSink | Gets the current message sink.
Top
Methods
 | Name | Description
Public method | CreateMessage | Creates a Message from the current MessageSource.
Public method | Write(Message) | Writes a message to the sink.
Public method | Write(Assembly, SeverityType, String, Object) | Emits a Message.
Public method | Write(MemberInfo, SeverityType, String, Object) | Emits a Message.
Public method | Write(ParameterInfo, SeverityType, String, Object) | Emits a Message.
Public method | Write(MessageLocation, SeverityType, String, Object) | Emits a Message.
Public method | Write(MessageLocation, SeverityType, String, Exception, Object) | Emits a Message and specifies an inner Exception.
Top
See Also

Reference

PostSharp.Extensibility Namespace

Other Resources

Conceptual: Emitting Errors, Warnings, and Messages
Conceptual: Validating Aspect Usage


MessageSource Constructor

Overload List
 | Name | Description
Public method | MessageSource(String, IMessageDispenser) | Initializes a new MessageSource backed by a IMessageDispenser.
Public method | MessageSource(String, ResourceManager) | Instantiates a MessageSource backed by a ResourceManager.
Top
See Also

Reference

MessageSource Class
PostSharp.Extensibility Namespace


MessageSource Constructor (String, IMessageDispenser)

Initializes a new MessageSource backed by a IMessageDispenser.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MessageSource(
    string source,
    IMessageDispenser messageDispenser
)

Parameters

source
Type: SystemString
Name of the component emitting. the messages.
messageDispenser
Type: PostSharp.ExtensibilityIMessageDispenser
The IMessageDispenser that will be used to retrieve message texts.
See Also

Reference

MessageSource Class
MessageSource Overload
PostSharp.Extensibility Namespace


MessageSource Constructor (String, ResourceManager)

Instantiates a MessageSource backed by a ResourceManager.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MessageSource(
    string source,
    ResourceManager resourceManager
)

Parameters

source
Type: SystemString
Source name.
resourceManager
Type: System.ResourcesResourceManager
The ResourceManager.
See Also

Reference

MessageSource Class
MessageSource Overload
PostSharp.Extensibility Namespace


MessageSource Properties

The MessageSource type exposes the following members.

Properties
Name | Description
MessageSink | Gets the current message sink.
Top
See Also

Reference

MessageSource Class
PostSharp.Extensibility Namespace


MessageSource.MessageSink Property

MessageSourceMessageSink Property

Gets the current message sink.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static IMessageSink MessageSink { get; }

Property Value

Type: IMessageSink
See Also

Reference

MessageSource Class
PostSharp.Extensibility Namespace


MessageSource Methods

The MessageSource type exposes the following members.

Methods
 | Name | Description
Public method | CreateMessage | Creates a Message from the current MessageSource.
Public method | Write(Message) | Writes a message to the sink.
Public method | Write(Assembly, SeverityType, String, Object) | Emits a Message.
Public method | Write(MemberInfo, SeverityType, String, Object) | Emits a Message.
Public method | Write(ParameterInfo, SeverityType, String, Object) | Emits a Message.
Public method | Write(MessageLocation, SeverityType, String, Object) | Emits a Message.
Public method | Write(MessageLocation, SeverityType, String, Exception, Object) | Emits a Message and specifies an inner Exception.
Top
See Also

Reference

MessageSource Class
PostSharp.Extensibility Namespace


MessageSource.CreateMessage Method

MessageSourceCreateMessage Method

Creates a Message from the current MessageSource.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Message CreateMessage(
    MessageLocation location,
    SeverityType severity,
    string messageId,
    Exception innerException,
    params Object[] arguments
)

Parameters

location
Type: PostSharp.ExtensibilityMessageLocation
Location of the source code artifact causing the message.
severity
Type: PostSharp.ExtensibilitySeverityType
Severity.
messageId
Type: SystemString
Message identifier (resolved by the current MessageSource).
innerException
Type: SystemException
Exception causing the message, or null.
arguments
Type: SystemObject
Arguments of the message text.

Return Value

Type: Message
A Message.
See Also

Reference

MessageSource Class
PostSharp.Extensibility Namespace


MessageSource.Write Method

MessageSourceWrite Method

Overload List
 | Name | Description
Public method | Write(Message) | Writes a message to the sink.
Public method | Write(Assembly, SeverityType, String, Object) | Emits a Message.
Public method | Write(MemberInfo, SeverityType, String, Object) | Emits a Message.
Public method | Write(ParameterInfo, SeverityType, String, Object) | Emits a Message.
Public method | Write(MessageLocation, SeverityType, String, Object) | Emits a Message.
Public method | Write(MessageLocation, SeverityType, String, Exception, Object) | Emits a Message and specifies an inner Exception.
Top
See Also

Reference

MessageSource Class
PostSharp.Extensibility Namespace


MessageSource.Write Method (Message)

MessageSourceWrite Method (Message)

Writes a message to the sink.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Write(
    Message message
)

Parameters

message
Type: PostSharp.ExtensibilityMessage
A message.

Implements

IMessageSinkWrite(Message)
See Also

Reference

MessageSource Class
Write Overload
PostSharp.Extensibility Namespace


MessageSource.Write Method (Assembly, SeverityType, String, Object[])

MessageSourceWrite Method (Assembly, SeverityType, String, Object)

Emits a Message.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Write(
    Assembly codeElement,
    SeverityType severity,
    string messageId,
    params Object[] arguments
)

Parameters

codeElement
Type: System.ReflectionAssembly
Source code artifact that caused the message.
severity
Type: PostSharp.ExtensibilitySeverityType
Message severity (fatal error, error, info, debug).
messageId
Type: SystemString
Identifier of the message type.
arguments
Type: SystemObject
Array of arguments used to format the message text, or null if this message has no argument.
See Also

Reference

MessageSource Class
Write Overload
PostSharp.Extensibility Namespace


MessageSource.Write Method (MemberInfo, SeverityType, String, Object[])

MessageSourceWrite Method (MemberInfo, SeverityType, String, Object)

Emits a Message.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Write(
    MemberInfo codeElement,
    SeverityType severity,
    string messageId,
    params Object[] arguments
)

Parameters

codeElement
Type: System.ReflectionMemberInfo
Source code artifact (Type, MethodInfo, ConstructorInfo, FieldInfo, EventInfo, PropertyInfo) that caused the message.
severity
Type: PostSharp.ExtensibilitySeverityType
Message severity (fatal error, error, info, debug).
messageId
Type: SystemString
Identifier of the message type.
arguments
Type: SystemObject
Array of arguments used to format the message text, or null if this message has no argument.
See Also

Reference

MessageSource Class
Write Overload
PostSharp.Extensibility Namespace


MessageSource.Write Method (ParameterInfo, SeverityType, String, Object[])

MessageSourceWrite Method (ParameterInfo, SeverityType, String, Object)

Emits a Message.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Write(
    ParameterInfo codeElement,
    SeverityType severity,
    string messageId,
    params Object[] arguments
)

Parameters

codeElement
Type: System.ReflectionParameterInfo
Source code artifact that caused the message.
severity
Type: PostSharp.ExtensibilitySeverityType
Message severity (fatal error, error, info, debug).
messageId
Type: SystemString
Identifier of the message type.
arguments
Type: SystemObject
Array of arguments used to format the message text, or null if this message has no argument.
See Also

Reference

MessageSource Class
Write Overload
PostSharp.Extensibility Namespace


MessageSource.Write Method (MessageLocation, SeverityType, String, Object[])

MessageSourceWrite Method (MessageLocation, SeverityType, String, Object)

Emits a Message.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Write(
    MessageLocation location,
    SeverityType severity,
    string messageId,
    params Object[] arguments
)

Parameters

location
Type: PostSharp.ExtensibilityMessageLocation
Location of the source code artifact that caused the message.
severity
Type: PostSharp.ExtensibilitySeverityType
Message severity (fatal error, error, info, debug).
messageId
Type: SystemString
Identifier of the message type.
arguments
Type: SystemObject
Array of arguments used to format the message text, or null if this message has no argument.
See Also

Reference

MessageSource Class
Write Overload
PostSharp.Extensibility Namespace


MessageSource.Write Method (MessageLocation, SeverityType, String, Exception, Object[])

MessageSourceWrite Method (MessageLocation, SeverityType, String, Exception, Object)

Emits a Message and specifies an inner Exception.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Write(
    MessageLocation location,
    SeverityType severity,
    string messageId,
    Exception innerException,
    params Object[] arguments
)

Parameters

location
Type: PostSharp.ExtensibilityMessageLocation
Location of the source code artifact that caused the message.
severity
Type: PostSharp.ExtensibilitySeverityType
Message severity (fatal error, error, info, debug).
messageId
Type: SystemString
Identifier of the message type.
innerException
Type: SystemException
The Exception that caused this message, or null if this message was not caused by an exception.
arguments
Type: SystemObject
Array of arguments used to format the message text, or null if this message has no argument.
See Also

Reference

MessageSource Class
Write Overload
PostSharp.Extensibility Namespace


MetricAttribute Class

Custom attribute that, when applied on an aspect, causes the aspect to increment some metric at build time.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMetricAttribute

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class MetricAttribute : Attribute

The MetricAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | MetricAttribute | Initializes a new MetricAttribute.
Top
Properties
 | Name | Description
Public property | AllowImplementationMetrics | Determines whether the usage of features used by the target aspects must be instrumented.
Public property | MetricName | Gets the name of the metric.
Public property | Operand | Gets the operand of the metric.
Top
Remarks
These metrics are used by PostSharp to collect usage information and are transferred to the makers of PostSharp only if you opted in for the Customer Experience Improvement Program.
See Also

Reference

PostSharp.Extensibility Namespace


MetricAttribute Constructor

Initializes a new MetricAttribute.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MetricAttribute(
    string metricName,
    Object operand
)

Parameters

metricName
Type: SystemString
Metric name.
operand
Type: SystemObject
Metric operand.
See Also

Reference

MetricAttribute Class
PostSharp.Extensibility Namespace


MetricAttribute Properties

The MetricAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AllowImplementationMetrics | Determines whether the usage of features used by the target aspects must be instrumented.
Public property | MetricName | Gets the name of the metric.
Public property | Operand | Gets the operand of the metric.
Top
See Also

Reference

MetricAttribute Class
PostSharp.Extensibility Namespace


MetricAttribute.AllowImplementationMetrics Property

MetricAttributeAllowImplementationMetrics Property

Determines whether the usage of features used by the target aspects must be instrumented.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool AllowImplementationMetrics { get; set; }

Property Value

Type: Boolean
See Also

Reference

MetricAttribute Class
PostSharp.Extensibility Namespace


MetricAttribute.MetricName Property

MetricAttributeMetricName Property

Gets the name of the metric.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string MetricName { get; }

Property Value

Type: String
See Also

Reference

MetricAttribute Class
PostSharp.Extensibility Namespace


MetricAttribute.Operand Property

MetricAttributeOperand Property

Gets the operand of the metric.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Object Operand { get; }

Property Value

Type: Object
See Also

Reference

MetricAttribute Class
PostSharp.Extensibility Namespace


MulticastAttribute Class

Custom attribute that can be applied to multiple elements using wildcards.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
More...

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public abstract class MulticastAttribute : Attribute

The MulticastAttribute type exposes the following members.

Constructors
 | Name | Description
Protected method | MulticastAttribute | Initializes a new instance of the MulticastAttribute class
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance.
Public property | AttributeInheritance | Determines whether this attribute is inherited
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before).
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations.
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply.
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies.
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module.
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module.
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies.
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies.
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies.
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies.
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies.
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies.
Top
Remarks

Each class derived from MulticastAttribute should be decorated with an instance of MulticastAttributeUsageAttribute.

Multicasting is performed by the MulticastAttributeTask, which should be included in the project. After multicasting, custom attribute instances are available on the CustomAttributeDictionaryTask class.

See Also

Reference

PostSharp.Extensibility Namespace

Other Resources

Conceptual: Adding Aspects Declaratively Using Attributes
Conceptual: Adding Aspects to Derived Classes and Methods Using Attributes
Conceptual: Adding Aspects to Multiple Declarations Using Attributes
Conceptual: Adding Aspects Using XML
Conceptual: Adding Behaviors to Existing Members
Conceptual: Coping with Several Aspects on the Same Target
Conceptual: Including CLR Objects in Configuration
Conceptual: Overriding and Removing Aspect Instances
Conceptual: Testing that an Aspect has been Applied
Conceptual: Understanding Aspect Inheritance
Conceptual: Understanding Aspect Lifetime and Scope
Conceptual: Understanding Attribute Multicasting
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.ConstraintsConstraint
PostSharp.Patterns.ContractsLocationContractAttribute
PostSharp.Patterns.ModelPureAttribute
PostSharp.Patterns.RecordingRecordingScopeAttribute
PostSharp.Patterns.ThreadingAccessLevelAttribute
PostSharp.Patterns.ThreadingEntryPointAttribute
PostSharp.Patterns.ThreadingExplicitlySynchronizedAttribute
PostSharp.Patterns.ThreadingReentrantAttribute
PostSharp.SerializationPSerializableAttribute


MulticastAttribute Constructor

Initializes a new instance of the MulticastAttribute class

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected MulticastAttribute()
See Also

Reference

MulticastAttribute Class
PostSharp.Extensibility Namespace


MulticastAttribute Properties

The MulticastAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance.
Public property | AttributeInheritance | Determines whether this attribute is inherited
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before).
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations.
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply.
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies.
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module.
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module.
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies.
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies.
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies.
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies.
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies.
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies.
Top
See Also

Reference

MulticastAttribute Class
PostSharp.Extensibility Namespace


MulticastAttribute.AttributeExclude Property

MulticastAttributeAttributeExclude Property

If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool AttributeExclude { get; set; }

Property Value

Type: Boolean
See Also

Reference

MulticastAttribute Class
PostSharp.Extensibility Namespace

Other Resources

Conceptual: Adding Aspects to Multiple Declarations Using Attributes
Conceptual: Overriding and Removing Aspect Instances


MulticastAttribute.AttributeInheritance Property

MulticastAttributeAttributeInheritance Property

Determines whether this attribute is inherited

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MulticastInheritance AttributeInheritance { get; set; }

Property Value

Type: MulticastInheritance
Remarks

If this property is not set to MulticastInheritance.None, a copy of this attribute will be propagated along the lines of inheritance of the target element:

  • On classes: all classed derived from that class.
  • On interfaces: all classes implementing this interface.
  • On virtual, abstract or interface methods: all methods overriding or implementing this method.
  • On parameters or return value of virtual, abstract or interface methods: corresponding parameter or return value on all methods or overriding or implementing the parent method of the target parameter or return value.
See Also

Reference

MulticastAttribute Class
PostSharp.Extensibility Namespace

Other Resources

Conceptual: Adding Aspects to Derived Classes and Methods Using Attributes
Conceptual: Understanding Attribute Multicasting


MulticastAttribute.AttributePriority Property

MulticastAttributeAttributePriority Property

Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before).

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int AttributePriority { get; set; }

Property Value

Type: Int32
Remarks
You should use only 16-bit values in user code. Top 16 bits are reserved for the system.
See Also

Reference

MulticastAttribute Class
PostSharp.Extensibility Namespace

Other Resources

Conceptual: Adding Aspects to Multiple Declarations Using Attributes
Conceptual: Coping with Several Aspects on the Same Target
Conceptual: Including CLR Objects in Configuration
Conceptual: Overriding and Removing Aspect Instances


MulticastAttribute.AttributeReplace Property

MulticastAttributeAttributeReplace Property

Determines whether this attribute replaces other attributes found on the target declarations.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool AttributeReplace { get; set; }

Property Value

Type: Boolean
true if the current instance will replace previous ones, or false if it will be added to previous instances.
See Also

Reference

MulticastAttribute Class
PostSharp.Extensibility Namespace

Other Resources

Conceptual: Overriding and Removing Aspect Instances


MulticastAttribute.AttributeTargetAssemblies Property

MulticastAttributeAttributeTargetAssemblies Property

Gets or sets the assemblies to which the current attribute apply.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string AttributeTargetAssemblies { get; set; }

Property Value

Type: String
Wildcard or regular expression specifying to which assemblies this instance applies, or null if this instance applies only to elements of the current assembly. Wildcard expressions should start with the regex: prefix.
Remarks
When this property is not specified or is null, the current attribute is multicasted only in the current assembly. Otherwise, it is multicasted also to external assemblies, i.e. to declarations that are referenced by the current assembly.
See Also

Reference

MulticastAttribute Class
PostSharp.Extensibility Namespace

Other Resources

Conceptual: Understanding Attribute Multicasting


MulticastAttribute.AttributeTargetElements Property

MulticastAttributeAttributeTargetElements Property

Gets or sets the kind of elements to which this custom attributes applies.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MulticastTargets AttributeTargetElements { get; set; }

Property Value

Type: MulticastTargets
See Also

Reference

MulticastAttribute Class
PostSharp.Extensibility Namespace

Other Resources

Conceptual: Understanding Attribute Multicasting


MulticastAttribute.AttributeTargetExternalMemberAttributes Property

MulticastAttributeAttributeTargetExternalMemberAttributes Property

Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MulticastAttributes AttributeTargetExternalMemberAttributes { get; set; }

Property Value

Type: MulticastAttributes
Remarks

Ignored if the AttributeTargetElements are only the module, the assembly, and/or types.

The MulticastAttributes enumeration is a multi-part flag: there is one part for visibility, one for scope, one for virtuality, and one for implementation. If you specify one part, it will override the values defined on the custom attribute definition. If you do not specify it, the values defined on the custom attribute definition will be inherited. Note that custom attributes may apply restrictions on these attributes. For instance, a custom attribute may not be valid on abstract methods. You are obviously not allowed to 'enlarge' the set of possible targets.

See Also

Reference

MulticastAttribute Class
PostSharp.Extensibility Namespace


MulticastAttribute.AttributeTargetExternalTypeAttributes Property

MulticastAttributeAttributeTargetExternalTypeAttributes Property

Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MulticastAttributes AttributeTargetExternalTypeAttributes { get; set; }

Property Value

Type: MulticastAttributes
Remarks
On type-level, the only meaningful enumeration values are related to visibility.
See Also

Reference

MulticastAttribute Class
PostSharp.Extensibility Namespace


MulticastAttribute.AttributeTargetMemberAttributes Property

MulticastAttributeAttributeTargetMemberAttributes Property

Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MulticastAttributes AttributeTargetMemberAttributes { get; set; }

Property Value

Type: MulticastAttributes
Remarks

Ignored if the AttributeTargetElements are only the module, the assembly, and/or types.

The MulticastAttributes enumeration is a multi-part flag: there is one part for visibility, one for scope, one for virtuality, and one for implementation. If you specify one part, it will override the values defined on the custom attribute definition. If you do not specify it, the values defined on the custom attribute definition will be inherited. Note that custom attributes may apply restrictions on these attributes. For instance, a custom attribute may not be valid on abstract methods. You are obviously not allowed to 'enlarge' the set of possible targets.

See Also

Reference

MulticastAttribute Class
PostSharp.Extensibility Namespace

Other Resources

Conceptual: Understanding Attribute Multicasting
Conceptual: Validating Aspect Usage


MulticastAttribute.AttributeTargetMembers Property

MulticastAttributeAttributeTargetMembers Property

Gets or sets the expression specifying to which members this instance applies.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string AttributeTargetMembers { get; set; }

Property Value

Type: String
A wildcard or regular expression specifying to which members this instance applies, or null this instance applies either to all members whose kind is given in AttributeTargetElements. Regular expressions should start with the regex: prefix.
Remarks

Ignored if the only AttributeTargetElements are only types.

See Also

Reference

MulticastAttribute Class
PostSharp.Extensibility Namespace

Other Resources

Conceptual: Understanding Attribute Multicasting


MulticastAttribute.AttributeTargetParameterAttributes Property

MulticastAttributeAttributeTargetParameterAttributes Property

Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MulticastAttributes AttributeTargetParameterAttributes { get; set; }

Property Value

Type: MulticastAttributes
Remarks

Ignored if the AttributeTargetElements do not include parameters.

See Also

Reference

MulticastAttribute Class
PostSharp.Extensibility Namespace

Other Resources

Conceptual: Understanding Attribute Multicasting


MulticastAttribute.AttributeTargetParameters Property

MulticastAttributeAttributeTargetParameters Property

Gets or sets the expression specifying to which parameters this instance applies.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string AttributeTargetParameters { get; set; }

Property Value

Type: String
A wildcard or regular expression specifying to which parameters this instance applies, or null this instance applies either to all members whose kind is given in AttributeTargetElements. Wildcard expressions should start with the regex: prefix.
Remarks

Ignored if the only AttributeTargetElements are only types.

See Also

Reference

MulticastAttribute Class
PostSharp.Extensibility Namespace

Other Resources

Conceptual: Understanding Attribute Multicasting


MulticastAttribute.AttributeTargetTypeAttributes Property

MulticastAttributeAttributeTargetTypeAttributes Property

Gets or sets the visibilities of types to which this attribute applies.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MulticastAttributes AttributeTargetTypeAttributes { get; set; }

Property Value

Type: MulticastAttributes
Remarks
On type-level, the only meaningful enumeration values are related to visibility.
See Also

Reference

MulticastAttribute Class
PostSharp.Extensibility Namespace

Other Resources

Conceptual: Adding Aspects to Multiple Declarations Using Attributes
Conceptual: Understanding Attribute Multicasting
Conceptual: Validating Aspect Usage


MulticastAttribute.AttributeTargetTypes Property

MulticastAttributeAttributeTargetTypes Property

Gets or sets the expression specifying to which types this instance applies.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string AttributeTargetTypes { get; set; }

Property Value

Type: String
A wildcard or regular expression specifying to which types this instance applies, or null this instance applies either to all types. Regular expressions should start with the regex: prefix.
Remarks

Ignored if the AttributeTargetElements are only the module and/or the assembly.

Nested types are delimited by a plus sign (+) in place of a dot (.).

See Also

Reference

MulticastAttribute Class
PostSharp.Extensibility Namespace

Other Resources

Conceptual: Adding Aspects to Multiple Declarations Using Attributes
Conceptual: Understanding Attribute Multicasting


MulticastAttributes Enumeration

Attributes of elements to which multicast custom attributes (MulticastAttribute) apply.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[FlagsAttribute]
public enum MulticastAttributes
Members
Member name | Value | Description
Default | 0 | Specifies that the set of target attributes is inherited from the parent custom attribute.
Private | 2 | Private (visible inside the current type).
Protected | 4 | Protected (visible inside derived types).
Internal | 8 | Internal (visible inside the current assembly).
InternalAndProtected | 16 | Internal and protected (visible inside derived types that are defined in the current assembly).
InternalOrProtected | 32 | Internal or protected (visible inside all derived types and in the current assembly).
Public | 64 | Public (visible everywhere).
AnyVisibility | 126 | Any visibility.
Static | 128 | Static scope.
Instance | 256 | Instance scope.
AnyScope | 384 | Any scope (Static | Instance).
Abstract | 512 | Abstract methods.
NonAbstract | 1024 | Concrete (non-abstract) methods.
AnyAbstraction | 1536 | Any abstraction (Abstract | NonAbstract).
Virtual | 2048 | Virtual methods.
NonVirtual | 4096 | Non-virtual methods.
AnyVirtuality | 6144 | Any virtuality (Virtual | NonVirtual).
Managed | 8192 | Managed code implementation.
NonManaged | 16384 | Non-managed code implementation (external or system).
AnyImplementation | 24576 | Any implementation (Managed | NonManaged).
Literal | 32768 | Literal fields.
NonLiteral | 65536 | Non-literal fields.
AnyLiterality | 98304 | Any field literality (Literal | NonLiteral).
InParameter | 131072 | Input parameters.
CompilerGenerated | 262144 | Compiler-generated code.
UserGenerated | 524288 | User-generated code (anything expected CompilerGenerated).
AnyGeneration | 786432 | Any code generation (CompilerGenerated | UserGenerated)l
OutParameter | 1048576 | Output (out in C#) parameters.
RefParameter | 2097152 | Input/Output (ref in C#) parameters.
AnyParameter | 3276800 | Any kind of parameter passing (InParameter | OutParameter | RefParameter).
All | 4194302 | All members.
Remarks
When specifying attributes of target members or types, do not forget to provide all categories of flags, not only the category on which you want to put a restriction. If you want to limit, for instance, a custom attribute to be applied on public members, a good practice is to set TargetMemberAttributes = MulticastAttributes.Public | ~MulticastAttributes.AnyVisibility, unless the parent is more restrictive, in which case you should specify attributes explicitly.
See Also

Reference

PostSharp.Extensibility Namespace


MulticastAttributeUsageAttribute Class

Custom attribute that determines the usage of a MulticastAttribute.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttributeUsageAttribute

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class MulticastAttributeUsageAttribute : Attribute

The MulticastAttributeUsageAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | MulticastAttributeUsageAttribute | Initializes a new MulticastAttributeUsageAttribute.
Public method | MulticastAttributeUsageAttribute(MulticastTargets) | Initializes a new MulticastAttributeUsageAttribute.
Top
Properties
 | Name | Description
Public property | AllowExternalAssemblies | Determines whether this attribute can be applied to declaration of external assemblies (i.e. to other assemblies than the one in which the custom attribute is instantiated).
Public property | AllowMultiple | Determines whether many instances of the custom attribute are allowed on a single declaration.
Public property | Inheritance | Determines whether the custom attribute in inherited along the lines of inheritance of the target element.
Public property | PersistMetaData | Determines whether the custom attribute should be persisted in metadata, so that it would be available for System.Reflection.
Public property | TargetExternalMemberAttributes | Gets or sets the attributes of the members (fields or methods) to which the custom attribute can be applied, when the members are external to the current module.
Public property | TargetExternalTypeAttributes | Gets or sets the attributes of the types to which the custom attribute can be applied, when the type is external to the current module. If the custom attribute relates to fields or methods, this property specifies which attributes of the declaring type are acceptable.
Public property | TargetMemberAttributes | Gets or sets the attributes of the members (fields or methods) to which the custom attribute can be applied.
Public property | TargetParameterAttributes | Gets or sets the attributes of the parameter to which the custom attribute can be applied.
Public property | TargetTypeAttributes | Gets or sets the attributes of the types to which the custom attribute can be applied. If the custom attribute relates to fields or methods, this property specifies which attributes of the declaring type are acceptable.
Public property | ValidOn | Gets the kinds of targets that instances of the related MulticastAttribute apply to.
Top
See Also

Reference

PostSharp.Extensibility Namespace

Other Resources

Conceptual: Adding Aspects Declaratively Using Attributes
Conceptual: Adding Aspects to Derived Classes and Methods Using Attributes
Conceptual: Developing Custom Architectural Constraints
Conceptual: Overriding and Removing Aspect Instances
Conceptual: Understanding Aspect Inheritance
Conceptual: Understanding Attribute Multicasting
Conceptual: Validating Aspect Usage


MulticastAttributeUsageAttribute Constructor

Overload List
 | Name | Description
Public method | MulticastAttributeUsageAttribute | Initializes a new MulticastAttributeUsageAttribute.
Public method | MulticastAttributeUsageAttribute(MulticastTargets) | Initializes a new MulticastAttributeUsageAttribute.
Top
See Also

Reference

MulticastAttributeUsageAttribute Class
PostSharp.Extensibility Namespace


MulticastAttributeUsageAttribute Constructor

Initializes a new MulticastAttributeUsageAttribute.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MulticastAttributeUsageAttribute()
See Also

Reference

MulticastAttributeUsageAttribute Class
MulticastAttributeUsageAttribute Overload
PostSharp.Extensibility Namespace


MulticastAttributeUsageAttribute Constructor (MulticastTargets)

Initializes a new MulticastAttributeUsageAttribute.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MulticastAttributeUsageAttribute(
    MulticastTargets validOn
)

Parameters

validOn
Type: PostSharp.ExtensibilityMulticastTargets
Kinds of targets that instances of the related MulticastAttribute apply to.
See Also

Reference

MulticastAttributeUsageAttribute Class
MulticastAttributeUsageAttribute Overload
PostSharp.Extensibility Namespace


MulticastAttributeUsageAttribute Properties

The MulticastAttributeUsageAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AllowExternalAssemblies | Determines whether this attribute can be applied to declaration of external assemblies (i.e. to other assemblies than the one in which the custom attribute is instantiated).
Public property | AllowMultiple | Determines whether many instances of the custom attribute are allowed on a single declaration.
Public property | Inheritance | Determines whether the custom attribute in inherited along the lines of inheritance of the target element.
Public property | PersistMetaData | Determines whether the custom attribute should be persisted in metadata, so that it would be available for System.Reflection.
Public property | TargetExternalMemberAttributes | Gets or sets the attributes of the members (fields or methods) to which the custom attribute can be applied, when the members are external to the current module.
Public property | TargetExternalTypeAttributes | Gets or sets the attributes of the types to which the custom attribute can be applied, when the type is external to the current module. If the custom attribute relates to fields or methods, this property specifies which attributes of the declaring type are acceptable.
Public property | TargetMemberAttributes | Gets or sets the attributes of the members (fields or methods) to which the custom attribute can be applied.
Public property | TargetParameterAttributes | Gets or sets the attributes of the parameter to which the custom attribute can be applied.
Public property | TargetTypeAttributes | Gets or sets the attributes of the types to which the custom attribute can be applied. If the custom attribute relates to fields or methods, this property specifies which attributes of the declaring type are acceptable.
Public property | ValidOn | Gets the kinds of targets that instances of the related MulticastAttribute apply to.
Top
See Also

Reference

MulticastAttributeUsageAttribute Class
PostSharp.Extensibility Namespace


MulticastAttributeUsageAttribute.AllowExternalAssemblies Property

MulticastAttributeUsageAttributeAllowExternalAssemblies Property

Determines whether this attribute can be applied to declaration of external assemblies (i.e. to other assemblies than the one in which the custom attribute is instantiated).

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool AllowExternalAssemblies { get; set; }

Property Value

Type: Boolean
See Also

Reference

MulticastAttributeUsageAttribute Class
PostSharp.Extensibility Namespace

Other Resources

Conceptual: Understanding Attribute Multicasting


MulticastAttributeUsageAttribute.AllowMultiple Property

MulticastAttributeUsageAttributeAllowMultiple Property

Determines whether many instances of the custom attribute are allowed on a single declaration.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool AllowMultiple { get; set; }

Property Value

Type: Boolean
See Also

Reference

MulticastAttributeUsageAttribute Class
PostSharp.Extensibility Namespace

Other Resources

Conceptual: Overriding and Removing Aspect Instances


MulticastAttributeUsageAttribute.Inheritance Property

MulticastAttributeUsageAttributeInheritance Property

Determines whether the custom attribute in inherited along the lines of inheritance of the target element.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MulticastInheritance Inheritance { get; set; }

Property Value

Type: MulticastInheritance
See Also

Reference

MulticastAttributeUsageAttribute Class
PostSharp.Extensibility Namespace
MulticastAttributeAttributeInheritance

Other Resources

Conceptual: Adding Aspects to Derived Classes and Methods Using Attributes
Conceptual: Understanding Attribute Multicasting


MulticastAttributeUsageAttribute.PersistMetaData Property

MulticastAttributeUsageAttributePersistMetaData Property

Determines whether the custom attribute should be persisted in metadata, so that it would be available for System.Reflection.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool PersistMetaData { get; set; }

Property Value

Type: Boolean
See Also

Reference

MulticastAttributeUsageAttribute Class
PostSharp.Extensibility Namespace

Other Resources

Conceptual: Adding Aspects to Multiple Declarations Using Attributes
Conceptual: Reflecting Aspect Instances at Runtime


MulticastAttributeUsageAttribute.TargetExternalMemberAttributes Property

MulticastAttributeUsageAttributeTargetExternalMemberAttributes Property

Gets or sets the attributes of the members (fields or methods) to which the custom attribute can be applied, when the members are external to the current module.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MulticastAttributes TargetExternalMemberAttributes { get; set; }

Property Value

Type: MulticastAttributes
See Also

Reference

MulticastAttributeUsageAttribute Class
PostSharp.Extensibility Namespace


MulticastAttributeUsageAttribute.TargetExternalTypeAttributes Property

MulticastAttributeUsageAttributeTargetExternalTypeAttributes Property

Gets or sets the attributes of the types to which the custom attribute can be applied, when the type is external to the current module. If the custom attribute relates to fields or methods, this property specifies which attributes of the declaring type are acceptable.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MulticastAttributes TargetExternalTypeAttributes { get; set; }

Property Value

Type: MulticastAttributes
See Also

Reference

MulticastAttributeUsageAttribute Class
PostSharp.Extensibility Namespace


MulticastAttributeUsageAttribute.TargetMemberAttributes Property

MulticastAttributeUsageAttributeTargetMemberAttributes Property

Gets or sets the attributes of the members (fields or methods) to which the custom attribute can be applied.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MulticastAttributes TargetMemberAttributes { get; set; }

Property Value

Type: MulticastAttributes
See Also

Reference

MulticastAttributeUsageAttribute Class
PostSharp.Extensibility Namespace

Other Resources

Conceptual: Understanding Attribute Multicasting


MulticastAttributeUsageAttribute.TargetParameterAttributes Property

MulticastAttributeUsageAttributeTargetParameterAttributes Property

Gets or sets the attributes of the parameter to which the custom attribute can be applied.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MulticastAttributes TargetParameterAttributes { get; set; }

Property Value

Type: MulticastAttributes
See Also

Reference

MulticastAttributeUsageAttribute Class
PostSharp.Extensibility Namespace

Other Resources

Conceptual: Understanding Attribute Multicasting


MulticastAttributeUsageAttribute.TargetTypeAttributes Property

MulticastAttributeUsageAttributeTargetTypeAttributes Property

Gets or sets the attributes of the types to which the custom attribute can be applied. If the custom attribute relates to fields or methods, this property specifies which attributes of the declaring type are acceptable.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MulticastAttributes TargetTypeAttributes { get; set; }

Property Value

Type: MulticastAttributes
See Also

Reference

MulticastAttributeUsageAttribute Class
PostSharp.Extensibility Namespace

Other Resources

Conceptual: Understanding Attribute Multicasting


MulticastAttributeUsageAttribute.ValidOn Property

MulticastAttributeUsageAttributeValidOn Property

Gets the kinds of targets that instances of the related MulticastAttribute apply to.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MulticastTargets ValidOn { get; }

Property Value

Type: MulticastTargets
See Also

Reference

MulticastAttributeUsageAttribute Class
PostSharp.Extensibility Namespace

Other Resources

Conceptual: Understanding Attribute Multicasting


MulticastInheritance Enumeration

Kind of inheritance of MulticastAttribute.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum MulticastInheritance
Members
Member name | Value | Description
None | 0 | No inheritance.
Strict | 1 | The instance is inherited to children of the original element, but multicasting is not applied to members of children.
Multicast | 2 | The instance is inherited to children of the original element and multicasting is applied to members of children.
See Also

Reference

PostSharp.Extensibility Namespace


MulticastTargets Enumeration

Kinds of targets to which multicast custom attributes (MulticastAttribute) can apply.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[FlagsAttribute]
public enum MulticastTargets
Members
Member name | Value | Description
Default | 0 | Specifies that the set of target elements is inherited from the parent custom attribute.
Class | 1 | Class.
Struct | 2 | Structure.
Enum | 4 | Enumeration.
Delegate | 8 | Delegate.
Interface | 16 | Interface.
AnyType | 31 | Any type (Class, Struct, Enum, Delegate or Interface).
Field | 32 | Field.
Method | 64 | Method (but not constructor).
InstanceConstructor | 128 | Instance constructor.
StaticConstructor | 256 | Static constructor.
Property | 512 | Property (but not methods inside the property).
Event | 1024 | Event (but not methods inside the event).
AnyMember | 2016 | Any member (Field, Method, InstanceConstructor, StaticConstructor, Property, Event).
Assembly | 2048 | Assembly.
Parameter | 4096 | Method or property parameter.
ReturnValue | 8192 | Method or property return value.
All | 16383 | All element kinds.
See Also

Reference

PostSharp.Extensibility Namespace


PostSharpEnvironment Class

Provides access to the current PostSharp environment (IPostSharpEnvironment).
Inheritance Hierarchy
SystemObject
PostSharp.ExtensibilityPostSharpEnvironment

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static class PostSharpEnvironment

The PostSharpEnvironment type exposes the following members.

Properties
Name | Description
Current | Gets the current PostSharp environment, or null if the PostSharp Platform is not loaded in the current context.
CurrentProject | Gets the current PostSharp project.
IsPostSharpRunning | Determines whether the PostSharp Platform is currently loaded.
Top
See Also

Reference

PostSharp.Extensibility Namespace


PostSharpEnvironment Properties

The PostSharpEnvironment type exposes the following members.

Properties
Name | Description
Current | Gets the current PostSharp environment, or null if the PostSharp Platform is not loaded in the current context.
CurrentProject | Gets the current PostSharp project.
IsPostSharpRunning | Determines whether the PostSharp Platform is currently loaded.
Top
See Also

Reference

PostSharpEnvironment Class
PostSharp.Extensibility Namespace


PostSharpEnvironment.Current Property

PostSharpEnvironmentCurrent Property

Gets the current PostSharp environment, or null if the PostSharp Platform is not loaded in the current context.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static IPostSharpEnvironment Current { get; }

Property Value

Type: IPostSharpEnvironment
See Also

Reference

PostSharpEnvironment Class
PostSharp.Extensibility Namespace


PostSharpEnvironment.CurrentProject Property

PostSharpEnvironmentCurrentProject Property

Gets the current PostSharp project.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static IProject CurrentProject { get; }

Property Value

Type: IProject
See Also

Reference

PostSharpEnvironment Class
PostSharp.Extensibility Namespace

Other Resources

Conceptual: Accessing Configuration from Source Code


PostSharpEnvironment.IsPostSharpRunning Property

PostSharpEnvironmentIsPostSharpRunning Property

Determines whether the PostSharp Platform is currently loaded.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool IsPostSharpRunning { get; }

Property Value

Type: Boolean
See Also

Reference

PostSharpEnvironment Class
PostSharp.Extensibility Namespace


ProjectExtensionElement Class

Represents a custom element (or section) in the XML project type.
Inheritance Hierarchy
SystemObject
PostSharp.ExtensibilityProjectExtensionElement

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ProjectExtensionElement

The ProjectExtensionElement type exposes the following members.

Properties
 | Name | Description
Public property | Name | Gets the local name of the custom element.
Public property | Namespace | Gets the XML namespace of the custom element.
Public property | XElement | Gets the XElement materializing the project extension.
Top
See Also

Reference

PostSharp.Extensibility Namespace


ProjectExtensionElement Properties

The ProjectExtensionElement type exposes the following members.

Properties
 | Name | Description
Public property | Name | Gets the local name of the custom element.
Public property | Namespace | Gets the XML namespace of the custom element.
Public property | XElement | Gets the XElement materializing the project extension.
Top
See Also

Reference

ProjectExtensionElement Class
PostSharp.Extensibility Namespace


ProjectExtensionElement.Name Property

ProjectExtensionElementName Property

Gets the local name of the custom element.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string Name { get; }

Property Value

Type: String
See Also

Reference

ProjectExtensionElement Class
PostSharp.Extensibility Namespace


ProjectExtensionElement.Namespace Property

ProjectExtensionElementNamespace Property

Gets the XML namespace of the custom element.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string Namespace { get; }

Property Value

Type: String
See Also

Reference

ProjectExtensionElement Class
PostSharp.Extensibility Namespace


ProjectExtensionElement.XElement Property

ProjectExtensionElementXElement Property

Gets the XElement materializing the project extension.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Object XElement { get; }

Property Value

Type: Object
See Also

Reference

ProjectExtensionElement Class
PostSharp.Extensibility Namespace


RequirePostSharpAttribute Class

Custom attribute that, when applied on another custom attribute (a class derived from Attribute), means that assemblies with elements annotated with that custom attribute should be processed by PostSharp.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityRequirePostSharpAttribute

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class RequirePostSharpAttribute : Attribute

The RequirePostSharpAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | RequirePostSharpAttribute(Type) | Initializes a new RequirePostSharpAttribute and specifies the required IService type.
Public method | RequirePostSharpAttribute(String, String) | Initializes a new RequirePostSharpAttribute and specifies the required plug-in and task names.
Top
Properties
 | Name | Description
Public property | AnyTypeReference | Determines whether the current attribute applies to any project that has any reference of the target type. If false, the requirement will apply only to assemblies that use the target type as a custom attribute. If true, the requirement will apply to any assembly that references the target type. The default value is false.
Public property | AssemblyReferenceOnly | Determines whether the requirement should apply only to assemblies referencing the declaration to which the custom attribute is applied. If true, the requirement will not apply to the assembly where the custom attribute is used.
Public property | PlugIn | Gets the name of the required plug-in (file name without the extension).
Public property | ServiceType | Gets the type of the required IService.
Public property | Task | Gets the name of the required task (should be defined in PlugIn).
Top
See Also

Reference

PostSharp.Extensibility Namespace


RequirePostSharpAttribute Constructor

Overload List
 | Name | Description
Public method | RequirePostSharpAttribute(Type) | Initializes a new RequirePostSharpAttribute and specifies the required IService type.
Public method | RequirePostSharpAttribute(String, String) | Initializes a new RequirePostSharpAttribute and specifies the required plug-in and task names.
Top
See Also

Reference

RequirePostSharpAttribute Class
PostSharp.Extensibility Namespace


RequirePostSharpAttribute Constructor (Type)

Initializes a new RequirePostSharpAttribute and specifies the required IService type.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public RequirePostSharpAttribute(
    Type serviceType
)

Parameters

serviceType
Type: SystemType
A type derived from IService.
See Also

Reference

RequirePostSharpAttribute Class
RequirePostSharpAttribute Overload
PostSharp.Extensibility Namespace


RequirePostSharpAttribute Constructor (String, String)

Initializes a new RequirePostSharpAttribute and specifies the required plug-in and task names.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public RequirePostSharpAttribute(
    string plugIn,
    string task
)

Parameters

plugIn
Type: SystemString
Name of the required plug-in (file name without extension).
task
Type: SystemString
Name of the required task (should be defined in plugIn).
See Also

Reference

RequirePostSharpAttribute Class
RequirePostSharpAttribute Overload
PostSharp.Extensibility Namespace


RequirePostSharpAttribute Properties

The RequirePostSharpAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AnyTypeReference | Determines whether the current attribute applies to any project that has any reference of the target type. If false, the requirement will apply only to assemblies that use the target type as a custom attribute. If true, the requirement will apply to any assembly that references the target type. The default value is false.
Public property | AssemblyReferenceOnly | Determines whether the requirement should apply only to assemblies referencing the declaration to which the custom attribute is applied. If true, the requirement will not apply to the assembly where the custom attribute is used.
Public property | PlugIn | Gets the name of the required plug-in (file name without the extension).
Public property | ServiceType | Gets the type of the required IService.
Public property | Task | Gets the name of the required task (should be defined in PlugIn).
Top
See Also

Reference

RequirePostSharpAttribute Class
PostSharp.Extensibility Namespace


RequirePostSharpAttribute.AnyTypeReference Property

RequirePostSharpAttributeAnyTypeReference Property

Determines whether the current attribute applies to any project that has any reference of the target type. If false, the requirement will apply only to assemblies that use the target type as a custom attribute. If true, the requirement will apply to any assembly that references the target type. The default value is false.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool AnyTypeReference { get; set; }

Property Value

Type: Boolean
See Also

Reference

RequirePostSharpAttribute Class
PostSharp.Extensibility Namespace


RequirePostSharpAttribute.AssemblyReferenceOnly Property

RequirePostSharpAttributeAssemblyReferenceOnly Property

Determines whether the requirement should apply only to assemblies referencing the declaration to which the custom attribute is applied. If true, the requirement will not apply to the assembly where the custom attribute is used.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool AssemblyReferenceOnly { get; set; }

Property Value

Type: Boolean
See Also

Reference

RequirePostSharpAttribute Class
PostSharp.Extensibility Namespace


RequirePostSharpAttribute.PlugIn Property

RequirePostSharpAttributePlugIn Property

Gets the name of the required plug-in (file name without the extension).

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string PlugIn { get; }

Property Value

Type: String
See Also

Reference

RequirePostSharpAttribute Class
PostSharp.Extensibility Namespace


RequirePostSharpAttribute.ServiceType Property

RequirePostSharpAttributeServiceType Property

Gets the type of the required IService.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Type ServiceType { get; }

Property Value

Type: Type
See Also

Reference

RequirePostSharpAttribute Class
PostSharp.Extensibility Namespace


RequirePostSharpAttribute.Task Property

RequirePostSharpAttributeTask Property

Gets the name of the required task (should be defined in PlugIn).

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string Task { get; }

Property Value

Type: String
See Also

Reference

RequirePostSharpAttribute Class
PostSharp.Extensibility Namespace


SeverityType Enumeration

Types of message severities.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum SeverityType
Members
Member name | Value | Description
Debug | 0 | Debugging information (typically trace).
Verbose | 1 | Verbose (lowly important information).
Info | 2 | Information.
ImportantInfo | 3 | Important information.
CommandLine | 4 | Command line.
Warning | 5 | Warning.
Error | 6 | Error.
Fatal | 7 | Fatal error.
None | -1 | No message.
See Also

Reference

PostSharp.Extensibility Namespace

Other Resources

Conceptual: Developing Custom Architectural Constraints
Conceptual: Emitting Errors, Warnings, and Messages


SuppressAnnotationValidationAttribute Class

Instructs PostSharp that the validation of IValidableAnnotation is done by another component, and should not be processed by the default component.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilitySuppressAnnotationValidationAttribute

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class SuppressAnnotationValidationAttribute : Attribute

The SuppressAnnotationValidationAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | SuppressAnnotationValidationAttribute | Initializes a new instance of the SuppressAnnotationValidationAttribute class
Top
See Also

Reference

PostSharp.Extensibility Namespace


SuppressAnnotationValidationAttribute Constructor

Initializes a new instance of the SuppressAnnotationValidationAttribute class

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SuppressAnnotationValidationAttribute()
See Also

Reference

SuppressAnnotationValidationAttribute Class
PostSharp.Extensibility Namespace


SuppressWarningAttribute Class

Instructs PostSharp to ignore warnings and information messages. Errors cannot be ignored.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilitySuppressWarningAttribute

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class SuppressWarningAttribute : Attribute

The SuppressWarningAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | SuppressWarningAttribute | Creates a new instance of SuppressWarningAttribute.
Top
Properties
 | Name | Description
Public property | MessageId | Gets the identifier of the ignored warning.
Public property | Reason | Gets or set the reason (a human-readable text) why the warning must be ignored.
Top
Remarks
See Also

Reference

PostSharp.Extensibility Namespace

Other Resources

Conceptual: Breaking Changes in PostSharp 5.0


SuppressWarningAttribute Constructor

Creates a new instance of SuppressWarningAttribute.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SuppressWarningAttribute(
    string messageId
)

Parameters

messageId
Type: SystemString
Identifier of the ignored warning.
See Also

Reference

SuppressWarningAttribute Class
PostSharp.Extensibility Namespace


SuppressWarningAttribute Properties

The SuppressWarningAttribute type exposes the following members.

Properties
 | Name | Description
Public property | MessageId | Gets the identifier of the ignored warning.
Public property | Reason | Gets or set the reason (a human-readable text) why the warning must be ignored.
Top
See Also

Reference

SuppressWarningAttribute Class
PostSharp.Extensibility Namespace


SuppressWarningAttribute.MessageId Property

SuppressWarningAttributeMessageId Property

Gets the identifier of the ignored warning.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string MessageId { get; }

Property Value

Type: String
See Also

Reference

SuppressWarningAttribute Class
PostSharp.Extensibility Namespace


SuppressWarningAttribute.Reason Property

SuppressWarningAttributeReason Property

Gets or set the reason (a human-readable text) why the warning must be ignored.

Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string Reason { get; set; }

Property Value

Type: String
See Also

Reference

SuppressWarningAttribute Class
PostSharp.Extensibility Namespace


PostSharp.Extensibility.BuildTimeLogging Namespace

Classes
 | Class | Description
Public class | BuildTimeLogger | Allows to emit build-time log records. Use the GetInstance(String) method and then invoke WriteLine(String) or Activity(String) using the ?. operator.
Structures
 | Structure | Description
Public structure | BuildTimeLogActivity | Value returned by the Activity(String) method that should be disposed to mark the end of the activity and decrease the indentation level.


BuildTimeLogActivity Structure

Value returned by the Activity(String) method that should be disposed to mark the end of the activity and decrease the indentation level.

Namespace: PostSharp.Extensibility.BuildTimeLogging
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public struct BuildTimeLogActivity : IDisposable

The BuildTimeLogActivity type exposes the following members.

Methods
 | Name | Description
Public method | Dispose | When the current BuildTimeLogActivity has been returned by the Activity(String) method, decreases the indentation level.
Top
Remarks

Only the value returned by Activity(String) method results in the indentation level to be decreased upon when the Dispose method is invoked. Calling the Dispose method on the default instance has no effect.

See Also

Reference

PostSharp.Extensibility.BuildTimeLogging Namespace


BuildTimeLogActivity Methods

The BuildTimeLogActivity type exposes the following members.

Methods
 | Name | Description
Public method | Dispose | When the current BuildTimeLogActivity has been returned by the Activity(String) method, decreases the indentation level.
Top
See Also

Reference

BuildTimeLogActivity Structure
PostSharp.Extensibility.BuildTimeLogging Namespace


BuildTimeLogActivity.Dispose Method

BuildTimeLogActivityDispose Method

When the current BuildTimeLogActivity has been returned by the Activity(String) method, decreases the indentation level.

Namespace: PostSharp.Extensibility.BuildTimeLogging
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Dispose()

Implements

IDisposableDispose
See Also

Reference

BuildTimeLogActivity Structure
PostSharp.Extensibility.BuildTimeLogging Namespace


BuildTimeLogger Class

Allows to emit build-time log records. Use the GetInstance(String) method and then invoke WriteLine(String) or Activity(String) using the ?. operator.
Inheritance Hierarchy
SystemObject
PostSharp.Extensibility.BuildTimeLoggingBuildTimeLogger

Namespace: PostSharp.Extensibility.BuildTimeLogging
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class BuildTimeLogger

The BuildTimeLogger type exposes the following members.

Properties
Name | Description
IsInitialized |
Top
Methods
 | Name | Description
Public method | Activity(String) | Writes a preformatted message and increases the indentation level. To decrease the indentation level, dispose the BuildTimeLogActivity returned by this method.
Public method | ActivityT1(String, T1) | Writes a message given a formatting string and 1 argument, and increases the indentation level. To decrease the indentation level, dispose the BuildTimeLogActivity returned by this method.
Public method | ActivityT1, T2(String, T1, T2) | Writes a message given a formatting string and 2 arguments, and increases the indentation level. To decrease the indentation level, dispose the BuildTimeLogActivity returned by this method.
Public method | ActivityT1, T2, T3(String, T1, T2, T3) | Writes a message given a formatting string and 3 arguments, and increases the indentation level. To decrease the indentation level, dispose the BuildTimeLogActivity returned by this method.
Public method | ActivityT1, T2, T3, T4(String, T1, T2, T3, T4) | Writes a message given a formatting string and 4 arguments, and increases the indentation level. To decrease the indentation level, dispose the BuildTimeLogActivity returned by this method.
Public method | ActivityT1, T2, T3, T4, T5(String, T1, T2, T3, T4, T5) | Writes a message given a formatting string and 5 arguments, and increases the indentation level. To decrease the indentation level, dispose the BuildTimeLogActivity returned by this method.
Public method | ActivityT1, T2, T3, T4, T5, T6(String, T1, T2, T3, T4, T5, T6) | Writes a message given a formatting string and 6 arguments, and increases the indentation level. To decrease the indentation level, dispose the BuildTimeLogActivity returned by this method.
Public method | ActivityT1, T2, T3, T4, T5, T6, T7(String, T1, T2, T3, T4, T5, T6, T7) | Writes a message given a formatting string and 7 arguments, and increases the indentation level. To decrease the indentation level, dispose the BuildTimeLogActivity returned by this method.
 | GetInstance | Gets a BuildTimeLogger for a given category, or null if logging is not enabled for this category.
 | Initialize |
Public method | Write(String) | Appends a preformatted string to the next message. The message is sent and flushed when the WriteLine(String) method is invoked.
Public method | Write(String, Object) | Appends a string to the next message and formats it using a formatting string and an array of parameters. The message is sent and flushed when the WriteLine(String) method is invoked.
Public method | WriteT1(String, T1) | Appends a string to the next message and formats it using a formatting string and 1 argument. The message is sent and flushed when the WriteLine(String) method is invoked.
Public method | WriteT1, T2(String, T1, T2) | Appends a string to the next message and formats it using a formatting string and 2 arguments. The message is sent and flushed when the WriteLine(String) method is invoked.
Public method | WriteT1, T2, T3(String, T1, T2, T3) | Appends a string to the next message and formats it using a formatting string and 3 arguments. The message is sent and flushed when the WriteLine(String) method is invoked.
Public method | WriteT1, T2, T3, T4(String, T1, T2, T3, T4) | Appends a string to the next message and formats it using a formatting string and 4 arguments. The message is sent and flushed when the WriteLine(String) method is invoked.
Public method | WriteT1, T2, T3, T4, T5(String, T1, T2, T3, T4, T5) | Appends a string to the next message and formats it using a formatting string and 5 arguments. The message is sent and flushed when the WriteLine(String) method is invoked.
Public method | WriteT1, T2, T3, T4, T5, T6(String, T1, T2, T3, T4, T5, T6) | Appends a string to the next message and formats it using a formatting string and 6 arguments. The message is sent and flushed when the WriteLine(String) method is invoked.
Public method | WriteT1, T2, T3, T4, T5, T6, T7(String, T1, T2, T3, T4, T5, T6, T7) | Appends a string to the next message and formats it using a formatting string and 7 arguments. The message is sent and flushed when the WriteLine(String) method is invoked.
Public method | WriteLine(String) | Writes a preformatted log message.
Public method | WriteLine(String, Object) | Writes a log message and specifies the formatting string and an array of parameters.
Public method | WriteLineT1(String, T1) | Writes a message given a formatting string and 1 argument.
Public method | WriteLineT1, T2(String, T1, T2) | Writes a message given a formatting string and 2 arguments.
Public method | WriteLineT1, T2, T3(String, T1, T2, T3) | Writes a message given a formatting string and 3 arguments.
Public method | WriteLineT1, T2, T3, T4(String, T1, T2, T3, T4) | Writes a message given a formatting string and 4 arguments.
Public method | WriteLineT1, T2, T3, T4, T5(String, T1, T2, T3, T4, T5) | Writes a message given a formatting string and 5 arguments.
Public method | WriteLineT1, T2, T3, T4, T5, T6(String, T1, T2, T3, T4, T5, T6) | Writes a message given a formatting string and 6 arguments.
Public method | WriteLineT1, T2, T3, T4, T5, T6, T7(String, T1, T2, T3, T4, T5, T6, T7) | Writes a message given a formatting string and 7 arguments.
Top
See Also

Reference

PostSharp.Extensibility.BuildTimeLogging Namespace


BuildTimeLogger Properties

The BuildTimeLogger type exposes the following members.

Properties
Name | Description
IsInitialized |
Top
See Also

Reference

BuildTimeLogger Class
PostSharp.Extensibility.BuildTimeLogging Namespace


BuildTimeLogger.IsInitialized Property

BuildTimeLoggerIsInitialized Property

Namespace: PostSharp.Extensibility.BuildTimeLogging
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool IsInitialized { get; }

Property Value

Type: Boolean
See Also

Reference

BuildTimeLogger Class
PostSharp.Extensibility.BuildTimeLogging Namespace


BuildTimeLogger Methods

The BuildTimeLogger type exposes the following members.

Methods
 | Name | Description
Public method | Activity(String) | Writes a preformatted message and increases the indentation level. To decrease the indentation level, dispose the BuildTimeLogActivity returned by this method.
Public method | ActivityT1(String, T1) | Writes a message given a formatting string and 1 argument, and increases the indentation level. To decrease the indentation level, dispose the BuildTimeLogActivity returned by this method.
Public method | ActivityT1, T2(String, T1, T2) | Writes a message given a formatting string and 2 arguments, and increases the indentation level. To decrease the indentation level, dispose the BuildTimeLogActivity returned by this method.
Public method | ActivityT1, T2, T3(String, T1, T2, T3) | Writes a message given a formatting string and 3 arguments, and increases the indentation level. To decrease the indentation level, dispose the BuildTimeLogActivity returned by this method.
Public method | ActivityT1, T2, T3, T4(String, T1, T2, T3, T4) | Writes a message given a formatting string and 4 arguments, and increases the indentation level. To decrease the indentation level, dispose the BuildTimeLogActivity returned by this method.
Public method | ActivityT1, T2, T3, T4, T5(String, T1, T2, T3, T4, T5) | Writes a message given a formatting string and 5 arguments, and increases the indentation level. To decrease the indentation level, dispose the BuildTimeLogActivity returned by this method.
Public method | ActivityT1, T2, T3, T4, T5, T6(String, T1, T2, T3, T4, T5, T6) | Writes a message given a formatting string and 6 arguments, and increases the indentation level. To decrease the indentation level, dispose the BuildTimeLogActivity returned by this method.
Public method | ActivityT1, T2, T3, T4, T5, T6, T7(String, T1, T2, T3, T4, T5, T6, T7) | Writes a message given a formatting string and 7 arguments, and increases the indentation level. To decrease the indentation level, dispose the BuildTimeLogActivity returned by this method.
 | GetInstance | Gets a BuildTimeLogger for a given category, or null if logging is not enabled for this category.
 | Initialize |
Public method | Write(String) | Appends a preformatted string to the next message. The message is sent and flushed when the WriteLine(String) method is invoked.
Public method | Write(String, Object) | Appends a string to the next message and formats it using a formatting string and an array of parameters. The message is sent and flushed when the WriteLine(String) method is invoked.
Public method | WriteT1(String, T1) | Appends a string to the next message and formats it using a formatting string and 1 argument. The message is sent and flushed when the WriteLine(String) method is invoked.
Public method | WriteT1, T2(String, T1, T2) | Appends a string to the next message and formats it using a formatting string and 2 arguments. The message is sent and flushed when the WriteLine(String) method is invoked.
Public method | WriteT1, T2, T3(String, T1, T2, T3) | Appends a string to the next message and formats it using a formatting string and 3 arguments. The message is sent and flushed when the WriteLine(String) method is invoked.
Public method | WriteT1, T2, T3, T4(String, T1, T2, T3, T4) | Appends a string to the next message and formats it using a formatting string and 4 arguments. The message is sent and flushed when the WriteLine(String) method is invoked.
Public method | WriteT1, T2, T3, T4, T5(String, T1, T2, T3, T4, T5) | Appends a string to the next message and formats it using a formatting string and 5 arguments. The message is sent and flushed when the WriteLine(String) method is invoked.
Public method | WriteT1, T2, T3, T4, T5, T6(String, T1, T2, T3, T4, T5, T6) | Appends a string to the next message and formats it using a formatting string and 6 arguments. The message is sent and flushed when the WriteLine(String) method is invoked.
Public method | WriteT1, T2, T3, T4, T5, T6, T7(String, T1, T2, T3, T4, T5, T6, T7) | Appends a string to the next message and formats it using a formatting string and 7 arguments. The message is sent and flushed when the WriteLine(String) method is invoked.
Public method | WriteLine(String) | Writes a preformatted log message.
Public method | WriteLine(String, Object) | Writes a log message and specifies the formatting string and an array of parameters.
Public method | WriteLineT1(String, T1) | Writes a message given a formatting string and 1 argument.
Public method | WriteLineT1, T2(String, T1, T2) | Writes a message given a formatting string and 2 arguments.
Public method | WriteLineT1, T2, T3(String, T1, T2, T3) | Writes a message given a formatting string and 3 arguments.
Public method | WriteLineT1, T2, T3, T4(String, T1, T2, T3, T4) | Writes a message given a formatting string and 4 arguments.
Public method | WriteLineT1, T2, T3, T4, T5(String, T1, T2, T3, T4, T5) | Writes a message given a formatting string and 5 arguments.
Public method | WriteLineT1, T2, T3, T4, T5, T6(String, T1, T2, T3, T4, T5, T6) | Writes a message given a formatting string and 6 arguments.
Public method | WriteLineT1, T2, T3, T4, T5, T6, T7(String, T1, T2, T3, T4, T5, T6, T7) | Writes a message given a formatting string and 7 arguments.
Top
See Also

Reference

BuildTimeLogger Class
PostSharp.Extensibility.BuildTimeLogging Namespace


BuildTimeLogger.Activity Method

BuildTimeLoggerActivity Method

Overload List
 | Name | Description
Public method | Activity(String) | Writes a preformatted message and increases the indentation level. To decrease the indentation level, dispose the BuildTimeLogActivity returned by this method.
Public method | ActivityT1(String, T1) | Writes a message given a formatting string and 1 argument, and increases the indentation level. To decrease the indentation level, dispose the BuildTimeLogActivity returned by this method.
Public method | ActivityT1, T2(String, T1, T2) | Writes a message given a formatting string and 2 arguments, and increases the indentation level. To decrease the indentation level, dispose the BuildTimeLogActivity returned by this method.
Public method | ActivityT1, T2, T3(String, T1, T2, T3) | Writes a message given a formatting string and 3 arguments, and increases the indentation level. To decrease the indentation level, dispose the BuildTimeLogActivity returned by this method.
Public method | ActivityT1, T2, T3, T4(String, T1, T2, T3, T4) | Writes a message given a formatting string and 4 arguments, and increases the indentation level. To decrease the indentation level, dispose the BuildTimeLogActivity returned by this method.
Public method | ActivityT1, T2, T3, T4, T5(String, T1, T2, T3, T4, T5) | Writes a message given a formatting string and 5 arguments, and increases the indentation level. To decrease the indentation level, dispose the BuildTimeLogActivity returned by this method.
Public method | ActivityT1, T2, T3, T4, T5, T6(String, T1, T2, T3, T4, T5, T6) | Writes a message given a formatting string and 6 arguments, and increases the indentation level. To decrease the indentation level, dispose the BuildTimeLogActivity returned by this method.
Public method | ActivityT1, T2, T3, T4, T5, T6, T7(String, T1, T2, T3, T4, T5, T6, T7) | Writes a message given a formatting string and 7 arguments, and increases the indentation level. To decrease the indentation level, dispose the BuildTimeLogActivity returned by this method.
Top
See Also

Reference

BuildTimeLogger Class
PostSharp.Extensibility.BuildTimeLogging Namespace


BuildTimeLogger.Activity Method (String)

BuildTimeLoggerActivity Method (String)

Writes a preformatted message and increases the indentation level. To decrease the indentation level, dispose the BuildTimeLogActivity returned by this method.

Namespace: PostSharp.Extensibility.BuildTimeLogging
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public BuildTimeLogActivity Activity(
    string message
)

Parameters

message
Type: SystemString
Message.

Return Value

Type: BuildTimeLogActivity
An opaque object to be disposed at the end of the activity to decrease the indentation level.
See Also

Reference

BuildTimeLogger Class
Activity Overload
PostSharp.Extensibility.BuildTimeLogging Namespace


BuildTimeLogger.Activity(T1) Method (String, T1)

BuildTimeLoggerActivityT1 Method (String, T1)

Writes a message given a formatting string and 1 argument, and increases the indentation level. To decrease the indentation level, dispose the BuildTimeLogActivity returned by this method.

Namespace: PostSharp.Extensibility.BuildTimeLogging
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public BuildTimeLogActivity Activity<T1>(
    string format,
    T1 arg1
)

Parameters

format
Type: SystemString
arg1
Type: T1
Value of the 1-th parameter.

Type Parameters

T1
Type of the 1-th parameter.

Return Value

Type: BuildTimeLogActivity
An opaque object to be disposed at the end of the activity to decrease the indentation level.
See Also

Reference

BuildTimeLogger Class
Activity Overload
PostSharp.Extensibility.BuildTimeLogging Namespace


BuildTimeLogger.Activity(T1, T2) Method (String, T1, T2)

BuildTimeLoggerActivityT1, T2 Method (String, T1, T2)

Writes a message given a formatting string and 2 arguments, and increases the indentation level. To decrease the indentation level, dispose the BuildTimeLogActivity returned by this method.

Namespace: PostSharp.Extensibility.BuildTimeLogging
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public BuildTimeLogActivity Activity<T1, T2>(
    string format,
    T1 arg1,
    T2 arg2
)

Parameters

format
Type: SystemString
arg1
Type: T1
Value of the 1-th parameter.
arg2
Type: T2
Value of the 2-th parameter.

Type Parameters

T1
Type of the 1-th parameter.
T2
Type of the 2-th parameter.

Return Value

Type: BuildTimeLogActivity
An opaque object to be disposed at the end of the activity to decrease the indentation level.
See Also

Reference

BuildTimeLogger Class
Activity Overload
PostSharp.Extensibility.BuildTimeLogging Namespace


BuildTimeLogger.Activity(T1, T2, T3) Method (String, T1, T2, T3)

BuildTimeLoggerActivityT1, T2, T3 Method (String, T1, T2, T3)

Writes a message given a formatting string and 3 arguments, and increases the indentation level. To decrease the indentation level, dispose the BuildTimeLogActivity returned by this method.

Namespace: PostSharp.Extensibility.BuildTimeLogging
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public BuildTimeLogActivity Activity<T1, T2, T3>(
    string format,
    T1 arg1,
    T2 arg2,
    T3 arg3
)

Parameters

format
Type: SystemString
arg1
Type: T1
Value of the 1-th parameter.
arg2
Type: T2
Value of the 2-th parameter.
arg3
Type: T3
Value of the 3-th parameter.

Type Parameters

T1
Type of the 1-th parameter.
T2
Type of the 2-th parameter.
T3
Type of the 3-th parameter.

Return Value

Type: BuildTimeLogActivity
An opaque object to be disposed at the end of the activity to decrease the indentation level.
See Also

Reference

BuildTimeLogger Class
Activity Overload
PostSharp.Extensibility.BuildTimeLogging Namespace


BuildTimeLogger.Activity(T1, T2, T3, T4) Method (String, T1, T2, T3, T4)

BuildTimeLoggerActivityT1, T2, T3, T4 Method (String, T1, T2, T3, T4)

Writes a message given a formatting string and 4 arguments, and increases the indentation level. To decrease the indentation level, dispose the BuildTimeLogActivity returned by this method.

Namespace: PostSharp.Extensibility.BuildTimeLogging
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public BuildTimeLogActivity Activity<T1, T2, T3, T4>(
    string format,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4
)

Parameters

format
Type: SystemString
arg1
Type: T1
Value of the 1-th parameter.
arg2
Type: T2
Value of the 2-th parameter.
arg3
Type: T3
Value of the 3-th parameter.
arg4
Type: T4
Value of the 4-th parameter.

Type Parameters

T1
Type of the 1-th parameter.
T2
Type of the 2-th parameter.
T3
Type of the 3-th parameter.
T4
Type of the 4-th parameter.

Return Value

Type: BuildTimeLogActivity
An opaque object to be disposed at the end of the activity to decrease the indentation level.
See Also

Reference

BuildTimeLogger Class
Activity Overload
PostSharp.Extensibility.BuildTimeLogging Namespace


BuildTimeLogger.Activity(T1, T2, T3, T4, T5) Method (String, T1, T2, T3, T4, T5)

BuildTimeLoggerActivityT1, T2, T3, T4, T5 Method (String, T1, T2, T3, T4, T5)

Writes a message given a formatting string and 5 arguments, and increases the indentation level. To decrease the indentation level, dispose the BuildTimeLogActivity returned by this method.

Namespace: PostSharp.Extensibility.BuildTimeLogging
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public BuildTimeLogActivity Activity<T1, T2, T3, T4, T5>(
    string format,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5
)

Parameters

format
Type: SystemString
arg1
Type: T1
Value of the 1-th parameter.
arg2
Type: T2
Value of the 2-th parameter.
arg3
Type: T3
Value of the 3-th parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.

Type Parameters

T1
Type of the 1-th parameter.
T2
Type of the 2-th parameter.
T3
Type of the 3-th parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.

Return Value

Type: BuildTimeLogActivity
An opaque object to be disposed at the end of the activity to decrease the indentation level.
See Also

Reference

BuildTimeLogger Class
Activity Overload
PostSharp.Extensibility.BuildTimeLogging Namespace


BuildTimeLogger.Activity(T1, T2, T3, T4, T5, T6) Method (String, T1, T2, T3, T4, T5, T6)

BuildTimeLoggerActivityT1, T2, T3, T4, T5, T6 Method (String, T1, T2, T3, T4, T5, T6)

Writes a message given a formatting string and 6 arguments, and increases the indentation level. To decrease the indentation level, dispose the BuildTimeLogActivity returned by this method.

Namespace: PostSharp.Extensibility.BuildTimeLogging
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public BuildTimeLogActivity Activity<T1, T2, T3, T4, T5, T6>(
    string format,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6
)

Parameters

format
Type: SystemString
arg1
Type: T1
Value of the 1-th parameter.
arg2
Type: T2
Value of the 2-th parameter.
arg3
Type: T3
Value of the 3-th parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.

Type Parameters

T1
Type of the 1-th parameter.
T2
Type of the 2-th parameter.
T3
Type of the 3-th parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.

Return Value

Type: BuildTimeLogActivity
An opaque object to be disposed at the end of the activity to decrease the indentation level.
See Also

Reference

BuildTimeLogger Class
Activity Overload
PostSharp.Extensibility.BuildTimeLogging Namespace


BuildTimeLogger.Activity(T1, T2, T3, T4, T5, T6, T7) Method (String, T1, T2, T3, T4, T5, T6, T7)

BuildTimeLoggerActivityT1, T2, T3, T4, T5, T6, T7 Method (String, T1, T2, T3, T4, T5, T6, T7)

Writes a message given a formatting string and 7 arguments, and increases the indentation level. To decrease the indentation level, dispose the BuildTimeLogActivity returned by this method.

Namespace: PostSharp.Extensibility.BuildTimeLogging
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public BuildTimeLogActivity Activity<T1, T2, T3, T4, T5, T6, T7>(
    string format,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7
)

Parameters

format
Type: SystemString
arg1
Type: T1
Value of the 1-th parameter.
arg2
Type: T2
Value of the 2-th parameter.
arg3
Type: T3
Value of the 3-th parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.

Type Parameters

T1
Type of the 1-th parameter.
T2
Type of the 2-th parameter.
T3
Type of the 3-th parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.

Return Value

Type: BuildTimeLogActivity
An opaque object to be disposed at the end of the activity to decrease the indentation level.
See Also

Reference

BuildTimeLogger Class
Activity Overload
PostSharp.Extensibility.BuildTimeLogging Namespace


BuildTimeLogger.GetInstance Method

BuildTimeLoggerGetInstance Method

Gets a BuildTimeLogger for a given category, or null if logging is not enabled for this category.

Namespace: PostSharp.Extensibility.BuildTimeLogging
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static BuildTimeLogger GetInstance(
    string category
)

Parameters

category
Type: SystemString
The name of the category.

Return Value

Type: BuildTimeLogger
A BuildTimeLogger for the category if logging is enabled for the category, otherwise null.
See Also

Reference

BuildTimeLogger Class
PostSharp.Extensibility.BuildTimeLogging Namespace


BuildTimeLogger.Initialize Method

BuildTimeLoggerInitialize Method

Namespace: PostSharp.Extensibility.BuildTimeLogging
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void Initialize(
    IEnumerable<string> enabledCategories = null
)

Parameters

enabledCategories (Optional)
Type: System.Collections.GenericIEnumerable String
See Also

Reference

BuildTimeLogger Class
PostSharp.Extensibility.BuildTimeLogging Namespace


BuildTimeLogger.Write Method

BuildTimeLoggerWrite Method

Overload List
 | Name | Description
Public method | Write(String) | Appends a preformatted string to the next message. The message is sent and flushed when the WriteLine(String) method is invoked.
Public method | Write(String, Object) | Appends a string to the next message and formats it using a formatting string and an array of parameters. The message is sent and flushed when the WriteLine(String) method is invoked.
Public method | WriteT1(String, T1) | Appends a string to the next message and formats it using a formatting string and 1 argument. The message is sent and flushed when the WriteLine(String) method is invoked.
Public method | WriteT1, T2(String, T1, T2) | Appends a string to the next message and formats it using a formatting string and 2 arguments. The message is sent and flushed when the WriteLine(String) method is invoked.
Public method | WriteT1, T2, T3(String, T1, T2, T3) | Appends a string to the next message and formats it using a formatting string and 3 arguments. The message is sent and flushed when the WriteLine(String) method is invoked.
Public method | WriteT1, T2, T3, T4(String, T1, T2, T3, T4) | Appends a string to the next message and formats it using a formatting string and 4 arguments. The message is sent and flushed when the WriteLine(String) method is invoked.
Public method | WriteT1, T2, T3, T4, T5(String, T1, T2, T3, T4, T5) | Appends a string to the next message and formats it using a formatting string and 5 arguments. The message is sent and flushed when the WriteLine(String) method is invoked.
Public method | WriteT1, T2, T3, T4, T5, T6(String, T1, T2, T3, T4, T5, T6) | Appends a string to the next message and formats it using a formatting string and 6 arguments. The message is sent and flushed when the WriteLine(String) method is invoked.
Public method | WriteT1, T2, T3, T4, T5, T6, T7(String, T1, T2, T3, T4, T5, T6, T7) | Appends a string to the next message and formats it using a formatting string and 7 arguments. The message is sent and flushed when the WriteLine(String) method is invoked.
Top
See Also

Reference

BuildTimeLogger Class
PostSharp.Extensibility.BuildTimeLogging Namespace


BuildTimeLogger.Write Method (String)

BuildTimeLoggerWrite Method (String)

Appends a preformatted string to the next message. The message is sent and flushed when the WriteLine(String) method is invoked.

Namespace: PostSharp.Extensibility.BuildTimeLogging
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Write(
    string message
)

Parameters

message
Type: SystemString
Message.
See Also

Reference

BuildTimeLogger Class
Write Overload
PostSharp.Extensibility.BuildTimeLogging Namespace


BuildTimeLogger.Write Method (String, Object[])

BuildTimeLoggerWrite Method (String, Object)

Appends a string to the next message and formats it using a formatting string and an array of parameters. The message is sent and flushed when the WriteLine(String) method is invoked.

Namespace: PostSharp.Extensibility.BuildTimeLogging
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Write(
    string message,
    Object[] args
)

Parameters

message
Type: SystemString
Message formatting string.
args
Type: SystemObject
Formatting string arguments.
See Also

Reference

BuildTimeLogger Class
Write Overload
PostSharp.Extensibility.BuildTimeLogging Namespace


BuildTimeLogger.Write(T1) Method (String, T1)

BuildTimeLoggerWriteT1 Method (String, T1)

Appends a string to the next message and formats it using a formatting string and 1 argument. The message is sent and flushed when the WriteLine(String) method is invoked.

Namespace: PostSharp.Extensibility.BuildTimeLogging
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Write<T1>(
    string format,
    T1 arg1
)

Parameters

format
Type: SystemString
arg1
Type: T1
Value of the 1-th parameter.

Type Parameters

T1
Type of the 1-th parameter.
See Also

Reference

BuildTimeLogger Class
Write Overload
PostSharp.Extensibility.BuildTimeLogging Namespace


BuildTimeLogger.Write(T1, T2) Method (String, T1, T2)

BuildTimeLoggerWriteT1, T2 Method (String, T1, T2)

Appends a string to the next message and formats it using a formatting string and 2 arguments. The message is sent and flushed when the WriteLine(String) method is invoked.

Namespace: PostSharp.Extensibility.BuildTimeLogging
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Write<T1, T2>(
    string format,
    T1 arg1,
    T2 arg2
)

Parameters

format
Type: SystemString
arg1
Type: T1
Value of the 1-th parameter.
arg2
Type: T2
Value of the 2-th parameter.

Type Parameters

T1
Type of the 1-th parameter.
T2
Type of the 2-th parameter.
See Also

Reference

BuildTimeLogger Class
Write Overload
PostSharp.Extensibility.BuildTimeLogging Namespace


BuildTimeLogger.Write(T1, T2, T3) Method (String, T1, T2, T3)

BuildTimeLoggerWriteT1, T2, T3 Method (String, T1, T2, T3)

Appends a string to the next message and formats it using a formatting string and 3 arguments. The message is sent and flushed when the WriteLine(String) method is invoked.

Namespace: PostSharp.Extensibility.BuildTimeLogging
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Write<T1, T2, T3>(
    string format,
    T1 arg1,
    T2 arg2,
    T3 arg3
)

Parameters

format
Type: SystemString
arg1
Type: T1
Value of the 1-th parameter.
arg2
Type: T2
Value of the 2-th parameter.
arg3
Type: T3
Value of the 3-th parameter.

Type Parameters

T1
Type of the 1-th parameter.
T2
Type of the 2-th parameter.
T3
Type of the 3-th parameter.
See Also

Reference

BuildTimeLogger Class
Write Overload
PostSharp.Extensibility.BuildTimeLogging Namespace


BuildTimeLogger.Write(T1, T2, T3, T4) Method (String, T1, T2, T3, T4)

BuildTimeLoggerWriteT1, T2, T3, T4 Method (String, T1, T2, T3, T4)

Appends a string to the next message and formats it using a formatting string and 4 arguments. The message is sent and flushed when the WriteLine(String) method is invoked.

Namespace: PostSharp.Extensibility.BuildTimeLogging
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Write<T1, T2, T3, T4>(
    string format,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4
)

Parameters

format
Type: SystemString
arg1
Type: T1
Value of the 1-th parameter.
arg2
Type: T2
Value of the 2-th parameter.
arg3
Type: T3
Value of the 3-th parameter.
arg4
Type: T4
Value of the 4-th parameter.

Type Parameters

T1
Type of the 1-th parameter.
T2
Type of the 2-th parameter.
T3
Type of the 3-th parameter.
T4
Type of the 4-th parameter.
See Also

Reference

BuildTimeLogger Class
Write Overload
PostSharp.Extensibility.BuildTimeLogging Namespace


BuildTimeLogger.Write(T1, T2, T3, T4, T5) Method (String, T1, T2, T3, T4, T5)

BuildTimeLoggerWriteT1, T2, T3, T4, T5 Method (String, T1, T2, T3, T4, T5)

Appends a string to the next message and formats it using a formatting string and 5 arguments. The message is sent and flushed when the WriteLine(String) method is invoked.

Namespace: PostSharp.Extensibility.BuildTimeLogging
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Write<T1, T2, T3, T4, T5>(
    string format,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5
)

Parameters

format
Type: SystemString
arg1
Type: T1
Value of the 1-th parameter.
arg2
Type: T2
Value of the 2-th parameter.
arg3
Type: T3
Value of the 3-th parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.

Type Parameters

T1
Type of the 1-th parameter.
T2
Type of the 2-th parameter.
T3
Type of the 3-th parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
See Also

Reference

BuildTimeLogger Class
Write Overload
PostSharp.Extensibility.BuildTimeLogging Namespace


BuildTimeLogger.Write(T1, T2, T3, T4, T5, T6) Method (String, T1, T2, T3, T4, T5, T6)

BuildTimeLoggerWriteT1, T2, T3, T4, T5, T6 Method (String, T1, T2, T3, T4, T5, T6)

Appends a string to the next message and formats it using a formatting string and 6 arguments. The message is sent and flushed when the WriteLine(String) method is invoked.

Namespace: PostSharp.Extensibility.BuildTimeLogging
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Write<T1, T2, T3, T4, T5, T6>(
    string format,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6
)

Parameters

format
Type: SystemString
arg1
Type: T1
Value of the 1-th parameter.
arg2
Type: T2
Value of the 2-th parameter.
arg3
Type: T3
Value of the 3-th parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.

Type Parameters

T1
Type of the 1-th parameter.
T2
Type of the 2-th parameter.
T3
Type of the 3-th parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
See Also

Reference

BuildTimeLogger Class
Write Overload
PostSharp.Extensibility.BuildTimeLogging Namespace


BuildTimeLogger.Write(T1, T2, T3, T4, T5, T6, T7) Method (String, T1, T2, T3, T4, T5, T6, T7)

BuildTimeLoggerWriteT1, T2, T3, T4, T5, T6, T7 Method (String, T1, T2, T3, T4, T5, T6, T7)

Appends a string to the next message and formats it using a formatting string and 7 arguments. The message is sent and flushed when the WriteLine(String) method is invoked.

Namespace: PostSharp.Extensibility.BuildTimeLogging
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Write<T1, T2, T3, T4, T5, T6, T7>(
    string format,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7
)

Parameters

format
Type: SystemString
arg1
Type: T1
Value of the 1-th parameter.
arg2
Type: T2
Value of the 2-th parameter.
arg3
Type: T3
Value of the 3-th parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.

Type Parameters

T1
Type of the 1-th parameter.
T2
Type of the 2-th parameter.
T3
Type of the 3-th parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.
See Also

Reference

BuildTimeLogger Class
Write Overload
PostSharp.Extensibility.BuildTimeLogging Namespace


BuildTimeLogger.WriteLine Method

BuildTimeLoggerWriteLine Method

Overload List
 | Name | Description
Public method | WriteLine(String) | Writes a preformatted log message.
Public method | WriteLine(String, Object) | Writes a log message and specifies the formatting string and an array of parameters.
Public method | WriteLineT1(String, T1) | Writes a message given a formatting string and 1 argument.
Public method | WriteLineT1, T2(String, T1, T2) | Writes a message given a formatting string and 2 arguments.
Public method | WriteLineT1, T2, T3(String, T1, T2, T3) | Writes a message given a formatting string and 3 arguments.
Public method | WriteLineT1, T2, T3, T4(String, T1, T2, T3, T4) | Writes a message given a formatting string and 4 arguments.
Public method | WriteLineT1, T2, T3, T4, T5(String, T1, T2, T3, T4, T5) | Writes a message given a formatting string and 5 arguments.
Public method | WriteLineT1, T2, T3, T4, T5, T6(String, T1, T2, T3, T4, T5, T6) | Writes a message given a formatting string and 6 arguments.
Public method | WriteLineT1, T2, T3, T4, T5, T6, T7(String, T1, T2, T3, T4, T5, T6, T7) | Writes a message given a formatting string and 7 arguments.
Top
See Also

Reference

BuildTimeLogger Class
PostSharp.Extensibility.BuildTimeLogging Namespace


BuildTimeLogger.WriteLine Method (String)

BuildTimeLoggerWriteLine Method (String)

Writes a preformatted log message.

Namespace: PostSharp.Extensibility.BuildTimeLogging
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void WriteLine(
    string message
)

Parameters

message
Type: SystemString
Message.
See Also

Reference

BuildTimeLogger Class
WriteLine Overload
PostSharp.Extensibility.BuildTimeLogging Namespace


BuildTimeLogger.WriteLine Method (String, Object[])

BuildTimeLoggerWriteLine Method (String, Object)

Writes a log message and specifies the formatting string and an array of parameters.

Namespace: PostSharp.Extensibility.BuildTimeLogging
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void WriteLine(
    string message,
    Object[] args
)

Parameters

message
Type: SystemString
Message formatting string.
args
Type: SystemObject
Formatting string arguments.
See Also

Reference

BuildTimeLogger Class
WriteLine Overload
PostSharp.Extensibility.BuildTimeLogging Namespace


BuildTimeLogger.WriteLine(T1) Method (String, T1)

BuildTimeLoggerWriteLineT1 Method (String, T1)

Writes a message given a formatting string and 1 argument.

Namespace: PostSharp.Extensibility.BuildTimeLogging
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void WriteLine<T1>(
    string format,
    T1 arg1
)

Parameters

format
Type: SystemString
arg1
Type: T1
Value of the 1-th parameter.

Type Parameters

T1
Type of the 1-th parameter.
See Also

Reference

BuildTimeLogger Class
WriteLine Overload
PostSharp.Extensibility.BuildTimeLogging Namespace


BuildTimeLogger.WriteLine(T1, T2) Method (String, T1, T2)

BuildTimeLoggerWriteLineT1, T2 Method (String, T1, T2)

Writes a message given a formatting string and 2 arguments.

Namespace: PostSharp.Extensibility.BuildTimeLogging
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void WriteLine<T1, T2>(
    string format,
    T1 arg1,
    T2 arg2
)

Parameters

format
Type: SystemString
arg1
Type: T1
Value of the 1-th parameter.
arg2
Type: T2
Value of the 2-th parameter.

Type Parameters

T1
Type of the 1-th parameter.
T2
Type of the 2-th parameter.
See Also

Reference

BuildTimeLogger Class
WriteLine Overload
PostSharp.Extensibility.BuildTimeLogging Namespace


BuildTimeLogger.WriteLine(T1, T2, T3) Method (String, T1, T2, T3)

BuildTimeLoggerWriteLineT1, T2, T3 Method (String, T1, T2, T3)

Writes a message given a formatting string and 3 arguments.

Namespace: PostSharp.Extensibility.BuildTimeLogging
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void WriteLine<T1, T2, T3>(
    string format,
    T1 arg1,
    T2 arg2,
    T3 arg3
)

Parameters

format
Type: SystemString
arg1
Type: T1
Value of the 1-th parameter.
arg2
Type: T2
Value of the 2-th parameter.
arg3
Type: T3
Value of the 3-th parameter.

Type Parameters

T1
Type of the 1-th parameter.
T2
Type of the 2-th parameter.
T3
Type of the 3-th parameter.
See Also

Reference

BuildTimeLogger Class
WriteLine Overload
PostSharp.Extensibility.BuildTimeLogging Namespace


BuildTimeLogger.WriteLine(T1, T2, T3, T4) Method (String, T1, T2, T3, T4)

BuildTimeLoggerWriteLineT1, T2, T3, T4 Method (String, T1, T2, T3, T4)

Writes a message given a formatting string and 4 arguments.

Namespace: PostSharp.Extensibility.BuildTimeLogging
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void WriteLine<T1, T2, T3, T4>(
    string format,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4
)

Parameters

format
Type: SystemString
arg1
Type: T1
Value of the 1-th parameter.
arg2
Type: T2
Value of the 2-th parameter.
arg3
Type: T3
Value of the 3-th parameter.
arg4
Type: T4
Value of the 4-th parameter.

Type Parameters

T1
Type of the 1-th parameter.
T2
Type of the 2-th parameter.
T3
Type of the 3-th parameter.
T4
Type of the 4-th parameter.
See Also

Reference

BuildTimeLogger Class
WriteLine Overload
PostSharp.Extensibility.BuildTimeLogging Namespace


BuildTimeLogger.WriteLine(T1, T2, T3, T4, T5) Method (String, T1, T2, T3, T4, T5)

BuildTimeLoggerWriteLineT1, T2, T3, T4, T5 Method (String, T1, T2, T3, T4, T5)

Writes a message given a formatting string and 5 arguments.

Namespace: PostSharp.Extensibility.BuildTimeLogging
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void WriteLine<T1, T2, T3, T4, T5>(
    string format,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5
)

Parameters

format
Type: SystemString
arg1
Type: T1
Value of the 1-th parameter.
arg2
Type: T2
Value of the 2-th parameter.
arg3
Type: T3
Value of the 3-th parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.

Type Parameters

T1
Type of the 1-th parameter.
T2
Type of the 2-th parameter.
T3
Type of the 3-th parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
See Also

Reference

BuildTimeLogger Class
WriteLine Overload
PostSharp.Extensibility.BuildTimeLogging Namespace


BuildTimeLogger.WriteLine(T1, T2, T3, T4, T5, T6) Method (String, T1, T2, T3, T4, T5, T6)

BuildTimeLoggerWriteLineT1, T2, T3, T4, T5, T6 Method (String, T1, T2, T3, T4, T5, T6)

Writes a message given a formatting string and 6 arguments.

Namespace: PostSharp.Extensibility.BuildTimeLogging
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void WriteLine<T1, T2, T3, T4, T5, T6>(
    string format,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6
)

Parameters

format
Type: SystemString
arg1
Type: T1
Value of the 1-th parameter.
arg2
Type: T2
Value of the 2-th parameter.
arg3
Type: T3
Value of the 3-th parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.

Type Parameters

T1
Type of the 1-th parameter.
T2
Type of the 2-th parameter.
T3
Type of the 3-th parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
See Also

Reference

BuildTimeLogger Class
WriteLine Overload
PostSharp.Extensibility.BuildTimeLogging Namespace


BuildTimeLogger.WriteLine(T1, T2, T3, T4, T5, T6, T7) Method (String, T1, T2, T3, T4, T5, T6, T7)

BuildTimeLoggerWriteLineT1, T2, T3, T4, T5, T6, T7 Method (String, T1, T2, T3, T4, T5, T6, T7)

Writes a message given a formatting string and 7 arguments.

Namespace: PostSharp.Extensibility.BuildTimeLogging
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void WriteLine<T1, T2, T3, T4, T5, T6, T7>(
    string format,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7
)

Parameters

format
Type: SystemString
arg1
Type: T1
Value of the 1-th parameter.
arg2
Type: T2
Value of the 2-th parameter.
arg3
Type: T3
Value of the 3-th parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.

Type Parameters

T1
Type of the 1-th parameter.
T2
Type of the 2-th parameter.
T3
Type of the 3-th parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.
See Also

Reference

BuildTimeLogger Class
WriteLine Overload
PostSharp.Extensibility.BuildTimeLogging Namespace


PostSharp.Patterns Namespace

Classes
 | Class | Description
Public class | AssertionFailedException | Exception thrown upon internal assertion failures in PostSharp Pattern Libraries.


AssertionFailedException Class

Exception thrown upon internal assertion failures in PostSharp Pattern Libraries.
Inheritance Hierarchy
SystemObject
SystemException
PostSharp.PatternsAssertionFailedException

Namespace: PostSharp.Patterns
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public sealed class AssertionFailedException : Exception
Constructors
 | Name | Description
Public method | AssertionFailedException | Initializes a new AssertionFailedException with the default error message.
Public method | AssertionFailedException(String) | Initializes a new AssertionFailedException and specifies the error message.
Public method | AssertionFailedException(String, Exception) | Initializes a new AssertionFailedException and specifies the error message and the inner Exception.
Top
See Also

Reference

PostSharp.Patterns Namespace


AssertionFailedException Constructor

Overload List
 | Name | Description
Public method | AssertionFailedException | Initializes a new AssertionFailedException with the default error message.
Public method | AssertionFailedException(String) | Initializes a new AssertionFailedException and specifies the error message.
Public method | AssertionFailedException(String, Exception) | Initializes a new AssertionFailedException and specifies the error message and the inner Exception.
Top
See Also

Reference

AssertionFailedException Class
PostSharp.Patterns Namespace


AssertionFailedException Constructor

Initializes a new AssertionFailedException with the default error message.

Namespace: PostSharp.Patterns
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AssertionFailedException()
See Also

Reference

AssertionFailedException Class
AssertionFailedException Overload
PostSharp.Patterns Namespace


AssertionFailedException Constructor (String)

Initializes a new AssertionFailedException and specifies the error message.

Namespace: PostSharp.Patterns
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AssertionFailedException(
    string message
)

Parameters

message
Type: SystemString
See Also

Reference

AssertionFailedException Class
AssertionFailedException Overload
PostSharp.Patterns Namespace


AssertionFailedException Constructor (String, Exception)

Initializes a new AssertionFailedException and specifies the error message and the inner Exception.

Namespace: PostSharp.Patterns
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AssertionFailedException(
    string message,
    Exception inner
)

Parameters

message
Type: SystemString
inner
Type: SystemException
See Also

Reference

AssertionFailedException Class
AssertionFailedException Overload
PostSharp.Patterns Namespace


PostSharp.Patterns.Caching Namespace

Classes
 | Class | Description
Public class | CacheAttribute | Custom attribute that, when applied on a method, causes the return value of the method to be cached for the specific list of arguments passed to this method call.
Public class | CacheConfigurationAttribute | Custom attribute that, when applied on a type, configures the CacheAttribute aspects applied to the methods of this type or its derived types. When applied to an assembly, the CacheConfigurationAttribute custom attribute configures all methods of the current assembly.
Public class | CachingException | Exception thrown by PostSharp.Patterns.Caching.
Public class | CachingProfile | Allows for centralized and run-time configuration of several instances of the CacheAttribute aspect.
Public class | CachingServices | The entry point to configure PostSharp.Patterns.Caching at run-time.
Public class | CachingServicesCachingProfileRegistry | Allows to configure caching profiles (CachingProfile), and therefore influence the behavior of the CacheAttribute aspect at run-time. Exposed on the Profiles property.
Public class | CachingServicesFormatters | Allows to get and register formatters used to generate caching keys.
Public class | CachingServicesInvalidation | Invalidates the cache.
Public class | InvalidateCacheAttribute | Custom attribute that, when applied on a method, causes an invocation of this method to remove from the cache the result of invocations of other given methods with the same parameter values.
Public class | InvalidCacheItemException | Exception thrown by a caching back-end during cache item retrieval (e.g. when the cached data cannot be serialized by the current object model). Throwing this exception causes removal of the invalid item.
Public class | NotCacheKeyAttribute | Custom attribute that, when applied to a parameter of a cached method (i.e. a method enhanced by the CacheAttribute aspect), excludes this parameter from being a part of the cache key.
Interfaces
 | Interface | Description
Public interface | ICachingContext | Represents the context in which a method being cached is executing.
Enumerations
 | Enumeration | Description
Public enumeration | CachingContextKind | Enumerates the kinds of ICachingContext.


CacheAttribute Class

Custom attribute that, when applied on a method, causes the return value of the method to be cached for the specific list of arguments passed to this method call.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsMethodLevelAspect
PostSharp.AspectsMethodInterceptionAspect
PostSharp.Patterns.CachingCacheAttribute

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class CacheAttribute : MethodInterceptionAspect

The CacheAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | CacheAttribute | Initializes a new instance of the CacheAttribute class
Top
Properties
 | Name | Description
Public property | AbsoluteExpiration | Gets or sets the total duration, in minutes, during which the result of the current method is stored in cache. The absolute expiration time is counted from the moment the method is evaluated and cached.
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | AutoReload | Determines whether the method calls are automatically reloaded (by re-evaluating the target method with the same arguments) when the cache item is removed from the cache.
Public property | IgnoreThisParameter | Determines whether the this instance should be a part of the cache key. The default value of this property is false, which means that by default the this instance is a part of the cache key.
Public property | Priority | Gets or sets the priority of the current method.
Public property | ProfileName | Gets or sets the name of the CachingProfile that contains the configuration of the current CacheAttribute.
Public property | SlidingExpiration | Gets or sets the duration, in minutes, during which the result of the current method is stored in cache after it has been added to or accessed from the cache. The expiration is extended every time the value is accessed from the cache.
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an async method with unsupported return value type. (Inherited from MethodInterceptionAspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Top
Remarks

There are several ways to configure the behavior of the CacheAttribute aspect: you can set the properties of the CacheAttribute class, such as AbsoluteExpiration or SlidingExpiration. You can add the CacheConfigurationAttribute custom attribute to the declaring type, a base type, or the declaring assembly. Finally, you can define a profile by setting the ProfileName property and configure the profile at run time by accessing the Profiles collection of the CachingServices class.

Use the NotCacheKeyAttribute custom attribute to exclude a parameter from being a part of the cache key.

To invalidate a cached method, see InvalidateCacheAttribute and CachingServicesInvalidation.

See Also

Reference

PostSharp.Patterns.Caching Namespace

Other Resources

Conceptual: Caching
Conceptual: Caching Back-Ends
Conceptual: Caching Method Return Values


CacheAttribute Constructor

Initializes a new instance of the CacheAttribute class

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CacheAttribute()
See Also

Reference

CacheAttribute Class
PostSharp.Patterns.Caching Namespace


CacheAttribute Properties

The CacheAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AbsoluteExpiration | Gets or sets the total duration, in minutes, during which the result of the current method is stored in cache. The absolute expiration time is counted from the moment the method is evaluated and cached.
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | AutoReload | Determines whether the method calls are automatically reloaded (by re-evaluating the target method with the same arguments) when the cache item is removed from the cache.
Public property | IgnoreThisParameter | Determines whether the this instance should be a part of the cache key. The default value of this property is false, which means that by default the this instance is a part of the cache key.
Public property | Priority | Gets or sets the priority of the current method.
Public property | ProfileName | Gets or sets the name of the CachingProfile that contains the configuration of the current CacheAttribute.
Public property | SlidingExpiration | Gets or sets the duration, in minutes, during which the result of the current method is stored in cache after it has been added to or accessed from the cache. The expiration is extended every time the value is accessed from the cache.
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an async method with unsupported return value type. (Inherited from MethodInterceptionAspect.)
Top
See Also

Reference

CacheAttribute Class
PostSharp.Patterns.Caching Namespace


CacheAttribute.AbsoluteExpiration Property

CacheAttributeAbsoluteExpiration Property

Gets or sets the total duration, in minutes, during which the result of the current method is stored in cache. The absolute expiration time is counted from the moment the method is evaluated and cached.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public double AbsoluteExpiration { get; set; }

Property Value

Type: Double
See Also

Reference

CacheAttribute Class
PostSharp.Patterns.Caching Namespace


CacheAttribute.AutoReload Property

CacheAttributeAutoReload Property

Determines whether the method calls are automatically reloaded (by re-evaluating the target method with the same arguments) when the cache item is removed from the cache.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool AutoReload { get; set; }

Property Value

Type: Boolean
See Also

Reference

CacheAttribute Class
PostSharp.Patterns.Caching Namespace


CacheAttribute.IgnoreThisParameter Property

CacheAttributeIgnoreThisParameter Property

Determines whether the this instance should be a part of the cache key. The default value of this property is false, which means that by default the this instance is a part of the cache key.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IgnoreThisParameter { get; set; }

Property Value

Type: Boolean
See Also

Reference

CacheAttribute Class
PostSharp.Patterns.Caching Namespace

Other Resources

Conceptual: Customizing Cache Keys
Conceptual: Removing Items From the Cache


CacheAttribute.Priority Property

CacheAttributePriority Property

Gets or sets the priority of the current method.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CacheItemPriority Priority { get; set; }

Property Value

Type: CacheItemPriority
See Also

Reference

CacheAttribute Class
PostSharp.Patterns.Caching Namespace


CacheAttribute.ProfileName Property

CacheAttributeProfileName Property

Gets or sets the name of the CachingProfile that contains the configuration of the current CacheAttribute.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string ProfileName { get; set; }

Property Value

Type: String
See Also

Reference

CacheAttribute Class
PostSharp.Patterns.Caching Namespace

Other Resources

Conceptual: Caching Method Return Values


CacheAttribute.SlidingExpiration Property

CacheAttributeSlidingExpiration Property

Gets or sets the duration, in minutes, during which the result of the current method is stored in cache after it has been added to or accessed from the cache. The expiration is extended every time the value is accessed from the cache.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public double SlidingExpiration { get; set; }

Property Value

Type: Double
See Also

Reference

CacheAttribute Class
PostSharp.Patterns.Caching Namespace


CacheAttribute Methods

The CacheAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Top
See Also

Reference

CacheAttribute Class
PostSharp.Patterns.Caching Namespace


CacheConfigurationAttribute Class

Custom attribute that, when applied on a type, configures the CacheAttribute aspects applied to the methods of this type or its derived types. When applied to an assembly, the CacheConfigurationAttribute custom attribute configures all methods of the current assembly.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Patterns.CachingCacheConfigurationAttribute

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class CacheConfigurationAttribute : Attribute

The CacheConfigurationAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | CacheConfigurationAttribute | Initializes a new instance of the CacheConfigurationAttribute class
Top
Properties
 | Name | Description
Public property | AbsoluteExpiration | Gets or sets the total duration, in minutes, during which the result of the cached method is stored in cache. The absolute expiration time is counted from the moment the method is evaluated and cached.
Public property | AutoReload | Determines whether the method calls are automatically reloaded (by re-evaluating the target method with the same arguments) when the cache item is removed from the cache.
Public property | IgnoreThisParameter | Determines whether the this instance should be a part of the cache key. The default value of this property is false, which means that by default the this instance is a part of the cache key.
Public property | Priority | Gets or sets the priority of the cached method.
Public property | ProfileName | Gets or sets the name of the CachingProfile that contains the configuration of the cached methods.
Public property | SlidingExpiration | Gets or sets the duration, in minutes, during which the result of the cached method is stored in cache after it has been added to or accessed from the cache. The expiration is extended every time the value is accessed from the cache.
Top
Remarks

Any CacheConfigurationAttribute on the base class has always priority over a CacheConfigurationAttribute on the assembly, even if the base class is in a different assembly.

See Also

Reference

PostSharp.Patterns.Caching Namespace

Other Resources

Conceptual: Caching
Conceptual: Caching Method Return Values


CacheConfigurationAttribute Constructor

Initializes a new instance of the CacheConfigurationAttribute class

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CacheConfigurationAttribute()
See Also

Reference

CacheConfigurationAttribute Class
PostSharp.Patterns.Caching Namespace


CacheConfigurationAttribute Properties

The CacheConfigurationAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AbsoluteExpiration | Gets or sets the total duration, in minutes, during which the result of the cached method is stored in cache. The absolute expiration time is counted from the moment the method is evaluated and cached.
Public property | AutoReload | Determines whether the method calls are automatically reloaded (by re-evaluating the target method with the same arguments) when the cache item is removed from the cache.
Public property | IgnoreThisParameter | Determines whether the this instance should be a part of the cache key. The default value of this property is false, which means that by default the this instance is a part of the cache key.
Public property | Priority | Gets or sets the priority of the cached method.
Public property | ProfileName | Gets or sets the name of the CachingProfile that contains the configuration of the cached methods.
Public property | SlidingExpiration | Gets or sets the duration, in minutes, during which the result of the cached method is stored in cache after it has been added to or accessed from the cache. The expiration is extended every time the value is accessed from the cache.
Top
See Also

Reference

CacheConfigurationAttribute Class
PostSharp.Patterns.Caching Namespace


CacheConfigurationAttribute.AbsoluteExpiration Property

CacheConfigurationAttributeAbsoluteExpiration Property

Gets or sets the total duration, in minutes, during which the result of the cached method is stored in cache. The absolute expiration time is counted from the moment the method is evaluated and cached.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public double AbsoluteExpiration { get; set; }

Property Value

Type: Double
See Also

Reference

CacheConfigurationAttribute Class
PostSharp.Patterns.Caching Namespace


CacheConfigurationAttribute.AutoReload Property

CacheConfigurationAttributeAutoReload Property

Determines whether the method calls are automatically reloaded (by re-evaluating the target method with the same arguments) when the cache item is removed from the cache.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool AutoReload { get; set; }

Property Value

Type: Boolean
See Also

Reference

CacheConfigurationAttribute Class
PostSharp.Patterns.Caching Namespace


CacheConfigurationAttribute.IgnoreThisParameter Property

CacheConfigurationAttributeIgnoreThisParameter Property

Determines whether the this instance should be a part of the cache key. The default value of this property is false, which means that by default the this instance is a part of the cache key.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IgnoreThisParameter { get; set; }

Property Value

Type: Boolean
See Also

Reference

CacheConfigurationAttribute Class
PostSharp.Patterns.Caching Namespace


CacheConfigurationAttribute.Priority Property

CacheConfigurationAttributePriority Property

Gets or sets the priority of the cached method.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CacheItemPriority Priority { get; set; }

Property Value

Type: CacheItemPriority
See Also

Reference

CacheConfigurationAttribute Class
PostSharp.Patterns.Caching Namespace


CacheConfigurationAttribute.ProfileName Property

CacheConfigurationAttributeProfileName Property

Gets or sets the name of the CachingProfile that contains the configuration of the cached methods.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string ProfileName { get; set; }

Property Value

Type: String
See Also

Reference

CacheConfigurationAttribute Class
PostSharp.Patterns.Caching Namespace


CacheConfigurationAttribute.SlidingExpiration Property

CacheConfigurationAttributeSlidingExpiration Property

Gets or sets the duration, in minutes, during which the result of the cached method is stored in cache after it has been added to or accessed from the cache. The expiration is extended every time the value is accessed from the cache.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public double SlidingExpiration { get; set; }

Property Value

Type: Double
See Also

Reference

CacheConfigurationAttribute Class
PostSharp.Patterns.Caching Namespace


CachingContextKind Enumeration

Enumerates the kinds of ICachingContext.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum CachingContextKind
Members
Member name | Value | Description
None | 0 | None (a null implementation of ICachingContext).
Cache | 1 | The ICachingContext of a method being evaluated and added to the cache.
Recache | 2 | The ICachingContext of a method being re-evaluated, ignoring the previous value, and replaced into the cache, using the RecacheTReturn(FuncTReturn) method.
See Also

Reference

PostSharp.Patterns.Caching Namespace


CachingException Class

Exception thrown by PostSharp.Patterns.Caching.
Inheritance Hierarchy
SystemObject
SystemException
PostSharp.Patterns.CachingCachingException
PostSharp.Patterns.CachingInvalidCacheItemException

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public class CachingException : Exception
Constructors
 | Name | Description
Public method | CachingException | Initializes a new CachingException with the default error message.
Public method | CachingException(String) | Initializes a new CachingException with a given error message.
Protected method | CachingException(SerializationInfo, StreamingContext) | Deserialization constructor.
Public method | CachingException(String, Exception) | Initializes a new CachingException with a given error message and inner Exception.
Top
See Also

Reference

PostSharp.Patterns.Caching Namespace


CachingException Constructor

Overload List
 | Name | Description
Public method | CachingException | Initializes a new CachingException with the default error message.
Public method | CachingException(String) | Initializes a new CachingException with a given error message.
Protected method | CachingException(SerializationInfo, StreamingContext) | Deserialization constructor.
Public method | CachingException(String, Exception) | Initializes a new CachingException with a given error message and inner Exception.
Top
See Also

Reference

CachingException Class
PostSharp.Patterns.Caching Namespace


CachingException Constructor

Initializes a new CachingException with the default error message.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CachingException()
See Also

Reference

CachingException Class
CachingException Overload
PostSharp.Patterns.Caching Namespace


CachingException Constructor (String)

Initializes a new CachingException with a given error message.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CachingException(
    string message
)

Parameters

message
Type: SystemString
The error message.
See Also

Reference

CachingException Class
CachingException Overload
PostSharp.Patterns.Caching Namespace


CachingException Constructor (SerializationInfo, StreamingContext)

Deserialization constructor.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected CachingException(
    SerializationInfo info,
    StreamingContext context
)

Parameters

info
Type: System.Runtime.SerializationSerializationInfo
context
Type: System.Runtime.SerializationStreamingContext
See Also

Reference

CachingException Class
CachingException Overload
PostSharp.Patterns.Caching Namespace


CachingException Constructor (String, Exception)

Initializes a new CachingException with a given error message and inner Exception.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CachingException(
    string message,
    Exception inner
)

Parameters

message
Type: SystemString
The error message.
inner
Type: SystemException
The inner exception.
See Also

Reference

CachingException Class
CachingException Overload
PostSharp.Patterns.Caching Namespace


CachingProfile Class

Allows for centralized and run-time configuration of several instances of the CacheAttribute aspect.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.CachingCachingProfile

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class CachingProfile : ICacheItemConfiguration

The CachingProfile type exposes the following members.

Constructors
 | Name | Description
Public method | CachingProfile | Initializes a new CachingProfile.
Top
Properties
 | Name | Description
Public property | AbsoluteExpiration | Gets or sets the total duration during which the result of the current method is stored in cache. The absolute expiration time is counted from the moment the method is evaluated and cached.
Public property | AcquireLockTimeout | Gets or sets the maximum time that the caching aspect will wait for the LockManager to acquire a lock. To specify an infinite waiting time, set this property to TimeSpan.FromMilliseconds( -1 ). The default behavior is to wait infinitely.
Public property | AcquireLockTimeoutStrategy | Gets or sets the behavior in case that the caching aspect could not acquire a lock because of a timeout. The default behavior is to throw a TimeoutException. You can implement your own strategy by implementing the IAcquireLockTimeoutStrategy interface. If the OnTimeout(String) does not return any exception, the cached method will be evaluated (even without a lock).
Public property | AutoReload | Determines whether the method calls are automatically reloaded (by re-evaluating the target method with the same arguments) when the cache item is removed from the cache.
Public property | IsEnabled | Determines whether caching is enabled for the current profile.
Public property | LockManager | Gets or sets the lock manager used to synchronize the execution of methods that are cached with the current profile. The default lock manager is NullLockManager, which allows for concurrent execution of all methods. An alternative implementation is LocalLockManager, which prevents concurrent execution of the same method with the same parameters, in the current process (or AppDomain).
Public property | Name | Gets the profile name (a case-insensitive string).
Public property | Priority | Gets or sets the priority of the cached methods.
Public property | SlidingExpiration | Gets or sets the duration during which the result of the current method is stored in cache after it has been added to or accessed from the cache. The expiration is extended every time the value is accessed from the cache.
Top
Fields
Name | Description
DefaultName | The name of the default profile.
Top
See Also

Reference

PostSharp.Patterns.Caching Namespace

Other Resources

Conceptual: Caching Method Return Values


CachingProfile Constructor

Initializes a new CachingProfile.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CachingProfile(
    string name
)

Parameters

name
Type: SystemString
Profile name (a case-insensitive string).
See Also

Reference

CachingProfile Class
PostSharp.Patterns.Caching Namespace


CachingProfile Properties

The CachingProfile type exposes the following members.

Properties
 | Name | Description
Public property | AbsoluteExpiration | Gets or sets the total duration during which the result of the current method is stored in cache. The absolute expiration time is counted from the moment the method is evaluated and cached.
Public property | AcquireLockTimeout | Gets or sets the maximum time that the caching aspect will wait for the LockManager to acquire a lock. To specify an infinite waiting time, set this property to TimeSpan.FromMilliseconds( -1 ). The default behavior is to wait infinitely.
Public property | AcquireLockTimeoutStrategy | Gets or sets the behavior in case that the caching aspect could not acquire a lock because of a timeout. The default behavior is to throw a TimeoutException. You can implement your own strategy by implementing the IAcquireLockTimeoutStrategy interface. If the OnTimeout(String) does not return any exception, the cached method will be evaluated (even without a lock).
Public property | AutoReload | Determines whether the method calls are automatically reloaded (by re-evaluating the target method with the same arguments) when the cache item is removed from the cache.
Public property | IsEnabled | Determines whether caching is enabled for the current profile.
Public property | LockManager | Gets or sets the lock manager used to synchronize the execution of methods that are cached with the current profile. The default lock manager is NullLockManager, which allows for concurrent execution of all methods. An alternative implementation is LocalLockManager, which prevents concurrent execution of the same method with the same parameters, in the current process (or AppDomain).
Public property | Name | Gets the profile name (a case-insensitive string).
Public property | Priority | Gets or sets the priority of the cached methods.
Public property | SlidingExpiration | Gets or sets the duration during which the result of the current method is stored in cache after it has been added to or accessed from the cache. The expiration is extended every time the value is accessed from the cache.
Top
See Also

Reference

CachingProfile Class
PostSharp.Patterns.Caching Namespace


CachingProfile.AbsoluteExpiration Property

CachingProfileAbsoluteExpiration Property

Gets or sets the total duration during which the result of the current method is stored in cache. The absolute expiration time is counted from the moment the method is evaluated and cached.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Nullable<TimeSpan> AbsoluteExpiration { get; set; }

Property Value

Type: Nullable TimeSpan
See Also

Reference

CachingProfile Class
PostSharp.Patterns.Caching Namespace


CachingProfile.AcquireLockTimeout Property

CachingProfileAcquireLockTimeout Property

Gets or sets the maximum time that the caching aspect will wait for the LockManager to acquire a lock. To specify an infinite waiting time, set this property to TimeSpan.FromMilliseconds( -1 ). The default behavior is to wait infinitely.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TimeSpan AcquireLockTimeout { get; set; }

Property Value

Type: TimeSpan
See Also

Reference

CachingProfile Class
PostSharp.Patterns.Caching Namespace

Other Resources

Conceptual: Preventing Concurrent Execution of Cached Methods


CachingProfile.AcquireLockTimeoutStrategy Property

CachingProfileAcquireLockTimeoutStrategy Property

Gets or sets the behavior in case that the caching aspect could not acquire a lock because of a timeout. The default behavior is to throw a TimeoutException. You can implement your own strategy by implementing the IAcquireLockTimeoutStrategy interface. If the OnTimeout(String) does not return any exception, the cached method will be evaluated (even without a lock).

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IAcquireLockTimeoutStrategy AcquireLockTimeoutStrategy { get; set; }

Property Value

Type: IAcquireLockTimeoutStrategy
See Also

Reference

CachingProfile Class
PostSharp.Patterns.Caching Namespace

Other Resources

Conceptual: Preventing Concurrent Execution of Cached Methods


CachingProfile.AutoReload Property

CachingProfileAutoReload Property

Determines whether the method calls are automatically reloaded (by re-evaluating the target method with the same arguments) when the cache item is removed from the cache.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Nullable<bool> AutoReload { get; set; }

Property Value

Type: Nullable Boolean
See Also

Reference

CachingProfile Class
PostSharp.Patterns.Caching Namespace


CachingProfile.IsEnabled Property

CachingProfileIsEnabled Property

Determines whether caching is enabled for the current profile.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsEnabled { get; set; }

Property Value

Type: Boolean
See Also

Reference

CachingProfile Class
PostSharp.Patterns.Caching Namespace

Other Resources

Conceptual: Caching Method Return Values


CachingProfile.LockManager Property

CachingProfileLockManager Property

Gets or sets the lock manager used to synchronize the execution of methods that are cached with the current profile. The default lock manager is NullLockManager, which allows for concurrent execution of all methods. An alternative implementation is LocalLockManager, which prevents concurrent execution of the same method with the same parameters, in the current process (or AppDomain).

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ILockManager LockManager { get; set; }

Property Value

Type: ILockManager
See Also

Reference

CachingProfile Class
PostSharp.Patterns.Caching Namespace

Other Resources

Conceptual: Preventing Concurrent Execution of Cached Methods


CachingProfile.Name Property

CachingProfileName Property

Gets the profile name (a case-insensitive string).

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string Name { get; }

Property Value

Type: String
See Also

Reference

CachingProfile Class
PostSharp.Patterns.Caching Namespace


CachingProfile.Priority Property

CachingProfilePriority Property

Gets or sets the priority of the cached methods.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Nullable<CacheItemPriority> Priority { get; set; }

Property Value

Type: Nullable CacheItemPriority

Implements

ICacheItemConfigurationPriority
See Also

Reference

CachingProfile Class
PostSharp.Patterns.Caching Namespace


CachingProfile.SlidingExpiration Property

CachingProfileSlidingExpiration Property

Gets or sets the duration during which the result of the current method is stored in cache after it has been added to or accessed from the cache. The expiration is extended every time the value is accessed from the cache.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Nullable<TimeSpan> SlidingExpiration { get; set; }

Property Value

Type: Nullable TimeSpan
See Also

Reference

CachingProfile Class
PostSharp.Patterns.Caching Namespace


CachingProfile Fields

The CachingProfile type exposes the following members.

Fields
Name | Description
DefaultName | The name of the default profile.
Top
See Also

Reference

CachingProfile Class
PostSharp.Patterns.Caching Namespace


CachingProfile.DefaultName Field

CachingProfileDefaultName Field

The name of the default profile.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string DefaultName = "default"

Field Value

Type: String
See Also

Reference

CachingProfile Class
PostSharp.Patterns.Caching Namespace


CachingServices Class

The entry point to configure PostSharp.Patterns.Caching at run-time.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.CachingCachingServices

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static class CachingServices

The CachingServices type exposes the following members.

Properties
Name | Description
CurrentContext | Gets the current caching context, so dependencies can be added.
DefaultBackend | Gets or sets the default CachingBackend, i.e. the physical storage of cache items.
DefaultKeyBuilder | Gets or sets the CacheKeyBuilder used to generate caching keys, i.e. to serialize objects into a String.
Profiles | Gets the repository of caching profiles (CachingProfile).
Top
See Also

Reference

PostSharp.Patterns.Caching Namespace


CachingServices Properties

The CachingServices type exposes the following members.

Properties
Name | Description
CurrentContext | Gets the current caching context, so dependencies can be added.
DefaultBackend | Gets or sets the default CachingBackend, i.e. the physical storage of cache items.
DefaultKeyBuilder | Gets or sets the CacheKeyBuilder used to generate caching keys, i.e. to serialize objects into a String.
Profiles | Gets the repository of caching profiles (CachingProfile).
Top
See Also

Reference

CachingServices Class
PostSharp.Patterns.Caching Namespace


CachingServices.CurrentContext Property

CachingServicesCurrentContext Property

Gets the current caching context, so dependencies can be added.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static ICachingContext CurrentContext { get; }

Property Value

Type: ICachingContext
See Also

Reference

CachingServices Class
PostSharp.Patterns.Caching Namespace


CachingServices.DefaultBackend Property

CachingServicesDefaultBackend Property

Gets or sets the default CachingBackend, i.e. the physical storage of cache items.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static CachingBackend DefaultBackend { get; set; }

Property Value

Type: CachingBackend
See Also

Reference

CachingServices Class
PostSharp.Patterns.Caching Namespace

Other Resources

Conceptual: Caching Method Return Values
Conceptual: Synchronizing Local In-Memory Caches for Multiple Servers
Conceptual: Using In-Memory Cache
Conceptual: Using Redis Cache


CachingServices.DefaultKeyBuilder Property

CachingServicesDefaultKeyBuilder Property

Gets or sets the CacheKeyBuilder used to generate caching keys, i.e. to serialize objects into a String.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static CacheKeyBuilder DefaultKeyBuilder { get; set; }

Property Value

Type: CacheKeyBuilder
See Also

Reference

CachingServices Class
PostSharp.Patterns.Caching Namespace

Other Resources

Conceptual: Customizing Cache Keys


CachingServices.Profiles Property

CachingServicesProfiles Property

Gets the repository of caching profiles (CachingProfile).

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static CachingServicesCachingProfileRegistry Profiles { get; }

Property Value

Type: CachingServicesCachingProfileRegistry
See Also

Reference

CachingServices Class
PostSharp.Patterns.Caching Namespace

Other Resources

Conceptual: Caching Method Return Values


CachingServices.CachingProfileRegistry Class

CachingServicesCachingProfileRegistry Class

Allows to configure caching profiles (CachingProfile), and therefore influence the behavior of the CacheAttribute aspect at run-time. Exposed on the Profiles property.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.CachingCachingServicesCachingProfileRegistry

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class CachingProfileRegistry

The CachingServicesCachingProfileRegistry type exposes the following members.

Properties
 | Name | Description
Public property | Default | Gets the default CachingProfile.
Public property | Item | Gets a CachingProfile of a given name. If no profile exists, a new profile is created, registered and returned.
Public property | RevisionNumber | Gets the revision number of all caching profiles. This property is incremented every time a profile is registered or modified.
Top
Methods
 | Name | Description
Public method | Register | Registers a CachingProfile.
Public method | Reset | Resets the current CachingServicesCachingProfileRegistry to the default values.
Top
See Also

Reference

PostSharp.Patterns.Caching Namespace


CachingProfileRegistry Properties

The CachingServicesCachingProfileRegistry type exposes the following members.

Properties
 | Name | Description
Public property | Default | Gets the default CachingProfile.
Public property | Item | Gets a CachingProfile of a given name. If no profile exists, a new profile is created, registered and returned.
Public property | RevisionNumber | Gets the revision number of all caching profiles. This property is incremented every time a profile is registered or modified.
Top
See Also

Reference

CachingServicesCachingProfileRegistry Class
PostSharp.Patterns.Caching Namespace


CachingServices.CachingProfileRegistry.Default Property

CachingServicesCachingProfileRegistryDefault Property

Gets the default CachingProfile.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CachingProfile Default { get; }

Property Value

Type: CachingProfile
See Also

Reference

CachingServicesCachingProfileRegistry Class
PostSharp.Patterns.Caching Namespace

Other Resources

Conceptual: Caching Method Return Values


CachingServices.CachingProfileRegistry.Item Property

CachingServicesCachingProfileRegistryItem Property

Gets a CachingProfile of a given name. If no profile exists, a new profile is created, registered and returned.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CachingProfile this[
    string profileName
] { get; }

Parameters

profileName
Type: SystemString
The profile name (a case-insensitive string).

Return Value

Type: CachingProfile
A CachingProfile object with name profileName.
See Also

Reference

CachingServicesCachingProfileRegistry Class
PostSharp.Patterns.Caching Namespace


CachingServices.CachingProfileRegistry.RevisionNumber Property

CachingServicesCachingProfileRegistryRevisionNumber Property

Gets the revision number of all caching profiles. This property is incremented every time a profile is registered or modified.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int RevisionNumber { get; }

Property Value

Type: Int32
See Also

Reference

CachingServicesCachingProfileRegistry Class
PostSharp.Patterns.Caching Namespace


CachingProfileRegistry Methods

The CachingServicesCachingProfileRegistry type exposes the following members.

Methods
 | Name | Description
Public method | Register | Registers a CachingProfile.
Public method | Reset | Resets the current CachingServicesCachingProfileRegistry to the default values.
Top
See Also

Reference

CachingServicesCachingProfileRegistry Class
PostSharp.Patterns.Caching Namespace


CachingServices.CachingProfileRegistry.Register Method

CachingServicesCachingProfileRegistryRegister Method

Registers a CachingProfile.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Register(
    CachingProfile profile
)

Parameters

profile
Type: PostSharp.Patterns.CachingCachingProfile
A CachingProfile.
See Also

Reference

CachingServicesCachingProfileRegistry Class
PostSharp.Patterns.Caching Namespace


CachingServices.CachingProfileRegistry.Reset Method

CachingServicesCachingProfileRegistryReset Method

Resets the current CachingServicesCachingProfileRegistry to the default values.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Reset()
See Also

Reference

CachingServicesCachingProfileRegistry Class
PostSharp.Patterns.Caching Namespace


CachingServices.Formatters Class

CachingServicesFormatters Class

Allows to get and register formatters used to generate caching keys.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.FormattersFormatterRepository CachingFormattingRole
PostSharp.Patterns.CachingCachingServicesFormatters

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class Formatters : FormatterRepository<CachingFormattingRole>
See Also

Reference

PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation Class

CachingServicesInvalidation Class

Invalidates the cache.
Invalidates the cache.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.CachingCachingServicesInvalidation

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static class Invalidation
Methods
Name | Description
Invalidate(Object) | Invalidates a cache dependency given an Object, i.e. removes all cached items that are dependent on that object.
Invalidate(String) | Invalidates a cache dependency given as String, i.e. removes all cache items that are dependent on this dependency key.
Invalidate(ICacheDependency) | Invalidates a cache dependency given as an ICacheDependency, i.e. removes all cache items that are dependent on this dependency.
Invalidate(MethodInfo, Object, Object) | Removes a method call result from the cache giving the MethodInfo representing the method, the instance and the arguments of the method call.
InvalidateTReturn(FuncTReturn) | Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 0 parameter.
InvalidateTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9) | Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 9 parameters.
InvalidateTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10) | Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 10 parameters.
InvalidateTReturn, TParam1(FuncTParam1, TReturn, TParam1) | Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 1 parameter.
InvalidateTReturn, TParam1, TParam2(FuncTParam1, TParam2, TReturn, TParam1, TParam2) | Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 2 parameters.
InvalidateTReturn, TParam1, TParam2, TParam3(FuncTParam1, TParam2, TParam3, TReturn, TParam1, TParam2, TParam3) | Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 3 parameters.
InvalidateTReturn, TParam1, TParam2, TParam3, TParam4(FuncTParam1, TParam2, TParam3, TParam4, TReturn, TParam1, TParam2, TParam3, TParam4) | Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 4 parameters.
InvalidateTReturn, TParam1, TParam2, TParam3, TParam4, TParam5(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5) | Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 5 parameters.
InvalidateTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6) | Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 6 parameters.
InvalidateTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7) | Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 7 parameters.
InvalidateTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8) | Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 8 parameters.
InvalidateAsync(Object) | Asynchronously invalidates a cache dependency given an Object, i.e. removes all cached items that are dependent on that object.
InvalidateAsync(String) | Asynchronously invalidates a cache dependency given as String, i.e. removes all cache items that are dependent on this dependency key.
InvalidateAsync(ICacheDependency) | Asynchronously invalidates a cache dependency given as an ICacheDependency, i.e. removes all cache items that are dependent on this dependency.
InvalidateAsync(MethodInfo, Object, Object) | Asynchronously removes a method call result from the cache giving the MethodInfo representing the method, the instance and the arguments of the method call.
InvalidateAsyncTReturn(FuncTReturn) | Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 0 parameter.
InvalidateAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9) | Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 9 parameters.
InvalidateAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10) | Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 10 parameters.
InvalidateAsyncTReturn, TParam1(FuncTParam1, TReturn, TParam1) | Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 1 parameter.
InvalidateAsyncTReturn, TParam1, TParam2(FuncTParam1, TParam2, TReturn, TParam1, TParam2) | Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 2 parameters.
InvalidateAsyncTReturn, TParam1, TParam2, TParam3(FuncTParam1, TParam2, TParam3, TReturn, TParam1, TParam2, TParam3) | Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 3 parameters.
InvalidateAsyncTReturn, TParam1, TParam2, TParam3, TParam4(FuncTParam1, TParam2, TParam3, TParam4, TReturn, TParam1, TParam2, TParam3, TParam4) | Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 4 parameters.
InvalidateAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5) | Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 5 parameters.
InvalidateAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6) | Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 6 parameters.
InvalidateAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7) | Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 7 parameters.
InvalidateAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8) | Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 8 parameters.
RecacheTReturn(FuncTReturn) | Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 0 parameter.
RecacheTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9) | Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 9 parameters.
RecacheTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10) | Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 10 parameters.
RecacheTReturn, TParam1(FuncTParam1, TReturn, TParam1) | Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 1 parameter.
RecacheTReturn, TParam1, TParam2(FuncTParam1, TParam2, TReturn, TParam1, TParam2) | Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 2 parameters.
RecacheTReturn, TParam1, TParam2, TParam3(FuncTParam1, TParam2, TParam3, TReturn, TParam1, TParam2, TParam3) | Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 3 parameters.
RecacheTReturn, TParam1, TParam2, TParam3, TParam4(FuncTParam1, TParam2, TParam3, TParam4, TReturn, TParam1, TParam2, TParam3, TParam4) | Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 4 parameters.
RecacheTReturn, TParam1, TParam2, TParam3, TParam4, TParam5(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5) | Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 5 parameters.
RecacheTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6) | Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 6 parameters.
RecacheTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7) | Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 7 parameters.
RecacheTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8) | Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 8 parameters.
RecacheAsyncTReturn(FuncTaskTReturn) | Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 0 parameter.
RecacheAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TaskTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9) | Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 9 parameters.
RecacheAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TaskTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10) | Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 10 parameters.
RecacheAsyncTReturn, TParam1(FuncTParam1, TaskTReturn, TParam1) | Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 1 parameter.
RecacheAsyncTReturn, TParam1, TParam2(FuncTParam1, TParam2, TaskTReturn, TParam1, TParam2) | Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 2 parameters.
RecacheAsyncTReturn, TParam1, TParam2, TParam3(FuncTParam1, TParam2, TParam3, TaskTReturn, TParam1, TParam2, TParam3) | Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 3 parameters.
RecacheAsyncTReturn, TParam1, TParam2, TParam3, TParam4(FuncTParam1, TParam2, TParam3, TParam4, TaskTReturn, TParam1, TParam2, TParam3, TParam4) | Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 4 parameters.
RecacheAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TaskTReturn, TParam1, TParam2, TParam3, TParam4, TParam5) | Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 5 parameters.
RecacheAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TaskTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6) | Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 6 parameters.
RecacheAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TaskTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7) | Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 7 parameters.
RecacheAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TaskTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8) | Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 8 parameters.
Top
See Also

Reference

PostSharp.Patterns.Caching Namespace

Other Resources

Conceptual: Caching


Invalidation Methods

Methods
Name | Description
Invalidate(Object) | Invalidates a cache dependency given an Object, i.e. removes all cached items that are dependent on that object.
Invalidate(String) | Invalidates a cache dependency given as String, i.e. removes all cache items that are dependent on this dependency key.
Invalidate(ICacheDependency) | Invalidates a cache dependency given as an ICacheDependency, i.e. removes all cache items that are dependent on this dependency.
Invalidate(MethodInfo, Object, Object) | Removes a method call result from the cache giving the MethodInfo representing the method, the instance and the arguments of the method call.
InvalidateTReturn(FuncTReturn) | Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 0 parameter.
InvalidateTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9) | Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 9 parameters.
InvalidateTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10) | Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 10 parameters.
InvalidateTReturn, TParam1(FuncTParam1, TReturn, TParam1) | Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 1 parameter.
InvalidateTReturn, TParam1, TParam2(FuncTParam1, TParam2, TReturn, TParam1, TParam2) | Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 2 parameters.
InvalidateTReturn, TParam1, TParam2, TParam3(FuncTParam1, TParam2, TParam3, TReturn, TParam1, TParam2, TParam3) | Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 3 parameters.
InvalidateTReturn, TParam1, TParam2, TParam3, TParam4(FuncTParam1, TParam2, TParam3, TParam4, TReturn, TParam1, TParam2, TParam3, TParam4) | Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 4 parameters.
InvalidateTReturn, TParam1, TParam2, TParam3, TParam4, TParam5(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5) | Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 5 parameters.
InvalidateTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6) | Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 6 parameters.
InvalidateTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7) | Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 7 parameters.
InvalidateTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8) | Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 8 parameters.
InvalidateAsync(Object) | Asynchronously invalidates a cache dependency given an Object, i.e. removes all cached items that are dependent on that object.
InvalidateAsync(String) | Asynchronously invalidates a cache dependency given as String, i.e. removes all cache items that are dependent on this dependency key.
InvalidateAsync(ICacheDependency) | Asynchronously invalidates a cache dependency given as an ICacheDependency, i.e. removes all cache items that are dependent on this dependency.
InvalidateAsync(MethodInfo, Object, Object) | Asynchronously removes a method call result from the cache giving the MethodInfo representing the method, the instance and the arguments of the method call.
InvalidateAsyncTReturn(FuncTReturn) | Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 0 parameter.
InvalidateAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9) | Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 9 parameters.
InvalidateAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10) | Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 10 parameters.
InvalidateAsyncTReturn, TParam1(FuncTParam1, TReturn, TParam1) | Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 1 parameter.
InvalidateAsyncTReturn, TParam1, TParam2(FuncTParam1, TParam2, TReturn, TParam1, TParam2) | Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 2 parameters.
InvalidateAsyncTReturn, TParam1, TParam2, TParam3(FuncTParam1, TParam2, TParam3, TReturn, TParam1, TParam2, TParam3) | Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 3 parameters.
InvalidateAsyncTReturn, TParam1, TParam2, TParam3, TParam4(FuncTParam1, TParam2, TParam3, TParam4, TReturn, TParam1, TParam2, TParam3, TParam4) | Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 4 parameters.
InvalidateAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5) | Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 5 parameters.
InvalidateAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6) | Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 6 parameters.
InvalidateAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7) | Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 7 parameters.
InvalidateAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8) | Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 8 parameters.
RecacheTReturn(FuncTReturn) | Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 0 parameter.
RecacheTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9) | Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 9 parameters.
RecacheTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10) | Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 10 parameters.
RecacheTReturn, TParam1(FuncTParam1, TReturn, TParam1) | Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 1 parameter.
RecacheTReturn, TParam1, TParam2(FuncTParam1, TParam2, TReturn, TParam1, TParam2) | Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 2 parameters.
RecacheTReturn, TParam1, TParam2, TParam3(FuncTParam1, TParam2, TParam3, TReturn, TParam1, TParam2, TParam3) | Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 3 parameters.
RecacheTReturn, TParam1, TParam2, TParam3, TParam4(FuncTParam1, TParam2, TParam3, TParam4, TReturn, TParam1, TParam2, TParam3, TParam4) | Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 4 parameters.
RecacheTReturn, TParam1, TParam2, TParam3, TParam4, TParam5(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5) | Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 5 parameters.
RecacheTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6) | Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 6 parameters.
RecacheTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7) | Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 7 parameters.
RecacheTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8) | Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 8 parameters.
RecacheAsyncTReturn(FuncTaskTReturn) | Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 0 parameter.
RecacheAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TaskTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9) | Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 9 parameters.
RecacheAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TaskTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10) | Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 10 parameters.
RecacheAsyncTReturn, TParam1(FuncTParam1, TaskTReturn, TParam1) | Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 1 parameter.
RecacheAsyncTReturn, TParam1, TParam2(FuncTParam1, TParam2, TaskTReturn, TParam1, TParam2) | Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 2 parameters.
RecacheAsyncTReturn, TParam1, TParam2, TParam3(FuncTParam1, TParam2, TParam3, TaskTReturn, TParam1, TParam2, TParam3) | Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 3 parameters.
RecacheAsyncTReturn, TParam1, TParam2, TParam3, TParam4(FuncTParam1, TParam2, TParam3, TParam4, TaskTReturn, TParam1, TParam2, TParam3, TParam4) | Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 4 parameters.
RecacheAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TaskTReturn, TParam1, TParam2, TParam3, TParam4, TParam5) | Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 5 parameters.
RecacheAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TaskTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6) | Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 6 parameters.
RecacheAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TaskTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7) | Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 7 parameters.
RecacheAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TaskTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8) | Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 8 parameters.
Top
See Also

Reference

CachingServicesInvalidation Class
PostSharp.Patterns.Caching Namespace


Invalidation.Invalidate Method

InvalidationInvalidate Method

Overload List
Name | Description
InvalidateTReturn(FuncTReturn) | Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 0 parameter.
Invalidate(Object) | Invalidates a cache dependency given an Object, i.e. removes all cached items that are dependent on that object.
Invalidate(String) | Invalidates a cache dependency given as String, i.e. removes all cache items that are dependent on this dependency key.
Invalidate(ICacheDependency) | Invalidates a cache dependency given as an ICacheDependency, i.e. removes all cache items that are dependent on this dependency.
InvalidateTReturn, TParam1(FuncTParam1, TReturn, TParam1) | Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 1 parameter.
InvalidateTReturn, TParam1, TParam2(FuncTParam1, TParam2, TReturn, TParam1, TParam2) | Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 2 parameters.
Invalidate(MethodInfo, Object, Object) | Removes a method call result from the cache giving the MethodInfo representing the method, the instance and the arguments of the method call.
InvalidateTReturn, TParam1, TParam2, TParam3(FuncTParam1, TParam2, TParam3, TReturn, TParam1, TParam2, TParam3) | Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 3 parameters.
InvalidateTReturn, TParam1, TParam2, TParam3, TParam4(FuncTParam1, TParam2, TParam3, TParam4, TReturn, TParam1, TParam2, TParam3, TParam4) | Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 4 parameters.
InvalidateTReturn, TParam1, TParam2, TParam3, TParam4, TParam5(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5) | Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 5 parameters.
InvalidateTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6) | Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 6 parameters.
InvalidateTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7) | Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 7 parameters.
InvalidateTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8) | Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 8 parameters.
InvalidateTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9) | Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 9 parameters.
InvalidateTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10) | Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 10 parameters.
Top
See Also

Reference

CachingServicesInvalidation Class
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.Invalidate(TReturn) Method (Func(TReturn))

CachingServicesInvalidationInvalidateTReturn Method (FuncTReturn)

Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 0 parameter.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void Invalidate<TReturn>(
    Func<TReturn> method
)

Parameters

method
Type: SystemFunc TReturn
A delegate of the method to invalidate.

Type Parameters

TReturn
The return type of the method.
See Also

Reference

CachingServicesInvalidation Class
Invalidate Overload
PostSharp.Patterns.Caching Namespace

Other Resources

Conceptual: Removing Items From the Cache


CachingServices.Invalidation.Invalidate Method (Object)

CachingServicesInvalidationInvalidate Method (Object)

Invalidates a cache dependency given an Object, i.e. removes all cached items that are dependent on that object.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void Invalidate(
    Object dependency
)

Parameters

dependency
Type: SystemObject
Typically, an Object. If a String, Delegate or ICacheDependency is passed, the proper overload of the method is invoked. Otherwise, dependency is wrapped into an ObjectDependency object.
See Also

Reference

CachingServicesInvalidation Class
Invalidate Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.Invalidate Method (String)

CachingServicesInvalidationInvalidate Method (String)

Invalidates a cache dependency given as String, i.e. removes all cache items that are dependent on this dependency key.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void Invalidate(
    string dependencyKey
)

Parameters

dependencyKey
Type: SystemString
See Also

Reference

CachingServicesInvalidation Class
Invalidate Overload
PostSharp.Patterns.Caching Namespace

Other Resources

Conceptual: Working with Cache Dependencies


CachingServices.Invalidation.Invalidate Method (ICacheDependency)

CachingServicesInvalidationInvalidate Method (ICacheDependency)

Invalidates a cache dependency given as an ICacheDependency, i.e. removes all cache items that are dependent on this dependency.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void Invalidate(
    ICacheDependency dependency
)

Parameters

dependency
Type: PostSharp.Patterns.Caching.DependenciesICacheDependency
A dependency.
See Also

Reference

CachingServicesInvalidation Class
Invalidate Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.Invalidate(TReturn, TParam1) Method (Func(TParam1, TReturn), TParam1)

CachingServicesInvalidationInvalidateTReturn, TParam1 Method (FuncTParam1, TReturn, TParam1)

Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 1 parameter.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void Invalidate<TReturn, TParam1>(
    Func<TParam1, TReturn> method,
    TParam1 arg1
)

Parameters

method
Type: SystemFunc TParam1, TReturn
A delegate of the method to invalidate.
arg1
Type: TParam1
Value of the first parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.
See Also

Reference

CachingServicesInvalidation Class
Invalidate Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.Invalidate(TReturn, TParam1, TParam2) Method (Func(TParam1, TParam2, TReturn), TParam1, TParam2)

CachingServicesInvalidationInvalidateTReturn, TParam1, TParam2 Method (FuncTParam1, TParam2, TReturn, TParam1, TParam2)

Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 2 parameters.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void Invalidate<TReturn, TParam1, TParam2>(
    Func<TParam1, TParam2, TReturn> method,
    TParam1 arg1,
    TParam2 arg2
)

Parameters

method
Type: SystemFunc TParam1, TParam2, TReturn
A delegate of the method to invalidate.
arg1
Type: TParam1
Value of the first parameter.
arg2
Type: TParam2
Value of the second parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.
TParam2
Type of the second parameter.
See Also

Reference

CachingServicesInvalidation Class
Invalidate Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.Invalidate Method (MethodInfo, Object, Object[])

CachingServicesInvalidationInvalidate Method (MethodInfo, Object, Object)

Removes a method call result from the cache giving the MethodInfo representing the method, the instance and the arguments of the method call.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void Invalidate(
    MethodInfo method,
    Object instance,
    params Object[] args
)

Parameters

method
Type: System.ReflectionMethodInfo
The MethodInfo of the method call.
instance
Type: SystemObject
The value of the this instance, or null for static methods.
args
Type: SystemObject
The method arguments.
See Also

Reference

CachingServicesInvalidation Class
Invalidate Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.Invalidate(TReturn, TParam1, TParam2, TParam3) Method (Func(TParam1, TParam2, TParam3, TReturn), TParam1, TParam2, TParam3)

CachingServicesInvalidationInvalidateTReturn, TParam1, TParam2, TParam3 Method (FuncTParam1, TParam2, TParam3, TReturn, TParam1, TParam2, TParam3)

Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 3 parameters.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void Invalidate<TReturn, TParam1, TParam2, TParam3>(
    Func<TParam1, TParam2, TParam3, TReturn> method,
    TParam1 arg1,
    TParam2 arg2,
    TParam3 arg3
)

Parameters

method
Type: SystemFunc TParam1, TParam2, TParam3, TReturn
A delegate of the method to invalidate.
arg1
Type: TParam1
Value of the first parameter.
arg2
Type: TParam2
Value of the second parameter.
arg3
Type: TParam3
Value of the third parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.
TParam2
Type of the second parameter.
TParam3
Type of the third parameter.
See Also

Reference

CachingServicesInvalidation Class
Invalidate Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.Invalidate(TReturn, TParam1, TParam2, TParam3, TParam4) Method (Func(TParam1, TParam2, TParam3, TParam4, TReturn), TParam1, TParam2, TParam3, TParam4)

CachingServicesInvalidationInvalidateTReturn, TParam1, TParam2, TParam3, TParam4 Method (FuncTParam1, TParam2, TParam3, TParam4, TReturn, TParam1, TParam2, TParam3, TParam4)

Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 4 parameters.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void Invalidate<TReturn, TParam1, TParam2, TParam3, TParam4>(
    Func<TParam1, TParam2, TParam3, TParam4, TReturn> method,
    TParam1 arg1,
    TParam2 arg2,
    TParam3 arg3,
    TParam4 arg4
)

Parameters

method
Type: SystemFunc TParam1, TParam2, TParam3, TParam4, TReturn
A delegate of the method to invalidate.
arg1
Type: TParam1
Value of the first parameter.
arg2
Type: TParam2
Value of the second parameter.
arg3
Type: TParam3
Value of the third parameter.
arg4
Type: TParam4
Value of the 4-th parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.
TParam2
Type of the second parameter.
TParam3
Type of the third parameter.
TParam4
Type of the 4-th parameter.
See Also

Reference

CachingServicesInvalidation Class
Invalidate Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.Invalidate(TReturn, TParam1, TParam2, TParam3, TParam4, TParam5) Method (Func(TParam1, TParam2, TParam3, TParam4, TParam5, TReturn), TParam1, TParam2, TParam3, TParam4, TParam5)

CachingServicesInvalidationInvalidateTReturn, TParam1, TParam2, TParam3, TParam4, TParam5 Method (FuncTParam1, TParam2, TParam3, TParam4, TParam5, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5)

Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 5 parameters.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void Invalidate<TReturn, TParam1, TParam2, TParam3, TParam4, TParam5>(
    Func<TParam1, TParam2, TParam3, TParam4, TParam5, TReturn> method,
    TParam1 arg1,
    TParam2 arg2,
    TParam3 arg3,
    TParam4 arg4,
    TParam5 arg5
)

Parameters

method
Type: SystemFunc TParam1, TParam2, TParam3, TParam4, TParam5, TReturn
A delegate of the method to invalidate.
arg1
Type: TParam1
Value of the first parameter.
arg2
Type: TParam2
Value of the second parameter.
arg3
Type: TParam3
Value of the third parameter.
arg4
Type: TParam4
Value of the 4-th parameter.
arg5
Type: TParam5
Value of the 5-th parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.
TParam2
Type of the second parameter.
TParam3
Type of the third parameter.
TParam4
Type of the 4-th parameter.
TParam5
Type of the 5-th parameter.
See Also

Reference

CachingServicesInvalidation Class
Invalidate Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.Invalidate(TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6) Method (Func(TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TReturn), TParam1, TParam2, TParam3, TParam4, TParam5, TParam6)

CachingServicesInvalidationInvalidateTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6 Method (FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6)

Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 6 parameters.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void Invalidate<TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6>(
    Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TReturn> method,
    TParam1 arg1,
    TParam2 arg2,
    TParam3 arg3,
    TParam4 arg4,
    TParam5 arg5,
    TParam6 arg6
)

Parameters

method
Type: SystemFunc TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TReturn
A delegate of the method to invalidate.
arg1
Type: TParam1
Value of the first parameter.
arg2
Type: TParam2
Value of the second parameter.
arg3
Type: TParam3
Value of the third parameter.
arg4
Type: TParam4
Value of the 4-th parameter.
arg5
Type: TParam5
Value of the 5-th parameter.
arg6
Type: TParam6
Value of the 6-th parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.
TParam2
Type of the second parameter.
TParam3
Type of the third parameter.
TParam4
Type of the 4-th parameter.
TParam5
Type of the 5-th parameter.
TParam6
Type of the 6-th parameter.
See Also

Reference

CachingServicesInvalidation Class
Invalidate Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.Invalidate(TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7) Method (Func(TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TReturn), TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7)

CachingServicesInvalidationInvalidateTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7 Method (FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7)

Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 7 parameters.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void Invalidate<TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7>(
    Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TReturn> method,
    TParam1 arg1,
    TParam2 arg2,
    TParam3 arg3,
    TParam4 arg4,
    TParam5 arg5,
    TParam6 arg6,
    TParam7 arg7
)

Parameters

method
Type: SystemFunc TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TReturn
A delegate of the method to invalidate.
arg1
Type: TParam1
Value of the first parameter.
arg2
Type: TParam2
Value of the second parameter.
arg3
Type: TParam3
Value of the third parameter.
arg4
Type: TParam4
Value of the 4-th parameter.
arg5
Type: TParam5
Value of the 5-th parameter.
arg6
Type: TParam6
Value of the 6-th parameter.
arg7
Type: TParam7
Value of the 7-th parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.
TParam2
Type of the second parameter.
TParam3
Type of the third parameter.
TParam4
Type of the 4-th parameter.
TParam5
Type of the 5-th parameter.
TParam6
Type of the 6-th parameter.
TParam7
Type of the 7-th parameter.
See Also

Reference

CachingServicesInvalidation Class
Invalidate Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.Invalidate(TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8) Method (Func(TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TReturn), TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8)

CachingServicesInvalidationInvalidateTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8 Method (FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8)

Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 8 parameters.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void Invalidate<TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8>(
    Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TReturn> method,
    TParam1 arg1,
    TParam2 arg2,
    TParam3 arg3,
    TParam4 arg4,
    TParam5 arg5,
    TParam6 arg6,
    TParam7 arg7,
    TParam8 arg8
)

Parameters

method
Type: SystemFunc TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TReturn
A delegate of the method to invalidate.
arg1
Type: TParam1
Value of the first parameter.
arg2
Type: TParam2
Value of the second parameter.
arg3
Type: TParam3
Value of the third parameter.
arg4
Type: TParam4
Value of the 4-th parameter.
arg5
Type: TParam5
Value of the 5-th parameter.
arg6
Type: TParam6
Value of the 6-th parameter.
arg7
Type: TParam7
Value of the 7-th parameter.
arg8
Type: TParam8
Value of the 8-th parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.
TParam2
Type of the second parameter.
TParam3
Type of the third parameter.
TParam4
Type of the 4-th parameter.
TParam5
Type of the 5-th parameter.
TParam6
Type of the 6-th parameter.
TParam7
Type of the 7-th parameter.
TParam8
Type of the 8-th parameter.
See Also

Reference

CachingServicesInvalidation Class
Invalidate Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.Invalidate(TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9) Method (Func(TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TReturn), TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TPa

CachingServicesInvalidationInvalidateTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9 Method (FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9)

Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 9 parameters.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void Invalidate<TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9>(
    Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TReturn> method,
    TParam1 arg1,
    TParam2 arg2,
    TParam3 arg3,
    TParam4 arg4,
    TParam5 arg5,
    TParam6 arg6,
    TParam7 arg7,
    TParam8 arg8,
    TParam9 arg9
)

Parameters

method
Type: SystemFunc TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TReturn
A delegate of the method to invalidate.
arg1
Type: TParam1
Value of the first parameter.
arg2
Type: TParam2
Value of the second parameter.
arg3
Type: TParam3
Value of the third parameter.
arg4
Type: TParam4
Value of the 4-th parameter.
arg5
Type: TParam5
Value of the 5-th parameter.
arg6
Type: TParam6
Value of the 6-th parameter.
arg7
Type: TParam7
Value of the 7-th parameter.
arg8
Type: TParam8
Value of the 8-th parameter.
arg9
Type: TParam9
Value of the 9-th parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.
TParam2
Type of the second parameter.
TParam3
Type of the third parameter.
TParam4
Type of the 4-th parameter.
TParam5
Type of the 5-th parameter.
TParam6
Type of the 6-th parameter.
TParam7
Type of the 7-th parameter.
TParam8
Type of the 8-th parameter.
TParam9
Type of the 9-th parameter.
See Also

Reference

CachingServicesInvalidation Class
Invalidate Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.Invalidate(TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10) Method (Func(TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TReturn), TParam1, TParam2, TParam3, TParam4, TParam5, T

CachingServicesInvalidationInvalidateTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10 Method (FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10)

Removes a method call result from the cache giving the delegate of the method. This overload is for methods with 10 parameters.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void Invalidate<TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10>(
    Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TReturn> method,
    TParam1 arg1,
    TParam2 arg2,
    TParam3 arg3,
    TParam4 arg4,
    TParam5 arg5,
    TParam6 arg6,
    TParam7 arg7,
    TParam8 arg8,
    TParam9 arg9,
    TParam10 arg10
)

Parameters

method
Type: SystemFunc TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TReturn
A delegate of the method to invalidate.
arg1
Type: TParam1
Value of the first parameter.
arg2
Type: TParam2
Value of the second parameter.
arg3
Type: TParam3
Value of the third parameter.
arg4
Type: TParam4
Value of the 4-th parameter.
arg5
Type: TParam5
Value of the 5-th parameter.
arg6
Type: TParam6
Value of the 6-th parameter.
arg7
Type: TParam7
Value of the 7-th parameter.
arg8
Type: TParam8
Value of the 8-th parameter.
arg9
Type: TParam9
Value of the 9-th parameter.
arg10
Type: TParam10
Value of the 10-th parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.
TParam2
Type of the second parameter.
TParam3
Type of the third parameter.
TParam4
Type of the 4-th parameter.
TParam5
Type of the 5-th parameter.
TParam6
Type of the 6-th parameter.
TParam7
Type of the 7-th parameter.
TParam8
Type of the 8-th parameter.
TParam9
Type of the 9-th parameter.
TParam10
Type of the 10-th parameter.
See Also

Reference

CachingServicesInvalidation Class
Invalidate Overload
PostSharp.Patterns.Caching Namespace


Invalidation.InvalidateAsync Method

InvalidationInvalidateAsync Method

Overload List
Name | Description
InvalidateAsyncTReturn(FuncTReturn) | Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 0 parameter.
InvalidateAsync(Object) | Asynchronously invalidates a cache dependency given an Object, i.e. removes all cached items that are dependent on that object.
InvalidateAsync(String) | Asynchronously invalidates a cache dependency given as String, i.e. removes all cache items that are dependent on this dependency key.
InvalidateAsync(ICacheDependency) | Asynchronously invalidates a cache dependency given as an ICacheDependency, i.e. removes all cache items that are dependent on this dependency.
InvalidateAsyncTReturn, TParam1(FuncTParam1, TReturn, TParam1) | Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 1 parameter.
InvalidateAsyncTReturn, TParam1, TParam2(FuncTParam1, TParam2, TReturn, TParam1, TParam2) | Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 2 parameters.
InvalidateAsync(MethodInfo, Object, Object) | Asynchronously removes a method call result from the cache giving the MethodInfo representing the method, the instance and the arguments of the method call.
InvalidateAsyncTReturn, TParam1, TParam2, TParam3(FuncTParam1, TParam2, TParam3, TReturn, TParam1, TParam2, TParam3) | Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 3 parameters.
InvalidateAsyncTReturn, TParam1, TParam2, TParam3, TParam4(FuncTParam1, TParam2, TParam3, TParam4, TReturn, TParam1, TParam2, TParam3, TParam4) | Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 4 parameters.
InvalidateAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5) | Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 5 parameters.
InvalidateAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6) | Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 6 parameters.
InvalidateAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7) | Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 7 parameters.
InvalidateAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8) | Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 8 parameters.
InvalidateAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9) | Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 9 parameters.
InvalidateAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10) | Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 10 parameters.
Top
See Also

Reference

CachingServicesInvalidation Class
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.InvalidateAsync(TReturn) Method (Func(TReturn))

CachingServicesInvalidationInvalidateAsyncTReturn Method (FuncTReturn)

Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 0 parameter.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Task InvalidateAsync<TReturn>(
    Func<TReturn> method
)

Parameters

method
Type: SystemFunc TReturn
A delegate of the method to invalidate.

Type Parameters

TReturn
The return type of the method.

Return Value

Type: Task
A Task.
See Also

Reference

CachingServicesInvalidation Class
InvalidateAsync Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.InvalidateAsync Method (Object)

CachingServicesInvalidationInvalidateAsync Method (Object)

Asynchronously invalidates a cache dependency given an Object, i.e. removes all cached items that are dependent on that object.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Task InvalidateAsync(
    Object dependency
)

Parameters

dependency
Type: SystemObject
Typically, an Object. If a String, Delegate or ICacheDependency is passed, the proper overload of the method is invoked. Otherwise, dependency is wrapped into an ObjectDependency object.

Return Value

Type: Task
A Task.
See Also

Reference

CachingServicesInvalidation Class
InvalidateAsync Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.InvalidateAsync Method (String)

CachingServicesInvalidationInvalidateAsync Method (String)

Asynchronously invalidates a cache dependency given as String, i.e. removes all cache items that are dependent on this dependency key.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Task InvalidateAsync(
    string dependencyKey
)

Parameters

dependencyKey
Type: SystemString

Return Value

Type: Task
See Also

Reference

CachingServicesInvalidation Class
InvalidateAsync Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.InvalidateAsync Method (ICacheDependency)

CachingServicesInvalidationInvalidateAsync Method (ICacheDependency)

Asynchronously invalidates a cache dependency given as an ICacheDependency, i.e. removes all cache items that are dependent on this dependency.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Task InvalidateAsync(
    ICacheDependency dependency
)

Parameters

dependency
Type: PostSharp.Patterns.Caching.DependenciesICacheDependency
A dependency.

Return Value

Type: Task
A Task.
See Also

Reference

CachingServicesInvalidation Class
InvalidateAsync Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.InvalidateAsync(TReturn, TParam1) Method (Func(TParam1, TReturn), TParam1)

CachingServicesInvalidationInvalidateAsyncTReturn, TParam1 Method (FuncTParam1, TReturn, TParam1)

Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 1 parameter.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Task InvalidateAsync<TReturn, TParam1>(
    Func<TParam1, TReturn> method,
    TParam1 arg1
)

Parameters

method
Type: SystemFunc TParam1, TReturn
A delegate of the method to invalidate.
arg1
Type: TParam1
Value of the first parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.

Return Value

Type: Task
A Task.
See Also

Reference

CachingServicesInvalidation Class
InvalidateAsync Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.InvalidateAsync(TReturn, TParam1, TParam2) Method (Func(TParam1, TParam2, TReturn), TParam1, TParam2)

CachingServicesInvalidationInvalidateAsyncTReturn, TParam1, TParam2 Method (FuncTParam1, TParam2, TReturn, TParam1, TParam2)

Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 2 parameters.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Task InvalidateAsync<TReturn, TParam1, TParam2>(
    Func<TParam1, TParam2, TReturn> method,
    TParam1 arg1,
    TParam2 arg2
)

Parameters

method
Type: SystemFunc TParam1, TParam2, TReturn
A delegate of the method to invalidate.
arg1
Type: TParam1
Value of the first parameter.
arg2
Type: TParam2
Value of the second parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.
TParam2
Type of the second parameter.

Return Value

Type: Task
A Task.
See Also

Reference

CachingServicesInvalidation Class
InvalidateAsync Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.InvalidateAsync Method (MethodInfo, Object, Object[])

CachingServicesInvalidationInvalidateAsync Method (MethodInfo, Object, Object)

Asynchronously removes a method call result from the cache giving the MethodInfo representing the method, the instance and the arguments of the method call.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Task InvalidateAsync(
    MethodInfo method,
    Object instance,
    params Object[] args
)

Parameters

method
Type: System.ReflectionMethodInfo
The MethodInfo of the method call.
instance
Type: SystemObject
The value of the this instance, or null for static methods.
args
Type: SystemObject
The method arguments.

Return Value

Type: Task
See Also

Reference

CachingServicesInvalidation Class
InvalidateAsync Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.InvalidateAsync(TReturn, TParam1, TParam2, TParam3) Method (Func(TParam1, TParam2, TParam3, TReturn), TParam1, TParam2, TParam3)

CachingServicesInvalidationInvalidateAsyncTReturn, TParam1, TParam2, TParam3 Method (FuncTParam1, TParam2, TParam3, TReturn, TParam1, TParam2, TParam3)

Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 3 parameters.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Task InvalidateAsync<TReturn, TParam1, TParam2, TParam3>(
    Func<TParam1, TParam2, TParam3, TReturn> method,
    TParam1 arg1,
    TParam2 arg2,
    TParam3 arg3
)

Parameters

method
Type: SystemFunc TParam1, TParam2, TParam3, TReturn
A delegate of the method to invalidate.
arg1
Type: TParam1
Value of the first parameter.
arg2
Type: TParam2
Value of the second parameter.
arg3
Type: TParam3
Value of the third parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.
TParam2
Type of the second parameter.
TParam3
Type of the third parameter.

Return Value

Type: Task
A Task.
See Also

Reference

CachingServicesInvalidation Class
InvalidateAsync Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.InvalidateAsync(TReturn, TParam1, TParam2, TParam3, TParam4) Method (Func(TParam1, TParam2, TParam3, TParam4, TReturn), TParam1, TParam2, TParam3, TParam4)

CachingServicesInvalidationInvalidateAsyncTReturn, TParam1, TParam2, TParam3, TParam4 Method (FuncTParam1, TParam2, TParam3, TParam4, TReturn, TParam1, TParam2, TParam3, TParam4)

Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 4 parameters.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Task InvalidateAsync<TReturn, TParam1, TParam2, TParam3, TParam4>(
    Func<TParam1, TParam2, TParam3, TParam4, TReturn> method,
    TParam1 arg1,
    TParam2 arg2,
    TParam3 arg3,
    TParam4 arg4
)

Parameters

method
Type: SystemFunc TParam1, TParam2, TParam3, TParam4, TReturn
A delegate of the method to invalidate.
arg1
Type: TParam1
Value of the first parameter.
arg2
Type: TParam2
Value of the second parameter.
arg3
Type: TParam3
Value of the third parameter.
arg4
Type: TParam4
Value of the 4-th parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.
TParam2
Type of the second parameter.
TParam3
Type of the third parameter.
TParam4
Type of the 4-th parameter.

Return Value

Type: Task
A Task.
See Also

Reference

CachingServicesInvalidation Class
InvalidateAsync Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.InvalidateAsync(TReturn, TParam1, TParam2, TParam3, TParam4, TParam5) Method (Func(TParam1, TParam2, TParam3, TParam4, TParam5, TReturn), TParam1, TParam2, TParam3, TParam4, TParam5)

CachingServicesInvalidationInvalidateAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5 Method (FuncTParam1, TParam2, TParam3, TParam4, TParam5, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5)

Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 5 parameters.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Task InvalidateAsync<TReturn, TParam1, TParam2, TParam3, TParam4, TParam5>(
    Func<TParam1, TParam2, TParam3, TParam4, TParam5, TReturn> method,
    TParam1 arg1,
    TParam2 arg2,
    TParam3 arg3,
    TParam4 arg4,
    TParam5 arg5
)

Parameters

method
Type: SystemFunc TParam1, TParam2, TParam3, TParam4, TParam5, TReturn
A delegate of the method to invalidate.
arg1
Type: TParam1
Value of the first parameter.
arg2
Type: TParam2
Value of the second parameter.
arg3
Type: TParam3
Value of the third parameter.
arg4
Type: TParam4
Value of the 4-th parameter.
arg5
Type: TParam5
Value of the 5-th parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.
TParam2
Type of the second parameter.
TParam3
Type of the third parameter.
TParam4
Type of the 4-th parameter.
TParam5
Type of the 5-th parameter.

Return Value

Type: Task
A Task.
See Also

Reference

CachingServicesInvalidation Class
InvalidateAsync Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.InvalidateAsync(TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6) Method (Func(TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TReturn), TParam1, TParam2, TParam3, TParam4, TParam5, TParam6)

CachingServicesInvalidationInvalidateAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6 Method (FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6)

Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 6 parameters.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Task InvalidateAsync<TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6>(
    Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TReturn> method,
    TParam1 arg1,
    TParam2 arg2,
    TParam3 arg3,
    TParam4 arg4,
    TParam5 arg5,
    TParam6 arg6
)

Parameters

method
Type: SystemFunc TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TReturn
A delegate of the method to invalidate.
arg1
Type: TParam1
Value of the first parameter.
arg2
Type: TParam2
Value of the second parameter.
arg3
Type: TParam3
Value of the third parameter.
arg4
Type: TParam4
Value of the 4-th parameter.
arg5
Type: TParam5
Value of the 5-th parameter.
arg6
Type: TParam6
Value of the 6-th parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.
TParam2
Type of the second parameter.
TParam3
Type of the third parameter.
TParam4
Type of the 4-th parameter.
TParam5
Type of the 5-th parameter.
TParam6
Type of the 6-th parameter.

Return Value

Type: Task
A Task.
See Also

Reference

CachingServicesInvalidation Class
InvalidateAsync Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.InvalidateAsync(TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7) Method (Func(TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TReturn), TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7)

CachingServicesInvalidationInvalidateAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7 Method (FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7)

Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 7 parameters.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Task InvalidateAsync<TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7>(
    Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TReturn> method,
    TParam1 arg1,
    TParam2 arg2,
    TParam3 arg3,
    TParam4 arg4,
    TParam5 arg5,
    TParam6 arg6,
    TParam7 arg7
)

Parameters

method
Type: SystemFunc TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TReturn
A delegate of the method to invalidate.
arg1
Type: TParam1
Value of the first parameter.
arg2
Type: TParam2
Value of the second parameter.
arg3
Type: TParam3
Value of the third parameter.
arg4
Type: TParam4
Value of the 4-th parameter.
arg5
Type: TParam5
Value of the 5-th parameter.
arg6
Type: TParam6
Value of the 6-th parameter.
arg7
Type: TParam7
Value of the 7-th parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.
TParam2
Type of the second parameter.
TParam3
Type of the third parameter.
TParam4
Type of the 4-th parameter.
TParam5
Type of the 5-th parameter.
TParam6
Type of the 6-th parameter.
TParam7
Type of the 7-th parameter.

Return Value

Type: Task
A Task.
See Also

Reference

CachingServicesInvalidation Class
InvalidateAsync Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.InvalidateAsync(TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8) Method (Func(TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TReturn), TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8)

CachingServicesInvalidationInvalidateAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8 Method (FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8)

Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 8 parameters.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Task InvalidateAsync<TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8>(
    Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TReturn> method,
    TParam1 arg1,
    TParam2 arg2,
    TParam3 arg3,
    TParam4 arg4,
    TParam5 arg5,
    TParam6 arg6,
    TParam7 arg7,
    TParam8 arg8
)

Parameters

method
Type: SystemFunc TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TReturn
A delegate of the method to invalidate.
arg1
Type: TParam1
Value of the first parameter.
arg2
Type: TParam2
Value of the second parameter.
arg3
Type: TParam3
Value of the third parameter.
arg4
Type: TParam4
Value of the 4-th parameter.
arg5
Type: TParam5
Value of the 5-th parameter.
arg6
Type: TParam6
Value of the 6-th parameter.
arg7
Type: TParam7
Value of the 7-th parameter.
arg8
Type: TParam8
Value of the 8-th parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.
TParam2
Type of the second parameter.
TParam3
Type of the third parameter.
TParam4
Type of the 4-th parameter.
TParam5
Type of the 5-th parameter.
TParam6
Type of the 6-th parameter.
TParam7
Type of the 7-th parameter.
TParam8
Type of the 8-th parameter.

Return Value

Type: Task
A Task.
See Also

Reference

CachingServicesInvalidation Class
InvalidateAsync Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.InvalidateAsync(TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9) Method (Func(TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TReturn), TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7

CachingServicesInvalidationInvalidateAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9 Method (FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9)

Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 9 parameters.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Task InvalidateAsync<TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9>(
    Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TReturn> method,
    TParam1 arg1,
    TParam2 arg2,
    TParam3 arg3,
    TParam4 arg4,
    TParam5 arg5,
    TParam6 arg6,
    TParam7 arg7,
    TParam8 arg8,
    TParam9 arg9
)

Parameters

method
Type: SystemFunc TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TReturn
A delegate of the method to invalidate.
arg1
Type: TParam1
Value of the first parameter.
arg2
Type: TParam2
Value of the second parameter.
arg3
Type: TParam3
Value of the third parameter.
arg4
Type: TParam4
Value of the 4-th parameter.
arg5
Type: TParam5
Value of the 5-th parameter.
arg6
Type: TParam6
Value of the 6-th parameter.
arg7
Type: TParam7
Value of the 7-th parameter.
arg8
Type: TParam8
Value of the 8-th parameter.
arg9
Type: TParam9
Value of the 9-th parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.
TParam2
Type of the second parameter.
TParam3
Type of the third parameter.
TParam4
Type of the 4-th parameter.
TParam5
Type of the 5-th parameter.
TParam6
Type of the 6-th parameter.
TParam7
Type of the 7-th parameter.
TParam8
Type of the 8-th parameter.
TParam9
Type of the 9-th parameter.

Return Value

Type: Task
A Task.
See Also

Reference

CachingServicesInvalidation Class
InvalidateAsync Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.InvalidateAsync(TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10) Method (Func(TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TReturn), TParam1, TParam2, TParam3, TParam4, TPara

CachingServicesInvalidationInvalidateAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10 Method (FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10)

Asynchronously removes a method call result from the cache giving the delegate of the method. This overload is for methods with 10 parameters.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Task InvalidateAsync<TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10>(
    Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TReturn> method,
    TParam1 arg1,
    TParam2 arg2,
    TParam3 arg3,
    TParam4 arg4,
    TParam5 arg5,
    TParam6 arg6,
    TParam7 arg7,
    TParam8 arg8,
    TParam9 arg9,
    TParam10 arg10
)

Parameters

method
Type: SystemFunc TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TReturn
A delegate of the method to invalidate.
arg1
Type: TParam1
Value of the first parameter.
arg2
Type: TParam2
Value of the second parameter.
arg3
Type: TParam3
Value of the third parameter.
arg4
Type: TParam4
Value of the 4-th parameter.
arg5
Type: TParam5
Value of the 5-th parameter.
arg6
Type: TParam6
Value of the 6-th parameter.
arg7
Type: TParam7
Value of the 7-th parameter.
arg8
Type: TParam8
Value of the 8-th parameter.
arg9
Type: TParam9
Value of the 9-th parameter.
arg10
Type: TParam10
Value of the 10-th parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.
TParam2
Type of the second parameter.
TParam3
Type of the third parameter.
TParam4
Type of the 4-th parameter.
TParam5
Type of the 5-th parameter.
TParam6
Type of the 6-th parameter.
TParam7
Type of the 7-th parameter.
TParam8
Type of the 8-th parameter.
TParam9
Type of the 9-th parameter.
TParam10
Type of the 10-th parameter.

Return Value

Type: Task
A Task.
See Also

Reference

CachingServicesInvalidation Class
InvalidateAsync Overload
PostSharp.Patterns.Caching Namespace


Invalidation.Recache Method

InvalidationRecache Method

Overload List
Name | Description
RecacheTReturn(FuncTReturn) | Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 0 parameter.
RecacheTReturn, TParam1(FuncTParam1, TReturn, TParam1) | Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 1 parameter.
RecacheTReturn, TParam1, TParam2(FuncTParam1, TParam2, TReturn, TParam1, TParam2) | Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 2 parameters.
RecacheTReturn, TParam1, TParam2, TParam3(FuncTParam1, TParam2, TParam3, TReturn, TParam1, TParam2, TParam3) | Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 3 parameters.
RecacheTReturn, TParam1, TParam2, TParam3, TParam4(FuncTParam1, TParam2, TParam3, TParam4, TReturn, TParam1, TParam2, TParam3, TParam4) | Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 4 parameters.
RecacheTReturn, TParam1, TParam2, TParam3, TParam4, TParam5(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5) | Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 5 parameters.
RecacheTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6) | Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 6 parameters.
RecacheTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7) | Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 7 parameters.
RecacheTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8) | Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 8 parameters.
RecacheTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9) | Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 9 parameters.
RecacheTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10) | Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 10 parameters.
Top
See Also

Reference

CachingServicesInvalidation Class
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.Recache(TReturn) Method (Func(TReturn))

CachingServicesInvalidationRecacheTReturn Method (FuncTReturn)

Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 0 parameter.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static TReturn Recache<TReturn>(
    Func<TReturn> method
)

Parameters

method
Type: SystemFunc TReturn
A delegate of the method to evaluate.

Type Parameters

TReturn
The return type of the method.

Return Value

Type: TReturn
The return value of method.
See Also

Reference

CachingServicesInvalidation Class
Recache Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.Recache(TReturn, TParam1) Method (Func(TParam1, TReturn), TParam1)

CachingServicesInvalidationRecacheTReturn, TParam1 Method (FuncTParam1, TReturn, TParam1)

Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 1 parameter.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static TReturn Recache<TReturn, TParam1>(
    Func<TParam1, TReturn> method,
    TParam1 arg1
)

Parameters

method
Type: SystemFunc TParam1, TReturn
A delegate of the method to evaluate.
arg1
Type: TParam1
Value of the first parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.

Return Value

Type: TReturn
The return value of method.
See Also

Reference

CachingServicesInvalidation Class
Recache Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.Recache(TReturn, TParam1, TParam2) Method (Func(TParam1, TParam2, TReturn), TParam1, TParam2)

CachingServicesInvalidationRecacheTReturn, TParam1, TParam2 Method (FuncTParam1, TParam2, TReturn, TParam1, TParam2)

Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 2 parameters.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static TReturn Recache<TReturn, TParam1, TParam2>(
    Func<TParam1, TParam2, TReturn> method,
    TParam1 arg1,
    TParam2 arg2
)

Parameters

method
Type: SystemFunc TParam1, TParam2, TReturn
A delegate of the method to evaluate.
arg1
Type: TParam1
Value of the first parameter.
arg2
Type: TParam2
Value of the second parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.
TParam2
Type of the second parameter.

Return Value

Type: TReturn
The return value of method.
See Also

Reference

CachingServicesInvalidation Class
Recache Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.Recache(TReturn, TParam1, TParam2, TParam3) Method (Func(TParam1, TParam2, TParam3, TReturn), TParam1, TParam2, TParam3)

CachingServicesInvalidationRecacheTReturn, TParam1, TParam2, TParam3 Method (FuncTParam1, TParam2, TParam3, TReturn, TParam1, TParam2, TParam3)

Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 3 parameters.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static TReturn Recache<TReturn, TParam1, TParam2, TParam3>(
    Func<TParam1, TParam2, TParam3, TReturn> method,
    TParam1 arg1,
    TParam2 arg2,
    TParam3 arg3
)

Parameters

method
Type: SystemFunc TParam1, TParam2, TParam3, TReturn
A delegate of the method to evaluate.
arg1
Type: TParam1
Value of the first parameter.
arg2
Type: TParam2
Value of the second parameter.
arg3
Type: TParam3
Value of the third parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.
TParam2
Type of the second parameter.
TParam3
Type of the third parameter.

Return Value

Type: TReturn
The return value of method.
See Also

Reference

CachingServicesInvalidation Class
Recache Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.Recache(TReturn, TParam1, TParam2, TParam3, TParam4) Method (Func(TParam1, TParam2, TParam3, TParam4, TReturn), TParam1, TParam2, TParam3, TParam4)

CachingServicesInvalidationRecacheTReturn, TParam1, TParam2, TParam3, TParam4 Method (FuncTParam1, TParam2, TParam3, TParam4, TReturn, TParam1, TParam2, TParam3, TParam4)

Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 4 parameters.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static TReturn Recache<TReturn, TParam1, TParam2, TParam3, TParam4>(
    Func<TParam1, TParam2, TParam3, TParam4, TReturn> method,
    TParam1 arg1,
    TParam2 arg2,
    TParam3 arg3,
    TParam4 arg4
)

Parameters

method
Type: SystemFunc TParam1, TParam2, TParam3, TParam4, TReturn
A delegate of the method to evaluate.
arg1
Type: TParam1
Value of the first parameter.
arg2
Type: TParam2
Value of the second parameter.
arg3
Type: TParam3
Value of the third parameter.
arg4
Type: TParam4
Value of the 4-th parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.
TParam2
Type of the second parameter.
TParam3
Type of the third parameter.
TParam4
Type of the 4-th parameter.

Return Value

Type: TReturn
The return value of method.
See Also

Reference

CachingServicesInvalidation Class
Recache Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.Recache(TReturn, TParam1, TParam2, TParam3, TParam4, TParam5) Method (Func(TParam1, TParam2, TParam3, TParam4, TParam5, TReturn), TParam1, TParam2, TParam3, TParam4, TParam5)

CachingServicesInvalidationRecacheTReturn, TParam1, TParam2, TParam3, TParam4, TParam5 Method (FuncTParam1, TParam2, TParam3, TParam4, TParam5, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5)

Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 5 parameters.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static TReturn Recache<TReturn, TParam1, TParam2, TParam3, TParam4, TParam5>(
    Func<TParam1, TParam2, TParam3, TParam4, TParam5, TReturn> method,
    TParam1 arg1,
    TParam2 arg2,
    TParam3 arg3,
    TParam4 arg4,
    TParam5 arg5
)

Parameters

method
Type: SystemFunc TParam1, TParam2, TParam3, TParam4, TParam5, TReturn
A delegate of the method to evaluate.
arg1
Type: TParam1
Value of the first parameter.
arg2
Type: TParam2
Value of the second parameter.
arg3
Type: TParam3
Value of the third parameter.
arg4
Type: TParam4
Value of the 4-th parameter.
arg5
Type: TParam5
Value of the 5-th parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.
TParam2
Type of the second parameter.
TParam3
Type of the third parameter.
TParam4
Type of the 4-th parameter.
TParam5
Type of the 5-th parameter.

Return Value

Type: TReturn
The return value of method.
See Also

Reference

CachingServicesInvalidation Class
Recache Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.Recache(TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6) Method (Func(TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TReturn), TParam1, TParam2, TParam3, TParam4, TParam5, TParam6)

CachingServicesInvalidationRecacheTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6 Method (FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6)

Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 6 parameters.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static TReturn Recache<TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6>(
    Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TReturn> method,
    TParam1 arg1,
    TParam2 arg2,
    TParam3 arg3,
    TParam4 arg4,
    TParam5 arg5,
    TParam6 arg6
)

Parameters

method
Type: SystemFunc TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TReturn
A delegate of the method to evaluate.
arg1
Type: TParam1
Value of the first parameter.
arg2
Type: TParam2
Value of the second parameter.
arg3
Type: TParam3
Value of the third parameter.
arg4
Type: TParam4
Value of the 4-th parameter.
arg5
Type: TParam5
Value of the 5-th parameter.
arg6
Type: TParam6
Value of the 6-th parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.
TParam2
Type of the second parameter.
TParam3
Type of the third parameter.
TParam4
Type of the 4-th parameter.
TParam5
Type of the 5-th parameter.
TParam6
Type of the 6-th parameter.

Return Value

Type: TReturn
The return value of method.
See Also

Reference

CachingServicesInvalidation Class
Recache Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.Recache(TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7) Method (Func(TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TReturn), TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7)

CachingServicesInvalidationRecacheTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7 Method (FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7)

Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 7 parameters.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static TReturn Recache<TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7>(
    Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TReturn> method,
    TParam1 arg1,
    TParam2 arg2,
    TParam3 arg3,
    TParam4 arg4,
    TParam5 arg5,
    TParam6 arg6,
    TParam7 arg7
)

Parameters

method
Type: SystemFunc TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TReturn
A delegate of the method to evaluate.
arg1
Type: TParam1
Value of the first parameter.
arg2
Type: TParam2
Value of the second parameter.
arg3
Type: TParam3
Value of the third parameter.
arg4
Type: TParam4
Value of the 4-th parameter.
arg5
Type: TParam5
Value of the 5-th parameter.
arg6
Type: TParam6
Value of the 6-th parameter.
arg7
Type: TParam7
Value of the 7-th parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.
TParam2
Type of the second parameter.
TParam3
Type of the third parameter.
TParam4
Type of the 4-th parameter.
TParam5
Type of the 5-th parameter.
TParam6
Type of the 6-th parameter.
TParam7
Type of the 7-th parameter.

Return Value

Type: TReturn
The return value of method.
See Also

Reference

CachingServicesInvalidation Class
Recache Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.Recache(TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8) Method (Func(TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TReturn), TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8)

CachingServicesInvalidationRecacheTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8 Method (FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8)

Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 8 parameters.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static TReturn Recache<TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8>(
    Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TReturn> method,
    TParam1 arg1,
    TParam2 arg2,
    TParam3 arg3,
    TParam4 arg4,
    TParam5 arg5,
    TParam6 arg6,
    TParam7 arg7,
    TParam8 arg8
)

Parameters

method
Type: SystemFunc TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TReturn
A delegate of the method to evaluate.
arg1
Type: TParam1
Value of the first parameter.
arg2
Type: TParam2
Value of the second parameter.
arg3
Type: TParam3
Value of the third parameter.
arg4
Type: TParam4
Value of the 4-th parameter.
arg5
Type: TParam5
Value of the 5-th parameter.
arg6
Type: TParam6
Value of the 6-th parameter.
arg7
Type: TParam7
Value of the 7-th parameter.
arg8
Type: TParam8
Value of the 8-th parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.
TParam2
Type of the second parameter.
TParam3
Type of the third parameter.
TParam4
Type of the 4-th parameter.
TParam5
Type of the 5-th parameter.
TParam6
Type of the 6-th parameter.
TParam7
Type of the 7-th parameter.
TParam8
Type of the 8-th parameter.

Return Value

Type: TReturn
The return value of method.
See Also

Reference

CachingServicesInvalidation Class
Recache Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.Recache(TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9) Method (Func(TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TReturn), TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam

CachingServicesInvalidationRecacheTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9 Method (FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9)

Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 9 parameters.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static TReturn Recache<TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9>(
    Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TReturn> method,
    TParam1 arg1,
    TParam2 arg2,
    TParam3 arg3,
    TParam4 arg4,
    TParam5 arg5,
    TParam6 arg6,
    TParam7 arg7,
    TParam8 arg8,
    TParam9 arg9
)

Parameters

method
Type: SystemFunc TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TReturn
A delegate of the method to evaluate.
arg1
Type: TParam1
Value of the first parameter.
arg2
Type: TParam2
Value of the second parameter.
arg3
Type: TParam3
Value of the third parameter.
arg4
Type: TParam4
Value of the 4-th parameter.
arg5
Type: TParam5
Value of the 5-th parameter.
arg6
Type: TParam6
Value of the 6-th parameter.
arg7
Type: TParam7
Value of the 7-th parameter.
arg8
Type: TParam8
Value of the 8-th parameter.
arg9
Type: TParam9
Value of the 9-th parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.
TParam2
Type of the second parameter.
TParam3
Type of the third parameter.
TParam4
Type of the 4-th parameter.
TParam5
Type of the 5-th parameter.
TParam6
Type of the 6-th parameter.
TParam7
Type of the 7-th parameter.
TParam8
Type of the 8-th parameter.
TParam9
Type of the 9-th parameter.

Return Value

Type: TReturn
The return value of method.
See Also

Reference

CachingServicesInvalidation Class
Recache Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.Recache(TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10) Method (Func(TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TReturn), TParam1, TParam2, TParam3, TParam4, TParam5, TPar

CachingServicesInvalidationRecacheTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10 Method (FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10)

Evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 10 parameters.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static TReturn Recache<TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10>(
    Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TReturn> method,
    TParam1 arg1,
    TParam2 arg2,
    TParam3 arg3,
    TParam4 arg4,
    TParam5 arg5,
    TParam6 arg6,
    TParam7 arg7,
    TParam8 arg8,
    TParam9 arg9,
    TParam10 arg10
)

Parameters

method
Type: SystemFunc TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TReturn
A delegate of the method to evaluate.
arg1
Type: TParam1
Value of the first parameter.
arg2
Type: TParam2
Value of the second parameter.
arg3
Type: TParam3
Value of the third parameter.
arg4
Type: TParam4
Value of the 4-th parameter.
arg5
Type: TParam5
Value of the 5-th parameter.
arg6
Type: TParam6
Value of the 6-th parameter.
arg7
Type: TParam7
Value of the 7-th parameter.
arg8
Type: TParam8
Value of the 8-th parameter.
arg9
Type: TParam9
Value of the 9-th parameter.
arg10
Type: TParam10
Value of the 10-th parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.
TParam2
Type of the second parameter.
TParam3
Type of the third parameter.
TParam4
Type of the 4-th parameter.
TParam5
Type of the 5-th parameter.
TParam6
Type of the 6-th parameter.
TParam7
Type of the 7-th parameter.
TParam8
Type of the 8-th parameter.
TParam9
Type of the 9-th parameter.
TParam10
Type of the 10-th parameter.

Return Value

Type: TReturn
The return value of method.
See Also

Reference

CachingServicesInvalidation Class
Recache Overload
PostSharp.Patterns.Caching Namespace


Invalidation.RecacheAsync Method

InvalidationRecacheAsync Method

Overload List
Name | Description
RecacheAsyncTReturn(FuncTaskTReturn) | Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 0 parameter.
RecacheAsyncTReturn, TParam1(FuncTParam1, TaskTReturn, TParam1) | Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 1 parameter.
RecacheAsyncTReturn, TParam1, TParam2(FuncTParam1, TParam2, TaskTReturn, TParam1, TParam2) | Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 2 parameters.
RecacheAsyncTReturn, TParam1, TParam2, TParam3(FuncTParam1, TParam2, TParam3, TaskTReturn, TParam1, TParam2, TParam3) | Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 3 parameters.
RecacheAsyncTReturn, TParam1, TParam2, TParam3, TParam4(FuncTParam1, TParam2, TParam3, TParam4, TaskTReturn, TParam1, TParam2, TParam3, TParam4) | Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 4 parameters.
RecacheAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TaskTReturn, TParam1, TParam2, TParam3, TParam4, TParam5) | Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 5 parameters.
RecacheAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TaskTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6) | Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 6 parameters.
RecacheAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TaskTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7) | Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 7 parameters.
RecacheAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TaskTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8) | Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 8 parameters.
RecacheAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TaskTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9) | Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 9 parameters.
RecacheAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10(FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TaskTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10) | Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 10 parameters.
Top
See Also

Reference

CachingServicesInvalidation Class
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.RecacheAsync(TReturn) Method (Func(Task(TReturn)))

CachingServicesInvalidationRecacheAsyncTReturn Method (FuncTaskTReturn)

Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 0 parameter.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Task<TReturn> RecacheAsync<TReturn>(
    Func<Task<TReturn>> method
)

Parameters

method
Type: SystemFunc Task TReturn
A delegate of the method to evaluate.

Type Parameters

TReturn
The return type of the method.

Return Value

Type: Task TReturn
A TaskTResult that evaluates to the return value of method.
See Also

Reference

CachingServicesInvalidation Class
RecacheAsync Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.RecacheAsync(TReturn, TParam1) Method (Func(TParam1, Task(TReturn)), TParam1)

CachingServicesInvalidationRecacheAsyncTReturn, TParam1 Method (FuncTParam1, TaskTReturn, TParam1)

Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 1 parameter.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Task<TReturn> RecacheAsync<TReturn, TParam1>(
    Func<TParam1, Task<TReturn>> method,
    TParam1 arg1
)

Parameters

method
Type: SystemFunc TParam1, Task TReturn
A delegate of the method to evaluate.
arg1
Type: TParam1
Value of the first parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.

Return Value

Type: Task TReturn
A TaskTResult that evaluates to the return value of method.
See Also

Reference

CachingServicesInvalidation Class
RecacheAsync Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.RecacheAsync(TReturn, TParam1, TParam2) Method (Func(TParam1, TParam2, Task(TReturn)), TParam1, TParam2)

CachingServicesInvalidationRecacheAsyncTReturn, TParam1, TParam2 Method (FuncTParam1, TParam2, TaskTReturn, TParam1, TParam2)

Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 2 parameters.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Task<TReturn> RecacheAsync<TReturn, TParam1, TParam2>(
    Func<TParam1, TParam2, Task<TReturn>> method,
    TParam1 arg1,
    TParam2 arg2
)

Parameters

method
Type: SystemFunc TParam1, TParam2, Task TReturn
A delegate of the method to evaluate.
arg1
Type: TParam1
Value of the first parameter.
arg2
Type: TParam2
Value of the second parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.
TParam2
Type of the second parameter.

Return Value

Type: Task TReturn
A TaskTResult that evaluates to the return value of method.
See Also

Reference

CachingServicesInvalidation Class
RecacheAsync Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.RecacheAsync(TReturn, TParam1, TParam2, TParam3) Method (Func(TParam1, TParam2, TParam3, Task(TReturn)), TParam1, TParam2, TParam3)

CachingServicesInvalidationRecacheAsyncTReturn, TParam1, TParam2, TParam3 Method (FuncTParam1, TParam2, TParam3, TaskTReturn, TParam1, TParam2, TParam3)

Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 3 parameters.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Task<TReturn> RecacheAsync<TReturn, TParam1, TParam2, TParam3>(
    Func<TParam1, TParam2, TParam3, Task<TReturn>> method,
    TParam1 arg1,
    TParam2 arg2,
    TParam3 arg3
)

Parameters

method
Type: SystemFunc TParam1, TParam2, TParam3, Task TReturn
A delegate of the method to evaluate.
arg1
Type: TParam1
Value of the first parameter.
arg2
Type: TParam2
Value of the second parameter.
arg3
Type: TParam3
Value of the third parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.
TParam2
Type of the second parameter.
TParam3
Type of the third parameter.

Return Value

Type: Task TReturn
A TaskTResult that evaluates to the return value of method.
See Also

Reference

CachingServicesInvalidation Class
RecacheAsync Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.RecacheAsync(TReturn, TParam1, TParam2, TParam3, TParam4) Method (Func(TParam1, TParam2, TParam3, TParam4, Task(TReturn)), TParam1, TParam2, TParam3, TParam4)

CachingServicesInvalidationRecacheAsyncTReturn, TParam1, TParam2, TParam3, TParam4 Method (FuncTParam1, TParam2, TParam3, TParam4, TaskTReturn, TParam1, TParam2, TParam3, TParam4)

Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 4 parameters.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Task<TReturn> RecacheAsync<TReturn, TParam1, TParam2, TParam3, TParam4>(
    Func<TParam1, TParam2, TParam3, TParam4, Task<TReturn>> method,
    TParam1 arg1,
    TParam2 arg2,
    TParam3 arg3,
    TParam4 arg4
)

Parameters

method
Type: SystemFunc TParam1, TParam2, TParam3, TParam4, Task TReturn
A delegate of the method to evaluate.
arg1
Type: TParam1
Value of the first parameter.
arg2
Type: TParam2
Value of the second parameter.
arg3
Type: TParam3
Value of the third parameter.
arg4
Type: TParam4
Value of the 4-th parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.
TParam2
Type of the second parameter.
TParam3
Type of the third parameter.
TParam4
Type of the 4-th parameter.

Return Value

Type: Task TReturn
A TaskTResult that evaluates to the return value of method.
See Also

Reference

CachingServicesInvalidation Class
RecacheAsync Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.RecacheAsync(TReturn, TParam1, TParam2, TParam3, TParam4, TParam5) Method (Func(TParam1, TParam2, TParam3, TParam4, TParam5, Task(TReturn)), TParam1, TParam2, TParam3, TParam4, TParam5)

CachingServicesInvalidationRecacheAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5 Method (FuncTParam1, TParam2, TParam3, TParam4, TParam5, TaskTReturn, TParam1, TParam2, TParam3, TParam4, TParam5)

Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 5 parameters.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Task<TReturn> RecacheAsync<TReturn, TParam1, TParam2, TParam3, TParam4, TParam5>(
    Func<TParam1, TParam2, TParam3, TParam4, TParam5, Task<TReturn>> method,
    TParam1 arg1,
    TParam2 arg2,
    TParam3 arg3,
    TParam4 arg4,
    TParam5 arg5
)

Parameters

method
Type: SystemFunc TParam1, TParam2, TParam3, TParam4, TParam5, Task TReturn
A delegate of the method to evaluate.
arg1
Type: TParam1
Value of the first parameter.
arg2
Type: TParam2
Value of the second parameter.
arg3
Type: TParam3
Value of the third parameter.
arg4
Type: TParam4
Value of the 4-th parameter.
arg5
Type: TParam5
Value of the 5-th parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.
TParam2
Type of the second parameter.
TParam3
Type of the third parameter.
TParam4
Type of the 4-th parameter.
TParam5
Type of the 5-th parameter.

Return Value

Type: Task TReturn
A TaskTResult that evaluates to the return value of method.
See Also

Reference

CachingServicesInvalidation Class
RecacheAsync Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.RecacheAsync(TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6) Method (Func(TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, Task(TReturn)), TParam1, TParam2, TParam3, TParam4, TParam5, TParam6)

CachingServicesInvalidationRecacheAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6 Method (FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TaskTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6)

Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 6 parameters.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Task<TReturn> RecacheAsync<TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6>(
    Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, Task<TReturn>> method,
    TParam1 arg1,
    TParam2 arg2,
    TParam3 arg3,
    TParam4 arg4,
    TParam5 arg5,
    TParam6 arg6
)

Parameters

method
Type: SystemFunc TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, Task TReturn
A delegate of the method to evaluate.
arg1
Type: TParam1
Value of the first parameter.
arg2
Type: TParam2
Value of the second parameter.
arg3
Type: TParam3
Value of the third parameter.
arg4
Type: TParam4
Value of the 4-th parameter.
arg5
Type: TParam5
Value of the 5-th parameter.
arg6
Type: TParam6
Value of the 6-th parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.
TParam2
Type of the second parameter.
TParam3
Type of the third parameter.
TParam4
Type of the 4-th parameter.
TParam5
Type of the 5-th parameter.
TParam6
Type of the 6-th parameter.

Return Value

Type: Task TReturn
A TaskTResult that evaluates to the return value of method.
See Also

Reference

CachingServicesInvalidation Class
RecacheAsync Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.RecacheAsync(TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7) Method (Func(TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, Task(TReturn)), TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7)

CachingServicesInvalidationRecacheAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7 Method (FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TaskTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7)

Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 7 parameters.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Task<TReturn> RecacheAsync<TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7>(
    Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, Task<TReturn>> method,
    TParam1 arg1,
    TParam2 arg2,
    TParam3 arg3,
    TParam4 arg4,
    TParam5 arg5,
    TParam6 arg6,
    TParam7 arg7
)

Parameters

method
Type: SystemFunc TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, Task TReturn
A delegate of the method to evaluate.
arg1
Type: TParam1
Value of the first parameter.
arg2
Type: TParam2
Value of the second parameter.
arg3
Type: TParam3
Value of the third parameter.
arg4
Type: TParam4
Value of the 4-th parameter.
arg5
Type: TParam5
Value of the 5-th parameter.
arg6
Type: TParam6
Value of the 6-th parameter.
arg7
Type: TParam7
Value of the 7-th parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.
TParam2
Type of the second parameter.
TParam3
Type of the third parameter.
TParam4
Type of the 4-th parameter.
TParam5
Type of the 5-th parameter.
TParam6
Type of the 6-th parameter.
TParam7
Type of the 7-th parameter.

Return Value

Type: Task TReturn
A TaskTResult that evaluates to the return value of method.
See Also

Reference

CachingServicesInvalidation Class
RecacheAsync Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.RecacheAsync(TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8) Method (Func(TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, Task(TReturn)), TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8)

CachingServicesInvalidationRecacheAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8 Method (FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TaskTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8)

Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 8 parameters.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Task<TReturn> RecacheAsync<TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8>(
    Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, Task<TReturn>> method,
    TParam1 arg1,
    TParam2 arg2,
    TParam3 arg3,
    TParam4 arg4,
    TParam5 arg5,
    TParam6 arg6,
    TParam7 arg7,
    TParam8 arg8
)

Parameters

method
Type: SystemFunc TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, Task TReturn
A delegate of the method to evaluate.
arg1
Type: TParam1
Value of the first parameter.
arg2
Type: TParam2
Value of the second parameter.
arg3
Type: TParam3
Value of the third parameter.
arg4
Type: TParam4
Value of the 4-th parameter.
arg5
Type: TParam5
Value of the 5-th parameter.
arg6
Type: TParam6
Value of the 6-th parameter.
arg7
Type: TParam7
Value of the 7-th parameter.
arg8
Type: TParam8
Value of the 8-th parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.
TParam2
Type of the second parameter.
TParam3
Type of the third parameter.
TParam4
Type of the 4-th parameter.
TParam5
Type of the 5-th parameter.
TParam6
Type of the 6-th parameter.
TParam7
Type of the 7-th parameter.
TParam8
Type of the 8-th parameter.

Return Value

Type: Task TReturn
A TaskTResult that evaluates to the return value of method.
See Also

Reference

CachingServicesInvalidation Class
RecacheAsync Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.RecacheAsync(TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9) Method (Func(TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, Task(TReturn)), TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TPar

CachingServicesInvalidationRecacheAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9 Method (FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TaskTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9)

Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 9 parameters.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Task<TReturn> RecacheAsync<TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9>(
    Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, Task<TReturn>> method,
    TParam1 arg1,
    TParam2 arg2,
    TParam3 arg3,
    TParam4 arg4,
    TParam5 arg5,
    TParam6 arg6,
    TParam7 arg7,
    TParam8 arg8,
    TParam9 arg9
)

Parameters

method
Type: SystemFunc TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, Task TReturn
A delegate of the method to evaluate.
arg1
Type: TParam1
Value of the first parameter.
arg2
Type: TParam2
Value of the second parameter.
arg3
Type: TParam3
Value of the third parameter.
arg4
Type: TParam4
Value of the 4-th parameter.
arg5
Type: TParam5
Value of the 5-th parameter.
arg6
Type: TParam6
Value of the 6-th parameter.
arg7
Type: TParam7
Value of the 7-th parameter.
arg8
Type: TParam8
Value of the 8-th parameter.
arg9
Type: TParam9
Value of the 9-th parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.
TParam2
Type of the second parameter.
TParam3
Type of the third parameter.
TParam4
Type of the 4-th parameter.
TParam5
Type of the 5-th parameter.
TParam6
Type of the 6-th parameter.
TParam7
Type of the 7-th parameter.
TParam8
Type of the 8-th parameter.
TParam9
Type of the 9-th parameter.

Return Value

Type: Task TReturn
A TaskTResult that evaluates to the return value of method.
See Also

Reference

CachingServicesInvalidation Class
RecacheAsync Overload
PostSharp.Patterns.Caching Namespace


CachingServices.Invalidation.RecacheAsync(TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10) Method (Func(TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, Task(TReturn)), TParam1, TParam2, TParam3, TParam4, TP

CachingServicesInvalidationRecacheAsyncTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10 Method (FuncTParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TaskTReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10)

Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 10 parameters.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Task<TReturn> RecacheAsync<TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10>(
    Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, Task<TReturn>> method,
    TParam1 arg1,
    TParam2 arg2,
    TParam3 arg3,
    TParam4 arg4,
    TParam5 arg5,
    TParam6 arg6,
    TParam7 arg7,
    TParam8 arg8,
    TParam9 arg9,
    TParam10 arg10
)

Parameters

method
Type: SystemFunc TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, Task TReturn
A delegate of the method to evaluate.
arg1
Type: TParam1
Value of the first parameter.
arg2
Type: TParam2
Value of the second parameter.
arg3
Type: TParam3
Value of the third parameter.
arg4
Type: TParam4
Value of the 4-th parameter.
arg5
Type: TParam5
Value of the 5-th parameter.
arg6
Type: TParam6
Value of the 6-th parameter.
arg7
Type: TParam7
Value of the 7-th parameter.
arg8
Type: TParam8
Value of the 8-th parameter.
arg9
Type: TParam9
Value of the 9-th parameter.
arg10
Type: TParam10
Value of the 10-th parameter.

Type Parameters

TReturn
The return type of the method.
TParam1
Type of the first parameter.
TParam2
Type of the second parameter.
TParam3
Type of the third parameter.
TParam4
Type of the 4-th parameter.
TParam5
Type of the 5-th parameter.
TParam6
Type of the 6-th parameter.
TParam7
Type of the 7-th parameter.
TParam8
Type of the 8-th parameter.
TParam9
Type of the 9-th parameter.
TParam10
Type of the 10-th parameter.

Return Value

Type: Task TReturn
A TaskTResult that evaluates to the return value of method.
See Also

Reference

CachingServicesInvalidation Class
RecacheAsync Overload
PostSharp.Patterns.Caching Namespace


ICachingContext Interface

Represents the context in which a method being cached is executing.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ICachingContext

The ICachingContext type exposes the following members.

Properties
 | Name | Description
Public property | Kind | Gets the kind of ICachingContext.
Public property | Parent | Gets the parent context.
Top
Methods
 | Name | Description
Public method | AddDependencies(IEnumerableString) | Adds a set of dependencies represented as keys to the current context.
Public method | AddDependencies(IEnumerableICacheDependency) | Adds a set of dependencies represented as ICacheDependency to the current context.
Public method | AddDependency(Object) | Adds a dependency Object the current context. Calling this method is equivalent to wrapping the Object into an ObjectDependency and calling the AddDependency(ICacheDependency) overload.
Public method | AddDependency(String) | Adds a dependency represented as a key to the current context.
Public method | AddDependency(ICacheDependency) | Adds a dependency represented as an ICacheDependency to the current context.
Top
See Also

Reference

PostSharp.Patterns.Caching Namespace


ICachingContext Properties

The ICachingContext type exposes the following members.

Properties
 | Name | Description
Public property | Kind | Gets the kind of ICachingContext.
Public property | Parent | Gets the parent context.
Top
See Also

Reference

ICachingContext Interface
PostSharp.Patterns.Caching Namespace


ICachingContext.Kind Property

ICachingContextKind Property

Gets the kind of ICachingContext.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
CachingContextKind Kind { get; }

Property Value

Type: CachingContextKind
See Also

Reference

ICachingContext Interface
PostSharp.Patterns.Caching Namespace


ICachingContext.Parent Property

ICachingContextParent Property

Gets the parent context.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
ICachingContext Parent { get; }

Property Value

Type: ICachingContext
See Also

Reference

ICachingContext Interface
PostSharp.Patterns.Caching Namespace


ICachingContext Methods

Methods
 | Name | Description
Public method | AddDependencies(IEnumerableString) | Adds a set of dependencies represented as keys to the current context.
Public method | AddDependencies(IEnumerableICacheDependency) | Adds a set of dependencies represented as ICacheDependency to the current context.
Public method | AddDependency(Object) | Adds a dependency Object the current context. Calling this method is equivalent to wrapping the Object into an ObjectDependency and calling the AddDependency(ICacheDependency) overload.
Public method | AddDependency(String) | Adds a dependency represented as a key to the current context.
Public method | AddDependency(ICacheDependency) | Adds a dependency represented as an ICacheDependency to the current context.
Top
See Also

Reference

ICachingContext Interface
PostSharp.Patterns.Caching Namespace


ICachingContext.AddDependencies Method

ICachingContextAddDependencies Method

Overload List
 | Name | Description
Public method | AddDependencies(IEnumerableString) | Adds a set of dependencies represented as keys to the current context.
Public method | AddDependencies(IEnumerableICacheDependency) | Adds a set of dependencies represented as ICacheDependency to the current context.
Top
See Also

Reference

ICachingContext Interface
PostSharp.Patterns.Caching Namespace


ICachingContext.AddDependencies Method (IEnumerable(String))

ICachingContextAddDependencies Method (IEnumerableString)

Adds a set of dependencies represented as keys to the current context.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void AddDependencies(
    IEnumerable<string> dependencies
)

Parameters

dependencies
Type: System.Collections.GenericIEnumerable String
A set of dependency keys.
See Also

Reference

ICachingContext Interface
AddDependencies Overload
PostSharp.Patterns.Caching Namespace


ICachingContext.AddDependencies Method (IEnumerable(ICacheDependency))

ICachingContextAddDependencies Method (IEnumerableICacheDependency)

Adds a set of dependencies represented as ICacheDependency to the current context.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void AddDependencies(
    IEnumerable<ICacheDependency> dependencies
)

Parameters

dependencies
Type: System.Collections.GenericIEnumerable ICacheDependency
A set of ICacheDependency.
See Also

Reference

ICachingContext Interface
AddDependencies Overload
PostSharp.Patterns.Caching Namespace


ICachingContext.AddDependency Method

ICachingContextAddDependency Method

Overload List
 | Name | Description
Public method | AddDependency(Object) | Adds a dependency Object the current context. Calling this method is equivalent to wrapping the Object into an ObjectDependency and calling the AddDependency(ICacheDependency) overload.
Public method | AddDependency(String) | Adds a dependency represented as a key to the current context.
Public method | AddDependency(ICacheDependency) | Adds a dependency represented as an ICacheDependency to the current context.
Top
See Also

Reference

ICachingContext Interface
PostSharp.Patterns.Caching Namespace


ICachingContext.AddDependency Method (Object)

ICachingContextAddDependency Method (Object)

Adds a dependency Object the current context. Calling this method is equivalent to wrapping the Object into an ObjectDependency and calling the AddDependency(ICacheDependency) overload.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void AddDependency(
    Object dependency
)

Parameters

dependency
Type: SystemObject
A dependency object.
See Also

Reference

ICachingContext Interface
AddDependency Overload
PostSharp.Patterns.Caching Namespace


ICachingContext.AddDependency Method (String)

ICachingContextAddDependency Method (String)

Adds a dependency represented as a key to the current context.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void AddDependency(
    string dependency
)

Parameters

dependency
Type: SystemString
A dependency key.
See Also

Reference

ICachingContext Interface
AddDependency Overload
PostSharp.Patterns.Caching Namespace

Other Resources

Conceptual: Working with Cache Dependencies


ICachingContext.AddDependency Method (ICacheDependency)

ICachingContextAddDependency Method (ICacheDependency)

Adds a dependency represented as an ICacheDependency to the current context.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void AddDependency(
    ICacheDependency dependency
)

Parameters

dependency
Type: PostSharp.Patterns.Caching.DependenciesICacheDependency
A dependency.
See Also

Reference

ICachingContext Interface
AddDependency Overload
PostSharp.Patterns.Caching Namespace


InvalidateCacheAttribute Class

Custom attribute that, when applied on a method, causes an invocation of this method to remove from the cache the result of invocations of other given methods with the same parameter values.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsMethodLevelAspect
PostSharp.AspectsMethodInterceptionAspect
PostSharp.Patterns.CachingInvalidateCacheAttribute

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class InvalidateCacheAttribute : MethodInterceptionAspect

The InvalidateCacheAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | InvalidateCacheAttribute(String) | Initializes a new InvalidateCacheAttribute that invalidates method of the same type as the type to which the current InvalidateCacheAttribute aspect is being applied.
Public method | InvalidateCacheAttribute(Type, String) | Initializes a new InvalidateCacheAttribute that invalidates method of a different type than the type to which the current InvalidateCacheAttribute aspect is being applied.
Top
Properties
 | Name | Description
Public property | AllowMultipleOverloads | Determines whether the current InvalidateCacheAttribute can match several overloads of the methods. The default value is false, which means that an error will be emitted if the current InvalidateCacheAttribute matches several methods of the same name.
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an async method with unsupported return value type. (Inherited from MethodInterceptionAspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Top
See Also

Reference

PostSharp.Patterns.Caching Namespace

Other Resources

Conceptual: Caching
Conceptual: Removing Items From the Cache


InvalidateCacheAttribute Constructor

Overload List
 | Name | Description
Public method | InvalidateCacheAttribute(String) | Initializes a new InvalidateCacheAttribute that invalidates method of the same type as the type to which the current InvalidateCacheAttribute aspect is being applied.
Public method | InvalidateCacheAttribute(Type, String) | Initializes a new InvalidateCacheAttribute that invalidates method of a different type than the type to which the current InvalidateCacheAttribute aspect is being applied.
Top
See Also

Reference

InvalidateCacheAttribute Class
PostSharp.Patterns.Caching Namespace


InvalidateCacheAttribute Constructor (String[])

InvalidateCacheAttribute Constructor (String)

Initializes a new InvalidateCacheAttribute that invalidates method of the same type as the type to which the current InvalidateCacheAttribute aspect is being applied.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public InvalidateCacheAttribute(
    params string[] methodNames
)

Parameters

methodNames
Type: SystemString
A list of names of methods to invalidate. All parameters of these methods (except those marked with NotCacheKeyAttribute) must have a parameter of the same name and compatible type in the target method of the current InvalidateCacheAttribute aspect.
See Also

Reference

InvalidateCacheAttribute Class
InvalidateCacheAttribute Overload
PostSharp.Patterns.Caching Namespace


InvalidateCacheAttribute Constructor (Type, String[])

InvalidateCacheAttribute Constructor (Type, String)

Initializes a new InvalidateCacheAttribute that invalidates method of a different type than the type to which the current InvalidateCacheAttribute aspect is being applied.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public InvalidateCacheAttribute(
    Type declaringType,
    params string[] methodNames
)

Parameters

declaringType
Type: SystemType
The type containing the methods to invalidate.
methodNames
Type: SystemString
A list of names of methods to invalidate. All parameters of these methods (except those marked with NotCacheKeyAttribute) must have a parameter of the same name and compatible type in the target method of the current InvalidateCacheAttribute aspect.
See Also

Reference

InvalidateCacheAttribute Class
InvalidateCacheAttribute Overload
PostSharp.Patterns.Caching Namespace


InvalidateCacheAttribute Properties

The InvalidateCacheAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AllowMultipleOverloads | Determines whether the current InvalidateCacheAttribute can match several overloads of the methods. The default value is false, which means that an error will be emitted if the current InvalidateCacheAttribute matches several methods of the same name.
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an async method with unsupported return value type. (Inherited from MethodInterceptionAspect.)
Top
See Also

Reference

InvalidateCacheAttribute Class
PostSharp.Patterns.Caching Namespace


InvalidateCacheAttribute.AllowMultipleOverloads Property

InvalidateCacheAttributeAllowMultipleOverloads Property

Determines whether the current InvalidateCacheAttribute can match several overloads of the methods. The default value is false, which means that an error will be emitted if the current InvalidateCacheAttribute matches several methods of the same name.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool AllowMultipleOverloads { get; set; }

Property Value

Type: Boolean
See Also

Reference

InvalidateCacheAttribute Class
PostSharp.Patterns.Caching Namespace

Other Resources

Conceptual: Removing Items From the Cache


InvalidateCacheAttribute Methods

The InvalidateCacheAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Top
See Also

Reference

InvalidateCacheAttribute Class
PostSharp.Patterns.Caching Namespace


InvalidCacheItemException Class

Exception thrown by a caching back-end during cache item retrieval (e.g. when the cached data cannot be serialized by the current object model). Throwing this exception causes removal of the invalid item.
Inheritance Hierarchy
SystemObject
SystemException
PostSharp.Patterns.CachingCachingException
PostSharp.Patterns.CachingInvalidCacheItemException

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public class InvalidCacheItemException : CachingException
Constructors
 | Name | Description
Public method | InvalidCacheItemException | Initializes a new InvalidCacheItemException with the default error message.
Public method | InvalidCacheItemException(String) | Initializes a new InvalidCacheItemException with a given error message.
Protected method | InvalidCacheItemException(SerializationInfo, StreamingContext) | Deserialization constructor.
Public method | InvalidCacheItemException(String, Exception) | Initializes a new InvalidCacheItemException with a given error message and inner Exception.
Top
See Also

Reference

PostSharp.Patterns.Caching Namespace


InvalidCacheItemException Constructor

Overload List
 | Name | Description
Public method | InvalidCacheItemException | Initializes a new InvalidCacheItemException with the default error message.
Public method | InvalidCacheItemException(String) | Initializes a new InvalidCacheItemException with a given error message.
Protected method | InvalidCacheItemException(SerializationInfo, StreamingContext) | Deserialization constructor.
Public method | InvalidCacheItemException(String, Exception) | Initializes a new InvalidCacheItemException with a given error message and inner Exception.
Top
See Also

Reference

InvalidCacheItemException Class
PostSharp.Patterns.Caching Namespace


InvalidCacheItemException Constructor

Initializes a new InvalidCacheItemException with the default error message.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public InvalidCacheItemException()
See Also

Reference

InvalidCacheItemException Class
InvalidCacheItemException Overload
PostSharp.Patterns.Caching Namespace


InvalidCacheItemException Constructor (String)

Initializes a new InvalidCacheItemException with a given error message.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public InvalidCacheItemException(
    string message
)

Parameters

message
Type: SystemString
The error message.
See Also

Reference

InvalidCacheItemException Class
InvalidCacheItemException Overload
PostSharp.Patterns.Caching Namespace


InvalidCacheItemException Constructor (SerializationInfo, StreamingContext)

Deserialization constructor.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected InvalidCacheItemException(
    SerializationInfo info,
    StreamingContext context
)

Parameters

info
Type: System.Runtime.SerializationSerializationInfo
context
Type: System.Runtime.SerializationStreamingContext
See Also

Reference

InvalidCacheItemException Class
InvalidCacheItemException Overload
PostSharp.Patterns.Caching Namespace


InvalidCacheItemException Constructor (String, Exception)

Initializes a new InvalidCacheItemException with a given error message and inner Exception.

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public InvalidCacheItemException(
    string message,
    Exception inner
)

Parameters

message
Type: SystemString
The error message.
inner
Type: SystemException
The inner exception.
See Also

Reference

InvalidCacheItemException Class
InvalidCacheItemException Overload
PostSharp.Patterns.Caching Namespace


NotCacheKeyAttribute Class

Custom attribute that, when applied to a parameter of a cached method (i.e. a method enhanced by the CacheAttribute aspect), excludes this parameter from being a part of the cache key.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Patterns.CachingNotCacheKeyAttribute

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class NotCacheKeyAttribute : Attribute

The NotCacheKeyAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | NotCacheKeyAttribute | Initializes a new instance of the NotCacheKeyAttribute class
Top
See Also

Reference

PostSharp.Patterns.Caching Namespace

Other Resources

Conceptual: Customizing Cache Keys
Conceptual: Removing Items From the Cache


NotCacheKeyAttribute Constructor

Initializes a new instance of the NotCacheKeyAttribute class

Namespace: PostSharp.Patterns.Caching
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public NotCacheKeyAttribute()
See Also

Reference

NotCacheKeyAttribute Class
PostSharp.Patterns.Caching Namespace


PostSharp.Patterns.Caching.Backends Namespace

Classes
 | Class | Description
Public class | MemoryCachingBackend | A CachingBackend based on the system MemoryCache.
Public class | NonBlockingCachingBackendEnhancer | A CachingBackendEnhancer that modifies all write operations to run in the background and immediately return to the caller.
Public class | NullCachingBackend | An implementation of CachingBackend that does not cache at all.
Public class | TwoLayerCachingBackendEnhancer | A CachingBackendEnhancer that adds a local (fast) MemoryCachingBackend to a remote (slower) cache. This class is typically instantiate in the back-end factory method. You should normally not use this class unless you develop a custom caching back-end.
Public class | TwoLayerCachingBackendEnhancerTwoLayerCacheValue | The object stored in the remote class.


MemoryCachingBackend Class

A CachingBackend based on the system MemoryCache.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Caching.ImplementationCachingBackend
PostSharp.Patterns.Caching.BackendsMemoryCachingBackend

Namespace: PostSharp.Patterns.Caching.Backends
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class MemoryCachingBackend : CachingBackend

The MemoryCachingBackend type exposes the following members.

Constructors
 | Name | Description
Public method | MemoryCachingBackend | Initializes a new MemoryCachingBackend based on the Default instance of the MemoryCache class.
Public method | MemoryCachingBackend(MemoryCache) | Initializes a new MemoryCachingBackend based on a given MemoryCache.
Top
Properties
 | Name | Description
Public property | Id | Gets the Guid of the current CachingBackend. (Inherited from CachingBackend.)
Public property | Status | Gets the status of the current CachingBackend (Default, Disposing or Disposed). (Inherited from CachingBackend.)
Public property | SupportedFeatures | Gets the set of features supported by the current CachingBackend. (Inherited from CachingBackend.)
Public property | ValueAdapters | Gets the factory of value adapters (IValueAdapter), which allow for instance to cache things like Stream or IEnumerable, which could not be otherwise cached. (Inherited from CachingBackend.)
Top
Methods
 | Name | Description
Public method | Clear | Clears the cache. (Inherited from CachingBackend.)
Public method | ClearAsync | Asynchronously clears the cache. (Inherited from CachingBackend.)
Public method | ContainsDependency | Determines whether the cache contains a given dependency. (Inherited from CachingBackend.)
Public method | ContainsDependencyAsync | Asynchronously determines whether the cache contains a given dependency. (Inherited from CachingBackend.)
Public method | ContainsItem | Determines whether the cache contains an item of a given key. (Inherited from CachingBackend.)
Public method | ContainsItemAsync | Asynchronously determines whether the cache contains an item of a given key. (Inherited from CachingBackend.)
Public method | Dispose | Synchronously disposes the current CachingBackend. (Inherited from CachingBackend.)
Public method | DisposeAsync | Asynchronously dispose the current CachingBackend. (Inherited from CachingBackend.)
Public method | GetItem | Gets a cache item given its key. (Inherited from CachingBackend.)
Public method | GetItemAsync | Asynchronously gets a cache item given its key. (Inherited from CachingBackend.)
Public method | InvalidateDependency | Removes from the cache all items that have a specific dependency. (Inherited from CachingBackend.)
Public method | InvalidateDependencyAsync | Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackend.)
Public method | RemoveItem | Removes a cache item from the cache given its key. (Inherited from CachingBackend.)
Public method | RemoveItemAsync | Asynchronously removes a cache item from the cache given its key. (Inherited from CachingBackend.)
Public method | SetItem | Sets a cache item. (Inherited from CachingBackend.)
Public method | SetItemAsync | Asynchronously sets a cache item. (Inherited from CachingBackend.)
Public method | ToString | Returns a string that represents the current object. (Inherited from CachingBackend.)
Public method | WhenBackgroundTasksCompleted | Returns a Task that is signaled to the complete state when all background tasks have completed. (Inherited from CachingBackend.)
Top
Events
 | Name | Description
Public event | DependencyInvalidated | Events raised when a dependency is invalidated. Check the Events property to see if the current CachingBackend supports events. (Inherited from CachingBackend.)
Public event | ItemRemoved | Event raised when a cache item is removed from the cache. Check the Events property to see if the current CachingBackend supports events. (Inherited from CachingBackend.)
Top
See Also

Reference

PostSharp.Patterns.Caching.Backends Namespace

Other Resources

Conceptual: Caching Back-Ends
Conceptual: Synchronizing Local In-Memory Caches for Multiple Servers
Conceptual: Using In-Memory Cache


MemoryCachingBackend Constructor

Overload List
 | Name | Description
Public method | MemoryCachingBackend | Initializes a new MemoryCachingBackend based on the Default instance of the MemoryCache class.
Public method | MemoryCachingBackend(MemoryCache) | Initializes a new MemoryCachingBackend based on a given MemoryCache.
Top
See Also

Reference

MemoryCachingBackend Class
PostSharp.Patterns.Caching.Backends Namespace


MemoryCachingBackend Constructor

Initializes a new MemoryCachingBackend based on the Default instance of the MemoryCache class.

Namespace: PostSharp.Patterns.Caching.Backends
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MemoryCachingBackend()
See Also

Reference

MemoryCachingBackend Class
MemoryCachingBackend Overload
PostSharp.Patterns.Caching.Backends Namespace


MemoryCachingBackend Constructor (MemoryCache)

Initializes a new MemoryCachingBackend based on a given MemoryCache.

Namespace: PostSharp.Patterns.Caching.Backends
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MemoryCachingBackend(
    MemoryCache cache
)

Parameters

cache
Type: System.Runtime.CachingMemoryCache
A MemoryCache, or null to use the Default instance of the MemoryCache class.
See Also

Reference

MemoryCachingBackend Class
MemoryCachingBackend Overload
PostSharp.Patterns.Caching.Backends Namespace


MemoryCachingBackend Properties

The MemoryCachingBackend type exposes the following members.

Properties
 | Name | Description
Public property | Id | Gets the Guid of the current CachingBackend. (Inherited from CachingBackend.)
Public property | Status | Gets the status of the current CachingBackend (Default, Disposing or Disposed). (Inherited from CachingBackend.)
Public property | SupportedFeatures | Gets the set of features supported by the current CachingBackend. (Inherited from CachingBackend.)
Public property | ValueAdapters | Gets the factory of value adapters (IValueAdapter), which allow for instance to cache things like Stream or IEnumerable, which could not be otherwise cached. (Inherited from CachingBackend.)
Top
See Also

Reference

MemoryCachingBackend Class
PostSharp.Patterns.Caching.Backends Namespace


MemoryCachingBackend Methods

The MemoryCachingBackend type exposes the following members.

Methods
 | Name | Description
Public method | Clear | Clears the cache. (Inherited from CachingBackend.)
Public method | ClearAsync | Asynchronously clears the cache. (Inherited from CachingBackend.)
Public method | ContainsDependency | Determines whether the cache contains a given dependency. (Inherited from CachingBackend.)
Public method | ContainsDependencyAsync | Asynchronously determines whether the cache contains a given dependency. (Inherited from CachingBackend.)
Public method | ContainsItem | Determines whether the cache contains an item of a given key. (Inherited from CachingBackend.)
Public method | ContainsItemAsync | Asynchronously determines whether the cache contains an item of a given key. (Inherited from CachingBackend.)
Public method | Dispose | Synchronously disposes the current CachingBackend. (Inherited from CachingBackend.)
Public method | DisposeAsync | Asynchronously dispose the current CachingBackend. (Inherited from CachingBackend.)
Public method | GetItem | Gets a cache item given its key. (Inherited from CachingBackend.)
Public method | GetItemAsync | Asynchronously gets a cache item given its key. (Inherited from CachingBackend.)
Public method | InvalidateDependency | Removes from the cache all items that have a specific dependency. (Inherited from CachingBackend.)
Public method | InvalidateDependencyAsync | Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackend.)
Public method | RemoveItem | Removes a cache item from the cache given its key. (Inherited from CachingBackend.)
Public method | RemoveItemAsync | Asynchronously removes a cache item from the cache given its key. (Inherited from CachingBackend.)
Public method | SetItem | Sets a cache item. (Inherited from CachingBackend.)
Public method | SetItemAsync | Asynchronously sets a cache item. (Inherited from CachingBackend.)
Public method | ToString | Returns a string that represents the current object. (Inherited from CachingBackend.)
Public method | WhenBackgroundTasksCompleted | Returns a Task that is signaled to the complete state when all background tasks have completed. (Inherited from CachingBackend.)
Top
See Also

Reference

MemoryCachingBackend Class
PostSharp.Patterns.Caching.Backends Namespace


MemoryCachingBackend Events

The MemoryCachingBackend type exposes the following members.

Events
 | Name | Description
Public event | DependencyInvalidated | Events raised when a dependency is invalidated. Check the Events property to see if the current CachingBackend supports events. (Inherited from CachingBackend.)
Public event | ItemRemoved | Event raised when a cache item is removed from the cache. Check the Events property to see if the current CachingBackend supports events. (Inherited from CachingBackend.)
Top
See Also

Reference

MemoryCachingBackend Class
PostSharp.Patterns.Caching.Backends Namespace


NonBlockingCachingBackendEnhancer Class

A CachingBackendEnhancer that modifies all write operations to run in the background and immediately return to the caller.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Caching.ImplementationCachingBackend
PostSharp.Patterns.Caching.ImplementationCachingBackendEnhancer
PostSharp.Patterns.Caching.BackendsNonBlockingCachingBackendEnhancer

Namespace: PostSharp.Patterns.Caching.Backends
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class NonBlockingCachingBackendEnhancer : CachingBackendEnhancer

The NonBlockingCachingBackendEnhancer type exposes the following members.

Constructors
 | Name | Description
Public method | NonBlockingCachingBackendEnhancer | Initializes a new CachingBackendEnhancer.
Top
Properties
 | Name | Description
Public property | Id | Gets the Guid of the current CachingBackend. (Inherited from CachingBackend.)
Protected property | Logger | Gets the Logger that implementations can use to emit log records. (Inherited from CachingBackend.)
Public property | Status | Gets the status of the current CachingBackend (Default, Disposing or Disposed). (Inherited from CachingBackend.)
Public property | SupportedFeatures | Gets the set of features supported by the current CachingBackend. (Inherited from CachingBackend.)
Public property | UnderlyingBackend | Gets the next CachingBackend in the chain of responsibility. (Inherited from CachingBackendEnhancer.)
Public property | ValueAdapters | Gets the factory of value adapters (IValueAdapter), which allow for instance to cache things like Stream or IEnumerable, which could not be otherwise cached. (Inherited from CachingBackend.)
Top
Methods
 | Name | Description
Public method | Clear | Clears the cache. (Inherited from CachingBackend.)
Public method | ClearAsync | Asynchronously clears the cache. (Inherited from CachingBackend.)
Protected method | ClearAsyncCore | Asynchronously clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Overrides CachingBackendEnhancerClearAsyncCore(CancellationToken).)
Protected method | ClearCore | Clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Overrides CachingBackendEnhancerClearCore.)
Public method | ContainsDependency | Determines whether the cache contains a given dependency. (Inherited from CachingBackend.)
Public method | ContainsDependencyAsync | Asynchronously determines whether the cache contains a given dependency. (Inherited from CachingBackend.)
Protected method | ContainsDependencyAsyncCore | Asynchronously determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Protected method | ContainsDependencyCore | Determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Public method | ContainsItem | Determines whether the cache contains an item of a given key. (Inherited from CachingBackend.)
Public method | ContainsItemAsync | Asynchronously determines whether the cache contains an item of a given key. (Inherited from CachingBackend.)
Protected method | ContainsItemAsyncCore | Asynchronously determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Protected method | ContainsItemCore | Determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Protected method | CreateFeatures | Creates a CachingBackendFeatures object, which describes set of features implemented by the back-end. This method is invoked the first time the SupportedFeatures property is evaluated. The result is then cached. (Overrides CachingBackendEnhancerCreateFeatures.)
Public method | Dispose | Synchronously disposes the current CachingBackend. (Inherited from CachingBackend.)
Protected method | Dispose(Boolean) | Synchronously disposes the current CachingBackend, with a parameter instructing whether this method is called because of a call to the Dispose method or because of object finalizing. (Inherited from CachingBackend.)
Public method | DisposeAsync | Asynchronously dispose the current CachingBackend. (Inherited from CachingBackend.)
Protected method | DisposeAsyncCore | Asynchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Overrides CachingBackendEnhancerDisposeAsyncCore(CancellationToken).)
Protected method | DisposeCore | Synchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Overrides CachingBackendEnhancerDisposeCore(Boolean).)
Public method | GetItem | Gets a cache item given its key. (Inherited from CachingBackend.)
Public method | GetItemAsync | Asynchronously gets a cache item given its key. (Inherited from CachingBackend.)
Protected method | GetItemAsyncCore | Asynchronously gets a cache item given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Protected method | GetItemCore | Gets a cache item given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Public method | InvalidateDependency | Removes from the cache all items that have a specific dependency. (Inherited from CachingBackend.)
Public method | InvalidateDependencyAsync | Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackend.)
Protected method | InvalidateDependencyAsyncCore | Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendEnhancerInvalidateDependencyAsyncCore(String, CancellationToken).)
Protected method | InvalidateDependencyCore | Removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendEnhancerInvalidateDependencyCore(String).)
Protected method | OnBackendDependencyInvalidated | Method invoked when the DependencyInvalidated event of the next UnderlyingBackend in the chain of responsibility is invoked. (Inherited from CachingBackendEnhancer.)
Protected method | OnBackendItemRemoved | Method invoked when the ItemRemoved event of the next UnderlyingBackend in the chain of responsibility is invoked. (Inherited from CachingBackendEnhancer.)
Protected method | OnDependencyInvalidated(CacheDependencyInvalidatedEventArgs) | Raises the DependencyInvalidated event given a CacheDependencyInvalidatedEventArgs. (Inherited from CachingBackend.)
Protected method | OnDependencyInvalidated(String, Guid) | Raises the DependencyInvalidated event , but lazily instantiates the CacheDependencyInvalidatedEventArgs if there is an event client. (Inherited from CachingBackend.)
Protected method | OnItemRemoved(CacheItemRemovedEventArgs) | Raises the ItemRemoved event given a CacheItemRemovedEventArgs. (Inherited from CachingBackend.)
Protected method | OnItemRemoved(String, CacheItemRemovedReason, Guid) | Raises the ItemRemoved event, but lazily instantiates the CacheItemRemovedEventArgs if there is an event client. (Inherited from CachingBackend.)
Public method | RemoveItem | Removes a cache item from the cache given its key. (Inherited from CachingBackend.)
Public method | RemoveItemAsync | Asynchronously removes a cache item from the cache given its key. (Inherited from CachingBackend.)
Protected method | RemoveItemAsyncCore | Asynchronously removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendEnhancerRemoveItemAsyncCore(String, CancellationToken).)
Protected method | RemoveItemCore | Removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendEnhancerRemoveItemCore(String).)
Public method | SetItem | Sets a cache item. (Inherited from CachingBackend.)
Public method | SetItemAsync | Asynchronously sets a cache item. (Inherited from CachingBackend.)
Protected method | SetItemAsyncCore | Asynchronously sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. The default implementation is to call the synchronous SetItemCore(String, CacheItem) method. (Overrides CachingBackendEnhancerSetItemAsyncCore(String, CacheItem, CancellationToken).)
Protected method | SetItemCore | Sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendEnhancerSetItemCore(String, CacheItem).)
Public method | ToString | Returns a string that represents the current object. (Inherited from CachingBackend.)
Public method | WhenBackgroundTasksCompleted | Returns a Task that is signaled to the complete state when all background tasks have completed. (Inherited from CachingBackend.)
Top
Events
 | Name | Description
Public event | DependencyInvalidated | Events raised when a dependency is invalidated. Check the Events property to see if the current CachingBackend supports events. (Inherited from CachingBackend.)
Public event | ItemRemoved | Event raised when a cache item is removed from the cache. Check the Events property to see if the current CachingBackend supports events. (Inherited from CachingBackend.)
Top
See Also

Reference

PostSharp.Patterns.Caching.Backends Namespace


NonBlockingCachingBackendEnhancer Constructor

Initializes a new CachingBackendEnhancer.

Namespace: PostSharp.Patterns.Caching.Backends
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public NonBlockingCachingBackendEnhancer(
    CachingBackend underlyingBackend
)

Parameters

underlyingBackend
Type: PostSharp.Patterns.Caching.ImplementationCachingBackend
The next CachingBackend in the chain of responsibility.
See Also

Reference

NonBlockingCachingBackendEnhancer Class
PostSharp.Patterns.Caching.Backends Namespace


NonBlockingCachingBackendEnhancer Properties

The NonBlockingCachingBackendEnhancer type exposes the following members.

Properties
 | Name | Description
Public property | Id | Gets the Guid of the current CachingBackend. (Inherited from CachingBackend.)
Protected property | Logger | Gets the Logger that implementations can use to emit log records. (Inherited from CachingBackend.)
Public property | Status | Gets the status of the current CachingBackend (Default, Disposing or Disposed). (Inherited from CachingBackend.)
Public property | SupportedFeatures | Gets the set of features supported by the current CachingBackend. (Inherited from CachingBackend.)
Public property | UnderlyingBackend | Gets the next CachingBackend in the chain of responsibility. (Inherited from CachingBackendEnhancer.)
Public property | ValueAdapters | Gets the factory of value adapters (IValueAdapter), which allow for instance to cache things like Stream or IEnumerable, which could not be otherwise cached. (Inherited from CachingBackend.)
Top
See Also

Reference

NonBlockingCachingBackendEnhancer Class
PostSharp.Patterns.Caching.Backends Namespace


NonBlockingCachingBackendEnhancer Methods

The NonBlockingCachingBackendEnhancer type exposes the following members.

Methods
 | Name | Description
Public method | Clear | Clears the cache. (Inherited from CachingBackend.)
Public method | ClearAsync | Asynchronously clears the cache. (Inherited from CachingBackend.)
Protected method | ClearAsyncCore | Asynchronously clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Overrides CachingBackendEnhancerClearAsyncCore(CancellationToken).)
Protected method | ClearCore | Clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Overrides CachingBackendEnhancerClearCore.)
Public method | ContainsDependency | Determines whether the cache contains a given dependency. (Inherited from CachingBackend.)
Public method | ContainsDependencyAsync | Asynchronously determines whether the cache contains a given dependency. (Inherited from CachingBackend.)
Protected method | ContainsDependencyAsyncCore | Asynchronously determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Protected method | ContainsDependencyCore | Determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Public method | ContainsItem | Determines whether the cache contains an item of a given key. (Inherited from CachingBackend.)
Public method | ContainsItemAsync | Asynchronously determines whether the cache contains an item of a given key. (Inherited from CachingBackend.)
Protected method | ContainsItemAsyncCore | Asynchronously determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Protected method | ContainsItemCore | Determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Protected method | CreateFeatures | Creates a CachingBackendFeatures object, which describes set of features implemented by the back-end. This method is invoked the first time the SupportedFeatures property is evaluated. The result is then cached. (Overrides CachingBackendEnhancerCreateFeatures.)
Public method | Dispose | Synchronously disposes the current CachingBackend. (Inherited from CachingBackend.)
Protected method | Dispose(Boolean) | Synchronously disposes the current CachingBackend, with a parameter instructing whether this method is called because of a call to the Dispose method or because of object finalizing. (Inherited from CachingBackend.)
Public method | DisposeAsync | Asynchronously dispose the current CachingBackend. (Inherited from CachingBackend.)
Protected method | DisposeAsyncCore | Asynchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Overrides CachingBackendEnhancerDisposeAsyncCore(CancellationToken).)
Protected method | DisposeCore | Synchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Overrides CachingBackendEnhancerDisposeCore(Boolean).)
Public method | GetItem | Gets a cache item given its key. (Inherited from CachingBackend.)
Public method | GetItemAsync | Asynchronously gets a cache item given its key. (Inherited from CachingBackend.)
Protected method | GetItemAsyncCore | Asynchronously gets a cache item given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Protected method | GetItemCore | Gets a cache item given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Public method | InvalidateDependency | Removes from the cache all items that have a specific dependency. (Inherited from CachingBackend.)
Public method | InvalidateDependencyAsync | Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackend.)
Protected method | InvalidateDependencyAsyncCore | Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendEnhancerInvalidateDependencyAsyncCore(String, CancellationToken).)
Protected method | InvalidateDependencyCore | Removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendEnhancerInvalidateDependencyCore(String).)
Protected method | OnBackendDependencyInvalidated | Method invoked when the DependencyInvalidated event of the next UnderlyingBackend in the chain of responsibility is invoked. (Inherited from CachingBackendEnhancer.)
Protected method | OnBackendItemRemoved | Method invoked when the ItemRemoved event of the next UnderlyingBackend in the chain of responsibility is invoked. (Inherited from CachingBackendEnhancer.)
Protected method | OnDependencyInvalidated(CacheDependencyInvalidatedEventArgs) | Raises the DependencyInvalidated event given a CacheDependencyInvalidatedEventArgs. (Inherited from CachingBackend.)
Protected method | OnDependencyInvalidated(String, Guid) | Raises the DependencyInvalidated event , but lazily instantiates the CacheDependencyInvalidatedEventArgs if there is an event client. (Inherited from CachingBackend.)
Protected method | OnItemRemoved(CacheItemRemovedEventArgs) | Raises the ItemRemoved event given a CacheItemRemovedEventArgs. (Inherited from CachingBackend.)
Protected method | OnItemRemoved(String, CacheItemRemovedReason, Guid) | Raises the ItemRemoved event, but lazily instantiates the CacheItemRemovedEventArgs if there is an event client. (Inherited from CachingBackend.)
Public method | RemoveItem | Removes a cache item from the cache given its key. (Inherited from CachingBackend.)
Public method | RemoveItemAsync | Asynchronously removes a cache item from the cache given its key. (Inherited from CachingBackend.)
Protected method | RemoveItemAsyncCore | Asynchronously removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendEnhancerRemoveItemAsyncCore(String, CancellationToken).)
Protected method | RemoveItemCore | Removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendEnhancerRemoveItemCore(String).)
Public method | SetItem | Sets a cache item. (Inherited from CachingBackend.)
Public method | SetItemAsync | Asynchronously sets a cache item. (Inherited from CachingBackend.)
Protected method | SetItemAsyncCore | Asynchronously sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. The default implementation is to call the synchronous SetItemCore(String, CacheItem) method. (Overrides CachingBackendEnhancerSetItemAsyncCore(String, CacheItem, CancellationToken).)
Protected method | SetItemCore | Sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendEnhancerSetItemCore(String, CacheItem).)
Public method | ToString | Returns a string that represents the current object. (Inherited from CachingBackend.)
Public method | WhenBackgroundTasksCompleted | Returns a Task that is signaled to the complete state when all background tasks have completed. (Inherited from CachingBackend.)
Top
See Also

Reference

NonBlockingCachingBackendEnhancer Class
PostSharp.Patterns.Caching.Backends Namespace


NonBlockingCachingBackendEnhancer.ClearAsyncCore Method

NonBlockingCachingBackendEnhancerClearAsyncCore Method

Asynchronously clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked.

Namespace: PostSharp.Patterns.Caching.Backends
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override Task ClearAsyncCore(
    CancellationToken cancellationToken
)

Parameters

cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task
A Task.
See Also

Reference

NonBlockingCachingBackendEnhancer Class
PostSharp.Patterns.Caching.Backends Namespace


NonBlockingCachingBackendEnhancer.ClearCore Method

NonBlockingCachingBackendEnhancerClearCore Method

Clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked.

Namespace: PostSharp.Patterns.Caching.Backends
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void ClearCore()
See Also

Reference

NonBlockingCachingBackendEnhancer Class
PostSharp.Patterns.Caching.Backends Namespace


NonBlockingCachingBackendEnhancer.CreateFeatures Method

NonBlockingCachingBackendEnhancerCreateFeatures Method

Creates a CachingBackendFeatures object, which describes set of features implemented by the back-end. This method is invoked the first time the SupportedFeatures property is evaluated. The result is then cached.

Namespace: PostSharp.Patterns.Caching.Backends
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override CachingBackendFeatures CreateFeatures()

Return Value

Type: CachingBackendFeatures
A new instance of the CachingBackendEnhancerFeatures class.
See Also

Reference

NonBlockingCachingBackendEnhancer Class
PostSharp.Patterns.Caching.Backends Namespace


NonBlockingCachingBackendEnhancer.DisposeAsyncCore Method

NonBlockingCachingBackendEnhancerDisposeAsyncCore Method

Asynchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked.

Namespace: PostSharp.Patterns.Caching.Backends
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override Task DisposeAsyncCore(
    CancellationToken cancellationToken
)

Parameters

cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task
A Task.
See Also

Reference

NonBlockingCachingBackendEnhancer Class
PostSharp.Patterns.Caching.Backends Namespace


NonBlockingCachingBackendEnhancer.DisposeCore Method

NonBlockingCachingBackendEnhancerDisposeCore Method

Synchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked.

Namespace: PostSharp.Patterns.Caching.Backends
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void DisposeCore(
    bool disposing
)

Parameters

disposing
Type: SystemBoolean
See Also

Reference

NonBlockingCachingBackendEnhancer Class
PostSharp.Patterns.Caching.Backends Namespace


NonBlockingCachingBackendEnhancer.InvalidateDependencyAsyncCore Method

NonBlockingCachingBackendEnhancerInvalidateDependencyAsyncCore Method

Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Backends
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override Task InvalidateDependencyAsyncCore(
    string key,
    CancellationToken cancellationToken
)

Parameters

key
Type: SystemString
The dependency key.
cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task
A Task.
See Also

Reference

NonBlockingCachingBackendEnhancer Class
PostSharp.Patterns.Caching.Backends Namespace


NonBlockingCachingBackendEnhancer.InvalidateDependencyCore Method

NonBlockingCachingBackendEnhancerInvalidateDependencyCore Method

Removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Backends
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void InvalidateDependencyCore(
    string key
)

Parameters

key
Type: SystemString
The dependency key.
See Also

Reference

NonBlockingCachingBackendEnhancer Class
PostSharp.Patterns.Caching.Backends Namespace


NonBlockingCachingBackendEnhancer.RemoveItemAsyncCore Method

NonBlockingCachingBackendEnhancerRemoveItemAsyncCore Method

Asynchronously removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Backends
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override Task RemoveItemAsyncCore(
    string key,
    CancellationToken cancellationToken
)

Parameters

key
Type: SystemString
The key of the cache item.
cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task
A Task.
See Also

Reference

NonBlockingCachingBackendEnhancer Class
PostSharp.Patterns.Caching.Backends Namespace


NonBlockingCachingBackendEnhancer.RemoveItemCore Method

NonBlockingCachingBackendEnhancerRemoveItemCore Method

Removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Backends
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void RemoveItemCore(
    string key
)

Parameters

key
Type: SystemString
The key of the cache item.
See Also

Reference

NonBlockingCachingBackendEnhancer Class
PostSharp.Patterns.Caching.Backends Namespace


NonBlockingCachingBackendEnhancer.SetItemAsyncCore Method

NonBlockingCachingBackendEnhancerSetItemAsyncCore Method

Asynchronously sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. The default implementation is to call the synchronous SetItemCore(String, CacheItem) method.

Namespace: PostSharp.Patterns.Caching.Backends
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override Task SetItemAsyncCore(
    string key,
    CacheItem item,
    CancellationToken cancellationToken
)

Parameters

key
Type: SystemString
The key of the cache item.
item
Type: PostSharp.Patterns.Caching.ImplementationCacheItem
The cache item.
cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task
A Task.
See Also

Reference

NonBlockingCachingBackendEnhancer Class
PostSharp.Patterns.Caching.Backends Namespace


NonBlockingCachingBackendEnhancer.SetItemCore Method

NonBlockingCachingBackendEnhancerSetItemCore Method

Sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Backends
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void SetItemCore(
    string key,
    CacheItem item
)

Parameters

key
Type: SystemString
The key of the cache item.
item
Type: PostSharp.Patterns.Caching.ImplementationCacheItem
The cache item.
See Also

Reference

NonBlockingCachingBackendEnhancer Class
PostSharp.Patterns.Caching.Backends Namespace


NonBlockingCachingBackendEnhancer Events

The NonBlockingCachingBackendEnhancer type exposes the following members.

Events
 | Name | Description
Public event | DependencyInvalidated | Events raised when a dependency is invalidated. Check the Events property to see if the current CachingBackend supports events. (Inherited from CachingBackend.)
Public event | ItemRemoved | Event raised when a cache item is removed from the cache. Check the Events property to see if the current CachingBackend supports events. (Inherited from CachingBackend.)
Top
See Also

Reference

NonBlockingCachingBackendEnhancer Class
PostSharp.Patterns.Caching.Backends Namespace


NullCachingBackend Class

An implementation of CachingBackend that does not cache at all.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Caching.ImplementationCachingBackend
PostSharp.Patterns.Caching.BackendsNullCachingBackend

Namespace: PostSharp.Patterns.Caching.Backends
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class NullCachingBackend : CachingBackend

The NullCachingBackend type exposes the following members.

Constructors
 | Name | Description
Public method | NullCachingBackend | Initializes a new instance of the NullCachingBackend class
Top
Properties
 | Name | Description
Public property | Id | Gets the Guid of the current CachingBackend. (Inherited from CachingBackend.)
Protected property | Logger | Gets the Logger that implementations can use to emit log records. (Inherited from CachingBackend.)
Public property | Status | Gets the status of the current CachingBackend (Default, Disposing or Disposed). (Inherited from CachingBackend.)
Public property | SupportedFeatures | Gets the set of features supported by the current CachingBackend. (Inherited from CachingBackend.)
Public property | ValueAdapters | Gets the factory of value adapters (IValueAdapter), which allow for instance to cache things like Stream or IEnumerable, which could not be otherwise cached. (Inherited from CachingBackend.)
Top
Methods
 | Name | Description
Public method | Clear | Clears the cache. (Inherited from CachingBackend.)
Public method | ClearAsync | Asynchronously clears the cache. (Inherited from CachingBackend.)
Protected method | ClearAsyncCore | Asynchronously clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Inherited from CachingBackend.)
Protected method | ClearCore | Clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Overrides CachingBackendClearCore.)
Public method | ContainsDependency | Determines whether the cache contains a given dependency. (Inherited from CachingBackend.)
Public method | ContainsDependencyAsync | Asynchronously determines whether the cache contains a given dependency. (Inherited from CachingBackend.)
Protected method | ContainsDependencyAsyncCore | Asynchronously determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackend.)
Protected method | ContainsDependencyCore | Determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendContainsDependencyCore(String).)
Public method | ContainsItem | Determines whether the cache contains an item of a given key. (Inherited from CachingBackend.)
Public method | ContainsItemAsync | Asynchronously determines whether the cache contains an item of a given key. (Inherited from CachingBackend.)
Protected method | ContainsItemAsyncCore | Asynchronously determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackend.)
Protected method | ContainsItemCore | Determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendContainsItemCore(String).)
Protected method | CreateFeatures | Creates a CachingBackendFeatures object, which describes set of features implemented by the back-end. This method is invoked the first time the SupportedFeatures property is evaluated. The result is then cached. (Inherited from CachingBackend.)
Public method | Dispose | Synchronously disposes the current CachingBackend. (Inherited from CachingBackend.)
Protected method | Dispose(Boolean) | Synchronously disposes the current CachingBackend, with a parameter instructing whether this method is called because of a call to the Dispose method or because of object finalizing. (Inherited from CachingBackend.)
Public method | DisposeAsync | Asynchronously dispose the current CachingBackend. (Inherited from CachingBackend.)
Protected method | DisposeAsyncCore | Asynchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Inherited from CachingBackend.)
Protected method | DisposeCore | Synchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Inherited from CachingBackend.)
Public method | GetItem | Gets a cache item given its key. (Inherited from CachingBackend.)
Public method | GetItemAsync | Asynchronously gets a cache item given its key. (Inherited from CachingBackend.)
Protected method | GetItemAsyncCore | Asynchronously gets a cache item given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackend.)
Protected method | GetItemCore | Gets a cache item given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendGetItemCore(String, Boolean).)
Public method | InvalidateDependency | Removes from the cache all items that have a specific dependency. (Inherited from CachingBackend.)
Public method | InvalidateDependencyAsync | Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackend.)
Protected method | InvalidateDependencyAsyncCore | Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackend.)
Protected method | InvalidateDependencyCore | Removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendInvalidateDependencyCore(String).)
Protected method | OnDependencyInvalidated(CacheDependencyInvalidatedEventArgs) | Raises the DependencyInvalidated event given a CacheDependencyInvalidatedEventArgs. (Inherited from CachingBackend.)
Protected method | OnDependencyInvalidated(String, Guid) | Raises the DependencyInvalidated event , but lazily instantiates the CacheDependencyInvalidatedEventArgs if there is an event client. (Inherited from CachingBackend.)
Protected method | OnItemRemoved(CacheItemRemovedEventArgs) | Raises the ItemRemoved event given a CacheItemRemovedEventArgs. (Inherited from CachingBackend.)
Protected method | OnItemRemoved(String, CacheItemRemovedReason, Guid) | Raises the ItemRemoved event, but lazily instantiates the CacheItemRemovedEventArgs if there is an event client. (Inherited from CachingBackend.)
Public method | RemoveItem | Removes a cache item from the cache given its key. (Inherited from CachingBackend.)
Public method | RemoveItemAsync | Asynchronously removes a cache item from the cache given its key. (Inherited from CachingBackend.)
Protected method | RemoveItemAsyncCore | Asynchronously removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackend.)
Protected method | RemoveItemCore | Removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendRemoveItemCore(String).)
Public method | SetItem | Sets a cache item. (Inherited from CachingBackend.)
Public method | SetItemAsync | Asynchronously sets a cache item. (Inherited from CachingBackend.)
Protected method | SetItemAsyncCore | Asynchronously sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. The default implementation is to call the synchronous SetItemCore(String, CacheItem) method. (Inherited from CachingBackend.)
Protected method | SetItemCore | Sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendSetItemCore(String, CacheItem).)
Public method | ToString | Returns a string that represents the current object. (Inherited from CachingBackend.)
Public method | WhenBackgroundTasksCompleted | Returns a Task that is signaled to the complete state when all background tasks have completed. (Inherited from CachingBackend.)
Top
Events
 | Name | Description
Public event | DependencyInvalidated | Events raised when a dependency is invalidated. Check the Events property to see if the current CachingBackend supports events. (Inherited from CachingBackend.)
Public event | ItemRemoved | Event raised when a cache item is removed from the cache. Check the Events property to see if the current CachingBackend supports events. (Inherited from CachingBackend.)
Top
See Also

Reference

PostSharp.Patterns.Caching.Backends Namespace


NullCachingBackend Constructor

Initializes a new instance of the NullCachingBackend class

Namespace: PostSharp.Patterns.Caching.Backends
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public NullCachingBackend()
See Also

Reference

NullCachingBackend Class
PostSharp.Patterns.Caching.Backends Namespace


NullCachingBackend Properties

The NullCachingBackend type exposes the following members.

Properties
 | Name | Description
Public property | Id | Gets the Guid of the current CachingBackend. (Inherited from CachingBackend.)
Protected property | Logger | Gets the Logger that implementations can use to emit log records. (Inherited from CachingBackend.)
Public property | Status | Gets the status of the current CachingBackend (Default, Disposing or Disposed). (Inherited from CachingBackend.)
Public property | SupportedFeatures | Gets the set of features supported by the current CachingBackend. (Inherited from CachingBackend.)
Public property | ValueAdapters | Gets the factory of value adapters (IValueAdapter), which allow for instance to cache things like Stream or IEnumerable, which could not be otherwise cached. (Inherited from CachingBackend.)
Top
See Also

Reference

NullCachingBackend Class
PostSharp.Patterns.Caching.Backends Namespace


NullCachingBackend Methods

The NullCachingBackend type exposes the following members.

Methods
 | Name | Description
Public method | Clear | Clears the cache. (Inherited from CachingBackend.)
Public method | ClearAsync | Asynchronously clears the cache. (Inherited from CachingBackend.)
Protected method | ClearAsyncCore | Asynchronously clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Inherited from CachingBackend.)
Protected method | ClearCore | Clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Overrides CachingBackendClearCore.)
Public method | ContainsDependency | Determines whether the cache contains a given dependency. (Inherited from CachingBackend.)
Public method | ContainsDependencyAsync | Asynchronously determines whether the cache contains a given dependency. (Inherited from CachingBackend.)
Protected method | ContainsDependencyAsyncCore | Asynchronously determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackend.)
Protected method | ContainsDependencyCore | Determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendContainsDependencyCore(String).)
Public method | ContainsItem | Determines whether the cache contains an item of a given key. (Inherited from CachingBackend.)
Public method | ContainsItemAsync | Asynchronously determines whether the cache contains an item of a given key. (Inherited from CachingBackend.)
Protected method | ContainsItemAsyncCore | Asynchronously determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackend.)
Protected method | ContainsItemCore | Determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendContainsItemCore(String).)
Protected method | CreateFeatures | Creates a CachingBackendFeatures object, which describes set of features implemented by the back-end. This method is invoked the first time the SupportedFeatures property is evaluated. The result is then cached. (Inherited from CachingBackend.)
Public method | Dispose | Synchronously disposes the current CachingBackend. (Inherited from CachingBackend.)
Protected method | Dispose(Boolean) | Synchronously disposes the current CachingBackend, with a parameter instructing whether this method is called because of a call to the Dispose method or because of object finalizing. (Inherited from CachingBackend.)
Public method | DisposeAsync | Asynchronously dispose the current CachingBackend. (Inherited from CachingBackend.)
Protected method | DisposeAsyncCore | Asynchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Inherited from CachingBackend.)
Protected method | DisposeCore | Synchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Inherited from CachingBackend.)
Public method | GetItem | Gets a cache item given its key. (Inherited from CachingBackend.)
Public method | GetItemAsync | Asynchronously gets a cache item given its key. (Inherited from CachingBackend.)
Protected method | GetItemAsyncCore | Asynchronously gets a cache item given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackend.)
Protected method | GetItemCore | Gets a cache item given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendGetItemCore(String, Boolean).)
Public method | InvalidateDependency | Removes from the cache all items that have a specific dependency. (Inherited from CachingBackend.)
Public method | InvalidateDependencyAsync | Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackend.)
Protected method | InvalidateDependencyAsyncCore | Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackend.)
Protected method | InvalidateDependencyCore | Removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendInvalidateDependencyCore(String).)
Protected method | OnDependencyInvalidated(CacheDependencyInvalidatedEventArgs) | Raises the DependencyInvalidated event given a CacheDependencyInvalidatedEventArgs. (Inherited from CachingBackend.)
Protected method | OnDependencyInvalidated(String, Guid) | Raises the DependencyInvalidated event , but lazily instantiates the CacheDependencyInvalidatedEventArgs if there is an event client. (Inherited from CachingBackend.)
Protected method | OnItemRemoved(CacheItemRemovedEventArgs) | Raises the ItemRemoved event given a CacheItemRemovedEventArgs. (Inherited from CachingBackend.)
Protected method | OnItemRemoved(String, CacheItemRemovedReason, Guid) | Raises the ItemRemoved event, but lazily instantiates the CacheItemRemovedEventArgs if there is an event client. (Inherited from CachingBackend.)
Public method | RemoveItem | Removes a cache item from the cache given its key. (Inherited from CachingBackend.)
Public method | RemoveItemAsync | Asynchronously removes a cache item from the cache given its key. (Inherited from CachingBackend.)
Protected method | RemoveItemAsyncCore | Asynchronously removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackend.)
Protected method | RemoveItemCore | Removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendRemoveItemCore(String).)
Public method | SetItem | Sets a cache item. (Inherited from CachingBackend.)
Public method | SetItemAsync | Asynchronously sets a cache item. (Inherited from CachingBackend.)
Protected method | SetItemAsyncCore | Asynchronously sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. The default implementation is to call the synchronous SetItemCore(String, CacheItem) method. (Inherited from CachingBackend.)
Protected method | SetItemCore | Sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendSetItemCore(String, CacheItem).)
Public method | ToString | Returns a string that represents the current object. (Inherited from CachingBackend.)
Public method | WhenBackgroundTasksCompleted | Returns a Task that is signaled to the complete state when all background tasks have completed. (Inherited from CachingBackend.)
Top
See Also

Reference

NullCachingBackend Class
PostSharp.Patterns.Caching.Backends Namespace


NullCachingBackend.ClearCore Method

NullCachingBackendClearCore Method

Clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked.

Namespace: PostSharp.Patterns.Caching.Backends
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void ClearCore()
See Also

Reference

NullCachingBackend Class
PostSharp.Patterns.Caching.Backends Namespace


NullCachingBackend.ContainsDependencyCore Method

NullCachingBackendContainsDependencyCore Method

Determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Backends
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override bool ContainsDependencyCore(
    string key
)

Parameters

key
Type: SystemString
The dependency key.

Return Value

Type: Boolean
true if the cache contains the dependency key, otherwise false.
See Also

Reference

NullCachingBackend Class
PostSharp.Patterns.Caching.Backends Namespace


NullCachingBackend.ContainsItemCore Method

NullCachingBackendContainsItemCore Method

Determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Backends
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override bool ContainsItemCore(
    string key
)

Parameters

key
Type: SystemString
The key of the cache item.

Return Value

Type: Boolean
true if the cache contains an item whose key is key, otherwise false.
See Also

Reference

NullCachingBackend Class
PostSharp.Patterns.Caching.Backends Namespace


NullCachingBackend.GetItemCore Method

NullCachingBackendGetItemCore Method

Gets a cache item given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Backends
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override CacheValue GetItemCore(
    string key,
    bool includeDependencies
)

Parameters

key
Type: SystemString
The cache item.
includeDependencies
Type: SystemBoolean
true if the Dependencies properties of the resulting CacheValue should be populated, otherwise false.

Return Value

Type: CacheValue
A CacheValue, or null if there is no item in cache of the given key.
See Also

Reference

NullCachingBackend Class
PostSharp.Patterns.Caching.Backends Namespace


NullCachingBackend.InvalidateDependencyCore Method

NullCachingBackendInvalidateDependencyCore Method

Removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Backends
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void InvalidateDependencyCore(
    string key
)

Parameters

key
Type: SystemString
The dependency key.
See Also

Reference

NullCachingBackend Class
PostSharp.Patterns.Caching.Backends Namespace


NullCachingBackend.RemoveItemCore Method

NullCachingBackendRemoveItemCore Method

Removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Backends
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void RemoveItemCore(
    string key
)

Parameters

key
Type: SystemString
The key of the cache item.
See Also

Reference

NullCachingBackend Class
PostSharp.Patterns.Caching.Backends Namespace


NullCachingBackend.SetItemCore Method

NullCachingBackendSetItemCore Method

Sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Backends
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void SetItemCore(
    string key,
    CacheItem item
)

Parameters

key
Type: SystemString
The key of the cache item.
item
Type: PostSharp.Patterns.Caching.ImplementationCacheItem
The cache item.
See Also

Reference

NullCachingBackend Class
PostSharp.Patterns.Caching.Backends Namespace


NullCachingBackend Events

The NullCachingBackend type exposes the following members.

Events
 | Name | Description
Public event | DependencyInvalidated | Events raised when a dependency is invalidated. Check the Events property to see if the current CachingBackend supports events. (Inherited from CachingBackend.)
Public event | ItemRemoved | Event raised when a cache item is removed from the cache. Check the Events property to see if the current CachingBackend supports events. (Inherited from CachingBackend.)
Top
See Also

Reference

NullCachingBackend Class
PostSharp.Patterns.Caching.Backends Namespace


TwoLayerCachingBackendEnhancer Class

A CachingBackendEnhancer that adds a local (fast) MemoryCachingBackend to a remote (slower) cache. This class is typically instantiate in the back-end factory method. You should normally not use this class unless you develop a custom caching back-end.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Caching.ImplementationCachingBackend
PostSharp.Patterns.Caching.ImplementationCachingBackendEnhancer
PostSharp.Patterns.Caching.BackendsTwoLayerCachingBackendEnhancer

Namespace: PostSharp.Patterns.Caching.Backends
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class TwoLayerCachingBackendEnhancer : CachingBackendEnhancer

The TwoLayerCachingBackendEnhancer type exposes the following members.

Constructors
 | Name | Description
Public method | TwoLayerCachingBackendEnhancer | Initializes a new TwoLayerCachingBackendEnhancer.
Top
Properties
 | Name | Description
Public property | Id | Gets the Guid of the current CachingBackend. (Inherited from CachingBackend.)
Public property | LocalCache |
Public property | Status | Gets the status of the current CachingBackend (Default, Disposing or Disposed). (Inherited from CachingBackend.)
Public property | SupportedFeatures | Gets the set of features supported by the current CachingBackend. (Inherited from CachingBackend.)
Public property | UnderlyingBackend | Gets the next CachingBackend in the chain of responsibility. (Inherited from CachingBackendEnhancer.)
Public property | ValueAdapters | Gets the factory of value adapters (IValueAdapter), which allow for instance to cache things like Stream or IEnumerable, which could not be otherwise cached. (Inherited from CachingBackend.)
Top
Methods
 | Name | Description
Public method | Clear | Clears the cache. (Inherited from CachingBackend.)
Public method | ClearAsync | Asynchronously clears the cache. (Inherited from CachingBackend.)
Public method | ContainsDependency | Determines whether the cache contains a given dependency. (Inherited from CachingBackend.)
Public method | ContainsDependencyAsync | Asynchronously determines whether the cache contains a given dependency. (Inherited from CachingBackend.)
Public method | ContainsItem | Determines whether the cache contains an item of a given key. (Inherited from CachingBackend.)
Public method | ContainsItemAsync | Asynchronously determines whether the cache contains an item of a given key. (Inherited from CachingBackend.)
Public method | Dispose | Synchronously disposes the current CachingBackend. (Inherited from CachingBackend.)
Public method | DisposeAsync | Asynchronously dispose the current CachingBackend. (Inherited from CachingBackend.)
Public method | GetItem | Gets a cache item given its key. (Inherited from CachingBackend.)
Public method | GetItemAsync | Asynchronously gets a cache item given its key. (Inherited from CachingBackend.)
Public method | InvalidateDependency | Removes from the cache all items that have a specific dependency. (Inherited from CachingBackend.)
Public method | InvalidateDependencyAsync | Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackend.)
Public method | RemoveItem | Removes a cache item from the cache given its key. (Inherited from CachingBackend.)
Public method | RemoveItemAsync | Asynchronously removes a cache item from the cache given its key. (Inherited from CachingBackend.)
Public method | SetItem | Sets a cache item. (Inherited from CachingBackend.)
Public method | SetItemAsync | Asynchronously sets a cache item. (Inherited from CachingBackend.)
Public method | ToString | Returns a string that represents the current object. (Inherited from CachingBackend.)
Public method | WhenBackgroundTasksCompleted | Returns a Task that is signaled to the complete state when all background tasks have completed. (Inherited from CachingBackend.)
Top
Events
 | Name | Description
Public event | DependencyInvalidated | Events raised when a dependency is invalidated. Check the Events property to see if the current CachingBackend supports events. (Inherited from CachingBackend.)
Public event | ItemRemoved | Event raised when a cache item is removed from the cache. Check the Events property to see if the current CachingBackend supports events. (Inherited from CachingBackend.)
Top
See Also

Reference

PostSharp.Patterns.Caching.Backends Namespace


TwoLayerCachingBackendEnhancer Constructor

Initializes a new TwoLayerCachingBackendEnhancer.

Namespace: PostSharp.Patterns.Caching.Backends
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TwoLayerCachingBackendEnhancer(
    CachingBackend remoteCache,
    MemoryCachingBackend memoryCache = null
)

Parameters

remoteCache
Type: PostSharp.Patterns.Caching.ImplementationCachingBackend
The remote CachingBackend.
memoryCache (Optional)
Type: PostSharp.Patterns.Caching.BackendsMemoryCachingBackend
A MemoryCachingBackend, or null to use a new default MemoryCachingBackend.
See Also

Reference

TwoLayerCachingBackendEnhancer Class
PostSharp.Patterns.Caching.Backends Namespace


TwoLayerCachingBackendEnhancer Properties

The TwoLayerCachingBackendEnhancer type exposes the following members.

Properties
 | Name | Description
Public property | Id | Gets the Guid of the current CachingBackend. (Inherited from CachingBackend.)
Public property | LocalCache |
Public property | Status | Gets the status of the current CachingBackend (Default, Disposing or Disposed). (Inherited from CachingBackend.)
Public property | SupportedFeatures | Gets the set of features supported by the current CachingBackend. (Inherited from CachingBackend.)
Public property | UnderlyingBackend | Gets the next CachingBackend in the chain of responsibility. (Inherited from CachingBackendEnhancer.)
Public property | ValueAdapters | Gets the factory of value adapters (IValueAdapter), which allow for instance to cache things like Stream or IEnumerable, which could not be otherwise cached. (Inherited from CachingBackend.)
Top
See Also

Reference

TwoLayerCachingBackendEnhancer Class
PostSharp.Patterns.Caching.Backends Namespace


TwoLayerCachingBackendEnhancer.LocalCache Property

TwoLayerCachingBackendEnhancerLocalCache Property

Namespace: PostSharp.Patterns.Caching.Backends
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MemoryCachingBackend LocalCache { get; }

Property Value

Type: MemoryCachingBackend
See Also

Reference

TwoLayerCachingBackendEnhancer Class
PostSharp.Patterns.Caching.Backends Namespace


TwoLayerCachingBackendEnhancer Methods

The TwoLayerCachingBackendEnhancer type exposes the following members.

Methods
 | Name | Description
Public method | Clear | Clears the cache. (Inherited from CachingBackend.)
Public method | ClearAsync | Asynchronously clears the cache. (Inherited from CachingBackend.)
Public method | ContainsDependency | Determines whether the cache contains a given dependency. (Inherited from CachingBackend.)
Public method | ContainsDependencyAsync | Asynchronously determines whether the cache contains a given dependency. (Inherited from CachingBackend.)
Public method | ContainsItem | Determines whether the cache contains an item of a given key. (Inherited from CachingBackend.)
Public method | ContainsItemAsync | Asynchronously determines whether the cache contains an item of a given key. (Inherited from CachingBackend.)
Public method | Dispose | Synchronously disposes the current CachingBackend. (Inherited from CachingBackend.)
Public method | DisposeAsync | Asynchronously dispose the current CachingBackend. (Inherited from CachingBackend.)
Public method | GetItem | Gets a cache item given its key. (Inherited from CachingBackend.)
Public method | GetItemAsync | Asynchronously gets a cache item given its key. (Inherited from CachingBackend.)
Public method | InvalidateDependency | Removes from the cache all items that have a specific dependency. (Inherited from CachingBackend.)
Public method | InvalidateDependencyAsync | Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackend.)
Public method | RemoveItem | Removes a cache item from the cache given its key. (Inherited from CachingBackend.)
Public method | RemoveItemAsync | Asynchronously removes a cache item from the cache given its key. (Inherited from CachingBackend.)
Public method | SetItem | Sets a cache item. (Inherited from CachingBackend.)
Public method | SetItemAsync | Asynchronously sets a cache item. (Inherited from CachingBackend.)
Public method | ToString | Returns a string that represents the current object. (Inherited from CachingBackend.)
Public method | WhenBackgroundTasksCompleted | Returns a Task that is signaled to the complete state when all background tasks have completed. (Inherited from CachingBackend.)
Top
See Also

Reference

TwoLayerCachingBackendEnhancer Class
PostSharp.Patterns.Caching.Backends Namespace


TwoLayerCachingBackendEnhancer Events

The TwoLayerCachingBackendEnhancer type exposes the following members.

Events
 | Name | Description
Public event | DependencyInvalidated | Events raised when a dependency is invalidated. Check the Events property to see if the current CachingBackend supports events. (Inherited from CachingBackend.)
Public event | ItemRemoved | Event raised when a cache item is removed from the cache. Check the Events property to see if the current CachingBackend supports events. (Inherited from CachingBackend.)
Top
See Also

Reference

TwoLayerCachingBackendEnhancer Class
PostSharp.Patterns.Caching.Backends Namespace


TwoLayerCachingBackendEnhancer.TwoLayerCacheValue Class

TwoLayerCachingBackendEnhancerTwoLayerCacheValue Class

The object stored in the remote class.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Caching.BackendsTwoLayerCachingBackendEnhancerTwoLayerCacheValue

Namespace: PostSharp.Patterns.Caching.Backends
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public sealed class TwoLayerCacheValue

The TwoLayerCachingBackendEnhancerTwoLayerCacheValue type exposes the following members.

Constructors
 | Name | Description
Public method | TwoLayerCachingBackendEnhancerTwoLayerCacheValue | Initializes a new TwoLayerCachingBackendEnhancerTwoLayerCacheValue.
Top
Properties
 | Name | Description
Public property | AbsoluteExpiration | Gets or sets the absolute expiration of the cache item.
Public property | Priority | Gets or sets the cache item priority.
Public property | SlidingExpiration | Gets or sets the sliding expiration of the cache item.
Public property | Timestamp | Gets or sets the timestamp of the cache item.
Public property | Value | Gets or sets the cached value.
Top
See Also

Reference

PostSharp.Patterns.Caching.Backends Namespace


TwoLayerCachingBackendEnhancer.TwoLayerCacheValue Constructor

TwoLayerCachingBackendEnhancerTwoLayerCacheValue Constructor

Initializes a new TwoLayerCachingBackendEnhancerTwoLayerCacheValue.

Namespace: PostSharp.Patterns.Caching.Backends
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TwoLayerCacheValue(
    CacheItem item
)

Parameters

item
Type: PostSharp.Patterns.Caching.ImplementationCacheItem
The original CacheItem.
See Also

Reference

TwoLayerCachingBackendEnhancerTwoLayerCacheValue Class
PostSharp.Patterns.Caching.Backends Namespace


TwoLayerCacheValue Properties

The TwoLayerCachingBackendEnhancerTwoLayerCacheValue type exposes the following members.

Properties
 | Name | Description
Public property | AbsoluteExpiration | Gets or sets the absolute expiration of the cache item.
Public property | Priority | Gets or sets the cache item priority.
Public property | SlidingExpiration | Gets or sets the sliding expiration of the cache item.
Public property | Timestamp | Gets or sets the timestamp of the cache item.
Public property | Value | Gets or sets the cached value.
Top
See Also

Reference

TwoLayerCachingBackendEnhancerTwoLayerCacheValue Class
PostSharp.Patterns.Caching.Backends Namespace


TwoLayerCachingBackendEnhancer.TwoLayerCacheValue.AbsoluteExpiration Property

TwoLayerCachingBackendEnhancerTwoLayerCacheValueAbsoluteExpiration Property

Gets or sets the absolute expiration of the cache item.

Namespace: PostSharp.Patterns.Caching.Backends
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Nullable<DateTime> AbsoluteExpiration { get; set; }

Property Value

Type: Nullable DateTime
See Also

Reference

TwoLayerCachingBackendEnhancerTwoLayerCacheValue Class
PostSharp.Patterns.Caching.Backends Namespace


TwoLayerCachingBackendEnhancer.TwoLayerCacheValue.Priority Property

TwoLayerCachingBackendEnhancerTwoLayerCacheValuePriority Property

Gets or sets the cache item priority.

Namespace: PostSharp.Patterns.Caching.Backends
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Nullable<CacheItemPriority> Priority { get; set; }

Property Value

Type: Nullable CacheItemPriority
See Also

Reference

TwoLayerCachingBackendEnhancerTwoLayerCacheValue Class
PostSharp.Patterns.Caching.Backends Namespace


TwoLayerCachingBackendEnhancer.TwoLayerCacheValue.SlidingExpiration Property

TwoLayerCachingBackendEnhancerTwoLayerCacheValueSlidingExpiration Property

Gets or sets the sliding expiration of the cache item.

Namespace: PostSharp.Patterns.Caching.Backends
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Nullable<TimeSpan> SlidingExpiration { get; set; }

Property Value

Type: Nullable TimeSpan
See Also

Reference

TwoLayerCachingBackendEnhancerTwoLayerCacheValue Class
PostSharp.Patterns.Caching.Backends Namespace


TwoLayerCachingBackendEnhancer.TwoLayerCacheValue.Timestamp Property

TwoLayerCachingBackendEnhancerTwoLayerCacheValueTimestamp Property

Gets or sets the timestamp of the cache item.

Namespace: PostSharp.Patterns.Caching.Backends
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public long Timestamp { get; set; }

Property Value

Type: Int64
See Also

Reference

TwoLayerCachingBackendEnhancerTwoLayerCacheValue Class
PostSharp.Patterns.Caching.Backends Namespace


TwoLayerCachingBackendEnhancer.TwoLayerCacheValue.Value Property

TwoLayerCachingBackendEnhancerTwoLayerCacheValueValue Property

Gets or sets the cached value.

Namespace: PostSharp.Patterns.Caching.Backends
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Object Value { get; set; }

Property Value

Type: Object
See Also

Reference

TwoLayerCachingBackendEnhancerTwoLayerCacheValue Class
PostSharp.Patterns.Caching.Backends Namespace


PostSharp.Patterns.Caching.Backends.Azure Namespace

Classes
 | Class | Description
Public class | AzureCacheInvalidator | An implementation of CacheInvalidator based on Microsoft Azure Service Bus.
Public class | AzureCacheInvalidatorOptions | Options for AzureCacheInvalidator.


AzureCacheInvalidator Class

An implementation of CacheInvalidator based on Microsoft Azure Service Bus.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Caching.ImplementationCachingBackend
PostSharp.Patterns.Caching.ImplementationCachingBackendEnhancer
PostSharp.Patterns.Caching.ImplementationCacheInvalidator
PostSharp.Patterns.Caching.Backends.AzureAzureCacheInvalidator

Namespace: PostSharp.Patterns.Caching.Backends.Azure
Assembly: PostSharp.Patterns.Caching.Backends.Azure (in PostSharp.Patterns.Caching.Backends.Azure.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class AzureCacheInvalidator : CacheInvalidator

The AzureCacheInvalidator type exposes the following members.

Properties
 | Name | Description
Public property | Id | Gets the Guid of the current CachingBackend. (Inherited from CachingBackend.)
Protected property | Logger | Gets the Logger that implementations can use to emit log records. (Inherited from CachingBackend.)
Public property | Options | Gets the options of the current CacheInvalidator. (Inherited from CacheInvalidator.)
Public property | Status | Gets the status of the current CachingBackend (Default, Disposing or Disposed). (Inherited from CachingBackend.)
Public property | SupportedFeatures | Gets the set of features supported by the current CachingBackend. (Inherited from CachingBackend.)
Public property | UnderlyingBackend | Gets the next CachingBackend in the chain of responsibility. (Inherited from CachingBackendEnhancer.)
Public property | ValueAdapters | Gets the factory of value adapters (IValueAdapter), which allow for instance to cache things like Stream or IEnumerable, which could not be otherwise cached. (Inherited from CachingBackend.)
Top
Methods
 | Name | Description
Public method | Clear | Clears the cache. (Inherited from CachingBackend.)
Public method | ClearAsync | Asynchronously clears the cache. (Inherited from CachingBackend.)
Protected method | ClearAsyncCore | Asynchronously clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Inherited from CachingBackendEnhancer.)
Protected method | ClearCore | Clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Inherited from CachingBackendEnhancer.)
Public method | ContainsDependency | Determines whether the cache contains a given dependency. (Inherited from CachingBackend.)
Public method | ContainsDependencyAsync | Asynchronously determines whether the cache contains a given dependency. (Inherited from CachingBackend.)
Protected method | ContainsDependencyAsyncCore | Asynchronously determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Protected method | ContainsDependencyCore | Determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Public method | ContainsItem | Determines whether the cache contains an item of a given key. (Inherited from CachingBackend.)
Public method | ContainsItemAsync | Asynchronously determines whether the cache contains an item of a given key. (Inherited from CachingBackend.)
Protected method | ContainsItemAsyncCore | Asynchronously determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Protected method | ContainsItemCore | Determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
 | Create | Creates a new AzureCacheInvalidator.
 | CreateAsync | Asynchronously creates a new AzureCacheInvalidator.
Protected method | CreateFeatures | Creates a CachingBackendFeatures object, which describes set of features implemented by the back-end. This method is invoked the first time the SupportedFeatures property is evaluated. The result is then cached. (Inherited from CachingBackendEnhancer.)
Public method | Dispose | Synchronously disposes the current CachingBackend. (Inherited from CachingBackend.)
Protected method | Dispose(Boolean) | Synchronously disposes the current CachingBackend, with a parameter instructing whether this method is called because of a call to the Dispose method or because of object finalizing. (Inherited from CachingBackend.)
Public method | DisposeAsync | Asynchronously dispose the current CachingBackend. (Inherited from CachingBackend.)
Protected method | DisposeAsyncCore | Asynchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Overrides CachingBackendEnhancerDisposeAsyncCore(CancellationToken).)
Protected method | DisposeCore | Synchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Overrides CachingBackendEnhancerDisposeCore(Boolean).)
Protected method | Finalize | Destructor. (Overrides ObjectFinalize.)
Public method | GetItem | Gets a cache item given its key. (Inherited from CachingBackend.)
Public method | GetItemAsync | Asynchronously gets a cache item given its key. (Inherited from CachingBackend.)
Protected method | GetItemAsyncCore | Asynchronously gets a cache item given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Protected method | GetItemCore | Gets a cache item given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Public method | InvalidateDependency | Removes from the cache all items that have a specific dependency. (Inherited from CachingBackend.)
Public method | InvalidateDependencyAsync | Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackend.)
Protected method | InvalidateDependencyAsyncCore | Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CacheInvalidator.)
Protected method | InvalidateDependencyCore | Removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CacheInvalidator.)
Protected method | OnBackendDependencyInvalidated | Method invoked when the DependencyInvalidated event of the next UnderlyingBackend in the chain of responsibility is invoked. (Inherited from CachingBackendEnhancer.)
Protected method | OnBackendItemRemoved | Method invoked when the ItemRemoved event of the next UnderlyingBackend in the chain of responsibility is invoked. (Inherited from CachingBackendEnhancer.)
Protected method | OnDependencyInvalidated(CacheDependencyInvalidatedEventArgs) | Raises the DependencyInvalidated event given a CacheDependencyInvalidatedEventArgs. (Inherited from CachingBackend.)
Protected method | OnDependencyInvalidated(String, Guid) | Raises the DependencyInvalidated event , but lazily instantiates the CacheDependencyInvalidatedEventArgs if there is an event client. (Inherited from CachingBackend.)
Protected method | OnItemRemoved(CacheItemRemovedEventArgs) | Raises the ItemRemoved event given a CacheItemRemovedEventArgs. (Inherited from CachingBackend.)
Protected method | OnItemRemoved(String, CacheItemRemovedReason, Guid) | Raises the ItemRemoved event, but lazily instantiates the CacheItemRemovedEventArgs if there is an event client. (Inherited from CachingBackend.)
Protected method | OnMessageReceived | Implementations of CacheInvalidator must call this method when an invalidation message is received. (Inherited from CacheInvalidator.)
Public method | RemoveItem | Removes a cache item from the cache given its key. (Inherited from CachingBackend.)
Public method | RemoveItemAsync | Asynchronously removes a cache item from the cache given its key. (Inherited from CachingBackend.)
Protected method | RemoveItemAsyncCore | Asynchronously removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CacheInvalidator.)
Protected method | RemoveItemCore | Removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CacheInvalidator.)
Protected method | SendMessageAsync | Sends an invalidation message over the message bus of the implementation. (Overrides CacheInvalidatorSendMessageAsync(String, CancellationToken).)
Public method | SetItem | Sets a cache item. (Inherited from CachingBackend.)
Public method | SetItemAsync | Asynchronously sets a cache item. (Inherited from CachingBackend.)
Protected method | SetItemAsyncCore | Asynchronously sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. The default implementation is to call the synchronous SetItemCore(String, CacheItem) method. (Inherited from CachingBackendEnhancer.)
Protected method | SetItemCore | Sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Public method | ToString | Returns a string that represents the current object. (Inherited from CachingBackend.)
Public method | WhenBackgroundTasksCompleted | Returns a Task that is signaled to the complete state when all background tasks have completed. (Inherited from CachingBackend.)
Top
Events
 | Name | Description
Public event | DependencyInvalidated | Events raised when a dependency is invalidated. Check the Events property to see if the current CachingBackend supports events. (Inherited from CachingBackend.)
Public event | ItemRemoved | Event raised when a cache item is removed from the cache. Check the Events property to see if the current CachingBackend supports events. (Inherited from CachingBackend.)
Top
See Also

Reference

PostSharp.Patterns.Caching.Backends.Azure Namespace

Other Resources

Conceptual: Synchronizing Local In-Memory Caches for Multiple Servers


AzureCacheInvalidator Properties

The AzureCacheInvalidator type exposes the following members.

Properties
 | Name | Description
Public property | Id | Gets the Guid of the current CachingBackend. (Inherited from CachingBackend.)
Protected property | Logger | Gets the Logger that implementations can use to emit log records. (Inherited from CachingBackend.)
Public property | Options | Gets the options of the current CacheInvalidator. (Inherited from CacheInvalidator.)
Public property | Status | Gets the status of the current CachingBackend (Default, Disposing or Disposed). (Inherited from CachingBackend.)
Public property | SupportedFeatures | Gets the set of features supported by the current CachingBackend. (Inherited from CachingBackend.)
Public property | UnderlyingBackend | Gets the next CachingBackend in the chain of responsibility. (Inherited from CachingBackendEnhancer.)
Public property | ValueAdapters | Gets the factory of value adapters (IValueAdapter), which allow for instance to cache things like Stream or IEnumerable, which could not be otherwise cached. (Inherited from CachingBackend.)
Top
See Also

Reference

AzureCacheInvalidator Class
PostSharp.Patterns.Caching.Backends.Azure Namespace


AzureCacheInvalidator Methods

The AzureCacheInvalidator type exposes the following members.

Methods
 | Name | Description
Public method | Clear | Clears the cache. (Inherited from CachingBackend.)
Public method | ClearAsync | Asynchronously clears the cache. (Inherited from CachingBackend.)
Protected method | ClearAsyncCore | Asynchronously clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Inherited from CachingBackendEnhancer.)
Protected method | ClearCore | Clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Inherited from CachingBackendEnhancer.)
Public method | ContainsDependency | Determines whether the cache contains a given dependency. (Inherited from CachingBackend.)
Public method | ContainsDependencyAsync | Asynchronously determines whether the cache contains a given dependency. (Inherited from CachingBackend.)
Protected method | ContainsDependencyAsyncCore | Asynchronously determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Protected method | ContainsDependencyCore | Determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Public method | ContainsItem | Determines whether the cache contains an item of a given key. (Inherited from CachingBackend.)
Public method | ContainsItemAsync | Asynchronously determines whether the cache contains an item of a given key. (Inherited from CachingBackend.)
Protected method | ContainsItemAsyncCore | Asynchronously determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Protected method | ContainsItemCore | Determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
 | Create | Creates a new AzureCacheInvalidator.
 | CreateAsync | Asynchronously creates a new AzureCacheInvalidator.
Protected method | CreateFeatures | Creates a CachingBackendFeatures object, which describes set of features implemented by the back-end. This method is invoked the first time the SupportedFeatures property is evaluated. The result is then cached. (Inherited from CachingBackendEnhancer.)
Public method | Dispose | Synchronously disposes the current CachingBackend. (Inherited from CachingBackend.)
Protected method | Dispose(Boolean) | Synchronously disposes the current CachingBackend, with a parameter instructing whether this method is called because of a call to the Dispose method or because of object finalizing. (Inherited from CachingBackend.)
Public method | DisposeAsync | Asynchronously dispose the current CachingBackend. (Inherited from CachingBackend.)
Protected method | DisposeAsyncCore | Asynchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Overrides CachingBackendEnhancerDisposeAsyncCore(CancellationToken).)
Protected method | DisposeCore | Synchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Overrides CachingBackendEnhancerDisposeCore(Boolean).)
Protected method | Finalize | Destructor. (Overrides ObjectFinalize.)
Public method | GetItem | Gets a cache item given its key. (Inherited from CachingBackend.)
Public method | GetItemAsync | Asynchronously gets a cache item given its key. (Inherited from CachingBackend.)
Protected method | GetItemAsyncCore | Asynchronously gets a cache item given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Protected method | GetItemCore | Gets a cache item given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Public method | InvalidateDependency | Removes from the cache all items that have a specific dependency. (Inherited from CachingBackend.)
Public method | InvalidateDependencyAsync | Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackend.)
Protected method | InvalidateDependencyAsyncCore | Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CacheInvalidator.)
Protected method | InvalidateDependencyCore | Removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CacheInvalidator.)
Protected method | OnBackendDependencyInvalidated | Method invoked when the DependencyInvalidated event of the next UnderlyingBackend in the chain of responsibility is invoked. (Inherited from CachingBackendEnhancer.)
Protected method | OnBackendItemRemoved | Method invoked when the ItemRemoved event of the next UnderlyingBackend in the chain of responsibility is invoked. (Inherited from CachingBackendEnhancer.)
Protected method | OnDependencyInvalidated(CacheDependencyInvalidatedEventArgs) | Raises the DependencyInvalidated event given a CacheDependencyInvalidatedEventArgs. (Inherited from CachingBackend.)
Protected method | OnDependencyInvalidated(String, Guid) | Raises the DependencyInvalidated event , but lazily instantiates the CacheDependencyInvalidatedEventArgs if there is an event client. (Inherited from CachingBackend.)
Protected method | OnItemRemoved(CacheItemRemovedEventArgs) | Raises the ItemRemoved event given a CacheItemRemovedEventArgs. (Inherited from CachingBackend.)
Protected method | OnItemRemoved(String, CacheItemRemovedReason, Guid) | Raises the ItemRemoved event, but lazily instantiates the CacheItemRemovedEventArgs if there is an event client. (Inherited from CachingBackend.)
Protected method | OnMessageReceived | Implementations of CacheInvalidator must call this method when an invalidation message is received. (Inherited from CacheInvalidator.)
Public method | RemoveItem | Removes a cache item from the cache given its key. (Inherited from CachingBackend.)
Public method | RemoveItemAsync | Asynchronously removes a cache item from the cache given its key. (Inherited from CachingBackend.)
Protected method | RemoveItemAsyncCore | Asynchronously removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CacheInvalidator.)
Protected method | RemoveItemCore | Removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CacheInvalidator.)
Protected method | SendMessageAsync | Sends an invalidation message over the message bus of the implementation. (Overrides CacheInvalidatorSendMessageAsync(String, CancellationToken).)
Public method | SetItem | Sets a cache item. (Inherited from CachingBackend.)
Public method | SetItemAsync | Asynchronously sets a cache item. (Inherited from CachingBackend.)
Protected method | SetItemAsyncCore | Asynchronously sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. The default implementation is to call the synchronous SetItemCore(String, CacheItem) method. (Inherited from CachingBackendEnhancer.)
Protected method | SetItemCore | Sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Public method | ToString | Returns a string that represents the current object. (Inherited from CachingBackend.)
Public method | WhenBackgroundTasksCompleted | Returns a Task that is signaled to the complete state when all background tasks have completed. (Inherited from CachingBackend.)
Top
See Also

Reference

AzureCacheInvalidator Class
PostSharp.Patterns.Caching.Backends.Azure Namespace


AzureCacheInvalidator.Create Method

AzureCacheInvalidatorCreate Method

Creates a new AzureCacheInvalidator.

Namespace: PostSharp.Patterns.Caching.Backends.Azure
Assembly: PostSharp.Patterns.Caching.Backends.Azure (in PostSharp.Patterns.Caching.Backends.Azure.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static AzureCacheInvalidator Create(
    CachingBackend backend,
    AzureCacheInvalidatorOptions options
)

Parameters

backend
Type: PostSharp.Patterns.Caching.ImplementationCachingBackend
The local (in-memory, typically) cache being invalidated by the new AzureCacheInvalidator.
options
Type: PostSharp.Patterns.Caching.Backends.AzureAzureCacheInvalidatorOptions
Options.

Return Value

Type: AzureCacheInvalidator
A new AzureCacheInvalidator.
See Also

Reference

AzureCacheInvalidator Class
PostSharp.Patterns.Caching.Backends.Azure Namespace

Other Resources

Conceptual: Synchronizing Local In-Memory Caches for Multiple Servers


AzureCacheInvalidator.CreateAsync Method

AzureCacheInvalidatorCreateAsync Method

Asynchronously creates a new AzureCacheInvalidator.

Namespace: PostSharp.Patterns.Caching.Backends.Azure
Assembly: PostSharp.Patterns.Caching.Backends.Azure (in PostSharp.Patterns.Caching.Backends.Azure.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Task<AzureCacheInvalidator> CreateAsync(
    CachingBackend backend,
    AzureCacheInvalidatorOptions options
)

Parameters

backend
Type: PostSharp.Patterns.Caching.ImplementationCachingBackend
The local (in-memory, typically) cache being invalidated by the new AzureCacheInvalidator.
options
Type: PostSharp.Patterns.Caching.Backends.AzureAzureCacheInvalidatorOptions
Options.

Return Value

Type: Task AzureCacheInvalidator
A new AzureCacheInvalidator.
See Also

Reference

AzureCacheInvalidator Class
PostSharp.Patterns.Caching.Backends.Azure Namespace


AzureCacheInvalidator.DisposeAsyncCore Method

AzureCacheInvalidatorDisposeAsyncCore Method

Asynchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked.

Namespace: PostSharp.Patterns.Caching.Backends.Azure
Assembly: PostSharp.Patterns.Caching.Backends.Azure (in PostSharp.Patterns.Caching.Backends.Azure.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override Task DisposeAsyncCore(
    CancellationToken cancellationToken
)

Parameters

cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task
A Task.
See Also

Reference

AzureCacheInvalidator Class
PostSharp.Patterns.Caching.Backends.Azure Namespace


AzureCacheInvalidator.DisposeCore Method

AzureCacheInvalidatorDisposeCore Method

Synchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked.

Namespace: PostSharp.Patterns.Caching.Backends.Azure
Assembly: PostSharp.Patterns.Caching.Backends.Azure (in PostSharp.Patterns.Caching.Backends.Azure.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void DisposeCore(
    bool disposing
)

Parameters

disposing
Type: SystemBoolean
See Also

Reference

AzureCacheInvalidator Class
PostSharp.Patterns.Caching.Backends.Azure Namespace


AzureCacheInvalidator.Finalize Method

AzureCacheInvalidatorFinalize Method

Destructor.

Namespace: PostSharp.Patterns.Caching.Backends.Azure
Assembly: PostSharp.Patterns.Caching.Backends.Azure (in PostSharp.Patterns.Caching.Backends.Azure.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void Finalize()

Implements

ObjectFinalize
See Also

Reference

AzureCacheInvalidator Class
PostSharp.Patterns.Caching.Backends.Azure Namespace


AzureCacheInvalidator.SendMessageAsync Method

AzureCacheInvalidatorSendMessageAsync Method

Sends an invalidation message over the message bus of the implementation.

Namespace: PostSharp.Patterns.Caching.Backends.Azure
Assembly: PostSharp.Patterns.Caching.Backends.Azure (in PostSharp.Patterns.Caching.Backends.Azure.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override Task SendMessageAsync(
    string message,
    CancellationToken cancellationToken
)

Parameters

message
Type: SystemString
A serialized, opaque serialization message.
cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task
A Task.
See Also

Reference

AzureCacheInvalidator Class
PostSharp.Patterns.Caching.Backends.Azure Namespace


AzureCacheInvalidator Events

The AzureCacheInvalidator type exposes the following members.

Events
 | Name | Description
Public event | DependencyInvalidated | Events raised when a dependency is invalidated. Check the Events property to see if the current CachingBackend supports events. (Inherited from CachingBackend.)
Public event | ItemRemoved | Event raised when a cache item is removed from the cache. Check the Events property to see if the current CachingBackend supports events. (Inherited from CachingBackend.)
Top
See Also

Reference

AzureCacheInvalidator Class
PostSharp.Patterns.Caching.Backends.Azure Namespace


AzureCacheInvalidatorOptions Class

Options for AzureCacheInvalidator.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Caching.ImplementationCacheInvalidatorOptions
PostSharp.Patterns.Caching.Backends.AzureAzureCacheInvalidatorOptions

Namespace: PostSharp.Patterns.Caching.Backends.Azure
Assembly: PostSharp.Patterns.Caching.Backends.Azure (in PostSharp.Patterns.Caching.Backends.Azure.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class AzureCacheInvalidatorOptions : CacheInvalidatorOptions

The AzureCacheInvalidatorOptions type exposes the following members.

Constructors
 | Name | Description
Public method | AzureCacheInvalidatorOptions | Initializes a new instance of the AzureCacheInvalidatorOptions class
Top
Properties
 | Name | Description
Public property | ConnectionString | Gets or sets the connection string for the Azure Service Bus topic. The value must be a valid argument of the TopicClient.CreateFromConnectionString method.
Public property | Prefix | Gets or sets the prefix of messages sent by the CacheInvalidator. Messages received by the OnMessageReceived(String) method are ignored if they don't start with the proper prefix. (Inherited from CacheInvalidatorOptions.)
Top
See Also

Reference

PostSharp.Patterns.Caching.Backends.Azure Namespace

Other Resources

Conceptual: Synchronizing Local In-Memory Caches for Multiple Servers


AzureCacheInvalidatorOptions Constructor

Initializes a new instance of the AzureCacheInvalidatorOptions class

Namespace: PostSharp.Patterns.Caching.Backends.Azure
Assembly: PostSharp.Patterns.Caching.Backends.Azure (in PostSharp.Patterns.Caching.Backends.Azure.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AzureCacheInvalidatorOptions()
See Also

Reference

AzureCacheInvalidatorOptions Class
PostSharp.Patterns.Caching.Backends.Azure Namespace


AzureCacheInvalidatorOptions Properties

The AzureCacheInvalidatorOptions type exposes the following members.

Properties
 | Name | Description
Public property | ConnectionString | Gets or sets the connection string for the Azure Service Bus topic. The value must be a valid argument of the TopicClient.CreateFromConnectionString method.
Public property | Prefix | Gets or sets the prefix of messages sent by the CacheInvalidator. Messages received by the OnMessageReceived(String) method are ignored if they don't start with the proper prefix. (Inherited from CacheInvalidatorOptions.)
Top
See Also

Reference

AzureCacheInvalidatorOptions Class
PostSharp.Patterns.Caching.Backends.Azure Namespace


AzureCacheInvalidatorOptions.ConnectionString Property

AzureCacheInvalidatorOptionsConnectionString Property

Gets or sets the connection string for the Azure Service Bus topic. The value must be a valid argument of the TopicClient.CreateFromConnectionString method.

Namespace: PostSharp.Patterns.Caching.Backends.Azure
Assembly: PostSharp.Patterns.Caching.Backends.Azure (in PostSharp.Patterns.Caching.Backends.Azure.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string ConnectionString { get; set; }

Property Value

Type: String
See Also

Reference

AzureCacheInvalidatorOptions Class
PostSharp.Patterns.Caching.Backends.Azure Namespace


PostSharp.Patterns.Caching.Backends.Redis Namespace

Classes
 | Class | Description
Public class | RedisCacheDependencyGarbageCollector | Removes dependencies added when a RedisCachingBackend when items are expired or evicted from the cache. At least one instance (ideally a single instance) of the RedisCacheDependencyGarbageCollector must be running whenever a RedisCachingBackend instance that supports dependencies is running, otherwise the cache will use storage to store dependencies that are no longer relevant, and will not be removed otherwise. If no RedisCacheDependencyGarbageCollector is running while at least one dependency-enabled RedisCachingBackend instance is running, you must initiate full garbage collection by calling the PerformFullCollectionAsync(RedisCachingBackend, CancellationToken) method.
Public class | RedisCacheInvalidator | An implementation of CacheInvalidator that uses Redis publish/subscribe channels to invalidate several instances of local caches.
Public class | RedisCacheInvalidatorOptions | Options for RedisCacheInvalidator.
Public class | RedisCachingBackend | A CachingBackend for Redis, based on the StackExchange.Redis client.
Public class | RedisCachingBackendConfiguration | Configuration for RedisCachingBackend.


RedisCacheDependencyGarbageCollector Class

Removes dependencies added when a RedisCachingBackend when items are expired or evicted from the cache. At least one instance (ideally a single instance) of the RedisCacheDependencyGarbageCollector must be running whenever a RedisCachingBackend instance that supports dependencies is running, otherwise the cache will use storage to store dependencies that are no longer relevant, and will not be removed otherwise. If no RedisCacheDependencyGarbageCollector is running while at least one dependency-enabled RedisCachingBackend instance is running, you must initiate full garbage collection by calling the PerformFullCollectionAsync(RedisCachingBackend, CancellationToken) method.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Caching.Backends.RedisRedisCacheDependencyGarbageCollector

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class RedisCacheDependencyGarbageCollector : IDisposable

The RedisCacheDependencyGarbageCollector type exposes the following members.

Properties
 | Name | Description
Public property | Connection | Gets the Redis IConnectionMultiplexer used by the current object.
Public property | Database | Gets the Redis IDatabase used by the current object.
Top
Methods
 | Name | Description
 | Create(CachingBackend) | Creates a new RedisCacheDependencyGarbageCollector that uses an existing DependenciesRedisCachingBackend object.
 | Create(IConnectionMultiplexer, RedisCachingBackendConfiguration) | Creates a new RedisCacheDependencyGarbageCollector given a Redis connection and a configuration object.
 | CreateAsync(CachingBackend, CancellationToken) | Asynchronously creates a new RedisCacheDependencyGarbageCollector that uses an existing RedisCachingBackend object.
 | CreateAsync(IConnectionMultiplexer, RedisCachingBackendConfiguration, CancellationToken) | Asynchronously creates a new RedisCacheDependencyGarbageCollector given a Redis connection and a configuration object.
Public method | Dispose | Disposes the current object.
Public method | DisposeAsync | Asynchronously disposes the current object.
 | PerformFullCollectionAsync(RedisCachingBackend, CancellationToken) | Performs a full garbage collection on all Redis servers. This operation enumerates and validates all keys in the database, and can possibly last several minutes and affect performance in production.
 | PerformFullCollectionAsync(RedisCachingBackend, IServer, CancellationToken) | Performs a full garbage collection on a given Redis server. This operation enumerates and validates all keys in the database, and can possibly last several minutes and affect performance in production.
Top
See Also

Reference

PostSharp.Patterns.Caching.Backends.Redis Namespace

Other Resources

Conceptual: Using Redis Cache


RedisCacheDependencyGarbageCollector Properties

The RedisCacheDependencyGarbageCollector type exposes the following members.

Properties
 | Name | Description
Public property | Connection | Gets the Redis IConnectionMultiplexer used by the current object.
Public property | Database | Gets the Redis IDatabase used by the current object.
Top
See Also

Reference

RedisCacheDependencyGarbageCollector Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCacheDependencyGarbageCollector.Connection Property

RedisCacheDependencyGarbageCollectorConnection Property

Gets the Redis IConnectionMultiplexer used by the current object.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IConnectionMultiplexer Connection { get; }

Property Value

Type: IConnectionMultiplexer
See Also

Reference

RedisCacheDependencyGarbageCollector Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCacheDependencyGarbageCollector.Database Property

RedisCacheDependencyGarbageCollectorDatabase Property

Gets the Redis IDatabase used by the current object.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IDatabase Database { get; }

Property Value

Type: IDatabase
See Also

Reference

RedisCacheDependencyGarbageCollector Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCacheDependencyGarbageCollector Methods

The RedisCacheDependencyGarbageCollector type exposes the following members.

Methods
 | Name | Description
 | Create(CachingBackend) | Creates a new RedisCacheDependencyGarbageCollector that uses an existing DependenciesRedisCachingBackend object.
 | Create(IConnectionMultiplexer, RedisCachingBackendConfiguration) | Creates a new RedisCacheDependencyGarbageCollector given a Redis connection and a configuration object.
 | CreateAsync(CachingBackend, CancellationToken) | Asynchronously creates a new RedisCacheDependencyGarbageCollector that uses an existing RedisCachingBackend object.
 | CreateAsync(IConnectionMultiplexer, RedisCachingBackendConfiguration, CancellationToken) | Asynchronously creates a new RedisCacheDependencyGarbageCollector given a Redis connection and a configuration object.
Public method | Dispose | Disposes the current object.
Public method | DisposeAsync | Asynchronously disposes the current object.
 | PerformFullCollectionAsync(RedisCachingBackend, CancellationToken) | Performs a full garbage collection on all Redis servers. This operation enumerates and validates all keys in the database, and can possibly last several minutes and affect performance in production.
 | PerformFullCollectionAsync(RedisCachingBackend, IServer, CancellationToken) | Performs a full garbage collection on a given Redis server. This operation enumerates and validates all keys in the database, and can possibly last several minutes and affect performance in production.
Top
See Also

Reference

RedisCacheDependencyGarbageCollector Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCacheDependencyGarbageCollector.Create Method

RedisCacheDependencyGarbageCollectorCreate Method

Overload List
Name | Description
Create(CachingBackend) | Creates a new RedisCacheDependencyGarbageCollector that uses an existing DependenciesRedisCachingBackend object.
Create(IConnectionMultiplexer, RedisCachingBackendConfiguration) | Creates a new RedisCacheDependencyGarbageCollector given a Redis connection and a configuration object.
Top
See Also

Reference

RedisCacheDependencyGarbageCollector Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCacheDependencyGarbageCollector.Create Method (CachingBackend)

RedisCacheDependencyGarbageCollectorCreate Method (CachingBackend)

Creates a new RedisCacheDependencyGarbageCollector that uses an existing DependenciesRedisCachingBackend object.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static RedisCacheDependencyGarbageCollector Create(
    CachingBackend backend
)

Parameters

backend
Type: PostSharp.Patterns.Caching.ImplementationCachingBackend
An existing Redis CachingBackend, as returned by Create(IConnectionMultiplexer, RedisCachingBackendConfiguration).

Return Value

Type: RedisCacheDependencyGarbageCollector
A RedisCacheDependencyGarbageCollector using backend.
See Also

Reference

RedisCacheDependencyGarbageCollector Class
Create Overload
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCacheDependencyGarbageCollector.Create Method (IConnectionMultiplexer, RedisCachingBackendConfiguration)

RedisCacheDependencyGarbageCollectorCreate Method (IConnectionMultiplexer, RedisCachingBackendConfiguration)

Creates a new RedisCacheDependencyGarbageCollector given a Redis connection and a configuration object.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static RedisCacheDependencyGarbageCollector Create(
    IConnectionMultiplexer connection,
    RedisCachingBackendConfiguration configuration
)

Parameters

connection
Type: IConnectionMultiplexer
A Redis connection.
configuration
Type: PostSharp.Patterns.Caching.Backends.RedisRedisCachingBackendConfiguration
A configuration object.

Return Value

Type: RedisCacheDependencyGarbageCollector
A RedisCacheDependencyGarbageCollector using connection and configuration.
See Also

Reference

RedisCacheDependencyGarbageCollector Class
Create Overload
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCacheDependencyGarbageCollector.CreateAsync Method

RedisCacheDependencyGarbageCollectorCreateAsync Method

Overload List
Name | Description
CreateAsync(CachingBackend, CancellationToken) | Asynchronously creates a new RedisCacheDependencyGarbageCollector that uses an existing RedisCachingBackend object.
CreateAsync(IConnectionMultiplexer, RedisCachingBackendConfiguration, CancellationToken) | Asynchronously creates a new RedisCacheDependencyGarbageCollector given a Redis connection and a configuration object.
Top
See Also

Reference

RedisCacheDependencyGarbageCollector Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCacheDependencyGarbageCollector.CreateAsync Method (CachingBackend, CancellationToken)

RedisCacheDependencyGarbageCollectorCreateAsync Method (CachingBackend, CancellationToken)

Asynchronously creates a new RedisCacheDependencyGarbageCollector that uses an existing RedisCachingBackend object.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Task<RedisCacheDependencyGarbageCollector> CreateAsync(
    CachingBackend backend,
    CancellationToken cancellationToken = null
)

Parameters

backend
Type: PostSharp.Patterns.Caching.ImplementationCachingBackend
An existing CachingBackend, as returned by Create(IConnectionMultiplexer, RedisCachingBackendConfiguration), that supports dependencies.
cancellationToken (Optional)
Type: System.ThreadingCancellationToken

Return Value

Type: Task RedisCacheDependencyGarbageCollector
A Task returning a RedisCacheDependencyGarbageCollector that uses backend.
See Also

Reference

RedisCacheDependencyGarbageCollector Class
CreateAsync Overload
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCacheDependencyGarbageCollector.CreateAsync Method (IConnectionMultiplexer, RedisCachingBackendConfiguration, CancellationToken)

RedisCacheDependencyGarbageCollectorCreateAsync Method (IConnectionMultiplexer, RedisCachingBackendConfiguration, CancellationToken)

Asynchronously creates a new RedisCacheDependencyGarbageCollector given a Redis connection and a configuration object.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Task<RedisCacheDependencyGarbageCollector> CreateAsync(
    IConnectionMultiplexer connection,
    RedisCachingBackendConfiguration configuration,
    CancellationToken cancellationToken = null
)

Parameters

connection
Type: IConnectionMultiplexer
A Redis connection.
configuration
Type: PostSharp.Patterns.Caching.Backends.RedisRedisCachingBackendConfiguration
A configuration object.
cancellationToken (Optional)
Type: System.ThreadingCancellationToken

Return Value

Type: Task RedisCacheDependencyGarbageCollector
A Task returning a RedisCacheDependencyGarbageCollector that uses connection and configuration.
See Also

Reference

RedisCacheDependencyGarbageCollector Class
CreateAsync Overload
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCacheDependencyGarbageCollector.Dispose Method

RedisCacheDependencyGarbageCollectorDispose Method

Disposes the current object.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Dispose()

Implements

IDisposableDispose
See Also

Reference

RedisCacheDependencyGarbageCollector Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCacheDependencyGarbageCollector.DisposeAsync Method

RedisCacheDependencyGarbageCollectorDisposeAsync Method

Asynchronously disposes the current object.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Task DisposeAsync(
    CancellationToken cancellationToken = null
)

Parameters

cancellationToken (Optional)
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task
A Task.
See Also

Reference

RedisCacheDependencyGarbageCollector Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCacheDependencyGarbageCollector.PerformFullCollectionAsync Method

RedisCacheDependencyGarbageCollectorPerformFullCollectionAsync Method

Overload List
Name | Description
PerformFullCollectionAsync(RedisCachingBackend, CancellationToken) | Performs a full garbage collection on all Redis servers. This operation enumerates and validates all keys in the database, and can possibly last several minutes and affect performance in production.
PerformFullCollectionAsync(RedisCachingBackend, IServer, CancellationToken) | Performs a full garbage collection on a given Redis server. This operation enumerates and validates all keys in the database, and can possibly last several minutes and affect performance in production.
Top
See Also

Reference

RedisCacheDependencyGarbageCollector Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCacheDependencyGarbageCollector.PerformFullCollectionAsync Method (RedisCachingBackend, CancellationToken)

RedisCacheDependencyGarbageCollectorPerformFullCollectionAsync Method (RedisCachingBackend, CancellationToken)

Performs a full garbage collection on all Redis servers. This operation enumerates and validates all keys in the database, and can possibly last several minutes and affect performance in production.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Task PerformFullCollectionAsync(
    RedisCachingBackend backend,
    CancellationToken cancellationToken = null
)

Parameters

backend
Type: PostSharp.Patterns.Caching.Backends.RedisRedisCachingBackend
A RedisCachingBackend that supports dependencies.
cancellationToken (Optional)
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task
A Task.
See Also

Reference

RedisCacheDependencyGarbageCollector Class
PerformFullCollectionAsync Overload
PostSharp.Patterns.Caching.Backends.Redis Namespace

Other Resources

Conceptual: Using Redis Cache


RedisCacheDependencyGarbageCollector.PerformFullCollectionAsync Method (RedisCachingBackend, IServer, CancellationToken)

RedisCacheDependencyGarbageCollectorPerformFullCollectionAsync Method (RedisCachingBackend, IServer, CancellationToken)

Performs a full garbage collection on a given Redis server. This operation enumerates and validates all keys in the database, and can possibly last several minutes and affect performance in production.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Task PerformFullCollectionAsync(
    RedisCachingBackend backend,
    IServer server,
    CancellationToken cancellationToken = null
)

Parameters

backend
Type: PostSharp.Patterns.Caching.Backends.RedisRedisCachingBackend
A RedisCachingBackend that supports dependencies.
server
Type: IServer
The Redis server whose keys will be enumerated and validated.
cancellationToken (Optional)
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task
A Task.
See Also

Reference

RedisCacheDependencyGarbageCollector Class
PerformFullCollectionAsync Overload
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCacheInvalidator Class

An implementation of CacheInvalidator that uses Redis publish/subscribe channels to invalidate several instances of local caches.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Caching.ImplementationCachingBackend
PostSharp.Patterns.Caching.ImplementationCachingBackendEnhancer
PostSharp.Patterns.Caching.ImplementationCacheInvalidator
PostSharp.Patterns.Caching.Backends.RedisRedisCacheInvalidator

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class RedisCacheInvalidator : CacheInvalidator

The RedisCacheInvalidator type exposes the following members.

Properties
 | Name | Description
Public property | Connection | Gets the Redis IConnectionMultiplexer used by the current RedisCacheInvalidator.
Public property | Id | Gets the Guid of the current CachingBackend. (Inherited from CachingBackend.)
Protected property | Logger | Gets the Logger that implementations can use to emit log records. (Inherited from CachingBackend.)
Public property | Options | Gets the options of the current CacheInvalidator. (Inherited from CacheInvalidator.)
Public property | Status | Gets the status of the current CachingBackend (Default, Disposing or Disposed). (Inherited from CachingBackend.)
Public property | SupportedFeatures | Gets the set of features supported by the current CachingBackend. (Inherited from CachingBackend.)
Public property | UnderlyingBackend | Gets the next CachingBackend in the chain of responsibility. (Inherited from CachingBackendEnhancer.)
Public property | ValueAdapters | Gets the factory of value adapters (IValueAdapter), which allow for instance to cache things like Stream or IEnumerable, which could not be otherwise cached. (Inherited from CachingBackend.)
Top
Methods
 | Name | Description
Public method | Clear | Clears the cache. (Inherited from CachingBackend.)
Public method | ClearAsync | Asynchronously clears the cache. (Inherited from CachingBackend.)
Protected method | ClearAsyncCore | Asynchronously clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Inherited from CachingBackendEnhancer.)
Protected method | ClearCore | Clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Inherited from CachingBackendEnhancer.)
Public method | ContainsDependency | Determines whether the cache contains a given dependency. (Inherited from CachingBackend.)
Public method | ContainsDependencyAsync | Asynchronously determines whether the cache contains a given dependency. (Inherited from CachingBackend.)
Protected method | ContainsDependencyAsyncCore | Asynchronously determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Protected method | ContainsDependencyCore | Determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Public method | ContainsItem | Determines whether the cache contains an item of a given key. (Inherited from CachingBackend.)
Public method | ContainsItemAsync | Asynchronously determines whether the cache contains an item of a given key. (Inherited from CachingBackend.)
Protected method | ContainsItemAsyncCore | Asynchronously determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Protected method | ContainsItemCore | Determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
 | Create | Creates a new RedisCacheInvalidator.
 | CreateAsync | Asynchronously creates a new RedisCacheInvalidator.
Protected method | CreateFeatures | Creates a CachingBackendFeatures object, which describes set of features implemented by the back-end. This method is invoked the first time the SupportedFeatures property is evaluated. The result is then cached. (Inherited from CachingBackendEnhancer.)
Public method | Dispose | Synchronously disposes the current CachingBackend. (Inherited from CachingBackend.)
Protected method | Dispose(Boolean) | Synchronously disposes the current CachingBackend, with a parameter instructing whether this method is called because of a call to the Dispose method or because of object finalizing. (Inherited from CachingBackend.)
Public method | DisposeAsync | Asynchronously dispose the current CachingBackend. (Inherited from CachingBackend.)
Protected method | DisposeAsyncCore | Asynchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Overrides CachingBackendEnhancerDisposeAsyncCore(CancellationToken).)
Protected method | DisposeCore | Synchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Overrides CachingBackendEnhancerDisposeCore(Boolean).)
Public method | GetItem | Gets a cache item given its key. (Inherited from CachingBackend.)
Public method | GetItemAsync | Asynchronously gets a cache item given its key. (Inherited from CachingBackend.)
Protected method | GetItemAsyncCore | Asynchronously gets a cache item given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Protected method | GetItemCore | Gets a cache item given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Public method | InvalidateDependency | Removes from the cache all items that have a specific dependency. (Inherited from CachingBackend.)
Public method | InvalidateDependencyAsync | Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackend.)
Protected method | InvalidateDependencyAsyncCore | Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CacheInvalidator.)
Protected method | InvalidateDependencyCore | Removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CacheInvalidator.)
Protected method | OnBackendDependencyInvalidated | Method invoked when the DependencyInvalidated event of the next UnderlyingBackend in the chain of responsibility is invoked. (Inherited from CachingBackendEnhancer.)
Protected method | OnBackendItemRemoved | Method invoked when the ItemRemoved event of the next UnderlyingBackend in the chain of responsibility is invoked. (Inherited from CachingBackendEnhancer.)
Protected method | OnDependencyInvalidated(CacheDependencyInvalidatedEventArgs) | Raises the DependencyInvalidated event given a CacheDependencyInvalidatedEventArgs. (Inherited from CachingBackend.)
Protected method | OnDependencyInvalidated(String, Guid) | Raises the DependencyInvalidated event , but lazily instantiates the CacheDependencyInvalidatedEventArgs if there is an event client. (Inherited from CachingBackend.)
Protected method | OnItemRemoved(CacheItemRemovedEventArgs) | Raises the ItemRemoved event given a CacheItemRemovedEventArgs. (Inherited from CachingBackend.)
Protected method | OnItemRemoved(String, CacheItemRemovedReason, Guid) | Raises the ItemRemoved event, but lazily instantiates the CacheItemRemovedEventArgs if there is an event client. (Inherited from CachingBackend.)
Protected method | OnMessageReceived | Implementations of CacheInvalidator must call this method when an invalidation message is received. (Inherited from CacheInvalidator.)
Public method | RemoveItem | Removes a cache item from the cache given its key. (Inherited from CachingBackend.)
Public method | RemoveItemAsync | Asynchronously removes a cache item from the cache given its key. (Inherited from CachingBackend.)
Protected method | RemoveItemAsyncCore | Asynchronously removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CacheInvalidator.)
Protected method | RemoveItemCore | Removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CacheInvalidator.)
Protected method | SendMessageAsync | Sends an invalidation message over the message bus of the implementation. (Overrides CacheInvalidatorSendMessageAsync(String, CancellationToken).)
Public method | SetItem | Sets a cache item. (Inherited from CachingBackend.)
Public method | SetItemAsync | Asynchronously sets a cache item. (Inherited from CachingBackend.)
Protected method | SetItemAsyncCore | Asynchronously sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. The default implementation is to call the synchronous SetItemCore(String, CacheItem) method. (Inherited from CachingBackendEnhancer.)
Protected method | SetItemCore | Sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Public method | ToString | Returns a string that represents the current object. (Inherited from CachingBackend.)
Public method | WhenBackgroundTasksCompleted | Returns a Task that is signaled to the complete state when all background tasks have completed. (Inherited from CachingBackend.)
Top
Events
 | Name | Description
Public event | DependencyInvalidated | Events raised when a dependency is invalidated. Check the Events property to see if the current CachingBackend supports events. (Inherited from CachingBackend.)
Public event | ItemRemoved | Event raised when a cache item is removed from the cache. Check the Events property to see if the current CachingBackend supports events. (Inherited from CachingBackend.)
Top
See Also

Reference

PostSharp.Patterns.Caching.Backends.Redis Namespace

Other Resources

Conceptual: Synchronizing Local In-Memory Caches for Multiple Servers


RedisCacheInvalidator Properties

The RedisCacheInvalidator type exposes the following members.

Properties
 | Name | Description
Public property | Connection | Gets the Redis IConnectionMultiplexer used by the current RedisCacheInvalidator.
Public property | Id | Gets the Guid of the current CachingBackend. (Inherited from CachingBackend.)
Protected property | Logger | Gets the Logger that implementations can use to emit log records. (Inherited from CachingBackend.)
Public property | Options | Gets the options of the current CacheInvalidator. (Inherited from CacheInvalidator.)
Public property | Status | Gets the status of the current CachingBackend (Default, Disposing or Disposed). (Inherited from CachingBackend.)
Public property | SupportedFeatures | Gets the set of features supported by the current CachingBackend. (Inherited from CachingBackend.)
Public property | UnderlyingBackend | Gets the next CachingBackend in the chain of responsibility. (Inherited from CachingBackendEnhancer.)
Public property | ValueAdapters | Gets the factory of value adapters (IValueAdapter), which allow for instance to cache things like Stream or IEnumerable, which could not be otherwise cached. (Inherited from CachingBackend.)
Top
See Also

Reference

RedisCacheInvalidator Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCacheInvalidator.Connection Property

RedisCacheInvalidatorConnection Property

Gets the Redis IConnectionMultiplexer used by the current RedisCacheInvalidator.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IConnectionMultiplexer Connection { get; }

Property Value

Type: IConnectionMultiplexer
See Also

Reference

RedisCacheInvalidator Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCacheInvalidator Methods

The RedisCacheInvalidator type exposes the following members.

Methods
 | Name | Description
Public method | Clear | Clears the cache. (Inherited from CachingBackend.)
Public method | ClearAsync | Asynchronously clears the cache. (Inherited from CachingBackend.)
Protected method | ClearAsyncCore | Asynchronously clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Inherited from CachingBackendEnhancer.)
Protected method | ClearCore | Clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Inherited from CachingBackendEnhancer.)
Public method | ContainsDependency | Determines whether the cache contains a given dependency. (Inherited from CachingBackend.)
Public method | ContainsDependencyAsync | Asynchronously determines whether the cache contains a given dependency. (Inherited from CachingBackend.)
Protected method | ContainsDependencyAsyncCore | Asynchronously determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Protected method | ContainsDependencyCore | Determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Public method | ContainsItem | Determines whether the cache contains an item of a given key. (Inherited from CachingBackend.)
Public method | ContainsItemAsync | Asynchronously determines whether the cache contains an item of a given key. (Inherited from CachingBackend.)
Protected method | ContainsItemAsyncCore | Asynchronously determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Protected method | ContainsItemCore | Determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
 | Create | Creates a new RedisCacheInvalidator.
 | CreateAsync | Asynchronously creates a new RedisCacheInvalidator.
Protected method | CreateFeatures | Creates a CachingBackendFeatures object, which describes set of features implemented by the back-end. This method is invoked the first time the SupportedFeatures property is evaluated. The result is then cached. (Inherited from CachingBackendEnhancer.)
Public method | Dispose | Synchronously disposes the current CachingBackend. (Inherited from CachingBackend.)
Protected method | Dispose(Boolean) | Synchronously disposes the current CachingBackend, with a parameter instructing whether this method is called because of a call to the Dispose method or because of object finalizing. (Inherited from CachingBackend.)
Public method | DisposeAsync | Asynchronously dispose the current CachingBackend. (Inherited from CachingBackend.)
Protected method | DisposeAsyncCore | Asynchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Overrides CachingBackendEnhancerDisposeAsyncCore(CancellationToken).)
Protected method | DisposeCore | Synchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Overrides CachingBackendEnhancerDisposeCore(Boolean).)
Public method | GetItem | Gets a cache item given its key. (Inherited from CachingBackend.)
Public method | GetItemAsync | Asynchronously gets a cache item given its key. (Inherited from CachingBackend.)
Protected method | GetItemAsyncCore | Asynchronously gets a cache item given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Protected method | GetItemCore | Gets a cache item given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Public method | InvalidateDependency | Removes from the cache all items that have a specific dependency. (Inherited from CachingBackend.)
Public method | InvalidateDependencyAsync | Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackend.)
Protected method | InvalidateDependencyAsyncCore | Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CacheInvalidator.)
Protected method | InvalidateDependencyCore | Removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CacheInvalidator.)
Protected method | OnBackendDependencyInvalidated | Method invoked when the DependencyInvalidated event of the next UnderlyingBackend in the chain of responsibility is invoked. (Inherited from CachingBackendEnhancer.)
Protected method | OnBackendItemRemoved | Method invoked when the ItemRemoved event of the next UnderlyingBackend in the chain of responsibility is invoked. (Inherited from CachingBackendEnhancer.)
Protected method | OnDependencyInvalidated(CacheDependencyInvalidatedEventArgs) | Raises the DependencyInvalidated event given a CacheDependencyInvalidatedEventArgs. (Inherited from CachingBackend.)
Protected method | OnDependencyInvalidated(String, Guid) | Raises the DependencyInvalidated event , but lazily instantiates the CacheDependencyInvalidatedEventArgs if there is an event client. (Inherited from CachingBackend.)
Protected method | OnItemRemoved(CacheItemRemovedEventArgs) | Raises the ItemRemoved event given a CacheItemRemovedEventArgs. (Inherited from CachingBackend.)
Protected method | OnItemRemoved(String, CacheItemRemovedReason, Guid) | Raises the ItemRemoved event, but lazily instantiates the CacheItemRemovedEventArgs if there is an event client. (Inherited from CachingBackend.)
Protected method | OnMessageReceived | Implementations of CacheInvalidator must call this method when an invalidation message is received. (Inherited from CacheInvalidator.)
Public method | RemoveItem | Removes a cache item from the cache given its key. (Inherited from CachingBackend.)
Public method | RemoveItemAsync | Asynchronously removes a cache item from the cache given its key. (Inherited from CachingBackend.)
Protected method | RemoveItemAsyncCore | Asynchronously removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CacheInvalidator.)
Protected method | RemoveItemCore | Removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CacheInvalidator.)
Protected method | SendMessageAsync | Sends an invalidation message over the message bus of the implementation. (Overrides CacheInvalidatorSendMessageAsync(String, CancellationToken).)
Public method | SetItem | Sets a cache item. (Inherited from CachingBackend.)
Public method | SetItemAsync | Asynchronously sets a cache item. (Inherited from CachingBackend.)
Protected method | SetItemAsyncCore | Asynchronously sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. The default implementation is to call the synchronous SetItemCore(String, CacheItem) method. (Inherited from CachingBackendEnhancer.)
Protected method | SetItemCore | Sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Public method | ToString | Returns a string that represents the current object. (Inherited from CachingBackend.)
Public method | WhenBackgroundTasksCompleted | Returns a Task that is signaled to the complete state when all background tasks have completed. (Inherited from CachingBackend.)
Top
See Also

Reference

RedisCacheInvalidator Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCacheInvalidator.Create Method

RedisCacheInvalidatorCreate Method

Creates a new RedisCacheInvalidator.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static RedisCacheInvalidator Create(
    CachingBackend backend,
    IConnectionMultiplexer connection,
    RedisCacheInvalidatorOptions options
)

Parameters

backend
Type: PostSharp.Patterns.Caching.ImplementationCachingBackend
A local (typically in-memory) caching back-end.
connection
Type: IConnectionMultiplexer
A Redis connection.
options
Type: PostSharp.Patterns.Caching.Backends.RedisRedisCacheInvalidatorOptions
Options.

Return Value

Type: RedisCacheInvalidator
A new RedisCacheInvalidator.
See Also

Reference

RedisCacheInvalidator Class
PostSharp.Patterns.Caching.Backends.Redis Namespace

Other Resources

Conceptual: Synchronizing Local In-Memory Caches for Multiple Servers


RedisCacheInvalidator.CreateAsync Method

RedisCacheInvalidatorCreateAsync Method

Asynchronously creates a new RedisCacheInvalidator.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Task<RedisCacheInvalidator> CreateAsync(
    CachingBackend backend,
    IConnectionMultiplexer connection,
    RedisCacheInvalidatorOptions options,
    CancellationToken cancellationToken = null
)

Parameters

backend
Type: PostSharp.Patterns.Caching.ImplementationCachingBackend
A local (typically in-memory) caching back-end.
connection
Type: IConnectionMultiplexer
A Redis connection.
options
Type: PostSharp.Patterns.Caching.Backends.RedisRedisCacheInvalidatorOptions
Options.
cancellationToken (Optional)
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task RedisCacheInvalidator
A Task returning a new RedisCacheInvalidator.
See Also

Reference

RedisCacheInvalidator Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCacheInvalidator.DisposeAsyncCore Method

RedisCacheInvalidatorDisposeAsyncCore Method

Asynchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override Task DisposeAsyncCore(
    CancellationToken cancellationToken
)

Parameters

cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task
A Task.
See Also

Reference

RedisCacheInvalidator Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCacheInvalidator.DisposeCore Method

RedisCacheInvalidatorDisposeCore Method

Synchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void DisposeCore(
    bool disposing
)

Parameters

disposing
Type: SystemBoolean
See Also

Reference

RedisCacheInvalidator Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCacheInvalidator.SendMessageAsync Method

RedisCacheInvalidatorSendMessageAsync Method

Sends an invalidation message over the message bus of the implementation.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override Task SendMessageAsync(
    string message,
    CancellationToken cancellationToken
)

Parameters

message
Type: SystemString
A serialized, opaque serialization message.
cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task
A Task.
See Also

Reference

RedisCacheInvalidator Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCacheInvalidator Events

The RedisCacheInvalidator type exposes the following members.

Events
 | Name | Description
Public event | DependencyInvalidated | Events raised when a dependency is invalidated. Check the Events property to see if the current CachingBackend supports events. (Inherited from CachingBackend.)
Public event | ItemRemoved | Event raised when a cache item is removed from the cache. Check the Events property to see if the current CachingBackend supports events. (Inherited from CachingBackend.)
Top
See Also

Reference

RedisCacheInvalidator Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCacheInvalidatorOptions Class

Options for RedisCacheInvalidator.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Caching.ImplementationCacheInvalidatorOptions
PostSharp.Patterns.Caching.Backends.RedisRedisCacheInvalidatorOptions

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class RedisCacheInvalidatorOptions : CacheInvalidatorOptions

The RedisCacheInvalidatorOptions type exposes the following members.

Constructors
 | Name | Description
Public method | RedisCacheInvalidatorOptions | Initializes a new instance of the RedisCacheInvalidatorOptions class
Top
Properties
 | Name | Description
Public property | ChannelName | Name of the Redis channel to use to exchange invalidation messages. The default value is RedisCacheInvalidator.
Public property | OwnsConnection | Determines whether disposing the RedisCacheInvalidator also disposes the Redis connection. The default value is false.
Public property | Prefix | Gets or sets the prefix of messages sent by the CacheInvalidator. Messages received by the OnMessageReceived(String) method are ignored if they don't start with the proper prefix. (Inherited from CacheInvalidatorOptions.)
Top
See Also

Reference

PostSharp.Patterns.Caching.Backends.Redis Namespace

Other Resources

Conceptual: Synchronizing Local In-Memory Caches for Multiple Servers


RedisCacheInvalidatorOptions Constructor

Initializes a new instance of the RedisCacheInvalidatorOptions class

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public RedisCacheInvalidatorOptions()
See Also

Reference

RedisCacheInvalidatorOptions Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCacheInvalidatorOptions Properties

The RedisCacheInvalidatorOptions type exposes the following members.

Properties
 | Name | Description
Public property | ChannelName | Name of the Redis channel to use to exchange invalidation messages. The default value is RedisCacheInvalidator.
Public property | OwnsConnection | Determines whether disposing the RedisCacheInvalidator also disposes the Redis connection. The default value is false.
Public property | Prefix | Gets or sets the prefix of messages sent by the CacheInvalidator. Messages received by the OnMessageReceived(String) method are ignored if they don't start with the proper prefix. (Inherited from CacheInvalidatorOptions.)
Top
See Also

Reference

RedisCacheInvalidatorOptions Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCacheInvalidatorOptions.ChannelName Property

RedisCacheInvalidatorOptionsChannelName Property

Name of the Redis channel to use to exchange invalidation messages. The default value is RedisCacheInvalidator.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string ChannelName { get; set; }

Property Value

Type: String
See Also

Reference

RedisCacheInvalidatorOptions Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCacheInvalidatorOptions.OwnsConnection Property

RedisCacheInvalidatorOptionsOwnsConnection Property

Determines whether disposing the RedisCacheInvalidator also disposes the Redis connection. The default value is false.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool OwnsConnection { get; set; }

Property Value

Type: Boolean
See Also

Reference

RedisCacheInvalidatorOptions Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCachingBackend Class

A CachingBackend for Redis, based on the StackExchange.Redis client.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Caching.ImplementationCachingBackend
PostSharp.Patterns.Caching.Backends.RedisRedisCachingBackend

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class RedisCachingBackend : CachingBackend

The RedisCachingBackend type exposes the following members.

Properties
 | Name | Description
Public property | Configuration | Gets the configuration of the current RedisCachingBackend.
Public property | Connection | Gets the Redis connection used by the current RedisCachingBackend.
Public property | Database | Gets the Redis database used by the current RedisCachingBackend.
Public property | Id | Gets the Guid of the current CachingBackend. (Inherited from CachingBackend.)
Protected property | Logger | Gets the Logger that implementations can use to emit log records. (Inherited from CachingBackend.)
Public property | Status | Gets the status of the current CachingBackend (Default, Disposing or Disposed). (Inherited from CachingBackend.)
Public property | SupportedFeatures | Gets the set of features supported by the current CachingBackend. (Inherited from CachingBackend.)
Public property | ValueAdapters | Gets the factory of value adapters (IValueAdapter), which allow for instance to cache things like Stream or IEnumerable, which could not be otherwise cached. (Inherited from CachingBackend.)
Top
Methods
 | Name | Description
Public method | Clear | Clears the cache. (Inherited from CachingBackend.)
Public method | ClearAsync | Asynchronously clears the cache. (Inherited from CachingBackend.)
Protected method | ClearAsyncCore | Asynchronously clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Overrides CachingBackendClearAsyncCore(CancellationToken).)
Protected method | ClearCore | Clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Overrides CachingBackendClearCore.)
Public method | ContainsDependency | Determines whether the cache contains a given dependency. (Inherited from CachingBackend.)
Public method | ContainsDependencyAsync | Asynchronously determines whether the cache contains a given dependency. (Inherited from CachingBackend.)
Protected method | ContainsDependencyAsyncCore | Asynchronously determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackend.)
Protected method | ContainsDependencyCore | Determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendContainsDependencyCore(String).)
Public method | ContainsItem | Determines whether the cache contains an item of a given key. (Inherited from CachingBackend.)
Public method | ContainsItemAsync | Asynchronously determines whether the cache contains an item of a given key. (Inherited from CachingBackend.)
Protected method | ContainsItemAsyncCore | Asynchronously determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendContainsItemAsyncCore(String, CancellationToken).)
Protected method | ContainsItemCore | Determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendContainsItemCore(String).)
 | Create | Creates a new RedisCachingBackend.
 | CreateAsync | Asynchronously creates a new RedisCachingBackend.
Protected method | CreateFeatures | Creates a CachingBackendFeatures object, which describes set of features implemented by the back-end. This method is invoked the first time the SupportedFeatures property is evaluated. The result is then cached. (Overrides CachingBackendCreateFeatures.)
Public method | Dispose | Synchronously disposes the current CachingBackend. (Inherited from CachingBackend.)
Protected method | Dispose(Boolean) | Synchronously disposes the current CachingBackend, with a parameter instructing whether this method is called because of a call to the Dispose method or because of object finalizing. (Inherited from CachingBackend.)
Public method | DisposeAsync | Asynchronously dispose the current CachingBackend. (Inherited from CachingBackend.)
Protected method | DisposeAsyncCore | Asynchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Overrides CachingBackendDisposeAsyncCore(CancellationToken).)
Protected method | DisposeCore | Synchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Overrides CachingBackendDisposeCore(Boolean).)
Protected method | Finalize | Destructor. (Overrides ObjectFinalize.)
Public method | GetItem | Gets a cache item given its key. (Inherited from CachingBackend.)
Public method | GetItemAsync | Asynchronously gets a cache item given its key. (Inherited from CachingBackend.)
Public method | InvalidateDependency | Removes from the cache all items that have a specific dependency. (Inherited from CachingBackend.)
Public method | InvalidateDependencyAsync | Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackend.)
Protected method | InvalidateDependencyAsyncCore | Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackend.)
Protected method | InvalidateDependencyCore | Removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendInvalidateDependencyCore(String).)
Protected method | OnDependencyInvalidated(CacheDependencyInvalidatedEventArgs) | Raises the DependencyInvalidated event given a CacheDependencyInvalidatedEventArgs. (Inherited from CachingBackend.)
Protected method | OnDependencyInvalidated(String, Guid) | Raises the DependencyInvalidated event , but lazily instantiates the CacheDependencyInvalidatedEventArgs if there is an event client. (Inherited from CachingBackend.)
Protected method | OnItemRemoved(CacheItemRemovedEventArgs) | Raises the ItemRemoved event given a CacheItemRemovedEventArgs. (Inherited from CachingBackend.)
Protected method | OnItemRemoved(String, CacheItemRemovedReason, Guid) | Raises the ItemRemoved event, but lazily instantiates the CacheItemRemovedEventArgs if there is an event client. (Inherited from CachingBackend.)
Protected method | ProcessEvent | Processes an event that was received on the events channel.
Public method | RemoveItem | Removes a cache item from the cache given its key. (Inherited from CachingBackend.)
Public method | RemoveItemAsync | Asynchronously removes a cache item from the cache given its key. (Inherited from CachingBackend.)
Protected method | RemoveItemAsyncCore | Asynchronously removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendRemoveItemAsyncCore(String, CancellationToken).)
Protected method | RemoveItemCore | Removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendRemoveItemCore(String).)
Protected method | SendEvent | Sends of event.
Protected method | SendEventAsync | Asynchronously sends of event.
Public method | SetItem | Sets a cache item. (Inherited from CachingBackend.)
Public method | SetItemAsync | Asynchronously sets a cache item. (Inherited from CachingBackend.)
Protected method | SetItemAsyncCore | Asynchronously sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. The default implementation is to call the synchronous SetItemCore(String, CacheItem) method. (Overrides CachingBackendSetItemAsyncCore(String, CacheItem, CancellationToken).)
Protected method | SetItemCore | Sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendSetItemCore(String, CacheItem).)
Public method | ToString | Returns a string that represents the current object. (Inherited from CachingBackend.)
Public method | WhenBackgroundTasksCompleted | Returns a Task that is signaled to the complete state when all background tasks have completed. (Overrides CachingBackendWhenBackgroundTasksCompleted(CancellationToken).)
Top
Events
 | Name | Description
Public event | DependencyInvalidated | Events raised when a dependency is invalidated. Check the Events property to see if the current CachingBackend supports events. (Inherited from CachingBackend.)
Public event | ItemRemoved | Event raised when a cache item is removed from the cache. Check the Events property to see if the current CachingBackend supports events. (Inherited from CachingBackend.)
Top
See Also

Reference

PostSharp.Patterns.Caching.Backends.Redis Namespace

Other Resources

Conceptual: Caching Back-Ends
Conceptual: Synchronizing Local In-Memory Caches for Multiple Servers
Conceptual: Using Redis Cache


RedisCachingBackend Properties

The RedisCachingBackend type exposes the following members.

Properties
 | Name | Description
Public property | Configuration | Gets the configuration of the current RedisCachingBackend.
Public property | Connection | Gets the Redis connection used by the current RedisCachingBackend.
Public property | Database | Gets the Redis database used by the current RedisCachingBackend.
Public property | Id | Gets the Guid of the current CachingBackend. (Inherited from CachingBackend.)
Protected property | Logger | Gets the Logger that implementations can use to emit log records. (Inherited from CachingBackend.)
Public property | Status | Gets the status of the current CachingBackend (Default, Disposing or Disposed). (Inherited from CachingBackend.)
Public property | SupportedFeatures | Gets the set of features supported by the current CachingBackend. (Inherited from CachingBackend.)
Public property | ValueAdapters | Gets the factory of value adapters (IValueAdapter), which allow for instance to cache things like Stream or IEnumerable, which could not be otherwise cached. (Inherited from CachingBackend.)
Top
See Also

Reference

RedisCachingBackend Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCachingBackend.Configuration Property

RedisCachingBackendConfiguration Property

Gets the configuration of the current RedisCachingBackend.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public RedisCachingBackendConfiguration Configuration { get; }

Property Value

Type: RedisCachingBackendConfiguration
See Also

Reference

RedisCachingBackend Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCachingBackend.Connection Property

RedisCachingBackendConnection Property

Gets the Redis connection used by the current RedisCachingBackend.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IConnectionMultiplexer Connection { get; }

Property Value

Type: IConnectionMultiplexer
See Also

Reference

RedisCachingBackend Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCachingBackend.Database Property

RedisCachingBackendDatabase Property

Gets the Redis database used by the current RedisCachingBackend.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IDatabase Database { get; }

Property Value

Type: IDatabase
See Also

Reference

RedisCachingBackend Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCachingBackend Methods

The RedisCachingBackend type exposes the following members.

Methods
 | Name | Description
Public method | Clear | Clears the cache. (Inherited from CachingBackend.)
Public method | ClearAsync | Asynchronously clears the cache. (Inherited from CachingBackend.)
Protected method | ClearAsyncCore | Asynchronously clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Overrides CachingBackendClearAsyncCore(CancellationToken).)
Protected method | ClearCore | Clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Overrides CachingBackendClearCore.)
Public method | ContainsDependency | Determines whether the cache contains a given dependency. (Inherited from CachingBackend.)
Public method | ContainsDependencyAsync | Asynchronously determines whether the cache contains a given dependency. (Inherited from CachingBackend.)
Protected method | ContainsDependencyAsyncCore | Asynchronously determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackend.)
Protected method | ContainsDependencyCore | Determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendContainsDependencyCore(String).)
Public method | ContainsItem | Determines whether the cache contains an item of a given key. (Inherited from CachingBackend.)
Public method | ContainsItemAsync | Asynchronously determines whether the cache contains an item of a given key. (Inherited from CachingBackend.)
Protected method | ContainsItemAsyncCore | Asynchronously determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendContainsItemAsyncCore(String, CancellationToken).)
Protected method | ContainsItemCore | Determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendContainsItemCore(String).)
 | Create | Creates a new RedisCachingBackend.
 | CreateAsync | Asynchronously creates a new RedisCachingBackend.
Protected method | CreateFeatures | Creates a CachingBackendFeatures object, which describes set of features implemented by the back-end. This method is invoked the first time the SupportedFeatures property is evaluated. The result is then cached. (Overrides CachingBackendCreateFeatures.)
Public method | Dispose | Synchronously disposes the current CachingBackend. (Inherited from CachingBackend.)
Protected method | Dispose(Boolean) | Synchronously disposes the current CachingBackend, with a parameter instructing whether this method is called because of a call to the Dispose method or because of object finalizing. (Inherited from CachingBackend.)
Public method | DisposeAsync | Asynchronously dispose the current CachingBackend. (Inherited from CachingBackend.)
Protected method | DisposeAsyncCore | Asynchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Overrides CachingBackendDisposeAsyncCore(CancellationToken).)
Protected method | DisposeCore | Synchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Overrides CachingBackendDisposeCore(Boolean).)
Protected method | Finalize | Destructor. (Overrides ObjectFinalize.)
Public method | GetItem | Gets a cache item given its key. (Inherited from CachingBackend.)
Public method | GetItemAsync | Asynchronously gets a cache item given its key. (Inherited from CachingBackend.)
Public method | InvalidateDependency | Removes from the cache all items that have a specific dependency. (Inherited from CachingBackend.)
Public method | InvalidateDependencyAsync | Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackend.)
Protected method | InvalidateDependencyAsyncCore | Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackend.)
Protected method | InvalidateDependencyCore | Removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendInvalidateDependencyCore(String).)
Protected method | OnDependencyInvalidated(CacheDependencyInvalidatedEventArgs) | Raises the DependencyInvalidated event given a CacheDependencyInvalidatedEventArgs. (Inherited from CachingBackend.)
Protected method | OnDependencyInvalidated(String, Guid) | Raises the DependencyInvalidated event , but lazily instantiates the CacheDependencyInvalidatedEventArgs if there is an event client. (Inherited from CachingBackend.)
Protected method | OnItemRemoved(CacheItemRemovedEventArgs) | Raises the ItemRemoved event given a CacheItemRemovedEventArgs. (Inherited from CachingBackend.)
Protected method | OnItemRemoved(String, CacheItemRemovedReason, Guid) | Raises the ItemRemoved event, but lazily instantiates the CacheItemRemovedEventArgs if there is an event client. (Inherited from CachingBackend.)
Protected method | ProcessEvent | Processes an event that was received on the events channel.
Public method | RemoveItem | Removes a cache item from the cache given its key. (Inherited from CachingBackend.)
Public method | RemoveItemAsync | Asynchronously removes a cache item from the cache given its key. (Inherited from CachingBackend.)
Protected method | RemoveItemAsyncCore | Asynchronously removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendRemoveItemAsyncCore(String, CancellationToken).)
Protected method | RemoveItemCore | Removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendRemoveItemCore(String).)
Protected method | SendEvent | Sends of event.
Protected method | SendEventAsync | Asynchronously sends of event.
Public method | SetItem | Sets a cache item. (Inherited from CachingBackend.)
Public method | SetItemAsync | Asynchronously sets a cache item. (Inherited from CachingBackend.)
Protected method | SetItemAsyncCore | Asynchronously sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. The default implementation is to call the synchronous SetItemCore(String, CacheItem) method. (Overrides CachingBackendSetItemAsyncCore(String, CacheItem, CancellationToken).)
Protected method | SetItemCore | Sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendSetItemCore(String, CacheItem).)
Public method | ToString | Returns a string that represents the current object. (Inherited from CachingBackend.)
Public method | WhenBackgroundTasksCompleted | Returns a Task that is signaled to the complete state when all background tasks have completed. (Overrides CachingBackendWhenBackgroundTasksCompleted(CancellationToken).)
Top
See Also

Reference

RedisCachingBackend Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCachingBackend.ClearAsyncCore Method

RedisCachingBackendClearAsyncCore Method

Asynchronously clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override Task ClearAsyncCore(
    CancellationToken cancellationToken
)

Parameters

cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task
A Task.
See Also

Reference

RedisCachingBackend Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCachingBackend.ClearCore Method

RedisCachingBackendClearCore Method

Clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void ClearCore()
See Also

Reference

RedisCachingBackend Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCachingBackend.ContainsDependencyCore Method

RedisCachingBackendContainsDependencyCore Method

Determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override bool ContainsDependencyCore(
    string key
)

Parameters

key
Type: SystemString
The dependency key.

Return Value

Type: Boolean
true if the cache contains the dependency key, otherwise false.
See Also

Reference

RedisCachingBackend Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCachingBackend.ContainsItemAsyncCore Method

RedisCachingBackendContainsItemAsyncCore Method

Asynchronously determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override Task<bool> ContainsItemAsyncCore(
    string key,
    CancellationToken cancellationToken
)

Parameters

key
Type: SystemString
The key of the cache item.
cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task Boolean
A Task that evaluates to true if the cache contains an item whose key is key, otherwise false.
See Also

Reference

RedisCachingBackend Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCachingBackend.ContainsItemCore Method

RedisCachingBackendContainsItemCore Method

Determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override bool ContainsItemCore(
    string key
)

Parameters

key
Type: SystemString
The key of the cache item.

Return Value

Type: Boolean
true if the cache contains an item whose key is key, otherwise false.
See Also

Reference

RedisCachingBackend Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCachingBackend.Create Method

RedisCachingBackendCreate Method

Creates a new RedisCachingBackend.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static CachingBackend Create(
    IConnectionMultiplexer connection,
    RedisCachingBackendConfiguration configuration
)

Parameters

connection
Type: IConnectionMultiplexer
A Redis connection.
configuration
Type: PostSharp.Patterns.Caching.Backends.RedisRedisCachingBackendConfiguration
Configuration of the new back-end.

Return Value

Type: CachingBackend
A RedisCachingBackend, DependenciesRedisCachingBackend, or a TwoLayerCachingBackendEnhancer, according to the properties of the configuration.
See Also

Reference

RedisCachingBackend Class
PostSharp.Patterns.Caching.Backends.Redis Namespace

Other Resources

Conceptual: Using Redis Cache


RedisCachingBackend.CreateAsync Method

RedisCachingBackendCreateAsync Method

Asynchronously creates a new RedisCachingBackend.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Task<CachingBackend> CreateAsync(
    IConnectionMultiplexer connection,
    RedisCachingBackendConfiguration configuration,
    CancellationToken cancellationToken = null
)

Parameters

connection
Type: IConnectionMultiplexer
A Redis connection.
configuration
Type: PostSharp.Patterns.Caching.Backends.RedisRedisCachingBackendConfiguration
Configuration of the new back-end.
cancellationToken (Optional)
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task CachingBackend
A task returning a RedisCachingBackend, DependenciesRedisCachingBackend, or a TwoLayerCachingBackendEnhancer, according to the properties of the configuration.
See Also

Reference

RedisCachingBackend Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCachingBackend.CreateFeatures Method

RedisCachingBackendCreateFeatures Method

Creates a CachingBackendFeatures object, which describes set of features implemented by the back-end. This method is invoked the first time the SupportedFeatures property is evaluated. The result is then cached.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override CachingBackendFeatures CreateFeatures()

Return Value

Type: CachingBackendFeatures
A new instance of the CachingBackendEnhancerFeatures class.
See Also

Reference

RedisCachingBackend Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCachingBackend.DisposeAsyncCore Method

RedisCachingBackendDisposeAsyncCore Method

Asynchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override Task DisposeAsyncCore(
    CancellationToken cancellationToken
)

Parameters

cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task
A Task.
See Also

Reference

RedisCachingBackend Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCachingBackend.DisposeCore Method

RedisCachingBackendDisposeCore Method

Synchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void DisposeCore(
    bool disposing
)

Parameters

disposing
Type: SystemBoolean
See Also

Reference

RedisCachingBackend Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCachingBackend.Finalize Method

RedisCachingBackendFinalize Method

Destructor.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void Finalize()

Implements

ObjectFinalize
See Also

Reference

RedisCachingBackend Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCachingBackend.InvalidateDependencyCore Method

RedisCachingBackendInvalidateDependencyCore Method

Removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void InvalidateDependencyCore(
    string key
)

Parameters

key
Type: SystemString
The dependency key.
See Also

Reference

RedisCachingBackend Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCachingBackend.ProcessEvent Method

RedisCachingBackendProcessEvent Method

Processes an event that was received on the events channel.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual bool ProcessEvent(
    string kind,
    string key,
    Guid sourceId
)

Parameters

kind
Type: SystemString
Kind of event.
key
Type: SystemString
Key of the item (value key or dependency key, typically).
sourceId
Type: SystemGuid
Guid of the RedisCachingBackend that sent the event.

Return Value

Type: Boolean
See Also

Reference

RedisCachingBackend Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCachingBackend.RemoveItemAsyncCore Method

RedisCachingBackendRemoveItemAsyncCore Method

Asynchronously removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override Task RemoveItemAsyncCore(
    string key,
    CancellationToken cancellationToken
)

Parameters

key
Type: SystemString
The key of the cache item.
cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task
A Task.
See Also

Reference

RedisCachingBackend Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCachingBackend.RemoveItemCore Method

RedisCachingBackendRemoveItemCore Method

Removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void RemoveItemCore(
    string key
)

Parameters

key
Type: SystemString
The key of the cache item.
See Also

Reference

RedisCachingBackend Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCachingBackend.SendEvent Method

RedisCachingBackendSendEvent Method

Sends of event.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected void SendEvent(
    string kind,
    string key
)

Parameters

kind
Type: SystemString
Kind of event.
key
Type: SystemString
Key of the item (value key or dependency key, typically).
See Also

Reference

RedisCachingBackend Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCachingBackend.SendEventAsync Method

RedisCachingBackendSendEventAsync Method

Asynchronously sends of event.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected Task SendEventAsync(
    string kind,
    string key
)

Parameters

kind
Type: SystemString
Kind of event.
key
Type: SystemString
Key of the item (value key or dependency key, typically).

Return Value

Type: Task
A Task.
See Also

Reference

RedisCachingBackend Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCachingBackend.SetItemAsyncCore Method

RedisCachingBackendSetItemAsyncCore Method

Asynchronously sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. The default implementation is to call the synchronous SetItemCore(String, CacheItem) method.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override Task SetItemAsyncCore(
    string key,
    CacheItem item,
    CancellationToken cancellationToken
)

Parameters

key
Type: SystemString
The key of the cache item.
item
Type: PostSharp.Patterns.Caching.ImplementationCacheItem
The cache item.
cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task
A Task.
See Also

Reference

RedisCachingBackend Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCachingBackend.SetItemCore Method

RedisCachingBackendSetItemCore Method

Sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void SetItemCore(
    string key,
    CacheItem item
)

Parameters

key
Type: SystemString
The key of the cache item.
item
Type: PostSharp.Patterns.Caching.ImplementationCacheItem
The cache item.
See Also

Reference

RedisCachingBackend Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCachingBackend.WhenBackgroundTasksCompleted Method

RedisCachingBackendWhenBackgroundTasksCompleted Method

Returns a Task that is signaled to the complete state when all background tasks have completed.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Task WhenBackgroundTasksCompleted(
    CancellationToken cancellationToken
)

Parameters

cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task
A Task that is signaled to the complete state when all background tasks have completed
Remarks

Other background tasks may possibly be enqueued between the time the returned Task has been signaled and the time the signal is processed by the caller.

See Also

Reference

RedisCachingBackend Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCachingBackend Events

The RedisCachingBackend type exposes the following members.

Events
 | Name | Description
Public event | DependencyInvalidated | Events raised when a dependency is invalidated. Check the Events property to see if the current CachingBackend supports events. (Inherited from CachingBackend.)
Public event | ItemRemoved | Event raised when a cache item is removed from the cache. Check the Events property to see if the current CachingBackend supports events. (Inherited from CachingBackend.)
Top
See Also

Reference

RedisCachingBackend Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCachingBackendConfiguration Class

Configuration for RedisCachingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Caching.Backends.RedisRedisCachingBackendConfiguration

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class RedisCachingBackendConfiguration : ICloneable

The RedisCachingBackendConfiguration type exposes the following members.

Constructors
 | Name | Description
Public method | RedisCachingBackendConfiguration | Initializes a new instance of the RedisCachingBackendConfiguration class
Top
Properties
 | Name | Description
Public property | CreateSerializer | Gets or sets a function that creates the serializer used to serialize objects into byte arrays (and conversely). The default value is null, which means that BinarySerializer will be used.
Public property | Database | Gets the index of the database to use. The default value is -1 (automatic selection).
Public property | DefaultExpiration | Gets or sets the default expiration time of cached items. All items that don't have an explicit expiration time are automatically expired according to the value of this property, unless they have the NotRemovable priority. The default value is 1 day.
Public property | IsFrozen |
Public property | IsLocallyCached | Determines whether a MemoryCachingBackend should be added in front of the RedisCachingBackend.
Public property | KeyPrefix | Gets the prefix for the key of all Redis items created by the RedisCachingBackend. The default value is cache.
Public property | OwnsConnection | Determines whether the RedisCachingBackend should dispose the Redis connection when the RedisCachingBackend itself is disposed.
Public property | SupportsDependencies | Determines whether the RedisCachingBackend should support dependencies. When this property is used, the DependenciesRedisCachingBackend class is used instead of RedisCachingBackend. When dependencies are enabled, at least one instance of the RedisCacheDependencyGarbageCollector MUST run.
Public property | TransactionMaxRetries | Gets or sets the number of times Redis transactions are retried when they fail due to a data conflict, before an exception is raised. The default value is 5.
Top
Methods
 | Name | Description
Protected method | CheckFrozen | Throws an InvalidOperationException if the object has been frozen.
Public method | Clone |
Top
See Also

Reference

PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCachingBackendConfiguration Constructor

Initializes a new instance of the RedisCachingBackendConfiguration class

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public RedisCachingBackendConfiguration()
See Also

Reference

RedisCachingBackendConfiguration Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCachingBackendConfiguration Properties

The RedisCachingBackendConfiguration type exposes the following members.

Properties
 | Name | Description
Public property | CreateSerializer | Gets or sets a function that creates the serializer used to serialize objects into byte arrays (and conversely). The default value is null, which means that BinarySerializer will be used.
Public property | Database | Gets the index of the database to use. The default value is -1 (automatic selection).
Public property | DefaultExpiration | Gets or sets the default expiration time of cached items. All items that don't have an explicit expiration time are automatically expired according to the value of this property, unless they have the NotRemovable priority. The default value is 1 day.
Public property | IsFrozen |
Public property | IsLocallyCached | Determines whether a MemoryCachingBackend should be added in front of the RedisCachingBackend.
Public property | KeyPrefix | Gets the prefix for the key of all Redis items created by the RedisCachingBackend. The default value is cache.
Public property | OwnsConnection | Determines whether the RedisCachingBackend should dispose the Redis connection when the RedisCachingBackend itself is disposed.
Public property | SupportsDependencies | Determines whether the RedisCachingBackend should support dependencies. When this property is used, the DependenciesRedisCachingBackend class is used instead of RedisCachingBackend. When dependencies are enabled, at least one instance of the RedisCacheDependencyGarbageCollector MUST run.
Public property | TransactionMaxRetries | Gets or sets the number of times Redis transactions are retried when they fail due to a data conflict, before an exception is raised. The default value is 5.
Top
See Also

Reference

RedisCachingBackendConfiguration Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCachingBackendConfiguration.CreateSerializer Property

RedisCachingBackendConfigurationCreateSerializer Property

Gets or sets a function that creates the serializer used to serialize objects into byte arrays (and conversely). The default value is null, which means that BinarySerializer will be used.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Func<ISerializer> CreateSerializer { get; set; }

Property Value

Type: Func ISerializer
See Also

Reference

RedisCachingBackendConfiguration Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCachingBackendConfiguration.Database Property

RedisCachingBackendConfigurationDatabase Property

Gets the index of the database to use. The default value is -1 (automatic selection).

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int Database { get; set; }

Property Value

Type: Int32
See Also

Reference

RedisCachingBackendConfiguration Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCachingBackendConfiguration.DefaultExpiration Property

RedisCachingBackendConfigurationDefaultExpiration Property

Gets or sets the default expiration time of cached items. All items that don't have an explicit expiration time are automatically expired according to the value of this property, unless they have the NotRemovable priority. The default value is 1 day.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TimeSpan DefaultExpiration { get; set; }

Property Value

Type: TimeSpan
See Also

Reference

RedisCachingBackendConfiguration Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCachingBackendConfiguration.IsFrozen Property

RedisCachingBackendConfigurationIsFrozen Property

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsFrozen { get; }

Property Value

Type: Boolean
See Also

Reference

RedisCachingBackendConfiguration Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCachingBackendConfiguration.IsLocallyCached Property

RedisCachingBackendConfigurationIsLocallyCached Property

Determines whether a MemoryCachingBackend should be added in front of the RedisCachingBackend.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsLocallyCached { get; set; }

Property Value

Type: Boolean
See Also

Reference

RedisCachingBackendConfiguration Class
PostSharp.Patterns.Caching.Backends.Redis Namespace

Other Resources

Conceptual: Using Redis Cache


RedisCachingBackendConfiguration.KeyPrefix Property

RedisCachingBackendConfigurationKeyPrefix Property

Gets the prefix for the key of all Redis items created by the RedisCachingBackend. The default value is cache.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string KeyPrefix { get; set; }

Property Value

Type: String
See Also

Reference

RedisCachingBackendConfiguration Class
PostSharp.Patterns.Caching.Backends.Redis Namespace

Other Resources

Conceptual: Customizing Cache Keys


RedisCachingBackendConfiguration.OwnsConnection Property

RedisCachingBackendConfigurationOwnsConnection Property

Determines whether the RedisCachingBackend should dispose the Redis connection when the RedisCachingBackend itself is disposed.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool OwnsConnection { get; set; }

Property Value

Type: Boolean
See Also

Reference

RedisCachingBackendConfiguration Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCachingBackendConfiguration.SupportsDependencies Property

RedisCachingBackendConfigurationSupportsDependencies Property

Determines whether the RedisCachingBackend should support dependencies. When this property is used, the DependenciesRedisCachingBackend class is used instead of RedisCachingBackend. When dependencies are enabled, at least one instance of the RedisCacheDependencyGarbageCollector MUST run.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool SupportsDependencies { get; set; }

Property Value

Type: Boolean
See Also

Reference

RedisCachingBackendConfiguration Class
PostSharp.Patterns.Caching.Backends.Redis Namespace

Other Resources

Conceptual: Using Redis Cache


RedisCachingBackendConfiguration.TransactionMaxRetries Property

RedisCachingBackendConfigurationTransactionMaxRetries Property

Gets or sets the number of times Redis transactions are retried when they fail due to a data conflict, before an exception is raised. The default value is 5.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int TransactionMaxRetries { get; set; }

Property Value

Type: Int32
See Also

Reference

RedisCachingBackendConfiguration Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCachingBackendConfiguration Methods

The RedisCachingBackendConfiguration type exposes the following members.

Methods
 | Name | Description
Protected method | CheckFrozen | Throws an InvalidOperationException if the object has been frozen.
Public method | Clone |
Top
See Also

Reference

RedisCachingBackendConfiguration Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCachingBackendConfiguration.CheckFrozen Method

RedisCachingBackendConfigurationCheckFrozen Method

Throws an InvalidOperationException if the object has been frozen.

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected void CheckFrozen()
Exceptions
Exception | Condition
InvalidOperationException |
See Also

Reference

RedisCachingBackendConfiguration Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


RedisCachingBackendConfiguration.Clone Method

RedisCachingBackendConfigurationClone Method

Namespace: PostSharp.Patterns.Caching.Backends.Redis
Assembly: PostSharp.Patterns.Caching.Backends.Redis (in PostSharp.Patterns.Caching.Backends.Redis.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public RedisCachingBackendConfiguration Clone()

Return Value

Type: RedisCachingBackendConfiguration
See Also

Reference

RedisCachingBackendConfiguration Class
PostSharp.Patterns.Caching.Backends.Redis Namespace


PostSharp.Patterns.Caching.Dependencies Namespace

Classes
 | Class | Description
Public class | ObjectDependency | Wraps an Object into an ObjectDependency. The GetCacheKey relies on the DefaultKeyBuilder to create the cache key of the wrapped object.
Public class | StringDependency | A cache dependency that is already represented as a string.
Interfaces
 | Interface | Description
Public interface | ICacheDependency | Interface that must be implemented by classes that need to be used as cache dependencies, for use with the AddDependency(ICacheDependency) method. Alternatively, custom classes may implement the IFormattable interface or simply the ToString method.


ICacheDependency Interface

Interface that must be implemented by classes that need to be used as cache dependencies, for use with the AddDependency(ICacheDependency) method. Alternatively, custom classes may implement the IFormattable interface or simply the ToString method.

Namespace: PostSharp.Patterns.Caching.Dependencies
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ICacheDependency

The ICacheDependency type exposes the following members.

Methods
 | Name | Description
Public method | GetCacheKey | Gets a string that uniquely represents the current object.
Top
See Also

Reference

PostSharp.Patterns.Caching.Dependencies Namespace

Other Resources

Conceptual: Working with Cache Dependencies


ICacheDependency Methods

The ICacheDependency type exposes the following members.

Methods
 | Name | Description
Public method | GetCacheKey | Gets a string that uniquely represents the current object.
Top
See Also

Reference

ICacheDependency Interface
PostSharp.Patterns.Caching.Dependencies Namespace


ICacheDependency.GetCacheKey Method

ICacheDependencyGetCacheKey Method

Gets a string that uniquely represents the current object.

Namespace: PostSharp.Patterns.Caching.Dependencies
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
string GetCacheKey()

Return Value

Type: String
A string that uniquely represents the current object.
Remarks

The returned key should be globally unique, not just unique within the class implementing the method.

See Also

Reference

ICacheDependency Interface
PostSharp.Patterns.Caching.Dependencies Namespace


ObjectDependency Class

Wraps an Object into an ObjectDependency. The GetCacheKey relies on the DefaultKeyBuilder to create the cache key of the wrapped object.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Caching.DependenciesObjectDependency

Namespace: PostSharp.Patterns.Caching.Dependencies
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ObjectDependency : ICacheDependency

The ObjectDependency type exposes the following members.

Constructors
 | Name | Description
Public method | ObjectDependency | Initializes a new ObjectDependency.
Top
Properties
 | Name | Description
Public property | Object | Gets the wrapped object.
Top
Methods
 | Name | Description
Public method | Equals(Object) | Determines whether the specified object is equal to the current object. (Overrides ObjectEquals(Object).)
Public method | Equals(ICacheDependency) |
Public method | GetCacheKey | Gets a string that uniquely represents the current object.
Public method | GetHashCode | Serves as the default hash function. (Overrides ObjectGetHashCode.)
Top
See Also

Reference

PostSharp.Patterns.Caching.Dependencies Namespace


ObjectDependency Constructor

Initializes a new ObjectDependency.

Namespace: PostSharp.Patterns.Caching.Dependencies
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ObjectDependency(
    Object dependencyObject
)

Parameters

dependencyObject
Type: SystemObject
The wrapped object.
See Also

Reference

ObjectDependency Class
PostSharp.Patterns.Caching.Dependencies Namespace


ObjectDependency Properties

The ObjectDependency type exposes the following members.

Properties
 | Name | Description
Public property | Object | Gets the wrapped object.
Top
See Also

Reference

ObjectDependency Class
PostSharp.Patterns.Caching.Dependencies Namespace


ObjectDependency.Object Property

ObjectDependencyObject Property

Gets the wrapped object.

Namespace: PostSharp.Patterns.Caching.Dependencies
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Object Object { get; }

Property Value

Type: Object
See Also

Reference

ObjectDependency Class
PostSharp.Patterns.Caching.Dependencies Namespace


ObjectDependency Methods

The ObjectDependency type exposes the following members.

Methods
 | Name | Description
Public method | Equals(Object) | Determines whether the specified object is equal to the current object. (Overrides ObjectEquals(Object).)
Public method | Equals(ICacheDependency) |
Public method | GetCacheKey | Gets a string that uniquely represents the current object.
Public method | GetHashCode | Serves as the default hash function. (Overrides ObjectGetHashCode.)
Top
See Also

Reference

ObjectDependency Class
PostSharp.Patterns.Caching.Dependencies Namespace


ObjectDependency.Equals Method

ObjectDependencyEquals Method

Overload List
 | Name | Description
Public method | Equals(Object) | Determines whether the specified object is equal to the current object. (Overrides ObjectEquals(Object).)
Public method | Equals(ICacheDependency) |
Top
See Also

Reference

ObjectDependency Class
PostSharp.Patterns.Caching.Dependencies Namespace


ObjectDependency.Equals Method (Object)

ObjectDependencyEquals Method (Object)

Determines whether the specified object is equal to the current object.

Namespace: PostSharp.Patterns.Caching.Dependencies
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool Equals(
    Object obj
)

Parameters

obj
Type: SystemObject
The object to compare with the current object.

Return Value

Type: Boolean
true if the specified object is equal to the current object; otherwise, false.
See Also

Reference

ObjectDependency Class
Equals Overload
PostSharp.Patterns.Caching.Dependencies Namespace


ObjectDependency.Equals Method (ICacheDependency)

ObjectDependencyEquals Method (ICacheDependency)

Namespace: PostSharp.Patterns.Caching.Dependencies
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Equals(
    ICacheDependency other
)

Parameters

other
Type: PostSharp.Patterns.Caching.DependenciesICacheDependency

Return Value

Type: Boolean
See Also

Reference

ObjectDependency Class
Equals Overload
PostSharp.Patterns.Caching.Dependencies Namespace


ObjectDependency.GetCacheKey Method

ObjectDependencyGetCacheKey Method

Gets a string that uniquely represents the current object.

Namespace: PostSharp.Patterns.Caching.Dependencies
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string GetCacheKey()

Return Value

Type: String
A string that uniquely represents the current object.

Implements

ICacheDependencyGetCacheKey
Remarks

The returned key should be globally unique, not just unique within the class implementing the method.

See Also

Reference

ObjectDependency Class
PostSharp.Patterns.Caching.Dependencies Namespace


ObjectDependency.GetHashCode Method

ObjectDependencyGetHashCode Method

Serves as the default hash function.

Namespace: PostSharp.Patterns.Caching.Dependencies
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override int GetHashCode()

Return Value

Type: Int32
A hash code for the current object.
See Also

Reference

ObjectDependency Class
PostSharp.Patterns.Caching.Dependencies Namespace


StringDependency Class

A cache dependency that is already represented as a string.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Caching.DependenciesStringDependency

Namespace: PostSharp.Patterns.Caching.Dependencies
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class StringDependency : ICacheDependency

The StringDependency type exposes the following members.

Constructors
 | Name | Description
Public method | StringDependency | Initializes a new StringDependency.
Top
Methods
 | Name | Description
Public method | Equals(Object) | Determines whether the specified object is equal to the current object. (Overrides ObjectEquals(Object).)
Public method | Equals(ICacheDependency) |
Public method | GetCacheKey | Gets a string that uniquely represents the current object.
Public method | GetHashCode | Serves as the default hash function. (Overrides ObjectGetHashCode.)
Top
See Also

Reference

PostSharp.Patterns.Caching.Dependencies Namespace


StringDependency Constructor

Initializes a new StringDependency.

Namespace: PostSharp.Patterns.Caching.Dependencies
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public StringDependency(
    string key
)

Parameters

key
Type: SystemString
The cache dependency.
See Also

Reference

StringDependency Class
PostSharp.Patterns.Caching.Dependencies Namespace


StringDependency Methods

The StringDependency type exposes the following members.

Methods
 | Name | Description
Public method | Equals(Object) | Determines whether the specified object is equal to the current object. (Overrides ObjectEquals(Object).)
Public method | Equals(ICacheDependency) |
Public method | GetCacheKey | Gets a string that uniquely represents the current object.
Public method | GetHashCode | Serves as the default hash function. (Overrides ObjectGetHashCode.)
Top
See Also

Reference

StringDependency Class
PostSharp.Patterns.Caching.Dependencies Namespace


StringDependency.Equals Method

StringDependencyEquals Method

Overload List
 | Name | Description
Public method | Equals(Object) | Determines whether the specified object is equal to the current object. (Overrides ObjectEquals(Object).)
Public method | Equals(ICacheDependency) |
Top
See Also

Reference

StringDependency Class
PostSharp.Patterns.Caching.Dependencies Namespace


StringDependency.Equals Method (Object)

StringDependencyEquals Method (Object)

Determines whether the specified object is equal to the current object.

Namespace: PostSharp.Patterns.Caching.Dependencies
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool Equals(
    Object obj
)

Parameters

obj
Type: SystemObject
The object to compare with the current object.

Return Value

Type: Boolean
true if the specified object is equal to the current object; otherwise, false.
See Also

Reference

StringDependency Class
Equals Overload
PostSharp.Patterns.Caching.Dependencies Namespace


StringDependency.Equals Method (ICacheDependency)

StringDependencyEquals Method (ICacheDependency)

Namespace: PostSharp.Patterns.Caching.Dependencies
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Equals(
    ICacheDependency other
)

Parameters

other
Type: PostSharp.Patterns.Caching.DependenciesICacheDependency

Return Value

Type: Boolean
See Also

Reference

StringDependency Class
Equals Overload
PostSharp.Patterns.Caching.Dependencies Namespace


StringDependency.GetCacheKey Method

StringDependencyGetCacheKey Method

Gets a string that uniquely represents the current object.

Namespace: PostSharp.Patterns.Caching.Dependencies
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string GetCacheKey()

Return Value

Type: String
A string that uniquely represents the current object.

Implements

ICacheDependencyGetCacheKey
Remarks

The returned key should be globally unique, not just unique within the class implementing the method.

See Also

Reference

StringDependency Class
PostSharp.Patterns.Caching.Dependencies Namespace


StringDependency.GetHashCode Method

StringDependencyGetHashCode Method

Serves as the default hash function.

Namespace: PostSharp.Patterns.Caching.Dependencies
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override int GetHashCode()

Return Value

Type: Int32
A hash code for the current object.
See Also

Reference

StringDependency Class
PostSharp.Patterns.Caching.Dependencies Namespace


PostSharp.Patterns.Caching.Formatters Namespace

Classes
 | Class | Description
Public class | CachingFormattingRole | The FormattingRole for PostSharp.Patterns.Caching.


CachingFormattingRole Class

The FormattingRole for PostSharp.Patterns.Caching.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.FormattersFormattingRole
PostSharp.Patterns.Caching.FormattersCachingFormattingRole

Namespace: PostSharp.Patterns.Caching.Formatters
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class CachingFormattingRole : FormattingRole

The CachingFormattingRole type exposes the following members.

Constructors
 | Name | Description
Public method | CachingFormattingRole | Initializes a new CachingFormattingRole.
Top
Properties
 | Name | Description
Public property | LoggingRole | Gets the logging role name (see LoggingRoles). (Overrides FormattingRoleLoggingRole.)
Public property | Name | Gets the name of the FormattingRole. (Overrides FormattingRoleName.)
Top
See Also

Reference

PostSharp.Patterns.Caching.Formatters Namespace


CachingFormattingRole Constructor

Initializes a new CachingFormattingRole.

Namespace: PostSharp.Patterns.Caching.Formatters
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CachingFormattingRole()
See Also

Reference

CachingFormattingRole Class
PostSharp.Patterns.Caching.Formatters Namespace


CachingFormattingRole Properties

The CachingFormattingRole type exposes the following members.

Properties
 | Name | Description
Public property | LoggingRole | Gets the logging role name (see LoggingRoles). (Overrides FormattingRoleLoggingRole.)
Public property | Name | Gets the name of the FormattingRole. (Overrides FormattingRoleName.)
Top
See Also

Reference

CachingFormattingRole Class
PostSharp.Patterns.Caching.Formatters Namespace


CachingFormattingRole.LoggingRole Property

CachingFormattingRoleLoggingRole Property

Gets the logging role name (see LoggingRoles).

Namespace: PostSharp.Patterns.Caching.Formatters
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override string LoggingRole { get; }

Property Value

Type: String
See Also

Reference

CachingFormattingRole Class
PostSharp.Patterns.Caching.Formatters Namespace


CachingFormattingRole.Name Property

CachingFormattingRoleName Property

Gets the name of the FormattingRole.

Namespace: PostSharp.Patterns.Caching.Formatters
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override string Name { get; }

Property Value

Type: String
See Also

Reference

CachingFormattingRole Class
PostSharp.Patterns.Caching.Formatters Namespace


PostSharp.Patterns.Caching.Implementation Namespace

Classes
 | Class | Description
Public class | CacheDependencyInvalidatedEventArgs | Arguments of the DependencyInvalidated event.
Public class | CachedMethodInfo | Encapsulates information about a method being cached.
Public class | CachedParameterInfo | Encapsulates information about a parameter of a method being cached. Exposed by the CachedMethodInfo class.
Public class | CacheInvalidator | Base class for a kind of CachingBackendEnhancer that allows several instances of the same application to use a local cache, and synchronize themselves by sending invalidation messages over a publish/subscribe channel.
Public class | CacheInvalidatorOptions | Options for the CacheInvalidator class.
Public class | CacheItem | Represents an item being added to the cache.
Public class | CacheItemConfiguration | Configuration of a CacheItem.
Public class | CacheItemRemovedEventArgs | Arguments of the ItemRemoved event.
Public class | CacheKeyBuilder | Builds cache item keys and dependency keys.
Public class | CacheValue | Return value of the GetItem(String, Boolean) method, i.e. represents an item retrieved from the cache (items being stored in the cache are represented by the CacheItem class).
Public class | CachingBackend | An abstraction of the physical implementation of the cache, where the CacheAttribute ends up writing to and reading from.
Public class | CachingBackendEnhancer | A base class for all cache enhancers. A CachingBackendEnhancer is a node in a chain of responsibility where the last node is the physical implementation of the CachingBackend. A CachingBackendEnhancer can add behaviors to a CachingBackend.
Public class | CachingBackendEnhancerFeatures | An abstract implementation of CachingBackendEnhancerFeatures for use in implementations of CachingBackendEnhancer, where the default behavior is to return the features of the underlying CachingBackend.
Public class | CachingBackendFeatures | List of features that can be implemented or not by a CachingBackend.
Interfaces
 | Interface | Description
Public interface | ICacheItemConfiguration | Configuration of a cached method. This interface is implemented by several classes that allow to configure cached method.
Enumerations
 | Enumeration | Description
Public enumeration | CacheItemPriority | Enumerates the priorities of a CacheItem.
Public enumeration | CacheItemRemovedReason | Enumerates the reasons why an item can be removed from the cache.
Public enumeration | CachingBackendStatus | Statuses of a CachingBackend.


CacheDependencyInvalidatedEventArgs Class

Arguments of the DependencyInvalidated event.
Inheritance Hierarchy
SystemObject
SystemEventArgs
PostSharp.Patterns.Caching.ImplementationCacheDependencyInvalidatedEventArgs

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class CacheDependencyInvalidatedEventArgs : EventArgs

The CacheDependencyInvalidatedEventArgs type exposes the following members.

Constructors
 | Name | Description
Public method | CacheDependencyInvalidatedEventArgs | Initializes a new CacheDependencyInvalidatedEventArgs.
Top
Properties
 | Name | Description
Public property | Key | Gets the key of the invalidated dependency.
Public property | SourceId | Gets the Guid of the CachingBackend instance that requested the invalidation, or Empty if this information is not available.
Top
See Also

Reference

PostSharp.Patterns.Caching.Implementation Namespace


CacheDependencyInvalidatedEventArgs Constructor

Initializes a new CacheDependencyInvalidatedEventArgs.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CacheDependencyInvalidatedEventArgs(
    string key,
    Guid sourceId
)

Parameters

key
Type: SystemString
The key of the invalidated dependency.
sourceId
Type: SystemGuid
The Guid of the CachingBackend instance that requested the invalidation, or Empty if this information is not available.
See Also

Reference

CacheDependencyInvalidatedEventArgs Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheDependencyInvalidatedEventArgs Properties

The CacheDependencyInvalidatedEventArgs type exposes the following members.

Properties
 | Name | Description
Public property | Key | Gets the key of the invalidated dependency.
Public property | SourceId | Gets the Guid of the CachingBackend instance that requested the invalidation, or Empty if this information is not available.
Top
See Also

Reference

CacheDependencyInvalidatedEventArgs Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheDependencyInvalidatedEventArgs.Key Property

CacheDependencyInvalidatedEventArgsKey Property

Gets the key of the invalidated dependency.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string Key { get; }

Property Value

Type: String
See Also

Reference

CacheDependencyInvalidatedEventArgs Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheDependencyInvalidatedEventArgs.SourceId Property

CacheDependencyInvalidatedEventArgsSourceId Property

Gets the Guid of the CachingBackend instance that requested the invalidation, or Empty if this information is not available.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Guid SourceId { get; }

Property Value

Type: Guid
See Also

Reference

CacheDependencyInvalidatedEventArgs Class
PostSharp.Patterns.Caching.Implementation Namespace


CachedMethodInfo Class

Encapsulates information about a method being cached.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Caching.ImplementationCachedMethodInfo

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class CachedMethodInfo

The CachedMethodInfo type exposes the following members.

Properties
 | Name | Description
Public property | IsThisParameterIgnored | Determines whether the value of the this parameter (for non-static methods) should be included in the cache key.
Public property | Method | Gets the MethodInfo of the method.
Public property | Parameters | Gets an array of CachedParameterInfo.
Top
See Also

Reference

PostSharp.Patterns.Caching.Implementation Namespace


CachedMethodInfo Properties

The CachedMethodInfo type exposes the following members.

Properties
 | Name | Description
Public property | IsThisParameterIgnored | Determines whether the value of the this parameter (for non-static methods) should be included in the cache key.
Public property | Method | Gets the MethodInfo of the method.
Public property | Parameters | Gets an array of CachedParameterInfo.
Top
See Also

Reference

CachedMethodInfo Class
PostSharp.Patterns.Caching.Implementation Namespace


CachedMethodInfo.IsThisParameterIgnored Property

CachedMethodInfoIsThisParameterIgnored Property

Determines whether the value of the this parameter (for non-static methods) should be included in the cache key.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsThisParameterIgnored { get; }

Property Value

Type: Boolean
See Also

Reference

CachedMethodInfo Class
PostSharp.Patterns.Caching.Implementation Namespace


CachedMethodInfo.Method Property

CachedMethodInfoMethod Property

Gets the MethodInfo of the method.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MethodInfo Method { get; }

Property Value

Type: MethodInfo
See Also

Reference

CachedMethodInfo Class
PostSharp.Patterns.Caching.Implementation Namespace


CachedMethodInfo.Parameters Property

CachedMethodInfoParameters Property

Gets an array of CachedParameterInfo.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ImmutableArray<CachedParameterInfo> Parameters { get; }

Property Value

Type: ImmutableArray CachedParameterInfo
See Also

Reference

CachedMethodInfo Class
PostSharp.Patterns.Caching.Implementation Namespace


CachedParameterInfo Class

Encapsulates information about a parameter of a method being cached. Exposed by the CachedMethodInfo class.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Caching.ImplementationCachedParameterInfo

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class CachedParameterInfo

The CachedParameterInfo type exposes the following members.

Properties
 | Name | Description
Public property | IsIgnored | Determines whether the parameter should be excluded from the cache key. When the value of this property is false, the parameter should be included in the cache key.
Public property | Parameter | Gets the ParameterInfo of the parameter.
Top
See Also

Reference

PostSharp.Patterns.Caching.Implementation Namespace


CachedParameterInfo Properties

The CachedParameterInfo type exposes the following members.

Properties
 | Name | Description
Public property | IsIgnored | Determines whether the parameter should be excluded from the cache key. When the value of this property is false, the parameter should be included in the cache key.
Public property | Parameter | Gets the ParameterInfo of the parameter.
Top
See Also

Reference

CachedParameterInfo Class
PostSharp.Patterns.Caching.Implementation Namespace


CachedParameterInfo.IsIgnored Property

CachedParameterInfoIsIgnored Property

Determines whether the parameter should be excluded from the cache key. When the value of this property is false, the parameter should be included in the cache key.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsIgnored { get; }

Property Value

Type: Boolean
See Also

Reference

CachedParameterInfo Class
PostSharp.Patterns.Caching.Implementation Namespace


CachedParameterInfo.Parameter Property

CachedParameterInfoParameter Property

Gets the ParameterInfo of the parameter.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ParameterInfo Parameter { get; }

Property Value

Type: ParameterInfo
See Also

Reference

CachedParameterInfo Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheInvalidator Class

Base class for a kind of CachingBackendEnhancer that allows several instances of the same application to use a local cache, and synchronize themselves by sending invalidation messages over a publish/subscribe channel.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Caching.ImplementationCachingBackend
PostSharp.Patterns.Caching.ImplementationCachingBackendEnhancer
PostSharp.Patterns.Caching.ImplementationCacheInvalidator
PostSharp.Patterns.Caching.Backends.AzureAzureCacheInvalidator
PostSharp.Patterns.Caching.Backends.RedisRedisCacheInvalidator

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class CacheInvalidator : CachingBackendEnhancer

The CacheInvalidator type exposes the following members.

Constructors
 | Name | Description
Protected method | CacheInvalidator | Initializes a new CachingBackend/
Top
Properties
 | Name | Description
Public property | Id | Gets the Guid of the current CachingBackend. (Inherited from CachingBackend.)
Protected property | Logger | Gets the Logger that implementations can use to emit log records. (Inherited from CachingBackend.)
Public property | Options | Gets the options of the current CacheInvalidator.
Public property | Status | Gets the status of the current CachingBackend (Default, Disposing or Disposed). (Inherited from CachingBackend.)
Public property | SupportedFeatures | Gets the set of features supported by the current CachingBackend. (Inherited from CachingBackend.)
Public property | UnderlyingBackend | Gets the next CachingBackend in the chain of responsibility. (Inherited from CachingBackendEnhancer.)
Public property | ValueAdapters | Gets the factory of value adapters (IValueAdapter), which allow for instance to cache things like Stream or IEnumerable, which could not be otherwise cached. (Inherited from CachingBackend.)
Top
Methods
 | Name | Description
Public method | Clear | Clears the cache. (Inherited from CachingBackend.)
Public method | ClearAsync | Asynchronously clears the cache. (Inherited from CachingBackend.)
Protected method | ClearAsyncCore | Asynchronously clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Inherited from CachingBackendEnhancer.)
Protected method | ClearCore | Clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Inherited from CachingBackendEnhancer.)
Public method | ContainsDependency | Determines whether the cache contains a given dependency. (Inherited from CachingBackend.)
Public method | ContainsDependencyAsync | Asynchronously determines whether the cache contains a given dependency. (Inherited from CachingBackend.)
Protected method | ContainsDependencyAsyncCore | Asynchronously determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Protected method | ContainsDependencyCore | Determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Public method | ContainsItem | Determines whether the cache contains an item of a given key. (Inherited from CachingBackend.)
Public method | ContainsItemAsync | Asynchronously determines whether the cache contains an item of a given key. (Inherited from CachingBackend.)
Protected method | ContainsItemAsyncCore | Asynchronously determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Protected method | ContainsItemCore | Determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Protected method | CreateFeatures | Creates a CachingBackendFeatures object, which describes set of features implemented by the back-end. This method is invoked the first time the SupportedFeatures property is evaluated. The result is then cached. (Inherited from CachingBackendEnhancer.)
Public method | Dispose | Synchronously disposes the current CachingBackend. (Inherited from CachingBackend.)
Protected method | Dispose(Boolean) | Synchronously disposes the current CachingBackend, with a parameter instructing whether this method is called because of a call to the Dispose method or because of object finalizing. (Inherited from CachingBackend.)
Public method | DisposeAsync | Asynchronously dispose the current CachingBackend. (Inherited from CachingBackend.)
Protected method | DisposeAsyncCore | Asynchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Inherited from CachingBackendEnhancer.)
Protected method | DisposeCore | Synchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Inherited from CachingBackendEnhancer.)
Public method | GetItem | Gets a cache item given its key. (Inherited from CachingBackend.)
Public method | GetItemAsync | Asynchronously gets a cache item given its key. (Inherited from CachingBackend.)
Protected method | GetItemAsyncCore | Asynchronously gets a cache item given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Protected method | GetItemCore | Gets a cache item given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Public method | InvalidateDependency | Removes from the cache all items that have a specific dependency. (Inherited from CachingBackend.)
Public method | InvalidateDependencyAsync | Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackend.)
Protected method | InvalidateDependencyAsyncCore | Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendEnhancerInvalidateDependencyAsyncCore(String, CancellationToken).)
Protected method | InvalidateDependencyCore | Removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendEnhancerInvalidateDependencyCore(String).)
Protected method | OnBackendDependencyInvalidated | Method invoked when the DependencyInvalidated event of the next UnderlyingBackend in the chain of responsibility is invoked. (Inherited from CachingBackendEnhancer.)
Protected method | OnBackendItemRemoved | Method invoked when the ItemRemoved event of the next UnderlyingBackend in the chain of responsibility is invoked. (Inherited from CachingBackendEnhancer.)
Protected method | OnDependencyInvalidated(CacheDependencyInvalidatedEventArgs) | Raises the DependencyInvalidated event given a CacheDependencyInvalidatedEventArgs. (Inherited from CachingBackend.)
Protected method | OnDependencyInvalidated(String, Guid) | Raises the DependencyInvalidated event , but lazily instantiates the CacheDependencyInvalidatedEventArgs if there is an event client. (Inherited from CachingBackend.)
Protected method | OnItemRemoved(CacheItemRemovedEventArgs) | Raises the ItemRemoved event given a CacheItemRemovedEventArgs. (Inherited from CachingBackend.)
Protected method | OnItemRemoved(String, CacheItemRemovedReason, Guid) | Raises the ItemRemoved event, but lazily instantiates the CacheItemRemovedEventArgs if there is an event client. (Inherited from CachingBackend.)
Protected method | OnMessageReceived | Implementations of CacheInvalidator must call this method when an invalidation message is received.
Public method | RemoveItem | Removes a cache item from the cache given its key. (Inherited from CachingBackend.)
Public method | RemoveItemAsync | Asynchronously removes a cache item from the cache given its key. (Inherited from CachingBackend.)
Protected method | RemoveItemAsyncCore | Asynchronously removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendEnhancerRemoveItemAsyncCore(String, CancellationToken).)
Protected method | RemoveItemCore | Removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendEnhancerRemoveItemCore(String).)
Protected method | SendMessageAsync | Sends an invalidation message over the message bus of the implementation.
Public method | SetItem | Sets a cache item. (Inherited from CachingBackend.)
Public method | SetItemAsync | Asynchronously sets a cache item. (Inherited from CachingBackend.)
Protected method | SetItemAsyncCore | Asynchronously sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. The default implementation is to call the synchronous SetItemCore(String, CacheItem) method. (Inherited from CachingBackendEnhancer.)
Protected method | SetItemCore | Sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Public method | ToString | Returns a string that represents the current object. (Inherited from CachingBackend.)
Public method | WhenBackgroundTasksCompleted | Returns a Task that is signaled to the complete state when all background tasks have completed. (Inherited from CachingBackend.)
Top
Events
 | Name | Description
Public event | DependencyInvalidated | Events raised when a dependency is invalidated. Check the Events property to see if the current CachingBackend supports events. (Inherited from CachingBackend.)
Public event | ItemRemoved | Event raised when a cache item is removed from the cache. Check the Events property to see if the current CachingBackend supports events. (Inherited from CachingBackend.)
Top
See Also

Reference

PostSharp.Patterns.Caching.Implementation Namespace


CacheInvalidator Constructor

Initializes a new CachingBackend/

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected CacheInvalidator(
    CachingBackend underlyingBackend,
    CacheInvalidatorOptions options
)

Parameters

underlyingBackend
Type: PostSharp.Patterns.Caching.ImplementationCachingBackend
The underlying CachingBackend (typically an in-memory cache).
options
Type: PostSharp.Patterns.Caching.ImplementationCacheInvalidatorOptions
Options of the new CacheInvalidator.
See Also

Reference

CacheInvalidator Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheInvalidator Properties

The CacheInvalidator type exposes the following members.

Properties
 | Name | Description
Public property | Id | Gets the Guid of the current CachingBackend. (Inherited from CachingBackend.)
Protected property | Logger | Gets the Logger that implementations can use to emit log records. (Inherited from CachingBackend.)
Public property | Options | Gets the options of the current CacheInvalidator.
Public property | Status | Gets the status of the current CachingBackend (Default, Disposing or Disposed). (Inherited from CachingBackend.)
Public property | SupportedFeatures | Gets the set of features supported by the current CachingBackend. (Inherited from CachingBackend.)
Public property | UnderlyingBackend | Gets the next CachingBackend in the chain of responsibility. (Inherited from CachingBackendEnhancer.)
Public property | ValueAdapters | Gets the factory of value adapters (IValueAdapter), which allow for instance to cache things like Stream or IEnumerable, which could not be otherwise cached. (Inherited from CachingBackend.)
Top
See Also

Reference

CacheInvalidator Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheInvalidator.Options Property

CacheInvalidatorOptions Property

Gets the options of the current CacheInvalidator.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CacheInvalidatorOptions Options { get; }

Property Value

Type: CacheInvalidatorOptions
See Also

Reference

CacheInvalidator Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheInvalidator Methods

The CacheInvalidator type exposes the following members.

Methods
 | Name | Description
Public method | Clear | Clears the cache. (Inherited from CachingBackend.)
Public method | ClearAsync | Asynchronously clears the cache. (Inherited from CachingBackend.)
Protected method | ClearAsyncCore | Asynchronously clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Inherited from CachingBackendEnhancer.)
Protected method | ClearCore | Clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Inherited from CachingBackendEnhancer.)
Public method | ContainsDependency | Determines whether the cache contains a given dependency. (Inherited from CachingBackend.)
Public method | ContainsDependencyAsync | Asynchronously determines whether the cache contains a given dependency. (Inherited from CachingBackend.)
Protected method | ContainsDependencyAsyncCore | Asynchronously determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Protected method | ContainsDependencyCore | Determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Public method | ContainsItem | Determines whether the cache contains an item of a given key. (Inherited from CachingBackend.)
Public method | ContainsItemAsync | Asynchronously determines whether the cache contains an item of a given key. (Inherited from CachingBackend.)
Protected method | ContainsItemAsyncCore | Asynchronously determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Protected method | ContainsItemCore | Determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Protected method | CreateFeatures | Creates a CachingBackendFeatures object, which describes set of features implemented by the back-end. This method is invoked the first time the SupportedFeatures property is evaluated. The result is then cached. (Inherited from CachingBackendEnhancer.)
Public method | Dispose | Synchronously disposes the current CachingBackend. (Inherited from CachingBackend.)
Protected method | Dispose(Boolean) | Synchronously disposes the current CachingBackend, with a parameter instructing whether this method is called because of a call to the Dispose method or because of object finalizing. (Inherited from CachingBackend.)
Public method | DisposeAsync | Asynchronously dispose the current CachingBackend. (Inherited from CachingBackend.)
Protected method | DisposeAsyncCore | Asynchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Inherited from CachingBackendEnhancer.)
Protected method | DisposeCore | Synchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Inherited from CachingBackendEnhancer.)
Public method | GetItem | Gets a cache item given its key. (Inherited from CachingBackend.)
Public method | GetItemAsync | Asynchronously gets a cache item given its key. (Inherited from CachingBackend.)
Protected method | GetItemAsyncCore | Asynchronously gets a cache item given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Protected method | GetItemCore | Gets a cache item given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Public method | InvalidateDependency | Removes from the cache all items that have a specific dependency. (Inherited from CachingBackend.)
Public method | InvalidateDependencyAsync | Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackend.)
Protected method | InvalidateDependencyAsyncCore | Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendEnhancerInvalidateDependencyAsyncCore(String, CancellationToken).)
Protected method | InvalidateDependencyCore | Removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendEnhancerInvalidateDependencyCore(String).)
Protected method | OnBackendDependencyInvalidated | Method invoked when the DependencyInvalidated event of the next UnderlyingBackend in the chain of responsibility is invoked. (Inherited from CachingBackendEnhancer.)
Protected method | OnBackendItemRemoved | Method invoked when the ItemRemoved event of the next UnderlyingBackend in the chain of responsibility is invoked. (Inherited from CachingBackendEnhancer.)
Protected method | OnDependencyInvalidated(CacheDependencyInvalidatedEventArgs) | Raises the DependencyInvalidated event given a CacheDependencyInvalidatedEventArgs. (Inherited from CachingBackend.)
Protected method | OnDependencyInvalidated(String, Guid) | Raises the DependencyInvalidated event , but lazily instantiates the CacheDependencyInvalidatedEventArgs if there is an event client. (Inherited from CachingBackend.)
Protected method | OnItemRemoved(CacheItemRemovedEventArgs) | Raises the ItemRemoved event given a CacheItemRemovedEventArgs. (Inherited from CachingBackend.)
Protected method | OnItemRemoved(String, CacheItemRemovedReason, Guid) | Raises the ItemRemoved event, but lazily instantiates the CacheItemRemovedEventArgs if there is an event client. (Inherited from CachingBackend.)
Protected method | OnMessageReceived | Implementations of CacheInvalidator must call this method when an invalidation message is received.
Public method | RemoveItem | Removes a cache item from the cache given its key. (Inherited from CachingBackend.)
Public method | RemoveItemAsync | Asynchronously removes a cache item from the cache given its key. (Inherited from CachingBackend.)
Protected method | RemoveItemAsyncCore | Asynchronously removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendEnhancerRemoveItemAsyncCore(String, CancellationToken).)
Protected method | RemoveItemCore | Removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendEnhancerRemoveItemCore(String).)
Protected method | SendMessageAsync | Sends an invalidation message over the message bus of the implementation.
Public method | SetItem | Sets a cache item. (Inherited from CachingBackend.)
Public method | SetItemAsync | Asynchronously sets a cache item. (Inherited from CachingBackend.)
Protected method | SetItemAsyncCore | Asynchronously sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. The default implementation is to call the synchronous SetItemCore(String, CacheItem) method. (Inherited from CachingBackendEnhancer.)
Protected method | SetItemCore | Sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackendEnhancer.)
Public method | ToString | Returns a string that represents the current object. (Inherited from CachingBackend.)
Public method | WhenBackgroundTasksCompleted | Returns a Task that is signaled to the complete state when all background tasks have completed. (Inherited from CachingBackend.)
Top
See Also

Reference

CacheInvalidator Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheInvalidator.InvalidateDependencyAsyncCore Method

CacheInvalidatorInvalidateDependencyAsyncCore Method

Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override Task InvalidateDependencyAsyncCore(
    string key,
    CancellationToken cancellationToken
)

Parameters

key
Type: SystemString
The dependency key.
cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task
A Task.
See Also

Reference

CacheInvalidator Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheInvalidator.InvalidateDependencyCore Method

CacheInvalidatorInvalidateDependencyCore Method

Removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void InvalidateDependencyCore(
    string key
)

Parameters

key
Type: SystemString
The dependency key.
See Also

Reference

CacheInvalidator Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheInvalidator.OnMessageReceived Method

CacheInvalidatorOnMessageReceived Method

Implementations of CacheInvalidator must call this method when an invalidation message is received.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected void OnMessageReceived(
    string message
)

Parameters

message
Type: SystemString
The serialized invalidation message.
See Also

Reference

CacheInvalidator Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheInvalidator.RemoveItemAsyncCore Method

CacheInvalidatorRemoveItemAsyncCore Method

Asynchronously removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override Task RemoveItemAsyncCore(
    string key,
    CancellationToken cancellationToken
)

Parameters

key
Type: SystemString
The key of the cache item.
cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task
A Task.
See Also

Reference

CacheInvalidator Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheInvalidator.RemoveItemCore Method

CacheInvalidatorRemoveItemCore Method

Removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void RemoveItemCore(
    string key
)

Parameters

key
Type: SystemString
The key of the cache item.
See Also

Reference

CacheInvalidator Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheInvalidator.SendMessageAsync Method

CacheInvalidatorSendMessageAsync Method

Sends an invalidation message over the message bus of the implementation.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected abstract Task SendMessageAsync(
    string message,
    CancellationToken cancellationToken
)

Parameters

message
Type: SystemString
A serialized, opaque serialization message.
cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task
A Task.
See Also

Reference

CacheInvalidator Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheInvalidator Events

The CacheInvalidator type exposes the following members.

Events
 | Name | Description
Public event | DependencyInvalidated | Events raised when a dependency is invalidated. Check the Events property to see if the current CachingBackend supports events. (Inherited from CachingBackend.)
Public event | ItemRemoved | Event raised when a cache item is removed from the cache. Check the Events property to see if the current CachingBackend supports events. (Inherited from CachingBackend.)
Top
See Also

Reference

CacheInvalidator Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheInvalidatorOptions Class

Options for the CacheInvalidator class.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Caching.ImplementationCacheInvalidatorOptions
PostSharp.Patterns.Caching.Backends.AzureAzureCacheInvalidatorOptions
PostSharp.Patterns.Caching.Backends.RedisRedisCacheInvalidatorOptions

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class CacheInvalidatorOptions

The CacheInvalidatorOptions type exposes the following members.

Constructors
 | Name | Description
Public method | CacheInvalidatorOptions | Initializes a new instance of the CacheInvalidatorOptions class
Top
Properties
 | Name | Description
Public property | Prefix | Gets or sets the prefix of messages sent by the CacheInvalidator. Messages received by the OnMessageReceived(String) method are ignored if they don't start with the proper prefix.
Top
See Also

Reference

PostSharp.Patterns.Caching.Implementation Namespace


CacheInvalidatorOptions Constructor

Initializes a new instance of the CacheInvalidatorOptions class

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CacheInvalidatorOptions()
See Also

Reference

CacheInvalidatorOptions Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheInvalidatorOptions Properties

The CacheInvalidatorOptions type exposes the following members.

Properties
 | Name | Description
Public property | Prefix | Gets or sets the prefix of messages sent by the CacheInvalidator. Messages received by the OnMessageReceived(String) method are ignored if they don't start with the proper prefix.
Top
See Also

Reference

CacheInvalidatorOptions Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheInvalidatorOptions.Prefix Property

CacheInvalidatorOptionsPrefix Property

Gets or sets the prefix of messages sent by the CacheInvalidator. Messages received by the OnMessageReceived(String) method are ignored if they don't start with the proper prefix.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string Prefix { get; set; }

Property Value

Type: String
See Also

Reference

CacheInvalidatorOptions Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheItem Class

Represents an item being added to the cache.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Caching.ImplementationCacheItem

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class CacheItem : IEquatable<CacheItem>

The CacheItem type exposes the following members.

Constructors
 | Name | Description
Public method | CacheItem | Initializes a new CacheItem.
Top
Properties
 | Name | Description
Public property | Configuration | Gets the CacheItemConfiguration for the current item, or null to use the default configuration.
Public property | Dependencies | Gets the list of dependencies of the current item, or null if there is no dependency.
Public property | Value | Gets the value to be cached (null is a valid value).
Top
Methods
 | Name | Description
Public method | Equals(Object) | Determines whether the specified object is equal to the current object. (Overrides ObjectEquals(Object).)
Public method | Equals(CacheItem) | Determines whether the current CacheItem is structurally equal to another CacheItem.
Public method | GetHashCode | Serves as the default hash function. (Overrides ObjectGetHashCode.)
Top
Operators
Name | Description
Equality | Determines whether two instances of the CacheItem class are structurally equal.
Inequality | Determines whether two instances of the CacheItem class are structurally different.
Top
See Also

Reference

PostSharp.Patterns.Caching.Implementation Namespace


CacheItem Constructor

Initializes a new CacheItem.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CacheItem(
    Object value,
    IImmutableList<string> dependencies = null,
    CacheItemConfiguration configuration = null
)

Parameters

value
Type: SystemObject
The value to be cached (null is a valid value).
dependencies (Optional)
Type: IImmutableList String
A list of dependencies, or null if there is no dependency.
configuration (Optional)
Type: PostSharp.Patterns.Caching.ImplementationCacheItemConfiguration
The configuration of the cache item, or null to use the default configuration.
See Also

Reference

CacheItem Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheItem Properties

The CacheItem type exposes the following members.

Properties
 | Name | Description
Public property | Configuration | Gets the CacheItemConfiguration for the current item, or null to use the default configuration.
Public property | Dependencies | Gets the list of dependencies of the current item, or null if there is no dependency.
Public property | Value | Gets the value to be cached (null is a valid value).
Top
See Also

Reference

CacheItem Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheItem.Configuration Property

CacheItemConfiguration Property

Gets the CacheItemConfiguration for the current item, or null to use the default configuration.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CacheItemConfiguration Configuration { get; }

Property Value

Type: CacheItemConfiguration
See Also

Reference

CacheItem Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheItem.Dependencies Property

CacheItemDependencies Property

Gets the list of dependencies of the current item, or null if there is no dependency.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IImmutableList<string> Dependencies { get; }

Property Value

Type: IImmutableList String
See Also

Reference

CacheItem Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheItem.Value Property

CacheItemValue Property

Gets the value to be cached (null is a valid value).

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Object Value { get; }

Property Value

Type: Object
See Also

Reference

CacheItem Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheItem Methods

The CacheItem type exposes the following members.

Methods
 | Name | Description
Public method | Equals(Object) | Determines whether the specified object is equal to the current object. (Overrides ObjectEquals(Object).)
Public method | Equals(CacheItem) | Determines whether the current CacheItem is structurally equal to another CacheItem.
Public method | GetHashCode | Serves as the default hash function. (Overrides ObjectGetHashCode.)
Top
See Also

Reference

CacheItem Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheItem.Equals Method

CacheItemEquals Method

Overload List
 | Name | Description
Public method | Equals(Object) | Determines whether the specified object is equal to the current object. (Overrides ObjectEquals(Object).)
Public method | Equals(CacheItem) | Determines whether the current CacheItem is structurally equal to another CacheItem.
Top
See Also

Reference

CacheItem Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheItem.Equals Method (Object)

CacheItemEquals Method (Object)

Determines whether the specified object is equal to the current object.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool Equals(
    Object obj
)

Parameters

obj
Type: SystemObject
The object to compare with the current object.

Return Value

Type: Boolean
true if the specified object is equal to the current object; otherwise, false.
See Also

Reference

CacheItem Class
Equals Overload
PostSharp.Patterns.Caching.Implementation Namespace


CacheItem.Equals Method (CacheItem)

CacheItemEquals Method (CacheItem)

Determines whether the current CacheItem is structurally equal to another CacheItem.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Equals(
    CacheItem other
)

Parameters

other
Type: PostSharp.Patterns.Caching.ImplementationCacheItem
A CacheItem.

Return Value

Type: Boolean
true both items are equal, otherwise false.

Implements

IEquatableTEquals(T)
See Also

Reference

CacheItem Class
Equals Overload
PostSharp.Patterns.Caching.Implementation Namespace


CacheItem.GetHashCode Method

CacheItemGetHashCode Method

Serves as the default hash function.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override int GetHashCode()

Return Value

Type: Int32
A hash code for the current object.
See Also

Reference

CacheItem Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheItem Operators

The CacheItem type exposes the following members.

Operators
Name | Description
Equality | Determines whether two instances of the CacheItem class are structurally equal.
Inequality | Determines whether two instances of the CacheItem class are structurally different.
Top
See Also

Reference

CacheItem Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheItem.Equality Operator

CacheItemEquality Operator

Determines whether two instances of the CacheItem class are structurally equal.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool operator ==(
    CacheItem first,
    CacheItem second
)

Parameters

first
Type: PostSharp.Patterns.Caching.ImplementationCacheItem
A CacheItem.
second
Type: PostSharp.Patterns.Caching.ImplementationCacheItem
A CacheItem.

Return Value

Type: Boolean
true if first equals second, otherwise false.
See Also

Reference

CacheItem Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheItem.Inequality Operator

CacheItemInequality Operator

Determines whether two instances of the CacheItem class are structurally different.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool operator !=(
    CacheItem first,
    CacheItem second
)

Parameters

first
Type: PostSharp.Patterns.Caching.ImplementationCacheItem
A CacheItem.
second
Type: PostSharp.Patterns.Caching.ImplementationCacheItem
A CacheItem.

Return Value

Type: Boolean
true if first is differnt to second, otherwise false.
See Also

Reference

CacheItem Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheItemConfiguration Class

Configuration of a CacheItem.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Caching.ImplementationCacheItemConfiguration

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class CacheItemConfiguration : ICacheItemConfiguration

The CacheItemConfiguration type exposes the following members.

Constructors
 | Name | Description
Public method | CacheItemConfiguration | Initializes a new instance of the CacheItemConfiguration class
Top
Properties
 | Name | Description
Public property | AbsoluteExpiration | Gets or sets the total duration during which the result of the cached methods is stored in cache. The absolute expiration time is counted from the moment the method is evaluated and cached.
Public property | AutoReload | Determines whether the method calls are automatically reloaded (by re-evaluating the target method with the same arguments) when the cache item is removed from the cache.
Public property | IgnoreThisParameter | Determines whether the this instance should be a part of the cache key. The default value of this property is false, which means that by default the this instance is a part of the cache key.
Public property | IsEnabled | Determines whether caching is enabled.
Public property | Priority | Gets or sets the priority of the cached methods.
Public property | ProfileName | Gets or sets the name of the CachingProfile that contains the configuration of the cached methods.
Public property | SlidingExpiration | Gets or sets the duration during which the result of the cached methods is stored in cache after it has been added to or accessed from the cache. The expiration is extended every time the value is accessed from the cache.
Top
See Also

Reference

PostSharp.Patterns.Caching.Implementation Namespace


CacheItemConfiguration Constructor

Initializes a new instance of the CacheItemConfiguration class

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CacheItemConfiguration()
See Also

Reference

CacheItemConfiguration Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheItemConfiguration Properties

The CacheItemConfiguration type exposes the following members.

Properties
 | Name | Description
Public property | AbsoluteExpiration | Gets or sets the total duration during which the result of the cached methods is stored in cache. The absolute expiration time is counted from the moment the method is evaluated and cached.
Public property | AutoReload | Determines whether the method calls are automatically reloaded (by re-evaluating the target method with the same arguments) when the cache item is removed from the cache.
Public property | IgnoreThisParameter | Determines whether the this instance should be a part of the cache key. The default value of this property is false, which means that by default the this instance is a part of the cache key.
Public property | IsEnabled | Determines whether caching is enabled.
Public property | Priority | Gets or sets the priority of the cached methods.
Public property | ProfileName | Gets or sets the name of the CachingProfile that contains the configuration of the cached methods.
Public property | SlidingExpiration | Gets or sets the duration during which the result of the cached methods is stored in cache after it has been added to or accessed from the cache. The expiration is extended every time the value is accessed from the cache.
Top
See Also

Reference

CacheItemConfiguration Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheItemConfiguration.AbsoluteExpiration Property

CacheItemConfigurationAbsoluteExpiration Property

Gets or sets the total duration during which the result of the cached methods is stored in cache. The absolute expiration time is counted from the moment the method is evaluated and cached.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Nullable<TimeSpan> AbsoluteExpiration { get; set; }

Property Value

Type: Nullable TimeSpan

Implements

ICacheItemConfigurationAbsoluteExpiration
See Also

Reference

CacheItemConfiguration Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheItemConfiguration.AutoReload Property

CacheItemConfigurationAutoReload Property

Determines whether the method calls are automatically reloaded (by re-evaluating the target method with the same arguments) when the cache item is removed from the cache.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Nullable<bool> AutoReload { get; set; }

Property Value

Type: Nullable Boolean

Implements

ICacheItemConfigurationAutoReload
See Also

Reference

CacheItemConfiguration Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheItemConfiguration.IgnoreThisParameter Property

CacheItemConfigurationIgnoreThisParameter Property

Determines whether the this instance should be a part of the cache key. The default value of this property is false, which means that by default the this instance is a part of the cache key.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Nullable<bool> IgnoreThisParameter { get; set; }

Property Value

Type: Nullable Boolean

Implements

ICacheItemConfigurationIgnoreThisParameter
See Also

Reference

CacheItemConfiguration Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheItemConfiguration.IsEnabled Property

CacheItemConfigurationIsEnabled Property

Determines whether caching is enabled.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Nullable<bool> IsEnabled { get; set; }

Property Value

Type: Nullable Boolean

Implements

ICacheItemConfigurationIsEnabled
See Also

Reference

CacheItemConfiguration Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheItemConfiguration.Priority Property

CacheItemConfigurationPriority Property

Gets or sets the priority of the cached methods.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Nullable<CacheItemPriority> Priority { get; set; }

Property Value

Type: Nullable CacheItemPriority

Implements

ICacheItemConfigurationPriority
See Also

Reference

CacheItemConfiguration Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheItemConfiguration.ProfileName Property

CacheItemConfigurationProfileName Property

Gets or sets the name of the CachingProfile that contains the configuration of the cached methods.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string ProfileName { get; set; }

Property Value

Type: String

Implements

ICacheItemConfigurationProfileName
See Also

Reference

CacheItemConfiguration Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheItemConfiguration.SlidingExpiration Property

CacheItemConfigurationSlidingExpiration Property

Gets or sets the duration during which the result of the cached methods is stored in cache after it has been added to or accessed from the cache. The expiration is extended every time the value is accessed from the cache.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Nullable<TimeSpan> SlidingExpiration { get; set; }

Property Value

Type: Nullable TimeSpan

Implements

ICacheItemConfigurationSlidingExpiration
See Also

Reference

CacheItemConfiguration Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheItemPriority Enumeration

Enumerates the priorities of a CacheItem.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum CacheItemPriority
Members
Member name | Value | Description
Default | 0 | Default.
NotRemovable | 1 | Never removed, unless explicitly required through invalidation methods.
See Also

Reference

PostSharp.Patterns.Caching.Implementation Namespace


CacheItemRemovedEventArgs Class

Arguments of the ItemRemoved event.
Inheritance Hierarchy
SystemObject
SystemEventArgs
PostSharp.Patterns.Caching.ImplementationCacheItemRemovedEventArgs

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class CacheItemRemovedEventArgs : EventArgs

The CacheItemRemovedEventArgs type exposes the following members.

Properties
 | Name | Description
Public property | Key | Gets the key of the removed cached item.
Public property | RemovedReason | Gets the reason of the removal.
Public property | SourceId | Gets the Guid of the CachingBackend that caused the removal, or Empty if it cannot be determined or does not apply.
Top
See Also

Reference

PostSharp.Patterns.Caching.Implementation Namespace


CacheItemRemovedEventArgs Properties

The CacheItemRemovedEventArgs type exposes the following members.

Properties
 | Name | Description
Public property | Key | Gets the key of the removed cached item.
Public property | RemovedReason | Gets the reason of the removal.
Public property | SourceId | Gets the Guid of the CachingBackend that caused the removal, or Empty if it cannot be determined or does not apply.
Top
See Also

Reference

CacheItemRemovedEventArgs Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheItemRemovedEventArgs.Key Property

CacheItemRemovedEventArgsKey Property

Gets the key of the removed cached item.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string Key { get; }

Property Value

Type: String
See Also

Reference

CacheItemRemovedEventArgs Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheItemRemovedEventArgs.RemovedReason Property

CacheItemRemovedEventArgsRemovedReason Property

Gets the reason of the removal.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CacheItemRemovedReason RemovedReason { get; }

Property Value

Type: CacheItemRemovedReason
See Also

Reference

CacheItemRemovedEventArgs Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheItemRemovedEventArgs.SourceId Property

CacheItemRemovedEventArgsSourceId Property

Gets the Guid of the CachingBackend that caused the removal, or Empty if it cannot be determined or does not apply.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Guid SourceId { get; }

Property Value

Type: Guid
See Also

Reference

CacheItemRemovedEventArgs Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheItemRemovedReason Enumeration

Enumerates the reasons why an item can be removed from the cache.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum CacheItemRemovedReason
Members
Member name | Value | Description
Removed | 0 | Directly removed from the cache, by calling the RemoveItem(String), or an invalidation method that invalidates a cached method directly (not indirectly through dependencies).
Expired | 1 | Removed because of AbsoluteExpiration or SlidingExpiration.
Evicted | 2 | Evicted to make space for newer cache items.
Invalidated | 3 | Indirectly invalidated (through dependencies).
Other | 4 | Other (or any reason that cannot be determined).
See Also

Reference

PostSharp.Patterns.Caching.Implementation Namespace


CacheKeyBuilder Class

Builds cache item keys and dependency keys.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Caching.ImplementationCacheKeyBuilder

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class CacheKeyBuilder : IDisposable

The CacheKeyBuilder type exposes the following members.

Constructors
 | Name | Description
Public method | CacheKeyBuilder | Initializes a new CacheKeyBuilder with a default maximal key size of 2048 characters.
Public method | CacheKeyBuilder(Int32) | Initializes a new CacheKeyBuilder and specifies the maximal key size.
Top
Properties
 | Name | Description
Protected property | IgnoredParameterSentinel | A sentinel object that means that the parameter is not a part of the cache key, and should be ignored.
Public property | MaxKeySize | Gets the maximal number of characters in cache keys.
Top
Methods
 | Name | Description
Protected method | AppendArgument | Appends a method argument to an UnsafeStringBuilder. To avoid ambiguities between different overloads of the same method, the default implementation appends both the parameter type and the value key.
Protected method | AppendMethod | Appends the method name and generic arguments to an UnsafeStringBuilder.
Protected method | AppendObject | Appends a string representing an Object to an UnsafeStringBuilder.
Protected method | AppendType | Appends a Type name to an UnsafeStringBuilder.
Public method | BuildDependencyKey | Builds a dependency key for a given object.
Public method | BuildMethodKey | Builds a cache key for a given method call.
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Protected method | Dispose(Boolean) | Disposes the current object.
Protected method | GetCachedMethodInfo | Gets the CachedMethodInfo for a given MethodInfo.
Top
See Also

Reference

PostSharp.Patterns.Caching.Implementation Namespace

Other Resources

Conceptual: Customizing Cache Keys


CacheKeyBuilder Constructor

Overload List
 | Name | Description
Public method | CacheKeyBuilder | Initializes a new CacheKeyBuilder with a default maximal key size of 2048 characters.
Public method | CacheKeyBuilder(Int32) | Initializes a new CacheKeyBuilder and specifies the maximal key size.
Top
See Also

Reference

CacheKeyBuilder Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheKeyBuilder Constructor

Initializes a new CacheKeyBuilder with a default maximal key size of 2048 characters.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CacheKeyBuilder()
See Also

Reference

CacheKeyBuilder Class
CacheKeyBuilder Overload
PostSharp.Patterns.Caching.Implementation Namespace


CacheKeyBuilder Constructor (Int32)

Initializes a new CacheKeyBuilder and specifies the maximal key size.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CacheKeyBuilder(
    int maxKeySize
)

Parameters

maxKeySize
Type: SystemInt32
The maximal number of characters in cache keys.
See Also

Reference

CacheKeyBuilder Class
CacheKeyBuilder Overload
PostSharp.Patterns.Caching.Implementation Namespace


CacheKeyBuilder Properties

The CacheKeyBuilder type exposes the following members.

Properties
 | Name | Description
Protected property | IgnoredParameterSentinel | A sentinel object that means that the parameter is not a part of the cache key, and should be ignored.
Public property | MaxKeySize | Gets the maximal number of characters in cache keys.
Top
See Also

Reference

CacheKeyBuilder Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheKeyBuilder.IgnoredParameterSentinel Property

CacheKeyBuilderIgnoredParameterSentinel Property

A sentinel object that means that the parameter is not a part of the cache key, and should be ignored.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected Object IgnoredParameterSentinel { get; }

Property Value

Type: Object
See Also

Reference

CacheKeyBuilder Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheKeyBuilder.MaxKeySize Property

CacheKeyBuilderMaxKeySize Property

Gets the maximal number of characters in cache keys.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int MaxKeySize { get; }

Property Value

Type: Int32
See Also

Reference

CacheKeyBuilder Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheKeyBuilder Methods

The CacheKeyBuilder type exposes the following members.

Methods
 | Name | Description
Protected method | AppendArgument | Appends a method argument to an UnsafeStringBuilder. To avoid ambiguities between different overloads of the same method, the default implementation appends both the parameter type and the value key.
Protected method | AppendMethod | Appends the method name and generic arguments to an UnsafeStringBuilder.
Protected method | AppendObject | Appends a string representing an Object to an UnsafeStringBuilder.
Protected method | AppendType | Appends a Type name to an UnsafeStringBuilder.
Public method | BuildDependencyKey | Builds a dependency key for a given object.
Public method | BuildMethodKey | Builds a cache key for a given method call.
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Protected method | Dispose(Boolean) | Disposes the current object.
Protected method | GetCachedMethodInfo | Gets the CachedMethodInfo for a given MethodInfo.
Top
See Also

Reference

CacheKeyBuilder Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheKeyBuilder.AppendArgument Method

CacheKeyBuilderAppendArgument Method

Appends a method argument to an UnsafeStringBuilder. To avoid ambiguities between different overloads of the same method, the default implementation appends both the parameter type and the value key.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void AppendArgument(
    UnsafeStringBuilder stringBuilder,
    Type parameterType,
    Object parameterValue
)

Parameters

stringBuilder
Type: PostSharp.Patterns.FormattersUnsafeStringBuilder
An UnsafeStringBuilder.
parameterType
Type: SystemType
The type of the parameter.
parameterValue
Type: SystemObject
The value assigned to the parameter (can be null).
See Also

Reference

CacheKeyBuilder Class
PostSharp.Patterns.Caching.Implementation Namespace

Other Resources

Conceptual: Customizing Cache Keys


CacheKeyBuilder.AppendMethod Method

CacheKeyBuilderAppendMethod Method

Appends the method name and generic arguments to an UnsafeStringBuilder.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void AppendMethod(
    UnsafeStringBuilder stringBuilder,
    MethodInfo method
)

Parameters

stringBuilder
Type: PostSharp.Patterns.FormattersUnsafeStringBuilder
An UnsafeStringBuilder
method
Type: System.ReflectionMethodInfo
A MethodInfo.
See Also

Reference

CacheKeyBuilder Class
PostSharp.Patterns.Caching.Implementation Namespace

Other Resources

Conceptual: Customizing Cache Keys


CacheKeyBuilder.AppendObject Method

CacheKeyBuilderAppendObject Method

Appends a string representing an Object to an UnsafeStringBuilder.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void AppendObject(
    UnsafeStringBuilder stringBuilder,
    Object o
)

Parameters

stringBuilder
Type: PostSharp.Patterns.FormattersUnsafeStringBuilder
An UnsafeStringBuilder.
o
Type: SystemObject
An Object.
See Also

Reference

CacheKeyBuilder Class
PostSharp.Patterns.Caching.Implementation Namespace

Other Resources

Conceptual: Customizing Cache Keys


CacheKeyBuilder.AppendType Method

CacheKeyBuilderAppendType Method

Appends a Type name to an UnsafeStringBuilder.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void AppendType(
    UnsafeStringBuilder stringBuilder,
    Type type
)

Parameters

stringBuilder
Type: PostSharp.Patterns.FormattersUnsafeStringBuilder
An UnsafeStringBuilder.
type
Type: SystemType
A Type.
See Also

Reference

CacheKeyBuilder Class
PostSharp.Patterns.Caching.Implementation Namespace

Other Resources

Conceptual: Customizing Cache Keys


CacheKeyBuilder.BuildDependencyKey Method

CacheKeyBuilderBuildDependencyKey Method

Builds a dependency key for a given object.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual string BuildDependencyKey(
    Object o
)

Parameters

o
Type: SystemObject
An object.

Return Value

Type: String
A dependency key that uniquely represents o.
See Also

Reference

CacheKeyBuilder Class
PostSharp.Patterns.Caching.Implementation Namespace

Other Resources

Conceptual: Customizing Cache Keys


CacheKeyBuilder.BuildMethodKey Method

CacheKeyBuilderBuildMethodKey Method

Builds a cache key for a given method call.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual string BuildMethodKey(
    MethodInfo method,
    IList<Object> arguments,
    Object instance = null
)

Parameters

method
Type: System.ReflectionMethodInfo
The MethodInfo representing the method.
arguments
Type: System.Collections.GenericIList Object
The arguments passed to the method call.
instance (Optional)
Type: SystemObject
The this instance of the method call, or null if method is static.

Return Value

Type: String
A string uniquely representing the method call.
See Also

Reference

CacheKeyBuilder Class
PostSharp.Patterns.Caching.Implementation Namespace

Other Resources

Conceptual: Customizing Cache Keys


CacheKeyBuilder.Dispose Method

CacheKeyBuilderDispose Method

Overload List
 | Name | Description
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Protected method | Dispose(Boolean) | Disposes the current object.
Top
See Also

Reference

CacheKeyBuilder Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheKeyBuilder.Dispose Method

CacheKeyBuilderDispose Method

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Dispose()

Implements

IDisposableDispose
See Also

Reference

CacheKeyBuilder Class
Dispose Overload
PostSharp.Patterns.Caching.Implementation Namespace


CacheKeyBuilder.Dispose Method (Boolean)

CacheKeyBuilderDispose Method (Boolean)

Disposes the current object.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void Dispose(
    bool disposing
)

Parameters

disposing
Type: SystemBoolean
true if the Dispose method has been called, false if the object is being finalized by the garbage collector.
See Also

Reference

CacheKeyBuilder Class
Dispose Overload
PostSharp.Patterns.Caching.Implementation Namespace


CacheKeyBuilder.GetCachedMethodInfo Method

CacheKeyBuilderGetCachedMethodInfo Method

Gets the CachedMethodInfo for a given MethodInfo.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected CachedMethodInfo GetCachedMethodInfo(
    MethodInfo method
)

Parameters

method
Type: System.ReflectionMethodInfo
A MethodInfo.

Return Value

Type: CachedMethodInfo
The CachedMethodInfo for method, or null if no CachedMethodInfo was registered for method.
See Also

Reference

CacheKeyBuilder Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheValue Class

Return value of the GetItem(String, Boolean) method, i.e. represents an item retrieved from the cache (items being stored in the cache are represented by the CacheItem class).
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Caching.ImplementationCacheValue

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class CacheValue

The CacheValue type exposes the following members.

Constructors
 | Name | Description
Public method | CacheValue | Initializes a new CacheValue.
Top
Properties
 | Name | Description
Public property | Dependencies | Gets the list of dependencies of the cache.
Public property | Value | Gets the cached value.
Top
Methods
 | Name | Description
Public method | WithValue | Returns a new CacheValue with different Value but identical Dependencies.
Top
See Also

Reference

PostSharp.Patterns.Caching.Implementation Namespace


CacheValue Constructor

Initializes a new CacheValue.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CacheValue(
    Object value,
    IImmutableList<string> dependencies = null
)

Parameters

value
Type: SystemObject
The cached value.
dependencies (Optional)
Type: IImmutableList String
The list of dependencies (or null if there are no dependencies or dependencies were not requested).
See Also

Reference

CacheValue Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheValue Properties

The CacheValue type exposes the following members.

Properties
 | Name | Description
Public property | Dependencies | Gets the list of dependencies of the cache.
Public property | Value | Gets the cached value.
Top
See Also

Reference

CacheValue Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheValue.Dependencies Property

CacheValueDependencies Property

Gets the list of dependencies of the cache.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IImmutableList<string> Dependencies { get; }

Property Value

Type: IImmutableList String
See Also

Reference

CacheValue Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheValue.Value Property

CacheValueValue Property

Gets the cached value.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Object Value { get; }

Property Value

Type: Object
See Also

Reference

CacheValue Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheValue Methods

The CacheValue type exposes the following members.

Methods
 | Name | Description
Public method | WithValue | Returns a new CacheValue with different Value but identical Dependencies.
Top
See Also

Reference

CacheValue Class
PostSharp.Patterns.Caching.Implementation Namespace


CacheValue.WithValue Method

CacheValueWithValue Method

Returns a new CacheValue with different Value but identical Dependencies.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CacheValue WithValue(
    Object value
)

Parameters

value
Type: SystemObject
The new value.

Return Value

Type: CacheValue
A new CacheValue with different Value but identical Dependencies.
See Also

Reference

CacheValue Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend Class

An abstraction of the physical implementation of the cache, where the CacheAttribute ends up writing to and reading from.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Caching.ImplementationCachingBackend
PostSharp.Patterns.Caching.BackendsMemoryCachingBackend
PostSharp.Patterns.Caching.BackendsNullCachingBackend
PostSharp.Patterns.Caching.Backends.RedisRedisCachingBackend
PostSharp.Patterns.Caching.ImplementationCachingBackendEnhancer

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class CachingBackend : IDisposable

The CachingBackend type exposes the following members.

Constructors
 | Name | Description
Protected method | CachingBackend | Initializes a new CachingBackend.
Top
Properties
 | Name | Description
Public property | Id | Gets the Guid of the current CachingBackend.
Protected property | Logger | Gets the Logger that implementations can use to emit log records.
Public property | Status | Gets the status of the current CachingBackend (Default, Disposing or Disposed).
Public property | SupportedFeatures | Gets the set of features supported by the current CachingBackend.
Public property | ValueAdapters | Gets the factory of value adapters (IValueAdapter), which allow for instance to cache things like Stream or IEnumerable, which could not be otherwise cached.
Top
Methods
 | Name | Description
Public method | Clear | Clears the cache.
Public method | ClearAsync | Asynchronously clears the cache.
Protected method | ClearAsyncCore | Asynchronously clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked.
Protected method | ClearCore | Clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked.
Public method | ContainsDependency | Determines whether the cache contains a given dependency.
Public method | ContainsDependencyAsync | Asynchronously determines whether the cache contains a given dependency.
Protected method | ContainsDependencyAsyncCore | Asynchronously determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.
Protected method | ContainsDependencyCore | Determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.
Public method | ContainsItem | Determines whether the cache contains an item of a given key.
Public method | ContainsItemAsync | Asynchronously determines whether the cache contains an item of a given key.
Protected method | ContainsItemAsyncCore | Asynchronously determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.
Protected method | ContainsItemCore | Determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.
Protected method | CreateFeatures | Creates a CachingBackendFeatures object, which describes set of features implemented by the back-end. This method is invoked the first time the SupportedFeatures property is evaluated. The result is then cached.
Public method | Dispose | Synchronously disposes the current CachingBackend.
Protected method | Dispose(Boolean) | Synchronously disposes the current CachingBackend, with a parameter instructing whether this method is called because of a call to the Dispose method or because of object finalizing.
Public method | DisposeAsync | Asynchronously dispose the current CachingBackend.
Protected method | DisposeAsyncCore | Asynchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked.
Protected method | DisposeCore | Synchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked.
Public method | GetItem | Gets a cache item given its key.
Public method | GetItemAsync | Asynchronously gets a cache item given its key.
Protected method | GetItemAsyncCore | Asynchronously gets a cache item given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.
Protected method | GetItemCore | Gets a cache item given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.
Public method | InvalidateDependency | Removes from the cache all items that have a specific dependency.
Public method | InvalidateDependencyAsync | Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.
Protected method | InvalidateDependencyAsyncCore | Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.
Protected method | InvalidateDependencyCore | Removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.
Protected method | OnDependencyInvalidated(CacheDependencyInvalidatedEventArgs) | Raises the DependencyInvalidated event given a CacheDependencyInvalidatedEventArgs.
Protected method | OnDependencyInvalidated(String, Guid) | Raises the DependencyInvalidated event , but lazily instantiates the CacheDependencyInvalidatedEventArgs if there is an event client.
Protected method | OnItemRemoved(CacheItemRemovedEventArgs) | Raises the ItemRemoved event given a CacheItemRemovedEventArgs.
Protected method | OnItemRemoved(String, CacheItemRemovedReason, Guid) | Raises the ItemRemoved event, but lazily instantiates the CacheItemRemovedEventArgs if there is an event client.
Public method | RemoveItem | Removes a cache item from the cache given its key.
Public method | RemoveItemAsync | Asynchronously removes a cache item from the cache given its key.
Protected method | RemoveItemAsyncCore | Asynchronously removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.
Protected method | RemoveItemCore | Removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.
Public method | SetItem | Sets a cache item.
Public method | SetItemAsync | Asynchronously sets a cache item.
Protected method | SetItemAsyncCore | Asynchronously sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. The default implementation is to call the synchronous SetItemCore(String, CacheItem) method.
Protected method | SetItemCore | Sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.
Public method | ToString | Returns a string that represents the current object. (Overrides ObjectToString.)
Public method | WhenBackgroundTasksCompleted | Returns a Task that is signaled to the complete state when all background tasks have completed.
Top
Events
 | Name | Description
Public event | DependencyInvalidated | Events raised when a dependency is invalidated. Check the Events property to see if the current CachingBackend supports events.
Public event | ItemRemoved | Event raised when a cache item is removed from the cache. Check the Events property to see if the current CachingBackend supports events.
Top
See Also

Reference

PostSharp.Patterns.Caching.Implementation Namespace

Other Resources

Conceptual: Caching Back-Ends


CachingBackend Constructor

Initializes a new CachingBackend.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected CachingBackend()
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend Properties

The CachingBackend type exposes the following members.

Properties
 | Name | Description
Public property | Id | Gets the Guid of the current CachingBackend.
Protected property | Logger | Gets the Logger that implementations can use to emit log records.
Public property | Status | Gets the status of the current CachingBackend (Default, Disposing or Disposed).
Public property | SupportedFeatures | Gets the set of features supported by the current CachingBackend.
Public property | ValueAdapters | Gets the factory of value adapters (IValueAdapter), which allow for instance to cache things like Stream or IEnumerable, which could not be otherwise cached.
Top
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.Id Property

CachingBackendId Property

Gets the Guid of the current CachingBackend.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Guid Id { get; }

Property Value

Type: Guid
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.Logger Property

CachingBackendLogger Property

Gets the Logger that implementations can use to emit log records.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected Logger Logger { get; }

Property Value

Type: Logger
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.Status Property

CachingBackendStatus Property

Gets the status of the current CachingBackend (Default, Disposing or Disposed).

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CachingBackendStatus Status { get; }

Property Value

Type: CachingBackendStatus
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.SupportedFeatures Property

CachingBackendSupportedFeatures Property

Gets the set of features supported by the current CachingBackend.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CachingBackendFeatures SupportedFeatures { get; }

Property Value

Type: CachingBackendFeatures
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.ValueAdapters Property

CachingBackendValueAdapters Property

Gets the factory of value adapters (IValueAdapter), which allow for instance to cache things like Stream or IEnumerable, which could not be otherwise cached.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ValueAdapterFactory ValueAdapters { get; }

Property Value

Type: ValueAdapterFactory
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace

Other Resources

Conceptual: Caching Special Types with Value Adapters


CachingBackend Methods

The CachingBackend type exposes the following members.

Methods
 | Name | Description
Public method | Clear | Clears the cache.
Public method | ClearAsync | Asynchronously clears the cache.
Protected method | ClearAsyncCore | Asynchronously clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked.
Protected method | ClearCore | Clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked.
Public method | ContainsDependency | Determines whether the cache contains a given dependency.
Public method | ContainsDependencyAsync | Asynchronously determines whether the cache contains a given dependency.
Protected method | ContainsDependencyAsyncCore | Asynchronously determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.
Protected method | ContainsDependencyCore | Determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.
Public method | ContainsItem | Determines whether the cache contains an item of a given key.
Public method | ContainsItemAsync | Asynchronously determines whether the cache contains an item of a given key.
Protected method | ContainsItemAsyncCore | Asynchronously determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.
Protected method | ContainsItemCore | Determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.
Protected method | CreateFeatures | Creates a CachingBackendFeatures object, which describes set of features implemented by the back-end. This method is invoked the first time the SupportedFeatures property is evaluated. The result is then cached.
Public method | Dispose | Synchronously disposes the current CachingBackend.
Protected method | Dispose(Boolean) | Synchronously disposes the current CachingBackend, with a parameter instructing whether this method is called because of a call to the Dispose method or because of object finalizing.
Public method | DisposeAsync | Asynchronously dispose the current CachingBackend.
Protected method | DisposeAsyncCore | Asynchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked.
Protected method | DisposeCore | Synchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked.
Public method | GetItem | Gets a cache item given its key.
Public method | GetItemAsync | Asynchronously gets a cache item given its key.
Protected method | GetItemAsyncCore | Asynchronously gets a cache item given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.
Protected method | GetItemCore | Gets a cache item given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.
Public method | InvalidateDependency | Removes from the cache all items that have a specific dependency.
Public method | InvalidateDependencyAsync | Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.
Protected method | InvalidateDependencyAsyncCore | Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.
Protected method | InvalidateDependencyCore | Removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.
Protected method | OnDependencyInvalidated(CacheDependencyInvalidatedEventArgs) | Raises the DependencyInvalidated event given a CacheDependencyInvalidatedEventArgs.
Protected method | OnDependencyInvalidated(String, Guid) | Raises the DependencyInvalidated event , but lazily instantiates the CacheDependencyInvalidatedEventArgs if there is an event client.
Protected method | OnItemRemoved(CacheItemRemovedEventArgs) | Raises the ItemRemoved event given a CacheItemRemovedEventArgs.
Protected method | OnItemRemoved(String, CacheItemRemovedReason, Guid) | Raises the ItemRemoved event, but lazily instantiates the CacheItemRemovedEventArgs if there is an event client.
Public method | RemoveItem | Removes a cache item from the cache given its key.
Public method | RemoveItemAsync | Asynchronously removes a cache item from the cache given its key.
Protected method | RemoveItemAsyncCore | Asynchronously removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.
Protected method | RemoveItemCore | Removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.
Public method | SetItem | Sets a cache item.
Public method | SetItemAsync | Asynchronously sets a cache item.
Protected method | SetItemAsyncCore | Asynchronously sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. The default implementation is to call the synchronous SetItemCore(String, CacheItem) method.
Protected method | SetItemCore | Sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.
Public method | ToString | Returns a string that represents the current object. (Overrides ObjectToString.)
Public method | WhenBackgroundTasksCompleted | Returns a Task that is signaled to the complete state when all background tasks have completed.
Top
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.Clear Method

CachingBackendClear Method

Clears the cache.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Clear()
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.ClearAsync Method

CachingBackendClearAsync Method

Asynchronously clears the cache.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Task ClearAsync(
    CancellationToken cancellationToken = null
)

Parameters

cancellationToken (Optional)
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task
A Task.
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.ClearAsyncCore Method

CachingBackendClearAsyncCore Method

Asynchronously clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual Task ClearAsyncCore(
    CancellationToken cancellationToken
)

Parameters

cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task
A Task.
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.ClearCore Method

CachingBackendClearCore Method

Clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected abstract void ClearCore()
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.ContainsDependency Method

CachingBackendContainsDependency Method

Determines whether the cache contains a given dependency.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool ContainsDependency(
    string key
)

Parameters

key
Type: SystemString
The dependency key.

Return Value

Type: Boolean
true if the cache contains the dependency key, otherwise false.
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.ContainsDependencyAsync Method

CachingBackendContainsDependencyAsync Method

Asynchronously determines whether the cache contains a given dependency.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Task<bool> ContainsDependencyAsync(
    string key,
    CancellationToken cancellationToken = null
)

Parameters

key
Type: SystemString
The dependency key.
cancellationToken (Optional)
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task Boolean
A Task evaluating to true if the cache contains the dependency key, otherwise false.
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.ContainsDependencyAsyncCore Method

CachingBackendContainsDependencyAsyncCore Method

Asynchronously determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual Task<bool> ContainsDependencyAsyncCore(
    string key,
    CancellationToken cancellationToken
)

Parameters

key
Type: SystemString
The dependency key.
cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task Boolean
A Task evaluating to true if the cache contains the dependency key, otherwise false.
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.ContainsDependencyCore Method

CachingBackendContainsDependencyCore Method

Determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected abstract bool ContainsDependencyCore(
    string key
)

Parameters

key
Type: SystemString
The dependency key.

Return Value

Type: Boolean
true if the cache contains the dependency key, otherwise false.
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.ContainsItem Method

CachingBackendContainsItem Method

Determines whether the cache contains an item of a given key.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool ContainsItem(
    string key
)

Parameters

key
Type: SystemString
The key of the cache item.

Return Value

Type: Boolean
true if the cache contains an item whose key is key, otherwise false.
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.ContainsItemAsync Method

CachingBackendContainsItemAsync Method

Asynchronously determines whether the cache contains an item of a given key.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Task<bool> ContainsItemAsync(
    string key,
    CancellationToken cancellationToken = null
)

Parameters

key
Type: SystemString
The key of the cache item.
cancellationToken (Optional)
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task Boolean
A Task that evaluates to true if the cache contains an item whose key is key, otherwise false.
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.ContainsItemAsyncCore Method

CachingBackendContainsItemAsyncCore Method

Asynchronously determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual Task<bool> ContainsItemAsyncCore(
    string key,
    CancellationToken cancellationToken
)

Parameters

key
Type: SystemString
The key of the cache item.
cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task Boolean
A Task that evaluates to true if the cache contains an item whose key is key, otherwise false.
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.ContainsItemCore Method

CachingBackendContainsItemCore Method

Determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected abstract bool ContainsItemCore(
    string key
)

Parameters

key
Type: SystemString
The key of the cache item.

Return Value

Type: Boolean
true if the cache contains an item whose key is key, otherwise false.
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.CreateFeatures Method

CachingBackendCreateFeatures Method

Creates a CachingBackendFeatures object, which describes set of features implemented by the back-end. This method is invoked the first time the SupportedFeatures property is evaluated. The result is then cached.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual CachingBackendFeatures CreateFeatures()

Return Value

Type: CachingBackendFeatures
A new instance of the CachingBackendEnhancerFeatures class.
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.Dispose Method

CachingBackendDispose Method

Overload List
 | Name | Description
Public method | Dispose | Synchronously disposes the current CachingBackend.
Protected method | Dispose(Boolean) | Synchronously disposes the current CachingBackend, with a parameter instructing whether this method is called because of a call to the Dispose method or because of object finalizing.
Top
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.Dispose Method

CachingBackendDispose Method

Synchronously disposes the current CachingBackend.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Dispose()

Implements

IDisposableDispose
See Also

Reference

CachingBackend Class
Dispose Overload
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.Dispose Method (Boolean)

CachingBackendDispose Method (Boolean)

Synchronously disposes the current CachingBackend, with a parameter instructing whether this method is called because of a call to the Dispose method or because of object finalizing.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected void Dispose(
    bool disposing
)

Parameters

disposing
Type: SystemBoolean
true if this method is called because the Dispose method has been called, or false if the object is being finalized.
See Also

Reference

CachingBackend Class
Dispose Overload
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.DisposeAsync Method

CachingBackendDisposeAsync Method

Asynchronously dispose the current CachingBackend.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Task DisposeAsync(
    CancellationToken cancellationToken = null
)

Parameters

cancellationToken (Optional)
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task
A Task.
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.DisposeAsyncCore Method

CachingBackendDisposeAsyncCore Method

Asynchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual Task DisposeAsyncCore(
    CancellationToken cancellationToken
)

Parameters

cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task
A Task.
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.DisposeCore Method

CachingBackendDisposeCore Method

Synchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void DisposeCore(
    bool disposing
)

Parameters

disposing
Type: SystemBoolean
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.GetItem Method

CachingBackendGetItem Method

Gets a cache item given its key.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CacheValue GetItem(
    string key,
    bool includeDependencies = true
)

Parameters

key
Type: SystemString
The cache item.
includeDependencies (Optional)
Type: SystemBoolean
true if the Dependencies properties of the resulting CacheValue should be populated, otherwise false.

Return Value

Type: CacheValue
A CacheValue, or null if there is no item in cache of the given key.
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.GetItemAsync Method

CachingBackendGetItemAsync Method

Asynchronously gets a cache item given its key.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Task<CacheValue> GetItemAsync(
    string key,
    bool includeDependencies = true,
    CancellationToken cancellationToken = null
)

Parameters

key
Type: SystemString
The cache item.
includeDependencies (Optional)
Type: SystemBoolean
true if the Dependencies properties of the resulting CacheValue should be populated, otherwise false.
cancellationToken (Optional)
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task CacheValue
A Task evaluating to a CacheValue, or evaluating to null if there is no item in cache of the given key.
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.GetItemAsyncCore Method

CachingBackendGetItemAsyncCore Method

Asynchronously gets a cache item given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual Task<CacheValue> GetItemAsyncCore(
    string key,
    bool includeDependencies,
    CancellationToken cancellationToken
)

Parameters

key
Type: SystemString
The cache item.
includeDependencies
Type: SystemBoolean
true if the Dependencies properties of the resulting CacheValue should be populated, otherwise false.
cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task CacheValue
A Task evaluating to a CacheValue, or evaluating to null if there is no item in cache of the given key.
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.GetItemCore Method

CachingBackendGetItemCore Method

Gets a cache item given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected abstract CacheValue GetItemCore(
    string key,
    bool includeDependencies
)

Parameters

key
Type: SystemString
The cache item.
includeDependencies
Type: SystemBoolean
true if the Dependencies properties of the resulting CacheValue should be populated, otherwise false.

Return Value

Type: CacheValue
A CacheValue, or null if there is no item in cache of the given key.
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.InvalidateDependency Method

CachingBackendInvalidateDependency Method

Removes from the cache all items that have a specific dependency.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void InvalidateDependency(
    string key
)

Parameters

key
Type: SystemString
The dependency key.
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.InvalidateDependencyAsync Method

CachingBackendInvalidateDependencyAsync Method

Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Task InvalidateDependencyAsync(
    string key,
    CancellationToken cancellationToken = null
)

Parameters

key
Type: SystemString
The dependency key.
cancellationToken (Optional)
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task
A Task.
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.InvalidateDependencyAsyncCore Method

CachingBackendInvalidateDependencyAsyncCore Method

Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual Task InvalidateDependencyAsyncCore(
    string key,
    CancellationToken cancellationToken
)

Parameters

key
Type: SystemString
The dependency key.
cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task
A Task.
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.InvalidateDependencyCore Method

CachingBackendInvalidateDependencyCore Method

Removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected abstract void InvalidateDependencyCore(
    string key
)

Parameters

key
Type: SystemString
The dependency key.
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.OnDependencyInvalidated Method

CachingBackendOnDependencyInvalidated Method

Overload List
 | Name | Description
Protected method | OnDependencyInvalidated(CacheDependencyInvalidatedEventArgs) | Raises the DependencyInvalidated event given a CacheDependencyInvalidatedEventArgs.
Protected method | OnDependencyInvalidated(String, Guid) | Raises the DependencyInvalidated event , but lazily instantiates the CacheDependencyInvalidatedEventArgs if there is an event client.
Top
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.OnDependencyInvalidated Method (CacheDependencyInvalidatedEventArgs)

CachingBackendOnDependencyInvalidated Method (CacheDependencyInvalidatedEventArgs)

Raises the DependencyInvalidated event given a CacheDependencyInvalidatedEventArgs.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected void OnDependencyInvalidated(
    CacheDependencyInvalidatedEventArgs args
)

Parameters

args
Type: PostSharp.Patterns.Caching.ImplementationCacheDependencyInvalidatedEventArgs
A CacheDependencyInvalidatedEventArgs.
See Also

Reference

CachingBackend Class
OnDependencyInvalidated Overload
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.OnDependencyInvalidated Method (String, Guid)

CachingBackendOnDependencyInvalidated Method (String, Guid)

Raises the DependencyInvalidated event , but lazily instantiates the CacheDependencyInvalidatedEventArgs if there is an event client.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected void OnDependencyInvalidated(
    string key,
    Guid sourceId
)

Parameters

key
Type: SystemString
The key of the removed cache item.
sourceId
Type: SystemGuid
The Guid of the CachingBackend instance that removed the item,. or Empty if the source CachingBackend cannot be determined.
See Also

Reference

CachingBackend Class
OnDependencyInvalidated Overload
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.OnItemRemoved Method

CachingBackendOnItemRemoved Method

Overload List
 | Name | Description
Protected method | OnItemRemoved(CacheItemRemovedEventArgs) | Raises the ItemRemoved event given a CacheItemRemovedEventArgs.
Protected method | OnItemRemoved(String, CacheItemRemovedReason, Guid) | Raises the ItemRemoved event, but lazily instantiates the CacheItemRemovedEventArgs if there is an event client.
Top
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.OnItemRemoved Method (CacheItemRemovedEventArgs)

CachingBackendOnItemRemoved Method (CacheItemRemovedEventArgs)

Raises the ItemRemoved event given a CacheItemRemovedEventArgs.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected void OnItemRemoved(
    CacheItemRemovedEventArgs args
)

Parameters

args
Type: PostSharp.Patterns.Caching.ImplementationCacheItemRemovedEventArgs
Event arguments.
See Also

Reference

CachingBackend Class
OnItemRemoved Overload
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.OnItemRemoved Method (String, CacheItemRemovedReason, Guid)

CachingBackendOnItemRemoved Method (String, CacheItemRemovedReason, Guid)

Raises the ItemRemoved event, but lazily instantiates the CacheItemRemovedEventArgs if there is an event client.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected void OnItemRemoved(
    string key,
    CacheItemRemovedReason reason,
    Guid sourceId
)

Parameters

key
Type: SystemString
The key of the removed cache item.
reason
Type: PostSharp.Patterns.Caching.ImplementationCacheItemRemovedReason
The reason of the removal.
sourceId
Type: SystemGuid
The Guid of the CachingBackend instance that removed the item,. or Empty if the source CachingBackend cannot be determined.
See Also

Reference

CachingBackend Class
OnItemRemoved Overload
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.RemoveItem Method

CachingBackendRemoveItem Method

Removes a cache item from the cache given its key.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void RemoveItem(
    string key
)

Parameters

key
Type: SystemString
The key of the cache item.
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.RemoveItemAsync Method

CachingBackendRemoveItemAsync Method

Asynchronously removes a cache item from the cache given its key.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Task RemoveItemAsync(
    string key,
    CancellationToken cancellationToken = null
)

Parameters

key
Type: SystemString
The key of the cache item.
cancellationToken (Optional)
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task
A Task.
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.RemoveItemAsyncCore Method

CachingBackendRemoveItemAsyncCore Method

Asynchronously removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual Task RemoveItemAsyncCore(
    string key,
    CancellationToken cancellationToken
)

Parameters

key
Type: SystemString
The key of the cache item.
cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task
A Task.
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.RemoveItemCore Method

CachingBackendRemoveItemCore Method

Removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected abstract void RemoveItemCore(
    string key
)

Parameters

key
Type: SystemString
The key of the cache item.
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.SetItem Method

CachingBackendSetItem Method

Sets a cache item.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void SetItem(
    string key,
    CacheItem item
)

Parameters

key
Type: SystemString
The key of the cache item.
item
Type: PostSharp.Patterns.Caching.ImplementationCacheItem
The cache item.
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.SetItemAsync Method

CachingBackendSetItemAsync Method

Asynchronously sets a cache item.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Task SetItemAsync(
    string key,
    CacheItem item,
    CancellationToken cancellationToken = null
)

Parameters

key
Type: SystemString
The key of the cache item.
item
Type: PostSharp.Patterns.Caching.ImplementationCacheItem
The cache item.
cancellationToken (Optional)
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task
A Task.
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.SetItemAsyncCore Method

CachingBackendSetItemAsyncCore Method

Asynchronously sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. The default implementation is to call the synchronous SetItemCore(String, CacheItem) method.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual Task SetItemAsyncCore(
    string key,
    CacheItem item,
    CancellationToken cancellationToken
)

Parameters

key
Type: SystemString
The key of the cache item.
item
Type: PostSharp.Patterns.Caching.ImplementationCacheItem
The cache item.
cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task
A Task.
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.SetItemCore Method

CachingBackendSetItemCore Method

Sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected abstract void SetItemCore(
    string key,
    CacheItem item
)

Parameters

key
Type: SystemString
The key of the cache item.
item
Type: PostSharp.Patterns.Caching.ImplementationCacheItem
The cache item.
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.ToString Method

CachingBackendToString Method

Returns a string that represents the current object.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override string ToString()

Return Value

Type: String
A string that represents the current object.
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.WhenBackgroundTasksCompleted Method

CachingBackendWhenBackgroundTasksCompleted Method

Returns a Task that is signaled to the complete state when all background tasks have completed.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual Task WhenBackgroundTasksCompleted(
    CancellationToken cancellationToken
)

Parameters

cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task
A Task that is signaled to the complete state when all background tasks have completed
Remarks

Other background tasks may possibly be enqueued between the time the returned Task has been signaled and the time the signal is processed by the caller.

See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend Events

The CachingBackend type exposes the following members.

Events
 | Name | Description
Public event | DependencyInvalidated | Events raised when a dependency is invalidated. Check the Events property to see if the current CachingBackend supports events.
Public event | ItemRemoved | Event raised when a cache item is removed from the cache. Check the Events property to see if the current CachingBackend supports events.
Top
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.DependencyInvalidated Event

CachingBackendDependencyInvalidated Event

Events raised when a dependency is invalidated. Check the Events property to see if the current CachingBackend supports events.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public event EventHandler<CacheDependencyInvalidatedEventArgs> DependencyInvalidated

Value

Type: SystemEventHandler CacheDependencyInvalidatedEventArgs
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackend.ItemRemoved Event

CachingBackendItemRemoved Event

Event raised when a cache item is removed from the cache. Check the Events property to see if the current CachingBackend supports events.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public event EventHandler<CacheItemRemovedEventArgs> ItemRemoved

Value

Type: SystemEventHandler CacheItemRemovedEventArgs
See Also

Reference

CachingBackend Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendEnhancer Class

A base class for all cache enhancers. A CachingBackendEnhancer is a node in a chain of responsibility where the last node is the physical implementation of the CachingBackend. A CachingBackendEnhancer can add behaviors to a CachingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Caching.ImplementationCachingBackend
PostSharp.Patterns.Caching.ImplementationCachingBackendEnhancer
PostSharp.Patterns.Caching.BackendsNonBlockingCachingBackendEnhancer
PostSharp.Patterns.Caching.BackendsTwoLayerCachingBackendEnhancer
PostSharp.Patterns.Caching.ImplementationCacheInvalidator

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class CachingBackendEnhancer : CachingBackend

The CachingBackendEnhancer type exposes the following members.

Constructors
 | Name | Description
Protected method | CachingBackendEnhancer | Initializes a new CachingBackendEnhancer.
Top
Properties
 | Name | Description
Public property | Id | Gets the Guid of the current CachingBackend. (Inherited from CachingBackend.)
Protected property | Logger | Gets the Logger that implementations can use to emit log records. (Inherited from CachingBackend.)
Public property | Status | Gets the status of the current CachingBackend (Default, Disposing or Disposed). (Inherited from CachingBackend.)
Public property | SupportedFeatures | Gets the set of features supported by the current CachingBackend. (Inherited from CachingBackend.)
Public property | UnderlyingBackend | Gets the next CachingBackend in the chain of responsibility.
Public property | ValueAdapters | Gets the factory of value adapters (IValueAdapter), which allow for instance to cache things like Stream or IEnumerable, which could not be otherwise cached. (Inherited from CachingBackend.)
Top
Methods
 | Name | Description
Public method | Clear | Clears the cache. (Inherited from CachingBackend.)
Public method | ClearAsync | Asynchronously clears the cache. (Inherited from CachingBackend.)
Protected method | ClearAsyncCore | Asynchronously clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Overrides CachingBackendClearAsyncCore(CancellationToken).)
Protected method | ClearCore | Clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Overrides CachingBackendClearCore.)
Public method | ContainsDependency | Determines whether the cache contains a given dependency. (Inherited from CachingBackend.)
Public method | ContainsDependencyAsync | Asynchronously determines whether the cache contains a given dependency. (Inherited from CachingBackend.)
Protected method | ContainsDependencyAsyncCore | Asynchronously determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendContainsDependencyAsyncCore(String, CancellationToken).)
Protected method | ContainsDependencyCore | Determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendContainsDependencyCore(String).)
Public method | ContainsItem | Determines whether the cache contains an item of a given key. (Inherited from CachingBackend.)
Public method | ContainsItemAsync | Asynchronously determines whether the cache contains an item of a given key. (Inherited from CachingBackend.)
Protected method | ContainsItemAsyncCore | Asynchronously determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendContainsItemAsyncCore(String, CancellationToken).)
Protected method | ContainsItemCore | Determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendContainsItemCore(String).)
Protected method | CreateFeatures | Creates a CachingBackendFeatures object, which describes set of features implemented by the back-end. This method is invoked the first time the SupportedFeatures property is evaluated. The result is then cached. (Overrides CachingBackendCreateFeatures.)
Public method | Dispose | Synchronously disposes the current CachingBackend. (Inherited from CachingBackend.)
Protected method | Dispose(Boolean) | Synchronously disposes the current CachingBackend, with a parameter instructing whether this method is called because of a call to the Dispose method or because of object finalizing. (Inherited from CachingBackend.)
Public method | DisposeAsync | Asynchronously dispose the current CachingBackend. (Inherited from CachingBackend.)
Protected method | DisposeAsyncCore | Asynchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Overrides CachingBackendDisposeAsyncCore(CancellationToken).)
Protected method | DisposeCore | Synchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Overrides CachingBackendDisposeCore(Boolean).)
Public method | GetItem | Gets a cache item given its key. (Inherited from CachingBackend.)
Public method | GetItemAsync | Asynchronously gets a cache item given its key. (Inherited from CachingBackend.)
Protected method | GetItemAsyncCore | Asynchronously gets a cache item given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendGetItemAsyncCore(String, Boolean, CancellationToken).)
Protected method | GetItemCore | Gets a cache item given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendGetItemCore(String, Boolean).)
Public method | InvalidateDependency | Removes from the cache all items that have a specific dependency. (Inherited from CachingBackend.)
Public method | InvalidateDependencyAsync | Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackend.)
Protected method | InvalidateDependencyAsyncCore | Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendInvalidateDependencyAsyncCore(String, CancellationToken).)
Protected method | InvalidateDependencyCore | Removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendInvalidateDependencyCore(String).)
Protected method | OnBackendDependencyInvalidated | Method invoked when the DependencyInvalidated event of the next UnderlyingBackend in the chain of responsibility is invoked.
Protected method | OnBackendItemRemoved | Method invoked when the ItemRemoved event of the next UnderlyingBackend in the chain of responsibility is invoked.
Protected method | OnDependencyInvalidated(CacheDependencyInvalidatedEventArgs) | Raises the DependencyInvalidated event given a CacheDependencyInvalidatedEventArgs. (Inherited from CachingBackend.)
Protected method | OnDependencyInvalidated(String, Guid) | Raises the DependencyInvalidated event , but lazily instantiates the CacheDependencyInvalidatedEventArgs if there is an event client. (Inherited from CachingBackend.)
Protected method | OnItemRemoved(CacheItemRemovedEventArgs) | Raises the ItemRemoved event given a CacheItemRemovedEventArgs. (Inherited from CachingBackend.)
Protected method | OnItemRemoved(String, CacheItemRemovedReason, Guid) | Raises the ItemRemoved event, but lazily instantiates the CacheItemRemovedEventArgs if there is an event client. (Inherited from CachingBackend.)
Public method | RemoveItem | Removes a cache item from the cache given its key. (Inherited from CachingBackend.)
Public method | RemoveItemAsync | Asynchronously removes a cache item from the cache given its key. (Inherited from CachingBackend.)
Protected method | RemoveItemAsyncCore | Asynchronously removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendRemoveItemAsyncCore(String, CancellationToken).)
Protected method | RemoveItemCore | Removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendRemoveItemCore(String).)
Public method | SetItem | Sets a cache item. (Inherited from CachingBackend.)
Public method | SetItemAsync | Asynchronously sets a cache item. (Inherited from CachingBackend.)
Protected method | SetItemAsyncCore | Asynchronously sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. The default implementation is to call the synchronous SetItemCore(String, CacheItem) method. (Overrides CachingBackendSetItemAsyncCore(String, CacheItem, CancellationToken).)
Protected method | SetItemCore | Sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendSetItemCore(String, CacheItem).)
Public method | ToString | Returns a string that represents the current object. (Inherited from CachingBackend.)
Public method | WhenBackgroundTasksCompleted | Returns a Task that is signaled to the complete state when all background tasks have completed. (Inherited from CachingBackend.)
Top
Events
 | Name | Description
Public event | DependencyInvalidated | Events raised when a dependency is invalidated. Check the Events property to see if the current CachingBackend supports events. (Inherited from CachingBackend.)
Public event | ItemRemoved | Event raised when a cache item is removed from the cache. Check the Events property to see if the current CachingBackend supports events. (Inherited from CachingBackend.)
Top
Remarks

The default behavior of all methods of a CachingBackendEnhancer is to delegate the implementation to the next CachingBackend in the chain of responsibility.

See Also

Reference

PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendEnhancer Constructor

Initializes a new CachingBackendEnhancer.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected CachingBackendEnhancer(
    CachingBackend underlyingBackend
)

Parameters

underlyingBackend
Type: PostSharp.Patterns.Caching.ImplementationCachingBackend
The next CachingBackend in the chain of responsibility.
See Also

Reference

CachingBackendEnhancer Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendEnhancer Properties

The CachingBackendEnhancer type exposes the following members.

Properties
 | Name | Description
Public property | Id | Gets the Guid of the current CachingBackend. (Inherited from CachingBackend.)
Protected property | Logger | Gets the Logger that implementations can use to emit log records. (Inherited from CachingBackend.)
Public property | Status | Gets the status of the current CachingBackend (Default, Disposing or Disposed). (Inherited from CachingBackend.)
Public property | SupportedFeatures | Gets the set of features supported by the current CachingBackend. (Inherited from CachingBackend.)
Public property | UnderlyingBackend | Gets the next CachingBackend in the chain of responsibility.
Public property | ValueAdapters | Gets the factory of value adapters (IValueAdapter), which allow for instance to cache things like Stream or IEnumerable, which could not be otherwise cached. (Inherited from CachingBackend.)
Top
See Also

Reference

CachingBackendEnhancer Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendEnhancer.UnderlyingBackend Property

CachingBackendEnhancerUnderlyingBackend Property

Gets the next CachingBackend in the chain of responsibility.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CachingBackend UnderlyingBackend { get; }

Property Value

Type: CachingBackend
See Also

Reference

CachingBackendEnhancer Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendEnhancer Methods

The CachingBackendEnhancer type exposes the following members.

Methods
 | Name | Description
Public method | Clear | Clears the cache. (Inherited from CachingBackend.)
Public method | ClearAsync | Asynchronously clears the cache. (Inherited from CachingBackend.)
Protected method | ClearAsyncCore | Asynchronously clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Overrides CachingBackendClearAsyncCore(CancellationToken).)
Protected method | ClearCore | Clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Overrides CachingBackendClearCore.)
Public method | ContainsDependency | Determines whether the cache contains a given dependency. (Inherited from CachingBackend.)
Public method | ContainsDependencyAsync | Asynchronously determines whether the cache contains a given dependency. (Inherited from CachingBackend.)
Protected method | ContainsDependencyAsyncCore | Asynchronously determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendContainsDependencyAsyncCore(String, CancellationToken).)
Protected method | ContainsDependencyCore | Determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendContainsDependencyCore(String).)
Public method | ContainsItem | Determines whether the cache contains an item of a given key. (Inherited from CachingBackend.)
Public method | ContainsItemAsync | Asynchronously determines whether the cache contains an item of a given key. (Inherited from CachingBackend.)
Protected method | ContainsItemAsyncCore | Asynchronously determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendContainsItemAsyncCore(String, CancellationToken).)
Protected method | ContainsItemCore | Determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendContainsItemCore(String).)
Protected method | CreateFeatures | Creates a CachingBackendFeatures object, which describes set of features implemented by the back-end. This method is invoked the first time the SupportedFeatures property is evaluated. The result is then cached. (Overrides CachingBackendCreateFeatures.)
Public method | Dispose | Synchronously disposes the current CachingBackend. (Inherited from CachingBackend.)
Protected method | Dispose(Boolean) | Synchronously disposes the current CachingBackend, with a parameter instructing whether this method is called because of a call to the Dispose method or because of object finalizing. (Inherited from CachingBackend.)
Public method | DisposeAsync | Asynchronously dispose the current CachingBackend. (Inherited from CachingBackend.)
Protected method | DisposeAsyncCore | Asynchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Overrides CachingBackendDisposeAsyncCore(CancellationToken).)
Protected method | DisposeCore | Synchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. (Overrides CachingBackendDisposeCore(Boolean).)
Public method | GetItem | Gets a cache item given its key. (Inherited from CachingBackend.)
Public method | GetItemAsync | Asynchronously gets a cache item given its key. (Inherited from CachingBackend.)
Protected method | GetItemAsyncCore | Asynchronously gets a cache item given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendGetItemAsyncCore(String, Boolean, CancellationToken).)
Protected method | GetItemCore | Gets a cache item given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendGetItemCore(String, Boolean).)
Public method | InvalidateDependency | Removes from the cache all items that have a specific dependency. (Inherited from CachingBackend.)
Public method | InvalidateDependencyAsync | Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Inherited from CachingBackend.)
Protected method | InvalidateDependencyAsyncCore | Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendInvalidateDependencyAsyncCore(String, CancellationToken).)
Protected method | InvalidateDependencyCore | Removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendInvalidateDependencyCore(String).)
Protected method | OnBackendDependencyInvalidated | Method invoked when the DependencyInvalidated event of the next UnderlyingBackend in the chain of responsibility is invoked.
Protected method | OnBackendItemRemoved | Method invoked when the ItemRemoved event of the next UnderlyingBackend in the chain of responsibility is invoked.
Protected method | OnDependencyInvalidated(CacheDependencyInvalidatedEventArgs) | Raises the DependencyInvalidated event given a CacheDependencyInvalidatedEventArgs. (Inherited from CachingBackend.)
Protected method | OnDependencyInvalidated(String, Guid) | Raises the DependencyInvalidated event , but lazily instantiates the CacheDependencyInvalidatedEventArgs if there is an event client. (Inherited from CachingBackend.)
Protected method | OnItemRemoved(CacheItemRemovedEventArgs) | Raises the ItemRemoved event given a CacheItemRemovedEventArgs. (Inherited from CachingBackend.)
Protected method | OnItemRemoved(String, CacheItemRemovedReason, Guid) | Raises the ItemRemoved event, but lazily instantiates the CacheItemRemovedEventArgs if there is an event client. (Inherited from CachingBackend.)
Public method | RemoveItem | Removes a cache item from the cache given its key. (Inherited from CachingBackend.)
Public method | RemoveItemAsync | Asynchronously removes a cache item from the cache given its key. (Inherited from CachingBackend.)
Protected method | RemoveItemAsyncCore | Asynchronously removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendRemoveItemAsyncCore(String, CancellationToken).)
Protected method | RemoveItemCore | Removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendRemoveItemCore(String).)
Public method | SetItem | Sets a cache item. (Inherited from CachingBackend.)
Public method | SetItemAsync | Asynchronously sets a cache item. (Inherited from CachingBackend.)
Protected method | SetItemAsyncCore | Asynchronously sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. The default implementation is to call the synchronous SetItemCore(String, CacheItem) method. (Overrides CachingBackendSetItemAsyncCore(String, CacheItem, CancellationToken).)
Protected method | SetItemCore | Sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. (Overrides CachingBackendSetItemCore(String, CacheItem).)
Public method | ToString | Returns a string that represents the current object. (Inherited from CachingBackend.)
Public method | WhenBackgroundTasksCompleted | Returns a Task that is signaled to the complete state when all background tasks have completed. (Inherited from CachingBackend.)
Top
See Also

Reference

CachingBackendEnhancer Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendEnhancer.ClearAsyncCore Method

CachingBackendEnhancerClearAsyncCore Method

Asynchronously clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override Task ClearAsyncCore(
    CancellationToken cancellationToken
)

Parameters

cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task
A Task.
See Also

Reference

CachingBackendEnhancer Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendEnhancer.ClearCore Method

CachingBackendEnhancerClearCore Method

Clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void ClearCore()
See Also

Reference

CachingBackendEnhancer Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendEnhancer.ContainsDependencyAsyncCore Method

CachingBackendEnhancerContainsDependencyAsyncCore Method

Asynchronously determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override Task<bool> ContainsDependencyAsyncCore(
    string key,
    CancellationToken cancellationToken
)

Parameters

key
Type: SystemString
The dependency key.
cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task Boolean
A Task evaluating to true if the cache contains the dependency key, otherwise false.
See Also

Reference

CachingBackendEnhancer Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendEnhancer.ContainsDependencyCore Method

CachingBackendEnhancerContainsDependencyCore Method

Determines whether the cache contains a given dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override bool ContainsDependencyCore(
    string key
)

Parameters

key
Type: SystemString
The dependency key.

Return Value

Type: Boolean
true if the cache contains the dependency key, otherwise false.
See Also

Reference

CachingBackendEnhancer Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendEnhancer.ContainsItemAsyncCore Method

CachingBackendEnhancerContainsItemAsyncCore Method

Asynchronously determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override Task<bool> ContainsItemAsyncCore(
    string key,
    CancellationToken cancellationToken
)

Parameters

key
Type: SystemString
The key of the cache item.
cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task Boolean
A Task that evaluates to true if the cache contains an item whose key is key, otherwise false.
See Also

Reference

CachingBackendEnhancer Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendEnhancer.ContainsItemCore Method

CachingBackendEnhancerContainsItemCore Method

Determines whether the cache contains an item of a given key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override bool ContainsItemCore(
    string key
)

Parameters

key
Type: SystemString
The key of the cache item.

Return Value

Type: Boolean
true if the cache contains an item whose key is key, otherwise false.
See Also

Reference

CachingBackendEnhancer Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendEnhancer.CreateFeatures Method

CachingBackendEnhancerCreateFeatures Method

Creates a CachingBackendFeatures object, which describes set of features implemented by the back-end. This method is invoked the first time the SupportedFeatures property is evaluated. The result is then cached.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override CachingBackendFeatures CreateFeatures()

Return Value

Type: CachingBackendFeatures
A new instance of the CachingBackendEnhancerFeatures class.
See Also

Reference

CachingBackendEnhancer Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendEnhancer.DisposeAsyncCore Method

CachingBackendEnhancerDisposeAsyncCore Method

Asynchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override Task DisposeAsyncCore(
    CancellationToken cancellationToken
)

Parameters

cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task
A Task.
See Also

Reference

CachingBackendEnhancer Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendEnhancer.DisposeCore Method

CachingBackendEnhancerDisposeCore Method

Synchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void DisposeCore(
    bool disposing
)

Parameters

disposing
Type: SystemBoolean
See Also

Reference

CachingBackendEnhancer Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendEnhancer.GetItemAsyncCore Method

CachingBackendEnhancerGetItemAsyncCore Method

Asynchronously gets a cache item given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override Task<CacheValue> GetItemAsyncCore(
    string key,
    bool includeDependencies,
    CancellationToken cancellationToken
)

Parameters

key
Type: SystemString
The cache item.
includeDependencies
Type: SystemBoolean
true if the Dependencies properties of the resulting CacheValue should be populated, otherwise false.
cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task CacheValue
A Task evaluating to a CacheValue, or evaluating to null if there is no item in cache of the given key.
See Also

Reference

CachingBackendEnhancer Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendEnhancer.GetItemCore Method

CachingBackendEnhancerGetItemCore Method

Gets a cache item given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override CacheValue GetItemCore(
    string key,
    bool includeDependencies
)

Parameters

key
Type: SystemString
The cache item.
includeDependencies
Type: SystemBoolean
true if the Dependencies properties of the resulting CacheValue should be populated, otherwise false.

Return Value

Type: CacheValue
A CacheValue, or null if there is no item in cache of the given key.
See Also

Reference

CachingBackendEnhancer Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendEnhancer.InvalidateDependencyAsyncCore Method

CachingBackendEnhancerInvalidateDependencyAsyncCore Method

Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override Task InvalidateDependencyAsyncCore(
    string key,
    CancellationToken cancellationToken
)

Parameters

key
Type: SystemString
The dependency key.
cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task
A Task.
See Also

Reference

CachingBackendEnhancer Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendEnhancer.InvalidateDependencyCore Method

CachingBackendEnhancerInvalidateDependencyCore Method

Removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void InvalidateDependencyCore(
    string key
)

Parameters

key
Type: SystemString
The dependency key.
See Also

Reference

CachingBackendEnhancer Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendEnhancer.OnBackendDependencyInvalidated Method

CachingBackendEnhancerOnBackendDependencyInvalidated Method

Method invoked when the DependencyInvalidated event of the next UnderlyingBackend in the chain of responsibility is invoked.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void OnBackendDependencyInvalidated(
    Object sender,
    CacheDependencyInvalidatedEventArgs args
)

Parameters

sender
Type: SystemObject
The sender (typically the value of the UnderlyingBackend property).
args
Type: PostSharp.Patterns.Caching.ImplementationCacheDependencyInvalidatedEventArgs
The CacheDependencyInvalidatedEventArgs.
See Also

Reference

CachingBackendEnhancer Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendEnhancer.OnBackendItemRemoved Method

CachingBackendEnhancerOnBackendItemRemoved Method

Method invoked when the ItemRemoved event of the next UnderlyingBackend in the chain of responsibility is invoked.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void OnBackendItemRemoved(
    Object sender,
    CacheItemRemovedEventArgs args
)

Parameters

sender
Type: SystemObject
The sender (typically the value of the UnderlyingBackend property).
args
Type: PostSharp.Patterns.Caching.ImplementationCacheItemRemovedEventArgs
The CacheItemRemovedEventArgs.
See Also

Reference

CachingBackendEnhancer Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendEnhancer.RemoveItemAsyncCore Method

CachingBackendEnhancerRemoveItemAsyncCore Method

Asynchronously removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override Task RemoveItemAsyncCore(
    string key,
    CancellationToken cancellationToken
)

Parameters

key
Type: SystemString
The key of the cache item.
cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task
A Task.
See Also

Reference

CachingBackendEnhancer Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendEnhancer.RemoveItemCore Method

CachingBackendEnhancerRemoveItemCore Method

Removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void RemoveItemCore(
    string key
)

Parameters

key
Type: SystemString
The key of the cache item.
See Also

Reference

CachingBackendEnhancer Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendEnhancer.SetItemAsyncCore Method

CachingBackendEnhancerSetItemAsyncCore Method

Asynchronously sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API. The default implementation is to call the synchronous SetItemCore(String, CacheItem) method.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override Task SetItemAsyncCore(
    string key,
    CacheItem item,
    CancellationToken cancellationToken
)

Parameters

key
Type: SystemString
The key of the cache item.
item
Type: PostSharp.Patterns.Caching.ImplementationCacheItem
The cache item.
cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task
A Task.
See Also

Reference

CachingBackendEnhancer Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendEnhancer.SetItemCore Method

CachingBackendEnhancerSetItemCore Method

Sets a cache item. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void SetItemCore(
    string key,
    CacheItem item
)

Parameters

key
Type: SystemString
The key of the cache item.
item
Type: PostSharp.Patterns.Caching.ImplementationCacheItem
The cache item.
See Also

Reference

CachingBackendEnhancer Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendEnhancer Events

The CachingBackendEnhancer type exposes the following members.

Events
 | Name | Description
Public event | DependencyInvalidated | Events raised when a dependency is invalidated. Check the Events property to see if the current CachingBackend supports events. (Inherited from CachingBackend.)
Public event | ItemRemoved | Event raised when a cache item is removed from the cache. Check the Events property to see if the current CachingBackend supports events. (Inherited from CachingBackend.)
Top
See Also

Reference

CachingBackendEnhancer Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendEnhancerFeatures Class

An abstract implementation of CachingBackendEnhancerFeatures for use in implementations of CachingBackendEnhancer, where the default behavior is to return the features of the underlying CachingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Caching.ImplementationCachingBackendFeatures
PostSharp.Patterns.Caching.ImplementationCachingBackendEnhancerFeatures

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class CachingBackendEnhancerFeatures : CachingBackendFeatures

The CachingBackendEnhancerFeatures type exposes the following members.

Constructors
 | Name | Description
Protected method | CachingBackendEnhancerFeatures | Initializes a new CachingBackendEnhancerFeatures.
Top
Properties
 | Name | Description
Public property | Blocking | Determines whether methods that modify the cache content run to completion before the control is given back to the calling method. If false, methods may run in the background, and the calling thread may not have a consistent view of the cache. (Overrides CachingBackendFeaturesBlocking.)
Public property | Clear | Determines whether the Clear method is supported. (Overrides CachingBackendFeaturesClear.)
Public property | ContainsDependency | Determines whether the ContainsDependency(String) method is supported. (Overrides CachingBackendFeaturesContainsDependency.)
Public property | Dependencies | Determines whether dependencies are supported. (Overrides CachingBackendFeaturesDependencies.)
Public property | Events | Determines whether the ItemRemoved and DependencyInvalidated events are raised. (Overrides CachingBackendFeaturesEvents.)
Protected property | UnderlyingBackendFeatures | Gets the feature of the underlying CachingBackend.
Top
See Also

Reference

PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendEnhancerFeatures Constructor

Initializes a new CachingBackendEnhancerFeatures.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected CachingBackendEnhancerFeatures(
    CachingBackendFeatures underlyingBackendFeatures
)

Parameters

underlyingBackendFeatures
Type: PostSharp.Patterns.Caching.ImplementationCachingBackendFeatures
The feature of the underlying CachingBackend.
See Also

Reference

CachingBackendEnhancerFeatures Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendEnhancerFeatures Properties

The CachingBackendEnhancerFeatures type exposes the following members.

Properties
 | Name | Description
Public property | Blocking | Determines whether methods that modify the cache content run to completion before the control is given back to the calling method. If false, methods may run in the background, and the calling thread may not have a consistent view of the cache. (Overrides CachingBackendFeaturesBlocking.)
Public property | Clear | Determines whether the Clear method is supported. (Overrides CachingBackendFeaturesClear.)
Public property | ContainsDependency | Determines whether the ContainsDependency(String) method is supported. (Overrides CachingBackendFeaturesContainsDependency.)
Public property | Dependencies | Determines whether dependencies are supported. (Overrides CachingBackendFeaturesDependencies.)
Public property | Events | Determines whether the ItemRemoved and DependencyInvalidated events are raised. (Overrides CachingBackendFeaturesEvents.)
Protected property | UnderlyingBackendFeatures | Gets the feature of the underlying CachingBackend.
Top
See Also

Reference

CachingBackendEnhancerFeatures Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendEnhancerFeatures.Blocking Property

CachingBackendEnhancerFeaturesBlocking Property

Determines whether methods that modify the cache content run to completion before the control is given back to the calling method. If false, methods may run in the background, and the calling thread may not have a consistent view of the cache.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool Blocking { get; }

Property Value

Type: Boolean
See Also

Reference

CachingBackendEnhancerFeatures Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendEnhancerFeatures.Clear Property

CachingBackendEnhancerFeaturesClear Property

Determines whether the Clear method is supported.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool Clear { get; }

Property Value

Type: Boolean
See Also

Reference

CachingBackendEnhancerFeatures Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendEnhancerFeatures.ContainsDependency Property

CachingBackendEnhancerFeaturesContainsDependency Property

Determines whether the ContainsDependency(String) method is supported.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool ContainsDependency { get; }

Property Value

Type: Boolean
See Also

Reference

CachingBackendEnhancerFeatures Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendEnhancerFeatures.Dependencies Property

CachingBackendEnhancerFeaturesDependencies Property

Determines whether dependencies are supported.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool Dependencies { get; }

Property Value

Type: Boolean
See Also

Reference

CachingBackendEnhancerFeatures Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendEnhancerFeatures.Events Property

CachingBackendEnhancerFeaturesEvents Property

Determines whether the ItemRemoved and DependencyInvalidated events are raised.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool Events { get; }

Property Value

Type: Boolean
See Also

Reference

CachingBackendEnhancerFeatures Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendEnhancerFeatures.UnderlyingBackendFeatures Property

CachingBackendEnhancerFeaturesUnderlyingBackendFeatures Property

Gets the feature of the underlying CachingBackend.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected CachingBackendFeatures UnderlyingBackendFeatures { get; }

Property Value

Type: CachingBackendFeatures
See Also

Reference

CachingBackendEnhancerFeatures Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendFeatures Class

List of features that can be implemented or not by a CachingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Caching.ImplementationCachingBackendFeatures
PostSharp.Patterns.Caching.ImplementationCachingBackendEnhancerFeatures

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class CachingBackendFeatures

The CachingBackendFeatures type exposes the following members.

Constructors
 | Name | Description
Public method | CachingBackendFeatures | Initializes a new instance of the CachingBackendFeatures class
Top
Properties
 | Name | Description
Public property | Blocking | Determines whether methods that modify the cache content run to completion before the control is given back to the calling method. If false, methods may run in the background, and the calling thread may not have a consistent view of the cache.
Public property | Clear | Determines whether the Clear method is supported.
Public property | ContainsDependency | Determines whether the ContainsDependency(String) method is supported.
Public property | Dependencies | Determines whether dependencies are supported.
Public property | Events | Determines whether the ItemRemoved and DependencyInvalidated events are raised.
Top
See Also

Reference

PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendFeatures Constructor

Initializes a new instance of the CachingBackendFeatures class

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CachingBackendFeatures()
See Also

Reference

CachingBackendFeatures Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendFeatures Properties

The CachingBackendFeatures type exposes the following members.

Properties
 | Name | Description
Public property | Blocking | Determines whether methods that modify the cache content run to completion before the control is given back to the calling method. If false, methods may run in the background, and the calling thread may not have a consistent view of the cache.
Public property | Clear | Determines whether the Clear method is supported.
Public property | ContainsDependency | Determines whether the ContainsDependency(String) method is supported.
Public property | Dependencies | Determines whether dependencies are supported.
Public property | Events | Determines whether the ItemRemoved and DependencyInvalidated events are raised.
Top
See Also

Reference

CachingBackendFeatures Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendFeatures.Blocking Property

CachingBackendFeaturesBlocking Property

Determines whether methods that modify the cache content run to completion before the control is given back to the calling method. If false, methods may run in the background, and the calling thread may not have a consistent view of the cache.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual bool Blocking { get; }

Property Value

Type: Boolean
See Also

Reference

CachingBackendFeatures Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendFeatures.Clear Property

CachingBackendFeaturesClear Property

Determines whether the Clear method is supported.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual bool Clear { get; }

Property Value

Type: Boolean
See Also

Reference

CachingBackendFeatures Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendFeatures.ContainsDependency Property

CachingBackendFeaturesContainsDependency Property

Determines whether the ContainsDependency(String) method is supported.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual bool ContainsDependency { get; }

Property Value

Type: Boolean
See Also

Reference

CachingBackendFeatures Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendFeatures.Dependencies Property

CachingBackendFeaturesDependencies Property

Determines whether dependencies are supported.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual bool Dependencies { get; }

Property Value

Type: Boolean
See Also

Reference

CachingBackendFeatures Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendFeatures.Events Property

CachingBackendFeaturesEvents Property

Determines whether the ItemRemoved and DependencyInvalidated events are raised.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual bool Events { get; }

Property Value

Type: Boolean
See Also

Reference

CachingBackendFeatures Class
PostSharp.Patterns.Caching.Implementation Namespace


CachingBackendStatus Enumeration

Statuses of a CachingBackend.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum CachingBackendStatus
Members
Member name | Value | Description
Default | 0 | Default.
Disposing | 1 | Being currently disposed.
Disposed | 2 | Already disposed.
DisposeFailed | 3 | A previous call of Dispose failed.
See Also

Reference

PostSharp.Patterns.Caching.Implementation Namespace


ICacheItemConfiguration Interface

Configuration of a cached method. This interface is implemented by several classes that allow to configure cached method.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ICacheItemConfiguration

The ICacheItemConfiguration type exposes the following members.

Properties
 | Name | Description
Public property | AbsoluteExpiration | Gets or sets the total duration during which the result of the cached methods is stored in cache. The absolute expiration time is counted from the moment the method is evaluated and cached.
Public property | AutoReload | Determines whether the method calls are automatically reloaded (by re-evaluating the target method with the same arguments) when the cache item is removed from the cache.
Public property | IgnoreThisParameter | Determines whether the this instance should be a part of the cache key. The default value of this property is false, which means that by default the this instance is a part of the cache key.
Public property | IsEnabled | Determines whether caching is enabled.
Public property | Priority | Gets or sets the priority of the cached methods.
Public property | ProfileName | Gets or sets the name of the CachingProfile that contains the configuration of the cached methods.
Public property | SlidingExpiration | Gets or sets the duration during which the result of the cached methods is stored in cache after it has been added to or accessed from the cache. The expiration is extended every time the value is accessed from the cache.
Top
See Also

Reference

PostSharp.Patterns.Caching.Implementation Namespace


ICacheItemConfiguration Properties

The ICacheItemConfiguration type exposes the following members.

Properties
 | Name | Description
Public property | AbsoluteExpiration | Gets or sets the total duration during which the result of the cached methods is stored in cache. The absolute expiration time is counted from the moment the method is evaluated and cached.
Public property | AutoReload | Determines whether the method calls are automatically reloaded (by re-evaluating the target method with the same arguments) when the cache item is removed from the cache.
Public property | IgnoreThisParameter | Determines whether the this instance should be a part of the cache key. The default value of this property is false, which means that by default the this instance is a part of the cache key.
Public property | IsEnabled | Determines whether caching is enabled.
Public property | Priority | Gets or sets the priority of the cached methods.
Public property | ProfileName | Gets or sets the name of the CachingProfile that contains the configuration of the cached methods.
Public property | SlidingExpiration | Gets or sets the duration during which the result of the cached methods is stored in cache after it has been added to or accessed from the cache. The expiration is extended every time the value is accessed from the cache.
Top
See Also

Reference

ICacheItemConfiguration Interface
PostSharp.Patterns.Caching.Implementation Namespace


ICacheItemConfiguration.AbsoluteExpiration Property

ICacheItemConfigurationAbsoluteExpiration Property

Gets or sets the total duration during which the result of the cached methods is stored in cache. The absolute expiration time is counted from the moment the method is evaluated and cached.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Nullable<TimeSpan> AbsoluteExpiration { get; }

Property Value

Type: Nullable TimeSpan
See Also

Reference

ICacheItemConfiguration Interface
PostSharp.Patterns.Caching.Implementation Namespace


ICacheItemConfiguration.AutoReload Property

ICacheItemConfigurationAutoReload Property

Determines whether the method calls are automatically reloaded (by re-evaluating the target method with the same arguments) when the cache item is removed from the cache.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Nullable<bool> AutoReload { get; }

Property Value

Type: Nullable Boolean
See Also

Reference

ICacheItemConfiguration Interface
PostSharp.Patterns.Caching.Implementation Namespace


ICacheItemConfiguration.IgnoreThisParameter Property

ICacheItemConfigurationIgnoreThisParameter Property

Determines whether the this instance should be a part of the cache key. The default value of this property is false, which means that by default the this instance is a part of the cache key.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Nullable<bool> IgnoreThisParameter { get; }

Property Value

Type: Nullable Boolean
See Also

Reference

ICacheItemConfiguration Interface
PostSharp.Patterns.Caching.Implementation Namespace


ICacheItemConfiguration.IsEnabled Property

ICacheItemConfigurationIsEnabled Property

Determines whether caching is enabled.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Nullable<bool> IsEnabled { get; }

Property Value

Type: Nullable Boolean
See Also

Reference

ICacheItemConfiguration Interface
PostSharp.Patterns.Caching.Implementation Namespace


ICacheItemConfiguration.Priority Property

ICacheItemConfigurationPriority Property

Gets or sets the priority of the cached methods.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Nullable<CacheItemPriority> Priority { get; }

Property Value

Type: Nullable CacheItemPriority
See Also

Reference

ICacheItemConfiguration Interface
PostSharp.Patterns.Caching.Implementation Namespace


ICacheItemConfiguration.ProfileName Property

ICacheItemConfigurationProfileName Property

Gets or sets the name of the CachingProfile that contains the configuration of the cached methods.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
string ProfileName { get; }

Property Value

Type: String
See Also

Reference

ICacheItemConfiguration Interface
PostSharp.Patterns.Caching.Implementation Namespace


ICacheItemConfiguration.SlidingExpiration Property

ICacheItemConfigurationSlidingExpiration Property

Gets or sets the duration during which the result of the cached methods is stored in cache after it has been added to or accessed from the cache. The expiration is extended every time the value is accessed from the cache.

Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Nullable<TimeSpan> SlidingExpiration { get; }

Property Value

Type: Nullable TimeSpan
See Also

Reference

ICacheItemConfiguration Interface
PostSharp.Patterns.Caching.Implementation Namespace


PostSharp.Patterns.Caching.Locking Namespace

Classes
 | Class | Description
Public class | LocalLockManager | An implementation of ILockManager in which every instance of the LocalLockManager has its own set of named locks that are not shared in any way with other instances. The LocalLockManager can be used to synchronize the execution of methods in the current process and AppDomain.
Public class | NullLockManager | An implementation of ILockManager which does not acquire any lock.
Interfaces
 | Interface | Description
Public interface | IAcquireLockTimeoutStrategy | Represents the behavior when the caching aspect cannot acquire a lock because of a timeout.
Public interface | ILockHandle | Allows to acquire and release a named lock returned by GetLock(String).
Public interface | ILockManager | Provides instances of named locks.


IAcquireLockTimeoutStrategy Interface

Represents the behavior when the caching aspect cannot acquire a lock because of a timeout.

Namespace: PostSharp.Patterns.Caching.Locking
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IAcquireLockTimeoutStrategy

The IAcquireLockTimeoutStrategy type exposes the following members.

Methods
 | Name | Description
Public method | OnTimeout | Method invoked when the caching aspect cannot acquire a lock because of a timeout. If this method returns without an exception, the caching aspect will invoke the cached method without acquiring the lock.
Top
See Also

Reference

PostSharp.Patterns.Caching.Locking Namespace

Other Resources

Conceptual: Preventing Concurrent Execution of Cached Methods


IAcquireLockTimeoutStrategy Methods

The IAcquireLockTimeoutStrategy type exposes the following members.

Methods
 | Name | Description
Public method | OnTimeout | Method invoked when the caching aspect cannot acquire a lock because of a timeout. If this method returns without an exception, the caching aspect will invoke the cached method without acquiring the lock.
Top
See Also

Reference

IAcquireLockTimeoutStrategy Interface
PostSharp.Patterns.Caching.Locking Namespace


IAcquireLockTimeoutStrategy.OnTimeout Method

IAcquireLockTimeoutStrategyOnTimeout Method

Method invoked when the caching aspect cannot acquire a lock because of a timeout. If this method returns without an exception, the caching aspect will invoke the cached method without acquiring the lock.

Namespace: PostSharp.Patterns.Caching.Locking
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void OnTimeout(
    string key
)

Parameters

key
Type: SystemString
Cache key (name of the lock).
See Also

Reference

IAcquireLockTimeoutStrategy Interface
PostSharp.Patterns.Caching.Locking Namespace


ILockHandle Interface

Allows to acquire and release a named lock returned by GetLock(String).

Namespace: PostSharp.Patterns.Caching.Locking
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ILockHandle : IDisposable

The ILockHandle type exposes the following members.

Methods
 | Name | Description
Public method | Acquire | Synchronously acquires the lock bound to the current handle.
Public method | AcquireAsync | Asynchronously acquires the lock bound to the current handle.
Public method | Release | Synchronously releases the lock bound to the current handle.
Public method | ReleaseAsync | Asynchronously releases the lock bound to the current handle.
Top
See Also

Reference

PostSharp.Patterns.Caching.Locking Namespace

Other Resources

Conceptual: Preventing Concurrent Execution of Cached Methods


ILockHandle Methods

The ILockHandle type exposes the following members.

Methods
 | Name | Description
Public method | Acquire | Synchronously acquires the lock bound to the current handle.
Public method | AcquireAsync | Asynchronously acquires the lock bound to the current handle.
Public method | Release | Synchronously releases the lock bound to the current handle.
Public method | ReleaseAsync | Asynchronously releases the lock bound to the current handle.
Top
See Also

Reference

ILockHandle Interface
PostSharp.Patterns.Caching.Locking Namespace


ILockHandle.Acquire Method

ILockHandleAcquire Method

Synchronously acquires the lock bound to the current handle.

Namespace: PostSharp.Patterns.Caching.Locking
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
bool Acquire(
    TimeSpan timeout,
    CancellationToken cancellationToken
)

Parameters

timeout
Type: SystemTimeSpan
Timeout.
cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Boolean
true if the lock was acquired, or false if the operation has timed out before the lock could be acquired.
See Also

Reference

ILockHandle Interface
PostSharp.Patterns.Caching.Locking Namespace


ILockHandle.AcquireAsync Method

ILockHandleAcquireAsync Method

Asynchronously acquires the lock bound to the current handle.

Namespace: PostSharp.Patterns.Caching.Locking
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Task<bool> AcquireAsync(
    TimeSpan timeout,
    CancellationToken cancellationToken
)

Parameters

timeout
Type: SystemTimeSpan
Timeout.
cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task Boolean
true if the lock was acquired, or false if the operation has timed out before the lock could be acquired.
See Also

Reference

ILockHandle Interface
PostSharp.Patterns.Caching.Locking Namespace


ILockHandle.Release Method

ILockHandleRelease Method

Synchronously releases the lock bound to the current handle.

Namespace: PostSharp.Patterns.Caching.Locking
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void Release()
See Also

Reference

ILockHandle Interface
PostSharp.Patterns.Caching.Locking Namespace


ILockHandle.ReleaseAsync Method

ILockHandleReleaseAsync Method

Asynchronously releases the lock bound to the current handle.

Namespace: PostSharp.Patterns.Caching.Locking
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Task ReleaseAsync()

Return Value

Type: Task
See Also

Reference

ILockHandle Interface
PostSharp.Patterns.Caching.Locking Namespace


ILockManager Interface

Provides instances of named locks.

Namespace: PostSharp.Patterns.Caching.Locking
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ILockManager

The ILockManager type exposes the following members.

Methods
 | Name | Description
Public method | GetLock | Gets a handle to a named lock. This method must return immediately. Waiting, if any, must be done in the Acquire(TimeSpan, CancellationToken) method.
Top
Remarks
Two implementations are provided: NullLockManager and LocalLockManager. To change the lock manager, set the LockManager property.
See Also

Reference

PostSharp.Patterns.Caching.Locking Namespace

Other Resources

Conceptual: Preventing Concurrent Execution of Cached Methods


ILockManager Methods

The ILockManager type exposes the following members.

Methods
 | Name | Description
Public method | GetLock | Gets a handle to a named lock. This method must return immediately. Waiting, if any, must be done in the Acquire(TimeSpan, CancellationToken) method.
Top
See Also

Reference

ILockManager Interface
PostSharp.Patterns.Caching.Locking Namespace


ILockManager.GetLock Method

ILockManagerGetLock Method

Gets a handle to a named lock. This method must return immediately. Waiting, if any, must be done in the Acquire(TimeSpan, CancellationToken) method.

Namespace: PostSharp.Patterns.Caching.Locking
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
ILockHandle GetLock(
    string key
)

Parameters

key
Type: SystemString
The name of the lock.

Return Value

Type: ILockHandle
A handle to the lock named key.
See Also

Reference

ILockManager Interface
PostSharp.Patterns.Caching.Locking Namespace


LocalLockManager Class

An implementation of ILockManager in which every instance of the LocalLockManager has its own set of named locks that are not shared in any way with other instances. The LocalLockManager can be used to synchronize the execution of methods in the current process and AppDomain.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Caching.LockingLocalLockManager

Namespace: PostSharp.Patterns.Caching.Locking
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class LocalLockManager : ILockManager

The LocalLockManager type exposes the following members.

Constructors
 | Name | Description
Public method | LocalLockManager | Initializes a new instance of the LocalLockManager class
Top
Methods
 | Name | Description
Public method | GetLock | Gets a handle to a named lock. This method must return immediately. Waiting, if any, must be done in the Acquire(TimeSpan, CancellationToken) method.
Top
See Also

Reference

PostSharp.Patterns.Caching.Locking Namespace

Other Resources

Conceptual: Preventing Concurrent Execution of Cached Methods


LocalLockManager Constructor

Initializes a new instance of the LocalLockManager class

Namespace: PostSharp.Patterns.Caching.Locking
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LocalLockManager()
See Also

Reference

LocalLockManager Class
PostSharp.Patterns.Caching.Locking Namespace


LocalLockManager Methods

The LocalLockManager type exposes the following members.

Methods
 | Name | Description
Public method | GetLock | Gets a handle to a named lock. This method must return immediately. Waiting, if any, must be done in the Acquire(TimeSpan, CancellationToken) method.
Top
See Also

Reference

LocalLockManager Class
PostSharp.Patterns.Caching.Locking Namespace


LocalLockManager.GetLock Method

LocalLockManagerGetLock Method

Gets a handle to a named lock. This method must return immediately. Waiting, if any, must be done in the Acquire(TimeSpan, CancellationToken) method.

Namespace: PostSharp.Patterns.Caching.Locking
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ILockHandle GetLock(
    string key
)

Parameters

key
Type: SystemString
The name of the lock.

Return Value

Type: ILockHandle
A handle to the lock named key.

Implements

ILockManagerGetLock(String)
See Also

Reference

LocalLockManager Class
PostSharp.Patterns.Caching.Locking Namespace


NullLockManager Class

An implementation of ILockManager which does not acquire any lock.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Caching.LockingNullLockManager

Namespace: PostSharp.Patterns.Caching.Locking
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class NullLockManager : ILockManager

The NullLockManager type exposes the following members.

Constructors
 | Name | Description
Public method | NullLockManager | Initializes a new instance of the NullLockManager class
Top
Methods
 | Name | Description
Public method | GetLock | Gets a handle to a named lock. This method must return immediately. Waiting, if any, must be done in the Acquire(TimeSpan, CancellationToken) method.
Top
See Also

Reference

PostSharp.Patterns.Caching.Locking Namespace

Other Resources

Conceptual: Preventing Concurrent Execution of Cached Methods


NullLockManager Constructor

Initializes a new instance of the NullLockManager class

Namespace: PostSharp.Patterns.Caching.Locking
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public NullLockManager()
See Also

Reference

NullLockManager Class
PostSharp.Patterns.Caching.Locking Namespace


NullLockManager Methods

The NullLockManager type exposes the following members.

Methods
 | Name | Description
Public method | GetLock | Gets a handle to a named lock. This method must return immediately. Waiting, if any, must be done in the Acquire(TimeSpan, CancellationToken) method.
Top
See Also

Reference

NullLockManager Class
PostSharp.Patterns.Caching.Locking Namespace


NullLockManager.GetLock Method

NullLockManagerGetLock Method

Gets a handle to a named lock. This method must return immediately. Waiting, if any, must be done in the Acquire(TimeSpan, CancellationToken) method.

Namespace: PostSharp.Patterns.Caching.Locking
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ILockHandle GetLock(
    string key
)

Parameters

key
Type: SystemString
The name of the lock.

Return Value

Type: ILockHandle
A handle to the lock named key.

Implements

ILockManagerGetLock(String)
See Also

Reference

NullLockManager Class
PostSharp.Patterns.Caching.Locking Namespace


PostSharp.Patterns.Caching.Serializers Namespace

Classes
 | Class | Description
Public class | BinarySerializer | An implementation of BinaryFormatter that uses BinaryFormatter (for classes annotated with SerializableAttribute).
Public class | DataContractSerializer | An implementation of ISerializer that uses NetDataContractSerializer. You can derive this class to use a different XmlObjectSerializer.
Public class | PortableSerializer | An implementation of ISerializer that uses the PortableFormatter (for classes annotated with PSerializableAttribute).
Interfaces
 | Interface | Description
Public interface | ISerializer | Serializes an object into a byte array and deserializes the byte array back.


BinarySerializer Class

An implementation of BinaryFormatter that uses BinaryFormatter (for classes annotated with SerializableAttribute).
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Caching.SerializersBinarySerializer

Namespace: PostSharp.Patterns.Caching.Serializers
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class BinarySerializer : ISerializer

The BinarySerializer type exposes the following members.

Constructors
 | Name | Description
Public method | BinarySerializer | Initializes a new instance of the BinarySerializer class
Top
Methods
 | Name | Description
Public method | Deserialize | Deserializes a byte array into an object.
Public method | Serialize | Serializes an object into a byte array.
Top
See Also

Reference

PostSharp.Patterns.Caching.Serializers Namespace


BinarySerializer Constructor

Initializes a new instance of the BinarySerializer class

Namespace: PostSharp.Patterns.Caching.Serializers
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public BinarySerializer()
See Also

Reference

BinarySerializer Class
PostSharp.Patterns.Caching.Serializers Namespace


BinarySerializer Methods

The BinarySerializer type exposes the following members.

Methods
 | Name | Description
Public method | Deserialize | Deserializes a byte array into an object.
Public method | Serialize | Serializes an object into a byte array.
Top
See Also

Reference

BinarySerializer Class
PostSharp.Patterns.Caching.Serializers Namespace


BinarySerializer.Deserialize Method

BinarySerializerDeserialize Method

Deserializes a byte array into an object.

Namespace: PostSharp.Patterns.Caching.Serializers
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Object Deserialize(
    byte[] array
)

Parameters

array
Type: SystemByte
A byte array.

Return Value

Type: Object
The object represented by array.

Implements

ISerializerDeserialize(Byte)
See Also

Reference

BinarySerializer Class
PostSharp.Patterns.Caching.Serializers Namespace


BinarySerializer.Serialize Method

BinarySerializerSerialize Method

Serializes an object into a byte array.

Namespace: PostSharp.Patterns.Caching.Serializers
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public byte[] Serialize(
    Object value
)

Parameters

value
Type: SystemObject
The object to serialize.

Return Value

Type: Byte
A byte array representing value.

Implements

ISerializerSerialize(Object)
See Also

Reference

BinarySerializer Class
PostSharp.Patterns.Caching.Serializers Namespace


DataContractSerializer Class

An implementation of ISerializer that uses NetDataContractSerializer. You can derive this class to use a different XmlObjectSerializer.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Caching.SerializersDataContractSerializer

Namespace: PostSharp.Patterns.Caching.Serializers
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class DataContractSerializer : ISerializer

The DataContractSerializer type exposes the following members.

Constructors
 | Name | Description
Public method | DataContractSerializer | Initializes a new DataContractSerializer.
Top
Methods
 | Name | Description
Protected method | CreateSerializer | Creates a new XmlObjectSerializer. The default implementation creates a NetDataContractSerializer.
Public method | Deserialize | Deserializes a byte array into an object.
Public method | Serialize | Serializes an object into a byte array.
Top
See Also

Reference

PostSharp.Patterns.Caching.Serializers Namespace


DataContractSerializer Constructor

Initializes a new DataContractSerializer.

Namespace: PostSharp.Patterns.Caching.Serializers
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public DataContractSerializer()
See Also

Reference

DataContractSerializer Class
PostSharp.Patterns.Caching.Serializers Namespace


DataContractSerializer Methods

The DataContractSerializer type exposes the following members.

Methods
 | Name | Description
Protected method | CreateSerializer | Creates a new XmlObjectSerializer. The default implementation creates a NetDataContractSerializer.
Public method | Deserialize | Deserializes a byte array into an object.
Public method | Serialize | Serializes an object into a byte array.
Top
See Also

Reference

DataContractSerializer Class
PostSharp.Patterns.Caching.Serializers Namespace


DataContractSerializer.CreateSerializer Method

DataContractSerializerCreateSerializer Method

Creates a new XmlObjectSerializer. The default implementation creates a NetDataContractSerializer.

Namespace: PostSharp.Patterns.Caching.Serializers
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual XmlObjectSerializer CreateSerializer()

Return Value

Type: XmlObjectSerializer
A new XmlObjectSerializer.
See Also

Reference

DataContractSerializer Class
PostSharp.Patterns.Caching.Serializers Namespace


DataContractSerializer.Deserialize Method

DataContractSerializerDeserialize Method

Deserializes a byte array into an object.

Namespace: PostSharp.Patterns.Caching.Serializers
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Object Deserialize(
    byte[] array
)

Parameters

array
Type: SystemByte
A byte array.

Return Value

Type: Object
The object represented by array.

Implements

ISerializerDeserialize(Byte)
See Also

Reference

DataContractSerializer Class
PostSharp.Patterns.Caching.Serializers Namespace


DataContractSerializer.Serialize Method

DataContractSerializerSerialize Method

Serializes an object into a byte array.

Namespace: PostSharp.Patterns.Caching.Serializers
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public byte[] Serialize(
    Object value
)

Parameters

value
Type: SystemObject
The object to serialize.

Return Value

Type: Byte
A byte array representing value.

Implements

ISerializerSerialize(Object)
See Also

Reference

DataContractSerializer Class
PostSharp.Patterns.Caching.Serializers Namespace


ISerializer Interface

Serializes an object into a byte array and deserializes the byte array back.

Namespace: PostSharp.Patterns.Caching.Serializers
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ISerializer

The ISerializer type exposes the following members.

Methods
 | Name | Description
Public method | Deserialize | Deserializes a byte array into an object.
Public method | Serialize | Serializes an object into a byte array.
Top
See Also

Reference

PostSharp.Patterns.Caching.Serializers Namespace


ISerializer Methods

The ISerializer type exposes the following members.

Methods
 | Name | Description
Public method | Deserialize | Deserializes a byte array into an object.
Public method | Serialize | Serializes an object into a byte array.
Top
See Also

Reference

ISerializer Interface
PostSharp.Patterns.Caching.Serializers Namespace


ISerializer.Deserialize Method

ISerializerDeserialize Method

Deserializes a byte array into an object.

Namespace: PostSharp.Patterns.Caching.Serializers
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Object Deserialize(
    byte[] array
)

Parameters

array
Type: SystemByte
A byte array.

Return Value

Type: Object
The object represented by array.
See Also

Reference

ISerializer Interface
PostSharp.Patterns.Caching.Serializers Namespace


ISerializer.Serialize Method

ISerializerSerialize Method

Serializes an object into a byte array.

Namespace: PostSharp.Patterns.Caching.Serializers
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
byte[] Serialize(
    Object value
)

Parameters

value
Type: SystemObject
The object to serialize.

Return Value

Type: Byte
A byte array representing value.
See Also

Reference

ISerializer Interface
PostSharp.Patterns.Caching.Serializers Namespace


PortableSerializer Class

An implementation of ISerializer that uses the PortableFormatter (for classes annotated with PSerializableAttribute).
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Caching.SerializersPortableSerializer

Namespace: PostSharp.Patterns.Caching.Serializers
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class PortableSerializer : ISerializer

The PortableSerializer type exposes the following members.

Constructors
 | Name | Description
Public method | PortableSerializer | Initializes a new PortableSerializer with a new default PortableFormatter.
Public method | PortableSerializer(PortableFormatter) | Initializes a new PortableSerializer with a given PortableFormatter.
Top
Methods
 | Name | Description
Public method | Deserialize | Deserializes a byte array into an object.
Public method | Serialize | Serializes an object into a byte array.
Top
See Also

Reference

PostSharp.Patterns.Caching.Serializers Namespace


PortableSerializer Constructor

Overload List
 | Name | Description
Public method | PortableSerializer | Initializes a new PortableSerializer with a new default PortableFormatter.
Public method | PortableSerializer(PortableFormatter) | Initializes a new PortableSerializer with a given PortableFormatter.
Top
See Also

Reference

PortableSerializer Class
PostSharp.Patterns.Caching.Serializers Namespace


PortableSerializer Constructor

Initializes a new PortableSerializer with a new default PortableFormatter.

Namespace: PostSharp.Patterns.Caching.Serializers
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public PortableSerializer()
See Also

Reference

PortableSerializer Class
PortableSerializer Overload
PostSharp.Patterns.Caching.Serializers Namespace


PortableSerializer Constructor (PortableFormatter)

Initializes a new PortableSerializer with a given PortableFormatter.

Namespace: PostSharp.Patterns.Caching.Serializers
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public PortableSerializer(
    PortableFormatter serializer
)

Parameters

serializer
Type: PostSharp.SerializationPortableFormatter
A PortableFormatter, or null to use a new default PortableFormatter.
See Also

Reference

PortableSerializer Class
PortableSerializer Overload
PostSharp.Patterns.Caching.Serializers Namespace


PortableSerializer Methods

The PortableSerializer type exposes the following members.

Methods
 | Name | Description
Public method | Deserialize | Deserializes a byte array into an object.
Public method | Serialize | Serializes an object into a byte array.
Top
See Also

Reference

PortableSerializer Class
PostSharp.Patterns.Caching.Serializers Namespace


PortableSerializer.Deserialize Method

PortableSerializerDeserialize Method

Deserializes a byte array into an object.

Namespace: PostSharp.Patterns.Caching.Serializers
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Object Deserialize(
    byte[] array
)

Parameters

array
Type: SystemByte
A byte array.

Return Value

Type: Object
The object represented by array.

Implements

ISerializerDeserialize(Byte)
See Also

Reference

PortableSerializer Class
PostSharp.Patterns.Caching.Serializers Namespace


PortableSerializer.Serialize Method

PortableSerializerSerialize Method

Serializes an object into a byte array.

Namespace: PostSharp.Patterns.Caching.Serializers
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public byte[] Serialize(
    Object value
)

Parameters

value
Type: SystemObject
The object to serialize.

Return Value

Type: Byte
A byte array representing value.

Implements

ISerializerSerialize(Object)
See Also

Reference

PortableSerializer Class
PostSharp.Patterns.Caching.Serializers Namespace


PostSharp.Patterns.Caching.ValueAdapters Namespace

Classes
 | Class | Description
Public class | ValueAdapterT | An abstract implementation of IValueAdapterT.
Public class | ValueAdapterFactory | Registers and provides value adapters (IValueAdapter), which allow for instance to cache things like Stream or IEnumerable, which could not be otherwise cached.
Interfaces
 | Interface | Description
Public interface | IValueAdapter | Wraps uncachable classes or interfaces into cacheable objects, for instance an IEnumerable may be wrapped into an array.
Public interface | IValueAdapterT | A strongly-typed version of IValueAdapter.


IValueAdapter Interface

Wraps uncachable classes or interfaces into cacheable objects, for instance an IEnumerable may be wrapped into an array.

Namespace: PostSharp.Patterns.Caching.ValueAdapters
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IValueAdapter

The IValueAdapter type exposes the following members.

Properties
 | Name | Description
Public property | IsAsyncSupported | Determines whether the GetStoredValueAsync(Object, CancellationToken) method is supported.
Top
Methods
 | Name | Description
Public method | GetExposedValue | Gets the value that should be exposed to the consuming application, i.e. typically the return value of the cached method.
Public method | GetStoredValue | Gets the value that should be stored in the cache.
Public method | GetStoredValueAsync | Asynchronously gets the value that should be stored in the cache.
Top
See Also

Reference

PostSharp.Patterns.Caching.ValueAdapters Namespace

Other Resources

Conceptual: Caching Special Types with Value Adapters


IValueAdapter Properties

The IValueAdapter type exposes the following members.

Properties
 | Name | Description
Public property | IsAsyncSupported | Determines whether the GetStoredValueAsync(Object, CancellationToken) method is supported.
Top
See Also

Reference

IValueAdapter Interface
PostSharp.Patterns.Caching.ValueAdapters Namespace


IValueAdapter.IsAsyncSupported Property

IValueAdapterIsAsyncSupported Property

Determines whether the GetStoredValueAsync(Object, CancellationToken) method is supported.

Namespace: PostSharp.Patterns.Caching.ValueAdapters
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
bool IsAsyncSupported { get; }

Property Value

Type: Boolean
See Also

Reference

IValueAdapter Interface
PostSharp.Patterns.Caching.ValueAdapters Namespace


IValueAdapter Methods

The IValueAdapter type exposes the following members.

Methods
 | Name | Description
Public method | GetExposedValue | Gets the value that should be exposed to the consuming application, i.e. typically the return value of the cached method.
Public method | GetStoredValue | Gets the value that should be stored in the cache.
Public method | GetStoredValueAsync | Asynchronously gets the value that should be stored in the cache.
Top
See Also

Reference

IValueAdapter Interface
PostSharp.Patterns.Caching.ValueAdapters Namespace


IValueAdapter.GetExposedValue Method

IValueAdapterGetExposedValue Method

Gets the value that should be exposed to the consuming application, i.e. typically the return value of the cached method.

Namespace: PostSharp.Patterns.Caching.ValueAdapters
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Object GetExposedValue(
    Object storedValue
)

Parameters

storedValue
Type: SystemObject
The value that was stored in the cache.

Return Value

Type: Object
The value that should be exposed to the consuming application, i.e. typically the return value of the cached method.
See Also

Reference

IValueAdapter Interface
PostSharp.Patterns.Caching.ValueAdapters Namespace


IValueAdapter.GetStoredValue Method

IValueAdapterGetStoredValue Method

Gets the value that should be stored in the cache.

Namespace: PostSharp.Patterns.Caching.ValueAdapters
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Object GetStoredValue(
    Object value
)

Parameters

value
Type: SystemObject
The apparent value (typically the return value of the cached method).

Return Value

Type: Object
A cacheable object.
See Also

Reference

IValueAdapter Interface
PostSharp.Patterns.Caching.ValueAdapters Namespace


IValueAdapter.GetStoredValueAsync Method

IValueAdapterGetStoredValueAsync Method

Asynchronously gets the value that should be stored in the cache.

Namespace: PostSharp.Patterns.Caching.ValueAdapters
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Task<Object> GetStoredValueAsync(
    Object value,
    CancellationToken cancellationToken
)

Parameters

value
Type: SystemObject
The apparent value (typically the return value of the cached method).
cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task Object
A Task returning a cacheable object.
See Also

Reference

IValueAdapter Interface
PostSharp.Patterns.Caching.ValueAdapters Namespace


IValueAdapter(T) Interface

IValueAdapterT Interface

A strongly-typed version of IValueAdapter.

Namespace: PostSharp.Patterns.Caching.ValueAdapters
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IValueAdapter<T> : IValueAdapter

Type Parameters

T
Type of the exposed value, i.e. typically return type of the cached method.

The IValueAdapterT type exposes the following members.

Properties
 | Name | Description
Public property | IsAsyncSupported | Determines whether the GetStoredValueAsync(Object, CancellationToken) method is supported. (Inherited from IValueAdapter.)
Top
Methods
 | Name | Description
Public method | GetExposedValue | Gets the value that should be exposed to the consuming application, i.e. typically the return value of the cached method.
Public method | GetStoredValue(Object) | Gets the value that should be stored in the cache. (Inherited from IValueAdapter.)
Public method | GetStoredValue(T) | Gets the value that should be stored in the cache.
Public method | GetStoredValueAsync(Object, CancellationToken) | Asynchronously gets the value that should be stored in the cache. (Inherited from IValueAdapter.)
Public method | GetStoredValueAsync(T, CancellationToken) | Asynchronously gets the value that should be stored in the cache.
Top
See Also

Reference

PostSharp.Patterns.Caching.ValueAdapters Namespace

Other Resources

Conceptual: Caching Special Types with Value Adapters


IValueAdapter(T) Properties

IValueAdapterT Properties

The IValueAdapterT generic type exposes the following members.

Properties
 | Name | Description
Public property | IsAsyncSupported | Determines whether the GetStoredValueAsync(Object, CancellationToken) method is supported. (Inherited from IValueAdapter.)
Top
See Also

Reference

IValueAdapterT Interface
PostSharp.Patterns.Caching.ValueAdapters Namespace


IValueAdapter(T) Methods

IValueAdapterT Methods

The IValueAdapterT generic type exposes the following members.

Methods
 | Name | Description
Public method | GetExposedValue | Gets the value that should be exposed to the consuming application, i.e. typically the return value of the cached method.
Public method | GetStoredValue(Object) | Gets the value that should be stored in the cache. (Inherited from IValueAdapter.)
Public method | GetStoredValue(T) | Gets the value that should be stored in the cache.
Public method | GetStoredValueAsync(Object, CancellationToken) | Asynchronously gets the value that should be stored in the cache. (Inherited from IValueAdapter.)
Public method | GetStoredValueAsync(T, CancellationToken) | Asynchronously gets the value that should be stored in the cache.
Top
See Also

Reference

IValueAdapterT Interface
PostSharp.Patterns.Caching.ValueAdapters Namespace


IValueAdapter(T).GetExposedValue Method

IValueAdapterTGetExposedValue Method

Gets the value that should be exposed to the consuming application, i.e. typically the return value of the cached method.

Namespace: PostSharp.Patterns.Caching.ValueAdapters
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
T GetExposedValue(
    Object storedValue
)

Parameters

storedValue
Type: SystemObject
The value that was stored in the cache.

Return Value

Type: T
The value that should be exposed to the consuming application, i.e. typically the return value of the cached method.
See Also

Reference

IValueAdapterT Interface
PostSharp.Patterns.Caching.ValueAdapters Namespace


IValueAdapter(T).GetStoredValue Method

IValueAdapterTGetStoredValue Method

Overload List
 | Name | Description
Public method | GetStoredValue(Object) | Gets the value that should be stored in the cache. (Inherited from IValueAdapter.)
Public method | GetStoredValue(T) | Gets the value that should be stored in the cache.
Top
See Also

Reference

IValueAdapterT Interface
PostSharp.Patterns.Caching.ValueAdapters Namespace


IValueAdapter(T).GetStoredValue Method (T)

IValueAdapterTGetStoredValue Method (T)

Gets the value that should be stored in the cache.

Namespace: PostSharp.Patterns.Caching.ValueAdapters
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Object GetStoredValue(
    T value
)

Parameters

value
Type: T
The apparent value (typically the return value of the cached method).

Return Value

Type: Object
A cacheable object.
See Also

Reference

IValueAdapterT Interface
GetStoredValue Overload
PostSharp.Patterns.Caching.ValueAdapters Namespace


IValueAdapter(T).GetStoredValueAsync Method

IValueAdapterTGetStoredValueAsync Method

Overload List
 | Name | Description
Public method | GetStoredValueAsync(Object, CancellationToken) | Asynchronously gets the value that should be stored in the cache. (Inherited from IValueAdapter.)
Public method | GetStoredValueAsync(T, CancellationToken) | Asynchronously gets the value that should be stored in the cache.
Top
See Also

Reference

IValueAdapterT Interface
PostSharp.Patterns.Caching.ValueAdapters Namespace


IValueAdapter(T).GetStoredValueAsync Method (T, CancellationToken)

IValueAdapterTGetStoredValueAsync Method (T, CancellationToken)

Asynchronously gets the value that should be stored in the cache.

Namespace: PostSharp.Patterns.Caching.ValueAdapters
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Task<Object> GetStoredValueAsync(
    T value,
    CancellationToken cancellationToken
)

Parameters

value
Type: T
The apparent value (typically the return value of the cached method).
cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task Object
A Task returning a cacheable object.
See Also

Reference

IValueAdapterT Interface
GetStoredValueAsync Overload
PostSharp.Patterns.Caching.ValueAdapters Namespace


ValueAdapter(T) Class

ValueAdapterT Class

An abstract implementation of IValueAdapterT.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Caching.ValueAdaptersValueAdapterT

Namespace: PostSharp.Patterns.Caching.ValueAdapters
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class ValueAdapter<T> : IValueAdapter<T>,
    IValueAdapter

Type Parameters

T
Type of the exposed value, i.e. typically return type of the cached method.

The ValueAdapterT type exposes the following members.

Constructors
 | Name | Description
Protected method | ValueAdapterT | Initializes a new instance of the ValueAdapterT class
Top
Properties
 | Name | Description
Public property | IsAsyncSupported | Determines whether the GetStoredValueAsync(Object, CancellationToken) method is supported.
Top
Methods
 | Name | Description
Public method | GetExposedValue | Gets the value that should be exposed to the consuming application, i.e. typically the return value of the cached method.
Public method | GetStoredValue | Gets the value that should be stored in the cache.
Public method | GetStoredValueAsync | Asynchronously gets the value that should be stored in the cache.
Top
See Also

Reference

PostSharp.Patterns.Caching.ValueAdapters Namespace


ValueAdapter(T) Constructor

ValueAdapterT Constructor

Initializes a new instance of the ValueAdapterT class

Namespace: PostSharp.Patterns.Caching.ValueAdapters
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected ValueAdapter()
See Also

Reference

ValueAdapterT Class
PostSharp.Patterns.Caching.ValueAdapters Namespace


ValueAdapter(T) Properties

ValueAdapterT Properties

The ValueAdapterT generic type exposes the following members.

Properties
 | Name | Description
Public property | IsAsyncSupported | Determines whether the GetStoredValueAsync(Object, CancellationToken) method is supported.
Top
See Also

Reference

ValueAdapterT Class
PostSharp.Patterns.Caching.ValueAdapters Namespace


ValueAdapter(T).IsAsyncSupported Property

ValueAdapterTIsAsyncSupported Property

Determines whether the GetStoredValueAsync(Object, CancellationToken) method is supported.

Namespace: PostSharp.Patterns.Caching.ValueAdapters
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual bool IsAsyncSupported { get; }

Property Value

Type: Boolean

Implements

IValueAdapterIsAsyncSupported
See Also

Reference

ValueAdapterT Class
PostSharp.Patterns.Caching.ValueAdapters Namespace


ValueAdapter(T) Methods

ValueAdapterT Methods

The ValueAdapterT generic type exposes the following members.

Methods
 | Name | Description
Public method | GetExposedValue | Gets the value that should be exposed to the consuming application, i.e. typically the return value of the cached method.
Public method | GetStoredValue | Gets the value that should be stored in the cache.
Public method | GetStoredValueAsync | Asynchronously gets the value that should be stored in the cache.
Top
See Also

Reference

ValueAdapterT Class
PostSharp.Patterns.Caching.ValueAdapters Namespace


ValueAdapter(T).GetExposedValue Method

ValueAdapterTGetExposedValue Method

Gets the value that should be exposed to the consuming application, i.e. typically the return value of the cached method.

Namespace: PostSharp.Patterns.Caching.ValueAdapters
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract T GetExposedValue(
    Object storedValue
)

Parameters

storedValue
Type: SystemObject
The value that was stored in the cache.

Return Value

Type: T
The value that should be exposed to the consuming application, i.e. typically the return value of the cached method.

Implements

IValueAdapterTGetExposedValue(Object)
See Also

Reference

ValueAdapterT Class
PostSharp.Patterns.Caching.ValueAdapters Namespace


ValueAdapter(T).GetStoredValue Method

ValueAdapterTGetStoredValue Method

Gets the value that should be stored in the cache.

Namespace: PostSharp.Patterns.Caching.ValueAdapters
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract Object GetStoredValue(
    T value
)

Parameters

value
Type: T
The apparent value (typically the return value of the cached method).

Return Value

Type: Object
A cacheable object.

Implements

IValueAdapterTGetStoredValue(T)
See Also

Reference

ValueAdapterT Class
PostSharp.Patterns.Caching.ValueAdapters Namespace


ValueAdapter(T).GetStoredValueAsync Method

ValueAdapterTGetStoredValueAsync Method

Asynchronously gets the value that should be stored in the cache.

Namespace: PostSharp.Patterns.Caching.ValueAdapters
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual Task<Object> GetStoredValueAsync(
    T value,
    CancellationToken cancellationToken
)

Parameters

value
Type: T
The apparent value (typically the return value of the cached method).
cancellationToken
Type: System.ThreadingCancellationToken
A CancellationToken.

Return Value

Type: Task Object
A Task returning a cacheable object.

Implements

IValueAdapterTGetStoredValueAsync(T, CancellationToken)
See Also

Reference

ValueAdapterT Class
PostSharp.Patterns.Caching.ValueAdapters Namespace


ValueAdapterFactory Class

Registers and provides value adapters (IValueAdapter), which allow for instance to cache things like Stream or IEnumerable, which could not be otherwise cached.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Caching.ValueAdaptersValueAdapterFactory

Namespace: PostSharp.Patterns.Caching.ValueAdapters
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ValueAdapterFactory

The ValueAdapterFactory type exposes the following members.

Methods
 | Name | Description
Public method | Get | Gets an IValueAdapter given a value type.
Public method | Register(Type, IValueAdapter) | Registers an IValueAdapter instance and explicitly expecifies the value type.
Public method | Register(Type, Type) | Registers a generic value adapter.
Public method | RegisterT(IValueAdapterT) | Registers an IValueAdapterT.
Top
See Also

Reference

PostSharp.Patterns.Caching.ValueAdapters Namespace

Other Resources

Conceptual: Caching Special Types with Value Adapters


ValueAdapterFactory Methods

The ValueAdapterFactory type exposes the following members.

Methods
 | Name | Description
Public method | Get | Gets an IValueAdapter given a value type.
Public method | Register(Type, IValueAdapter) | Registers an IValueAdapter instance and explicitly expecifies the value type.
Public method | Register(Type, Type) | Registers a generic value adapter.
Public method | RegisterT(IValueAdapterT) | Registers an IValueAdapterT.
Top
See Also

Reference

ValueAdapterFactory Class
PostSharp.Patterns.Caching.ValueAdapters Namespace


ValueAdapterFactory.Get Method

ValueAdapterFactoryGet Method

Gets an IValueAdapter given a value type.

Namespace: PostSharp.Patterns.Caching.ValueAdapters
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IValueAdapter Get(
    Type valueType
)

Parameters

valueType
Type: SystemType
The type of the cached value (typically the return type of the cached method).

Return Value

Type: IValueAdapter
A value adapter for valueType, or null if no value adapter is available for valueType.
See Also

Reference

ValueAdapterFactory Class
PostSharp.Patterns.Caching.ValueAdapters Namespace


ValueAdapterFactory.Register Method

ValueAdapterFactoryRegister Method

Overload List
 | Name | Description
Public method | RegisterT(IValueAdapterT) | Registers an IValueAdapterT.
Public method | Register(Type, IValueAdapter) | Registers an IValueAdapter instance and explicitly expecifies the value type.
Public method | Register(Type, Type) | Registers a generic value adapter.
Top
See Also

Reference

ValueAdapterFactory Class
PostSharp.Patterns.Caching.ValueAdapters Namespace


ValueAdapterFactory.Register(T) Method (IValueAdapter(T))

ValueAdapterFactoryRegisterT Method (IValueAdapterT)

Registers an IValueAdapterT.

Namespace: PostSharp.Patterns.Caching.ValueAdapters
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Register<T>(
    IValueAdapter<T> valueAdapter
)

Parameters

valueAdapter
Type: PostSharp.Patterns.Caching.ValueAdaptersIValueAdapter T
The adapter.

Type Parameters

T
The type of the cached value (typically the return type of the cached method).
See Also

Reference

ValueAdapterFactory Class
Register Overload
PostSharp.Patterns.Caching.ValueAdapters Namespace


ValueAdapterFactory.Register Method (Type, IValueAdapter)

ValueAdapterFactoryRegister Method (Type, IValueAdapter)

Registers an IValueAdapter instance and explicitly expecifies the value type.

Namespace: PostSharp.Patterns.Caching.ValueAdapters
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Register(
    Type valueType,
    IValueAdapter valueAdapter
)

Parameters

valueType
Type: SystemType
The type of the cached value (typically the return type of the cached method).
valueAdapter
Type: PostSharp.Patterns.Caching.ValueAdaptersIValueAdapter
The adapter.
See Also

Reference

ValueAdapterFactory Class
Register Overload
PostSharp.Patterns.Caching.ValueAdapters Namespace

Other Resources

Conceptual: Caching Special Types with Value Adapters


ValueAdapterFactory.Register Method (Type, Type)

ValueAdapterFactoryRegister Method (Type, Type)

Registers a generic value adapter.

Namespace: PostSharp.Patterns.Caching.ValueAdapters
Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Register(
    Type valueType,
    Type valueAdapterType
)

Parameters

valueType
Type: SystemType
The type of the cached value (typically the return type of the cached method).
valueAdapterType
Type: SystemType
The type of the value adapter. This type must implement the IValueAdapter interface and have the same number of generic parameters as valueType.
See Also

Reference

ValueAdapterFactory Class
Register Overload
PostSharp.Patterns.Caching.ValueAdapters Namespace


PostSharp.Patterns.Collections Namespace

The PostSharp.Patterns.Collections namespace defines collection classes that work with the Aggregatable pattern.
Classes
 | Class | Description
Public class | AdvisableCollectionT | A collection type similar to CollectionT into which advices can be injected dynamically.
Public class | AdvisableDictionaryTKey, TValue | An implementation of a DictionaryTKey, TValue into which advices can be injected dynamically. The class also allows derived classes to add new behaviors by overriding methods, like the CollectionT class does.
Public class | AdvisableDictionaryTKey, TValueKeyCollection | Represents the collection of keys in an AdvisableDictionaryTKey, TValue.
Public class | AdvisableDictionaryTKey, TValueValueCollection | Represents the collection of values in an AdvisableDictionaryTKey, TValue.
Public class | AdvisableHashSetT | A collection type similar to HashSetT into which advices can be injected dynamically.
Public class | AdvisableKeyedCollectionTKey, TItem | Provides the abstract base class for a keyed collection, similar to KeyedCollectionTKey, TItem, into which advices can be injected dynamically.
Public class | Extensions | Adds extension methods to the IEnumerableT and IDictionaryTKey, TValue interfaces.
Structures
 | Structure | Description
Public structure | AdvisableCollectionTEnumerator | Enumerates the elements of an AdvisableCollectionT.
Public structure | AdvisableDictionaryTKey, TValueEnumerator | Enumerates the elements of an AdvisableDictionaryTKey, TValue.
Public structure | AdvisableDictionaryTKey, TValueKeyCollectionEnumerator | Enumerates the elements of a AdvisableDictionaryTKey, TValueKeyCollection.
Public structure | AdvisableDictionaryTKey, TValueValueCollectionEnumerator | Enumerates the elements of a AdvisableDictionaryTKey, TValueValueCollection.
Public structure | AdvisableHashSetTEnumerator | Enumerator for the AdvisableHashSetT class.
Public structure | ReadOnlyArrayT | Read-only array wrapper.


AdvisableCollection(T) Class

AdvisableCollectionT Class

A collection type similar to CollectionT into which advices can be injected dynamically.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DynamicAdvisingDynamicallyAdvisableObject
PostSharp.Patterns.CollectionsAdvisableCollectionT
PostSharp.Patterns.CollectionsAdvisableKeyedCollectionTKey, TItem

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public class AdvisableCollection<T> : DynamicallyAdvisableObject,
    IList<T>, ICollection<T>, IEnumerable<T>, IEnumerable, IList,
    ICollection, IDynamicallyAdvisableCollection, IDynamicallyAdvisable, IQueryInterface, INotifyPropertyChanged,
    INotifyCollectionChanged

Type Parameters

T
The type of elements in the collection

The AdvisableCollectionT type exposes the following members.

Properties
 | Name | Description
Public property | Count | Gets the number of elements contained in the ICollectionT.
Public property | IsReadOnly | Gets a value indicating whether the ICollectionT is read-only.
Public property | Item | Gets or sets the element at the specified index.
Top
Methods
 | Name | Description
Public method | Add | Adds an item to the ICollectionT.
Public method | AddRange | Adds the elements of the specified collection to the end of the AdvisableCollectionT.
Public method | Clear | Removes all items from the ICollectionT.
Protected method | ClearItems | Removes all elements from the underlying collection.
Public method | Contains | Determines whether the ICollectionT contains a specific value.
Public method | CopyTo | Copies the elements of the ICollectionT to an Array, starting at a particular Array index.
Protected method | ExecuteWithAdvicesTResult, TAction | Executes an action wrapped by all custom advices added to the current object. (Inherited from DynamicallyAdvisableObject.)
Protected method | GetAdviceEnumerator | Gets an AdviceEnumeratorT for the ICollectionDynamicAdviceT interface.
Protected method | GetCount | Gets the number of elements in the underlying collection.
Public method | GetEnumerator | Returns an enumerator that iterates through the AdvisableCollectionT.
Protected method | GetItem | Gets the element at the specified index of the underlying collection.
Public method | GetObjectData | Populates a SerializationInfo with the data needed to serialize the target object. (Overrides DynamicallyAdvisableObjectGetObjectData(SerializationInfo, StreamingContext).)
Public method | GetRange | Creates a shallow copy of a range of elements in the source AdvisableCollectionT.
Public method | IndexOf | Determines the index of a specific item in the IListT.
Protected method | IndexOfItem | Searches for the specified object and returns the zero-based index of the first occurrence within the entire underlying collection.
Protected method | InitializeAdvices | Initializes the list of dynamic advices. (Inherited from DynamicallyAdvisableObject.)
Public method | Insert | Inserts an item to the IListT at the specified index.
Protected method | InsertItem | Inserts an element into the underlying collection at the specified index.
Protected method | InsertItems | Inserts elements into the underlying collection at the specified index.
Public method | InsertRange | Inserts the elements of a collection into the AdvisableCollectionT at the specified index.
Public method | Move | Moved the element at the specified index to another index.
Protected method | MoveItem | Moves the element at the specified index to another index in the underlying collection.
Public method | OnDeserialization | Runs when the entire object graph has been deserialized. (Overrides DynamicallyAdvisableObjectOnDeserialization(Object).)
Protected method | RaiseEvents | Raised the events that have been buffered.
Public method | Remove | Removes the first occurrence of a specific object from the ICollectionT.
Public method | RemoveAt | Removes the IListT item at the specified index.
Protected method | RemoveItem | Removes the element at the specified index of the underlying collection.
Protected method | RemoveItems | Removes the specified number of elements starting at the specified index of the underlying collection.
Public method | RemoveRange | Removes a range of elements from the AdvisableCollectionT.
Protected method | SetItem | Replaces the element at the specified index of the underlying collection.
Public method | ToArray | Creates an array from the current AdvisableCollectionT.
Top
Events
 | Name | Description
Public event | CollectionChanged | Occurs when the collection changes.
Public event | PropertyChanged | Event raised when the value of a property of the current object changes.
Top
Extension Methods
 | Name | Description
Public Extension Method | ToAdvisableCollectionT | Converts an IEnumerableT into an AdvisableCollectionT. (Defined by Extensions.)
Public Extension Method | ToAdvisableDictionaryT, TKey, TValue | Converts an IEnumerableT into a AdvisableDictionaryTKey, TValue given a method returning the item key and a method returning the item value. (Defined by Extensions.)
Public Extension Method | ToAdvisableHashSetT | Converts an IEnumerableT into an AdvisableHashSetT. (Defined by Extensions.)
Top
Remarks

The API of this class is compatible with the CollectionT class. It provides some additions but preserves the same design and naming conventions.

Classes that derive from AdvisableCollectionT can add functionalities by overriding protected methods or by defining new public methods. New public methods wrap their logic in a call of the ExecuteWithAdvicesTResult, TAction(ObjectAccessLevel, TAction) method, which applies boundary aspects. Public methods can access the data structure thanks to protected methods, which have a name ending in Item, for instance SetItem(Int32, T). Public methods should not use other public methods of the class, as it may cause inconsistent invocation of advises and performance issues. Events (PropertyChanged and CollectionChanged( are buffered. Public methods must invoke RaiseEvents to raise buffered events.

See Also

Reference

PostSharp.Patterns.Collections Namespace

Other Resources

Conceptual: Annotating an Object Model for Parent/Child Relationships (Aggregatable)
Conceptual: Enumerating Child Objects (Visitor)
Conceptual: Freezable Threading Model
Conceptual: Immutable Threading Model
Conceptual: What's New in PostSharp 4.2
Conceptual: Working With Child Collections


AdvisableCollection(T) Properties

AdvisableCollectionT Properties

The AdvisableCollectionT generic type exposes the following members.

Properties
 | Name | Description
Public property | Count | Gets the number of elements contained in the ICollectionT.
Public property | IsReadOnly | Gets a value indicating whether the ICollectionT is read-only.
Public property | Item | Gets or sets the element at the specified index.
Top
See Also

Reference

AdvisableCollectionT Class
PostSharp.Patterns.Collections Namespace


AdvisableCollection(T).Count Property

AdvisableCollectionTCount Property

Gets the number of elements contained in the ICollectionT.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int Count { get; }

Return Value

Type: Int32
The number of elements contained in the ICollectionT.

Implements

ICollectionTCount
ICollectionCount
See Also

Reference

AdvisableCollectionT Class
PostSharp.Patterns.Collections Namespace


AdvisableCollection(T).IsReadOnly Property

AdvisableCollectionTIsReadOnly Property

Gets a value indicating whether the ICollectionT is read-only.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsReadOnly { get; }

Return Value

Type: Boolean
true if the ICollectionT is read-only; otherwise, false.

Implements

ICollectionTIsReadOnly
IListIsReadOnly
See Also

Reference

AdvisableCollectionT Class
PostSharp.Patterns.Collections Namespace


AdvisableCollection(T).Item Property

AdvisableCollectionTItem Property

Gets or sets the element at the specified index.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public T this[
    int index
] { get; set; }

Parameters

index
Type: SystemInt32
The zero-based index of the element to get or set.

Return Value

Type: T
The element at the specified index.

Implements

IListTItemInt32
Exceptions
Exception | Condition
ArgumentOutOfRangeException | index is not a valid index in the IListT.
NotSupportedException | The property is set and the IListT is read-only.
See Also

Reference

AdvisableCollectionT Class
PostSharp.Patterns.Collections Namespace


AdvisableCollection(T) Methods

AdvisableCollectionT Methods

The AdvisableCollectionT generic type exposes the following members.

Methods
 | Name | Description
Public method | Add | Adds an item to the ICollectionT.
Public method | AddRange | Adds the elements of the specified collection to the end of the AdvisableCollectionT.
Public method | Clear | Removes all items from the ICollectionT.
Protected method | ClearItems | Removes all elements from the underlying collection.
Public method | Contains | Determines whether the ICollectionT contains a specific value.
Public method | CopyTo | Copies the elements of the ICollectionT to an Array, starting at a particular Array index.
Protected method | ExecuteWithAdvicesTResult, TAction | Executes an action wrapped by all custom advices added to the current object. (Inherited from DynamicallyAdvisableObject.)
Protected method | GetAdviceEnumerator | Gets an AdviceEnumeratorT for the ICollectionDynamicAdviceT interface.
Protected method | GetCount | Gets the number of elements in the underlying collection.
Public method | GetEnumerator | Returns an enumerator that iterates through the AdvisableCollectionT.
Protected method | GetItem | Gets the element at the specified index of the underlying collection.
Public method | GetObjectData | Populates a SerializationInfo with the data needed to serialize the target object. (Overrides DynamicallyAdvisableObjectGetObjectData(SerializationInfo, StreamingContext).)
Public method | GetRange | Creates a shallow copy of a range of elements in the source AdvisableCollectionT.
Public method | IndexOf | Determines the index of a specific item in the IListT.
Protected method | IndexOfItem | Searches for the specified object and returns the zero-based index of the first occurrence within the entire underlying collection.
Protected method | InitializeAdvices | Initializes the list of dynamic advices. (Inherited from DynamicallyAdvisableObject.)
Public method | Insert | Inserts an item to the IListT at the specified index.
Protected method | InsertItem | Inserts an element into the underlying collection at the specified index.
Protected method | InsertItems | Inserts elements into the underlying collection at the specified index.
Public method | InsertRange | Inserts the elements of a collection into the AdvisableCollectionT at the specified index.
Public method | Move | Moved the element at the specified index to another index.
Protected method | MoveItem | Moves the element at the specified index to another index in the underlying collection.
Public method | OnDeserialization | Runs when the entire object graph has been deserialized. (Overrides DynamicallyAdvisableObjectOnDeserialization(Object).)
Protected method | RaiseEvents | Raised the events that have been buffered.
Public method | Remove | Removes the first occurrence of a specific object from the ICollectionT.
Public method | RemoveAt | Removes the IListT item at the specified index.
Protected method | RemoveItem | Removes the element at the specified index of the underlying collection.
Protected method | RemoveItems | Removes the specified number of elements starting at the specified index of the underlying collection.
Public method | RemoveRange | Removes a range of elements from the AdvisableCollectionT.
Protected method | SetItem | Replaces the element at the specified index of the underlying collection.
Public method | ToArray | Creates an array from the current AdvisableCollectionT.
Top
Extension Methods
 | Name | Description
Public Extension Method | ToAdvisableCollectionT | Converts an IEnumerableT into an AdvisableCollectionT. (Defined by Extensions.)
Public Extension Method | ToAdvisableDictionaryT, TKey, TValue | Converts an IEnumerableT into a AdvisableDictionaryTKey, TValue given a method returning the item key and a method returning the item value. (Defined by Extensions.)
Public Extension Method | ToAdvisableHashSetT | Converts an IEnumerableT into an AdvisableHashSetT. (Defined by Extensions.)
Top
See Also

Reference

AdvisableCollectionT Class
PostSharp.Patterns.Collections Namespace


AdvisableCollection(T).Add Method

AdvisableCollectionTAdd Method

Adds an item to the ICollectionT.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Add(
    T item
)

Parameters

item
Type: T
The object to add to the ICollectionT.

Implements

ICollectionTAdd(T)
Exceptions
Exception | Condition
NotSupportedException | The ICollectionT is read-only.
See Also

Reference

AdvisableCollectionT Class
PostSharp.Patterns.Collections Namespace


AdvisableCollection(T).AddRange Method

AdvisableCollectionTAddRange Method

Adds the elements of the specified collection to the end of the AdvisableCollectionT.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void AddRange(
    IEnumerable<T> collection
)

Parameters

collection
Type: System.Collections.GenericIEnumerable T
The collection whose elements should be added to the end of the AdvisableCollectionT. The collection itself cannot be null, but it can contain elements that are null, if type T is a reference type.
Exceptions
Exception | Condition
ArgumentNullException | collection is null.
See Also

Reference

AdvisableCollectionT Class
PostSharp.Patterns.Collections Namespace

Other Resources

Conceptual: What's New in PostSharp 4.2


AdvisableCollection(T).Clear Method

AdvisableCollectionTClear Method

Removes all items from the ICollectionT.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Clear()

Implements

ICollectionTClear
IListClear
Exceptions
Exception | Condition
NotSupportedException | The ICollectionT is read-only.
See Also

Reference

AdvisableCollectionT Class
PostSharp.Patterns.Collections Namespace


AdvisableCollection(T).ClearItems Method

AdvisableCollectionTClearItems Method

Removes all elements from the underlying collection.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void ClearItems()
Remarks

Note Note
This method does not cause the advices to be executed. It should be invoked only from inside the scope of the ExecuteWithAdvices method.

See Also

Reference

AdvisableCollectionT Class
PostSharp.Patterns.Collections Namespace


AdvisableCollection(T).Contains Method

AdvisableCollectionTContains Method

Determines whether the ICollectionT contains a specific value.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Contains(
    T item
)

Parameters

item
Type: T
The object to locate in the ICollectionT.

Return Value

Type: Boolean
true if item is found in the ICollectionT; otherwise, false.

Implements

ICollectionTContains(T)
See Also

Reference

AdvisableCollectionT Class
PostSharp.Patterns.Collections Namespace


AdvisableCollection(T).CopyTo Method

AdvisableCollectionTCopyTo Method

Copies the elements of the ICollectionT to an Array, starting at a particular Array index.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void CopyTo(
    T[] array,
    int arrayIndex
)

Parameters

array
Type: T
The one-dimensional Array that is the destination of the elements copied from ICollectionT. The Array must have zero-based indexing.
arrayIndex
Type: SystemInt32
The zero-based index in array at which copying begins.

Implements

ICollectionTCopyTo(T, Int32)
Exceptions
Exception | Condition
ArgumentNullException | array is null.
ArgumentOutOfRangeException | arrayIndex is less than 0.
ArgumentException | The number of elements in the source ICollectionT is greater than the available space from arrayIndex to the end of the destination array.
See Also

Reference

AdvisableCollectionT Class
PostSharp.Patterns.Collections Namespace


AdvisableCollection(T).GetAdviceEnumerator Method

AdvisableCollectionTGetAdviceEnumerator Method

Gets an AdviceEnumeratorT for the ICollectionDynamicAdviceT interface.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected AdviceEnumerator<ICollectionDynamicAdvice<T>> GetAdviceEnumerator()

Return Value

Type: AdviceEnumerator ICollectionDynamicAdvice T
See Also

Reference

AdvisableCollectionT Class
PostSharp.Patterns.Collections Namespace


AdvisableCollection(T).GetCount Method

AdvisableCollectionTGetCount Method

Gets the number of elements in the underlying collection.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected int GetCount()

Return Value

Type: Int32
The number of elements in the collection.
Remarks

Note Note
This method does not cause the advices to be executed. It should be invoked only from inside the scope of the ExecuteWithAdvices method.

See Also

Reference

AdvisableCollectionT Class
PostSharp.Patterns.Collections Namespace


AdvisableCollection(T).GetEnumerator Method

AdvisableCollectionTGetEnumerator Method

Returns an enumerator that iterates through the AdvisableCollectionT.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AdvisableCollectionTEnumerator GetEnumerator()

Return Value

Type: AdvisableCollectionTEnumerator
An AdvisableCollectionTEnumerator for the AdvisableCollectionT.
See Also

Reference

AdvisableCollectionT Class
PostSharp.Patterns.Collections Namespace


AdvisableCollection(T).GetItem Method

AdvisableCollectionTGetItem Method

Gets the element at the specified index of the underlying collection.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected T GetItem(
    int index
)

Parameters

index
Type: SystemInt32
The zero-based index of the element.

Return Value

Type: T
The element value.
Remarks

Note Note
This method does not cause the advices to be executed. It should be invoked only from inside the scope of the ExecuteWithAdvices method.

See Also

Reference

AdvisableCollectionT Class
PostSharp.Patterns.Collections Namespace


AdvisableCollection(T).GetObjectData Method

AdvisableCollectionTGetObjectData Method

Populates a SerializationInfo with the data needed to serialize the target object.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void GetObjectData(
    SerializationInfo info,
    StreamingContext context
)

Parameters

info
Type: System.Runtime.SerializationSerializationInfo
The SerializationInfo to populate with data.
context
Type: System.Runtime.SerializationStreamingContext
The destination (see StreamingContext) for this serialization.

Implements

ISerializableGetObjectData(SerializationInfo, StreamingContext)
Exceptions
Exception | Condition
SecurityException | The caller does not have the required permission.
See Also

Reference

AdvisableCollectionT Class
PostSharp.Patterns.Collections Namespace


AdvisableCollection(T).GetRange Method

AdvisableCollectionTGetRange Method

Creates a shallow copy of a range of elements in the source AdvisableCollectionT.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public List<T> GetRange(
    int index,
    int count
)

Parameters

index
Type: SystemInt32
The zero-based index at which the range starts.
count
Type: SystemInt32
The number of elements in the range.

Return Value

Type: List T
A shallow copy of a range of elements in the source AdvisableCollectionT.
Exceptions
Exception | Condition
ArgumentOutOfRangeException | index is less than 0. -or- count is less than 0.
ArgumentException | index and count do not denote a valid range of elements in the AdvisableCollectionT.
See Also

Reference

AdvisableCollectionT Class
PostSharp.Patterns.Collections Namespace


AdvisableCollection(T).IndexOf Method

AdvisableCollectionTIndexOf Method

Determines the index of a specific item in the IListT.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int IndexOf(
    T item
)

Parameters

item
Type: T
The object to locate in the IListT.

Return Value

Type: Int32
The index of item if found in the list; otherwise, -1.

Implements

IListTIndexOf(T)
See Also

Reference

AdvisableCollectionT Class
PostSharp.Patterns.Collections Namespace


AdvisableCollection(T).IndexOfItem Method

AdvisableCollectionTIndexOfItem Method

Searches for the specified object and returns the zero-based index of the first occurrence within the entire underlying collection.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual int IndexOfItem(
    T item
)

Parameters

item
Type: T
The object to locate in the AdvisableCollectionT. The value can be null for reference types.

Return Value

Type: Int32
The zero-based index of the first occurrence of item within the entire AdvisableCollectionT, if found; otherwise, -1.
See Also

Reference

AdvisableCollectionT Class
PostSharp.Patterns.Collections Namespace


AdvisableCollection(T).Insert Method

AdvisableCollectionTInsert Method

Inserts an item to the IListT at the specified index.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Insert(
    int index,
    T item
)

Parameters

index
Type: SystemInt32
The zero-based index at which item should be inserted.
item
Type: T
The object to insert into the IListT.

Implements

IListTInsert(Int32, T)
Exceptions
Exception | Condition
ArgumentOutOfRangeException | index is not a valid index in the IListT.
NotSupportedException | The IListT is read-only.
See Also

Reference

AdvisableCollectionT Class
PostSharp.Patterns.Collections Namespace


AdvisableCollection(T).InsertItem Method

AdvisableCollectionTInsertItem Method

Inserts an element into the underlying collection at the specified index.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void InsertItem(
    int index,
    T item
)

Parameters

index
Type: SystemInt32
The zero-based index at which item should be inserted.
item
Type: T
The object to insert. The value can be null for reference types.
Remarks

Note Note
This method does not cause the advices to be executed. It should be invoked only from inside the scope of the ExecuteWithAdvices method.

See Also

Reference

AdvisableCollectionT Class
PostSharp.Patterns.Collections Namespace


AdvisableCollection(T).InsertItems Method

AdvisableCollectionTInsertItems Method

Inserts elements into the underlying collection at the specified index.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void InsertItems(
    int index,
    T[] collection
)

Parameters

index
Type: SystemInt32
The zero-based index at which collection should be inserted.
collection
Type: T
The list of objects to insert. The values in the list can be null for reference types.
Remarks

Note Note
This method does not cause the advices to be executed. It should be invoked only from inside the scope of the ExecuteWithAdvices method.

See Also

Reference

AdvisableCollectionT Class
PostSharp.Patterns.Collections Namespace


AdvisableCollection(T).InsertRange Method

AdvisableCollectionTInsertRange Method

Inserts the elements of a collection into the AdvisableCollectionT at the specified index.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void InsertRange(
    int index,
    IEnumerable<T> collection
)

Parameters

index
Type: SystemInt32
The zero-based index at which the new elements should be inserted.
collection
Type: System.Collections.GenericIEnumerable T
The collection whose elements should be inserted into the AdvisableCollectionT. The collection itself cannot be null, but it can contain elements that are null, if type T is a reference type.
Exceptions
Exception | Condition
ArgumentNullException | collection is null.
ArgumentOutOfRangeException | index is less than 0. -or- index is greater than Count
See Also

Reference

AdvisableCollectionT Class
PostSharp.Patterns.Collections Namespace

Other Resources

Conceptual: What's New in PostSharp 4.2


AdvisableCollection(T).Move Method

AdvisableCollectionTMove Method

Moved the element at the specified index to another index.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Move(
    int oldIndex,
    int newIndex
)

Parameters

oldIndex
Type: SystemInt32
The old zero-based index of the item to be moved.
newIndex
Type: SystemInt32
The new zero-based index of the item to be moved.
See Also

Reference

AdvisableCollectionT Class
PostSharp.Patterns.Collections Namespace


AdvisableCollection(T).MoveItem Method

AdvisableCollectionTMoveItem Method

Moves the element at the specified index to another index in the underlying collection.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void MoveItem(
    T item,
    int oldIndex,
    int newIndex
)

Parameters

item
Type: T
The element to be moved.
oldIndex
Type: SystemInt32
The old zero-based index of item in the collection.
newIndex
Type: SystemInt32
The new zero-based index of item in the collection.
Remarks

Some redundancy is created by requiring both item and oldIndex: this is intentional, for performance reasons.

Remarks

Note Note
This method does not cause the advices to be executed. It should be invoked only from inside the scope of the ExecuteWithAdvices method.

See Also

Reference

AdvisableCollectionT Class
PostSharp.Patterns.Collections Namespace


AdvisableCollection(T).OnDeserialization Method

AdvisableCollectionTOnDeserialization Method

Runs when the entire object graph has been deserialized.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void OnDeserialization(
    Object sender
)

Parameters

sender
Type: SystemObject
The object that initiated the callback. The functionality for this parameter is not currently implemented.

Implements

IDeserializationCallbackOnDeserialization(Object)
See Also

Reference

AdvisableCollectionT Class
PostSharp.Patterns.Collections Namespace


AdvisableCollection(T).RaiseEvents Method

AdvisableCollectionTRaiseEvents Method

Raised the events that have been buffered.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected void RaiseEvents()
See Also

Reference

AdvisableCollectionT Class
PostSharp.Patterns.Collections Namespace


AdvisableCollection(T).Remove Method

AdvisableCollectionTRemove Method

Removes the first occurrence of a specific object from the ICollectionT.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Remove(
    T item
)

Parameters

item
Type: T
The object to remove from the ICollectionT.

Return Value

Type: Boolean
true if item was successfully removed from the ICollectionT; otherwise, false. This method also returns false if item is not found in the original ICollectionT.

Implements

ICollectionTRemove(T)
Exceptions
Exception | Condition
NotSupportedException | The ICollectionT is read-only.
See Also

Reference

AdvisableCollectionT Class
PostSharp.Patterns.Collections Namespace


AdvisableCollection(T).RemoveAt Method

AdvisableCollectionTRemoveAt Method

Removes the IListT item at the specified index.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void RemoveAt(
    int index
)

Parameters

index
Type: SystemInt32
The zero-based index of the item to remove.

Implements

IListTRemoveAt(Int32)
Exceptions
Exception | Condition
ArgumentOutOfRangeException | index is not a valid index in the IListT.
NotSupportedException | The IListT is read-only.
See Also

Reference

AdvisableCollectionT Class
PostSharp.Patterns.Collections Namespace


AdvisableCollection(T).RemoveItem Method

AdvisableCollectionTRemoveItem Method

Removes the element at the specified index of the underlying collection.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void RemoveItem(
    int index
)

Parameters

index
Type: SystemInt32
The zero-based index of the element to remove.
Remarks

Note Note
This method does not cause the advices to be executed. It should be invoked only from inside the scope of the ExecuteWithAdvices method.

See Also

Reference

AdvisableCollectionT Class
PostSharp.Patterns.Collections Namespace


AdvisableCollection(T).RemoveItems Method

AdvisableCollectionTRemoveItems Method

Removes the specified number of elements starting at the specified index of the underlying collection.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual T[] RemoveItems(
    int index,
    int count
)

Parameters

index
Type: SystemInt32
The zero-based index of the element to remove.
count
Type: SystemInt32
The number of the elements to remove.

Return Value

Type: T
The list of elements that were removed.
Remarks

Note Note
This method does not cause the advices to be executed. It should be invoked only from inside the scope of the ExecuteWithAdvices method.

See Also

Reference

AdvisableCollectionT Class
PostSharp.Patterns.Collections Namespace


AdvisableCollection(T).RemoveRange Method

AdvisableCollectionTRemoveRange Method

Removes a range of elements from the AdvisableCollectionT.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void RemoveRange(
    int index,
    int count
)

Parameters

index
Type: SystemInt32
The zero-based starting index of the range of elements to remove.
count
Type: SystemInt32
The number of elements to remove.
Exceptions
Exception | Condition
ArgumentOutOfRangeException | index is less than 0. -or- count is less than 0.
ArgumentException | index and count do not denote a valid range of elements in the AdvisableCollectionT.
See Also

Reference

AdvisableCollectionT Class
PostSharp.Patterns.Collections Namespace

Other Resources

Conceptual: What's New in PostSharp 4.2


AdvisableCollection(T).SetItem Method

AdvisableCollectionTSetItem Method

Replaces the element at the specified index of the underlying collection.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void SetItem(
    int index,
    T item
)

Parameters

index
Type: SystemInt32
The zero-based index of the element to replace.
item
Type: T
The new value for the element at the specified index. The value can be null for reference types.
Remarks

Note Note
This method does not cause the advices to be executed. It should be invoked only from inside the scope of the ExecuteWithAdvices method.

See Also

Reference

AdvisableCollectionT Class
PostSharp.Patterns.Collections Namespace


AdvisableCollection(T).ToArray Method

AdvisableCollectionTToArray Method

Creates an array from the current AdvisableCollectionT.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public T[] ToArray()

Return Value

Type: T
See Also

Reference

AdvisableCollectionT Class
PostSharp.Patterns.Collections Namespace


AdvisableCollection(T) Events

AdvisableCollectionT Events

The AdvisableCollectionT generic type exposes the following members.

Events
 | Name | Description
Public event | CollectionChanged | Occurs when the collection changes.
Public event | PropertyChanged | Event raised when the value of a property of the current object changes.
Top
See Also

Reference

AdvisableCollectionT Class
PostSharp.Patterns.Collections Namespace


AdvisableCollection(T).CollectionChanged Event

AdvisableCollectionTCollectionChanged Event

Occurs when the collection changes.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual event NotifyCollectionChangedEventHandler CollectionChanged

Value

Type: System.Collections.SpecializedNotifyCollectionChangedEventHandler

Implements

INotifyCollectionChangedCollectionChanged
See Also

Reference

AdvisableCollectionT Class
PostSharp.Patterns.Collections Namespace


AdvisableCollection(T).PropertyChanged Event

AdvisableCollectionTPropertyChanged Event

Event raised when the value of a property of the current object changes.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual event PropertyChangedEventHandler PropertyChanged

Value

Type: System.ComponentModelPropertyChangedEventHandler

Implements

INotifyPropertyChangedPropertyChanged
See Also

Reference

AdvisableCollectionT Class
PostSharp.Patterns.Collections Namespace


AdvisableCollection(T).Enumerator Structure

AdvisableCollectionTEnumerator Structure

Enumerates the elements of an AdvisableCollectionT.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public struct Enumerator : IEnumerator<T>,
    IDisposable, IEnumerator

The AdvisableCollectionTEnumerator generic type exposes the following members.

Properties
 | Name | Description
Public property | Current | Gets the element in the collection at the current position of the enumerator.
Top
Methods
 | Name | Description
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Public method | MoveNext | Advances the enumerator to the next element of the collection.
Top
See Also

Reference

PostSharp.Patterns.Collections Namespace


Enumerator Properties

The AdvisableCollectionTEnumerator type exposes the following members.

Properties
 | Name | Description
Public property | Current | Gets the element in the collection at the current position of the enumerator.
Top
See Also

Reference

AdvisableCollectionTEnumerator Structure
PostSharp.Patterns.Collections Namespace


AdvisableCollection(T).Enumerator.Current Property

AdvisableCollectionTEnumeratorCurrent Property

Gets the element in the collection at the current position of the enumerator.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public T Current { get; }

Return Value

Type: T
The element in the collection at the current position of the enumerator.

Implements

IEnumeratorTCurrent
See Also

Reference

AdvisableCollectionTEnumerator Structure
PostSharp.Patterns.Collections Namespace


Enumerator Methods

The AdvisableCollectionTEnumerator type exposes the following members.

Methods
 | Name | Description
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Public method | MoveNext | Advances the enumerator to the next element of the collection.
Top
See Also

Reference

AdvisableCollectionTEnumerator Structure
PostSharp.Patterns.Collections Namespace


AdvisableCollection(T).Enumerator.Dispose Method

AdvisableCollectionTEnumeratorDispose Method

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Dispose()

Implements

IDisposableDispose
See Also

Reference

AdvisableCollectionTEnumerator Structure
PostSharp.Patterns.Collections Namespace


AdvisableCollection(T).Enumerator.MoveNext Method

AdvisableCollectionTEnumeratorMoveNext Method

Advances the enumerator to the next element of the collection.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool MoveNext()

Return Value

Type: Boolean
true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.

Implements

IEnumeratorMoveNext
Exceptions
Exception | Condition
InvalidOperationException | The collection was modified after the enumerator was created.
See Also

Reference

AdvisableCollectionTEnumerator Structure
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue) Class

AdvisableDictionaryTKey, TValue Class

An implementation of a DictionaryTKey, TValue into which advices can be injected dynamically. The class also allows derived classes to add new behaviors by overriding methods, like the CollectionT class does.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DynamicAdvisingDynamicallyAdvisableObject
PostSharp.Patterns.CollectionsAdvisableDictionaryTKey, TValue

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public class AdvisableDictionary<TKey, TValue> : DynamicallyAdvisableObject,
    IDynamicallyAdvisableDictionary, IDynamicallyAdvisable, IQueryInterface, IDictionary, ICollection,
    IEnumerable, IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>,
    IEnumerable<KeyValuePair<TKey, TValue>>

Type Parameters

TKey
The type of keys in the dictionary.
TValue
The type of values in the dictionary.

The AdvisableDictionaryTKey, TValue type exposes the following members.

Constructors
 | Name | Description
Public method | AdvisableDictionaryTKey, TValue | Initializes a new instance of the AdvisableDictionaryTKey, TValue class that is empty, has the default initial capacity, and uses the default equality comparer for the key type.
Public method | AdvisableDictionaryTKey, TValue(IDictionaryTKey, TValue) | Initializes a new instance of the AdvisableDictionaryTKey, TValue class that contains elements copied from the specified IDictionaryTKey, TValue and uses the default equality comparer for the key type.
Public method | AdvisableDictionaryTKey, TValue(IEqualityComparerTKey) | Initializes a new instance of the AdvisableDictionaryTKey, TValue that is empty, has the default initial capacity, and uses the specified equality comparer for the key type.
Public method | AdvisableDictionaryTKey, TValue(Int32) | Initializes a new instance of the AdvisableDictionaryTKey, TValue class that is empty, has the specified initial capacity, and uses the default equality comparer for the key type.
Public method | AdvisableDictionaryTKey, TValue(IDictionaryTKey, TValue, IEqualityComparerTKey) | Initializes a new instance of the AdvisableDictionaryTKey, TValue class that contains elements copied from the specified IDictionaryTKey, TValue and uses the specified IEqualityComparerT.
Public method | AdvisableDictionaryTKey, TValue(Int32, IEqualityComparerTKey) | Initializes a new instance of the AdvisableDictionaryTKey, TValue that is empty, has a specified initial capacity, and uses the specified equality comparer for the key type.
Protected method | AdvisableDictionaryTKey, TValue(SerializationInfo, StreamingContext) | Deserialization constructor.
Top
Properties
 | Name | Description
Public property | Count | Gets the number of elements contained in the ICollection.
Public property | IsReadOnly | Gets a value indicating whether the IDictionary object is read-only.
Public property | Item | Gets or sets the element with the specified key.
Public property | Keys | Gets a collection containing the keys in the AdvisableDictionaryTKey, TValue.
Public property | Values | Gets a collection containing the values in the AdvisableDictionaryTKey, TValue.
Top
Methods
 | Name | Description
Public method | Add | Adds an element with the provided key and value to the IDictionaryTKey, TValue.
Protected method | AddItem | Adds an element into the underlying dictionary.
Public method | Clear | Removes all elements from the IDictionary object.
Protected method | ClearItems | Removes all keys and items from the underlying dictionary.
Public method | ContainsKey | Determines whether the IDictionaryTKey, TValue contains an element with the specified key.
Public method | ContainsValue | Determines whether the AdvisableDictionaryTKey, TValue contains a specific value.
Protected method | ExecuteWithAdvicesTResult, TAction | Executes an action wrapped by all custom advices added to the current object. (Inherited from DynamicallyAdvisableObject.)
Protected method | GetAdviceEnumerator | Gets an AdviceEnumeratorT for the ICollectionDynamicAdviceT interface.
Public method | GetEnumerator | Returns an enumerator that iterates through the AdvisableDictionaryTKey, TValue.
Public method | GetObjectData | Populates a SerializationInfo with the data needed to serialize the target object. (Overrides DynamicallyAdvisableObjectGetObjectData(SerializationInfo, StreamingContext).)
Protected method | InitializeAdvices | Initializes the list of dynamic advices. (Inherited from DynamicallyAdvisableObject.)
Public method | OnDeserialization | Runs when the entire object graph has been deserialized. (Overrides DynamicallyAdvisableObjectOnDeserialization(Object).)
Public method | Remove | Removes the element with the specified key from the IDictionaryTKey, TValue.
Protected method | RemoveItem | Removes the value with the specific key from the underlying dictionary.
Protected method | SetItem | Sets the value with the specified key in the underlying dictionary.
Public method | TryGetValue | Gets the value associated with the specified key.
Top
Extension Methods
 | Name | Description
Public Extension Method | ToAdvisableCollectionKeyValuePairTKey, TValue | Converts an IEnumerableT into an AdvisableCollectionT. (Defined by Extensions.)
Public Extension Method | ToAdvisableDictionaryKeyValuePairTKey, TValue, TKey, TValue | Converts an IEnumerableT into a AdvisableDictionaryTKey, TValue given a method returning the item key and a method returning the item value. (Defined by Extensions.)
Public Extension Method | ToAdvisableHashSetKeyValuePairTKey, TValue | Converts an IEnumerableT into an AdvisableHashSetT. (Defined by Extensions.)
Top
Remarks

To learn how to extend this class, see the AdvisableCollectionT class documentation,

See Also

Reference

PostSharp.Patterns.Collections Namespace

Other Resources

Conceptual: Annotating an Object Model for Parent/Child Relationships (Aggregatable)
Conceptual: Enumerating Child Objects (Visitor)
Conceptual: Freezable Threading Model
Conceptual: Immutable Threading Model
Conceptual: Working With Child Collections


AdvisableDictionary(TKey, TValue) Constructor

AdvisableDictionaryTKey, TValue Constructor

Overload List
 | Name | Description
Public method | AdvisableDictionaryTKey, TValue | Initializes a new instance of the AdvisableDictionaryTKey, TValue class that is empty, has the default initial capacity, and uses the default equality comparer for the key type.
Public method | AdvisableDictionaryTKey, TValue(IDictionaryTKey, TValue) | Initializes a new instance of the AdvisableDictionaryTKey, TValue class that contains elements copied from the specified IDictionaryTKey, TValue and uses the default equality comparer for the key type.
Public method | AdvisableDictionaryTKey, TValue(IEqualityComparerTKey) | Initializes a new instance of the AdvisableDictionaryTKey, TValue that is empty, has the default initial capacity, and uses the specified equality comparer for the key type.
Public method | AdvisableDictionaryTKey, TValue(Int32) | Initializes a new instance of the AdvisableDictionaryTKey, TValue class that is empty, has the specified initial capacity, and uses the default equality comparer for the key type.
Public method | AdvisableDictionaryTKey, TValue(IDictionaryTKey, TValue, IEqualityComparerTKey) | Initializes a new instance of the AdvisableDictionaryTKey, TValue class that contains elements copied from the specified IDictionaryTKey, TValue and uses the specified IEqualityComparerT.
Public method | AdvisableDictionaryTKey, TValue(Int32, IEqualityComparerTKey) | Initializes a new instance of the AdvisableDictionaryTKey, TValue that is empty, has a specified initial capacity, and uses the specified equality comparer for the key type.
Protected method | AdvisableDictionaryTKey, TValue(SerializationInfo, StreamingContext) | Deserialization constructor.
Top
See Also

Reference

AdvisableDictionaryTKey, TValue Class
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue) Constructor

AdvisableDictionaryTKey, TValue Constructor

Initializes a new instance of the AdvisableDictionaryTKey, TValue class that is empty, has the default initial capacity, and uses the default equality comparer for the key type.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AdvisableDictionary()
See Also

Reference

AdvisableDictionaryTKey, TValue Class
AdvisableDictionaryTKey, TValue Overload
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue) Constructor (IDictionary(TKey, TValue))

AdvisableDictionaryTKey, TValue Constructor (IDictionaryTKey, TValue)

Initializes a new instance of the AdvisableDictionaryTKey, TValue class that contains elements copied from the specified IDictionaryTKey, TValue and uses the default equality comparer for the key type.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AdvisableDictionary(
    IDictionary<TKey, TValue> dictionary
)

Parameters

dictionary
Type: System.Collections.GenericIDictionary TKey, TValue
The IDictionaryTKey, TValue whose elements are copied to the new AdvisableDictionaryTKey, TValue.
See Also

Reference

AdvisableDictionaryTKey, TValue Class
AdvisableDictionaryTKey, TValue Overload
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue) Constructor (IEqualityComparer(TKey))

AdvisableDictionaryTKey, TValue Constructor (IEqualityComparerTKey)

Initializes a new instance of the AdvisableDictionaryTKey, TValue that is empty, has the default initial capacity, and uses the specified equality comparer for the key type.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AdvisableDictionary(
    IEqualityComparer<TKey> comparer
)

Parameters

comparer
Type: System.Collections.GenericIEqualityComparer TKey
The IEqualityComparerT implementation to use when comparing keys, or null to use the default EqualityComparerT for the type of the key.
See Also

Reference

AdvisableDictionaryTKey, TValue Class
AdvisableDictionaryTKey, TValue Overload
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue) Constructor (Int32)

AdvisableDictionaryTKey, TValue Constructor (Int32)

Initializes a new instance of the AdvisableDictionaryTKey, TValue class that is empty, has the specified initial capacity, and uses the default equality comparer for the key type.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AdvisableDictionary(
    int capacity
)

Parameters

capacity
Type: SystemInt32
The initial number of elements that the AdvisableDictionaryTKey, TValue can contain.
See Also

Reference

AdvisableDictionaryTKey, TValue Class
AdvisableDictionaryTKey, TValue Overload
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue) Constructor (IDictionary(TKey, TValue), IEqualityComparer(TKey))

AdvisableDictionaryTKey, TValue Constructor (IDictionaryTKey, TValue, IEqualityComparerTKey)

Initializes a new instance of the AdvisableDictionaryTKey, TValue class that contains elements copied from the specified IDictionaryTKey, TValue and uses the specified IEqualityComparerT.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AdvisableDictionary(
    IDictionary<TKey, TValue> dictionary,
    IEqualityComparer<TKey> comparer
)

Parameters

dictionary
Type: System.Collections.GenericIDictionary TKey, TValue
The IDictionaryTKey, TValue whose elements are copied to the new AdvisableDictionaryTKey, TValue.
comparer
Type: System.Collections.GenericIEqualityComparer TKey
The IEqualityComparerT implementation to use when comparing keys, or null to use the default EqualityComparerT for the type of the key.
See Also

Reference

AdvisableDictionaryTKey, TValue Class
AdvisableDictionaryTKey, TValue Overload
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue) Constructor (Int32, IEqualityComparer(TKey))

AdvisableDictionaryTKey, TValue Constructor (Int32, IEqualityComparerTKey)

Initializes a new instance of the AdvisableDictionaryTKey, TValue that is empty, has a specified initial capacity, and uses the specified equality comparer for the key type.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AdvisableDictionary(
    int capacity,
    IEqualityComparer<TKey> comparer
)

Parameters

capacity
Type: SystemInt32
The initial number of elements that the AdvisableDictionaryTKey, TValue can contain.
comparer
Type: System.Collections.GenericIEqualityComparer TKey
The IEqualityComparerT implementation to use when comparing keys, or null to use the default EqualityComparerT for the type of the key.
See Also

Reference

AdvisableDictionaryTKey, TValue Class
AdvisableDictionaryTKey, TValue Overload
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue) Constructor (SerializationInfo, StreamingContext)

AdvisableDictionaryTKey, TValue Constructor (SerializationInfo, StreamingContext)

Deserialization constructor.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected AdvisableDictionary(
    SerializationInfo info,
    StreamingContext context
)

Parameters

info
Type: System.Runtime.SerializationSerializationInfo
context
Type: System.Runtime.SerializationStreamingContext
See Also

Reference

AdvisableDictionaryTKey, TValue Class
AdvisableDictionaryTKey, TValue Overload
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue) Properties

AdvisableDictionaryTKey, TValue Properties

The AdvisableDictionaryTKey, TValue generic type exposes the following members.

Properties
 | Name | Description
Public property | Count | Gets the number of elements contained in the ICollection.
Public property | IsReadOnly | Gets a value indicating whether the IDictionary object is read-only.
Public property | Item | Gets or sets the element with the specified key.
Public property | Keys | Gets a collection containing the keys in the AdvisableDictionaryTKey, TValue.
Public property | Values | Gets a collection containing the values in the AdvisableDictionaryTKey, TValue.
Top
See Also

Reference

AdvisableDictionaryTKey, TValue Class
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).Count Property

AdvisableDictionaryTKey, TValueCount Property

Gets the number of elements contained in the ICollection.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int Count { get; }

Return Value

Type: Int32
The number of elements contained in the ICollection.

Implements

ICollectionCount
ICollectionTCount
See Also

Reference

AdvisableDictionaryTKey, TValue Class
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).IsReadOnly Property

AdvisableDictionaryTKey, TValueIsReadOnly Property

Gets a value indicating whether the IDictionary object is read-only.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsReadOnly { get; }

Return Value

Type: Boolean
true if the IDictionary object is read-only; otherwise, false.

Implements

IDictionaryIsReadOnly
ICollectionTIsReadOnly
See Also

Reference

AdvisableDictionaryTKey, TValue Class
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).Item Property

AdvisableDictionaryTKey, TValueItem Property

Gets or sets the element with the specified key.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TValue this[
    TKey key
] { get; set; }

Parameters

key
Type: TKey
The key of the element to get or set.

Return Value

Type: TValue
The element with the specified key.

Implements

IDictionaryTKey, TValueItemTKey
Exceptions
Exception | Condition
ArgumentNullException | key is null.
KeyNotFoundException | The property is retrieved and key is not found.
NotSupportedException | The property is set and the IDictionaryTKey, TValue is read-only.
See Also

Reference

AdvisableDictionaryTKey, TValue Class
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).Keys Property

AdvisableDictionaryTKey, TValueKeys Property

Gets a collection containing the keys in the AdvisableDictionaryTKey, TValue.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AdvisableDictionaryTKey, TValueKeyCollection Keys { get; }

Property Value

Type: AdvisableDictionaryTKey, TValueKeyCollection
See Also

Reference

AdvisableDictionaryTKey, TValue Class
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).Values Property

AdvisableDictionaryTKey, TValueValues Property

Gets a collection containing the values in the AdvisableDictionaryTKey, TValue.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AdvisableDictionaryTKey, TValueValueCollection Values { get; }

Property Value

Type: AdvisableDictionaryTKey, TValueValueCollection
See Also

Reference

AdvisableDictionaryTKey, TValue Class
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue) Methods

AdvisableDictionaryTKey, TValue Methods

The AdvisableDictionaryTKey, TValue generic type exposes the following members.

Methods
 | Name | Description
Public method | Add | Adds an element with the provided key and value to the IDictionaryTKey, TValue.
Protected method | AddItem | Adds an element into the underlying dictionary.
Public method | Clear | Removes all elements from the IDictionary object.
Protected method | ClearItems | Removes all keys and items from the underlying dictionary.
Public method | ContainsKey | Determines whether the IDictionaryTKey, TValue contains an element with the specified key.
Public method | ContainsValue | Determines whether the AdvisableDictionaryTKey, TValue contains a specific value.
Protected method | ExecuteWithAdvicesTResult, TAction | Executes an action wrapped by all custom advices added to the current object. (Inherited from DynamicallyAdvisableObject.)
Protected method | GetAdviceEnumerator | Gets an AdviceEnumeratorT for the ICollectionDynamicAdviceT interface.
Public method | GetEnumerator | Returns an enumerator that iterates through the AdvisableDictionaryTKey, TValue.
Public method | GetObjectData | Populates a SerializationInfo with the data needed to serialize the target object. (Overrides DynamicallyAdvisableObjectGetObjectData(SerializationInfo, StreamingContext).)
Protected method | InitializeAdvices | Initializes the list of dynamic advices. (Inherited from DynamicallyAdvisableObject.)
Public method | OnDeserialization | Runs when the entire object graph has been deserialized. (Overrides DynamicallyAdvisableObjectOnDeserialization(Object).)
Public method | Remove | Removes the element with the specified key from the IDictionaryTKey, TValue.
Protected method | RemoveItem | Removes the value with the specific key from the underlying dictionary.
Protected method | SetItem | Sets the value with the specified key in the underlying dictionary.
Public method | TryGetValue | Gets the value associated with the specified key.
Top
Extension Methods
 | Name | Description
Public Extension Method | ToAdvisableCollectionKeyValuePairTKey, TValue | Converts an IEnumerableT into an AdvisableCollectionT. (Defined by Extensions.)
Public Extension Method | ToAdvisableDictionaryKeyValuePairTKey, TValue, TKey, TValue | Converts an IEnumerableT into a AdvisableDictionaryTKey, TValue given a method returning the item key and a method returning the item value. (Defined by Extensions.)
Public Extension Method | ToAdvisableHashSetKeyValuePairTKey, TValue | Converts an IEnumerableT into an AdvisableHashSetT. (Defined by Extensions.)
Top
See Also

Reference

AdvisableDictionaryTKey, TValue Class
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).Add Method

AdvisableDictionaryTKey, TValueAdd Method

Adds an element with the provided key and value to the IDictionaryTKey, TValue.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Add(
    TKey key,
    TValue value
)

Parameters

key
Type: TKey
The object to use as the key of the element to add.
value
Type: TValue
The object to use as the value of the element to add.

Implements

IDictionaryTKey, TValueAdd(TKey, TValue)
Exceptions
Exception | Condition
ArgumentNullException | key is null.
ArgumentException | An element with the same key already exists in the IDictionaryTKey, TValue.
NotSupportedException | The IDictionaryTKey, TValue is read-only.
See Also

Reference

AdvisableDictionaryTKey, TValue Class
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).AddItem Method

AdvisableDictionaryTKey, TValueAddItem Method

Adds an element into the underlying dictionary.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void AddItem(
    TKey key,
    TValue value
)

Parameters

key
Type: TKey
The key of the element to add.
value
Type: TValue
The value of the element to add. The value can be null for reference types..
Remarks

Note Note
This method does not cause the advices to be executed. It should be invoked only from inside the scope of the ExecuteWithAdvices method.

See Also

Reference

AdvisableDictionaryTKey, TValue Class
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).Clear Method

AdvisableDictionaryTKey, TValueClear Method

Removes all elements from the IDictionary object.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Clear()

Implements

IDictionaryClear
ICollectionTClear
Exceptions
Exception | Condition
NotSupportedException | The IDictionary object is read-only.
See Also

Reference

AdvisableDictionaryTKey, TValue Class
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).ClearItems Method

AdvisableDictionaryTKey, TValueClearItems Method

Removes all keys and items from the underlying dictionary.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void ClearItems()
Remarks

Note Note
This method does not cause the advices to be executed. It should be invoked only from inside the scope of the ExecuteWithAdvices method.

See Also

Reference

AdvisableDictionaryTKey, TValue Class
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).ContainsKey Method

AdvisableDictionaryTKey, TValueContainsKey Method

Determines whether the IDictionaryTKey, TValue contains an element with the specified key.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool ContainsKey(
    TKey key
)

Parameters

key
Type: TKey
The key to locate in the IDictionaryTKey, TValue.

Return Value

Type: Boolean
true if the IDictionaryTKey, TValue contains an element with the key; otherwise, false.

Implements

IDictionaryTKey, TValueContainsKey(TKey)
Exceptions
Exception | Condition
ArgumentNullException | key is null.
See Also

Reference

AdvisableDictionaryTKey, TValue Class
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).ContainsValue Method

AdvisableDictionaryTKey, TValueContainsValue Method

Determines whether the AdvisableDictionaryTKey, TValue contains a specific value.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool ContainsValue(
    TValue value
)

Parameters

value
Type: TValue
The value to locate in the AdvisableDictionaryTKey, TValue. The value can be null for reference types.

Return Value

Type: Boolean
true if the AdvisableDictionaryTKey, TValue contains an element with the specified value; otherwise, false.
See Also

Reference

AdvisableDictionaryTKey, TValue Class
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).GetAdviceEnumerator Method

AdvisableDictionaryTKey, TValueGetAdviceEnumerator Method

Gets an AdviceEnumeratorT for the ICollectionDynamicAdviceT interface.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected AdviceEnumerator<IDictionaryDynamicAdvice<TKey, TValue>> GetAdviceEnumerator()

Return Value

Type: AdviceEnumerator IDictionaryDynamicAdvice TKey, TValue
See Also

Reference

AdvisableDictionaryTKey, TValue Class
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).GetEnumerator Method

AdvisableDictionaryTKey, TValueGetEnumerator Method

Returns an enumerator that iterates through the AdvisableDictionaryTKey, TValue.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AdvisableDictionaryTKey, TValueEnumerator GetEnumerator()

Return Value

Type: AdvisableDictionaryTKey, TValueEnumerator
An AdvisableDictionaryTKey, TValueEnumerator structure for the current AdvisableDictionaryTKey, TValue.
See Also

Reference

AdvisableDictionaryTKey, TValue Class
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).GetObjectData Method

AdvisableDictionaryTKey, TValueGetObjectData Method

Populates a SerializationInfo with the data needed to serialize the target object.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void GetObjectData(
    SerializationInfo info,
    StreamingContext context
)

Parameters

info
Type: System.Runtime.SerializationSerializationInfo
The SerializationInfo to populate with data.
context
Type: System.Runtime.SerializationStreamingContext
The destination (see StreamingContext) for this serialization.

Implements

ISerializableGetObjectData(SerializationInfo, StreamingContext)
Exceptions
Exception | Condition
SecurityException | The caller does not have the required permission.
See Also

Reference

AdvisableDictionaryTKey, TValue Class
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).OnDeserialization Method

AdvisableDictionaryTKey, TValueOnDeserialization Method

Runs when the entire object graph has been deserialized.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void OnDeserialization(
    Object sender
)

Parameters

sender
Type: SystemObject
The object that initiated the callback. The functionality for this parameter is not currently implemented.

Implements

IDeserializationCallbackOnDeserialization(Object)
See Also

Reference

AdvisableDictionaryTKey, TValue Class
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).Remove Method

AdvisableDictionaryTKey, TValueRemove Method

Removes the element with the specified key from the IDictionaryTKey, TValue.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Remove(
    TKey key
)

Parameters

key
Type: TKey
The key of the element to remove.

Return Value

Type: Boolean
true if the element is successfully removed; otherwise, false. This method also returns false if key was not found in the original IDictionaryTKey, TValue.

Implements

IDictionaryTKey, TValueRemove(TKey)
Exceptions
Exception | Condition
ArgumentNullException | key is null.
NotSupportedException | The IDictionaryTKey, TValue is read-only.
See Also

Reference

AdvisableDictionaryTKey, TValue Class
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).RemoveItem Method

AdvisableDictionaryTKey, TValueRemoveItem Method

Removes the value with the specific key from the underlying dictionary.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual bool RemoveItem(
    TKey key
)

Parameters

key
Type: TKey
The key of the element to remove.

Return Value

Type: Boolean
true if the element was successfully found and removed, otherwise false. This method returns false if key if not found in the underlying dictionary.
Remarks

Note Note
This method does not cause the advices to be executed. It should be invoked only from inside the scope of the ExecuteWithAdvices method.

See Also

Reference

AdvisableDictionaryTKey, TValue Class
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).SetItem Method

AdvisableDictionaryTKey, TValueSetItem Method

Sets the value with the specified key in the underlying dictionary.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void SetItem(
    TKey key,
    TValue value,
    TValue oldValue
)

Parameters

key
Type: TKey
The key of the element to add or replace.
value
Type: TValue
The new value to assign to the key.
oldValue
Type: TValue
The old value assigned to key, or null if there is currently no value assigned to key.
Remarks

There is redundancy in requiring both key and oldValue, but this redundancy is required for performance reason.

Note Note
This method does not cause the advices to be executed. It should be invoked only from inside the scope of the ExecuteWithAdvices method.

See Also

Reference

AdvisableDictionaryTKey, TValue Class
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).TryGetValue Method

AdvisableDictionaryTKey, TValueTryGetValue Method

Gets the value associated with the specified key.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool TryGetValue(
    TKey key,
    out TValue value
)

Parameters

key
Type: TKey
The key whose value to get.
value
Type: TValue
When this method returns, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized.

Return Value

Type: Boolean
true if the object that implements IDictionaryTKey, TValue contains an element with the specified key; otherwise, false.

Implements

IDictionaryTKey, TValueTryGetValue(TKey, TValue)
Exceptions
Exception | Condition
ArgumentNullException | key is null.
See Also

Reference

AdvisableDictionaryTKey, TValue Class
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).Enumerator Structure

AdvisableDictionaryTKey, TValueEnumerator Structure

Enumerates the elements of an AdvisableDictionaryTKey, TValue.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public struct Enumerator : IEnumerator<KeyValuePair<TKey, TValue>>,
    IDisposable, IEnumerator, IDictionaryEnumerator

The AdvisableDictionaryTKey, TValueEnumerator generic type exposes the following members.

Properties
 | Name | Description
Public property | Current | Gets the element in the collection at the current position of the enumerator.
Top
Methods
 | Name | Description
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Public method | MoveNext | Advances the enumerator to the next element of the collection.
Top
See Also

Reference

PostSharp.Patterns.Collections Namespace


Enumerator Properties

The AdvisableDictionaryTKey, TValueEnumerator type exposes the following members.

Properties
 | Name | Description
Public property | Current | Gets the element in the collection at the current position of the enumerator.
Top
See Also

Reference

AdvisableDictionaryTKey, TValueEnumerator Structure
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).Enumerator.Current Property

AdvisableDictionaryTKey, TValueEnumeratorCurrent Property

Gets the element in the collection at the current position of the enumerator.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public KeyValuePair<TKey, TValue> Current { get; }

Return Value

Type: KeyValuePair TKey, TValue
The element in the collection at the current position of the enumerator.

Implements

IEnumeratorTCurrent
See Also

Reference

AdvisableDictionaryTKey, TValueEnumerator Structure
PostSharp.Patterns.Collections Namespace


Enumerator Methods

The AdvisableDictionaryTKey, TValueEnumerator type exposes the following members.

Methods
 | Name | Description
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Public method | MoveNext | Advances the enumerator to the next element of the collection.
Top
See Also

Reference

AdvisableDictionaryTKey, TValueEnumerator Structure
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).Enumerator.Dispose Method

AdvisableDictionaryTKey, TValueEnumeratorDispose Method

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Dispose()

Implements

IDisposableDispose
See Also

Reference

AdvisableDictionaryTKey, TValueEnumerator Structure
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).Enumerator.MoveNext Method

AdvisableDictionaryTKey, TValueEnumeratorMoveNext Method

Advances the enumerator to the next element of the collection.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool MoveNext()

Return Value

Type: Boolean
true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.

Implements

IEnumeratorMoveNext
Exceptions
Exception | Condition
InvalidOperationException | The collection was modified after the enumerator was created.
See Also

Reference

AdvisableDictionaryTKey, TValueEnumerator Structure
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).KeyCollection Class

AdvisableDictionaryTKey, TValueKeyCollection Class

Represents the collection of keys in an AdvisableDictionaryTKey, TValue.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.CollectionsAdvisableDictionaryTKey, TValueKeyCollection

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class KeyCollection : ICollection<TKey>,
    IEnumerable<TKey>, IEnumerable, ICollection

The AdvisableDictionaryTKey, TValueKeyCollection generic type exposes the following members.

Properties
 | Name | Description
Public property | Count | Gets the number of elements contained in the ICollectionT.
Top
Methods
 | Name | Description
Public method | CopyTo | Copies the elements of the ICollectionT to an Array, starting at a particular Array index.
Public method | GetEnumerator | Returns an enumerator that iterates through the AdvisableDictionaryTKey, TValueKeyCollection.
Top
Extension Methods
 | Name | Description
Public Extension Method | ToAdvisableCollectionTKey | Converts an IEnumerableT into an AdvisableCollectionT. (Defined by Extensions.)
Public Extension Method | ToAdvisableDictionaryTKey, TKey, TValue | Converts an IEnumerableT into a AdvisableDictionaryTKey, TValue given a method returning the item key and a method returning the item value. (Defined by Extensions.)
Public Extension Method | ToAdvisableHashSetTKey | Converts an IEnumerableT into an AdvisableHashSetT. (Defined by Extensions.)
Top
See Also

Reference

PostSharp.Patterns.Collections Namespace


KeyCollection Properties

The AdvisableDictionaryTKey, TValueKeyCollection type exposes the following members.

Properties
 | Name | Description
Public property | Count | Gets the number of elements contained in the ICollectionT.
Top
See Also

Reference

AdvisableDictionaryTKey, TValueKeyCollection Class
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).KeyCollection.Count Property

AdvisableDictionaryTKey, TValueKeyCollectionCount Property

Gets the number of elements contained in the ICollectionT.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int Count { get; }

Return Value

Type: Int32
The number of elements contained in the ICollectionT.

Implements

ICollectionTCount
ICollectionCount
See Also

Reference

AdvisableDictionaryTKey, TValueKeyCollection Class
PostSharp.Patterns.Collections Namespace


KeyCollection Methods

The AdvisableDictionaryTKey, TValueKeyCollection type exposes the following members.

Methods
 | Name | Description
Public method | CopyTo | Copies the elements of the ICollectionT to an Array, starting at a particular Array index.
Public method | GetEnumerator | Returns an enumerator that iterates through the AdvisableDictionaryTKey, TValueKeyCollection.
Top
Extension Methods
 | Name | Description
Public Extension Method | ToAdvisableCollectionTKey | Converts an IEnumerableT into an AdvisableCollectionT. (Defined by Extensions.)
Public Extension Method | ToAdvisableDictionaryTKey, TKey, TValue | Converts an IEnumerableT into a AdvisableDictionaryTKey, TValue given a method returning the item key and a method returning the item value. (Defined by Extensions.)
Public Extension Method | ToAdvisableHashSetTKey | Converts an IEnumerableT into an AdvisableHashSetT. (Defined by Extensions.)
Top
See Also

Reference

AdvisableDictionaryTKey, TValueKeyCollection Class
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).KeyCollection.CopyTo Method

AdvisableDictionaryTKey, TValueKeyCollectionCopyTo Method

Copies the elements of the ICollectionT to an Array, starting at a particular Array index.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void CopyTo(
    TKey[] array,
    int arrayIndex
)

Parameters

array
Type: TKey
The one-dimensional Array that is the destination of the elements copied from ICollectionT. The Array must have zero-based indexing.
arrayIndex
Type: SystemInt32
The zero-based index in array at which copying begins.

Implements

ICollectionTCopyTo(T, Int32)
Exceptions
Exception | Condition
ArgumentNullException | array is null.
ArgumentOutOfRangeException | arrayIndex is less than 0.
ArgumentException | The number of elements in the source ICollectionT is greater than the available space from arrayIndex to the end of the destination array.
See Also

Reference

AdvisableDictionaryTKey, TValueKeyCollection Class
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).KeyCollection.GetEnumerator Method

AdvisableDictionaryTKey, TValueKeyCollectionGetEnumerator Method

Returns an enumerator that iterates through the AdvisableDictionaryTKey, TValueKeyCollection.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AdvisableDictionaryTKey, TValueKeyCollectionEnumerator GetEnumerator()

Return Value

Type: AdvisableDictionaryTKey, TValueKeyCollectionEnumerator
An AdvisableDictionaryTKey, TValueKeyCollectionEnumerator structure for the current AdvisableDictionaryTKey, TValueKeyCollection.
See Also

Reference

AdvisableDictionaryTKey, TValueKeyCollection Class
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).KeyCollection.Enumerator Structure

AdvisableDictionaryTKey, TValueKeyCollectionEnumerator Structure

Enumerates the elements of a AdvisableDictionaryTKey, TValueKeyCollection.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public struct Enumerator : IEnumerator<TKey>,
    IDisposable, IEnumerator

The AdvisableDictionaryTKey, TValueKeyCollectionEnumerator type exposes the following members.

Properties
 | Name | Description
Public property | Current | Gets the element in the collection at the current position of the enumerator.
Top
Methods
 | Name | Description
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Public method | MoveNext | Advances the enumerator to the next element of the collection.
Top
See Also

Reference

PostSharp.Patterns.Collections Namespace


Enumerator Properties

The AdvisableDictionaryTKey, TValueKeyCollectionEnumerator type exposes the following members.

Properties
 | Name | Description
Public property | Current | Gets the element in the collection at the current position of the enumerator.
Top
See Also

Reference

AdvisableDictionaryTKey, TValueKeyCollectionEnumerator Structure
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).KeyCollection.Enumerator.Current Property

AdvisableDictionaryTKey, TValueKeyCollectionEnumeratorCurrent Property

Gets the element in the collection at the current position of the enumerator.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TKey Current { get; }

Return Value

Type: TKey
The element in the collection at the current position of the enumerator.

Implements

IEnumeratorTCurrent
See Also

Reference

AdvisableDictionaryTKey, TValueKeyCollectionEnumerator Structure
PostSharp.Patterns.Collections Namespace


Enumerator Methods

The AdvisableDictionaryTKey, TValueKeyCollectionEnumerator type exposes the following members.

Methods
 | Name | Description
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Public method | MoveNext | Advances the enumerator to the next element of the collection.
Top
See Also

Reference

AdvisableDictionaryTKey, TValueKeyCollectionEnumerator Structure
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).KeyCollection.Enumerator.Dispose Method

AdvisableDictionaryTKey, TValueKeyCollectionEnumeratorDispose Method

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Dispose()

Implements

IDisposableDispose
See Also

Reference

AdvisableDictionaryTKey, TValueKeyCollectionEnumerator Structure
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).KeyCollection.Enumerator.MoveNext Method

AdvisableDictionaryTKey, TValueKeyCollectionEnumeratorMoveNext Method

Advances the enumerator to the next element of the collection.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool MoveNext()

Return Value

Type: Boolean
true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.

Implements

IEnumeratorMoveNext
Exceptions
Exception | Condition
InvalidOperationException | The collection was modified after the enumerator was created.
See Also

Reference

AdvisableDictionaryTKey, TValueKeyCollectionEnumerator Structure
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).ValueCollection Class

AdvisableDictionaryTKey, TValueValueCollection Class

Represents the collection of values in an AdvisableDictionaryTKey, TValue.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.CollectionsAdvisableDictionaryTKey, TValueValueCollection

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ValueCollection : ICollection<TValue>,
    IEnumerable<TValue>, IEnumerable, ICollection

The AdvisableDictionaryTKey, TValueValueCollection generic type exposes the following members.

Properties
 | Name | Description
Public property | Count | Gets the number of elements contained in the ICollectionT.
Top
Methods
 | Name | Description
Public method | CopyTo | Copies the elements of the ICollectionT to an Array, starting at a particular Array index.
Public method | GetEnumerator | Returns an enumerator that iterates through the AdvisableDictionaryTKey, TValueValueCollection.
Top
Extension Methods
 | Name | Description
Public Extension Method | ToAdvisableCollectionTValue | Converts an IEnumerableT into an AdvisableCollectionT. (Defined by Extensions.)
Public Extension Method | ToAdvisableDictionaryTValue, TKey, TValue | Converts an IEnumerableT into a AdvisableDictionaryTKey, TValue given a method returning the item key and a method returning the item value. (Defined by Extensions.)
Public Extension Method | ToAdvisableHashSetTValue | Converts an IEnumerableT into an AdvisableHashSetT. (Defined by Extensions.)
Top
See Also

Reference

PostSharp.Patterns.Collections Namespace


ValueCollection Properties

The AdvisableDictionaryTKey, TValueValueCollection type exposes the following members.

Properties
 | Name | Description
Public property | Count | Gets the number of elements contained in the ICollectionT.
Top
See Also

Reference

AdvisableDictionaryTKey, TValueValueCollection Class
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).ValueCollection.Count Property

AdvisableDictionaryTKey, TValueValueCollectionCount Property

Gets the number of elements contained in the ICollectionT.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int Count { get; }

Return Value

Type: Int32
The number of elements contained in the ICollectionT.

Implements

ICollectionTCount
ICollectionCount
See Also

Reference

AdvisableDictionaryTKey, TValueValueCollection Class
PostSharp.Patterns.Collections Namespace


ValueCollection Methods

The AdvisableDictionaryTKey, TValueValueCollection type exposes the following members.

Methods
 | Name | Description
Public method | CopyTo | Copies the elements of the ICollectionT to an Array, starting at a particular Array index.
Public method | GetEnumerator | Returns an enumerator that iterates through the AdvisableDictionaryTKey, TValueValueCollection.
Top
Extension Methods
 | Name | Description
Public Extension Method | ToAdvisableCollectionTValue | Converts an IEnumerableT into an AdvisableCollectionT. (Defined by Extensions.)
Public Extension Method | ToAdvisableDictionaryTValue, TKey, TValue | Converts an IEnumerableT into a AdvisableDictionaryTKey, TValue given a method returning the item key and a method returning the item value. (Defined by Extensions.)
Public Extension Method | ToAdvisableHashSetTValue | Converts an IEnumerableT into an AdvisableHashSetT. (Defined by Extensions.)
Top
See Also

Reference

AdvisableDictionaryTKey, TValueValueCollection Class
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).ValueCollection.CopyTo Method

AdvisableDictionaryTKey, TValueValueCollectionCopyTo Method

Copies the elements of the ICollectionT to an Array, starting at a particular Array index.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void CopyTo(
    TValue[] array,
    int arrayIndex
)

Parameters

array
Type: TValue
The one-dimensional Array that is the destination of the elements copied from ICollectionT. The Array must have zero-based indexing.
arrayIndex
Type: SystemInt32
The zero-based index in array at which copying begins.

Implements

ICollectionTCopyTo(T, Int32)
Exceptions
Exception | Condition
ArgumentNullException | array is null.
ArgumentOutOfRangeException | arrayIndex is less than 0.
ArgumentException | The number of elements in the source ICollectionT is greater than the available space from arrayIndex to the end of the destination array.
See Also

Reference

AdvisableDictionaryTKey, TValueValueCollection Class
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).ValueCollection.GetEnumerator Method

AdvisableDictionaryTKey, TValueValueCollectionGetEnumerator Method

Returns an enumerator that iterates through the AdvisableDictionaryTKey, TValueValueCollection.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AdvisableDictionaryTKey, TValueValueCollectionEnumerator GetEnumerator()

Return Value

Type: AdvisableDictionaryTKey, TValueValueCollectionEnumerator
An AdvisableDictionaryTKey, TValueValueCollectionEnumerator structure for the current AdvisableDictionaryTKey, TValueValueCollection.
See Also

Reference

AdvisableDictionaryTKey, TValueValueCollection Class
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).ValueCollection.Enumerator Structure

AdvisableDictionaryTKey, TValueValueCollectionEnumerator Structure

Enumerates the elements of a AdvisableDictionaryTKey, TValueValueCollection.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public struct Enumerator : IEnumerator<TValue>,
    IDisposable, IEnumerator

The AdvisableDictionaryTKey, TValueValueCollectionEnumerator type exposes the following members.

Properties
 | Name | Description
Public property | Current | Gets the element in the collection at the current position of the enumerator.
Top
Methods
 | Name | Description
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Public method | MoveNext | Advances the enumerator to the next element of the collection.
Top
See Also

Reference

PostSharp.Patterns.Collections Namespace


Enumerator Properties

The AdvisableDictionaryTKey, TValueValueCollectionEnumerator type exposes the following members.

Properties
 | Name | Description
Public property | Current | Gets the element in the collection at the current position of the enumerator.
Top
See Also

Reference

AdvisableDictionaryTKey, TValueValueCollectionEnumerator Structure
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).ValueCollection.Enumerator.Current Property

AdvisableDictionaryTKey, TValueValueCollectionEnumeratorCurrent Property

Gets the element in the collection at the current position of the enumerator.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TValue Current { get; }

Return Value

Type: TValue
The element in the collection at the current position of the enumerator.

Implements

IEnumeratorTCurrent
See Also

Reference

AdvisableDictionaryTKey, TValueValueCollectionEnumerator Structure
PostSharp.Patterns.Collections Namespace


Enumerator Methods

The AdvisableDictionaryTKey, TValueValueCollectionEnumerator type exposes the following members.

Methods
 | Name | Description
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Public method | MoveNext | Advances the enumerator to the next element of the collection.
Top
See Also

Reference

AdvisableDictionaryTKey, TValueValueCollectionEnumerator Structure
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).ValueCollection.Enumerator.Dispose Method

AdvisableDictionaryTKey, TValueValueCollectionEnumeratorDispose Method

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Dispose()

Implements

IDisposableDispose
See Also

Reference

AdvisableDictionaryTKey, TValueValueCollectionEnumerator Structure
PostSharp.Patterns.Collections Namespace


AdvisableDictionary(TKey, TValue).ValueCollection.Enumerator.MoveNext Method

AdvisableDictionaryTKey, TValueValueCollectionEnumeratorMoveNext Method

Advances the enumerator to the next element of the collection.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool MoveNext()

Return Value

Type: Boolean
true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.

Implements

IEnumeratorMoveNext
Exceptions
Exception | Condition
InvalidOperationException | The collection was modified after the enumerator was created.
See Also

Reference

AdvisableDictionaryTKey, TValueValueCollectionEnumerator Structure
PostSharp.Patterns.Collections Namespace


AdvisableHashSet(T) Class

AdvisableHashSetT Class

A collection type similar to HashSetT into which advices can be injected dynamically.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DynamicAdvisingDynamicallyAdvisableObject
PostSharp.Patterns.CollectionsAdvisableHashSetT

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public class AdvisableHashSet<T> : DynamicallyAdvisableObject,
    ISet<T>, ICollection<T>, IEnumerable<T>, IEnumerable, IDynamicallyAdvisableHashSet,
    IDynamicallyAdvisable, IQueryInterface, ICollection

Type Parameters

T
The type of elements in the collection

The AdvisableHashSetT type exposes the following members.

Properties
 | Name | Description
Public property | Comparer | Gets the IEqualityComparerT object that is used to determine equality for the values in the set.
Public property | Count | Gets the number of elements contained in the ICollectionT.
Top
Methods
 | Name | Description
Public method | Add | Adds an element to the current set and returns a value to indicate if the element was successfully added.
Protected method | AddItem | Inserts an element into the underlying set.
Protected method | ChangeManyItems | Modifies the underlying set by adding and removing the specified items.
Public method | Clear | Removes all items from the ICollectionT.
Protected method | ClearItems | Removes all elements from the underlying set.
Public method | Contains | Determines whether the ICollectionT contains a specific value.
Public method | CopyTo(T) | Copies the elements of an AdvisableHashSetT object to an array.
Public method | CopyTo(T, Int32) | Copies the elements of the ICollectionT to an Array, starting at a particular Array index.
Public method | CopyTo(T, Int32, Int32) | Copies the specified number of elements of an AdvisableHashSetT object to an array, starting at the specified array index.
 | CreateSetComparer | Returns an IEqualityComparer object that can be used for equality testing of a AdvisableHashSetT object.
Public method | ExceptWith | Removes all elements in the specified collection from the current set.
Protected method | ExecuteWithAdvicesTResult, TAction | Executes an action wrapped by all custom advices added to the current object. (Inherited from DynamicallyAdvisableObject.)
Protected method | GetAdviceEnumerator | Gets an AdviceEnumeratorT for the ICollectionDynamicAdviceT interface.
Public method | GetEnumerator | Returns an enumerator that iterates through the AdvisableHashSetT.
Public method | GetObjectData | Populates a SerializationInfo with the data needed to serialize the target object. (Overrides DynamicallyAdvisableObjectGetObjectData(SerializationInfo, StreamingContext).)
Protected method | InitializeAdvices | Initializes the list of dynamic advices. (Inherited from DynamicallyAdvisableObject.)
Public method | IntersectWith | Modifies the current set so that it contains only elements that are also in a specified collection.
Public method | IsProperSubsetOf | Determines whether the current set is a proper (strict) subset of a specified collection.
Public method | IsProperSupersetOf | Determines whether the current set is a proper (strict) superset of a specified collection.
Public method | IsSubsetOf | Determines whether a set is a subset of a specified collection.
Public method | IsSupersetOf | Determines whether the current set is a superset of a specified collection.
Public method | OnDeserialization | Runs when the entire object graph has been deserialized. (Overrides DynamicallyAdvisableObjectOnDeserialization(Object).)
Public method | Overlaps | Determines whether the current set overlaps with the specified collection.
Public method | Remove | Removes the first occurrence of a specific object from the ICollectionT.
Protected method | RemoveItem | Removes an element from the underlying collection.
Public method | RemoveWhere | Removes all elements that match the conditions defined by the specified predicate from a HashSetT collection.
Public method | SetEquals | Determines whether the current set and the specified collection contain the same elements.
Public method | SymmetricExceptWith | Modifies the current set so that it contains only elements that are present either in the current set or in the specified collection, but not both.
Public method | TrimExcess | Sets the capacity of a AdvisableHashSetT object to the actual number of elements it contains, rounded up to a nearby, implementation-specific value.
Public method | UnionWith | Modifies the current set so that it contains all elements that are present in the current set, in the specified collection, or in both.
Top
Extension Methods
 | Name | Description
Public Extension Method | ToAdvisableCollectionT | Converts an IEnumerableT into an AdvisableCollectionT. (Defined by Extensions.)
Public Extension Method | ToAdvisableDictionaryT, TKey, TValue | Converts an IEnumerableT into a AdvisableDictionaryTKey, TValue given a method returning the item key and a method returning the item value. (Defined by Extensions.)
Public Extension Method | ToAdvisableHashSetT | Converts an IEnumerableT into an AdvisableHashSetT. (Defined by Extensions.)
Top
Remarks

The API of this class is compatible with the HashSetT class. It provides some additions but preserves the same design and naming conventions.

Classes that derive from HashSetT can add functionalities by overriding protected methods or by defining new public methods. New public methods wrap their logic in a call of the ExecuteWithAdvicesTResult, TAction(ObjectAccessLevel, TAction) method, which applies boundary aspects. Public methods can access the data structure thanks to protected methods, which have a name ending in Item, for instance AddItem(T). Public methods should not use other public methods of the class, as it may cause inconsistent invocation of advises and performance issues.

See Also

Reference

PostSharp.Patterns.Collections Namespace

Other Resources

Conceptual: What's New in PostSharp 4.2
Conceptual: Working With Child Collections


AdvisableHashSet(T) Properties

AdvisableHashSetT Properties

The AdvisableHashSetT generic type exposes the following members.

Properties
 | Name | Description
Public property | Comparer | Gets the IEqualityComparerT object that is used to determine equality for the values in the set.
Public property | Count | Gets the number of elements contained in the ICollectionT.
Top
See Also

Reference

AdvisableHashSetT Class
PostSharp.Patterns.Collections Namespace


AdvisableHashSet(T).Comparer Property

AdvisableHashSetTComparer Property

Gets the IEqualityComparerT object that is used to determine equality for the values in the set.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IEqualityComparer<T> Comparer { get; }

Property Value

Type: IEqualityComparer T
The IEqualityComparerT object that is used to determine equality for the values in the set.
See Also

Reference

AdvisableHashSetT Class
PostSharp.Patterns.Collections Namespace


AdvisableHashSet(T).Count Property

AdvisableHashSetTCount Property

Gets the number of elements contained in the ICollectionT.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int Count { get; }

Return Value

Type: Int32
The number of elements contained in the ICollectionT.

Implements

ICollectionTCount
ICollectionCount
See Also

Reference

AdvisableHashSetT Class
PostSharp.Patterns.Collections Namespace


AdvisableHashSet(T) Methods

AdvisableHashSetT Methods

The AdvisableHashSetT generic type exposes the following members.

Methods
 | Name | Description
Public method | Add | Adds an element to the current set and returns a value to indicate if the element was successfully added.
Protected method | AddItem | Inserts an element into the underlying set.
Protected method | ChangeManyItems | Modifies the underlying set by adding and removing the specified items.
Public method | Clear | Removes all items from the ICollectionT.
Protected method | ClearItems | Removes all elements from the underlying set.
Public method | Contains | Determines whether the ICollectionT contains a specific value.
Public method | CopyTo(T) | Copies the elements of an AdvisableHashSetT object to an array.
Public method | CopyTo(T, Int32) | Copies the elements of the ICollectionT to an Array, starting at a particular Array index.
Public method | CopyTo(T, Int32, Int32) | Copies the specified number of elements of an AdvisableHashSetT object to an array, starting at the specified array index.
 | CreateSetComparer | Returns an IEqualityComparer object that can be used for equality testing of a AdvisableHashSetT object.
Public method | ExceptWith | Removes all elements in the specified collection from the current set.
Protected method | ExecuteWithAdvicesTResult, TAction | Executes an action wrapped by all custom advices added to the current object. (Inherited from DynamicallyAdvisableObject.)
Protected method | GetAdviceEnumerator | Gets an AdviceEnumeratorT for the ICollectionDynamicAdviceT interface.
Public method | GetEnumerator | Returns an enumerator that iterates through the AdvisableHashSetT.
Public method | GetObjectData | Populates a SerializationInfo with the data needed to serialize the target object. (Overrides DynamicallyAdvisableObjectGetObjectData(SerializationInfo, StreamingContext).)
Protected method | InitializeAdvices | Initializes the list of dynamic advices. (Inherited from DynamicallyAdvisableObject.)
Public method | IntersectWith | Modifies the current set so that it contains only elements that are also in a specified collection.
Public method | IsProperSubsetOf | Determines whether the current set is a proper (strict) subset of a specified collection.
Public method | IsProperSupersetOf | Determines whether the current set is a proper (strict) superset of a specified collection.
Public method | IsSubsetOf | Determines whether a set is a subset of a specified collection.
Public method | IsSupersetOf | Determines whether the current set is a superset of a specified collection.
Public method | OnDeserialization | Runs when the entire object graph has been deserialized. (Overrides DynamicallyAdvisableObjectOnDeserialization(Object).)
Public method | Overlaps | Determines whether the current set overlaps with the specified collection.
Public method | Remove | Removes the first occurrence of a specific object from the ICollectionT.
Protected method | RemoveItem | Removes an element from the underlying collection.
Public method | RemoveWhere | Removes all elements that match the conditions defined by the specified predicate from a HashSetT collection.
Public method | SetEquals | Determines whether the current set and the specified collection contain the same elements.
Public method | SymmetricExceptWith | Modifies the current set so that it contains only elements that are present either in the current set or in the specified collection, but not both.
Public method | TrimExcess | Sets the capacity of a AdvisableHashSetT object to the actual number of elements it contains, rounded up to a nearby, implementation-specific value.
Public method | UnionWith | Modifies the current set so that it contains all elements that are present in the current set, in the specified collection, or in both.
Top
Extension Methods
 | Name | Description
Public Extension Method | ToAdvisableCollectionT | Converts an IEnumerableT into an AdvisableCollectionT. (Defined by Extensions.)
Public Extension Method | ToAdvisableDictionaryT, TKey, TValue | Converts an IEnumerableT into a AdvisableDictionaryTKey, TValue given a method returning the item key and a method returning the item value. (Defined by Extensions.)
Public Extension Method | ToAdvisableHashSetT | Converts an IEnumerableT into an AdvisableHashSetT. (Defined by Extensions.)
Top
See Also

Reference

AdvisableHashSetT Class
PostSharp.Patterns.Collections Namespace


AdvisableHashSet(T).Add Method

AdvisableHashSetTAdd Method

Adds an element to the current set and returns a value to indicate if the element was successfully added.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Add(
    T item
)

Parameters

item
Type: T
The element to add to the set.

Return Value

Type: Boolean
true if the element is added to the set; false if the element is already in the set.

Implements

ISetTAdd(T)
See Also

Reference

AdvisableHashSetT Class
PostSharp.Patterns.Collections Namespace


AdvisableHashSet(T).AddItem Method

AdvisableHashSetTAddItem Method

Inserts an element into the underlying set.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void AddItem(
    T item
)

Parameters

item
Type: T
The object to insert. The value can be null for reference types.
Remarks

Note Note
This method does not cause the advices to be executed. It should be invoked only from inside the scope of the ExecuteWithAdvices method.

See Also

Reference

AdvisableHashSetT Class
PostSharp.Patterns.Collections Namespace


AdvisableHashSet(T).ChangeManyItems Method

AdvisableHashSetTChangeManyItems Method

Modifies the underlying set by adding and removing the specified items.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void ChangeManyItems(
    IList<T> itemsToAdd,
    IList<T> itemsToRemove
)

Parameters

itemsToAdd
Type: System.Collections.GenericIList T
The objects to insert. The value can be null for reference types.
itemsToRemove
Type: System.Collections.GenericIList T
The objects to remove. The value can be null for reference types.
Remarks

Note Note
This method does not cause the advices to be executed. It should be invoked only from inside the scope of the ExecuteWithAdvices method.

See Also

Reference

AdvisableHashSetT Class
PostSharp.Patterns.Collections Namespace


AdvisableHashSet(T).Clear Method

AdvisableHashSetTClear Method

Removes all items from the ICollectionT.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Clear()

Implements

ICollectionTClear
Exceptions
Exception | Condition
NotSupportedException | The ICollectionT is read-only.
See Also

Reference

AdvisableHashSetT Class
PostSharp.Patterns.Collections Namespace


AdvisableHashSet(T).ClearItems Method

AdvisableHashSetTClearItems Method

Removes all elements from the underlying set.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void ClearItems()
Remarks

Note Note
This method does not cause the advices to be executed. It should be invoked only from inside the scope of the ExecuteWithAdvices method.

See Also

Reference

AdvisableHashSetT Class
PostSharp.Patterns.Collections Namespace


AdvisableHashSet(T).Contains Method

AdvisableHashSetTContains Method

Determines whether the ICollectionT contains a specific value.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Contains(
    T item
)

Parameters

item
Type: T
The object to locate in the ICollectionT.

Return Value

Type: Boolean
true if item is found in the ICollectionT; otherwise, false.

Implements

ICollectionTContains(T)
See Also

Reference

AdvisableHashSetT Class
PostSharp.Patterns.Collections Namespace


AdvisableHashSet(T).CopyTo Method

AdvisableHashSetTCopyTo Method

Overload List
 | Name | Description
Public method | CopyTo(T) | Copies the elements of an AdvisableHashSetT object to an array.
Public method | CopyTo(T, Int32) | Copies the elements of the ICollectionT to an Array, starting at a particular Array index.
Public method | CopyTo(T, Int32, Int32) | Copies the specified number of elements of an AdvisableHashSetT object to an array, starting at the specified array index.
Top
See Also

Reference

AdvisableHashSetT Class
PostSharp.Patterns.Collections Namespace


AdvisableHashSet(T).CopyTo Method (T[])

AdvisableHashSetTCopyTo Method (T)

Copies the elements of an AdvisableHashSetT object to an array.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void CopyTo(
    T[] array
)

Parameters

array
Type: T
The one-dimensional array that is the destination of the elements copied from the AdvisableHashSetT object. The array must have zero-based indexing.
Exceptions
Exception | Condition
ArgumentNullException | array is null.
See Also

Reference

AdvisableHashSetT Class
CopyTo Overload
PostSharp.Patterns.Collections Namespace


AdvisableHashSet(T).CopyTo Method (T[], Int32)

AdvisableHashSetTCopyTo Method (T, Int32)

Copies the elements of the ICollectionT to an Array, starting at a particular Array index.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void CopyTo(
    T[] array,
    int arrayIndex
)

Parameters

array
Type: T
The one-dimensional Array that is the destination of the elements copied from ICollectionT. The Array must have zero-based indexing.
arrayIndex
Type: SystemInt32
The zero-based index in array at which copying begins.

Implements

ICollectionTCopyTo(T, Int32)
Exceptions
Exception | Condition
ArgumentNullException | array is null.
ArgumentOutOfRangeException | arrayIndex is less than 0.
ArgumentException | The number of elements in the source ICollectionT is greater than the available space from arrayIndex to the end of the destination array.
See Also

Reference

AdvisableHashSetT Class
CopyTo Overload
PostSharp.Patterns.Collections Namespace


AdvisableHashSet(T).CopyTo Method (T[], Int32, Int32)

AdvisableHashSetTCopyTo Method (T, Int32, Int32)

Copies the specified number of elements of an AdvisableHashSetT object to an array, starting at the specified array index.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void CopyTo(
    T[] array,
    int arrayIndex,
    int count
)

Parameters

array
Type: T
The one-dimensional array that is the destination of the elements copied from the AdvisableHashSetT object. The array must have zero-based indexing.
arrayIndex
Type: SystemInt32
The zero-based index in array at which copying begins.
count
Type: SystemInt32
The number of elements to copy to array.
Exceptions
Exception | Condition
ArgumentNullException | array is null.
ArgumentOutOfRangeException | arrayIndex is less than 0. -or- count is less than 0.
ArgumentException | arrayIndex is greater than the length of the destination array. -or- count is greater than the available space from the arrayIndex to the end of the destination array.
See Also

Reference

AdvisableHashSetT Class
CopyTo Overload
PostSharp.Patterns.Collections Namespace


AdvisableHashSet(T).CreateSetComparer Method

AdvisableHashSetTCreateSetComparer Method

Returns an IEqualityComparer object that can be used for equality testing of a AdvisableHashSetT object.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static IEqualityComparer<AdvisableHashSet<T>> CreateSetComparer()

Return Value

Type: IEqualityComparer AdvisableHashSet T
An IEqualityComparer object that can be used for deep equality testing of the HashSetT object.
Remarks

The IEqualityComparer object checks for equality at only one level; however, you can chain together comparers at additional levels to perform deeper equality testing.

See Also

Reference

AdvisableHashSetT Class
PostSharp.Patterns.Collections Namespace


AdvisableHashSet(T).ExceptWith Method

AdvisableHashSetTExceptWith Method

Removes all elements in the specified collection from the current set.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void ExceptWith(
    IEnumerable<T> other
)

Parameters

other
Type: System.Collections.GenericIEnumerable T
The collection of items to remove from the set.

Implements

ISetTExceptWith(IEnumerableT)
Exceptions
Exception | Condition
ArgumentNullException | other is null.
See Also

Reference

AdvisableHashSetT Class
PostSharp.Patterns.Collections Namespace


AdvisableHashSet(T).GetAdviceEnumerator Method

AdvisableHashSetTGetAdviceEnumerator Method

Gets an AdviceEnumeratorT for the ICollectionDynamicAdviceT interface.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected AdviceEnumerator<IHashSetDynamicAdvice<T>> GetAdviceEnumerator()

Return Value

Type: AdviceEnumerator IHashSetDynamicAdvice T
See Also

Reference

AdvisableHashSetT Class
PostSharp.Patterns.Collections Namespace


AdvisableHashSet(T).GetEnumerator Method

AdvisableHashSetTGetEnumerator Method

Returns an enumerator that iterates through the AdvisableHashSetT.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AdvisableHashSetTEnumerator GetEnumerator()

Return Value

Type: AdvisableHashSetTEnumerator
An AdvisableHashSetTEnumerator for the AdvisableHashSetT.
See Also

Reference

AdvisableHashSetT Class
PostSharp.Patterns.Collections Namespace


AdvisableHashSet(T).GetObjectData Method

AdvisableHashSetTGetObjectData Method

Populates a SerializationInfo with the data needed to serialize the target object.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void GetObjectData(
    SerializationInfo info,
    StreamingContext context
)

Parameters

info
Type: System.Runtime.SerializationSerializationInfo
The SerializationInfo to populate with data.
context
Type: System.Runtime.SerializationStreamingContext
The destination (see StreamingContext) for this serialization.

Implements

ISerializableGetObjectData(SerializationInfo, StreamingContext)
Exceptions
Exception | Condition
SecurityException | The caller does not have the required permission.
See Also

Reference

AdvisableHashSetT Class
PostSharp.Patterns.Collections Namespace


AdvisableHashSet(T).IntersectWith Method

AdvisableHashSetTIntersectWith Method

Modifies the current set so that it contains only elements that are also in a specified collection.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void IntersectWith(
    IEnumerable<T> other
)

Parameters

other
Type: System.Collections.GenericIEnumerable T
The collection to compare to the current set.

Implements

ISetTIntersectWith(IEnumerableT)
Exceptions
Exception | Condition
ArgumentNullException | other is null.
See Also

Reference

AdvisableHashSetT Class
PostSharp.Patterns.Collections Namespace


AdvisableHashSet(T).IsProperSubsetOf Method

AdvisableHashSetTIsProperSubsetOf Method

Determines whether the current set is a proper (strict) subset of a specified collection.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsProperSubsetOf(
    IEnumerable<T> other
)

Parameters

other
Type: System.Collections.GenericIEnumerable T
The collection to compare to the current set.

Return Value

Type: Boolean
true if the current set is a proper subset of other; otherwise, false.

Implements

ISetTIsProperSubsetOf(IEnumerableT)
Exceptions
Exception | Condition
ArgumentNullException | other is null.
See Also

Reference

AdvisableHashSetT Class
PostSharp.Patterns.Collections Namespace


AdvisableHashSet(T).IsProperSupersetOf Method

AdvisableHashSetTIsProperSupersetOf Method

Determines whether the current set is a proper (strict) superset of a specified collection.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsProperSupersetOf(
    IEnumerable<T> other
)

Parameters

other
Type: System.Collections.GenericIEnumerable T
The collection to compare to the current set.

Return Value

Type: Boolean
true if the current set is a proper superset of other; otherwise, false.

Implements

ISetTIsProperSupersetOf(IEnumerableT)
Exceptions
Exception | Condition
ArgumentNullException | other is null.
See Also

Reference

AdvisableHashSetT Class
PostSharp.Patterns.Collections Namespace


AdvisableHashSet(T).IsSubsetOf Method

AdvisableHashSetTIsSubsetOf Method

Determines whether a set is a subset of a specified collection.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsSubsetOf(
    IEnumerable<T> other
)

Parameters

other
Type: System.Collections.GenericIEnumerable T
The collection to compare to the current set.

Return Value

Type: Boolean
true if the current set is a subset of other; otherwise, false.

Implements

ISetTIsSubsetOf(IEnumerableT)
Exceptions
Exception | Condition
ArgumentNullException | other is null.
See Also

Reference

AdvisableHashSetT Class
PostSharp.Patterns.Collections Namespace


AdvisableHashSet(T).IsSupersetOf Method

AdvisableHashSetTIsSupersetOf Method

Determines whether the current set is a superset of a specified collection.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsSupersetOf(
    IEnumerable<T> other
)

Parameters

other
Type: System.Collections.GenericIEnumerable T
The collection to compare to the current set.

Return Value

Type: Boolean
true if the current set is a superset of other; otherwise, false.

Implements

ISetTIsSupersetOf(IEnumerableT)
Exceptions
Exception | Condition
ArgumentNullException | other is null.
See Also

Reference

AdvisableHashSetT Class
PostSharp.Patterns.Collections Namespace


AdvisableHashSet(T).OnDeserialization Method

AdvisableHashSetTOnDeserialization Method

Runs when the entire object graph has been deserialized.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void OnDeserialization(
    Object sender
)

Parameters

sender
Type: SystemObject
The object that initiated the callback. The functionality for this parameter is not currently implemented.

Implements

IDeserializationCallbackOnDeserialization(Object)
See Also

Reference

AdvisableHashSetT Class
PostSharp.Patterns.Collections Namespace


AdvisableHashSet(T).Overlaps Method

AdvisableHashSetTOverlaps Method

Determines whether the current set overlaps with the specified collection.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Overlaps(
    IEnumerable<T> other
)

Parameters

other
Type: System.Collections.GenericIEnumerable T
The collection to compare to the current set.

Return Value

Type: Boolean
true if the current set and other share at least one common element; otherwise, false.

Implements

ISetTOverlaps(IEnumerableT)
Exceptions
Exception | Condition
ArgumentNullException | other is null.
See Also

Reference

AdvisableHashSetT Class
PostSharp.Patterns.Collections Namespace


AdvisableHashSet(T).Remove Method

AdvisableHashSetTRemove Method

Removes the first occurrence of a specific object from the ICollectionT.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Remove(
    T item
)

Parameters

item
Type: T
The object to remove from the ICollectionT.

Return Value

Type: Boolean
true if item was successfully removed from the ICollectionT; otherwise, false. This method also returns false if item is not found in the original ICollectionT.

Implements

ICollectionTRemove(T)
Exceptions
Exception | Condition
NotSupportedException | The ICollectionT is read-only.
See Also

Reference

AdvisableHashSetT Class
PostSharp.Patterns.Collections Namespace


AdvisableHashSet(T).RemoveItem Method

AdvisableHashSetTRemoveItem Method

Removes an element from the underlying collection.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void RemoveItem(
    T item
)

Parameters

item
Type: T
The object to remove. The value can be null for reference types.
Remarks

Note Note
This method does not cause the advices to be executed. It should be invoked only from inside the scope of the ExecuteWithAdvices method.

See Also

Reference

AdvisableHashSetT Class
PostSharp.Patterns.Collections Namespace


AdvisableHashSet(T).RemoveWhere Method

AdvisableHashSetTRemoveWhere Method

Removes all elements that match the conditions defined by the specified predicate from a HashSetT collection.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int RemoveWhere(
    Predicate<T> match
)

Parameters

match
Type: SystemPredicate T
The PredicateT delegate that defines the conditions of the elements to remove.

Return Value

Type: Int32
The number of elements that were removed from the HashSetT collection.
Exceptions
Exception | Condition
ArgumentNullException | match is null.
See Also

Reference

AdvisableHashSetT Class
PostSharp.Patterns.Collections Namespace


AdvisableHashSet(T).SetEquals Method

AdvisableHashSetTSetEquals Method

Determines whether the current set and the specified collection contain the same elements.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool SetEquals(
    IEnumerable<T> other
)

Parameters

other
Type: System.Collections.GenericIEnumerable T
The collection to compare to the current set.

Return Value

Type: Boolean
true if the current set is equal to other; otherwise, false.

Implements

ISetTSetEquals(IEnumerableT)
Exceptions
Exception | Condition
ArgumentNullException | other is null.
See Also

Reference

AdvisableHashSetT Class
PostSharp.Patterns.Collections Namespace


AdvisableHashSet(T).SymmetricExceptWith Method

AdvisableHashSetTSymmetricExceptWith Method

Modifies the current set so that it contains only elements that are present either in the current set or in the specified collection, but not both.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void SymmetricExceptWith(
    IEnumerable<T> other
)

Parameters

other
Type: System.Collections.GenericIEnumerable T
The collection to compare to the current set.

Implements

ISetTSymmetricExceptWith(IEnumerableT)
Exceptions
Exception | Condition
ArgumentNullException | other is null.
See Also

Reference

AdvisableHashSetT Class
PostSharp.Patterns.Collections Namespace


AdvisableHashSet(T).TrimExcess Method

AdvisableHashSetTTrimExcess Method

Sets the capacity of a AdvisableHashSetT object to the actual number of elements it contains, rounded up to a nearby, implementation-specific value.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void TrimExcess()
See Also

Reference

AdvisableHashSetT Class
PostSharp.Patterns.Collections Namespace


AdvisableHashSet(T).UnionWith Method

AdvisableHashSetTUnionWith Method

Modifies the current set so that it contains all elements that are present in the current set, in the specified collection, or in both.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void UnionWith(
    IEnumerable<T> other
)

Parameters

other
Type: System.Collections.GenericIEnumerable T
The collection to compare to the current set.

Implements

ISetTUnionWith(IEnumerableT)
Exceptions
Exception | Condition
ArgumentNullException | other is null.
See Also

Reference

AdvisableHashSetT Class
PostSharp.Patterns.Collections Namespace


AdvisableHashSet(T).Enumerator Structure

AdvisableHashSetTEnumerator Structure

Enumerator for the AdvisableHashSetT class.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public struct Enumerator : IEnumerator<T>,
    IDisposable, IEnumerator

The AdvisableHashSetTEnumerator generic type exposes the following members.

Properties
 | Name | Description
Public property | Current | Gets the element in the collection at the current position of the enumerator.
Top
Methods
 | Name | Description
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Public method | MoveNext | Advances the enumerator to the next element of the collection.
Top
See Also

Reference

PostSharp.Patterns.Collections Namespace


Enumerator Properties

The AdvisableHashSetTEnumerator type exposes the following members.

Properties
 | Name | Description
Public property | Current | Gets the element in the collection at the current position of the enumerator.
Top
See Also

Reference

AdvisableHashSetTEnumerator Structure
PostSharp.Patterns.Collections Namespace


AdvisableHashSet(T).Enumerator.Current Property

AdvisableHashSetTEnumeratorCurrent Property

Gets the element in the collection at the current position of the enumerator.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public T Current { get; }

Return Value

Type: T
The element in the collection at the current position of the enumerator.

Implements

IEnumeratorTCurrent
See Also

Reference

AdvisableHashSetTEnumerator Structure
PostSharp.Patterns.Collections Namespace


Enumerator Methods

The AdvisableHashSetTEnumerator type exposes the following members.

Methods
 | Name | Description
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Public method | MoveNext | Advances the enumerator to the next element of the collection.
Top
See Also

Reference

AdvisableHashSetTEnumerator Structure
PostSharp.Patterns.Collections Namespace


AdvisableHashSet(T).Enumerator.Dispose Method

AdvisableHashSetTEnumeratorDispose Method

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Dispose()

Implements

IDisposableDispose
See Also

Reference

AdvisableHashSetTEnumerator Structure
PostSharp.Patterns.Collections Namespace


AdvisableHashSet(T).Enumerator.MoveNext Method

AdvisableHashSetTEnumeratorMoveNext Method

Advances the enumerator to the next element of the collection.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool MoveNext()

Return Value

Type: Boolean
true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.

Implements

IEnumeratorMoveNext
Exceptions
Exception | Condition
InvalidOperationException | The collection was modified after the enumerator was created.
See Also

Reference

AdvisableHashSetTEnumerator Structure
PostSharp.Patterns.Collections Namespace


AdvisableKeyedCollection(TKey, TItem) Class

AdvisableKeyedCollectionTKey, TItem Class

Provides the abstract base class for a keyed collection, similar to KeyedCollectionTKey, TItem, into which advices can be injected dynamically.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DynamicAdvisingDynamicallyAdvisableObject
PostSharp.Patterns.CollectionsAdvisableCollection TItem
PostSharp.Patterns.CollectionsAdvisableKeyedCollectionTKey, TItem

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public abstract class AdvisableKeyedCollection<TKey, TItem> : AdvisableCollection<TItem>

Type Parameters

TKey
The type of keys in the collection.
TItem
The type of values in the collection.

The AdvisableKeyedCollectionTKey, TItem type exposes the following members.

Constructors
 | Name | Description
Protected method | AdvisableKeyedCollectionTKey, TItem | Initializes a new instance of the AdvisableKeyedCollectionTKey, TItem class that is empty and has the default initial capacity.
Protected method | AdvisableKeyedCollectionTKey, TItem(Int32) | Initializes a new instance of the AdvisableKeyedCollectionTKey, TItem class that is empty and has a specified initial capacity.
Protected method | AdvisableKeyedCollectionTKey, TItem(Int32, IEqualityComparerTKey) | Initializes a new instance of the AdvisableKeyedCollectionTKey, TItem class that has a specified initial capacity and a given equality comparer and uses the specified equality comparer.
Protected method | AdvisableKeyedCollectionTKey, TItem(SerializationInfo, StreamingContext) | Deserialization constructor.
Top
Properties
 | Name | Description
Protected property | Comparer | Gets the generic equality comparer that is used to determine equality of keys in the collection.
Public property | Count | Gets the number of elements contained in the ICollectionT. (Inherited from AdvisableCollectionT.)
Public property | IsReadOnly | Gets a value indicating whether the ICollectionT is read-only. (Inherited from AdvisableCollectionT.)
Public property | ItemInt32 | Gets or sets the element at the specified index. (Inherited from AdvisableCollectionT.)
Public property | ItemTKey | Gets or sets the element with the specified key.
Top
Methods
 | Name | Description
Public method | Add | Adds an item to the ICollectionT. (Inherited from AdvisableCollectionT.)
Public method | AddRange | Adds the elements of the specified collection to the end of the AdvisableCollectionT. (Inherited from AdvisableCollectionT.)
Public method | Clear | Removes all items from the ICollectionT. (Inherited from AdvisableCollectionT.)
Protected method | ClearItems | Removes all elements from the underlying collection. (Overrides AdvisableCollectionTClearItems.)
Public method | Contains(T) | Determines whether the ICollectionT contains a specific value. (Inherited from AdvisableCollectionT.)
Public method | Contains(TKey) | Determines whether the collection contains an element with the specified key.
Public method | CopyTo | Copies the elements of the ICollectionT to an Array, starting at a particular Array index. (Inherited from AdvisableCollectionT.)
Protected method | ExecuteWithAdvicesTResult, TAction | Executes an action wrapped by all custom advices added to the current object. (Inherited from DynamicallyAdvisableObject.)
Protected method | GetAdviceEnumerator | Gets an AdviceEnumeratorT for the ICollectionDynamicAdviceT interface. (Inherited from AdvisableCollectionT.)
Protected method | GetCount | Gets the number of elements in the underlying collection. (Inherited from AdvisableCollectionT.)
Public method | GetEnumerator | Returns an enumerator that iterates through the AdvisableCollectionT. (Inherited from AdvisableCollectionT.)
Protected method | GetItem | Gets the element at the specified index of the underlying collection. (Inherited from AdvisableCollectionT.)
Protected method | GetKeyForItem | Extracts the key from the specified element.
Public method | GetObjectData | Populates a SerializationInfo with the data needed to serialize the target object. (Overrides AdvisableCollectionTGetObjectData(SerializationInfo, StreamingContext).)
Public method | GetRange | Creates a shallow copy of a range of elements in the source AdvisableCollectionT. (Inherited from AdvisableCollectionT.)
Public method | IndexOf | Determines the index of a specific item in the IListT. (Inherited from AdvisableCollectionT.)
Protected method | IndexOfItem | Searches for the specified object and returns the zero-based index of the first occurrence within the entire underlying collection. (Overrides AdvisableCollectionTIndexOfItem(T).)
Protected method | InitializeAdvices | Initializes the list of dynamic advices. (Inherited from DynamicallyAdvisableObject.)
Public method | Insert | Inserts an item to the IListT at the specified index. (Inherited from AdvisableCollectionT.)
Protected method | InsertItem | Inserts an element into the underlying collection at the specified index. (Overrides AdvisableCollectionTInsertItem(Int32, T).)
Protected method | InsertItems | Inserts elements into the underlying collection at the specified index. (Overrides AdvisableCollectionTInsertItems(Int32, T).)
Public method | InsertRange | Inserts the elements of a collection into the AdvisableCollectionT at the specified index. (Inherited from AdvisableCollectionT.)
Public method | Move | Moved the element at the specified index to another index. (Inherited from AdvisableCollectionT.)
Protected method | MoveItem | Moves the element at the specified index to another index in the underlying collection. (Overrides AdvisableCollectionTMoveItem(T, Int32, Int32).)
Public method | OnDeserialization | Runs when the entire object graph has been deserialized. (Inherited from AdvisableCollectionT.)
Protected method | RaiseEvents | Raised the events that have been buffered. (Inherited from AdvisableCollectionT.)
Public method | Remove | Removes the first occurrence of a specific object from the ICollectionT. (Inherited from AdvisableCollectionT.)
Public method | RemoveAt | Removes the IListT item at the specified index. (Inherited from AdvisableCollectionT.)
Protected method | RemoveItem | Removes the element at the specified index of the underlying collection. (Overrides AdvisableCollectionTRemoveItem(Int32).)
Protected method | RemoveItems | Removes the specified number of elements starting at the specified index of the underlying collection. (Overrides AdvisableCollectionTRemoveItems(Int32, Int32).)
Public method | RemoveRange | Removes a range of elements from the AdvisableCollectionT. (Inherited from AdvisableCollectionT.)
Protected method | SetItem | Replaces the element at the specified index of the underlying collection. (Overrides AdvisableCollectionTSetItem(Int32, T).)
Public method | ToArray | Creates an array from the current AdvisableCollectionT. (Inherited from AdvisableCollectionT.)
Top
Events
 | Name | Description
Public event | CollectionChanged | Occurs when the collection changes. (Inherited from AdvisableCollectionT.)
Public event | PropertyChanged | Event raised when the value of a property of the current object changes. (Inherited from AdvisableCollectionT.)
Top
Remarks

The API of this class is compatible with the KeyedCollectionTKey, TItem class.

To learn how to extend this class, see the AdvisableCollectionT class documentation.

See Also

Reference

PostSharp.Patterns.Collections Namespace

Other Resources

Conceptual: Annotating an Object Model for Parent/Child Relationships (Aggregatable)
Conceptual: Working With Child Collections


AdvisableKeyedCollection(TKey, TItem) Constructor

AdvisableKeyedCollectionTKey, TItem Constructor

Overload List
 | Name | Description
Protected method | AdvisableKeyedCollectionTKey, TItem | Initializes a new instance of the AdvisableKeyedCollectionTKey, TItem class that is empty and has the default initial capacity.
Protected method | AdvisableKeyedCollectionTKey, TItem(Int32) | Initializes a new instance of the AdvisableKeyedCollectionTKey, TItem class that is empty and has a specified initial capacity.
Protected method | AdvisableKeyedCollectionTKey, TItem(Int32, IEqualityComparerTKey) | Initializes a new instance of the AdvisableKeyedCollectionTKey, TItem class that has a specified initial capacity and a given equality comparer and uses the specified equality comparer.
Protected method | AdvisableKeyedCollectionTKey, TItem(SerializationInfo, StreamingContext) | Deserialization constructor.
Top
See Also

Reference

AdvisableKeyedCollectionTKey, TItem Class
PostSharp.Patterns.Collections Namespace


AdvisableKeyedCollection(TKey, TItem) Constructor

AdvisableKeyedCollectionTKey, TItem Constructor

Initializes a new instance of the AdvisableKeyedCollectionTKey, TItem class that is empty and has the default initial capacity.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected AdvisableKeyedCollection()
See Also

Reference

AdvisableKeyedCollectionTKey, TItem Class
AdvisableKeyedCollectionTKey, TItem Overload
PostSharp.Patterns.Collections Namespace


AdvisableKeyedCollection(TKey, TItem) Constructor (Int32)

AdvisableKeyedCollectionTKey, TItem Constructor (Int32)

Initializes a new instance of the AdvisableKeyedCollectionTKey, TItem class that is empty and has a specified initial capacity.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected AdvisableKeyedCollection(
    int capacity
)

Parameters

capacity
Type: SystemInt32
The number of elements the collection can contain before it must be resized.
See Also

Reference

AdvisableKeyedCollectionTKey, TItem Class
AdvisableKeyedCollectionTKey, TItem Overload
PostSharp.Patterns.Collections Namespace


AdvisableKeyedCollection(TKey, TItem) Constructor (Int32, IEqualityComparer(TKey))

AdvisableKeyedCollectionTKey, TItem Constructor (Int32, IEqualityComparerTKey)

Initializes a new instance of the AdvisableKeyedCollectionTKey, TItem class that has a specified initial capacity and a given equality comparer and uses the specified equality comparer.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected AdvisableKeyedCollection(
    int capacity,
    IEqualityComparer<TKey> comparer
)

Parameters

capacity
Type: SystemInt32
The number of elements the collection can contain before it must be resized.
comparer
Type: System.Collections.GenericIEqualityComparer TKey
The implementation of the IEqualityComparerT generic interface to use when comparing keys, or null to use the default equality comparer for the type of the key.
See Also

Reference

AdvisableKeyedCollectionTKey, TItem Class
AdvisableKeyedCollectionTKey, TItem Overload
PostSharp.Patterns.Collections Namespace


AdvisableKeyedCollection(TKey, TItem) Constructor (SerializationInfo, StreamingContext)

AdvisableKeyedCollectionTKey, TItem Constructor (SerializationInfo, StreamingContext)

Deserialization constructor.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected AdvisableKeyedCollection(
    SerializationInfo info,
    StreamingContext context
)

Parameters

info
Type: System.Runtime.SerializationSerializationInfo
context
Type: System.Runtime.SerializationStreamingContext
See Also

Reference

AdvisableKeyedCollectionTKey, TItem Class
AdvisableKeyedCollectionTKey, TItem Overload
PostSharp.Patterns.Collections Namespace


AdvisableKeyedCollection(TKey, TItem) Properties

AdvisableKeyedCollectionTKey, TItem Properties

The AdvisableKeyedCollectionTKey, TItem generic type exposes the following members.

Properties
 | Name | Description
Protected property | Comparer | Gets the generic equality comparer that is used to determine equality of keys in the collection.
Public property | Count | Gets the number of elements contained in the ICollectionT. (Inherited from AdvisableCollectionT.)
Public property | IsReadOnly | Gets a value indicating whether the ICollectionT is read-only. (Inherited from AdvisableCollectionT.)
Public property | ItemInt32 | Gets or sets the element at the specified index. (Inherited from AdvisableCollectionT.)
Public property | ItemTKey | Gets or sets the element with the specified key.
Top
See Also

Reference

AdvisableKeyedCollectionTKey, TItem Class
PostSharp.Patterns.Collections Namespace


AdvisableKeyedCollection(TKey, TItem).Comparer Property

AdvisableKeyedCollectionTKey, TItemComparer Property

Gets the generic equality comparer that is used to determine equality of keys in the collection.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected IEqualityComparer<TKey> Comparer { get; }

Property Value

Type: IEqualityComparer TKey
See Also

Reference

AdvisableKeyedCollectionTKey, TItem Class
PostSharp.Patterns.Collections Namespace


AdvisableKeyedCollection(TKey, TItem).Item Property

AdvisableKeyedCollectionTKey, TItemItem Property

Overload List
 | Name | Description
Public property | ItemInt32 | Gets or sets the element at the specified index. (Inherited from AdvisableCollectionT.)
Public property | ItemTKey | Gets or sets the element with the specified key.
Top
See Also

Reference

AdvisableKeyedCollectionTKey, TItem Class
PostSharp.Patterns.Collections Namespace


AdvisableKeyedCollection(TKey, TItem).Item Property (TKey)

AdvisableKeyedCollectionTKey, TItemItem Property (TKey)

Gets or sets the element with the specified key.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TItem this[
    TKey key
] { get; set; }

Parameters

key
Type: TKey
The key of the element.

Return Value

Type: TItem
The element whose key is key.
Remarks
When setting this property, the key of the new value should be identical to the value of the key parameter.
See Also

Reference

AdvisableKeyedCollectionTKey, TItem Class
Item Overload
PostSharp.Patterns.Collections Namespace


AdvisableKeyedCollection(TKey, TItem) Methods

AdvisableKeyedCollectionTKey, TItem Methods

The AdvisableKeyedCollectionTKey, TItem generic type exposes the following members.

Methods
 | Name | Description
Public method | Add | Adds an item to the ICollectionT. (Inherited from AdvisableCollectionT.)
Public method | AddRange | Adds the elements of the specified collection to the end of the AdvisableCollectionT. (Inherited from AdvisableCollectionT.)
Public method | Clear | Removes all items from the ICollectionT. (Inherited from AdvisableCollectionT.)
Protected method | ClearItems | Removes all elements from the underlying collection. (Overrides AdvisableCollectionTClearItems.)
Public method | Contains(T) | Determines whether the ICollectionT contains a specific value. (Inherited from AdvisableCollectionT.)
Public method | Contains(TKey) | Determines whether the collection contains an element with the specified key.
Public method | CopyTo | Copies the elements of the ICollectionT to an Array, starting at a particular Array index. (Inherited from AdvisableCollectionT.)
Protected method | ExecuteWithAdvicesTResult, TAction | Executes an action wrapped by all custom advices added to the current object. (Inherited from DynamicallyAdvisableObject.)
Protected method | GetAdviceEnumerator | Gets an AdviceEnumeratorT for the ICollectionDynamicAdviceT interface. (Inherited from AdvisableCollectionT.)
Protected method | GetCount | Gets the number of elements in the underlying collection. (Inherited from AdvisableCollectionT.)
Public method | GetEnumerator | Returns an enumerator that iterates through the AdvisableCollectionT. (Inherited from AdvisableCollectionT.)
Protected method | GetItem | Gets the element at the specified index of the underlying collection. (Inherited from AdvisableCollectionT.)
Protected method | GetKeyForItem | Extracts the key from the specified element.
Public method | GetObjectData | Populates a SerializationInfo with the data needed to serialize the target object. (Overrides AdvisableCollectionTGetObjectData(SerializationInfo, StreamingContext).)
Public method | GetRange | Creates a shallow copy of a range of elements in the source AdvisableCollectionT. (Inherited from AdvisableCollectionT.)
Public method | IndexOf | Determines the index of a specific item in the IListT. (Inherited from AdvisableCollectionT.)
Protected method | IndexOfItem | Searches for the specified object and returns the zero-based index of the first occurrence within the entire underlying collection. (Overrides AdvisableCollectionTIndexOfItem(T).)
Protected method | InitializeAdvices | Initializes the list of dynamic advices. (Inherited from DynamicallyAdvisableObject.)
Public method | Insert | Inserts an item to the IListT at the specified index. (Inherited from AdvisableCollectionT.)
Protected method | InsertItem | Inserts an element into the underlying collection at the specified index. (Overrides AdvisableCollectionTInsertItem(Int32, T).)
Protected method | InsertItems | Inserts elements into the underlying collection at the specified index. (Overrides AdvisableCollectionTInsertItems(Int32, T).)
Public method | InsertRange | Inserts the elements of a collection into the AdvisableCollectionT at the specified index. (Inherited from AdvisableCollectionT.)
Public method | Move | Moved the element at the specified index to another index. (Inherited from AdvisableCollectionT.)
Protected method | MoveItem | Moves the element at the specified index to another index in the underlying collection. (Overrides AdvisableCollectionTMoveItem(T, Int32, Int32).)
Public method | OnDeserialization | Runs when the entire object graph has been deserialized. (Inherited from AdvisableCollectionT.)
Protected method | RaiseEvents | Raised the events that have been buffered. (Inherited from AdvisableCollectionT.)
Public method | Remove | Removes the first occurrence of a specific object from the ICollectionT. (Inherited from AdvisableCollectionT.)
Public method | RemoveAt | Removes the IListT item at the specified index. (Inherited from AdvisableCollectionT.)
Protected method | RemoveItem | Removes the element at the specified index of the underlying collection. (Overrides AdvisableCollectionTRemoveItem(Int32).)
Protected method | RemoveItems | Removes the specified number of elements starting at the specified index of the underlying collection. (Overrides AdvisableCollectionTRemoveItems(Int32, Int32).)
Public method | RemoveRange | Removes a range of elements from the AdvisableCollectionT. (Inherited from AdvisableCollectionT.)
Protected method | SetItem | Replaces the element at the specified index of the underlying collection. (Overrides AdvisableCollectionTSetItem(Int32, T).)
Public method | ToArray | Creates an array from the current AdvisableCollectionT. (Inherited from AdvisableCollectionT.)
Top
See Also

Reference

AdvisableKeyedCollectionTKey, TItem Class
PostSharp.Patterns.Collections Namespace


AdvisableKeyedCollection(TKey, TItem).ClearItems Method

AdvisableKeyedCollectionTKey, TItemClearItems Method

Removes all elements from the underlying collection.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void ClearItems()
Remarks

Note Note
This method does not cause the advices to be executed. It should be invoked only from inside the scope of the ExecuteWithAdvices method.

See Also

Reference

AdvisableKeyedCollectionTKey, TItem Class
PostSharp.Patterns.Collections Namespace


AdvisableKeyedCollection(TKey, TItem).Contains Method

AdvisableKeyedCollectionTKey, TItemContains Method

Overload List
 | Name | Description
Public method | Contains(T) | Determines whether the ICollectionT contains a specific value. (Inherited from AdvisableCollectionT.)
Public method | Contains(TKey) | Determines whether the collection contains an element with the specified key.
Top
See Also

Reference

AdvisableKeyedCollectionTKey, TItem Class
PostSharp.Patterns.Collections Namespace


AdvisableKeyedCollection(TKey, TItem).Contains Method (TKey)

AdvisableKeyedCollectionTKey, TItemContains Method (TKey)

Determines whether the collection contains an element with the specified key.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Contains(
    TKey item
)

Parameters

item
Type: TKey
The key to locate in the collection.

Return Value

Type: Boolean
true if the collection contains an element with the specified key; otherwise, false.
See Also

Reference

AdvisableKeyedCollectionTKey, TItem Class
Contains Overload
PostSharp.Patterns.Collections Namespace


AdvisableKeyedCollection(TKey, TItem).GetKeyForItem Method

AdvisableKeyedCollectionTKey, TItemGetKeyForItem Method

Extracts the key from the specified element.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected abstract TKey GetKeyForItem(
    TItem item
)

Parameters

item
Type: TItem
The element from which to extract the key.

Return Value

Type: TKey
The key for the specified element.
See Also

Reference

AdvisableKeyedCollectionTKey, TItem Class
PostSharp.Patterns.Collections Namespace


AdvisableKeyedCollection(TKey, TItem).GetObjectData Method

AdvisableKeyedCollectionTKey, TItemGetObjectData Method

Populates a SerializationInfo with the data needed to serialize the target object.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void GetObjectData(
    SerializationInfo info,
    StreamingContext context
)

Parameters

info
Type: System.Runtime.SerializationSerializationInfo
The SerializationInfo to populate with data.
context
Type: System.Runtime.SerializationStreamingContext
The destination (see StreamingContext) for this serialization.

Implements

ISerializableGetObjectData(SerializationInfo, StreamingContext)
Exceptions
Exception | Condition
SecurityException | The caller does not have the required permission.
See Also

Reference

AdvisableKeyedCollectionTKey, TItem Class
PostSharp.Patterns.Collections Namespace


AdvisableKeyedCollection(TKey, TItem).IndexOfItem Method

AdvisableKeyedCollectionTKey, TItemIndexOfItem Method

Searches for the specified object and returns the zero-based index of the first occurrence within the entire underlying collection.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override int IndexOfItem(
    TItem item
)

Parameters

item
Type: TItem
The object to locate in the AdvisableCollectionT. The value can be null for reference types.

Return Value

Type: Int32
The zero-based index of the first occurrence of item within the entire AdvisableCollectionT, if found; otherwise, -1.
See Also

Reference

AdvisableKeyedCollectionTKey, TItem Class
PostSharp.Patterns.Collections Namespace


AdvisableKeyedCollection(TKey, TItem).InsertItem Method

AdvisableKeyedCollectionTKey, TItemInsertItem Method

Inserts an element into the underlying collection at the specified index.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void InsertItem(
    int index,
    TItem item
)

Parameters

index
Type: SystemInt32
The zero-based index at which item should be inserted.
item
Type: TItem
The object to insert. The value can be null for reference types.
Remarks

Note Note
This method does not cause the advices to be executed. It should be invoked only from inside the scope of the ExecuteWithAdvices method.

See Also

Reference

AdvisableKeyedCollectionTKey, TItem Class
PostSharp.Patterns.Collections Namespace


AdvisableKeyedCollection(TKey, TItem).InsertItems Method

AdvisableKeyedCollectionTKey, TItemInsertItems Method

Inserts elements into the underlying collection at the specified index.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void InsertItems(
    int index,
    TItem[] collection
)

Parameters

index
Type: SystemInt32
The zero-based index at which collection should be inserted.
collection
Type: TItem
The list of objects to insert. The values in the list can be null for reference types.
Remarks

Note Note
This method does not cause the advices to be executed. It should be invoked only from inside the scope of the ExecuteWithAdvices method.

See Also

Reference

AdvisableKeyedCollectionTKey, TItem Class
PostSharp.Patterns.Collections Namespace


AdvisableKeyedCollection(TKey, TItem).MoveItem Method

AdvisableKeyedCollectionTKey, TItemMoveItem Method

Moves the element at the specified index to another index in the underlying collection.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void MoveItem(
    TItem item,
    int oldIndex,
    int newIndex
)

Parameters

item
Type: TItem
The element to be moved.
oldIndex
Type: SystemInt32
The old zero-based index of item in the collection.
newIndex
Type: SystemInt32
The new zero-based index of item in the collection.
Remarks

Some redundancy is created by requiring both item and oldIndex: this is intentional, for performance reasons.

See Also

Reference

AdvisableKeyedCollectionTKey, TItem Class
PostSharp.Patterns.Collections Namespace


AdvisableKeyedCollection(TKey, TItem).RemoveItem Method

AdvisableKeyedCollectionTKey, TItemRemoveItem Method

Removes the element at the specified index of the underlying collection.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void RemoveItem(
    int index
)

Parameters

index
Type: SystemInt32
The zero-based index of the element to remove.
Remarks

Note Note
This method does not cause the advices to be executed. It should be invoked only from inside the scope of the ExecuteWithAdvices method.

See Also

Reference

AdvisableKeyedCollectionTKey, TItem Class
PostSharp.Patterns.Collections Namespace


AdvisableKeyedCollection(TKey, TItem).RemoveItems Method

AdvisableKeyedCollectionTKey, TItemRemoveItems Method

Removes the specified number of elements starting at the specified index of the underlying collection.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override TItem[] RemoveItems(
    int index,
    int count
)

Parameters

index
Type: SystemInt32
The zero-based index of the element to remove.
count
Type: SystemInt32
The number of the elements to remove.

Return Value

Type: TItem
The list of elements that were removed.
Remarks

Note Note
This method does not cause the advices to be executed. It should be invoked only from inside the scope of the ExecuteWithAdvices method.

See Also

Reference

AdvisableKeyedCollectionTKey, TItem Class
PostSharp.Patterns.Collections Namespace


AdvisableKeyedCollection(TKey, TItem).SetItem Method

AdvisableKeyedCollectionTKey, TItemSetItem Method

Replaces the element at the specified index of the underlying collection.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void SetItem(
    int index,
    TItem item
)

Parameters

index
Type: SystemInt32
The zero-based index of the element to replace.
item
Type: TItem
The new value for the element at the specified index. The value can be null for reference types.
Remarks

Note Note
This method does not cause the advices to be executed. It should be invoked only from inside the scope of the ExecuteWithAdvices method.

See Also

Reference

AdvisableKeyedCollectionTKey, TItem Class
PostSharp.Patterns.Collections Namespace


AdvisableKeyedCollection(TKey, TItem) Events

AdvisableKeyedCollectionTKey, TItem Events

The AdvisableKeyedCollectionTKey, TItem generic type exposes the following members.

Events
 | Name | Description
Public event | CollectionChanged | Occurs when the collection changes. (Inherited from AdvisableCollectionT.)
Public event | PropertyChanged | Event raised when the value of a property of the current object changes. (Inherited from AdvisableCollectionT.)
Top
See Also

Reference

AdvisableKeyedCollectionTKey, TItem Class
PostSharp.Patterns.Collections Namespace


Extensions Class

Adds extension methods to the IEnumerableT and IDictionaryTKey, TValue interfaces.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.CollectionsExtensions

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static class Extensions

The Extensions type exposes the following members.

Methods
Name | Description
ToAdvisableCollectionT | Converts an IEnumerableT into an AdvisableCollectionT.
ToAdvisableDictionaryTKey, TValue(IDictionaryTKey, TValue) | Converts an IDictionaryTKey, TValue into an AdvisableDictionaryTKey, TValue.
ToAdvisableDictionaryTItem, TKey, TValue(IEnumerableTItem, FuncTItem, TKey, FuncTItem, TValue) | Converts an IEnumerableT into a AdvisableDictionaryTKey, TValue given a method returning the item key and a method returning the item value.
ToAdvisableHashSetT | Converts an IEnumerableT into an AdvisableHashSetT.
Top
See Also

Reference

PostSharp.Patterns.Collections Namespace

Other Resources

Conceptual: What's New in PostSharp 4.2


Extensions Methods

The Extensions type exposes the following members.

Methods
Name | Description
ToAdvisableCollectionT | Converts an IEnumerableT into an AdvisableCollectionT.
ToAdvisableDictionaryTKey, TValue(IDictionaryTKey, TValue) | Converts an IDictionaryTKey, TValue into an AdvisableDictionaryTKey, TValue.
ToAdvisableDictionaryTItem, TKey, TValue(IEnumerableTItem, FuncTItem, TKey, FuncTItem, TValue) | Converts an IEnumerableT into a AdvisableDictionaryTKey, TValue given a method returning the item key and a method returning the item value.
ToAdvisableHashSetT | Converts an IEnumerableT into an AdvisableHashSetT.
Top
See Also

Reference

Extensions Class
PostSharp.Patterns.Collections Namespace


Extensions.ToAdvisableCollection(T) Method

ExtensionsToAdvisableCollectionT Method

Converts an IEnumerableT into an AdvisableCollectionT.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static AdvisableCollection<T> ToAdvisableCollection<T>(
    this IEnumerable<T> collection
)

Parameters

collection
Type: System.Collections.GenericIEnumerable T
An IEnumerableT, or null.

Type Parameters

T
Type of collection items.

Return Value

Type: AdvisableCollection T
A new AdvisableCollectionT containing all elements of collection, or null if collection is empty.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable T. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

Extensions Class
PostSharp.Patterns.Collections Namespace


Extensions.ToAdvisableDictionary Method

ExtensionsToAdvisableDictionary Method

Overload List
Name | Description
ToAdvisableDictionaryTKey, TValue(IDictionaryTKey, TValue) | Converts an IDictionaryTKey, TValue into an AdvisableDictionaryTKey, TValue.
ToAdvisableDictionaryTItem, TKey, TValue(IEnumerableTItem, FuncTItem, TKey, FuncTItem, TValue) | Converts an IEnumerableT into a AdvisableDictionaryTKey, TValue given a method returning the item key and a method returning the item value.
Top
See Also

Reference

Extensions Class
PostSharp.Patterns.Collections Namespace


Extensions.ToAdvisableDictionary(TKey, TValue) Method (IDictionary(TKey, TValue))

ExtensionsToAdvisableDictionaryTKey, TValue Method (IDictionaryTKey, TValue)

Converts an IDictionaryTKey, TValue into an AdvisableDictionaryTKey, TValue.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static AdvisableDictionary<TKey, TValue> ToAdvisableDictionary<TKey, TValue>(
    this IDictionary<TKey, TValue> dictionary
)

Parameters

dictionary
Type: System.Collections.GenericIDictionary TKey, TValue
An IDictionaryTKey, TValue, or null.

Type Parameters

TKey
Type of dictionary keys.
TValue
Type of dictionary values.

Return Value

Type: AdvisableDictionary TKey, TValue
A new AdvisableDictionaryTKey, TValue containing all elements of dictionary, or null if dictionary is empty.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IDictionary TKey, TValue. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

Extensions Class
ToAdvisableDictionary Overload
PostSharp.Patterns.Collections Namespace


Extensions.ToAdvisableDictionary(TItem, TKey, TValue) Method (IEnumerable(TItem), Func(TItem, TKey), Func(TItem, TValue))

ExtensionsToAdvisableDictionaryTItem, TKey, TValue Method (IEnumerableTItem, FuncTItem, TKey, FuncTItem, TValue)

Converts an IEnumerableT into a AdvisableDictionaryTKey, TValue given a method returning the item key and a method returning the item value.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static AdvisableDictionary<TKey, TValue> ToAdvisableDictionary<TItem, TKey, TValue>(
    this IEnumerable<TItem> collection,
    Func<TItem, TKey> getKeyFunc,
    Func<TItem, TValue> getValueFunc
)

Parameters

collection
Type: System.Collections.GenericIEnumerable TItem
An IEnumerableT, or null.
getKeyFunc
Type: SystemFunc TItem, TKey
A method returning the dictionary key given an item of the input collection.
getValueFunc
Type: SystemFunc TItem, TValue
A method returning the dictionary value given an item of the input collection.

Type Parameters

TItem
Type of items in the input collection.
TKey
Type of keys in the output dictionary.
TValue
Type of values in the output dictionary.

Return Value

Type: AdvisableDictionary TKey, TValue
A new AdvisableDictionaryTKey, TValue build from items of the input collection, or null if collection is null.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable TItem. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

Extensions Class
ToAdvisableDictionary Overload
PostSharp.Patterns.Collections Namespace


Extensions.ToAdvisableHashSet(T) Method

ExtensionsToAdvisableHashSetT Method

Converts an IEnumerableT into an AdvisableHashSetT.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static AdvisableHashSet<T> ToAdvisableHashSet<T>(
    this IEnumerable<T> collection
)

Parameters

collection
Type: System.Collections.GenericIEnumerable T
An IEnumerableT, or null.

Type Parameters

T
Type of collection items.

Return Value

Type: AdvisableHashSet T
A new AdvisableHashSetT containing all elements of collection, or null if collection is empty.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable T. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

Extensions Class
PostSharp.Patterns.Collections Namespace


ReadOnlyArray(T) Structure

ReadOnlyArrayT Structure

Read-only array wrapper.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public struct ReadOnlyArray<T> : IEquatable<ReadOnlyArray<T>>

Type Parameters

T
Type of array items.

The ReadOnlyArrayT type exposes the following members.

Constructors
 | Name | Description
Public method | ReadOnlyArrayT | Initializes a new ReadOnlyArrayT.
Top
Properties
 | Name | Description
Public property | IsNull | Determines whether the array is null.
Public property | Item | Gets a specified element of the array.
Public property | Length | Gets the array length.
Top
Methods
 | Name | Description
Public method | Equals(Object) | Indicates whether this instance and a specified object are equal. (Overrides ValueTypeEquals(Object).)
Public method | Equals(ReadOnlyArrayT) | Indicates whether the current object is equal to another object of the same type.
Public method | GetHashCode | Returns the hash code for this instance. (Overrides ValueTypeGetHashCode.)
Top
Operators
Name | Description
Equality | Determines whether two instances of the ReadOnlyArrayT type are equal.
Inequality | Determines whether two instances of the ReadOnlyArrayT type are different.
Top
See Also

Reference

PostSharp.Patterns.Collections Namespace


ReadOnlyArray(T) Constructor

ReadOnlyArrayT Constructor

Initializes a new ReadOnlyArrayT.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ReadOnlyArray(
    T[] array
)

Parameters

array
Type: T
An array, or null.
See Also

Reference

ReadOnlyArrayT Structure
PostSharp.Patterns.Collections Namespace


ReadOnlyArray(T) Properties

ReadOnlyArrayT Properties

The ReadOnlyArrayT generic type exposes the following members.

Properties
 | Name | Description
Public property | IsNull | Determines whether the array is null.
Public property | Item | Gets a specified element of the array.
Public property | Length | Gets the array length.
Top
See Also

Reference

ReadOnlyArrayT Structure
PostSharp.Patterns.Collections Namespace


ReadOnlyArray(T).IsNull Property

ReadOnlyArrayTIsNull Property

Determines whether the array is null.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsNull { get; }

Property Value

Type: Boolean
See Also

Reference

ReadOnlyArrayT Structure
PostSharp.Patterns.Collections Namespace


ReadOnlyArray(T).Item Property

ReadOnlyArrayTItem Property

Gets a specified element of the array.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public T this[
    int index
] { get; }

Parameters

index
Type: SystemInt32
The element position.

Return Value

Type: T
The element at position index.
See Also

Reference

ReadOnlyArrayT Structure
PostSharp.Patterns.Collections Namespace


ReadOnlyArray(T).Length Property

ReadOnlyArrayTLength Property

Gets the array length.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int Length { get; }

Property Value

Type: Int32
See Also

Reference

ReadOnlyArrayT Structure
PostSharp.Patterns.Collections Namespace


ReadOnlyArray(T) Methods

ReadOnlyArrayT Methods

The ReadOnlyArrayT generic type exposes the following members.

Methods
 | Name | Description
Public method | Equals(Object) | Indicates whether this instance and a specified object are equal. (Overrides ValueTypeEquals(Object).)
Public method | Equals(ReadOnlyArrayT) | Indicates whether the current object is equal to another object of the same type.
Public method | GetHashCode | Returns the hash code for this instance. (Overrides ValueTypeGetHashCode.)
Top
See Also

Reference

ReadOnlyArrayT Structure
PostSharp.Patterns.Collections Namespace


ReadOnlyArray(T).Equals Method

ReadOnlyArrayTEquals Method

Overload List
 | Name | Description
Public method | Equals(Object) | Indicates whether this instance and a specified object are equal. (Overrides ValueTypeEquals(Object).)
Public method | Equals(ReadOnlyArrayT) | Indicates whether the current object is equal to another object of the same type.
Top
See Also

Reference

ReadOnlyArrayT Structure
PostSharp.Patterns.Collections Namespace


ReadOnlyArray(T).Equals Method (Object)

ReadOnlyArrayTEquals Method (Object)

Indicates whether this instance and a specified object are equal.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool Equals(
    Object obj
)

Parameters

obj
Type: SystemObject
The object to compare with the current instance.

Return Value

Type: Boolean
true if obj and this instance are the same type and represent the same value; otherwise, false.
See Also

Reference

ReadOnlyArrayT Structure
Equals Overload
PostSharp.Patterns.Collections Namespace


ReadOnlyArray(T).Equals Method (ReadOnlyArray(T))

ReadOnlyArrayTEquals Method (ReadOnlyArrayT)

Indicates whether the current object is equal to another object of the same type.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Equals(
    ReadOnlyArray<T> other
)

Parameters

other
Type: PostSharp.Patterns.CollectionsReadOnlyArray T
An object to compare with this object.

Return Value

Type: Boolean
true if the current object is equal to the other parameter; otherwise, false.

Implements

IEquatableTEquals(T)
See Also

Reference

ReadOnlyArrayT Structure
Equals Overload
PostSharp.Patterns.Collections Namespace


ReadOnlyArray(T).GetHashCode Method

ReadOnlyArrayTGetHashCode Method

Returns the hash code for this instance.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override int GetHashCode()

Return Value

Type: Int32
A 32-bit signed integer that is the hash code for this instance.
See Also

Reference

ReadOnlyArrayT Structure
PostSharp.Patterns.Collections Namespace


ReadOnlyArray(T) Operators

ReadOnlyArrayT Operators

The ReadOnlyArrayT generic type exposes the following members.

Operators
Name | Description
Equality | Determines whether two instances of the ReadOnlyArrayT type are equal.
Inequality | Determines whether two instances of the ReadOnlyArrayT type are different.
Top
See Also

Reference

ReadOnlyArrayT Structure
PostSharp.Patterns.Collections Namespace


ReadOnlyArray(T).Equality Operator

ReadOnlyArrayTEquality Operator

Determines whether two instances of the ReadOnlyArrayT type are equal.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool operator ==(
    ReadOnlyArray<T> left,
    ReadOnlyArray<T> right
)

Parameters

left
Type: PostSharp.Patterns.CollectionsReadOnlyArray T
right
Type: PostSharp.Patterns.CollectionsReadOnlyArray T

Return Value

Type: Boolean
See Also

Reference

ReadOnlyArrayT Structure
PostSharp.Patterns.Collections Namespace


ReadOnlyArray(T).Inequality Operator

ReadOnlyArrayTInequality Operator

Determines whether two instances of the ReadOnlyArrayT type are different.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool operator !=(
    ReadOnlyArray<T> left,
    ReadOnlyArray<T> right
)

Parameters

left
Type: PostSharp.Patterns.CollectionsReadOnlyArray T
right
Type: PostSharp.Patterns.CollectionsReadOnlyArray T

Return Value

Type: Boolean
See Also

Reference

ReadOnlyArrayT Structure
PostSharp.Patterns.Collections Namespace


PostSharp.Patterns.Collections.Advices Namespace

Classes
 | Class | Description
Public class | CollectionDynamicAdviceT | Base implementation of the ICollectionDynamicAdviceT interface.
Public class | DictionaryDynamicAdviceTKey, TValue | Base implementation for dynamic advices added to an AdvisableDictionaryTKey, TValue.
Public class | HashSetDynamicAdviceT | An implementation of IHashSetDynamicAdviceT with default behavior (invokes the next advice in the chain).
Interfaces
 | Interface | Description
Public interface | ICollectionDynamicAdviceT | Defines the semantics of a dynamic advice that can be applied to an AdvisableCollectionT.
Public interface | ICollectionDynamicAdviceBase | Base interface for all dynamic advices that apply to collection-like types.
Public interface | ICollectionDynamicAdviceFactoryTPayload | Creates instances of the ICollectionDynamicAdviceT interface.
Public interface | IDictionaryDynamicAdviceTKey, TValue | Defines the semantics of a dynamic advice that can be applied to an AdvisableDictionaryTKey, TValue.
Public interface | IDictionaryDynamicAdviceFactoryTPayload | Creates instances of the IDictionaryDynamicAdviceTKey, TValue interface.
Public interface | IDynamicallyAdvisableCollection | Defines the semantics of a collection that can be advised dynamically.
Public interface | IDynamicallyAdvisableDictionary | Defines the semantics of a dictionary that can be advised dynamically.
Public interface | IDynamicallyAdvisableHashSet | Defines the semantics of a collection that can be advised dynamically.
Public interface | IHashSetDynamicAdviceT | Defines the semantics of a dynamic advice that can be applied to an AdvisableHashSetT.
Public interface | IHashSetDynamicAdviceFactoryTPayload | Factory for IHashSetDynamicAdviceT advices.


CollectionDynamicAdvice(T) Class

CollectionDynamicAdviceT Class

Base implementation of the ICollectionDynamicAdviceT interface.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DynamicAdvisingDynamicAdvice
PostSharp.Patterns.Collections.AdvicesCollectionDynamicAdviceT

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class CollectionDynamicAdvice<T> : DynamicAdvice,
    ICollectionDynamicAdvice<T>, ICollectionDynamicAdviceBase, IDynamicAdvice, IDynamicInterfaceImplementation

Type Parameters

T
Type of collection items.

The CollectionDynamicAdviceT type exposes the following members.

Constructors
 | Name | Description
Protected method | CollectionDynamicAdviceT | Initializes a new CollectionDynamicAdviceT.
Top
Properties
 | Name | Description
Protected property | AdvisedObject | Gets the advised object. (Inherited from DynamicAdvice.)
Protected property | Collection | Gets the target AdvisableCollectionT.
Public property | Identity | Gets the type identity of the advice, which should correspond to the first parameter of the Advise(Type, FuncIQueryInterface, IDynamicAdvice) method. This is typically the generic type definition of the advice (Inherited from DynamicAdvice.)
Public property | Order | Gets the execution order of the dynamic advice. See DynamicAdviceOrder. (Inherited from DynamicAdvice.)
Top
Methods
 | Name | Description
Public method | ClearItems | Empties the advised collection.
Public method | Dispose | Disposes the current advice. // We don't use IDisposable so that advises are not be cast to IDisposable by default. (Inherited from DynamicAdvice.)
Public method | Initialize | Initializes the current advice. (Inherited from DynamicAdvice.)
Public method | InsertItem | Inserts an item into the advised collection.
Public method | InsertMany | Inserts several items to the advised collection.
Public method | IsReadOnly | Determines whether the advised collection is read-only.
Public method | IsSynchronized | Determines whether the advised collection is synchronized (i.e. thread-safe).
Public method | MoveItem | Moves an item of the advised collection from an old index to a new index.
Public method | QueryInterfaceTInterface | (Inherited from DynamicAdvice.)
Public method | RemoveItem | Removes an item from the advised collection.
Public method | RemoveMany | Removes several items from the advised collection.
Public method | SetItem | Replaces an item in the advised collection.
Public method | ToArray | Copies the advised collection into a new array.
Top
See Also

Reference

PostSharp.Patterns.Collections.Advices Namespace


CollectionDynamicAdvice(T) Constructor

CollectionDynamicAdviceT Constructor

Initializes a new CollectionDynamicAdviceT.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected CollectionDynamicAdvice(
    IQueryInterface parent
)

Parameters

parent
Type: PostSharp.Patterns.DynamicAdvisingIQueryInterface
The parent object.
See Also

Reference

CollectionDynamicAdviceT Class
PostSharp.Patterns.Collections.Advices Namespace


CollectionDynamicAdvice(T) Properties

CollectionDynamicAdviceT Properties

The CollectionDynamicAdviceT generic type exposes the following members.

Properties
 | Name | Description
Protected property | AdvisedObject | Gets the advised object. (Inherited from DynamicAdvice.)
Protected property | Collection | Gets the target AdvisableCollectionT.
Public property | Identity | Gets the type identity of the advice, which should correspond to the first parameter of the Advise(Type, FuncIQueryInterface, IDynamicAdvice) method. This is typically the generic type definition of the advice (Inherited from DynamicAdvice.)
Public property | Order | Gets the execution order of the dynamic advice. See DynamicAdviceOrder. (Inherited from DynamicAdvice.)
Top
See Also

Reference

CollectionDynamicAdviceT Class
PostSharp.Patterns.Collections.Advices Namespace


CollectionDynamicAdvice(T).Collection Property

CollectionDynamicAdviceTCollection Property

Gets the target AdvisableCollectionT.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected AdvisableCollection<T> Collection { get; }

Property Value

Type: AdvisableCollection T
See Also

Reference

CollectionDynamicAdviceT Class
PostSharp.Patterns.Collections.Advices Namespace


CollectionDynamicAdvice(T) Methods

CollectionDynamicAdviceT Methods

The CollectionDynamicAdviceT generic type exposes the following members.

Methods
 | Name | Description
Public method | ClearItems | Empties the advised collection.
Public method | Dispose | Disposes the current advice. // We don't use IDisposable so that advises are not be cast to IDisposable by default. (Inherited from DynamicAdvice.)
Public method | Initialize | Initializes the current advice. (Inherited from DynamicAdvice.)
Public method | InsertItem | Inserts an item into the advised collection.
Public method | InsertMany | Inserts several items to the advised collection.
Public method | IsReadOnly | Determines whether the advised collection is read-only.
Public method | IsSynchronized | Determines whether the advised collection is synchronized (i.e. thread-safe).
Public method | MoveItem | Moves an item of the advised collection from an old index to a new index.
Public method | QueryInterfaceTInterface | (Inherited from DynamicAdvice.)
Public method | RemoveItem | Removes an item from the advised collection.
Public method | RemoveMany | Removes several items from the advised collection.
Public method | SetItem | Replaces an item in the advised collection.
Public method | ToArray | Copies the advised collection into a new array.
Top
See Also

Reference

CollectionDynamicAdviceT Class
PostSharp.Patterns.Collections.Advices Namespace


CollectionDynamicAdvice(T).ClearItems Method

CollectionDynamicAdviceTClearItems Method

Empties the advised collection.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void ClearItems(
    AdviceEnumerator<ICollectionDynamicAdvice<T>> nextAdvices
)

Parameters

nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator ICollectionDynamicAdvice T

Implements

ICollectionDynamicAdviceTClearItems(AdviceEnumeratorICollectionDynamicAdviceT)
See Also

Reference

CollectionDynamicAdviceT Class
PostSharp.Patterns.Collections.Advices Namespace


CollectionDynamicAdvice(T).InsertItem Method

CollectionDynamicAdviceTInsertItem Method

Inserts an item into the advised collection.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void InsertItem(
    int index,
    T item,
    AdviceEnumerator<ICollectionDynamicAdvice<T>> nextAdvices
)

Parameters

index
Type: SystemInt32
item
Type: T
nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator ICollectionDynamicAdvice T

Implements

ICollectionDynamicAdviceTInsertItem(Int32, T, AdviceEnumeratorICollectionDynamicAdviceT)
See Also

Reference

CollectionDynamicAdviceT Class
PostSharp.Patterns.Collections.Advices Namespace


CollectionDynamicAdvice(T).InsertMany Method

CollectionDynamicAdviceTInsertMany Method

Inserts several items to the advised collection.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void InsertMany(
    int index,
    T[] itemsToAdd,
    AdviceEnumerator<ICollectionDynamicAdvice<T>> nextAdvices
)

Parameters

index
Type: SystemInt32
itemsToAdd
Type: T
nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator ICollectionDynamicAdvice T

Implements

ICollectionDynamicAdviceTInsertMany(Int32, T, AdviceEnumeratorICollectionDynamicAdviceT)
See Also

Reference

CollectionDynamicAdviceT Class
PostSharp.Patterns.Collections.Advices Namespace


CollectionDynamicAdvice(T).IsReadOnly Method

CollectionDynamicAdviceTIsReadOnly Method

Determines whether the advised collection is read-only.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual bool IsReadOnly(
    AdviceEnumerator<ICollectionDynamicAdviceBase> nextAdvices
)

Parameters

nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator ICollectionDynamicAdviceBase
The next advice in the chain of responsibility.

Return Value

Type: Boolean
true if the advised collection is read-only, otherwise false.

Implements

ICollectionDynamicAdviceBaseIsReadOnly(AdviceEnumeratorICollectionDynamicAdviceBase)
See Also

Reference

CollectionDynamicAdviceT Class
PostSharp.Patterns.Collections.Advices Namespace


CollectionDynamicAdvice(T).IsSynchronized Method

CollectionDynamicAdviceTIsSynchronized Method

Determines whether the advised collection is synchronized (i.e. thread-safe).

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual bool IsSynchronized(
    AdviceEnumerator<ICollectionDynamicAdviceBase> nextAdvices
)

Parameters

nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator ICollectionDynamicAdviceBase
The next advice in the chain of responsibility.

Return Value

Type: Boolean
true if the advised collection is synchronized (i.e. thread-safe), otherwise false.

Implements

ICollectionDynamicAdviceBaseIsSynchronized(AdviceEnumeratorICollectionDynamicAdviceBase)
See Also

Reference

CollectionDynamicAdviceT Class
PostSharp.Patterns.Collections.Advices Namespace


CollectionDynamicAdvice(T).MoveItem Method

CollectionDynamicAdviceTMoveItem Method

Moves an item of the advised collection from an old index to a new index.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void MoveItem(
    T item,
    int oldIndex,
    int newIndex,
    AdviceEnumerator<ICollectionDynamicAdvice<T>> nextAdvices
)

Parameters

item
Type: T
oldIndex
Type: SystemInt32
newIndex
Type: SystemInt32
nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator ICollectionDynamicAdvice T

Implements

ICollectionDynamicAdviceTMoveItem(T, Int32, Int32, AdviceEnumeratorICollectionDynamicAdviceT)
See Also

Reference

CollectionDynamicAdviceT Class
PostSharp.Patterns.Collections.Advices Namespace


CollectionDynamicAdvice(T).RemoveItem Method

CollectionDynamicAdviceTRemoveItem Method

Removes an item from the advised collection.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void RemoveItem(
    int index,
    T item,
    AdviceEnumerator<ICollectionDynamicAdvice<T>> nextAdvices
)

Parameters

index
Type: SystemInt32
item
Type: T
nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator ICollectionDynamicAdvice T

Implements

ICollectionDynamicAdviceTRemoveItem(Int32, T, AdviceEnumeratorICollectionDynamicAdviceT)
See Also

Reference

CollectionDynamicAdviceT Class
PostSharp.Patterns.Collections.Advices Namespace


CollectionDynamicAdvice(T).RemoveMany Method

CollectionDynamicAdviceTRemoveMany Method

Removes several items from the advised collection.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void RemoveMany(
    int index,
    T[] itemsToRemove,
    AdviceEnumerator<ICollectionDynamicAdvice<T>> nextAdvices
)

Parameters

index
Type: SystemInt32
itemsToRemove
Type: T
nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator ICollectionDynamicAdvice T

Implements

ICollectionDynamicAdviceTRemoveMany(Int32, T, AdviceEnumeratorICollectionDynamicAdviceT)
See Also

Reference

CollectionDynamicAdviceT Class
PostSharp.Patterns.Collections.Advices Namespace


CollectionDynamicAdvice(T).SetItem Method

CollectionDynamicAdviceTSetItem Method

Replaces an item in the advised collection.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void SetItem(
    int index,
    T item,
    T oldItem,
    AdviceEnumerator<ICollectionDynamicAdvice<T>> nextAdvices
)

Parameters

index
Type: SystemInt32
item
Type: T
oldItem
Type: T
nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator ICollectionDynamicAdvice T

Implements

ICollectionDynamicAdviceTSetItem(Int32, T, T, AdviceEnumeratorICollectionDynamicAdviceT)
See Also

Reference

CollectionDynamicAdviceT Class
PostSharp.Patterns.Collections.Advices Namespace


CollectionDynamicAdvice(T).ToArray Method

CollectionDynamicAdviceTToArray Method

Copies the advised collection into a new array.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual T[] ToArray(
    AdviceEnumerator<ICollectionDynamicAdvice<T>> nextAdvices
)

Parameters

nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator ICollectionDynamicAdvice T

Return Value

Type: T

Implements

ICollectionDynamicAdviceTToArray(AdviceEnumeratorICollectionDynamicAdviceT)
See Also

Reference

CollectionDynamicAdviceT Class
PostSharp.Patterns.Collections.Advices Namespace


DictionaryDynamicAdvice(TKey, TValue) Class

DictionaryDynamicAdviceTKey, TValue Class

Base implementation for dynamic advices added to an AdvisableDictionaryTKey, TValue.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DynamicAdvisingDynamicAdvice
PostSharp.Patterns.Collections.AdvicesDictionaryDynamicAdviceTKey, TValue

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class DictionaryDynamicAdvice<TKey, TValue> : DynamicAdvice,
    IDictionaryDynamicAdvice<TKey, TValue>, ICollectionDynamicAdviceBase, IDynamicAdvice, IDynamicInterfaceImplementation

Type Parameters

TKey
Type of dictionary keys.
TValue
Type of dictionary values.

The DictionaryDynamicAdviceTKey, TValue type exposes the following members.

Constructors
 | Name | Description
Protected method | DictionaryDynamicAdviceTKey, TValue | Initializes a new DictionaryDynamicAdviceTKey, TValue.
Top
Properties
 | Name | Description
Protected property | AdvisedObject | Gets the advised object. (Inherited from DynamicAdvice.)
Protected property | Dictionary | Gets the advised dictionary.
Public property | Identity | Gets the type identity of the advice, which should correspond to the first parameter of the Advise(Type, FuncIQueryInterface, IDynamicAdvice) method. This is typically the generic type definition of the advice (Inherited from DynamicAdvice.)
Public property | Order | Gets the execution order of the dynamic advice. See DynamicAdviceOrder. (Inherited from DynamicAdvice.)
Top
Methods
 | Name | Description
Public method | AddItem | Adds an item to the dictionary.
Public method | ClearItems | Empties the dictionary.
Public method | Dispose | Disposes the current advice. // We don't use IDisposable so that advises are not be cast to IDisposable by default. (Inherited from DynamicAdvice.)
Public method | Initialize | Initializes the current advice. (Inherited from DynamicAdvice.)
Public method | IsReadOnly | Determines whether the advised collection is read-only.
Public method | IsSynchronized | Determines whether the advised collection is synchronized (i.e. thread-safe).
Public method | QueryInterfaceTInterface | (Inherited from DynamicAdvice.)
Public method | RemoveItem | Removes an item from the dictionary.
Public method | SetItem | Replaces an item with another one in the dictionary.
Public method | ToArray | Copies the dictionary to an array of keys and values.
Top
See Also

Reference

PostSharp.Patterns.Collections.Advices Namespace


DictionaryDynamicAdvice(TKey, TValue) Constructor

DictionaryDynamicAdviceTKey, TValue Constructor

Initializes a new DictionaryDynamicAdviceTKey, TValue.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected DictionaryDynamicAdvice(
    IQueryInterface parent
)

Parameters

parent
Type: PostSharp.Patterns.DynamicAdvisingIQueryInterface
Parent object.
See Also

Reference

DictionaryDynamicAdviceTKey, TValue Class
PostSharp.Patterns.Collections.Advices Namespace


DictionaryDynamicAdvice(TKey, TValue) Properties

DictionaryDynamicAdviceTKey, TValue Properties

The DictionaryDynamicAdviceTKey, TValue generic type exposes the following members.

Properties
 | Name | Description
Protected property | AdvisedObject | Gets the advised object. (Inherited from DynamicAdvice.)
Protected property | Dictionary | Gets the advised dictionary.
Public property | Identity | Gets the type identity of the advice, which should correspond to the first parameter of the Advise(Type, FuncIQueryInterface, IDynamicAdvice) method. This is typically the generic type definition of the advice (Inherited from DynamicAdvice.)
Public property | Order | Gets the execution order of the dynamic advice. See DynamicAdviceOrder. (Inherited from DynamicAdvice.)
Top
See Also

Reference

DictionaryDynamicAdviceTKey, TValue Class
PostSharp.Patterns.Collections.Advices Namespace


DictionaryDynamicAdvice(TKey, TValue).Dictionary Property

DictionaryDynamicAdviceTKey, TValueDictionary Property

Gets the advised dictionary.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected AdvisableDictionary<TKey, TValue> Dictionary { get; }

Property Value

Type: AdvisableDictionary TKey, TValue
See Also

Reference

DictionaryDynamicAdviceTKey, TValue Class
PostSharp.Patterns.Collections.Advices Namespace


DictionaryDynamicAdvice(TKey, TValue) Methods

DictionaryDynamicAdviceTKey, TValue Methods

The DictionaryDynamicAdviceTKey, TValue generic type exposes the following members.

Methods
 | Name | Description
Public method | AddItem | Adds an item to the dictionary.
Public method | ClearItems | Empties the dictionary.
Public method | Dispose | Disposes the current advice. // We don't use IDisposable so that advises are not be cast to IDisposable by default. (Inherited from DynamicAdvice.)
Public method | Initialize | Initializes the current advice. (Inherited from DynamicAdvice.)
Public method | IsReadOnly | Determines whether the advised collection is read-only.
Public method | IsSynchronized | Determines whether the advised collection is synchronized (i.e. thread-safe).
Public method | QueryInterfaceTInterface | (Inherited from DynamicAdvice.)
Public method | RemoveItem | Removes an item from the dictionary.
Public method | SetItem | Replaces an item with another one in the dictionary.
Public method | ToArray | Copies the dictionary to an array of keys and values.
Top
See Also

Reference

DictionaryDynamicAdviceTKey, TValue Class
PostSharp.Patterns.Collections.Advices Namespace


DictionaryDynamicAdvice(TKey, TValue).AddItem Method

DictionaryDynamicAdviceTKey, TValueAddItem Method

Adds an item to the dictionary.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void AddItem(
    TKey key,
    TValue value,
    AdviceEnumerator<IDictionaryDynamicAdvice<TKey, TValue>> nextAdvices
)

Parameters

key
Type: TKey
value
Type: TValue
nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator IDictionaryDynamicAdvice TKey, TValue

Implements

IDictionaryDynamicAdviceTKey, TValueAddItem(TKey, TValue, AdviceEnumeratorIDictionaryDynamicAdviceTKey, TValue)
See Also

Reference

DictionaryDynamicAdviceTKey, TValue Class
PostSharp.Patterns.Collections.Advices Namespace


DictionaryDynamicAdvice(TKey, TValue).ClearItems Method

DictionaryDynamicAdviceTKey, TValueClearItems Method

Empties the dictionary.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void ClearItems(
    AdviceEnumerator<IDictionaryDynamicAdvice<TKey, TValue>> nextAdvices
)

Parameters

nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator IDictionaryDynamicAdvice TKey, TValue

Implements

IDictionaryDynamicAdviceTKey, TValueClearItems(AdviceEnumeratorIDictionaryDynamicAdviceTKey, TValue)
See Also

Reference

DictionaryDynamicAdviceTKey, TValue Class
PostSharp.Patterns.Collections.Advices Namespace


DictionaryDynamicAdvice(TKey, TValue).IsReadOnly Method

DictionaryDynamicAdviceTKey, TValueIsReadOnly Method

Determines whether the advised collection is read-only.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual bool IsReadOnly(
    AdviceEnumerator<ICollectionDynamicAdviceBase> nextAdvices
)

Parameters

nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator ICollectionDynamicAdviceBase
The next advice in the chain of responsibility.

Return Value

Type: Boolean
true if the advised collection is read-only, otherwise false.

Implements

ICollectionDynamicAdviceBaseIsReadOnly(AdviceEnumeratorICollectionDynamicAdviceBase)
See Also

Reference

DictionaryDynamicAdviceTKey, TValue Class
PostSharp.Patterns.Collections.Advices Namespace


DictionaryDynamicAdvice(TKey, TValue).IsSynchronized Method

DictionaryDynamicAdviceTKey, TValueIsSynchronized Method

Determines whether the advised collection is synchronized (i.e. thread-safe).

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual bool IsSynchronized(
    AdviceEnumerator<ICollectionDynamicAdviceBase> nextAdvices
)

Parameters

nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator ICollectionDynamicAdviceBase
The next advice in the chain of responsibility.

Return Value

Type: Boolean
true if the advised collection is synchronized (i.e. thread-safe), otherwise false.

Implements

ICollectionDynamicAdviceBaseIsSynchronized(AdviceEnumeratorICollectionDynamicAdviceBase)
See Also

Reference

DictionaryDynamicAdviceTKey, TValue Class
PostSharp.Patterns.Collections.Advices Namespace


DictionaryDynamicAdvice(TKey, TValue).RemoveItem Method

DictionaryDynamicAdviceTKey, TValueRemoveItem Method

Removes an item from the dictionary.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void RemoveItem(
    TKey key,
    TValue value,
    AdviceEnumerator<IDictionaryDynamicAdvice<TKey, TValue>> nextAdvices
)

Parameters

key
Type: TKey
value
Type: TValue
nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator IDictionaryDynamicAdvice TKey, TValue

Implements

IDictionaryDynamicAdviceTKey, TValueRemoveItem(TKey, TValue, AdviceEnumeratorIDictionaryDynamicAdviceTKey, TValue)
See Also

Reference

DictionaryDynamicAdviceTKey, TValue Class
PostSharp.Patterns.Collections.Advices Namespace


DictionaryDynamicAdvice(TKey, TValue).SetItem Method

DictionaryDynamicAdviceTKey, TValueSetItem Method

Replaces an item with another one in the dictionary.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void SetItem(
    TKey key,
    TValue value,
    TValue oldValue,
    AdviceEnumerator<IDictionaryDynamicAdvice<TKey, TValue>> nextAdvices
)

Parameters

key
Type: TKey
value
Type: TValue
oldValue
Type: TValue
nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator IDictionaryDynamicAdvice TKey, TValue

Implements

IDictionaryDynamicAdviceTKey, TValueSetItem(TKey, TValue, TValue, AdviceEnumeratorIDictionaryDynamicAdviceTKey, TValue)
See Also

Reference

DictionaryDynamicAdviceTKey, TValue Class
PostSharp.Patterns.Collections.Advices Namespace


DictionaryDynamicAdvice(TKey, TValue).ToArray Method

DictionaryDynamicAdviceTKey, TValueToArray Method

Copies the dictionary to an array of keys and values.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public KeyValuePair<TKey, TValue>[] ToArray(
    AdviceEnumerator<IDictionaryDynamicAdvice<TKey, TValue>> nextAdvices
)

Parameters

nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator IDictionaryDynamicAdvice TKey, TValue

Return Value

Type: KeyValuePair TKey, TValue

Implements

IDictionaryDynamicAdviceTKey, TValueToArray(AdviceEnumeratorIDictionaryDynamicAdviceTKey, TValue)
See Also

Reference

DictionaryDynamicAdviceTKey, TValue Class
PostSharp.Patterns.Collections.Advices Namespace


HashSetDynamicAdvice(T) Class

HashSetDynamicAdviceT Class

An implementation of IHashSetDynamicAdviceT with default behavior (invokes the next advice in the chain).
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DynamicAdvisingDynamicAdvice
PostSharp.Patterns.Collections.AdvicesHashSetDynamicAdviceT

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class HashSetDynamicAdvice<T> : DynamicAdvice,
    IHashSetDynamicAdvice<T>, ICollectionDynamicAdviceBase, IDynamicAdvice, IDynamicInterfaceImplementation

Type Parameters

T
Type of items in the AdvisableCollectionT

The HashSetDynamicAdviceT type exposes the following members.

Constructors
 | Name | Description
Protected method | HashSetDynamicAdviceT | Initializes a new HashSetDynamicAdviceT.
Top
Properties
 | Name | Description
Protected property | AdvisedObject | Gets the advised object. (Inherited from DynamicAdvice.)
Public property | Identity | Gets the type identity of the advice, which should correspond to the first parameter of the Advise(Type, FuncIQueryInterface, IDynamicAdvice) method. This is typically the generic type definition of the advice (Inherited from DynamicAdvice.)
Public property | Order | Gets the execution order of the dynamic advice. See DynamicAdviceOrder. (Inherited from DynamicAdvice.)
Protected property | Set | Gets the parent AdvisableHashSetT.
Top
Methods
 | Name | Description
Public method | AddItem | Adds an item to the hash set.
Public method | ChangeMany | Adds and/or removes several items to or from the hash set.
Public method | ClearItems | Removes all items from the hash set.
Public method | Dispose | Disposes the current advice. // We don't use IDisposable so that advises are not be cast to IDisposable by default. (Inherited from DynamicAdvice.)
Public method | Initialize | Initializes the current advice. (Inherited from DynamicAdvice.)
Public method | IsReadOnly | Determines whether the advised collection is read-only.
Public method | IsSynchronized | Determines whether the advised collection is synchronized (i.e. thread-safe).
Public method | QueryInterfaceTInterface | (Inherited from DynamicAdvice.)
Public method | RemoveItem | Removes an item from the hash set.
Public method | ToArray | Copies the hash set to an array.
Top
See Also

Reference

PostSharp.Patterns.Collections.Advices Namespace


HashSetDynamicAdvice(T) Constructor

HashSetDynamicAdviceT Constructor

Initializes a new HashSetDynamicAdviceT.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected HashSetDynamicAdvice(
    IQueryInterface parent
)

Parameters

parent
Type: PostSharp.Patterns.DynamicAdvisingIQueryInterface
The parent object.
See Also

Reference

HashSetDynamicAdviceT Class
PostSharp.Patterns.Collections.Advices Namespace


HashSetDynamicAdvice(T) Properties

HashSetDynamicAdviceT Properties

The HashSetDynamicAdviceT generic type exposes the following members.

Properties
 | Name | Description
Protected property | AdvisedObject | Gets the advised object. (Inherited from DynamicAdvice.)
Public property | Identity | Gets the type identity of the advice, which should correspond to the first parameter of the Advise(Type, FuncIQueryInterface, IDynamicAdvice) method. This is typically the generic type definition of the advice (Inherited from DynamicAdvice.)
Public property | Order | Gets the execution order of the dynamic advice. See DynamicAdviceOrder. (Inherited from DynamicAdvice.)
Protected property | Set | Gets the parent AdvisableHashSetT.
Top
See Also

Reference

HashSetDynamicAdviceT Class
PostSharp.Patterns.Collections.Advices Namespace


HashSetDynamicAdvice(T).Set Property

HashSetDynamicAdviceTSet Property

Gets the parent AdvisableHashSetT.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected AdvisableHashSet<T> Set { get; }

Property Value

Type: AdvisableHashSet T
See Also

Reference

HashSetDynamicAdviceT Class
PostSharp.Patterns.Collections.Advices Namespace


HashSetDynamicAdvice(T) Methods

HashSetDynamicAdviceT Methods

The HashSetDynamicAdviceT generic type exposes the following members.

Methods
 | Name | Description
Public method | AddItem | Adds an item to the hash set.
Public method | ChangeMany | Adds and/or removes several items to or from the hash set.
Public method | ClearItems | Removes all items from the hash set.
Public method | Dispose | Disposes the current advice. // We don't use IDisposable so that advises are not be cast to IDisposable by default. (Inherited from DynamicAdvice.)
Public method | Initialize | Initializes the current advice. (Inherited from DynamicAdvice.)
Public method | IsReadOnly | Determines whether the advised collection is read-only.
Public method | IsSynchronized | Determines whether the advised collection is synchronized (i.e. thread-safe).
Public method | QueryInterfaceTInterface | (Inherited from DynamicAdvice.)
Public method | RemoveItem | Removes an item from the hash set.
Public method | ToArray | Copies the hash set to an array.
Top
See Also

Reference

HashSetDynamicAdviceT Class
PostSharp.Patterns.Collections.Advices Namespace


HashSetDynamicAdvice(T).AddItem Method

HashSetDynamicAdviceTAddItem Method

Adds an item to the hash set.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void AddItem(
    T item,
    AdviceEnumerator<IHashSetDynamicAdvice<T>> nextAdvices
)

Parameters

item
Type: T
nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator IHashSetDynamicAdvice T

Implements

IHashSetDynamicAdviceTAddItem(T, AdviceEnumeratorIHashSetDynamicAdviceT)
See Also

Reference

HashSetDynamicAdviceT Class
PostSharp.Patterns.Collections.Advices Namespace


HashSetDynamicAdvice(T).ChangeMany Method

HashSetDynamicAdviceTChangeMany Method

Adds and/or removes several items to or from the hash set.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void ChangeMany(
    AdviceEnumerator<IHashSetDynamicAdvice<T>> nextAdvices,
    IList<T> itemsToAdd,
    IList<T> itemsToRemove
)

Parameters

nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator IHashSetDynamicAdvice T
itemsToAdd
Type: System.Collections.GenericIList T
itemsToRemove
Type: System.Collections.GenericIList T

Implements

IHashSetDynamicAdviceTChangeMany(AdviceEnumeratorIHashSetDynamicAdviceT, IListT, IListT)
See Also

Reference

HashSetDynamicAdviceT Class
PostSharp.Patterns.Collections.Advices Namespace


HashSetDynamicAdvice(T).ClearItems Method

HashSetDynamicAdviceTClearItems Method

Removes all items from the hash set.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void ClearItems(
    AdviceEnumerator<IHashSetDynamicAdvice<T>> nextAdvices
)

Parameters

nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator IHashSetDynamicAdvice T

Implements

IHashSetDynamicAdviceTClearItems(AdviceEnumeratorIHashSetDynamicAdviceT)
See Also

Reference

HashSetDynamicAdviceT Class
PostSharp.Patterns.Collections.Advices Namespace


HashSetDynamicAdvice(T).IsReadOnly Method

HashSetDynamicAdviceTIsReadOnly Method

Determines whether the advised collection is read-only.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual bool IsReadOnly(
    AdviceEnumerator<ICollectionDynamicAdviceBase> nextAdvices
)

Parameters

nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator ICollectionDynamicAdviceBase
The next advice in the chain of responsibility.

Return Value

Type: Boolean
true if the advised collection is read-only, otherwise false.

Implements

ICollectionDynamicAdviceBaseIsReadOnly(AdviceEnumeratorICollectionDynamicAdviceBase)
See Also

Reference

HashSetDynamicAdviceT Class
PostSharp.Patterns.Collections.Advices Namespace


HashSetDynamicAdvice(T).IsSynchronized Method

HashSetDynamicAdviceTIsSynchronized Method

Determines whether the advised collection is synchronized (i.e. thread-safe).

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual bool IsSynchronized(
    AdviceEnumerator<ICollectionDynamicAdviceBase> nextAdvices
)

Parameters

nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator ICollectionDynamicAdviceBase
The next advice in the chain of responsibility.

Return Value

Type: Boolean
true if the advised collection is synchronized (i.e. thread-safe), otherwise false.

Implements

ICollectionDynamicAdviceBaseIsSynchronized(AdviceEnumeratorICollectionDynamicAdviceBase)
See Also

Reference

HashSetDynamicAdviceT Class
PostSharp.Patterns.Collections.Advices Namespace


HashSetDynamicAdvice(T).RemoveItem Method

HashSetDynamicAdviceTRemoveItem Method

Removes an item from the hash set.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void RemoveItem(
    T item,
    AdviceEnumerator<IHashSetDynamicAdvice<T>> nextAdvices
)

Parameters

item
Type: T
nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator IHashSetDynamicAdvice T

Implements

IHashSetDynamicAdviceTRemoveItem(T, AdviceEnumeratorIHashSetDynamicAdviceT)
See Also

Reference

HashSetDynamicAdviceT Class
PostSharp.Patterns.Collections.Advices Namespace


HashSetDynamicAdvice(T).ToArray Method

HashSetDynamicAdviceTToArray Method

Copies the hash set to an array.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual T[] ToArray(
    AdviceEnumerator<IHashSetDynamicAdvice<T>> nextAdvices
)

Parameters

nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator IHashSetDynamicAdvice T

Return Value

Type: T

Implements

IHashSetDynamicAdviceTToArray(AdviceEnumeratorIHashSetDynamicAdviceT)
See Also

Reference

HashSetDynamicAdviceT Class
PostSharp.Patterns.Collections.Advices Namespace


ICollectionDynamicAdvice(T) Interface

ICollectionDynamicAdviceT Interface

Defines the semantics of a dynamic advice that can be applied to an AdvisableCollectionT.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ICollectionDynamicAdvice<T> : ICollectionDynamicAdviceBase,
    IDynamicAdvice, IDynamicInterfaceImplementation

Type Parameters

T
Type of collection items.

The ICollectionDynamicAdviceT type exposes the following members.

Properties
 | Name | Description
Public property | AdvisedObject | Gets the principal object for which the current object is an indirect interface implementation. (Inherited from IDynamicInterfaceImplementation.)
Public property | Identity | Gets the type identity of the advice, which should correspond to the first parameter of the Advise(Type, FuncIQueryInterface, IDynamicAdvice) method. This is typically the generic type definition of the advice (Inherited from IDynamicAdvice.)
Public property | Order | Gets the execution order of the dynamic advice. See DynamicAdviceOrder. (Inherited from IDynamicAdvice.)
Top
Methods
 | Name | Description
Public method | ClearItems | Empties the advised collection.
Public method | Dispose | Disposes the current advice. // We don't use IDisposable so that advises are not be cast to IDisposable by default. (Inherited from IDynamicAdvice.)
Public method | Initialize | Initializes the current advice. (Inherited from IDynamicAdvice.)
Public method | InsertItem | Inserts an item into the advised collection.
Public method | InsertMany | Inserts several items to the advised collection.
Public method | IsReadOnly | Determines whether the advised collection is read-only. (Inherited from ICollectionDynamicAdviceBase.)
Public method | IsSynchronized | Determines whether the advised collection is synchronized (i.e. thread-safe). (Inherited from ICollectionDynamicAdviceBase.)
Public method | MoveItem | Moves an item of the advised collection from an old index to a new index.
Public method | QueryInterfaceT | Gets the implementation of an interface. (Inherited from IDynamicAdvice.)
Public method | RemoveItem | Removes an item from the advised collection.
Public method | RemoveMany | Removes several items from the advised collection.
Public method | SetItem | Replaces an item in the advised collection.
Public method | ToArray | Copies the advised collection into a new array.
Top
See Also

Reference

PostSharp.Patterns.Collections.Advices Namespace


ICollectionDynamicAdvice(T) Properties

ICollectionDynamicAdviceT Properties

The ICollectionDynamicAdviceT generic type exposes the following members.

Properties
 | Name | Description
Public property | AdvisedObject | Gets the principal object for which the current object is an indirect interface implementation. (Inherited from IDynamicInterfaceImplementation.)
Public property | Identity | Gets the type identity of the advice, which should correspond to the first parameter of the Advise(Type, FuncIQueryInterface, IDynamicAdvice) method. This is typically the generic type definition of the advice (Inherited from IDynamicAdvice.)
Public property | Order | Gets the execution order of the dynamic advice. See DynamicAdviceOrder. (Inherited from IDynamicAdvice.)
Top
See Also

Reference

ICollectionDynamicAdviceT Interface
PostSharp.Patterns.Collections.Advices Namespace


ICollectionDynamicAdvice(T) Methods

ICollectionDynamicAdviceT Methods

The ICollectionDynamicAdviceT generic type exposes the following members.

Methods
 | Name | Description
Public method | ClearItems | Empties the advised collection.
Public method | Dispose | Disposes the current advice. // We don't use IDisposable so that advises are not be cast to IDisposable by default. (Inherited from IDynamicAdvice.)
Public method | Initialize | Initializes the current advice. (Inherited from IDynamicAdvice.)
Public method | InsertItem | Inserts an item into the advised collection.
Public method | InsertMany | Inserts several items to the advised collection.
Public method | IsReadOnly | Determines whether the advised collection is read-only. (Inherited from ICollectionDynamicAdviceBase.)
Public method | IsSynchronized | Determines whether the advised collection is synchronized (i.e. thread-safe). (Inherited from ICollectionDynamicAdviceBase.)
Public method | MoveItem | Moves an item of the advised collection from an old index to a new index.
Public method | QueryInterfaceT | Gets the implementation of an interface. (Inherited from IDynamicAdvice.)
Public method | RemoveItem | Removes an item from the advised collection.
Public method | RemoveMany | Removes several items from the advised collection.
Public method | SetItem | Replaces an item in the advised collection.
Public method | ToArray | Copies the advised collection into a new array.
Top
See Also

Reference

ICollectionDynamicAdviceT Interface
PostSharp.Patterns.Collections.Advices Namespace


ICollectionDynamicAdvice(T).ClearItems Method

ICollectionDynamicAdviceTClearItems Method

Empties the advised collection.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void ClearItems(
    AdviceEnumerator<ICollectionDynamicAdvice<T>> nextAdvices
)

Parameters

nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator ICollectionDynamicAdvice T
See Also

Reference

ICollectionDynamicAdviceT Interface
PostSharp.Patterns.Collections.Advices Namespace


ICollectionDynamicAdvice(T).InsertItem Method

ICollectionDynamicAdviceTInsertItem Method

Inserts an item into the advised collection.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void InsertItem(
    int index,
    T item,
    AdviceEnumerator<ICollectionDynamicAdvice<T>> nextAdvices
)

Parameters

index
Type: SystemInt32
item
Type: T
nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator ICollectionDynamicAdvice T
See Also

Reference

ICollectionDynamicAdviceT Interface
PostSharp.Patterns.Collections.Advices Namespace


ICollectionDynamicAdvice(T).InsertMany Method

ICollectionDynamicAdviceTInsertMany Method

Inserts several items to the advised collection.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void InsertMany(
    int index,
    T[] itemsToAdd,
    AdviceEnumerator<ICollectionDynamicAdvice<T>> nextAdvices
)

Parameters

index
Type: SystemInt32
itemsToAdd
Type: T
nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator ICollectionDynamicAdvice T
See Also

Reference

ICollectionDynamicAdviceT Interface
PostSharp.Patterns.Collections.Advices Namespace


ICollectionDynamicAdvice(T).MoveItem Method

ICollectionDynamicAdviceTMoveItem Method

Moves an item of the advised collection from an old index to a new index.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void MoveItem(
    T item,
    int oldIndex,
    int newIndex,
    AdviceEnumerator<ICollectionDynamicAdvice<T>> nextAdvices
)

Parameters

item
Type: T
oldIndex
Type: SystemInt32
newIndex
Type: SystemInt32
nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator ICollectionDynamicAdvice T
See Also

Reference

ICollectionDynamicAdviceT Interface
PostSharp.Patterns.Collections.Advices Namespace


ICollectionDynamicAdvice(T).RemoveItem Method

ICollectionDynamicAdviceTRemoveItem Method

Removes an item from the advised collection.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void RemoveItem(
    int index,
    T item,
    AdviceEnumerator<ICollectionDynamicAdvice<T>> nextAdvices
)

Parameters

index
Type: SystemInt32
item
Type: T
nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator ICollectionDynamicAdvice T
See Also

Reference

ICollectionDynamicAdviceT Interface
PostSharp.Patterns.Collections.Advices Namespace


ICollectionDynamicAdvice(T).RemoveMany Method

ICollectionDynamicAdviceTRemoveMany Method

Removes several items from the advised collection.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void RemoveMany(
    int index,
    T[] itemsToRemove,
    AdviceEnumerator<ICollectionDynamicAdvice<T>> nextAdvices
)

Parameters

index
Type: SystemInt32
itemsToRemove
Type: T
nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator ICollectionDynamicAdvice T
See Also

Reference

ICollectionDynamicAdviceT Interface
PostSharp.Patterns.Collections.Advices Namespace


ICollectionDynamicAdvice(T).SetItem Method

ICollectionDynamicAdviceTSetItem Method

Replaces an item in the advised collection.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void SetItem(
    int index,
    T item,
    T oldItem,
    AdviceEnumerator<ICollectionDynamicAdvice<T>> nextAdvices
)

Parameters

index
Type: SystemInt32
item
Type: T
oldItem
Type: T
nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator ICollectionDynamicAdvice T
See Also

Reference

ICollectionDynamicAdviceT Interface
PostSharp.Patterns.Collections.Advices Namespace


ICollectionDynamicAdvice(T).ToArray Method

ICollectionDynamicAdviceTToArray Method

Copies the advised collection into a new array.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
T[] ToArray(
    AdviceEnumerator<ICollectionDynamicAdvice<T>> nextAdvices
)

Parameters

nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator ICollectionDynamicAdvice T

Return Value

Type: T
See Also

Reference

ICollectionDynamicAdviceT Interface
PostSharp.Patterns.Collections.Advices Namespace


ICollectionDynamicAdviceBase Interface

Base interface for all dynamic advices that apply to collection-like types.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ICollectionDynamicAdviceBase : IDynamicAdvice,
    IDynamicInterfaceImplementation

The ICollectionDynamicAdviceBase type exposes the following members.

Properties
 | Name | Description
Public property | AdvisedObject | Gets the principal object for which the current object is an indirect interface implementation. (Inherited from IDynamicInterfaceImplementation.)
Public property | Identity | Gets the type identity of the advice, which should correspond to the first parameter of the Advise(Type, FuncIQueryInterface, IDynamicAdvice) method. This is typically the generic type definition of the advice (Inherited from IDynamicAdvice.)
Public property | Order | Gets the execution order of the dynamic advice. See DynamicAdviceOrder. (Inherited from IDynamicAdvice.)
Top
Methods
 | Name | Description
Public method | Dispose | Disposes the current advice. // We don't use IDisposable so that advises are not be cast to IDisposable by default. (Inherited from IDynamicAdvice.)
Public method | Initialize | Initializes the current advice. (Inherited from IDynamicAdvice.)
Public method | IsReadOnly | Determines whether the advised collection is read-only.
Public method | IsSynchronized | Determines whether the advised collection is synchronized (i.e. thread-safe).
Public method | QueryInterfaceT | Gets the implementation of an interface. (Inherited from IDynamicAdvice.)
Top
See Also

Reference

PostSharp.Patterns.Collections.Advices Namespace


ICollectionDynamicAdviceBase Properties

The ICollectionDynamicAdviceBase type exposes the following members.

Properties
 | Name | Description
Public property | AdvisedObject | Gets the principal object for which the current object is an indirect interface implementation. (Inherited from IDynamicInterfaceImplementation.)
Public property | Identity | Gets the type identity of the advice, which should correspond to the first parameter of the Advise(Type, FuncIQueryInterface, IDynamicAdvice) method. This is typically the generic type definition of the advice (Inherited from IDynamicAdvice.)
Public property | Order | Gets the execution order of the dynamic advice. See DynamicAdviceOrder. (Inherited from IDynamicAdvice.)
Top
See Also

Reference

ICollectionDynamicAdviceBase Interface
PostSharp.Patterns.Collections.Advices Namespace


ICollectionDynamicAdviceBase Methods

The ICollectionDynamicAdviceBase type exposes the following members.

Methods
 | Name | Description
Public method | Dispose | Disposes the current advice. // We don't use IDisposable so that advises are not be cast to IDisposable by default. (Inherited from IDynamicAdvice.)
Public method | Initialize | Initializes the current advice. (Inherited from IDynamicAdvice.)
Public method | IsReadOnly | Determines whether the advised collection is read-only.
Public method | IsSynchronized | Determines whether the advised collection is synchronized (i.e. thread-safe).
Public method | QueryInterfaceT | Gets the implementation of an interface. (Inherited from IDynamicAdvice.)
Top
See Also

Reference

ICollectionDynamicAdviceBase Interface
PostSharp.Patterns.Collections.Advices Namespace


ICollectionDynamicAdviceBase.IsReadOnly Method

ICollectionDynamicAdviceBaseIsReadOnly Method

Determines whether the advised collection is read-only.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
bool IsReadOnly(
    AdviceEnumerator<ICollectionDynamicAdviceBase> nextAdvices
)

Parameters

nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator ICollectionDynamicAdviceBase
The next advice in the chain of responsibility.

Return Value

Type: Boolean
true if the advised collection is read-only, otherwise false.
See Also

Reference

ICollectionDynamicAdviceBase Interface
PostSharp.Patterns.Collections.Advices Namespace


ICollectionDynamicAdviceBase.IsSynchronized Method

ICollectionDynamicAdviceBaseIsSynchronized Method

Determines whether the advised collection is synchronized (i.e. thread-safe).

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
bool IsSynchronized(
    AdviceEnumerator<ICollectionDynamicAdviceBase> nextAdvices
)

Parameters

nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator ICollectionDynamicAdviceBase
The next advice in the chain of responsibility.

Return Value

Type: Boolean
true if the advised collection is synchronized (i.e. thread-safe), otherwise false.
See Also

Reference

ICollectionDynamicAdviceBase Interface
PostSharp.Patterns.Collections.Advices Namespace


ICollectionDynamicAdviceFactory(TPayload) Interface

ICollectionDynamicAdviceFactoryTPayload Interface

Creates instances of the ICollectionDynamicAdviceT interface.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ICollectionDynamicAdviceFactory<TPayload>

Type Parameters

TPayload

The ICollectionDynamicAdviceFactoryTPayload type exposes the following members.

Methods
 | Name | Description
Public method | Create | Creates a new instance implementing ICollectionDynamicAdviceT.
Top
See Also

Reference

PostSharp.Patterns.Collections.Advices Namespace


ICollectionDynamicAdviceFactory(TPayload) Methods

ICollectionDynamicAdviceFactoryTPayload Methods

The ICollectionDynamicAdviceFactoryTPayload generic type exposes the following members.

Methods
 | Name | Description
Public method | Create | Creates a new instance implementing ICollectionDynamicAdviceT.
Top
See Also

Reference

ICollectionDynamicAdviceFactoryTPayload Interface
PostSharp.Patterns.Collections.Advices Namespace


ICollectionDynamicAdviceFactory(TPayload).Create Method

ICollectionDynamicAdviceFactoryTPayloadCreate Method

Creates a new instance implementing ICollectionDynamicAdviceT.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IDynamicAdvice Create(
    IDynamicallyAdvisableCollection collection,
    TPayload payload
)

Parameters

collection
Type: PostSharp.Patterns.Collections.AdvicesIDynamicallyAdvisableCollection
The collection being advised.
payload
Type: TPayload

Return Value

Type: IDynamicAdvice
See Also

Reference

ICollectionDynamicAdviceFactoryTPayload Interface
PostSharp.Patterns.Collections.Advices Namespace


IDictionaryDynamicAdvice(TKey, TValue) Interface

IDictionaryDynamicAdviceTKey, TValue Interface

Defines the semantics of a dynamic advice that can be applied to an AdvisableDictionaryTKey, TValue.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IDictionaryDynamicAdvice<TKey, TValue> : ICollectionDynamicAdviceBase,
    IDynamicAdvice, IDynamicInterfaceImplementation

Type Parameters

TKey
Type of dictionary keys.
TValue
Type of dictionary values.

The IDictionaryDynamicAdviceTKey, TValue type exposes the following members.

Properties
 | Name | Description
Public property | AdvisedObject | Gets the principal object for which the current object is an indirect interface implementation. (Inherited from IDynamicInterfaceImplementation.)
Public property | Identity | Gets the type identity of the advice, which should correspond to the first parameter of the Advise(Type, FuncIQueryInterface, IDynamicAdvice) method. This is typically the generic type definition of the advice (Inherited from IDynamicAdvice.)
Public property | Order | Gets the execution order of the dynamic advice. See DynamicAdviceOrder. (Inherited from IDynamicAdvice.)
Top
Methods
 | Name | Description
Public method | AddItem | Adds an item to the dictionary.
Public method | ClearItems | Empties the dictionary.
Public method | Dispose | Disposes the current advice. // We don't use IDisposable so that advises are not be cast to IDisposable by default. (Inherited from IDynamicAdvice.)
Public method | Initialize | Initializes the current advice. (Inherited from IDynamicAdvice.)
Public method | IsReadOnly | Determines whether the advised collection is read-only. (Inherited from ICollectionDynamicAdviceBase.)
Public method | IsSynchronized | Determines whether the advised collection is synchronized (i.e. thread-safe). (Inherited from ICollectionDynamicAdviceBase.)
Public method | QueryInterfaceT | Gets the implementation of an interface. (Inherited from IDynamicAdvice.)
Public method | RemoveItem | Removes an item from the dictionary.
Public method | SetItem | Replaces an item with another one in the dictionary.
Public method | ToArray | Copies the dictionary to an array of keys and values.
Top
See Also

Reference

PostSharp.Patterns.Collections.Advices Namespace


IDictionaryDynamicAdvice(TKey, TValue) Properties

IDictionaryDynamicAdviceTKey, TValue Properties

The IDictionaryDynamicAdviceTKey, TValue generic type exposes the following members.

Properties
 | Name | Description
Public property | AdvisedObject | Gets the principal object for which the current object is an indirect interface implementation. (Inherited from IDynamicInterfaceImplementation.)
Public property | Identity | Gets the type identity of the advice, which should correspond to the first parameter of the Advise(Type, FuncIQueryInterface, IDynamicAdvice) method. This is typically the generic type definition of the advice (Inherited from IDynamicAdvice.)
Public property | Order | Gets the execution order of the dynamic advice. See DynamicAdviceOrder. (Inherited from IDynamicAdvice.)
Top
See Also

Reference

IDictionaryDynamicAdviceTKey, TValue Interface
PostSharp.Patterns.Collections.Advices Namespace


IDictionaryDynamicAdvice(TKey, TValue) Methods

IDictionaryDynamicAdviceTKey, TValue Methods

The IDictionaryDynamicAdviceTKey, TValue generic type exposes the following members.

Methods
 | Name | Description
Public method | AddItem | Adds an item to the dictionary.
Public method | ClearItems | Empties the dictionary.
Public method | Dispose | Disposes the current advice. // We don't use IDisposable so that advises are not be cast to IDisposable by default. (Inherited from IDynamicAdvice.)
Public method | Initialize | Initializes the current advice. (Inherited from IDynamicAdvice.)
Public method | IsReadOnly | Determines whether the advised collection is read-only. (Inherited from ICollectionDynamicAdviceBase.)
Public method | IsSynchronized | Determines whether the advised collection is synchronized (i.e. thread-safe). (Inherited from ICollectionDynamicAdviceBase.)
Public method | QueryInterfaceT | Gets the implementation of an interface. (Inherited from IDynamicAdvice.)
Public method | RemoveItem | Removes an item from the dictionary.
Public method | SetItem | Replaces an item with another one in the dictionary.
Public method | ToArray | Copies the dictionary to an array of keys and values.
Top
See Also

Reference

IDictionaryDynamicAdviceTKey, TValue Interface
PostSharp.Patterns.Collections.Advices Namespace


IDictionaryDynamicAdvice(TKey, TValue).AddItem Method

IDictionaryDynamicAdviceTKey, TValueAddItem Method

Adds an item to the dictionary.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void AddItem(
    TKey key,
    TValue value,
    AdviceEnumerator<IDictionaryDynamicAdvice<TKey, TValue>> nextAdvices
)

Parameters

key
Type: TKey
value
Type: TValue
nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator IDictionaryDynamicAdvice TKey, TValue
See Also

Reference

IDictionaryDynamicAdviceTKey, TValue Interface
PostSharp.Patterns.Collections.Advices Namespace


IDictionaryDynamicAdvice(TKey, TValue).ClearItems Method

IDictionaryDynamicAdviceTKey, TValueClearItems Method

Empties the dictionary.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void ClearItems(
    AdviceEnumerator<IDictionaryDynamicAdvice<TKey, TValue>> nextAdvices
)

Parameters

nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator IDictionaryDynamicAdvice TKey, TValue
See Also

Reference

IDictionaryDynamicAdviceTKey, TValue Interface
PostSharp.Patterns.Collections.Advices Namespace


IDictionaryDynamicAdvice(TKey, TValue).RemoveItem Method

IDictionaryDynamicAdviceTKey, TValueRemoveItem Method

Removes an item from the dictionary.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void RemoveItem(
    TKey key,
    TValue value,
    AdviceEnumerator<IDictionaryDynamicAdvice<TKey, TValue>> nextAdvices
)

Parameters

key
Type: TKey
value
Type: TValue
nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator IDictionaryDynamicAdvice TKey, TValue
See Also

Reference

IDictionaryDynamicAdviceTKey, TValue Interface
PostSharp.Patterns.Collections.Advices Namespace


IDictionaryDynamicAdvice(TKey, TValue).SetItem Method

IDictionaryDynamicAdviceTKey, TValueSetItem Method

Replaces an item with another one in the dictionary.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void SetItem(
    TKey key,
    TValue value,
    TValue oldValue,
    AdviceEnumerator<IDictionaryDynamicAdvice<TKey, TValue>> nextAdvices
)

Parameters

key
Type: TKey
value
Type: TValue
oldValue
Type: TValue
nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator IDictionaryDynamicAdvice TKey, TValue
See Also

Reference

IDictionaryDynamicAdviceTKey, TValue Interface
PostSharp.Patterns.Collections.Advices Namespace


IDictionaryDynamicAdvice(TKey, TValue).ToArray Method

IDictionaryDynamicAdviceTKey, TValueToArray Method

Copies the dictionary to an array of keys and values.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
KeyValuePair<TKey, TValue>[] ToArray(
    AdviceEnumerator<IDictionaryDynamicAdvice<TKey, TValue>> nextAdvices
)

Parameters

nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator IDictionaryDynamicAdvice TKey, TValue

Return Value

Type: KeyValuePair TKey, TValue
See Also

Reference

IDictionaryDynamicAdviceTKey, TValue Interface
PostSharp.Patterns.Collections.Advices Namespace


IDictionaryDynamicAdviceFactory(TPayload) Interface

IDictionaryDynamicAdviceFactoryTPayload Interface

Creates instances of the IDictionaryDynamicAdviceTKey, TValue interface.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IDictionaryDynamicAdviceFactory<TPayload>

Type Parameters

TPayload

The IDictionaryDynamicAdviceFactoryTPayload type exposes the following members.

Methods
 | Name | Description
Public method | Create | Creates a new instance implementing IDictionaryDynamicAdviceTKey, TValue.
Top
See Also

Reference

PostSharp.Patterns.Collections.Advices Namespace


IDictionaryDynamicAdviceFactory(TPayload) Methods

IDictionaryDynamicAdviceFactoryTPayload Methods

The IDictionaryDynamicAdviceFactoryTPayload generic type exposes the following members.

Methods
 | Name | Description
Public method | Create | Creates a new instance implementing IDictionaryDynamicAdviceTKey, TValue.
Top
See Also

Reference

IDictionaryDynamicAdviceFactoryTPayload Interface
PostSharp.Patterns.Collections.Advices Namespace


IDictionaryDynamicAdviceFactory(TPayload).Create Method

IDictionaryDynamicAdviceFactoryTPayloadCreate Method

Creates a new instance implementing IDictionaryDynamicAdviceTKey, TValue.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IDynamicAdvice Create(
    IDynamicallyAdvisableDictionary dictionary,
    TPayload payload
)

Parameters

dictionary
Type: PostSharp.Patterns.Collections.AdvicesIDynamicallyAdvisableDictionary
The dictionary being advised.
payload
Type: TPayload

Return Value

Type: IDynamicAdvice
See Also

Reference

IDictionaryDynamicAdviceFactoryTPayload Interface
PostSharp.Patterns.Collections.Advices Namespace


IDynamicallyAdvisableCollection Interface

Defines the semantics of a collection that can be advised dynamically.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IDynamicallyAdvisableCollection : IDynamicallyAdvisable,
    IQueryInterface, ICollection, IEnumerable

The IDynamicallyAdvisableCollection type exposes the following members.

Properties
 | Name | Description
Public property | ItemType | Gets the type of items in the collection.
Top
Methods
 | Name | Description
Public method | Advise | Adds an advice to the object. (Inherited from IDynamicallyAdvisable.)
Public method | QueryAdviceT | Queries an interface implemented by a dynamic advice. (Inherited from IDynamicallyAdvisable.)
Public method | QueryInterfaceT | Gets the implementation of a specified interface for the current object. (Inherited from IQueryInterface.)
Public method | Unadvise | Removes an advice from the object. (Inherited from IDynamicallyAdvisable.)
Top
See Also

Reference

PostSharp.Patterns.Collections.Advices Namespace


IDynamicallyAdvisableCollection Properties

The IDynamicallyAdvisableCollection type exposes the following members.

Properties
 | Name | Description
Public property | ItemType | Gets the type of items in the collection.
Top
See Also

Reference

IDynamicallyAdvisableCollection Interface
PostSharp.Patterns.Collections.Advices Namespace


IDynamicallyAdvisableCollection.ItemType Property

IDynamicallyAdvisableCollectionItemType Property

Gets the type of items in the collection.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Type ItemType { get; }

Property Value

Type: Type
See Also

Reference

IDynamicallyAdvisableCollection Interface
PostSharp.Patterns.Collections.Advices Namespace


IDynamicallyAdvisableCollection Methods

The IDynamicallyAdvisableCollection type exposes the following members.

Methods
 | Name | Description
Public method | Advise | Adds an advice to the object. (Inherited from IDynamicallyAdvisable.)
Public method | QueryAdviceT | Queries an interface implemented by a dynamic advice. (Inherited from IDynamicallyAdvisable.)
Public method | QueryInterfaceT | Gets the implementation of a specified interface for the current object. (Inherited from IQueryInterface.)
Public method | Unadvise | Removes an advice from the object. (Inherited from IDynamicallyAdvisable.)
Top
See Also

Reference

IDynamicallyAdvisableCollection Interface
PostSharp.Patterns.Collections.Advices Namespace


IDynamicallyAdvisableDictionary Interface

Defines the semantics of a dictionary that can be advised dynamically.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IDynamicallyAdvisableDictionary : IDynamicallyAdvisable,
    IQueryInterface, IDictionary, ICollection, IEnumerable

The IDynamicallyAdvisableDictionary type exposes the following members.

Properties
 | Name | Description
Public property | KeyType | Type of keys in the dictionary.
Public property | ValueType | Type of values in the dictionary.
Top
Methods
 | Name | Description
Public method | Advise | Adds an advice to the object. (Inherited from IDynamicallyAdvisable.)
Public method | QueryAdviceT | Queries an interface implemented by a dynamic advice. (Inherited from IDynamicallyAdvisable.)
Public method | QueryInterfaceT | Gets the implementation of a specified interface for the current object. (Inherited from IQueryInterface.)
Public method | Unadvise | Removes an advice from the object. (Inherited from IDynamicallyAdvisable.)
Top
See Also

Reference

PostSharp.Patterns.Collections.Advices Namespace


IDynamicallyAdvisableDictionary Properties

The IDynamicallyAdvisableDictionary type exposes the following members.

Properties
 | Name | Description
Public property | KeyType | Type of keys in the dictionary.
Public property | ValueType | Type of values in the dictionary.
Top
See Also

Reference

IDynamicallyAdvisableDictionary Interface
PostSharp.Patterns.Collections.Advices Namespace


IDynamicallyAdvisableDictionary.KeyType Property

IDynamicallyAdvisableDictionaryKeyType Property

Type of keys in the dictionary.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Type KeyType { get; }

Property Value

Type: Type
See Also

Reference

IDynamicallyAdvisableDictionary Interface
PostSharp.Patterns.Collections.Advices Namespace


IDynamicallyAdvisableDictionary.ValueType Property

IDynamicallyAdvisableDictionaryValueType Property

Type of values in the dictionary.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Type ValueType { get; }

Property Value

Type: Type
See Also

Reference

IDynamicallyAdvisableDictionary Interface
PostSharp.Patterns.Collections.Advices Namespace


IDynamicallyAdvisableDictionary Methods

The IDynamicallyAdvisableDictionary type exposes the following members.

Methods
 | Name | Description
Public method | Advise | Adds an advice to the object. (Inherited from IDynamicallyAdvisable.)
Public method | QueryAdviceT | Queries an interface implemented by a dynamic advice. (Inherited from IDynamicallyAdvisable.)
Public method | QueryInterfaceT | Gets the implementation of a specified interface for the current object. (Inherited from IQueryInterface.)
Public method | Unadvise | Removes an advice from the object. (Inherited from IDynamicallyAdvisable.)
Top
See Also

Reference

IDynamicallyAdvisableDictionary Interface
PostSharp.Patterns.Collections.Advices Namespace


IDynamicallyAdvisableHashSet Interface

Defines the semantics of a collection that can be advised dynamically.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IDynamicallyAdvisableHashSet : IDynamicallyAdvisable,
    IQueryInterface, ICollection, IEnumerable

The IDynamicallyAdvisableHashSet type exposes the following members.

Properties
 | Name | Description
Public property | ItemType | Gets the type of items in the collection.
Top
Methods
 | Name | Description
Public method | Advise | Adds an advice to the object. (Inherited from IDynamicallyAdvisable.)
Public method | QueryAdviceT | Queries an interface implemented by a dynamic advice. (Inherited from IDynamicallyAdvisable.)
Public method | QueryInterfaceT | Gets the implementation of a specified interface for the current object. (Inherited from IQueryInterface.)
Public method | Unadvise | Removes an advice from the object. (Inherited from IDynamicallyAdvisable.)
Top
See Also

Reference

PostSharp.Patterns.Collections.Advices Namespace


IDynamicallyAdvisableHashSet Properties

The IDynamicallyAdvisableHashSet type exposes the following members.

Properties
 | Name | Description
Public property | ItemType | Gets the type of items in the collection.
Top
See Also

Reference

IDynamicallyAdvisableHashSet Interface
PostSharp.Patterns.Collections.Advices Namespace


IDynamicallyAdvisableHashSet.ItemType Property

IDynamicallyAdvisableHashSetItemType Property

Gets the type of items in the collection.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Type ItemType { get; }

Property Value

Type: Type
See Also

Reference

IDynamicallyAdvisableHashSet Interface
PostSharp.Patterns.Collections.Advices Namespace


IDynamicallyAdvisableHashSet Methods

The IDynamicallyAdvisableHashSet type exposes the following members.

Methods
 | Name | Description
Public method | Advise | Adds an advice to the object. (Inherited from IDynamicallyAdvisable.)
Public method | QueryAdviceT | Queries an interface implemented by a dynamic advice. (Inherited from IDynamicallyAdvisable.)
Public method | QueryInterfaceT | Gets the implementation of a specified interface for the current object. (Inherited from IQueryInterface.)
Public method | Unadvise | Removes an advice from the object. (Inherited from IDynamicallyAdvisable.)
Top
See Also

Reference

IDynamicallyAdvisableHashSet Interface
PostSharp.Patterns.Collections.Advices Namespace


IHashSetDynamicAdvice(T) Interface

IHashSetDynamicAdviceT Interface

Defines the semantics of a dynamic advice that can be applied to an AdvisableHashSetT.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IHashSetDynamicAdvice<T> : ICollectionDynamicAdviceBase,
    IDynamicAdvice, IDynamicInterfaceImplementation

Type Parameters

T
Type of collection items.

The IHashSetDynamicAdviceT type exposes the following members.

Properties
 | Name | Description
Public property | AdvisedObject | Gets the principal object for which the current object is an indirect interface implementation. (Inherited from IDynamicInterfaceImplementation.)
Public property | Identity | Gets the type identity of the advice, which should correspond to the first parameter of the Advise(Type, FuncIQueryInterface, IDynamicAdvice) method. This is typically the generic type definition of the advice (Inherited from IDynamicAdvice.)
Public property | Order | Gets the execution order of the dynamic advice. See DynamicAdviceOrder. (Inherited from IDynamicAdvice.)
Top
Methods
 | Name | Description
Public method | AddItem | Adds an item to the hash set.
Public method | ChangeMany | Adds and/or removes several items to or from the hash set.
Public method | ClearItems | Removes all items from the hash set.
Public method | Dispose | Disposes the current advice. // We don't use IDisposable so that advises are not be cast to IDisposable by default. (Inherited from IDynamicAdvice.)
Public method | Initialize | Initializes the current advice. (Inherited from IDynamicAdvice.)
Public method | IsReadOnly | Determines whether the advised collection is read-only. (Inherited from ICollectionDynamicAdviceBase.)
Public method | IsSynchronized | Determines whether the advised collection is synchronized (i.e. thread-safe). (Inherited from ICollectionDynamicAdviceBase.)
Public method | QueryInterfaceT | Gets the implementation of an interface. (Inherited from IDynamicAdvice.)
Public method | RemoveItem | Removes an item from the hash set.
Public method | ToArray | Copies the hash set to an array.
Top
See Also

Reference

PostSharp.Patterns.Collections.Advices Namespace


IHashSetDynamicAdvice(T) Properties

IHashSetDynamicAdviceT Properties

The IHashSetDynamicAdviceT generic type exposes the following members.

Properties
 | Name | Description
Public property | AdvisedObject | Gets the principal object for which the current object is an indirect interface implementation. (Inherited from IDynamicInterfaceImplementation.)
Public property | Identity | Gets the type identity of the advice, which should correspond to the first parameter of the Advise(Type, FuncIQueryInterface, IDynamicAdvice) method. This is typically the generic type definition of the advice (Inherited from IDynamicAdvice.)
Public property | Order | Gets the execution order of the dynamic advice. See DynamicAdviceOrder. (Inherited from IDynamicAdvice.)
Top
See Also

Reference

IHashSetDynamicAdviceT Interface
PostSharp.Patterns.Collections.Advices Namespace


IHashSetDynamicAdvice(T) Methods

IHashSetDynamicAdviceT Methods

The IHashSetDynamicAdviceT generic type exposes the following members.

Methods
 | Name | Description
Public method | AddItem | Adds an item to the hash set.
Public method | ChangeMany | Adds and/or removes several items to or from the hash set.
Public method | ClearItems | Removes all items from the hash set.
Public method | Dispose | Disposes the current advice. // We don't use IDisposable so that advises are not be cast to IDisposable by default. (Inherited from IDynamicAdvice.)
Public method | Initialize | Initializes the current advice. (Inherited from IDynamicAdvice.)
Public method | IsReadOnly | Determines whether the advised collection is read-only. (Inherited from ICollectionDynamicAdviceBase.)
Public method | IsSynchronized | Determines whether the advised collection is synchronized (i.e. thread-safe). (Inherited from ICollectionDynamicAdviceBase.)
Public method | QueryInterfaceT | Gets the implementation of an interface. (Inherited from IDynamicAdvice.)
Public method | RemoveItem | Removes an item from the hash set.
Public method | ToArray | Copies the hash set to an array.
Top
See Also

Reference

IHashSetDynamicAdviceT Interface
PostSharp.Patterns.Collections.Advices Namespace


IHashSetDynamicAdvice(T).AddItem Method

IHashSetDynamicAdviceTAddItem Method

Adds an item to the hash set.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void AddItem(
    T item,
    AdviceEnumerator<IHashSetDynamicAdvice<T>> nextAdvices
)

Parameters

item
Type: T
nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator IHashSetDynamicAdvice T
See Also

Reference

IHashSetDynamicAdviceT Interface
PostSharp.Patterns.Collections.Advices Namespace


IHashSetDynamicAdvice(T).ChangeMany Method

IHashSetDynamicAdviceTChangeMany Method

Adds and/or removes several items to or from the hash set.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void ChangeMany(
    AdviceEnumerator<IHashSetDynamicAdvice<T>> nextAdvices,
    IList<T> itemsToAdd,
    IList<T> itemsToRemove
)

Parameters

nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator IHashSetDynamicAdvice T
itemsToAdd
Type: System.Collections.GenericIList T
itemsToRemove
Type: System.Collections.GenericIList T
See Also

Reference

IHashSetDynamicAdviceT Interface
PostSharp.Patterns.Collections.Advices Namespace


IHashSetDynamicAdvice(T).ClearItems Method

IHashSetDynamicAdviceTClearItems Method

Removes all items from the hash set.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void ClearItems(
    AdviceEnumerator<IHashSetDynamicAdvice<T>> nextAdvices
)

Parameters

nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator IHashSetDynamicAdvice T
See Also

Reference

IHashSetDynamicAdviceT Interface
PostSharp.Patterns.Collections.Advices Namespace


IHashSetDynamicAdvice(T).RemoveItem Method

IHashSetDynamicAdviceTRemoveItem Method

Removes an item from the hash set.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void RemoveItem(
    T item,
    AdviceEnumerator<IHashSetDynamicAdvice<T>> nextAdvices
)

Parameters

item
Type: T
nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator IHashSetDynamicAdvice T
See Also

Reference

IHashSetDynamicAdviceT Interface
PostSharp.Patterns.Collections.Advices Namespace


IHashSetDynamicAdvice(T).ToArray Method

IHashSetDynamicAdviceTToArray Method

Copies the hash set to an array.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
T[] ToArray(
    AdviceEnumerator<IHashSetDynamicAdvice<T>> nextAdvices
)

Parameters

nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator IHashSetDynamicAdvice T

Return Value

Type: T
See Also

Reference

IHashSetDynamicAdviceT Interface
PostSharp.Patterns.Collections.Advices Namespace


IHashSetDynamicAdviceFactory(TPayload) Interface

IHashSetDynamicAdviceFactoryTPayload Interface

Factory for IHashSetDynamicAdviceT advices.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IHashSetDynamicAdviceFactory<TPayload>

Type Parameters

TPayload
Type of the advice payload.

The IHashSetDynamicAdviceFactoryTPayload type exposes the following members.

Methods
 | Name | Description
Public method | Create | Creates a new instance implementing IHashSetDynamicAdviceT.
Top
See Also

Reference

PostSharp.Patterns.Collections.Advices Namespace


IHashSetDynamicAdviceFactory(TPayload) Methods

IHashSetDynamicAdviceFactoryTPayload Methods

The IHashSetDynamicAdviceFactoryTPayload generic type exposes the following members.

Methods
 | Name | Description
Public method | Create | Creates a new instance implementing IHashSetDynamicAdviceT.
Top
See Also

Reference

IHashSetDynamicAdviceFactoryTPayload Interface
PostSharp.Patterns.Collections.Advices Namespace


IHashSetDynamicAdviceFactory(TPayload).Create Method

IHashSetDynamicAdviceFactoryTPayloadCreate Method

Creates a new instance implementing IHashSetDynamicAdviceT.

Namespace: PostSharp.Patterns.Collections.Advices
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IDynamicAdvice Create(
    IDynamicallyAdvisableHashSet hashSet,
    TPayload payload
)

Parameters

hashSet
Type: PostSharp.Patterns.Collections.AdvicesIDynamicallyAdvisableHashSet
The collection being advised.
payload
Type: TPayload

Return Value

Type: IDynamicAdvice
See Also

Reference

IHashSetDynamicAdviceFactoryTPayload Interface
PostSharp.Patterns.Collections.Advices Namespace


PostSharp.Patterns.Common.Utilities Namespace

Classes
 | Class | Description
Public class | FieldValueComparer | Helper class for detecting whether field value is being changed. Used by machine-generated code.


FieldValueComparer Class

Helper class for detecting whether field value is being changed. Used by machine-generated code.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Common.UtilitiesFieldValueComparer

Namespace: PostSharp.Patterns.Common.Utilities
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static class FieldValueComparer
Methods
Name | Description
AreEqualT(T, T) | Detects whether field value is being changed.
AreEqualT(Boolean, T, T) | Detects whether field value is being changed, knowing whether field type is a struct.
Top
See Also

Reference

PostSharp.Patterns.Common.Utilities Namespace


FieldValueComparer Methods

Methods
Name | Description
AreEqualT(T, T) | Detects whether field value is being changed.
AreEqualT(Boolean, T, T) | Detects whether field value is being changed, knowing whether field type is a struct.
Top
See Also

Reference

FieldValueComparer Class
PostSharp.Patterns.Common.Utilities Namespace


FieldValueComparer.AreEqual Method

FieldValueComparerAreEqual Method

Overload List
Name | Description
AreEqualT(T, T) | Detects whether field value is being changed.
AreEqualT(Boolean, T, T) | Detects whether field value is being changed, knowing whether field type is a struct.
Top
See Also

Reference

FieldValueComparer Class
PostSharp.Patterns.Common.Utilities Namespace


FieldValueComparer.AreEqual(T) Method (T, T)

FieldValueComparerAreEqualT Method (T, T)

Detects whether field value is being changed.

Namespace: PostSharp.Patterns.Common.Utilities
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool AreEqual<T>(
    T currentValue,
    T newValue
)

Parameters

currentValue
Type: T
newValue
Type: T

Type Parameters

T

Return Value

Type: Boolean
See Also

Reference

FieldValueComparer Class
AreEqual Overload
PostSharp.Patterns.Common.Utilities Namespace


FieldValueComparer.AreEqual(T) Method (Boolean, T, T)

FieldValueComparerAreEqualT Method (Boolean, T, T)

Detects whether field value is being changed, knowing whether field type is a struct.

Namespace: PostSharp.Patterns.Common.Utilities
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool AreEqual<T>(
    bool isValueType,
    T currentValue,
    T newValue
)

Parameters

isValueType
Type: SystemBoolean
currentValue
Type: T
newValue
Type: T

Type Parameters

T

Return Value

Type: Boolean
See Also

Reference

FieldValueComparer Class
AreEqual Overload
PostSharp.Patterns.Common.Utilities Namespace


PostSharp.Patterns.Contracts Namespace

The PostSharp.Patterns.Contracts namespace contains ready-made contracts that validate fields, properties and parameters at runtime.
Classes
Class Description
Public class ContractLocalizedTextProvider
Base class for contract error messages providers.
Public class CreditCardAttribute
Custom attribute that, when added to a field, property or parameter, throws an ArgumentException if the target is assigned a value that is not a valid credit card number. Null strings are accepted and do not throw an exception.
Public class EmailAddressAttribute
Custom attribute that, when added to a field, property or parameter, throws an ArgumentException if the target is assigned a value that is not a valid email address. Null strings are accepted and do not throw an exception.
Public class EnumDataTypeAttribute
Custom attribute that, when added to a field, property or parameter, throws an ArgumentException if the target is assigned a value that is not a valid member of an enumeration.
Public class GreaterThanAttribute
Custom attribute that, when added to a field, property or parameter, throws an ArgumentOutOfRangeException if the target is assigned a value that is smaller than a given value.
Public class LessThanAttribute
Custom attribute that, when added to a field, property or parameter, throws an ArgumentOutOfRangeException if the target is assigned a value that is greater than a given value.
Public class LocationContractAttribute
Base class for other custom attributes in this namespace.
Public class NegativeAttribute
Custom attribute that, when added to a field, property or parameter, throws an ArgumentOutOfRangeException if the target is assigned a value greater than zero.
Public class NotEmptyAttribute
Custom attribute that, when added to a field, property or parameter, throws an ArgumentNullException if the target is assigned a null or empty value. The custom attributes can be added to locations of type String (where empty means zero characters) or ICollection (where empty means zero items).
Public class NotNullAttribute
Custom attribute that, when added to a field, property or parameter, throws an ArgumentNullException if the target is assigned a null value.
Public class PhoneAttribute
Custom attribute that, when added to a field, property or parameter, throws an ArgumentException if the target is assigned a value that is not a valid phone number. Null strings are accepted and do not throw an exception.
Public class PositiveAttribute
Custom attribute that, when added to a field, property or parameter, throws an ArgumentOutOfRangeException if the target is assigned a value smaller than zero.
Public class PostconditionFailedException
The exception that is thrown when a postcondition contract was not fulfilled by a method.
Public class RangeAttribute
Custom attribute that, when added to a field, property or parameter, throws an ArgumentOutOfRangeException if the target is assigned a value that is outside a given range.
Public class RegularExpressionAttribute
Custom attribute that, when added to a field, property or parameter, throws an ArgumentException if the target is assigned a value that does not match a given regular expression. Null strings are accepted and do not throw an exception.
Public class RequiredAttribute
Custom attribute that, when added to a field, property or parameter, throws:
  • an ArgumentNullException if the target is assigned a null value;
  • an ArgumentOutOfRangeException if the target is assigned an empty or white-space string.
Public class StrictlyGreaterThanAttribute
Custom attribute that, when added to a field, property or parameter, throws an ArgumentOutOfRangeException if the target is assigned a value that is smaller than or equal to a given value.
Public class StrictlyLessThanAttribute
Custom attribute that, when added to a field, property or parameter, throws an ArgumentOutOfRangeException if the target is assigned a value that is greater than or equal to a given value.
Public class StrictlyNegativeAttribute
Custom attribute that, when added to a field, property or parameter, throws an ArgumentOutOfRangeException if the target is assigned a value greater than or equal to zero.
Public class StrictlyPositiveAttribute
Custom attribute that, when added to a field, property or parameter, throws an ArgumentOutOfRangeException if the target is assigned a value smaller than or equal to zero.
Public class StringLengthAttribute
Custom attribute that, when added to a field, property or parameter, throws an ArgumentException if the target is assigned a string of invalid length. Null strings are accepted and do not throw an exception.
Public class UrlAttribute
Custom attribute that, when added to a field, property or parameter, throws an ArgumentException if the target is assigned a value that is not a valid URL starting with http://, https:// or ftp://. Null strings are accepted and do not throw an exception.


ContractLocalizedTextProvider Class

Base class for contract error messages providers.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.UtilitiesLocalizedTextProvider
PostSharp.Patterns.ContractsContractLocalizedTextProvider

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class ContractLocalizedTextProvider : LocalizedTextProvider

The ContractLocalizedTextProvider type exposes the following members.

Constructors
 | Name | Description
Public method | ContractLocalizedTextProvider | Initializes a new ContractLocalizedTextProvider.
Top
Properties
Name | Description
Current | Current instance of ContractLocalizedTextProvider.
Top
Methods
 | Name | Description
Public method | FormatString | Formats a string. An implementation would typically invoke Format(String, Object). (Inherited from LocalizedTextProvider.)
Public method | GetMessage | Gets a message declared by the LocalizedTextProvider or the rest of responsibility chain if applicable. (Overrides LocalizedTextProviderGetMessage(String).)
Top
Fields
Name | Description
CreditCardErrorMessage | Identifier of the error message shown when CreditCardAttribute constraint is violated.
EmailAddressErrorMessage | Identifier of the error message shown when EmailAddressAttribute constraint is violated.
EnumDataTypeErrorMessage | Identifier of the error message shown when EnumDataTypeAttribute constraint is violated.
GreaterThanErrorMessage | Identifier of the error message shown when GreaterThanAttribute constraint is violated.
LessThanErrorMessage | Identifier of the error message shown when LessThanAttribute constraint is violated.
LocationContractErrorMessage | Identifier of the error message shown when LocationContractAttribute constraint is violated.
NotEmptyErrorMessage | Identifier of the error message shown when NotEmptyAttribute constraint is violated.
NotNullErrorMessage | Identifier of the error message shown when NotNullAttribute constraint is violated.
PhoneErrorMessage | Identifier of the error message shown when PhoneAttribute constraint is violated.
RangeErrorMessage | Identifier of the error message shown when RangeAttribute constraint is violated.
RegularExpressionErrorMessage | Identifier of the error message shown when RegularExpressionAttribute constraint is violated.
RequiredErrorMessage | Identifier of the error message shown when RequiredAttribute constraint is violated.
StrictlyGreaterThanErrorMessage | Identifier of the error message shown when StrictlyGreaterThanAttribute constraint is violated.
StrictlyLessThanErrorMessage | Identifier of the error message shown when StrictlyLessThanAttribute constraint is violated.
StringLengthMaxErrorMessage | Identifier of the error message shown when StringLengthAttribute constraint is violated (only maximum length was specified).
StringLengthMinErrorMessage | Identifier of the error message shown when StringLengthAttribute constraint is violated (only minimum length was specified).
StringLengthRangeErrorMessage | Identifier of the error message shown when StringLengthAttribute constraint is violated (both minimum and maximum was specified).
UrlErrorMessage | Identifier of the error message shown when UrlAttribute constraint is violated.
Top
See Also

Reference

PostSharp.Patterns.Contracts Namespace

Other Resources

Conceptual: Localizing Contract Errors


ContractLocalizedTextProvider Constructor

Initializes a new ContractLocalizedTextProvider.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ContractLocalizedTextProvider(
    ContractLocalizedTextProvider next
)

Parameters

next
Type: PostSharp.Patterns.ContractsContractLocalizedTextProvider
The next node in the chain of responsibility.
See Also

Reference

ContractLocalizedTextProvider Class
PostSharp.Patterns.Contracts Namespace


ContractLocalizedTextProvider Properties

The ContractLocalizedTextProvider type exposes the following members.

Properties
Name | Description
Current | Current instance of ContractLocalizedTextProvider.
Top
See Also

Reference

ContractLocalizedTextProvider Class
PostSharp.Patterns.Contracts Namespace


ContractLocalizedTextProvider.Current Property

ContractLocalizedTextProviderCurrent Property

Current instance of ContractLocalizedTextProvider.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static ContractLocalizedTextProvider Current { get; set; }

Property Value

Type: ContractLocalizedTextProvider
See Also

Reference

ContractLocalizedTextProvider Class
PostSharp.Patterns.Contracts Namespace


ContractLocalizedTextProvider Methods

The ContractLocalizedTextProvider type exposes the following members.

Methods
 | Name | Description
Public method | FormatString | Formats a string. An implementation would typically invoke Format(String, Object). (Inherited from LocalizedTextProvider.)
Public method | GetMessage | Gets a message declared by the LocalizedTextProvider or the rest of responsibility chain if applicable. (Overrides LocalizedTextProviderGetMessage(String).)
Top
See Also

Reference

ContractLocalizedTextProvider Class
PostSharp.Patterns.Contracts Namespace


ContractLocalizedTextProvider.GetMessage Method

ContractLocalizedTextProviderGetMessage Method

Gets a message declared by the LocalizedTextProvider or the rest of responsibility chain if applicable.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override string GetMessage(
    string messageId
)

Parameters

messageId
Type: SystemString
Identifier of the message.

Return Value

Type: String
Message represented by messageId. Returning null is not allowed.
Remarks

An implementation must call the base implementation if it does not provide the requested message. The base implementation is responsible to invoke the next provider in the chain of responsibility.

See Also

Reference

ContractLocalizedTextProvider Class
PostSharp.Patterns.Contracts Namespace

Other Resources

Conceptual: Localizing Contract Errors


ContractLocalizedTextProvider Fields

The ContractLocalizedTextProvider type exposes the following members.

Fields
Name | Description
CreditCardErrorMessage | Identifier of the error message shown when CreditCardAttribute constraint is violated.
EmailAddressErrorMessage | Identifier of the error message shown when EmailAddressAttribute constraint is violated.
EnumDataTypeErrorMessage | Identifier of the error message shown when EnumDataTypeAttribute constraint is violated.
GreaterThanErrorMessage | Identifier of the error message shown when GreaterThanAttribute constraint is violated.
LessThanErrorMessage | Identifier of the error message shown when LessThanAttribute constraint is violated.
LocationContractErrorMessage | Identifier of the error message shown when LocationContractAttribute constraint is violated.
NotEmptyErrorMessage | Identifier of the error message shown when NotEmptyAttribute constraint is violated.
NotNullErrorMessage | Identifier of the error message shown when NotNullAttribute constraint is violated.
PhoneErrorMessage | Identifier of the error message shown when PhoneAttribute constraint is violated.
RangeErrorMessage | Identifier of the error message shown when RangeAttribute constraint is violated.
RegularExpressionErrorMessage | Identifier of the error message shown when RegularExpressionAttribute constraint is violated.
RequiredErrorMessage | Identifier of the error message shown when RequiredAttribute constraint is violated.
StrictlyGreaterThanErrorMessage | Identifier of the error message shown when StrictlyGreaterThanAttribute constraint is violated.
StrictlyLessThanErrorMessage | Identifier of the error message shown when StrictlyLessThanAttribute constraint is violated.
StringLengthMaxErrorMessage | Identifier of the error message shown when StringLengthAttribute constraint is violated (only maximum length was specified).
StringLengthMinErrorMessage | Identifier of the error message shown when StringLengthAttribute constraint is violated (only minimum length was specified).
StringLengthRangeErrorMessage | Identifier of the error message shown when StringLengthAttribute constraint is violated (both minimum and maximum was specified).
UrlErrorMessage | Identifier of the error message shown when UrlAttribute constraint is violated.
Top
See Also

Reference

ContractLocalizedTextProvider Class
PostSharp.Patterns.Contracts Namespace


ContractLocalizedTextProvider.CreditCardErrorMessage Field

ContractLocalizedTextProviderCreditCardErrorMessage Field

Identifier of the error message shown when CreditCardAttribute constraint is violated.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string CreditCardErrorMessage = "CreditCardErrorMessage"

Field Value

Type: String
See Also

Reference

ContractLocalizedTextProvider Class
PostSharp.Patterns.Contracts Namespace


ContractLocalizedTextProvider.EmailAddressErrorMessage Field

ContractLocalizedTextProviderEmailAddressErrorMessage Field

Identifier of the error message shown when EmailAddressAttribute constraint is violated.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string EmailAddressErrorMessage = "EmailAddressErrorMessage"

Field Value

Type: String
See Also

Reference

ContractLocalizedTextProvider Class
PostSharp.Patterns.Contracts Namespace


ContractLocalizedTextProvider.EnumDataTypeErrorMessage Field

ContractLocalizedTextProviderEnumDataTypeErrorMessage Field

Identifier of the error message shown when EnumDataTypeAttribute constraint is violated.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string EnumDataTypeErrorMessage = "EnumDataTypeErrorMessage"

Field Value

Type: String
See Also

Reference

ContractLocalizedTextProvider Class
PostSharp.Patterns.Contracts Namespace


ContractLocalizedTextProvider.GreaterThanErrorMessage Field

ContractLocalizedTextProviderGreaterThanErrorMessage Field

Identifier of the error message shown when GreaterThanAttribute constraint is violated.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string GreaterThanErrorMessage = "GreaterThanErrorMessage"

Field Value

Type: String
See Also

Reference

ContractLocalizedTextProvider Class
PostSharp.Patterns.Contracts Namespace


ContractLocalizedTextProvider.LessThanErrorMessage Field

ContractLocalizedTextProviderLessThanErrorMessage Field

Identifier of the error message shown when LessThanAttribute constraint is violated.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string LessThanErrorMessage = "LessThanErrorMessage"

Field Value

Type: String
See Also

Reference

ContractLocalizedTextProvider Class
PostSharp.Patterns.Contracts Namespace


ContractLocalizedTextProvider.LocationContractErrorMessage Field

ContractLocalizedTextProviderLocationContractErrorMessage Field

Identifier of the error message shown when LocationContractAttribute constraint is violated.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string LocationContractErrorMessage = "LocationContractErrorMessage"

Field Value

Type: String
See Also

Reference

ContractLocalizedTextProvider Class
PostSharp.Patterns.Contracts Namespace


ContractLocalizedTextProvider.NotEmptyErrorMessage Field

ContractLocalizedTextProviderNotEmptyErrorMessage Field

Identifier of the error message shown when NotEmptyAttribute constraint is violated.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string NotEmptyErrorMessage = "NotEmptyErrorMessage"

Field Value

Type: String
See Also

Reference

ContractLocalizedTextProvider Class
PostSharp.Patterns.Contracts Namespace


ContractLocalizedTextProvider.NotNullErrorMessage Field

ContractLocalizedTextProviderNotNullErrorMessage Field

Identifier of the error message shown when NotNullAttribute constraint is violated.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string NotNullErrorMessage = "NotNullErrorMessage"

Field Value

Type: String
See Also

Reference

ContractLocalizedTextProvider Class
PostSharp.Patterns.Contracts Namespace


ContractLocalizedTextProvider.PhoneErrorMessage Field

ContractLocalizedTextProviderPhoneErrorMessage Field

Identifier of the error message shown when PhoneAttribute constraint is violated.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string PhoneErrorMessage = "PhoneErrorMessage"

Field Value

Type: String
See Also

Reference

ContractLocalizedTextProvider Class
PostSharp.Patterns.Contracts Namespace


ContractLocalizedTextProvider.RangeErrorMessage Field

ContractLocalizedTextProviderRangeErrorMessage Field

Identifier of the error message shown when RangeAttribute constraint is violated.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string RangeErrorMessage = "RangeErrorMessage"

Field Value

Type: String
See Also

Reference

ContractLocalizedTextProvider Class
PostSharp.Patterns.Contracts Namespace


ContractLocalizedTextProvider.RegularExpressionErrorMessage Field

ContractLocalizedTextProviderRegularExpressionErrorMessage Field

Identifier of the error message shown when RegularExpressionAttribute constraint is violated.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string RegularExpressionErrorMessage = "RegularExpressionErrorMessage"

Field Value

Type: String
See Also

Reference

ContractLocalizedTextProvider Class
PostSharp.Patterns.Contracts Namespace


ContractLocalizedTextProvider.RequiredErrorMessage Field

ContractLocalizedTextProviderRequiredErrorMessage Field

Identifier of the error message shown when RequiredAttribute constraint is violated.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string RequiredErrorMessage = "RequiredErrorMessage"

Field Value

Type: String
See Also

Reference

ContractLocalizedTextProvider Class
PostSharp.Patterns.Contracts Namespace


ContractLocalizedTextProvider.StrictlyGreaterThanErrorMessage Field

ContractLocalizedTextProviderStrictlyGreaterThanErrorMessage Field

Identifier of the error message shown when StrictlyGreaterThanAttribute constraint is violated.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string StrictlyGreaterThanErrorMessage = "StrictlyGreaterThanErrorMessage"

Field Value

Type: String
See Also

Reference

ContractLocalizedTextProvider Class
PostSharp.Patterns.Contracts Namespace


ContractLocalizedTextProvider.StrictlyLessThanErrorMessage Field

ContractLocalizedTextProviderStrictlyLessThanErrorMessage Field

Identifier of the error message shown when StrictlyLessThanAttribute constraint is violated.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string StrictlyLessThanErrorMessage = "StrictlyLessThanErrorMessage"

Field Value

Type: String
See Also

Reference

ContractLocalizedTextProvider Class
PostSharp.Patterns.Contracts Namespace


ContractLocalizedTextProvider.StringLengthMaxErrorMessage Field

ContractLocalizedTextProviderStringLengthMaxErrorMessage Field

Identifier of the error message shown when StringLengthAttribute constraint is violated (only maximum length was specified).

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string StringLengthMaxErrorMessage = "StringLengthMaxErrorMessage"

Field Value

Type: String
See Also

Reference

ContractLocalizedTextProvider Class
PostSharp.Patterns.Contracts Namespace


ContractLocalizedTextProvider.StringLengthMinErrorMessage Field

ContractLocalizedTextProviderStringLengthMinErrorMessage Field

Identifier of the error message shown when StringLengthAttribute constraint is violated (only minimum length was specified).

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string StringLengthMinErrorMessage = "StringLengthMinErrorMessage"

Field Value

Type: String
See Also

Reference

ContractLocalizedTextProvider Class
PostSharp.Patterns.Contracts Namespace


ContractLocalizedTextProvider.StringLengthRangeErrorMessage Field

ContractLocalizedTextProviderStringLengthRangeErrorMessage Field

Identifier of the error message shown when StringLengthAttribute constraint is violated (both minimum and maximum was specified).

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string StringLengthRangeErrorMessage = "StringLengthRangeErrorMessage"

Field Value

Type: String
See Also

Reference

ContractLocalizedTextProvider Class
PostSharp.Patterns.Contracts Namespace


ContractLocalizedTextProvider.UrlErrorMessage Field

ContractLocalizedTextProviderUrlErrorMessage Field

Identifier of the error message shown when UrlAttribute constraint is violated.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string UrlErrorMessage = "UrlErrorMessage"

Field Value

Type: String
See Also

Reference

ContractLocalizedTextProvider Class
PostSharp.Patterns.Contracts Namespace


CreditCardAttribute Class

Custom attribute that, when added to a field, property or parameter, throws an ArgumentException if the target is assigned a value that is not a valid credit card number. Null strings are accepted and do not throw an exception.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.Patterns.ContractsLocationContractAttribute
PostSharp.Patterns.ContractsCreditCardAttribute

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class CreditCardAttribute : LocationContractAttribute,
    IAspect

The CreditCardAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | CreditCardAttribute | Initializes a new CreditCardAttribute.
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Top
Methods
 | Name | Description
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Public method | ValidateValueDynamic | Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property. (Overrides LocationContractAttributeValidateValueDynamic(Object, String, LocationKind, LocationValidationContext).)
Top
Remarks

Error message is identified by CreditCardErrorMessage.

See Also

Reference

PostSharp.Patterns.Contracts Namespace


CreditCardAttribute Constructor

Initializes a new CreditCardAttribute.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CreditCardAttribute()
See Also

Reference

CreditCardAttribute Class
PostSharp.Patterns.Contracts Namespace


CreditCardAttribute Properties

The CreditCardAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Top
See Also

Reference

CreditCardAttribute Class
PostSharp.Patterns.Contracts Namespace


CreditCardAttribute Methods

The CreditCardAttribute type exposes the following members.

Methods
 | Name | Description
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Public method | ValidateValueDynamic | Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property. (Overrides LocationContractAttributeValidateValueDynamic(Object, String, LocationKind, LocationValidationContext).)
Top
See Also

Reference

CreditCardAttribute Class
PostSharp.Patterns.Contracts Namespace


CreditCardAttribute.ValidateValueDynamic Method

CreditCardAttributeValidateValueDynamic Method

Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Exception ValidateValueDynamic(
    Object value,
    string locationName,
    LocationKind locationKind,
    LocationValidationContext context
)

Parameters

value
Type: SystemObject
Value.
locationName
Type: SystemString
The name of the property.
locationKind
Type: PostSharp.ReflectionLocationKind
The kind of location (typically a Property).
context
Type: PostSharp.AspectsLocationValidationContext
Why or when the value is being validated.

Return Value

Type: Exception
An Exception if the value is invalid, or null if the value is valid.
See Also

Reference

CreditCardAttribute Class
PostSharp.Patterns.Contracts Namespace


EmailAddressAttribute Class

Custom attribute that, when added to a field, property or parameter, throws an ArgumentException if the target is assigned a value that is not a valid email address. Null strings are accepted and do not throw an exception.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.Patterns.ContractsLocationContractAttribute
PostSharp.Patterns.ContractsRegularExpressionAttribute
PostSharp.Patterns.ContractsEmailAddressAttribute

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class EmailAddressAttribute : RegularExpressionAttribute

The EmailAddressAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | EmailAddressAttribute | Initializes a new EmailAddressAttribute.
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Top
Methods
 | Name | Description
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Public method | ValidateValueDynamic | Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property. (Inherited from RegularExpressionAttribute.)
Top
Remarks

Error message is identified by EmailAddressErrorMessage.

See Also

Reference

PostSharp.Patterns.Contracts Namespace


EmailAddressAttribute Constructor

Initializes a new EmailAddressAttribute.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public EmailAddressAttribute()
See Also

Reference

EmailAddressAttribute Class
PostSharp.Patterns.Contracts Namespace


EmailAddressAttribute Properties

The EmailAddressAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Top
See Also

Reference

EmailAddressAttribute Class
PostSharp.Patterns.Contracts Namespace


EmailAddressAttribute Methods

The EmailAddressAttribute type exposes the following members.

Methods
 | Name | Description
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Public method | ValidateValueDynamic | Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property. (Inherited from RegularExpressionAttribute.)
Top
See Also

Reference

EmailAddressAttribute Class
PostSharp.Patterns.Contracts Namespace


EnumDataTypeAttribute Class

Custom attribute that, when added to a field, property or parameter, throws an ArgumentException if the target is assigned a value that is not a valid member of an enumeration.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.Patterns.ContractsLocationContractAttribute
PostSharp.Patterns.ContractsEnumDataTypeAttribute

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class EnumDataTypeAttribute : LocationContractAttribute,
    IAspect

The EnumDataTypeAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | EnumDataTypeAttribute | Initializes a new EnumDataTypeAttribute.
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | EnumType | Gets the enumeration type.
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Top
Methods
 | Name | Description
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Top
Remarks

Strings are matched against enumeration member names. Integers are matched against enumeration member values. Null values are accepted and do not throw exception.

Error message is identified by EnumDataTypeErrorMessage.

Error message can use additional argument

Field Value

Type:
{4} to refer to EnumType name.

See Also

Reference

PostSharp.Patterns.Contracts Namespace


EnumDataTypeAttribute Constructor

Initializes a new EnumDataTypeAttribute.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public EnumDataTypeAttribute(
    Type enumType
)

Parameters

enumType
Type: SystemType
Enumeration type.
See Also

Reference

EnumDataTypeAttribute Class
PostSharp.Patterns.Contracts Namespace


EnumDataTypeAttribute Properties

The EnumDataTypeAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | EnumType | Gets the enumeration type.
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Top
See Also

Reference

EnumDataTypeAttribute Class
PostSharp.Patterns.Contracts Namespace


EnumDataTypeAttribute.EnumType Property

EnumDataTypeAttributeEnumType Property

Gets the enumeration type.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Type EnumType { get; }

Property Value

Type: Type
See Also

Reference

EnumDataTypeAttribute Class
PostSharp.Patterns.Contracts Namespace


EnumDataTypeAttribute Methods

The EnumDataTypeAttribute type exposes the following members.

Methods
 | Name | Description
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Top
See Also

Reference

EnumDataTypeAttribute Class
PostSharp.Patterns.Contracts Namespace


GreaterThanAttribute Class

Custom attribute that, when added to a field, property or parameter, throws an ArgumentOutOfRangeException if the target is assigned a value that is smaller than a given value.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.Patterns.ContractsLocationContractAttribute
PostSharp.Patterns.ContractsRangeAttribute
PostSharp.Patterns.ContractsGreaterThanAttribute
PostSharp.Patterns.ContractsPositiveAttribute

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class GreaterThanAttribute : RangeAttribute

The GreaterThanAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | GreaterThanAttribute(Double) | Initializes a new GreaterThanAttribute with a given floating-point bound.
Public method | GreaterThanAttribute(Int64) | Initializes a new GreaterThanAttribute with a given integer bound.
Public method | GreaterThanAttribute(UInt64) | Initializes a new GreaterThanAttribute with a given UInt64 bound.
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | DisplayMaxValue | Gets the maximal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments. (Inherited from RangeAttribute.)
Protected property | DisplayMinValue | Gets the minimal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments. (Inherited from RangeAttribute.)
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Top
Methods
 | Name | Description
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from RangeAttribute.)
Protected method | CompileTimeValidate(LocationInfo) | Validates that the current aspect has been applied to a valid location. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentException | Creates an ArgumentException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentNullException | Creates an ArgumentNullException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentOutOfRangeException | Creates an ArgumentOutOfRangeException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreatePostconditionFailedException | Creates an PostconditionFailedException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | FormatErrorMessage | Formats the ErrorMessage with concrete values. (Inherited from LocationContractAttribute.)
Protected method | GetErrorMessage | Gets unformatted error message as defined by the instance. (Overrides RangeAttributeGetErrorMessage.)
Protected method | GetErrorMessageArguments | Gets values of additional arguments for error message associated with particular instance of LocationContractAttribute. There arguments can be referenced from error message string by {4}, {5} and so on. (Overrides RangeAttributeGetErrorMessageArguments.)
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Protected method | SelectSelfOrNothing | A pointcut that selects the target location of the current aspect, unless the target location is a dependency property or an attached property. (Inherited from LocationContractAttribute.)
Public method | ValidateValueDynamic | Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property. (Inherited from RangeAttribute.)
Top
Remarks

Null values are accepted and do not throw an exception.

Error message is identified by GreaterThanErrorMessage.

Error message can use additional argument

Field Value

Type:
{4} to refer to the minimum value used.

See Also

Reference

PostSharp.Patterns.Contracts Namespace


GreaterThanAttribute Constructor

Overload List
 | Name | Description
Public method | GreaterThanAttribute(Double) | Initializes a new GreaterThanAttribute with a given floating-point bound.
Public method | GreaterThanAttribute(Int64) | Initializes a new GreaterThanAttribute with a given integer bound.
Public method | GreaterThanAttribute(UInt64) | Initializes a new GreaterThanAttribute with a given UInt64 bound.
Top
See Also

Reference

GreaterThanAttribute Class
PostSharp.Patterns.Contracts Namespace


GreaterThanAttribute Constructor (Double)

Initializes a new GreaterThanAttribute with a given floating-point bound.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public GreaterThanAttribute(
    double min
)

Parameters

min
Type: SystemDouble
The lower bound.
See Also

Reference

GreaterThanAttribute Class
GreaterThanAttribute Overload
PostSharp.Patterns.Contracts Namespace


GreaterThanAttribute Constructor (Int64)

Initializes a new GreaterThanAttribute with a given integer bound.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public GreaterThanAttribute(
    long min
)

Parameters

min
Type: SystemInt64
The lower bound.
See Also

Reference

GreaterThanAttribute Class
GreaterThanAttribute Overload
PostSharp.Patterns.Contracts Namespace


GreaterThanAttribute Constructor (UInt64)

Initializes a new GreaterThanAttribute with a given UInt64 bound.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public GreaterThanAttribute(
    ulong min
)

Parameters

min
Type: SystemUInt64
The lower bound.
See Also

Reference

GreaterThanAttribute Class
GreaterThanAttribute Overload
PostSharp.Patterns.Contracts Namespace


GreaterThanAttribute Properties

The GreaterThanAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | DisplayMaxValue | Gets the maximal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments. (Inherited from RangeAttribute.)
Protected property | DisplayMinValue | Gets the minimal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments. (Inherited from RangeAttribute.)
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Top
See Also

Reference

GreaterThanAttribute Class
PostSharp.Patterns.Contracts Namespace


GreaterThanAttribute Methods

The GreaterThanAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from RangeAttribute.)
Protected method | CompileTimeValidate(LocationInfo) | Validates that the current aspect has been applied to a valid location. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentException | Creates an ArgumentException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentNullException | Creates an ArgumentNullException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentOutOfRangeException | Creates an ArgumentOutOfRangeException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreatePostconditionFailedException | Creates an PostconditionFailedException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | FormatErrorMessage | Formats the ErrorMessage with concrete values. (Inherited from LocationContractAttribute.)
Protected method | GetErrorMessage | Gets unformatted error message as defined by the instance. (Overrides RangeAttributeGetErrorMessage.)
Protected method | GetErrorMessageArguments | Gets values of additional arguments for error message associated with particular instance of LocationContractAttribute. There arguments can be referenced from error message string by {4}, {5} and so on. (Overrides RangeAttributeGetErrorMessageArguments.)
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Protected method | SelectSelfOrNothing | A pointcut that selects the target location of the current aspect, unless the target location is a dependency property or an attached property. (Inherited from LocationContractAttribute.)
Public method | ValidateValueDynamic | Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property. (Inherited from RangeAttribute.)
Top
See Also

Reference

GreaterThanAttribute Class
PostSharp.Patterns.Contracts Namespace


GreaterThanAttribute.GetErrorMessage Method

GreaterThanAttributeGetErrorMessage Method

Gets unformatted error message as defined by the instance.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override string GetErrorMessage()

Return Value

Type: String
Remarks

See remarks on LocationContractAttribute for information about message parameters.

Use of this method can be overridden by setting ErrorMessage property to non-null value.

See Also

Reference

GreaterThanAttribute Class
PostSharp.Patterns.Contracts Namespace

Other Resources

Conceptual: Creating Custom Contracts
Conceptual: Localizing Contract Errors


GreaterThanAttribute.GetErrorMessageArguments Method

GreaterThanAttributeGetErrorMessageArguments Method

Gets values of additional arguments for error message associated with particular instance of LocationContractAttribute. There arguments can be referenced from error message string by {4}, {5} and so on.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override Object[] GetErrorMessageArguments()

Return Value

Type: Object
An array of additional argument values.
Remarks
This method is expected to be pure, i.e. it's result can be cached and so the implementer should not return information that may change after constructor of the class has finished.
See Also

Reference

GreaterThanAttribute Class
PostSharp.Patterns.Contracts Namespace


LessThanAttribute Class

Custom attribute that, when added to a field, property or parameter, throws an ArgumentOutOfRangeException if the target is assigned a value that is greater than a given value.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.Patterns.ContractsLocationContractAttribute
PostSharp.Patterns.ContractsRangeAttribute
PostSharp.Patterns.ContractsLessThanAttribute
PostSharp.Patterns.ContractsNegativeAttribute

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class LessThanAttribute : RangeAttribute

The LessThanAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | LessThanAttribute(Double) | Initializes a new LessThanAttribute with a given floating-point bound.
Public method | LessThanAttribute(Int64) | Initializes a new LessThanAttribute with a given integer bound.
Public method | LessThanAttribute(UInt64) | Initializes a new LessThanAttribute with a given UInt64 bound.
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | DisplayMaxValue | Gets the maximal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments. (Inherited from RangeAttribute.)
Protected property | DisplayMinValue | Gets the minimal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments. (Inherited from RangeAttribute.)
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Top
Methods
 | Name | Description
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from RangeAttribute.)
Protected method | CompileTimeValidate(LocationInfo) | Validates that the current aspect has been applied to a valid location. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentException | Creates an ArgumentException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentNullException | Creates an ArgumentNullException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentOutOfRangeException | Creates an ArgumentOutOfRangeException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreatePostconditionFailedException | Creates an PostconditionFailedException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | FormatErrorMessage | Formats the ErrorMessage with concrete values. (Inherited from LocationContractAttribute.)
Protected method | GetErrorMessage | Gets unformatted error message as defined by the instance. (Overrides RangeAttributeGetErrorMessage.)
Protected method | GetErrorMessageArguments | Gets values of additional arguments for error message associated with particular instance of LocationContractAttribute. There arguments can be referenced from error message string by {4}, {5} and so on. (Overrides RangeAttributeGetErrorMessageArguments.)
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Protected method | SelectSelfOrNothing | A pointcut that selects the target location of the current aspect, unless the target location is a dependency property or an attached property. (Inherited from LocationContractAttribute.)
Public method | ValidateValueDynamic | Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property. (Inherited from RangeAttribute.)
Top
Remarks

Null values are accepted and do not throw an exception.

Error message is identified by LessThanErrorMessage.

Error message can use additional argument

Field Value

Type:
{4} to refer to the minimum value used.

See Also

Reference

PostSharp.Patterns.Contracts Namespace


LessThanAttribute Constructor

Overload List
 | Name | Description
Public method | LessThanAttribute(Double) | Initializes a new LessThanAttribute with a given floating-point bound.
Public method | LessThanAttribute(Int64) | Initializes a new LessThanAttribute with a given integer bound.
Public method | LessThanAttribute(UInt64) | Initializes a new LessThanAttribute with a given UInt64 bound.
Top
See Also

Reference

LessThanAttribute Class
PostSharp.Patterns.Contracts Namespace


LessThanAttribute Constructor (Double)

Initializes a new LessThanAttribute with a given floating-point bound.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LessThanAttribute(
    double max
)

Parameters

max
Type: SystemDouble
The upper bound.
See Also

Reference

LessThanAttribute Class
LessThanAttribute Overload
PostSharp.Patterns.Contracts Namespace


LessThanAttribute Constructor (Int64)

Initializes a new LessThanAttribute with a given integer bound.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LessThanAttribute(
    long max
)

Parameters

max
Type: SystemInt64
The upper bound.
See Also

Reference

LessThanAttribute Class
LessThanAttribute Overload
PostSharp.Patterns.Contracts Namespace


LessThanAttribute Constructor (UInt64)

Initializes a new LessThanAttribute with a given UInt64 bound.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LessThanAttribute(
    ulong max
)

Parameters

max
Type: SystemUInt64
The upper bound.
See Also

Reference

LessThanAttribute Class
LessThanAttribute Overload
PostSharp.Patterns.Contracts Namespace


LessThanAttribute Properties

The LessThanAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | DisplayMaxValue | Gets the maximal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments. (Inherited from RangeAttribute.)
Protected property | DisplayMinValue | Gets the minimal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments. (Inherited from RangeAttribute.)
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Top
See Also

Reference

LessThanAttribute Class
PostSharp.Patterns.Contracts Namespace


LessThanAttribute Methods

The LessThanAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from RangeAttribute.)
Protected method | CompileTimeValidate(LocationInfo) | Validates that the current aspect has been applied to a valid location. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentException | Creates an ArgumentException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentNullException | Creates an ArgumentNullException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentOutOfRangeException | Creates an ArgumentOutOfRangeException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreatePostconditionFailedException | Creates an PostconditionFailedException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | FormatErrorMessage | Formats the ErrorMessage with concrete values. (Inherited from LocationContractAttribute.)
Protected method | GetErrorMessage | Gets unformatted error message as defined by the instance. (Overrides RangeAttributeGetErrorMessage.)
Protected method | GetErrorMessageArguments | Gets values of additional arguments for error message associated with particular instance of LocationContractAttribute. There arguments can be referenced from error message string by {4}, {5} and so on. (Overrides RangeAttributeGetErrorMessageArguments.)
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Protected method | SelectSelfOrNothing | A pointcut that selects the target location of the current aspect, unless the target location is a dependency property or an attached property. (Inherited from LocationContractAttribute.)
Public method | ValidateValueDynamic | Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property. (Inherited from RangeAttribute.)
Top
See Also

Reference

LessThanAttribute Class
PostSharp.Patterns.Contracts Namespace


LessThanAttribute.GetErrorMessage Method

LessThanAttributeGetErrorMessage Method

Gets unformatted error message as defined by the instance.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override string GetErrorMessage()

Return Value

Type: String
Remarks

See remarks on LocationContractAttribute for information about message parameters.

Use of this method can be overridden by setting ErrorMessage property to non-null value.

See Also

Reference

LessThanAttribute Class
PostSharp.Patterns.Contracts Namespace

Other Resources

Conceptual: Creating Custom Contracts
Conceptual: Localizing Contract Errors


LessThanAttribute.GetErrorMessageArguments Method

LessThanAttributeGetErrorMessageArguments Method

Gets values of additional arguments for error message associated with particular instance of LocationContractAttribute. There arguments can be referenced from error message string by {4}, {5} and so on.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override Object[] GetErrorMessageArguments()

Return Value

Type: Object
An array of additional argument values.
Remarks
This method is expected to be pure, i.e. it's result can be cached and so the implementer should not return information that may change after constructor of the class has finished.
See Also

Reference

LessThanAttribute Class
PostSharp.Patterns.Contracts Namespace


LocationContractAttribute Class

Base class for other custom attributes in this namespace.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.Patterns.ContractsLocationContractAttribute
More...

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class LocationContractAttribute : MulticastAttribute,
    ILocationLevelAspect, IAspect

The LocationContractAttribute type exposes the following members.

Constructors
 | Name | Description
Protected method | LocationContractAttribute | Initializes a new LocationContractAttribute.
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | ErrorMessage | Gets or sets the error message formatting string.
Top
Methods
 | Name | Description
Protected method | CompileTimeValidate | Validates that the current aspect has been applied to a valid location.
Protected method | CreateArgumentException | Creates an ArgumentException with an error message formatted from ErrorMessage and given concrete values.
Protected method | CreateArgumentNullException | Creates an ArgumentNullException with an error message formatted from ErrorMessage and given concrete values.
Protected method | CreateArgumentOutOfRangeException | Creates an ArgumentOutOfRangeException with an error message formatted from ErrorMessage and given concrete values.
Protected method | CreatePostconditionFailedException | Creates an PostconditionFailedException with an error message formatted from ErrorMessage and given concrete values.
Protected method | FormatErrorMessage | Formats the ErrorMessage with concrete values.
Protected method | GetErrorMessage | Gets unformatted error message as defined by the instance.
Protected method | GetErrorMessageArguments | Gets values of additional arguments for error message associated with particular instance of LocationContractAttribute. There arguments can be referenced from error message string by {4}, {5} and so on.
Public method | RuntimeInitialize | Initializes the aspect at runtime.
Protected method | SelectSelfOrNothing | A pointcut that selects the target location of the current aspect, unless the target location is a dependency property or an attached property.
Public method | ValidateValueDynamic | Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property.
Top
Remarks

Basic error message is identified by LocationContractErrorMessage and obtained from the provider set in Current.

All formatting string are have following parameters replaced:

  • Field Value

    Type:
    {0} represents location name.

  • Field Value

    Type:
    {1} represents location kind.

  • Field Value

    Type:
    {2} represents string containing both location kind and name.

  • Field Value

    Type:
    {3} represents value which caused the error when being assigned to the location.
  • Further parameters are described in remarks sections of appropriate contracts which override the GetErrorMessageArguments method.

Note that an array of error message arguments are cached for each location.

See Also

Reference

PostSharp.Patterns.Contracts Namespace

Other Resources

Conceptual: Contracts
Conceptual: Creating Custom Contracts
Conceptual: Localizing Contract Errors
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.Patterns.ContractsLocationContractAttribute
PostSharp.Patterns.ContractsCreditCardAttribute
PostSharp.Patterns.ContractsEnumDataTypeAttribute
PostSharp.Patterns.ContractsNotEmptyAttribute
PostSharp.Patterns.ContractsNotNullAttribute
PostSharp.Patterns.ContractsRangeAttribute
PostSharp.Patterns.ContractsRegularExpressionAttribute
PostSharp.Patterns.ContractsRequiredAttribute
PostSharp.Patterns.ContractsStringLengthAttribute


LocationContractAttribute Constructor

Initializes a new LocationContractAttribute.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected LocationContractAttribute()
See Also

Reference

LocationContractAttribute Class
PostSharp.Patterns.Contracts Namespace


LocationContractAttribute Properties

The LocationContractAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | ErrorMessage | Gets or sets the error message formatting string.
Top
See Also

Reference

LocationContractAttribute Class
PostSharp.Patterns.Contracts Namespace


LocationContractAttribute.ErrorMessage Property

LocationContractAttributeErrorMessage Property

Gets or sets the error message formatting string.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string ErrorMessage { get; set; }

Property Value

Type: String
Remarks

See remarks on LocationContractAttribute for information about message parameters.

If the value of this property is set to

Property Value

Type: String
null, GetErrorMessage will be used to obtain the error message.

Set this property only for legacy purposes. Otherwise, use GetErrorMessage method.

See Also

Reference

LocationContractAttribute Class
PostSharp.Patterns.Contracts Namespace

Other Resources

Conceptual: Contracts


LocationContractAttribute Methods

The LocationContractAttribute type exposes the following members.

Methods
 | Name | Description
Protected method | CompileTimeValidate | Validates that the current aspect has been applied to a valid location.
Protected method | CreateArgumentException | Creates an ArgumentException with an error message formatted from ErrorMessage and given concrete values.
Protected method | CreateArgumentNullException | Creates an ArgumentNullException with an error message formatted from ErrorMessage and given concrete values.
Protected method | CreateArgumentOutOfRangeException | Creates an ArgumentOutOfRangeException with an error message formatted from ErrorMessage and given concrete values.
Protected method | CreatePostconditionFailedException | Creates an PostconditionFailedException with an error message formatted from ErrorMessage and given concrete values.
Protected method | FormatErrorMessage | Formats the ErrorMessage with concrete values.
Protected method | GetErrorMessage | Gets unformatted error message as defined by the instance.
Protected method | GetErrorMessageArguments | Gets values of additional arguments for error message associated with particular instance of LocationContractAttribute. There arguments can be referenced from error message string by {4}, {5} and so on.
Public method | RuntimeInitialize | Initializes the aspect at runtime.
Protected method | SelectSelfOrNothing | A pointcut that selects the target location of the current aspect, unless the target location is a dependency property or an attached property.
Public method | ValidateValueDynamic | Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property.
Top
See Also

Reference

LocationContractAttribute Class
PostSharp.Patterns.Contracts Namespace


LocationContractAttribute.CompileTimeValidate Method

LocationContractAttributeCompileTimeValidate Method

Validates that the current aspect has been applied to a valid location.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual bool CompileTimeValidate(
    LocationInfo target
)

Parameters

target
Type: PostSharp.ReflectionLocationInfo
The location to which the current aspect has been applied.

Return Value

Type: Boolean
true if target is a valid target for the current aspect, otherwise false.
See Also

Reference

LocationContractAttribute Class
PostSharp.Patterns.Contracts Namespace


LocationContractAttribute.CreateArgumentException Method

LocationContractAttributeCreateArgumentException Method

Creates an ArgumentException with an error message formatted from ErrorMessage and given concrete values.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected ArgumentException CreateArgumentException(
    Object value,
    string locationName,
    LocationKind locationKind
)

Parameters

value
Type: SystemObject
Value assigned to the location.
locationName
Type: SystemString
Name of the location.
locationKind
Type: PostSharp.ReflectionLocationKind
Location kind.

Return Value

Type: ArgumentException
A new ArgumentException where the message, has been derived from ErrorMessage, with placeholders replaced by their concrete value.
See Also

Reference

LocationContractAttribute Class
PostSharp.Patterns.Contracts Namespace


LocationContractAttribute.CreateArgumentNullException Method

LocationContractAttributeCreateArgumentNullException Method

Creates an ArgumentNullException with an error message formatted from ErrorMessage and given concrete values.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected ArgumentNullException CreateArgumentNullException(
    Object value,
    string locationName,
    LocationKind locationKind
)

Parameters

value
Type: SystemObject
Value assigned to the location.
locationName
Type: SystemString
Name of the location.
locationKind
Type: PostSharp.ReflectionLocationKind
Location kind.

Return Value

Type: ArgumentNullException
A new ArgumentNullException where the message, has been derived from ErrorMessage, with placeholders replaced by their concrete value.
See Also

Reference

LocationContractAttribute Class
PostSharp.Patterns.Contracts Namespace


LocationContractAttribute.CreateArgumentOutOfRangeException Method

LocationContractAttributeCreateArgumentOutOfRangeException Method

Creates an ArgumentOutOfRangeException with an error message formatted from ErrorMessage and given concrete values.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected ArgumentOutOfRangeException CreateArgumentOutOfRangeException(
    Object value,
    string locationName,
    LocationKind locationKind
)

Parameters

value
Type: SystemObject
Value assigned to the location.
locationName
Type: SystemString
Name of the location.
locationKind
Type: PostSharp.ReflectionLocationKind
Location kind.

Return Value

Type: ArgumentOutOfRangeException
A new ArgumentOutOfRangeException where the message, has been derived from ErrorMessage, with placeholders replaced by their concrete value.
See Also

Reference

LocationContractAttribute Class
PostSharp.Patterns.Contracts Namespace


LocationContractAttribute.CreatePostconditionFailedException Method

LocationContractAttributeCreatePostconditionFailedException Method

Creates an PostconditionFailedException with an error message formatted from ErrorMessage and given concrete values.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected PostconditionFailedException CreatePostconditionFailedException(
    Object value,
    string locationName,
    LocationKind locationKind
)

Parameters

value
Type: SystemObject
Value assigned to the location.
locationName
Type: SystemString
Name of the location.
locationKind
Type: PostSharp.ReflectionLocationKind
Location kind.

Return Value

Type: PostconditionFailedException
A new PostconditionFailedException where the message, has been derived from ErrorMessage, with placeholders replaced by their concrete value.
See Also

Reference

LocationContractAttribute Class
PostSharp.Patterns.Contracts Namespace


LocationContractAttribute.FormatErrorMessage Method

LocationContractAttributeFormatErrorMessage Method

Formats the ErrorMessage with concrete values.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected string FormatErrorMessage(
    Object value,
    string locationName,
    LocationKind locationKind
)

Parameters

value
Type: SystemObject
Value assigned to the location.
locationName
Type: SystemString
Name of the location.
locationKind
Type: PostSharp.ReflectionLocationKind
Location kind.

Return Value

Type: String
A string derived from ErrorMessage, where placeholders have been replaced by their concrete value.
See Also

Reference

LocationContractAttribute Class
PostSharp.Patterns.Contracts Namespace


LocationContractAttribute.GetErrorMessage Method

LocationContractAttributeGetErrorMessage Method

Gets unformatted error message as defined by the instance.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual string GetErrorMessage()

Return Value

Type: String
Remarks

See remarks on LocationContractAttribute for information about message parameters.

Use of this method can be overridden by setting ErrorMessage property to non-null value.

See Also

Reference

LocationContractAttribute Class
PostSharp.Patterns.Contracts Namespace

Other Resources

Conceptual: Creating Custom Contracts
Conceptual: Localizing Contract Errors


LocationContractAttribute.GetErrorMessageArguments Method

LocationContractAttributeGetErrorMessageArguments Method

Gets values of additional arguments for error message associated with particular instance of LocationContractAttribute. There arguments can be referenced from error message string by {4}, {5} and so on.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual Object[] GetErrorMessageArguments()

Return Value

Type: Object
An array of additional argument values.
Remarks
This method is expected to be pure, i.e. it's result can be cached and so the implementer should not return information that may change after constructor of the class has finished.
See Also

Reference

LocationContractAttribute Class
PostSharp.Patterns.Contracts Namespace


LocationContractAttribute.RuntimeInitialize Method

LocationContractAttributeRuntimeInitialize Method

Initializes the aspect at runtime.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void RuntimeInitialize(
    LocationInfo locationInfo
)

Parameters

locationInfo
Type: PostSharp.ReflectionLocationInfo
Target if the aspect.

Implements

ILocationLevelAspectRuntimeInitialize(LocationInfo)
See Also

Reference

LocationContractAttribute Class
PostSharp.Patterns.Contracts Namespace


LocationContractAttribute.SelectSelfOrNothing Method

LocationContractAttributeSelectSelfOrNothing Method

A pointcut that selects the target location of the current aspect, unless the target location is a dependency property or an attached property.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected IEnumerable<LocationInfo> SelectSelfOrNothing(
    LocationInfo target
)

Parameters

target
Type: PostSharp.ReflectionLocationInfo
The target location.

Return Value

Type: IEnumerable LocationInfo
The target location, or nothing if the target location is a dependency property or an attached property.
See Also

Reference

LocationContractAttribute Class
PostSharp.Patterns.Contracts Namespace


LocationContractAttribute.ValidateValueDynamic Method

LocationContractAttributeValidateValueDynamic Method

Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual Exception ValidateValueDynamic(
    Object value,
    string locationName,
    LocationKind locationKind,
    LocationValidationContext context
)

Parameters

value
Type: SystemObject
Value.
locationName
Type: SystemString
The name of the property.
locationKind
Type: PostSharp.ReflectionLocationKind
The kind of location (typically a Property).
context
Type: PostSharp.AspectsLocationValidationContext
Why or when the value is being validated.

Return Value

Type: Exception
An Exception if the value is invalid, or null if the value is valid.
See Also

Reference

LocationContractAttribute Class
PostSharp.Patterns.Contracts Namespace


NegativeAttribute Class

Custom attribute that, when added to a field, property or parameter, throws an ArgumentOutOfRangeException if the target is assigned a value greater than zero.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.Patterns.ContractsLocationContractAttribute
PostSharp.Patterns.ContractsRangeAttribute
PostSharp.Patterns.ContractsLessThanAttribute
PostSharp.Patterns.ContractsNegativeAttribute

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class NegativeAttribute : LessThanAttribute

The NegativeAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | NegativeAttribute | Initializes a new NegativeAttribute.
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | DisplayMaxValue | Gets the maximal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments. (Inherited from RangeAttribute.)
Protected property | DisplayMinValue | Gets the minimal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments. (Inherited from RangeAttribute.)
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Top
Methods
 | Name | Description
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from RangeAttribute.)
Protected method | CompileTimeValidate(LocationInfo) | Validates that the current aspect has been applied to a valid location. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentException | Creates an ArgumentException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentNullException | Creates an ArgumentNullException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentOutOfRangeException | Creates an ArgumentOutOfRangeException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreatePostconditionFailedException | Creates an PostconditionFailedException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | FormatErrorMessage | Formats the ErrorMessage with concrete values. (Inherited from LocationContractAttribute.)
Protected method | GetErrorMessage | Gets unformatted error message as defined by the instance. (Inherited from LessThanAttribute.)
Protected method | GetErrorMessageArguments | Gets values of additional arguments for error message associated with particular instance of LocationContractAttribute. There arguments can be referenced from error message string by {4}, {5} and so on. (Inherited from LessThanAttribute.)
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Protected method | SelectSelfOrNothing | A pointcut that selects the target location of the current aspect, unless the target location is a dependency property or an attached property. (Inherited from LocationContractAttribute.)
Public method | ValidateValueDynamic | Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property. (Inherited from RangeAttribute.)
Top
Remarks

Null values are accepted and do not throw an exception.

Error message is identified by LessThanErrorMessage.

See Also

Reference

PostSharp.Patterns.Contracts Namespace


NegativeAttribute Constructor

Initializes a new NegativeAttribute.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public NegativeAttribute()
See Also

Reference

NegativeAttribute Class
PostSharp.Patterns.Contracts Namespace


NegativeAttribute Properties

The NegativeAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | DisplayMaxValue | Gets the maximal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments. (Inherited from RangeAttribute.)
Protected property | DisplayMinValue | Gets the minimal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments. (Inherited from RangeAttribute.)
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Top
See Also

Reference

NegativeAttribute Class
PostSharp.Patterns.Contracts Namespace


NegativeAttribute Methods

The NegativeAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from RangeAttribute.)
Protected method | CompileTimeValidate(LocationInfo) | Validates that the current aspect has been applied to a valid location. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentException | Creates an ArgumentException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentNullException | Creates an ArgumentNullException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentOutOfRangeException | Creates an ArgumentOutOfRangeException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreatePostconditionFailedException | Creates an PostconditionFailedException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | FormatErrorMessage | Formats the ErrorMessage with concrete values. (Inherited from LocationContractAttribute.)
Protected method | GetErrorMessage | Gets unformatted error message as defined by the instance. (Inherited from LessThanAttribute.)
Protected method | GetErrorMessageArguments | Gets values of additional arguments for error message associated with particular instance of LocationContractAttribute. There arguments can be referenced from error message string by {4}, {5} and so on. (Inherited from LessThanAttribute.)
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Protected method | SelectSelfOrNothing | A pointcut that selects the target location of the current aspect, unless the target location is a dependency property or an attached property. (Inherited from LocationContractAttribute.)
Public method | ValidateValueDynamic | Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property. (Inherited from RangeAttribute.)
Top
See Also

Reference

NegativeAttribute Class
PostSharp.Patterns.Contracts Namespace


NotEmptyAttribute Class

Custom attribute that, when added to a field, property or parameter, throws an ArgumentNullException if the target is assigned a null or empty value. The custom attributes can be added to locations of type String (where empty means zero characters) or ICollection (where empty means zero items).
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.Patterns.ContractsLocationContractAttribute
PostSharp.Patterns.ContractsNotEmptyAttribute

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class NotEmptyAttribute : LocationContractAttribute,
    IAspect

The NotEmptyAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | NotEmptyAttribute | Initializes a new NotEmptyAttribute.
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Top
Methods
 | Name | Description
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Public method | ValidateValueDynamic | Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property. (Overrides LocationContractAttributeValidateValueDynamic(Object, String, LocationKind, LocationValidationContext).)
Top
Remarks

Error message is identified by NotEmptyErrorMessage.

See Also

Reference

PostSharp.Patterns.Contracts Namespace

Other Resources

Conceptual: Dependency Property


NotEmptyAttribute Constructor

Initializes a new NotEmptyAttribute.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public NotEmptyAttribute()
See Also

Reference

NotEmptyAttribute Class
PostSharp.Patterns.Contracts Namespace


NotEmptyAttribute Properties

The NotEmptyAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Top
See Also

Reference

NotEmptyAttribute Class
PostSharp.Patterns.Contracts Namespace


NotEmptyAttribute Methods

The NotEmptyAttribute type exposes the following members.

Methods
 | Name | Description
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Public method | ValidateValueDynamic | Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property. (Overrides LocationContractAttributeValidateValueDynamic(Object, String, LocationKind, LocationValidationContext).)
Top
See Also

Reference

NotEmptyAttribute Class
PostSharp.Patterns.Contracts Namespace


NotEmptyAttribute.ValidateValueDynamic Method

NotEmptyAttributeValidateValueDynamic Method

Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Exception ValidateValueDynamic(
    Object value,
    string locationName,
    LocationKind locationKind,
    LocationValidationContext context
)

Parameters

value
Type: SystemObject
Value.
locationName
Type: SystemString
The name of the property.
locationKind
Type: PostSharp.ReflectionLocationKind
The kind of location (typically a Property).
context
Type: PostSharp.AspectsLocationValidationContext
Why or when the value is being validated.

Return Value

Type: Exception
An Exception if the value is invalid, or null if the value is valid.
See Also

Reference

NotEmptyAttribute Class
PostSharp.Patterns.Contracts Namespace


NotNullAttribute Class

Custom attribute that, when added to a field, property or parameter, throws an ArgumentNullException if the target is assigned a null value.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.Patterns.ContractsLocationContractAttribute
PostSharp.Patterns.ContractsNotNullAttribute

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class NotNullAttribute : LocationContractAttribute,
    IAspect

The NotNullAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | NotNullAttribute | Initializes a new ArgumentNullException.
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Top
Methods
 | Name | Description
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Top
Remarks

Error message is identified by NotNullErrorMessage.

See Also

Reference

PostSharp.Patterns.Contracts Namespace


NotNullAttribute Constructor

Initializes a new ArgumentNullException.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public NotNullAttribute()
See Also

Reference

NotNullAttribute Class
PostSharp.Patterns.Contracts Namespace


NotNullAttribute Properties

The NotNullAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Top
See Also

Reference

NotNullAttribute Class
PostSharp.Patterns.Contracts Namespace


NotNullAttribute Methods

The NotNullAttribute type exposes the following members.

Methods
 | Name | Description
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Top
See Also

Reference

NotNullAttribute Class
PostSharp.Patterns.Contracts Namespace


PhoneAttribute Class

Custom attribute that, when added to a field, property or parameter, throws an ArgumentException if the target is assigned a value that is not a valid phone number. Null strings are accepted and do not throw an exception.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.Patterns.ContractsLocationContractAttribute
PostSharp.Patterns.ContractsRegularExpressionAttribute
PostSharp.Patterns.ContractsPhoneAttribute

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class PhoneAttribute : RegularExpressionAttribute

The PhoneAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | PhoneAttribute | Initializes a new PhoneAttribute.
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Top
Methods
 | Name | Description
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Public method | ValidateValueDynamic | Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property. (Inherited from RegularExpressionAttribute.)
Top
Remarks

Error message is identified by PhoneAttribute.

See Also

Reference

PostSharp.Patterns.Contracts Namespace


PhoneAttribute Constructor

Initializes a new PhoneAttribute.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public PhoneAttribute()
See Also

Reference

PhoneAttribute Class
PostSharp.Patterns.Contracts Namespace


PhoneAttribute Properties

The PhoneAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Top
See Also

Reference

PhoneAttribute Class
PostSharp.Patterns.Contracts Namespace


PhoneAttribute Methods

The PhoneAttribute type exposes the following members.

Methods
 | Name | Description
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Public method | ValidateValueDynamic | Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property. (Inherited from RegularExpressionAttribute.)
Top
See Also

Reference

PhoneAttribute Class
PostSharp.Patterns.Contracts Namespace


PositiveAttribute Class

Custom attribute that, when added to a field, property or parameter, throws an ArgumentOutOfRangeException if the target is assigned a value smaller than zero.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.Patterns.ContractsLocationContractAttribute
PostSharp.Patterns.ContractsRangeAttribute
PostSharp.Patterns.ContractsGreaterThanAttribute
PostSharp.Patterns.ContractsPositiveAttribute

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class PositiveAttribute : GreaterThanAttribute

The PositiveAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | PositiveAttribute | Initializes a new PositiveAttribute.
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | DisplayMaxValue | Gets the maximal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments. (Inherited from RangeAttribute.)
Protected property | DisplayMinValue | Gets the minimal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments. (Inherited from RangeAttribute.)
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Top
Methods
 | Name | Description
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from RangeAttribute.)
Protected method | CompileTimeValidate(LocationInfo) | Validates that the current aspect has been applied to a valid location. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentException | Creates an ArgumentException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentNullException | Creates an ArgumentNullException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentOutOfRangeException | Creates an ArgumentOutOfRangeException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreatePostconditionFailedException | Creates an PostconditionFailedException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | FormatErrorMessage | Formats the ErrorMessage with concrete values. (Inherited from LocationContractAttribute.)
Protected method | GetErrorMessage | Gets unformatted error message as defined by the instance. (Inherited from GreaterThanAttribute.)
Protected method | GetErrorMessageArguments | Gets values of additional arguments for error message associated with particular instance of LocationContractAttribute. There arguments can be referenced from error message string by {4}, {5} and so on. (Inherited from GreaterThanAttribute.)
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Protected method | SelectSelfOrNothing | A pointcut that selects the target location of the current aspect, unless the target location is a dependency property or an attached property. (Inherited from LocationContractAttribute.)
Public method | ValidateValueDynamic | Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property. (Inherited from RangeAttribute.)
Top
Remarks

Null values are accepted and do not throw an exception.

Error message is identified by GreaterThanErrorMessage.

See Also

Reference

PostSharp.Patterns.Contracts Namespace


PositiveAttribute Constructor

Initializes a new PositiveAttribute.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public PositiveAttribute()
See Also

Reference

PositiveAttribute Class
PostSharp.Patterns.Contracts Namespace


PositiveAttribute Properties

The PositiveAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | DisplayMaxValue | Gets the maximal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments. (Inherited from RangeAttribute.)
Protected property | DisplayMinValue | Gets the minimal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments. (Inherited from RangeAttribute.)
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Top
See Also

Reference

PositiveAttribute Class
PostSharp.Patterns.Contracts Namespace


PositiveAttribute Methods

The PositiveAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from RangeAttribute.)
Protected method | CompileTimeValidate(LocationInfo) | Validates that the current aspect has been applied to a valid location. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentException | Creates an ArgumentException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentNullException | Creates an ArgumentNullException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentOutOfRangeException | Creates an ArgumentOutOfRangeException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreatePostconditionFailedException | Creates an PostconditionFailedException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | FormatErrorMessage | Formats the ErrorMessage with concrete values. (Inherited from LocationContractAttribute.)
Protected method | GetErrorMessage | Gets unformatted error message as defined by the instance. (Inherited from GreaterThanAttribute.)
Protected method | GetErrorMessageArguments | Gets values of additional arguments for error message associated with particular instance of LocationContractAttribute. There arguments can be referenced from error message string by {4}, {5} and so on. (Inherited from GreaterThanAttribute.)
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Protected method | SelectSelfOrNothing | A pointcut that selects the target location of the current aspect, unless the target location is a dependency property or an attached property. (Inherited from LocationContractAttribute.)
Public method | ValidateValueDynamic | Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property. (Inherited from RangeAttribute.)
Top
See Also

Reference

PositiveAttribute Class
PostSharp.Patterns.Contracts Namespace


PostconditionFailedException Class

The exception that is thrown when a postcondition contract was not fulfilled by a method.
Inheritance Hierarchy
SystemObject
SystemException
PostSharp.Patterns.ContractsPostconditionFailedException

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public class PostconditionFailedException : Exception
Constructors
 | Name | Description
Public method | PostconditionFailedException | Initializes a new instance of the PostconditionFailedException class.
Public method | PostconditionFailedException(String) | Initializes a new instance of the PostconditionFailedException class with a specified error message.
Protected method | PostconditionFailedException(SerializationInfo, StreamingContext) | Initializes a new instance of the PostconditionFailedException class with serialized data.
Public method | PostconditionFailedException(String, Exception) | Initializes a new instance of the PostconditionFailedException class with a specified error message and a reference to the inner exception that is the cause of this exception.
Top
See Also

Reference

PostSharp.Patterns.Contracts Namespace


PostconditionFailedException Constructor

Overload List
 | Name | Description
Public method | PostconditionFailedException | Initializes a new instance of the PostconditionFailedException class.
Public method | PostconditionFailedException(String) | Initializes a new instance of the PostconditionFailedException class with a specified error message.
Protected method | PostconditionFailedException(SerializationInfo, StreamingContext) | Initializes a new instance of the PostconditionFailedException class with serialized data.
Public method | PostconditionFailedException(String, Exception) | Initializes a new instance of the PostconditionFailedException class with a specified error message and a reference to the inner exception that is the cause of this exception.
Top
See Also

Reference

PostconditionFailedException Class
PostSharp.Patterns.Contracts Namespace


PostconditionFailedException Constructor

Initializes a new instance of the PostconditionFailedException class.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public PostconditionFailedException()
See Also

Reference

PostconditionFailedException Class
PostconditionFailedException Overload
PostSharp.Patterns.Contracts Namespace


PostconditionFailedException Constructor (String)

Initializes a new instance of the PostconditionFailedException class with a specified error message.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public PostconditionFailedException(
    string message
)

Parameters

message
Type: SystemString
Exception message.
See Also

Reference

PostconditionFailedException Class
PostconditionFailedException Overload
PostSharp.Patterns.Contracts Namespace


PostconditionFailedException Constructor (SerializationInfo, StreamingContext)

Initializes a new instance of the PostconditionFailedException class with serialized data.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected PostconditionFailedException(
    SerializationInfo info,
    StreamingContext context
)

Parameters

info
Type: System.Runtime.SerializationSerializationInfo
The SerializationInfo that holds the serialized object data about the exception being thrown.
context
Type: System.Runtime.SerializationStreamingContext
The StreamingContext that contains contextual information about the source or destination.
See Also

Reference

PostconditionFailedException Class
PostconditionFailedException Overload
PostSharp.Patterns.Contracts Namespace


PostconditionFailedException Constructor (String, Exception)

Initializes a new instance of the PostconditionFailedException class with a specified error message and a reference to the inner exception that is the cause of this exception.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public PostconditionFailedException(
    string message,
    Exception innerException
)

Parameters

message
Type: SystemString
Exception message.
innerException
Type: SystemException
Inner exception.
See Also

Reference

PostconditionFailedException Class
PostconditionFailedException Overload
PostSharp.Patterns.Contracts Namespace


RangeAttribute Class

Custom attribute that, when added to a field, property or parameter, throws an ArgumentOutOfRangeException if the target is assigned a value that is outside a given range.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.Patterns.ContractsLocationContractAttribute
PostSharp.Patterns.ContractsRangeAttribute
PostSharp.Patterns.ContractsGreaterThanAttribute
PostSharp.Patterns.ContractsLessThanAttribute
PostSharp.Patterns.ContractsStrictlyGreaterThanAttribute
PostSharp.Patterns.ContractsStrictlyLessThanAttribute

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class RangeAttribute : LocationContractAttribute,
    IValidableAnnotation, IAspect

The RangeAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | RangeAttribute(Double, Double) | Initializes a new GreaterThanAttribute and specify a floating-point bound.
Public method | RangeAttribute(Int64, Int64) | Initializes a new GreaterThanAttribute and specify an integer bound.
Public method | RangeAttribute(UInt64, UInt64) | Initializes a new GreaterThanAttribute and specify a UInt64 bound.
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | DisplayMaxValue | Gets the maximal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments.
Protected property | DisplayMinValue | Gets the minimal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments.
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Top
Methods
 | Name | Description
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target.
Protected method | CompileTimeValidate(LocationInfo) | Validates that the current aspect has been applied to a valid location. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentException | Creates an ArgumentException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentNullException | Creates an ArgumentNullException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentOutOfRangeException | Creates an ArgumentOutOfRangeException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreatePostconditionFailedException | Creates an PostconditionFailedException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | FormatErrorMessage | Formats the ErrorMessage with concrete values. (Inherited from LocationContractAttribute.)
Protected method | GetErrorMessage | Gets unformatted error message as defined by the instance. (Overrides LocationContractAttributeGetErrorMessage.)
Protected method | GetErrorMessageArguments | Gets values of additional arguments for error message associated with particular instance of LocationContractAttribute. There arguments can be referenced from error message string by {4}, {5} and so on. (Overrides LocationContractAttributeGetErrorMessageArguments.)
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Protected method | SelectSelfOrNothing | A pointcut that selects the target location of the current aspect, unless the target location is a dependency property or an attached property. (Inherited from LocationContractAttribute.)
Public method | ValidateValueDynamic | Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property. (Overrides LocationContractAttributeValidateValueDynamic(Object, String, LocationKind, LocationValidationContext).)
Top
Remarks

Null values are accepted and do not throw an exception.

Error message is identified by RangeErrorMessage.

Error message can use additional argument

Field Value

Type:
{4} to refer to the minimum value used and

Field Value

Type:
{5} to refer to the maximum value used.

See Also

Reference

PostSharp.Patterns.Contracts Namespace


RangeAttribute Constructor

Overload List
 | Name | Description
Public method | RangeAttribute(Double, Double) | Initializes a new GreaterThanAttribute and specify a floating-point bound.
Public method | RangeAttribute(Int64, Int64) | Initializes a new GreaterThanAttribute and specify an integer bound.
Public method | RangeAttribute(UInt64, UInt64) | Initializes a new GreaterThanAttribute and specify a UInt64 bound.
Top
See Also

Reference

RangeAttribute Class
PostSharp.Patterns.Contracts Namespace


RangeAttribute Constructor (Double, Double)

Initializes a new GreaterThanAttribute and specify a floating-point bound.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public RangeAttribute(
    double min,
    double max
)

Parameters

min
Type: SystemDouble
The lower bound.
max
Type: SystemDouble
The upper bound.
See Also

Reference

RangeAttribute Class
RangeAttribute Overload
PostSharp.Patterns.Contracts Namespace


RangeAttribute Constructor (Int64, Int64)

Initializes a new GreaterThanAttribute and specify an integer bound.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public RangeAttribute(
    long min,
    long max
)

Parameters

min
Type: SystemInt64
The lower bound.
max
Type: SystemInt64
The upper bound.
See Also

Reference

RangeAttribute Class
RangeAttribute Overload
PostSharp.Patterns.Contracts Namespace


RangeAttribute Constructor (UInt64, UInt64)

Initializes a new GreaterThanAttribute and specify a UInt64 bound.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public RangeAttribute(
    ulong min,
    ulong max
)

Parameters

min
Type: SystemUInt64
The lower bound.
max
Type: SystemUInt64
The upper bound.
See Also

Reference

RangeAttribute Class
RangeAttribute Overload
PostSharp.Patterns.Contracts Namespace


RangeAttribute Properties

The RangeAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | DisplayMaxValue | Gets the maximal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments.
Protected property | DisplayMinValue | Gets the minimal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments.
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Top
See Also

Reference

RangeAttribute Class
PostSharp.Patterns.Contracts Namespace


RangeAttribute.DisplayMaxValue Property

RangeAttributeDisplayMaxValue Property

Gets the maximal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected Object DisplayMaxValue { get; }

Property Value

Type: Object
See Also

Reference

RangeAttribute Class
PostSharp.Patterns.Contracts Namespace


RangeAttribute.DisplayMinValue Property

RangeAttributeDisplayMinValue Property

Gets the minimal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected Object DisplayMinValue { get; }

Property Value

Type: Object
See Also

Reference

RangeAttribute Class
PostSharp.Patterns.Contracts Namespace


RangeAttribute Methods

The RangeAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target.
Protected method | CompileTimeValidate(LocationInfo) | Validates that the current aspect has been applied to a valid location. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentException | Creates an ArgumentException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentNullException | Creates an ArgumentNullException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentOutOfRangeException | Creates an ArgumentOutOfRangeException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreatePostconditionFailedException | Creates an PostconditionFailedException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | FormatErrorMessage | Formats the ErrorMessage with concrete values. (Inherited from LocationContractAttribute.)
Protected method | GetErrorMessage | Gets unformatted error message as defined by the instance. (Overrides LocationContractAttributeGetErrorMessage.)
Protected method | GetErrorMessageArguments | Gets values of additional arguments for error message associated with particular instance of LocationContractAttribute. There arguments can be referenced from error message string by {4}, {5} and so on. (Overrides LocationContractAttributeGetErrorMessageArguments.)
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Protected method | SelectSelfOrNothing | A pointcut that selects the target location of the current aspect, unless the target location is a dependency property or an attached property. (Inherited from LocationContractAttribute.)
Public method | ValidateValueDynamic | Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property. (Overrides LocationContractAttributeValidateValueDynamic(Object, String, LocationKind, LocationValidationContext).)
Top
See Also

Reference

RangeAttribute Class
PostSharp.Patterns.Contracts Namespace


RangeAttribute.CompileTimeValidate Method

RangeAttributeCompileTimeValidate Method

Overload List
 | Name | Description
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target.
Protected method | CompileTimeValidate(LocationInfo) | Validates that the current aspect has been applied to a valid location. (Inherited from LocationContractAttribute.)
Top
See Also

Reference

RangeAttribute Class
PostSharp.Patterns.Contracts Namespace


RangeAttribute.CompileTimeValidate Method (Object)

RangeAttributeCompileTimeValidate Method (Object)

Method invoked at build time to ensure that the aspect has been applied to the right target.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool CompileTimeValidate(
    Object target
)

Parameters

target
Type: SystemObject
Target element.

Return Value

Type: Boolean
true if the aspect was applied to an acceptable target, otherwise false.

Implements

IValidableAnnotationCompileTimeValidate(Object)
Remarks
The implementation of this method is expected to emit an error message or an exception of type InvalidAnnotationException in case of error. Only returning false causes the aspect to be silently ignored.
See Also

Reference

RangeAttribute Class
CompileTimeValidate Overload
PostSharp.Patterns.Contracts Namespace


RangeAttribute.GetErrorMessage Method

RangeAttributeGetErrorMessage Method

Gets unformatted error message as defined by the instance.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override string GetErrorMessage()

Return Value

Type: String
Remarks

See remarks on LocationContractAttribute for information about message parameters.

Use of this method can be overridden by setting ErrorMessage property to non-null value.

See Also

Reference

RangeAttribute Class
PostSharp.Patterns.Contracts Namespace

Other Resources

Conceptual: Creating Custom Contracts
Conceptual: Localizing Contract Errors


RangeAttribute.GetErrorMessageArguments Method

RangeAttributeGetErrorMessageArguments Method

Gets values of additional arguments for error message associated with particular instance of LocationContractAttribute. There arguments can be referenced from error message string by {4}, {5} and so on.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override Object[] GetErrorMessageArguments()

Return Value

Type: Object
An array of additional argument values.
Remarks
This method is expected to be pure, i.e. it's result can be cached and so the implementer should not return information that may change after constructor of the class has finished.
See Also

Reference

RangeAttribute Class
PostSharp.Patterns.Contracts Namespace


RangeAttribute.ValidateValueDynamic Method

RangeAttributeValidateValueDynamic Method

Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Exception ValidateValueDynamic(
    Object value,
    string locationName,
    LocationKind locationKind,
    LocationValidationContext context
)

Parameters

value
Type: SystemObject
Value.
locationName
Type: SystemString
The name of the property.
locationKind
Type: PostSharp.ReflectionLocationKind
The kind of location (typically a Property).
context
Type: PostSharp.AspectsLocationValidationContext
Why or when the value is being validated.

Return Value

Type: Exception
An Exception if the value is invalid, or null if the value is valid.
See Also

Reference

RangeAttribute Class
PostSharp.Patterns.Contracts Namespace


RegularExpressionAttribute Class

Custom attribute that, when added to a field, property or parameter, throws an ArgumentException if the target is assigned a value that does not match a given regular expression. Null strings are accepted and do not throw an exception.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.Patterns.ContractsLocationContractAttribute
PostSharp.Patterns.ContractsRegularExpressionAttribute
PostSharp.Patterns.ContractsEmailAddressAttribute
PostSharp.Patterns.ContractsPhoneAttribute
PostSharp.Patterns.ContractsUrlAttribute

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class RegularExpressionAttribute : LocationContractAttribute,
    IAspect

The RegularExpressionAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | RegularExpressionAttribute(String) | Initializes a new RegularExpressionAttribute.
Public method | RegularExpressionAttribute(String, RegexOptions) | Initializes a new RegularExpressionAttribute and specify options.
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Top
Methods
 | Name | Description
Protected method | CompileTimeValidate | Validates that the current aspect has been applied to a valid location. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentException | Creates an ArgumentException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentNullException | Creates an ArgumentNullException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentOutOfRangeException | Creates an ArgumentOutOfRangeException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreatePostconditionFailedException | Creates an PostconditionFailedException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | FormatErrorMessage | Formats the ErrorMessage with concrete values. (Inherited from LocationContractAttribute.)
Protected method | GetErrorMessage | Gets unformatted error message as defined by the instance. (Overrides LocationContractAttributeGetErrorMessage.)
Protected method | GetErrorMessageArguments | Gets values of additional arguments for error message associated with particular instance of LocationContractAttribute. There arguments can be referenced from error message string by {4}, {5} and so on. (Overrides LocationContractAttributeGetErrorMessageArguments.)
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Protected method | SelectSelfOrNothing | A pointcut that selects the target location of the current aspect, unless the target location is a dependency property or an attached property. (Inherited from LocationContractAttribute.)
Public method | ValidateValueDynamic | Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property. (Overrides LocationContractAttributeValidateValueDynamic(Object, String, LocationKind, LocationValidationContext).)
Top
Remarks

Error message is identified by RegularExpressionErrorMessage.

Error message can use additional argument

Field Value

Type:
{4} to refer to the regular expression used.

See Also

Reference

PostSharp.Patterns.Contracts Namespace


RegularExpressionAttribute Constructor

Overload List
 | Name | Description
Public method | RegularExpressionAttribute(String) | Initializes a new RegularExpressionAttribute.
Public method | RegularExpressionAttribute(String, RegexOptions) | Initializes a new RegularExpressionAttribute and specify options.
Top
See Also

Reference

RegularExpressionAttribute Class
PostSharp.Patterns.Contracts Namespace


RegularExpressionAttribute Constructor (String)

Initializes a new RegularExpressionAttribute.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public RegularExpressionAttribute(
    string pattern
)

Parameters

pattern
Type: SystemString
The regular expression.
See Also

Reference

RegularExpressionAttribute Class
RegularExpressionAttribute Overload
PostSharp.Patterns.Contracts Namespace


RegularExpressionAttribute Constructor (String, RegexOptions)

Initializes a new RegularExpressionAttribute and specify options.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public RegularExpressionAttribute(
    string pattern,
    RegexOptions options
)

Parameters

pattern
Type: SystemString
The regular expression.
options
Type: System.Text.RegularExpressionsRegexOptions
Options.
See Also

Reference

RegularExpressionAttribute Class
RegularExpressionAttribute Overload
PostSharp.Patterns.Contracts Namespace


RegularExpressionAttribute Properties

The RegularExpressionAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Top
See Also

Reference

RegularExpressionAttribute Class
PostSharp.Patterns.Contracts Namespace


RegularExpressionAttribute Methods

The RegularExpressionAttribute type exposes the following members.

Methods
 | Name | Description
Protected method | CompileTimeValidate | Validates that the current aspect has been applied to a valid location. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentException | Creates an ArgumentException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentNullException | Creates an ArgumentNullException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentOutOfRangeException | Creates an ArgumentOutOfRangeException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreatePostconditionFailedException | Creates an PostconditionFailedException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | FormatErrorMessage | Formats the ErrorMessage with concrete values. (Inherited from LocationContractAttribute.)
Protected method | GetErrorMessage | Gets unformatted error message as defined by the instance. (Overrides LocationContractAttributeGetErrorMessage.)
Protected method | GetErrorMessageArguments | Gets values of additional arguments for error message associated with particular instance of LocationContractAttribute. There arguments can be referenced from error message string by {4}, {5} and so on. (Overrides LocationContractAttributeGetErrorMessageArguments.)
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Protected method | SelectSelfOrNothing | A pointcut that selects the target location of the current aspect, unless the target location is a dependency property or an attached property. (Inherited from LocationContractAttribute.)
Public method | ValidateValueDynamic | Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property. (Overrides LocationContractAttributeValidateValueDynamic(Object, String, LocationKind, LocationValidationContext).)
Top
See Also

Reference

RegularExpressionAttribute Class
PostSharp.Patterns.Contracts Namespace


RegularExpressionAttribute.GetErrorMessage Method

RegularExpressionAttributeGetErrorMessage Method

Gets unformatted error message as defined by the instance.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override string GetErrorMessage()

Return Value

Type: String
Remarks

See remarks on LocationContractAttribute for information about message parameters.

Use of this method can be overridden by setting ErrorMessage property to non-null value.

See Also

Reference

RegularExpressionAttribute Class
PostSharp.Patterns.Contracts Namespace

Other Resources

Conceptual: Creating Custom Contracts
Conceptual: Localizing Contract Errors


RegularExpressionAttribute.GetErrorMessageArguments Method

RegularExpressionAttributeGetErrorMessageArguments Method

Gets values of additional arguments for error message associated with particular instance of LocationContractAttribute. There arguments can be referenced from error message string by {4}, {5} and so on.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override Object[] GetErrorMessageArguments()

Return Value

Type: Object
An array of additional argument values.
Remarks
This method is expected to be pure, i.e. it's result can be cached and so the implementer should not return information that may change after constructor of the class has finished.
See Also

Reference

RegularExpressionAttribute Class
PostSharp.Patterns.Contracts Namespace


RegularExpressionAttribute.ValidateValueDynamic Method

RegularExpressionAttributeValidateValueDynamic Method

Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Exception ValidateValueDynamic(
    Object value,
    string locationName,
    LocationKind locationKind,
    LocationValidationContext context
)

Parameters

value
Type: SystemObject
Value.
locationName
Type: SystemString
The name of the property.
locationKind
Type: PostSharp.ReflectionLocationKind
The kind of location (typically a Property).
context
Type: PostSharp.AspectsLocationValidationContext
Why or when the value is being validated.

Return Value

Type: Exception
An Exception if the value is invalid, or null if the value is valid.
See Also

Reference

RegularExpressionAttribute Class
PostSharp.Patterns.Contracts Namespace


RequiredAttribute Class

Custom attribute that, when added to a field, property or parameter, throws:
  • an ArgumentNullException if the target is assigned a null value;
  • an ArgumentOutOfRangeException if the target is assigned an empty or white-space string.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.Patterns.ContractsLocationContractAttribute
PostSharp.Patterns.ContractsRequiredAttribute

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class RequiredAttribute : LocationContractAttribute,
    IAspect

The RequiredAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | RequiredAttribute | Initializes a new RequiredAttribute.
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Top
Methods
 | Name | Description
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Public method | ValidateValueDynamic | Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property. (Overrides LocationContractAttributeValidateValueDynamic(Object, String, LocationKind, LocationValidationContext).)
Top
Remarks

Error message is identified by RequiredErrorMessage.

See Also

Reference

PostSharp.Patterns.Contracts Namespace

Other Resources

Conceptual: Adding Contracts to Code
Conceptual: Breaking Changes in PostSharp 6.0
Conceptual: Contracts


RequiredAttribute Constructor

Initializes a new RequiredAttribute.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public RequiredAttribute()
See Also

Reference

RequiredAttribute Class
PostSharp.Patterns.Contracts Namespace


RequiredAttribute Properties

The RequiredAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Top
See Also

Reference

RequiredAttribute Class
PostSharp.Patterns.Contracts Namespace


RequiredAttribute Methods

The RequiredAttribute type exposes the following members.

Methods
 | Name | Description
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Public method | ValidateValueDynamic | Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property. (Overrides LocationContractAttributeValidateValueDynamic(Object, String, LocationKind, LocationValidationContext).)
Top
See Also

Reference

RequiredAttribute Class
PostSharp.Patterns.Contracts Namespace


RequiredAttribute.ValidateValueDynamic Method

RequiredAttributeValidateValueDynamic Method

Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Exception ValidateValueDynamic(
    Object value,
    string locationName,
    LocationKind locationKind,
    LocationValidationContext context
)

Parameters

value
Type: SystemObject
Value.
locationName
Type: SystemString
The name of the property.
locationKind
Type: PostSharp.ReflectionLocationKind
The kind of location (typically a Property).
context
Type: PostSharp.AspectsLocationValidationContext
Why or when the value is being validated.

Return Value

Type: Exception
An Exception if the value is invalid, or null if the value is valid.
See Also

Reference

RequiredAttribute Class
PostSharp.Patterns.Contracts Namespace


StrictlyGreaterThanAttribute Class

Custom attribute that, when added to a field, property or parameter, throws an ArgumentOutOfRangeException if the target is assigned a value that is smaller than or equal to a given value.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.Patterns.ContractsLocationContractAttribute
PostSharp.Patterns.ContractsRangeAttribute
PostSharp.Patterns.ContractsStrictlyGreaterThanAttribute
PostSharp.Patterns.ContractsStrictlyPositiveAttribute

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class StrictlyGreaterThanAttribute : RangeAttribute

The StrictlyGreaterThanAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | StrictlyGreaterThanAttribute(Double) | Initializes a new StrictlyGreaterThanAttribute with a given floating-point bound.
Public method | StrictlyGreaterThanAttribute(Int64) | Initializes a new StrictlyGreaterThanAttribute with a given integer bound.
Public method | StrictlyGreaterThanAttribute(UInt64) | Initializes a new StrictlyGreaterThanAttribute with a given UInt64 bound.
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | DisplayMaxValue | Gets the maximal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments. (Inherited from RangeAttribute.)
Protected property | DisplayMinValue | Gets the minimal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments. (Inherited from RangeAttribute.)
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Top
Methods
 | Name | Description
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from RangeAttribute.)
Protected method | CompileTimeValidate(LocationInfo) | Validates that the current aspect has been applied to a valid location. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentException | Creates an ArgumentException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentNullException | Creates an ArgumentNullException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentOutOfRangeException | Creates an ArgumentOutOfRangeException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreatePostconditionFailedException | Creates an PostconditionFailedException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | FormatErrorMessage | Formats the ErrorMessage with concrete values. (Inherited from LocationContractAttribute.)
Protected method | GetErrorMessage | Gets unformatted error message as defined by the instance. (Overrides RangeAttributeGetErrorMessage.)
Protected method | GetErrorMessageArguments | Gets values of additional arguments for error message associated with particular instance of LocationContractAttribute. There arguments can be referenced from error message string by {4}, {5} and so on. (Overrides RangeAttributeGetErrorMessageArguments.)
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Protected method | SelectSelfOrNothing | A pointcut that selects the target location of the current aspect, unless the target location is a dependency property or an attached property. (Inherited from LocationContractAttribute.)
Public method | ValidateValueDynamic | Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property. (Inherited from RangeAttribute.)
Top
Remarks

Null values are accepted and do not throw an exception.

Floating-point values are tested to be greater than or equal to the minimum value plus a tolerance value. The tolerance value is equal to the distance of the value closest to the minimum value according to the precision of the respective floating-point numerical data type.

Error message is identified by StrictlyGreaterThanErrorMessage.

Error message can use additional argument

Field Value

Type:
{4} to refer to the minimum value used.

See Also

Reference

PostSharp.Patterns.Contracts Namespace


StrictlyGreaterThanAttribute Constructor

Overload List
 | Name | Description
Public method | StrictlyGreaterThanAttribute(Double) | Initializes a new StrictlyGreaterThanAttribute with a given floating-point bound.
Public method | StrictlyGreaterThanAttribute(Int64) | Initializes a new StrictlyGreaterThanAttribute with a given integer bound.
Public method | StrictlyGreaterThanAttribute(UInt64) | Initializes a new StrictlyGreaterThanAttribute with a given UInt64 bound.
Top
See Also

Reference

StrictlyGreaterThanAttribute Class
PostSharp.Patterns.Contracts Namespace


StrictlyGreaterThanAttribute Constructor (Double)

Initializes a new StrictlyGreaterThanAttribute with a given floating-point bound.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public StrictlyGreaterThanAttribute(
    double min
)

Parameters

min
Type: SystemDouble
The lower bound.
See Also

Reference

StrictlyGreaterThanAttribute Class
StrictlyGreaterThanAttribute Overload
PostSharp.Patterns.Contracts Namespace


StrictlyGreaterThanAttribute Constructor (Int64)

Initializes a new StrictlyGreaterThanAttribute with a given integer bound.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public StrictlyGreaterThanAttribute(
    long min
)

Parameters

min
Type: SystemInt64
The lower bound.
See Also

Reference

StrictlyGreaterThanAttribute Class
StrictlyGreaterThanAttribute Overload
PostSharp.Patterns.Contracts Namespace


StrictlyGreaterThanAttribute Constructor (UInt64)

Initializes a new StrictlyGreaterThanAttribute with a given UInt64 bound.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public StrictlyGreaterThanAttribute(
    ulong min
)

Parameters

min
Type: SystemUInt64
The lower bound.
See Also

Reference

StrictlyGreaterThanAttribute Class
StrictlyGreaterThanAttribute Overload
PostSharp.Patterns.Contracts Namespace


StrictlyGreaterThanAttribute Properties

The StrictlyGreaterThanAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | DisplayMaxValue | Gets the maximal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments. (Inherited from RangeAttribute.)
Protected property | DisplayMinValue | Gets the minimal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments. (Inherited from RangeAttribute.)
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Top
See Also

Reference

StrictlyGreaterThanAttribute Class
PostSharp.Patterns.Contracts Namespace


StrictlyGreaterThanAttribute Methods

The StrictlyGreaterThanAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from RangeAttribute.)
Protected method | CompileTimeValidate(LocationInfo) | Validates that the current aspect has been applied to a valid location. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentException | Creates an ArgumentException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentNullException | Creates an ArgumentNullException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentOutOfRangeException | Creates an ArgumentOutOfRangeException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreatePostconditionFailedException | Creates an PostconditionFailedException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | FormatErrorMessage | Formats the ErrorMessage with concrete values. (Inherited from LocationContractAttribute.)
Protected method | GetErrorMessage | Gets unformatted error message as defined by the instance. (Overrides RangeAttributeGetErrorMessage.)
Protected method | GetErrorMessageArguments | Gets values of additional arguments for error message associated with particular instance of LocationContractAttribute. There arguments can be referenced from error message string by {4}, {5} and so on. (Overrides RangeAttributeGetErrorMessageArguments.)
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Protected method | SelectSelfOrNothing | A pointcut that selects the target location of the current aspect, unless the target location is a dependency property or an attached property. (Inherited from LocationContractAttribute.)
Public method | ValidateValueDynamic | Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property. (Inherited from RangeAttribute.)
Top
See Also

Reference

StrictlyGreaterThanAttribute Class
PostSharp.Patterns.Contracts Namespace


StrictlyGreaterThanAttribute.GetErrorMessage Method

StrictlyGreaterThanAttributeGetErrorMessage Method

Gets unformatted error message as defined by the instance.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override string GetErrorMessage()

Return Value

Type: String
Remarks

See remarks on LocationContractAttribute for information about message parameters.

Use of this method can be overridden by setting ErrorMessage property to non-null value.

See Also

Reference

StrictlyGreaterThanAttribute Class
PostSharp.Patterns.Contracts Namespace

Other Resources

Conceptual: Creating Custom Contracts
Conceptual: Localizing Contract Errors


StrictlyGreaterThanAttribute.GetErrorMessageArguments Method

StrictlyGreaterThanAttributeGetErrorMessageArguments Method

Gets values of additional arguments for error message associated with particular instance of LocationContractAttribute. There arguments can be referenced from error message string by {4}, {5} and so on.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override Object[] GetErrorMessageArguments()

Return Value

Type: Object
An array of additional argument values.
Remarks
This method is expected to be pure, i.e. it's result can be cached and so the implementer should not return information that may change after constructor of the class has finished.
See Also

Reference

StrictlyGreaterThanAttribute Class
PostSharp.Patterns.Contracts Namespace


StrictlyLessThanAttribute Class

Custom attribute that, when added to a field, property or parameter, throws an ArgumentOutOfRangeException if the target is assigned a value that is greater than or equal to a given value.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.Patterns.ContractsLocationContractAttribute
PostSharp.Patterns.ContractsRangeAttribute
PostSharp.Patterns.ContractsStrictlyLessThanAttribute
PostSharp.Patterns.ContractsStrictlyNegativeAttribute

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class StrictlyLessThanAttribute : RangeAttribute

The StrictlyLessThanAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | StrictlyLessThanAttribute(Double) | Initializes a new StrictlyLessThanAttribute with a given floating-point bound.
Public method | StrictlyLessThanAttribute(Int64) | Initializes a new StrictlyLessThanAttribute with a given integer bound.
Public method | StrictlyLessThanAttribute(UInt64) | Initializes a new StrictlyLessThanAttribute with a given UInt64 bound.
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | DisplayMaxValue | Gets the maximal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments. (Inherited from RangeAttribute.)
Protected property | DisplayMinValue | Gets the minimal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments. (Inherited from RangeAttribute.)
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Top
Methods
 | Name | Description
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from RangeAttribute.)
Protected method | CompileTimeValidate(LocationInfo) | Validates that the current aspect has been applied to a valid location. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentException | Creates an ArgumentException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentNullException | Creates an ArgumentNullException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentOutOfRangeException | Creates an ArgumentOutOfRangeException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreatePostconditionFailedException | Creates an PostconditionFailedException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | FormatErrorMessage | Formats the ErrorMessage with concrete values. (Inherited from LocationContractAttribute.)
Protected method | GetErrorMessage | Gets unformatted error message as defined by the instance. (Overrides RangeAttributeGetErrorMessage.)
Protected method | GetErrorMessageArguments | Gets values of additional arguments for error message associated with particular instance of LocationContractAttribute. There arguments can be referenced from error message string by {4}, {5} and so on. (Overrides RangeAttributeGetErrorMessageArguments.)
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Protected method | SelectSelfOrNothing | A pointcut that selects the target location of the current aspect, unless the target location is a dependency property or an attached property. (Inherited from LocationContractAttribute.)
Public method | ValidateValueDynamic | Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property. (Inherited from RangeAttribute.)
Top
Remarks

Null values are accepted and do not throw an exception.

Floating-point values are tested to be greater than or equal to the maximum value plus a tolerance value. The tolerance value is equal to the distance of the value closest to the maximum value according to the precision of the respective floating-point numerical data type.

Error message is identified by StrictlyLessThanErrorMessage.

Error message can use additional argument

Field Value

Type:
{4} to refer to the minimum value used.

See Also

Reference

PostSharp.Patterns.Contracts Namespace


StrictlyLessThanAttribute Constructor

Overload List
 | Name | Description
Public method | StrictlyLessThanAttribute(Double) | Initializes a new StrictlyLessThanAttribute with a given floating-point bound.
Public method | StrictlyLessThanAttribute(Int64) | Initializes a new StrictlyLessThanAttribute with a given integer bound.
Public method | StrictlyLessThanAttribute(UInt64) | Initializes a new StrictlyLessThanAttribute with a given UInt64 bound.
Top
See Also

Reference

StrictlyLessThanAttribute Class
PostSharp.Patterns.Contracts Namespace


StrictlyLessThanAttribute Constructor (Double)

Initializes a new StrictlyLessThanAttribute with a given floating-point bound.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public StrictlyLessThanAttribute(
    double max
)

Parameters

max
Type: SystemDouble
The upper bound.
See Also

Reference

StrictlyLessThanAttribute Class
StrictlyLessThanAttribute Overload
PostSharp.Patterns.Contracts Namespace


StrictlyLessThanAttribute Constructor (Int64)

Initializes a new StrictlyLessThanAttribute with a given integer bound.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public StrictlyLessThanAttribute(
    long max
)

Parameters

max
Type: SystemInt64
The upper bound.
See Also

Reference

StrictlyLessThanAttribute Class
StrictlyLessThanAttribute Overload
PostSharp.Patterns.Contracts Namespace


StrictlyLessThanAttribute Constructor (UInt64)

Initializes a new StrictlyLessThanAttribute with a given UInt64 bound.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public StrictlyLessThanAttribute(
    ulong max
)

Parameters

max
Type: SystemUInt64
The upper bound.
See Also

Reference

StrictlyLessThanAttribute Class
StrictlyLessThanAttribute Overload
PostSharp.Patterns.Contracts Namespace


StrictlyLessThanAttribute Properties

The StrictlyLessThanAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | DisplayMaxValue | Gets the maximal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments. (Inherited from RangeAttribute.)
Protected property | DisplayMinValue | Gets the minimal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments. (Inherited from RangeAttribute.)
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Top
See Also

Reference

StrictlyLessThanAttribute Class
PostSharp.Patterns.Contracts Namespace


StrictlyLessThanAttribute Methods

The StrictlyLessThanAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from RangeAttribute.)
Protected method | CompileTimeValidate(LocationInfo) | Validates that the current aspect has been applied to a valid location. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentException | Creates an ArgumentException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentNullException | Creates an ArgumentNullException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentOutOfRangeException | Creates an ArgumentOutOfRangeException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreatePostconditionFailedException | Creates an PostconditionFailedException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | FormatErrorMessage | Formats the ErrorMessage with concrete values. (Inherited from LocationContractAttribute.)
Protected method | GetErrorMessage | Gets unformatted error message as defined by the instance. (Overrides RangeAttributeGetErrorMessage.)
Protected method | GetErrorMessageArguments | Gets values of additional arguments for error message associated with particular instance of LocationContractAttribute. There arguments can be referenced from error message string by {4}, {5} and so on. (Overrides RangeAttributeGetErrorMessageArguments.)
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Protected method | SelectSelfOrNothing | A pointcut that selects the target location of the current aspect, unless the target location is a dependency property or an attached property. (Inherited from LocationContractAttribute.)
Public method | ValidateValueDynamic | Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property. (Inherited from RangeAttribute.)
Top
See Also

Reference

StrictlyLessThanAttribute Class
PostSharp.Patterns.Contracts Namespace


StrictlyLessThanAttribute.GetErrorMessage Method

StrictlyLessThanAttributeGetErrorMessage Method

Gets unformatted error message as defined by the instance.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override string GetErrorMessage()

Return Value

Type: String
Remarks

See remarks on LocationContractAttribute for information about message parameters.

Use of this method can be overridden by setting ErrorMessage property to non-null value.

See Also

Reference

StrictlyLessThanAttribute Class
PostSharp.Patterns.Contracts Namespace

Other Resources

Conceptual: Creating Custom Contracts
Conceptual: Localizing Contract Errors


StrictlyLessThanAttribute.GetErrorMessageArguments Method

StrictlyLessThanAttributeGetErrorMessageArguments Method

Gets values of additional arguments for error message associated with particular instance of LocationContractAttribute. There arguments can be referenced from error message string by {4}, {5} and so on.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override Object[] GetErrorMessageArguments()

Return Value

Type: Object
An array of additional argument values.
Remarks
This method is expected to be pure, i.e. it's result can be cached and so the implementer should not return information that may change after constructor of the class has finished.
See Also

Reference

StrictlyLessThanAttribute Class
PostSharp.Patterns.Contracts Namespace


StrictlyNegativeAttribute Class

Custom attribute that, when added to a field, property or parameter, throws an ArgumentOutOfRangeException if the target is assigned a value greater than or equal to zero.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.Patterns.ContractsLocationContractAttribute
PostSharp.Patterns.ContractsRangeAttribute
PostSharp.Patterns.ContractsStrictlyLessThanAttribute
PostSharp.Patterns.ContractsStrictlyNegativeAttribute

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class StrictlyNegativeAttribute : StrictlyLessThanAttribute

The StrictlyNegativeAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | StrictlyNegativeAttribute | Initializes a new StrictlyNegativeAttribute.
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | DisplayMaxValue | Gets the maximal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments. (Inherited from RangeAttribute.)
Protected property | DisplayMinValue | Gets the minimal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments. (Inherited from RangeAttribute.)
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Top
Methods
 | Name | Description
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from RangeAttribute.)
Protected method | CompileTimeValidate(LocationInfo) | Validates that the current aspect has been applied to a valid location. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentException | Creates an ArgumentException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentNullException | Creates an ArgumentNullException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentOutOfRangeException | Creates an ArgumentOutOfRangeException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreatePostconditionFailedException | Creates an PostconditionFailedException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | FormatErrorMessage | Formats the ErrorMessage with concrete values. (Inherited from LocationContractAttribute.)
Protected method | GetErrorMessage | Gets unformatted error message as defined by the instance. (Inherited from StrictlyLessThanAttribute.)
Protected method | GetErrorMessageArguments | Gets values of additional arguments for error message associated with particular instance of LocationContractAttribute. There arguments can be referenced from error message string by {4}, {5} and so on. (Inherited from StrictlyLessThanAttribute.)
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Protected method | SelectSelfOrNothing | A pointcut that selects the target location of the current aspect, unless the target location is a dependency property or an attached property. (Inherited from LocationContractAttribute.)
Public method | ValidateValueDynamic | Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property. (Inherited from RangeAttribute.)
Top
Remarks

Null values are accepted and do not throw an exception.

Error message is identified by LessThanErrorMessage.

See Also

Reference

PostSharp.Patterns.Contracts Namespace


StrictlyNegativeAttribute Constructor

Initializes a new StrictlyNegativeAttribute.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public StrictlyNegativeAttribute()
See Also

Reference

StrictlyNegativeAttribute Class
PostSharp.Patterns.Contracts Namespace


StrictlyNegativeAttribute Properties

The StrictlyNegativeAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | DisplayMaxValue | Gets the maximal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments. (Inherited from RangeAttribute.)
Protected property | DisplayMinValue | Gets the minimal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments. (Inherited from RangeAttribute.)
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Top
See Also

Reference

StrictlyNegativeAttribute Class
PostSharp.Patterns.Contracts Namespace


StrictlyNegativeAttribute Methods

The StrictlyNegativeAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from RangeAttribute.)
Protected method | CompileTimeValidate(LocationInfo) | Validates that the current aspect has been applied to a valid location. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentException | Creates an ArgumentException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentNullException | Creates an ArgumentNullException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentOutOfRangeException | Creates an ArgumentOutOfRangeException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreatePostconditionFailedException | Creates an PostconditionFailedException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | FormatErrorMessage | Formats the ErrorMessage with concrete values. (Inherited from LocationContractAttribute.)
Protected method | GetErrorMessage | Gets unformatted error message as defined by the instance. (Inherited from StrictlyLessThanAttribute.)
Protected method | GetErrorMessageArguments | Gets values of additional arguments for error message associated with particular instance of LocationContractAttribute. There arguments can be referenced from error message string by {4}, {5} and so on. (Inherited from StrictlyLessThanAttribute.)
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Protected method | SelectSelfOrNothing | A pointcut that selects the target location of the current aspect, unless the target location is a dependency property or an attached property. (Inherited from LocationContractAttribute.)
Public method | ValidateValueDynamic | Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property. (Inherited from RangeAttribute.)
Top
See Also

Reference

StrictlyNegativeAttribute Class
PostSharp.Patterns.Contracts Namespace


StrictlyPositiveAttribute Class

Custom attribute that, when added to a field, property or parameter, throws an ArgumentOutOfRangeException if the target is assigned a value smaller than or equal to zero.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.Patterns.ContractsLocationContractAttribute
PostSharp.Patterns.ContractsRangeAttribute
PostSharp.Patterns.ContractsStrictlyGreaterThanAttribute
PostSharp.Patterns.ContractsStrictlyPositiveAttribute

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class StrictlyPositiveAttribute : StrictlyGreaterThanAttribute

The StrictlyPositiveAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | StrictlyPositiveAttribute | Initializes a new StrictlyPositiveAttribute.
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | DisplayMaxValue | Gets the maximal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments. (Inherited from RangeAttribute.)
Protected property | DisplayMinValue | Gets the minimal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments. (Inherited from RangeAttribute.)
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Top
Methods
 | Name | Description
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from RangeAttribute.)
Protected method | CompileTimeValidate(LocationInfo) | Validates that the current aspect has been applied to a valid location. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentException | Creates an ArgumentException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentNullException | Creates an ArgumentNullException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentOutOfRangeException | Creates an ArgumentOutOfRangeException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreatePostconditionFailedException | Creates an PostconditionFailedException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | FormatErrorMessage | Formats the ErrorMessage with concrete values. (Inherited from LocationContractAttribute.)
Protected method | GetErrorMessage | Gets unformatted error message as defined by the instance. (Inherited from StrictlyGreaterThanAttribute.)
Protected method | GetErrorMessageArguments | Gets values of additional arguments for error message associated with particular instance of LocationContractAttribute. There arguments can be referenced from error message string by {4}, {5} and so on. (Inherited from StrictlyGreaterThanAttribute.)
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Protected method | SelectSelfOrNothing | A pointcut that selects the target location of the current aspect, unless the target location is a dependency property or an attached property. (Inherited from LocationContractAttribute.)
Public method | ValidateValueDynamic | Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property. (Inherited from RangeAttribute.)
Top
Remarks

Null values are accepted and do not throw an exception.

Error message is identified by GreaterThanErrorMessage.

See Also

Reference

PostSharp.Patterns.Contracts Namespace


StrictlyPositiveAttribute Constructor

Initializes a new StrictlyPositiveAttribute.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public StrictlyPositiveAttribute()
See Also

Reference

StrictlyPositiveAttribute Class
PostSharp.Patterns.Contracts Namespace


StrictlyPositiveAttribute Properties

The StrictlyPositiveAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | DisplayMaxValue | Gets the maximal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments. (Inherited from RangeAttribute.)
Protected property | DisplayMinValue | Gets the minimal value to be used when generating the error message, typically in the implementation of GetErrorMessageArguments. (Inherited from RangeAttribute.)
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Top
See Also

Reference

StrictlyPositiveAttribute Class
PostSharp.Patterns.Contracts Namespace


StrictlyPositiveAttribute Methods

The StrictlyPositiveAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from RangeAttribute.)
Protected method | CompileTimeValidate(LocationInfo) | Validates that the current aspect has been applied to a valid location. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentException | Creates an ArgumentException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentNullException | Creates an ArgumentNullException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreateArgumentOutOfRangeException | Creates an ArgumentOutOfRangeException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | CreatePostconditionFailedException | Creates an PostconditionFailedException with an error message formatted from ErrorMessage and given concrete values. (Inherited from LocationContractAttribute.)
Protected method | FormatErrorMessage | Formats the ErrorMessage with concrete values. (Inherited from LocationContractAttribute.)
Protected method | GetErrorMessage | Gets unformatted error message as defined by the instance. (Inherited from StrictlyGreaterThanAttribute.)
Protected method | GetErrorMessageArguments | Gets values of additional arguments for error message associated with particular instance of LocationContractAttribute. There arguments can be referenced from error message string by {4}, {5} and so on. (Inherited from StrictlyGreaterThanAttribute.)
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Protected method | SelectSelfOrNothing | A pointcut that selects the target location of the current aspect, unless the target location is a dependency property or an attached property. (Inherited from LocationContractAttribute.)
Public method | ValidateValueDynamic | Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property. (Inherited from RangeAttribute.)
Top
See Also

Reference

StrictlyPositiveAttribute Class
PostSharp.Patterns.Contracts Namespace


StringLengthAttribute Class

Custom attribute that, when added to a field, property or parameter, throws an ArgumentException if the target is assigned a string of invalid length. Null strings are accepted and do not throw an exception.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.Patterns.ContractsLocationContractAttribute
PostSharp.Patterns.ContractsStringLengthAttribute

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class StringLengthAttribute : LocationContractAttribute

The StringLengthAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | StringLengthAttribute(Int32) | Initializes a new StringLengthAttribute and specifies the maximum length.
Public method | StringLengthAttribute(Int32, Int32) | Initializes a new StringLengthAttribute and specifies the maximum length and the minimum length.
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Public property | MaximumLength | Gets the maximum length.
Public property | MinimumLength | Gets the minimum length.
Top
Methods
 | Name | Description
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Public method | ValidateValueDynamic | Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property. (Overrides LocationContractAttributeValidateValueDynamic(Object, String, LocationKind, LocationValidationContext).)
Top
Remarks

Depending on supplied constructor arguments, one of the following holds:

  • if there is no minimum specified, then the error message is identified by StringLengthMaxErrorMessage and can use additional argument

    Field Value

    Type:
    {4} to refer to the maximum value specified,
  • or if there is maximum is equal to MaxValue, then the error message is identified by StringLengthMinErrorMessage and can use additional argument

    Field Value

    Type:
    {4} to refer to the minimum value specified,
  • otherwise, the error message is identified by StringLengthRangeErrorMessage and can use additional arguments

    Field Value

    Type:
    {4} to refer to the minimum value specified and

    Field Value

    Type:
    {5} to refer to the maximum value specified.

See Also

Reference

PostSharp.Patterns.Contracts Namespace


StringLengthAttribute Constructor

Overload List
 | Name | Description
Public method | StringLengthAttribute(Int32) | Initializes a new StringLengthAttribute and specifies the maximum length.
Public method | StringLengthAttribute(Int32, Int32) | Initializes a new StringLengthAttribute and specifies the maximum length and the minimum length.
Top
See Also

Reference

StringLengthAttribute Class
PostSharp.Patterns.Contracts Namespace


StringLengthAttribute Constructor (Int32)

Initializes a new StringLengthAttribute and specifies the maximum length.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public StringLengthAttribute(
    int maximumLength
)

Parameters

maximumLength
Type: SystemInt32
Maximum length.
See Also

Reference

StringLengthAttribute Class
StringLengthAttribute Overload
PostSharp.Patterns.Contracts Namespace


StringLengthAttribute Constructor (Int32, Int32)

Initializes a new StringLengthAttribute and specifies the maximum length and the minimum length.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public StringLengthAttribute(
    int minimumLength,
    int maximumLength
)

Parameters

minimumLength
Type: SystemInt32
Minimum length.
maximumLength
Type: SystemInt32
Maximum length.
See Also

Reference

StringLengthAttribute Class
StringLengthAttribute Overload
PostSharp.Patterns.Contracts Namespace


StringLengthAttribute Properties

The StringLengthAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Public property | MaximumLength | Gets the maximum length.
Public property | MinimumLength | Gets the minimum length.
Top
See Also

Reference

StringLengthAttribute Class
PostSharp.Patterns.Contracts Namespace


StringLengthAttribute.MaximumLength Property

StringLengthAttributeMaximumLength Property

Gets the maximum length.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int MaximumLength { get; }

Property Value

Type: Int32
See Also

Reference

StringLengthAttribute Class
PostSharp.Patterns.Contracts Namespace


StringLengthAttribute.MinimumLength Property

StringLengthAttributeMinimumLength Property

Gets the minimum length.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int MinimumLength { get; }

Property Value

Type: Int32
See Also

Reference

StringLengthAttribute Class
PostSharp.Patterns.Contracts Namespace


StringLengthAttribute Methods

The StringLengthAttribute type exposes the following members.

Methods
 | Name | Description
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Public method | ValidateValueDynamic | Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property. (Overrides LocationContractAttributeValidateValueDynamic(Object, String, LocationKind, LocationValidationContext).)
Top
See Also

Reference

StringLengthAttribute Class
PostSharp.Patterns.Contracts Namespace


StringLengthAttribute.ValidateValueDynamic Method

StringLengthAttributeValidateValueDynamic Method

Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Exception ValidateValueDynamic(
    Object value,
    string locationName,
    LocationKind locationKind,
    LocationValidationContext context
)

Parameters

value
Type: SystemObject
Value.
locationName
Type: SystemString
The name of the property.
locationKind
Type: PostSharp.ReflectionLocationKind
The kind of location (typically a Property).
context
Type: PostSharp.AspectsLocationValidationContext
Why or when the value is being validated.

Return Value

Type: Exception
An Exception if the value is invalid, or null if the value is valid.
See Also

Reference

StringLengthAttribute Class
PostSharp.Patterns.Contracts Namespace


UrlAttribute Class

Custom attribute that, when added to a field, property or parameter, throws an ArgumentException if the target is assigned a value that is not a valid URL starting with http://, https:// or ftp://. Null strings are accepted and do not throw an exception.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.Patterns.ContractsLocationContractAttribute
PostSharp.Patterns.ContractsRegularExpressionAttribute
PostSharp.Patterns.ContractsUrlAttribute

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class UrlAttribute : RegularExpressionAttribute

The UrlAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | UrlAttribute | Initializes a new UrlAttribute.
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Top
Methods
 | Name | Description
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Public method | ValidateValueDynamic | Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property. (Inherited from RegularExpressionAttribute.)
Top
Remarks

Error message is identified by UrlErrorMessage.

See Also

Reference

PostSharp.Patterns.Contracts Namespace


UrlAttribute Constructor

Initializes a new UrlAttribute.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public UrlAttribute()
See Also

Reference

UrlAttribute Class
PostSharp.Patterns.Contracts Namespace


UrlAttribute Properties

The UrlAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | ErrorMessage | Gets or sets the error message formatting string. (Inherited from LocationContractAttribute.)
Top
See Also

Reference

UrlAttribute Class
PostSharp.Patterns.Contracts Namespace


UrlAttribute Methods

The UrlAttribute type exposes the following members.

Methods
 | Name | Description
Public method | RuntimeInitialize | Initializes the aspect at runtime. (Inherited from LocationContractAttribute.)
Public method | ValidateValueDynamic | Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property. (Inherited from RegularExpressionAttribute.)
Top
See Also

Reference

UrlAttribute Class
PostSharp.Patterns.Contracts Namespace


PostSharp.Patterns.Diagnostics Namespace

The PostSharp.Patterns.Diagnostics namespace contains a logging aspect.
Classes
 | Class | Description
Public class | CustomRecordLoggingOptions | Options for custom logging records. Exposed on the CustomRecordLoggingOptions property.
Public class | DefaultLoggingExceptionHandler | An implementation of the ILoggingExceptionHandler that attempts to log exceptions to the Meta logging role, then disables the backlog in case of internal exception (but not in case of invalid user code). Not to be confused with ILoggerExceptionHandler.
Public class | LogActivity | Represents a logged custom activity, i.e. something that a beginning and an end with a specific outcome.
Public class | LogAttribute | Custom attribute that, when applied on a method, causes PostSharp to implement tracing before and after execution of this method.
Public class | LogAttributeBase | Base class for all method-level logging aspects.
Public class | LogExceptionAttribute | Custom attribute that, when applied on a method, causes PostSharp to implement tracing upon exception in this method.
Public class | Logger | Allows to emit custom log records and define custom activities.
Public class | LoggingAbstractSource | Exposes the current LoggingTypeSource for a given role and Type.
Public class | LoggingBackend | Base class for all logging back-ends (sometimes names sinks, targets, listeners) of the PostSharp logging system.
Public class | LoggingBackendOptions | Options for the LoggingBackend class.
Public class | LoggingBuildTimeConfiguration | Root element of the XML configuration (postsharp.config) for the Logging component.
Public class | LoggingContextMismatchException |
Public class | LoggingExceptionInfo | Arguments of the OnInternalException(LoggingExceptionInfo) method.
Public class | LoggingNamespaceSource | Allows to enable or disable logging for a whole namespace.
Public class | LoggingOptions | Represents the build-time options for logging records. This class is exposed by DefaultOptions and ExceptionOptions. The values of this class cannot be changed at run-time because they influence the way PostSharp instruments the code.
Public class | LoggingProfile | Logging profiles are named configurations of logging aspects and influence the way PostSharp generates the code instrumentation. They are typically instantiated in postsharp.config.
Public class | LoggingProfileCollection | Collection of instances of the LoggingProfile class.
Public class | LoggingProfileRepository | Provides access to logging profiles (LoggingProfile) at run-time. Exposed by the Profiles property. Note that each assembly of the AppDomain contains its own copy of each LoggingProfile used in this assembly, and each copy may be different, even if they have the same name.
Public class | LoggingRoleConfiguration | Role-specific logging options. There is one instance of the LoggingRoleConfiguration class for each logging role. The LoggingRoleConfiguration is a run-time concept, with no build-time meaning.
Public class | LoggingRoleConfigurationRepository | Provides access to role-specific options (LoggingRoleConfiguration). This class is exposed on the Profiles.
Public class | LoggingRoles | List of standard logging roles.
Public class | LoggingServices | The entry point to configure PostSharp.Patterns.Diagnostics logging at run-time.
Public class | LoggingServicesFormatters | Provides access to formatters. This class is exposed on the LoggingServicesFormatters property.
Public class | LoggingTypeSource | Allows to enable or disable logging for a specific SourceType and exposes some information regarding this SourceType/
Public class | LogRecordKindExtensions | Extensions to the LogRecordKind enum.
Public class | LogValueAttribute | Custom attribute that, when applied on a field or property, causes PostSharp to implement tracing when its value changes.
Public class | NotLoggedAttribute | Indicates that the value of this parameter should not be logged.
Public class | ThrowLoggingExceptionHandler |
Structures
 | Structure | Description
Public structure | LogActivityOptions | Options of a new LogActivity.
Interfaces
 | Interface | Description
Public interface | ILogAspect | Base interface for all method-level logging aspects.
Public interface | ILoggingExceptionHandler | Defines methods called in case of exception in the logging component.
Public interface | ILogValueAspect | Base interface for all location-level logging aspects.
Enumerations
 | Enumeration | Description
Public enumeration | LogActivityKind | Kinds of LogActivity.
Public enumeration | LogLevel | Specifies the severity of a logged message.
Public enumeration | LogRecordKind | Kinds of log entry.


CustomRecordLoggingOptions Class

Options for custom logging records. Exposed on the CustomRecordLoggingOptions property.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsCustomRecordLoggingOptions

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class CustomRecordLoggingOptions : INotifyPropertyChanged,
    ILogActivityOptions

The CustomRecordLoggingOptions type exposes the following members.

Properties
 | Name | Description
Public property | ActivityLevel | Gets or sets the LogLevel from which the OpenActivity(String) does something meaningful. Under the specified LogLevel, OpenActivity(String) returns a null LogActivity that does not do anything. Even calls to SetFailure or SetException(Exception) are ignored in this case.
Public property | ExceptionLevel | Gets or sets the LogLevel for failures of custom activities (defined by the SetException(Exception) method).
Public property | FailureLevel | Gets or sets the LogLevel for failures of custom activities (defined by the SetFailure(String) method).
Public property | IncludeSourceLineInfo | Determines whether source line information should be included in the log output.
Top
Events
 | Name | Description
Public event | PropertyChanged | Event raised when a property of the current object has changed.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics Namespace


CustomRecordLoggingOptions Properties

The CustomRecordLoggingOptions type exposes the following members.

Properties
 | Name | Description
Public property | ActivityLevel | Gets or sets the LogLevel from which the OpenActivity(String) does something meaningful. Under the specified LogLevel, OpenActivity(String) returns a null LogActivity that does not do anything. Even calls to SetFailure or SetException(Exception) are ignored in this case.
Public property | ExceptionLevel | Gets or sets the LogLevel for failures of custom activities (defined by the SetException(Exception) method).
Public property | FailureLevel | Gets or sets the LogLevel for failures of custom activities (defined by the SetFailure(String) method).
Public property | IncludeSourceLineInfo | Determines whether source line information should be included in the log output.
Top
See Also

Reference

CustomRecordLoggingOptions Class
PostSharp.Patterns.Diagnostics Namespace


CustomRecordLoggingOptions.ActivityLevel Property

CustomRecordLoggingOptionsActivityLevel Property

Gets or sets the LogLevel from which the OpenActivity(String) does something meaningful. Under the specified LogLevel, OpenActivity(String) returns a null LogActivity that does not do anything. Even calls to SetFailure or SetException(Exception) are ignored in this case.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogLevel ActivityLevel { get; set; }

Property Value

Type: LogLevel

Implements

ILogActivityOptionsActivityLevel
See Also

Reference

CustomRecordLoggingOptions Class
PostSharp.Patterns.Diagnostics Namespace


CustomRecordLoggingOptions.ExceptionLevel Property

CustomRecordLoggingOptionsExceptionLevel Property

Gets or sets the LogLevel for failures of custom activities (defined by the SetException(Exception) method).

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogLevel ExceptionLevel { get; set; }

Property Value

Type: LogLevel

Implements

ILogActivityOptionsExceptionLevel
See Also

Reference

CustomRecordLoggingOptions Class
PostSharp.Patterns.Diagnostics Namespace


CustomRecordLoggingOptions.FailureLevel Property

CustomRecordLoggingOptionsFailureLevel Property

Gets or sets the LogLevel for failures of custom activities (defined by the SetFailure(String) method).

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogLevel FailureLevel { get; set; }

Property Value

Type: LogLevel

Implements

ILogActivityOptionsFailureLevel
See Also

Reference

CustomRecordLoggingOptions Class
PostSharp.Patterns.Diagnostics Namespace


CustomRecordLoggingOptions.IncludeSourceLineInfo Property

CustomRecordLoggingOptionsIncludeSourceLineInfo Property

Determines whether source line information should be included in the log output.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IncludeSourceLineInfo { get; set; }

Property Value

Type: Boolean
See Also

Reference

CustomRecordLoggingOptions Class
PostSharp.Patterns.Diagnostics Namespace


CustomRecordLoggingOptions Events

The CustomRecordLoggingOptions type exposes the following members.

Events
 | Name | Description
Public event | PropertyChanged | Event raised when a property of the current object has changed.
Top
See Also

Reference

CustomRecordLoggingOptions Class
PostSharp.Patterns.Diagnostics Namespace


CustomRecordLoggingOptions.PropertyChanged Event

CustomRecordLoggingOptionsPropertyChanged Event

Event raised when a property of the current object has changed.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public event PropertyChangedEventHandler PropertyChanged

Value

Type: System.ComponentModelPropertyChangedEventHandler

Implements

INotifyPropertyChangedPropertyChanged
See Also

Reference

CustomRecordLoggingOptions Class
PostSharp.Patterns.Diagnostics Namespace


DefaultLoggingExceptionHandler Class

An implementation of the ILoggingExceptionHandler that attempts to log exceptions to the Meta logging role, then disables the backlog in case of internal exception (but not in case of invalid user code). Not to be confused with ILoggerExceptionHandler.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsDefaultLoggingExceptionHandler

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class DefaultLoggingExceptionHandler : ILoggingExceptionHandler

The DefaultLoggingExceptionHandler type exposes the following members.

Constructors
 | Name | Description
Public method | DefaultLoggingExceptionHandler | Initializes a new instance of the DefaultLoggingExceptionHandler class
Top
Methods
 | Name | Description
Public method | OnInternalException | Method invoked when an exception is thrown in logging code.
Public method | OnInvalidUserCode | Method invoked when a logging component detects a precondition violation that probably stem from user-written code.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics Namespace


DefaultLoggingExceptionHandler Constructor

Initializes a new instance of the DefaultLoggingExceptionHandler class

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public DefaultLoggingExceptionHandler()
See Also

Reference

DefaultLoggingExceptionHandler Class
PostSharp.Patterns.Diagnostics Namespace


DefaultLoggingExceptionHandler Methods

The DefaultLoggingExceptionHandler type exposes the following members.

Methods
 | Name | Description
Public method | OnInternalException | Method invoked when an exception is thrown in logging code.
Public method | OnInvalidUserCode | Method invoked when a logging component detects a precondition violation that probably stem from user-written code.
Top
See Also

Reference

DefaultLoggingExceptionHandler Class
PostSharp.Patterns.Diagnostics Namespace


DefaultLoggingExceptionHandler.OnInternalException Method

DefaultLoggingExceptionHandlerOnInternalException Method

Method invoked when an exception is thrown in logging code.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void OnInternalException(
    LoggingExceptionInfo exceptionInfo
)

Parameters

exceptionInfo
Type: PostSharp.Patterns.DiagnosticsLoggingExceptionInfo
Information about the exception.

Implements

ILoggingExceptionHandlerOnInternalException(LoggingExceptionInfo)
See Also

Reference

DefaultLoggingExceptionHandler Class
PostSharp.Patterns.Diagnostics Namespace


DefaultLoggingExceptionHandler.OnInvalidUserCode Method

DefaultLoggingExceptionHandlerOnInvalidUserCode Method

Method invoked when a logging component detects a precondition violation that probably stem from user-written code.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void OnInvalidUserCode(
    ref CallerInfo callerInfo,
    LoggingTypeSource source,
    string message,
    params Object[] args
)

Parameters

callerInfo
Type: PostSharp.Patterns.Diagnostics.ContextsCallerInfo
Location of the code that performed the invalid call, or an empty instance if the information is not available.
source
Type: PostSharp.Patterns.DiagnosticsLoggingTypeSource
Related LoggingTypeSource, or null if it is not available.
message
Type: SystemString
Error message formatting string.
args
Type: SystemObject
Arguments for the formatting string, or null.

Implements

ILoggingExceptionHandlerOnInvalidUserCode(CallerInfo, LoggingTypeSource, String, Object)
See Also

Reference

DefaultLoggingExceptionHandler Class
PostSharp.Patterns.Diagnostics Namespace


ILogAspect Interface

Base interface for all method-level logging aspects.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ILogAspect : IAspect

The ILogAspect type exposes the following members.

Properties
 | Name | Description
Public property | ProfileName | Gets the name of the logging profile.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics Namespace


ILogAspect Properties

The ILogAspect type exposes the following members.

Properties
 | Name | Description
Public property | ProfileName | Gets the name of the logging profile.
Top
See Also

Reference

ILogAspect Interface
PostSharp.Patterns.Diagnostics Namespace


ILogAspect.ProfileName Property

ILogAspectProfileName Property

Gets the name of the logging profile.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
string ProfileName { get; }

Property Value

Type: String
See Also

Reference

ILogAspect Interface
PostSharp.Patterns.Diagnostics Namespace


ILoggingExceptionHandler Interface

Defines methods called in case of exception in the logging component.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ILoggingExceptionHandler

The ILoggingExceptionHandler type exposes the following members.

Methods
 | Name | Description
Public method | OnInternalException | Method invoked when an exception is thrown in logging code.
Public method | OnInvalidUserCode | Method invoked when a logging component detects a precondition violation that probably stem from user-written code.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Handling Faults in the Logging Component


ILoggingExceptionHandler Methods

The ILoggingExceptionHandler type exposes the following members.

Methods
 | Name | Description
Public method | OnInternalException | Method invoked when an exception is thrown in logging code.
Public method | OnInvalidUserCode | Method invoked when a logging component detects a precondition violation that probably stem from user-written code.
Top
See Also

Reference

ILoggingExceptionHandler Interface
PostSharp.Patterns.Diagnostics Namespace


ILoggingExceptionHandler.OnInternalException Method

ILoggingExceptionHandlerOnInternalException Method

Method invoked when an exception is thrown in logging code.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void OnInternalException(
    LoggingExceptionInfo exceptionInfo
)

Parameters

exceptionInfo
Type: PostSharp.Patterns.DiagnosticsLoggingExceptionInfo
Information about the exception.
See Also

Reference

ILoggingExceptionHandler Interface
PostSharp.Patterns.Diagnostics Namespace


ILoggingExceptionHandler.OnInvalidUserCode Method

ILoggingExceptionHandlerOnInvalidUserCode Method

Method invoked when a logging component detects a precondition violation that probably stem from user-written code.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void OnInvalidUserCode(
    ref CallerInfo callerInfo,
    LoggingTypeSource source,
    string message,
    params Object[] args
)

Parameters

callerInfo
Type: PostSharp.Patterns.Diagnostics.ContextsCallerInfo
Location of the code that performed the invalid call, or an empty instance if the information is not available.
source
Type: PostSharp.Patterns.DiagnosticsLoggingTypeSource
Related LoggingTypeSource, or null if it is not available.
message
Type: SystemString
Error message formatting string.
args
Type: SystemObject
Arguments for the formatting string, or null.
See Also

Reference

ILoggingExceptionHandler Interface
PostSharp.Patterns.Diagnostics Namespace


ILogValueAspect Interface

Base interface for all location-level logging aspects.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ILogValueAspect : IAspect

The ILogValueAspect type exposes the following members.

Properties
 | Name | Description
Public property | ProfileName | Gets the name of the logging profile.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics Namespace


ILogValueAspect Properties

The ILogValueAspect type exposes the following members.

Properties
 | Name | Description
Public property | ProfileName | Gets the name of the logging profile.
Top
See Also

Reference

ILogValueAspect Interface
PostSharp.Patterns.Diagnostics Namespace


ILogValueAspect.ProfileName Property

ILogValueAspectProfileName Property

Gets the name of the logging profile.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
string ProfileName { get; }

Property Value

Type: String
See Also

Reference

ILogValueAspect Interface
PostSharp.Patterns.Diagnostics Namespace


LogActivity Class

Represents a logged custom activity, i.e. something that a beginning and an end with a specific outcome.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLogger
PostSharp.Patterns.DiagnosticsLogActivity

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class LogActivity : Logger,
    IDisposable

The LogActivity type exposes the following members.

Constructors
 | Name | Description
Public method | LogActivity | Initializes a new LogActivity.
Top
Properties
 | Name | Description
Public property | Context |
Public property | IsOpenActivityEnabled | Determines whether the current logging verbosity results in the OpenActivity(String) method to open a new activity and log the start, success or failure of the activity. When this property evaluates to false, calls to the OpenActivity(String) method, as well as all calls to the methods of the returned LogActivity, are basically ignored, even SetFailure and SetException(Exception). (Inherited from Logger.)
Public property | IsValid | Determines whether the current LogActivity is valid, i.e. calls to methods SetFailure or SetException(Exception) will do something, or will be totally ignored.
Top
Methods
 | Name | Description
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Protected method | Dispose(Boolean) | Disposes the current LogActivity.
Public method | IsEnabled | Determines whether logging is enabled in the current Logger for a given LogLevel. (Inherited from Logger.)
Public method | OpenActivity(String) | Opens a custom activity with an optional description, but without parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivity(String, Object) | Opens a custom activity with an array of parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivity(LogActivityOptions, String) | Opens a custom activity with an optional description, but without parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivity(LogActivityOptions, String, Object) | Opens a custom activity with an array of parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1(String, T1) | Opens a custom activity with a description containing 1 parameter. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1(LogActivityOptions, String, T1) | Opens a custom activity with a description containing 1 parameter. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) | Opens a custom activity with a description containing 10 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) | Opens a custom activity with a description containing 10 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1, T2(String, T1, T2) | Opens a custom activity with a description containing 2 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1, T2(LogActivityOptions, String, T1, T2) | Opens a custom activity with a description containing 2 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1, T2, T3(String, T1, T2, T3) | Opens a custom activity with a description containing 3 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1, T2, T3(LogActivityOptions, String, T1, T2, T3) | Opens a custom activity with a description containing 3 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1, T2, T3, T4(String, T1, T2, T3, T4) | Opens a custom activity with a description containing 4 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1, T2, T3, T4(LogActivityOptions, String, T1, T2, T3, T4) | Opens a custom activity with a description containing 4 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1, T2, T3, T4, T5(String, T1, T2, T3, T4, T5) | Opens a custom activity with a description containing 5 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1, T2, T3, T4, T5(LogActivityOptions, String, T1, T2, T3, T4, T5) | Opens a custom activity with a description containing 5 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1, T2, T3, T4, T5, T6(String, T1, T2, T3, T4, T5, T6) | Opens a custom activity with a description containing 6 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1, T2, T3, T4, T5, T6(LogActivityOptions, String, T1, T2, T3, T4, T5, T6) | Opens a custom activity with a description containing 6 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7(String, T1, T2, T3, T4, T5, T6, T7) | Opens a custom activity with a description containing 7 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7) | Opens a custom activity with a description containing 7 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7, T8(String, T1, T2, T3, T4, T5, T6, T7, T8) | Opens a custom activity with a description containing 8 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7, T8(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8) | Opens a custom activity with a description containing 8 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7, T8, T9(String, T1, T2, T3, T4, T5, T6, T7, T8, T9) | Opens a custom activity with a description containing 9 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7, T8, T9(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, T9) | Opens a custom activity with a description containing 9 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenAsyncActivity(String) | Opens an asynchronous custom activity with an optional description, but without parameters. (Inherited from Logger.)
Public method | OpenAsyncActivity(String, Object) | Opens an asynchronous custom activity with an optional description and an array of parameters. (Inherited from Logger.)
Public method | OpenAsyncActivity(LogActivityOptions, String) | Opens an asynchronous custom activity with an optional description, but without parameters. (Inherited from Logger.)
Public method | OpenAsyncActivity(LogActivityOptions, String, Object) | Opens an asynchronous custom activity with an optional description and an array of parameters. (Inherited from Logger.)
Public method | OpenAsyncActivityT1(String, T1) | Opens an asynchronous custom activity with a description containing 1 parameter. (Inherited from Logger.)
Public method | OpenAsyncActivityT1(LogActivityOptions, String, T1) | Opens an asynchronous custom activity with a description containing 1 parameter. (Inherited from Logger.)
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) | Opens an asynchronous custom activity with a description containing 10 parameters. (Inherited from Logger.)
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) | Opens an asynchronous custom activity with a description containing 10 parameters. (Inherited from Logger.)
Public method | OpenAsyncActivityT1, T2(String, T1, T2) | Opens an asynchronous custom activity with a description containing 2 parameters. (Inherited from Logger.)
Public method | OpenAsyncActivityT1, T2(LogActivityOptions, String, T1, T2) | Opens an asynchronous custom activity with a description containing 2 parameters. (Inherited from Logger.)
Public method | OpenAsyncActivityT1, T2, T3(String, T1, T2, T3) | Opens an asynchronous custom activity with a description containing 3 parameters. (Inherited from Logger.)
Public method | OpenAsyncActivityT1, T2, T3(LogActivityOptions, String, T1, T2, T3) | Opens an asynchronous custom activity with a description containing 3 parameters. (Inherited from Logger.)
Public method | OpenAsyncActivityT1, T2, T3, T4(String, T1, T2, T3, T4) | Opens an asynchronous custom activity with a description containing 4 parameters. (Inherited from Logger.)
Public method | OpenAsyncActivityT1, T2, T3, T4(LogActivityOptions, String, T1, T2, T3, T4) | Opens an asynchronous custom activity with a description containing 4 parameters. (Inherited from Logger.)
Public method | OpenAsyncActivityT1, T2, T3, T4, T5(String, T1, T2, T3, T4, T5) | Opens an asynchronous custom activity with a description containing 5 parameters. (Inherited from Logger.)
Public method | OpenAsyncActivityT1, T2, T3, T4, T5(LogActivityOptions, String, T1, T2, T3, T4, T5) | Opens an asynchronous custom activity with a description containing 5 parameters. (Inherited from Logger.)
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6(String, T1, T2, T3, T4, T5, T6) | Opens an asynchronous custom activity with a description containing 6 parameters. (Inherited from Logger.)
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6(LogActivityOptions, String, T1, T2, T3, T4, T5, T6) | Opens an asynchronous custom activity with a description containing 6 parameters. (Inherited from Logger.)
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7(String, T1, T2, T3, T4, T5, T6, T7) | Opens an asynchronous custom activity with a description containing 7 parameters. (Inherited from Logger.)
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7) | Opens an asynchronous custom activity with a description containing 7 parameters. (Inherited from Logger.)
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7, T8(String, T1, T2, T3, T4, T5, T6, T7, T8) | Opens an asynchronous custom activity with a description containing 8 parameters. (Inherited from Logger.)
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7, T8(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8) | Opens an asynchronous custom activity with a description containing 8 parameters. (Inherited from Logger.)
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7, T8, T9(String, T1, T2, T3, T4, T5, T6, T7, T8, T9) | Opens an asynchronous custom activity with a description containing 9 parameters. (Inherited from Logger.)
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7, T8, T9(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, T9) | Opens an asynchronous custom activity with a description containing 9 parameters. (Inherited from Logger.)
Public method | Resume | Resumes the current async activity after it has been suspended by a call to Suspend. There is typically no need to invoke this method in user code because all async methods that use the Logger class are automatically instrumented.
Public method | SetException | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with a given Exception.
Public method | SetFailure | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure with the default failure message.
Public method | SetFailure(String) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a parameterless failure message.
Public method | SetFailure(String, Object) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with an array of parameters.
Public method | SetFailureT1(String, T1) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 1 parameter.
Public method | SetFailureT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 10 parameters.
Public method | SetFailureT1, T2(String, T1, T2) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 2 parameters.
Public method | SetFailureT1, T2, T3(String, T1, T2, T3) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 3 parameters.
Public method | SetFailureT1, T2, T3, T4(String, T1, T2, T3, T4) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 4 parameters.
Public method | SetFailureT1, T2, T3, T4, T5(String, T1, T2, T3, T4, T5) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 5 parameters.
Public method | SetFailureT1, T2, T3, T4, T5, T6(String, T1, T2, T3, T4, T5, T6) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 6 parameters.
Public method | SetFailureT1, T2, T3, T4, T5, T6, T7(String, T1, T2, T3, T4, T5, T6, T7) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 7 parameters.
Public method | SetFailureT1, T2, T3, T4, T5, T6, T7, T8(String, T1, T2, T3, T4, T5, T6, T7, T8) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 8 parameters.
Public method | SetFailureT1, T2, T3, T4, T5, T6, T7, T8, T9(String, T1, T2, T3, T4, T5, T6, T7, T8, T9) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 9 parameters.
Public method | SetSuccess | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success with the default success message.
Public method | SetSuccess(String) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a parameterless success message.
Public method | SetSuccess(String, Object) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with an array of parameters.
Public method | SetSuccessT1(String, T1) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 1 parameter.
Public method | SetSuccessT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 10 parameters.
Public method | SetSuccessT1, T2(String, T1, T2) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 2 parameters.
Public method | SetSuccessT1, T2, T3(String, T1, T2, T3) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 3 parameters.
Public method | SetSuccessT1, T2, T3, T4(String, T1, T2, T3, T4) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 4 parameters.
Public method | SetSuccessT1, T2, T3, T4, T5(String, T1, T2, T3, T4, T5) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 5 parameters.
Public method | SetSuccessT1, T2, T3, T4, T5, T6(String, T1, T2, T3, T4, T5, T6) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 6 parameters.
Public method | SetSuccessT1, T2, T3, T4, T5, T6, T7(String, T1, T2, T3, T4, T5, T6, T7) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 7 parameters.
Public method | SetSuccessT1, T2, T3, T4, T5, T6, T7, T8(String, T1, T2, T3, T4, T5, T6, T7, T8) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 8 parameters.
Public method | SetSuccessT1, T2, T3, T4, T5, T6, T7, T8, T9(String, T1, T2, T3, T4, T5, T6, T7, T8, T9) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 9 parameters.
Public method | Suspend | Suspends the current async activity. The activity must than be resumed by a call of the Resume method. There is typically no need to invoke this method in user code because all async methods that use the Logger class are automatically instrumented.
Public method | Write(LogLevel, String) | Writes a custom log record without parameters. (Inherited from Logger.)
Public method | Write(LogLevel, String, Object) | Writes a custom log record with an array of parameters. (Inherited from Logger.)
Public method | WriteT1(LogLevel, String, T1) | Writes a custom log record with 1 parameter. (Inherited from Logger.)
Public method | WriteT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(LogLevel, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) | Writes a custom log record with 10 parameters. (Inherited from Logger.)
Public method | WriteT1, T2(LogLevel, String, T1, T2) | Writes a custom log record with 2 parameters. (Inherited from Logger.)
Public method | WriteT1, T2, T3(LogLevel, String, T1, T2, T3) | Writes a custom log record with 3 parameters. (Inherited from Logger.)
Public method | WriteT1, T2, T3, T4(LogLevel, String, T1, T2, T3, T4) | Writes a custom log record with 4 parameters. (Inherited from Logger.)
Public method | WriteT1, T2, T3, T4, T5(LogLevel, String, T1, T2, T3, T4, T5) | Writes a custom log record with 5 parameters. (Inherited from Logger.)
Public method | WriteT1, T2, T3, T4, T5, T6(LogLevel, String, T1, T2, T3, T4, T5, T6) | Writes a custom log record with 6 parameters. (Inherited from Logger.)
Public method | WriteT1, T2, T3, T4, T5, T6, T7(LogLevel, String, T1, T2, T3, T4, T5, T6, T7) | Writes a custom log record with 7 parameters. (Inherited from Logger.)
Public method | WriteT1, T2, T3, T4, T5, T6, T7, T8(LogLevel, String, T1, T2, T3, T4, T5, T6, T7, T8) | Writes a custom log record with 8 parameters. (Inherited from Logger.)
Public method | WriteT1, T2, T3, T4, T5, T6, T7, T8, T9(LogLevel, String, T1, T2, T3, T4, T5, T6, T7, T8, T9) | Writes a custom log record with 9 parameters. (Inherited from Logger.)
Public method | WriteException(LogLevel, Exception, String) | Writes a custom record without parameters and associates it with an Exception. (Inherited from Logger.)
Public method | WriteException(LogLevel, Exception, String, Object) | Writes a custom record with an array of parameters and associates it with an Exception. (Inherited from Logger.)
Public method | WriteExceptionT1(LogLevel, Exception, String, T1) | Writes a custom log record with 1 parameter and associates it with an Exception. (Inherited from Logger.)
Public method | WriteExceptionT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(LogLevel, Exception, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) | Writes a custom log record with 10 parameters and associates it with an Exception. (Inherited from Logger.)
Public method | WriteExceptionT1, T2(LogLevel, Exception, String, T1, T2) | Writes a custom log record with 2 parameters and associates it with an Exception. (Inherited from Logger.)
Public method | WriteExceptionT1, T2, T3(LogLevel, Exception, String, T1, T2, T3) | Writes a custom log record with 3 parameters and associates it with an Exception. (Inherited from Logger.)
Public method | WriteExceptionT1, T2, T3, T4(LogLevel, Exception, String, T1, T2, T3, T4) | Writes a custom log record with 4 parameters and associates it with an Exception. (Inherited from Logger.)
Public method | WriteExceptionT1, T2, T3, T4, T5(LogLevel, Exception, String, T1, T2, T3, T4, T5) | Writes a custom log record with 5 parameters and associates it with an Exception. (Inherited from Logger.)
Public method | WriteExceptionT1, T2, T3, T4, T5, T6(LogLevel, Exception, String, T1, T2, T3, T4, T5, T6) | Writes a custom log record with 6 parameters and associates it with an Exception. (Inherited from Logger.)
Public method | WriteExceptionT1, T2, T3, T4, T5, T6, T7(LogLevel, Exception, String, T1, T2, T3, T4, T5, T6, T7) | Writes a custom log record with 7 parameters and associates it with an Exception. (Inherited from Logger.)
Public method | WriteExceptionT1, T2, T3, T4, T5, T6, T7, T8(LogLevel, Exception, String, T1, T2, T3, T4, T5, T6, T7, T8) | Writes a custom log record with 8 parameters and associates it with an Exception. (Inherited from Logger.)
Public method | WriteExceptionT1, T2, T3, T4, T5, T6, T7, T8, T9(LogLevel, Exception, String, T1, T2, T3, T4, T5, T6, T7, T8, T9) | Writes a custom log record with 9 parameters and associates it with an Exception. (Inherited from Logger.)
Public method | WriteExecutionPoint | Emits a log record with the source file and line of the caller. (Inherited from Logger.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Adding Custom Log Records Manually


LogActivity Constructor

Initializes a new LogActivity.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity(
    ILogger logger,
    ILoggingContext context
)

Parameters

logger
Type: PostSharp.Patterns.Diagnostics.CustomILogger
The underlying ILogger.
context
Type: PostSharp.Patterns.Diagnostics.ContextsILoggingContext
The ILoggingContext implementing the new LogActivity.
See Also

Reference

LogActivity Class
PostSharp.Patterns.Diagnostics Namespace


LogActivity Properties

The LogActivity type exposes the following members.

Properties
 | Name | Description
Public property | Context |
Public property | IsOpenActivityEnabled | Determines whether the current logging verbosity results in the OpenActivity(String) method to open a new activity and log the start, success or failure of the activity. When this property evaluates to false, calls to the OpenActivity(String) method, as well as all calls to the methods of the returned LogActivity, are basically ignored, even SetFailure and SetException(Exception). (Inherited from Logger.)
Public property | IsValid | Determines whether the current LogActivity is valid, i.e. calls to methods SetFailure or SetException(Exception) will do something, or will be totally ignored.
Top
See Also

Reference

LogActivity Class
PostSharp.Patterns.Diagnostics Namespace


LogActivity.Context Property

LogActivityContext Property

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ILoggingContext Context { get; }

Property Value

Type: ILoggingContext
See Also

Reference

LogActivity Class
PostSharp.Patterns.Diagnostics Namespace


LogActivity.IsValid Property

LogActivityIsValid Property

Determines whether the current LogActivity is valid, i.e. calls to methods SetFailure or SetException(Exception) will do something, or will be totally ignored.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsValid { get; }

Property Value

Type: Boolean
See Also

Reference

LogActivity Class
PostSharp.Patterns.Diagnostics Namespace


LogActivity Methods

The LogActivity type exposes the following members.

Methods
 | Name | Description
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Protected method | Dispose(Boolean) | Disposes the current LogActivity.
Public method | IsEnabled | Determines whether logging is enabled in the current Logger for a given LogLevel. (Inherited from Logger.)
Public method | OpenActivity(String) | Opens a custom activity with an optional description, but without parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivity(String, Object) | Opens a custom activity with an array of parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivity(LogActivityOptions, String) | Opens a custom activity with an optional description, but without parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivity(LogActivityOptions, String, Object) | Opens a custom activity with an array of parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1(String, T1) | Opens a custom activity with a description containing 1 parameter. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1(LogActivityOptions, String, T1) | Opens a custom activity with a description containing 1 parameter. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) | Opens a custom activity with a description containing 10 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) | Opens a custom activity with a description containing 10 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1, T2(String, T1, T2) | Opens a custom activity with a description containing 2 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1, T2(LogActivityOptions, String, T1, T2) | Opens a custom activity with a description containing 2 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1, T2, T3(String, T1, T2, T3) | Opens a custom activity with a description containing 3 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1, T2, T3(LogActivityOptions, String, T1, T2, T3) | Opens a custom activity with a description containing 3 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1, T2, T3, T4(String, T1, T2, T3, T4) | Opens a custom activity with a description containing 4 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1, T2, T3, T4(LogActivityOptions, String, T1, T2, T3, T4) | Opens a custom activity with a description containing 4 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1, T2, T3, T4, T5(String, T1, T2, T3, T4, T5) | Opens a custom activity with a description containing 5 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1, T2, T3, T4, T5(LogActivityOptions, String, T1, T2, T3, T4, T5) | Opens a custom activity with a description containing 5 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1, T2, T3, T4, T5, T6(String, T1, T2, T3, T4, T5, T6) | Opens a custom activity with a description containing 6 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1, T2, T3, T4, T5, T6(LogActivityOptions, String, T1, T2, T3, T4, T5, T6) | Opens a custom activity with a description containing 6 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7(String, T1, T2, T3, T4, T5, T6, T7) | Opens a custom activity with a description containing 7 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7) | Opens a custom activity with a description containing 7 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7, T8(String, T1, T2, T3, T4, T5, T6, T7, T8) | Opens a custom activity with a description containing 8 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7, T8(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8) | Opens a custom activity with a description containing 8 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7, T8, T9(String, T1, T2, T3, T4, T5, T6, T7, T8, T9) | Opens a custom activity with a description containing 9 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7, T8, T9(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, T9) | Opens a custom activity with a description containing 9 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator. (Inherited from Logger.)
Public method | OpenAsyncActivity(String) | Opens an asynchronous custom activity with an optional description, but without parameters. (Inherited from Logger.)
Public method | OpenAsyncActivity(String, Object) | Opens an asynchronous custom activity with an optional description and an array of parameters. (Inherited from Logger.)
Public method | OpenAsyncActivity(LogActivityOptions, String) | Opens an asynchronous custom activity with an optional description, but without parameters. (Inherited from Logger.)
Public method | OpenAsyncActivity(LogActivityOptions, String, Object) | Opens an asynchronous custom activity with an optional description and an array of parameters. (Inherited from Logger.)
Public method | OpenAsyncActivityT1(String, T1) | Opens an asynchronous custom activity with a description containing 1 parameter. (Inherited from Logger.)
Public method | OpenAsyncActivityT1(LogActivityOptions, String, T1) | Opens an asynchronous custom activity with a description containing 1 parameter. (Inherited from Logger.)
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) | Opens an asynchronous custom activity with a description containing 10 parameters. (Inherited from Logger.)
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) | Opens an asynchronous custom activity with a description containing 10 parameters. (Inherited from Logger.)
Public method | OpenAsyncActivityT1, T2(String, T1, T2) | Opens an asynchronous custom activity with a description containing 2 parameters. (Inherited from Logger.)
Public method | OpenAsyncActivityT1, T2(LogActivityOptions, String, T1, T2) | Opens an asynchronous custom activity with a description containing 2 parameters. (Inherited from Logger.)
Public method | OpenAsyncActivityT1, T2, T3(String, T1, T2, T3) | Opens an asynchronous custom activity with a description containing 3 parameters. (Inherited from Logger.)
Public method | OpenAsyncActivityT1, T2, T3(LogActivityOptions, String, T1, T2, T3) | Opens an asynchronous custom activity with a description containing 3 parameters. (Inherited from Logger.)
Public method | OpenAsyncActivityT1, T2, T3, T4(String, T1, T2, T3, T4) | Opens an asynchronous custom activity with a description containing 4 parameters. (Inherited from Logger.)
Public method | OpenAsyncActivityT1, T2, T3, T4(LogActivityOptions, String, T1, T2, T3, T4) | Opens an asynchronous custom activity with a description containing 4 parameters. (Inherited from Logger.)
Public method | OpenAsyncActivityT1, T2, T3, T4, T5(String, T1, T2, T3, T4, T5) | Opens an asynchronous custom activity with a description containing 5 parameters. (Inherited from Logger.)
Public method | OpenAsyncActivityT1, T2, T3, T4, T5(LogActivityOptions, String, T1, T2, T3, T4, T5) | Opens an asynchronous custom activity with a description containing 5 parameters. (Inherited from Logger.)
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6(String, T1, T2, T3, T4, T5, T6) | Opens an asynchronous custom activity with a description containing 6 parameters. (Inherited from Logger.)
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6(LogActivityOptions, String, T1, T2, T3, T4, T5, T6) | Opens an asynchronous custom activity with a description containing 6 parameters. (Inherited from Logger.)
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7(String, T1, T2, T3, T4, T5, T6, T7) | Opens an asynchronous custom activity with a description containing 7 parameters. (Inherited from Logger.)
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7) | Opens an asynchronous custom activity with a description containing 7 parameters. (Inherited from Logger.)
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7, T8(String, T1, T2, T3, T4, T5, T6, T7, T8) | Opens an asynchronous custom activity with a description containing 8 parameters. (Inherited from Logger.)
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7, T8(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8) | Opens an asynchronous custom activity with a description containing 8 parameters. (Inherited from Logger.)
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7, T8, T9(String, T1, T2, T3, T4, T5, T6, T7, T8, T9) | Opens an asynchronous custom activity with a description containing 9 parameters. (Inherited from Logger.)
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7, T8, T9(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, T9) | Opens an asynchronous custom activity with a description containing 9 parameters. (Inherited from Logger.)
Public method | Resume | Resumes the current async activity after it has been suspended by a call to Suspend. There is typically no need to invoke this method in user code because all async methods that use the Logger class are automatically instrumented.
Public method | SetException | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with a given Exception.
Public method | SetFailure | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure with the default failure message.
Public method | SetFailure(String) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a parameterless failure message.
Public method | SetFailure(String, Object) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with an array of parameters.
Public method | SetFailureT1(String, T1) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 1 parameter.
Public method | SetFailureT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 10 parameters.
Public method | SetFailureT1, T2(String, T1, T2) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 2 parameters.
Public method | SetFailureT1, T2, T3(String, T1, T2, T3) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 3 parameters.
Public method | SetFailureT1, T2, T3, T4(String, T1, T2, T3, T4) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 4 parameters.
Public method | SetFailureT1, T2, T3, T4, T5(String, T1, T2, T3, T4, T5) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 5 parameters.
Public method | SetFailureT1, T2, T3, T4, T5, T6(String, T1, T2, T3, T4, T5, T6) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 6 parameters.
Public method | SetFailureT1, T2, T3, T4, T5, T6, T7(String, T1, T2, T3, T4, T5, T6, T7) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 7 parameters.
Public method | SetFailureT1, T2, T3, T4, T5, T6, T7, T8(String, T1, T2, T3, T4, T5, T6, T7, T8) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 8 parameters.
Public method | SetFailureT1, T2, T3, T4, T5, T6, T7, T8, T9(String, T1, T2, T3, T4, T5, T6, T7, T8, T9) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 9 parameters.
Public method | SetSuccess | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success with the default success message.
Public method | SetSuccess(String) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a parameterless success message.
Public method | SetSuccess(String, Object) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with an array of parameters.
Public method | SetSuccessT1(String, T1) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 1 parameter.
Public method | SetSuccessT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 10 parameters.
Public method | SetSuccessT1, T2(String, T1, T2) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 2 parameters.
Public method | SetSuccessT1, T2, T3(String, T1, T2, T3) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 3 parameters.
Public method | SetSuccessT1, T2, T3, T4(String, T1, T2, T3, T4) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 4 parameters.
Public method | SetSuccessT1, T2, T3, T4, T5(String, T1, T2, T3, T4, T5) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 5 parameters.
Public method | SetSuccessT1, T2, T3, T4, T5, T6(String, T1, T2, T3, T4, T5, T6) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 6 parameters.
Public method | SetSuccessT1, T2, T3, T4, T5, T6, T7(String, T1, T2, T3, T4, T5, T6, T7) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 7 parameters.
Public method | SetSuccessT1, T2, T3, T4, T5, T6, T7, T8(String, T1, T2, T3, T4, T5, T6, T7, T8) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 8 parameters.
Public method | SetSuccessT1, T2, T3, T4, T5, T6, T7, T8, T9(String, T1, T2, T3, T4, T5, T6, T7, T8, T9) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 9 parameters.
Public method | Suspend | Suspends the current async activity. The activity must than be resumed by a call of the Resume method. There is typically no need to invoke this method in user code because all async methods that use the Logger class are automatically instrumented.
Public method | Write(LogLevel, String) | Writes a custom log record without parameters. (Inherited from Logger.)
Public method | Write(LogLevel, String, Object) | Writes a custom log record with an array of parameters. (Inherited from Logger.)
Public method | WriteT1(LogLevel, String, T1) | Writes a custom log record with 1 parameter. (Inherited from Logger.)
Public method | WriteT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(LogLevel, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) | Writes a custom log record with 10 parameters. (Inherited from Logger.)
Public method | WriteT1, T2(LogLevel, String, T1, T2) | Writes a custom log record with 2 parameters. (Inherited from Logger.)
Public method | WriteT1, T2, T3(LogLevel, String, T1, T2, T3) | Writes a custom log record with 3 parameters. (Inherited from Logger.)
Public method | WriteT1, T2, T3, T4(LogLevel, String, T1, T2, T3, T4) | Writes a custom log record with 4 parameters. (Inherited from Logger.)
Public method | WriteT1, T2, T3, T4, T5(LogLevel, String, T1, T2, T3, T4, T5) | Writes a custom log record with 5 parameters. (Inherited from Logger.)
Public method | WriteT1, T2, T3, T4, T5, T6(LogLevel, String, T1, T2, T3, T4, T5, T6) | Writes a custom log record with 6 parameters. (Inherited from Logger.)
Public method | WriteT1, T2, T3, T4, T5, T6, T7(LogLevel, String, T1, T2, T3, T4, T5, T6, T7) | Writes a custom log record with 7 parameters. (Inherited from Logger.)
Public method | WriteT1, T2, T3, T4, T5, T6, T7, T8(LogLevel, String, T1, T2, T3, T4, T5, T6, T7, T8) | Writes a custom log record with 8 parameters. (Inherited from Logger.)
Public method | WriteT1, T2, T3, T4, T5, T6, T7, T8, T9(LogLevel, String, T1, T2, T3, T4, T5, T6, T7, T8, T9) | Writes a custom log record with 9 parameters. (Inherited from Logger.)
Public method | WriteException(LogLevel, Exception, String) | Writes a custom record without parameters and associates it with an Exception. (Inherited from Logger.)
Public method | WriteException(LogLevel, Exception, String, Object) | Writes a custom record with an array of parameters and associates it with an Exception. (Inherited from Logger.)
Public method | WriteExceptionT1(LogLevel, Exception, String, T1) | Writes a custom log record with 1 parameter and associates it with an Exception. (Inherited from Logger.)
Public method | WriteExceptionT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(LogLevel, Exception, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) | Writes a custom log record with 10 parameters and associates it with an Exception. (Inherited from Logger.)
Public method | WriteExceptionT1, T2(LogLevel, Exception, String, T1, T2) | Writes a custom log record with 2 parameters and associates it with an Exception. (Inherited from Logger.)
Public method | WriteExceptionT1, T2, T3(LogLevel, Exception, String, T1, T2, T3) | Writes a custom log record with 3 parameters and associates it with an Exception. (Inherited from Logger.)
Public method | WriteExceptionT1, T2, T3, T4(LogLevel, Exception, String, T1, T2, T3, T4) | Writes a custom log record with 4 parameters and associates it with an Exception. (Inherited from Logger.)
Public method | WriteExceptionT1, T2, T3, T4, T5(LogLevel, Exception, String, T1, T2, T3, T4, T5) | Writes a custom log record with 5 parameters and associates it with an Exception. (Inherited from Logger.)
Public method | WriteExceptionT1, T2, T3, T4, T5, T6(LogLevel, Exception, String, T1, T2, T3, T4, T5, T6) | Writes a custom log record with 6 parameters and associates it with an Exception. (Inherited from Logger.)
Public method | WriteExceptionT1, T2, T3, T4, T5, T6, T7(LogLevel, Exception, String, T1, T2, T3, T4, T5, T6, T7) | Writes a custom log record with 7 parameters and associates it with an Exception. (Inherited from Logger.)
Public method | WriteExceptionT1, T2, T3, T4, T5, T6, T7, T8(LogLevel, Exception, String, T1, T2, T3, T4, T5, T6, T7, T8) | Writes a custom log record with 8 parameters and associates it with an Exception. (Inherited from Logger.)
Public method | WriteExceptionT1, T2, T3, T4, T5, T6, T7, T8, T9(LogLevel, Exception, String, T1, T2, T3, T4, T5, T6, T7, T8, T9) | Writes a custom log record with 9 parameters and associates it with an Exception. (Inherited from Logger.)
Public method | WriteExecutionPoint | Emits a log record with the source file and line of the caller. (Inherited from Logger.)
Top
See Also

Reference

LogActivity Class
PostSharp.Patterns.Diagnostics Namespace


LogActivity.Dispose Method

LogActivityDispose Method

Overload List
 | Name | Description
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Protected method | Dispose(Boolean) | Disposes the current LogActivity.
Top
See Also

Reference

LogActivity Class
PostSharp.Patterns.Diagnostics Namespace


LogActivity.Dispose Method

LogActivityDispose Method

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Dispose()

Implements

IDisposableDispose
See Also

Reference

LogActivity Class
Dispose Overload
PostSharp.Patterns.Diagnostics Namespace


LogActivity.Dispose Method (Boolean)

LogActivityDispose Method (Boolean)

Disposes the current LogActivity.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void Dispose(
    bool disposing
)

Parameters

disposing
Type: SystemBoolean
true if the method is called because of a call to the Dispose public method, false if it is called by the object finalizer.
See Also

Reference

LogActivity Class
Dispose Overload
PostSharp.Patterns.Diagnostics Namespace


LogActivity.Resume Method

LogActivityResume Method

Resumes the current async activity after it has been suspended by a call to Suspend. There is typically no need to invoke this method in user code because all async methods that use the Logger class are automatically instrumented.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Resume()
See Also

Reference

LogActivity Class
PostSharp.Patterns.Diagnostics Namespace


LogActivity.SetException Method

LogActivitySetException Method

Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with a given Exception.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool SetException(
    Exception exception
)

Parameters

exception
Type: SystemException
The exception.

Return Value

Type: Boolean
Always false.
See Also

Reference

LogActivity Class
PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Adding Custom Log Records Manually


LogActivity.SetFailure Method

LogActivitySetFailure Method

Overload List
 | Name | Description
Public method | SetFailure | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure with the default failure message.
Public method | SetFailure(String) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a parameterless failure message.
Public method | SetFailure(String, Object) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with an array of parameters.
Public method | SetFailureT1(String, T1) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 1 parameter.
Public method | SetFailureT1, T2(String, T1, T2) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 2 parameters.
Public method | SetFailureT1, T2, T3(String, T1, T2, T3) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 3 parameters.
Public method | SetFailureT1, T2, T3, T4(String, T1, T2, T3, T4) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 4 parameters.
Public method | SetFailureT1, T2, T3, T4, T5(String, T1, T2, T3, T4, T5) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 5 parameters.
Public method | SetFailureT1, T2, T3, T4, T5, T6(String, T1, T2, T3, T4, T5, T6) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 6 parameters.
Public method | SetFailureT1, T2, T3, T4, T5, T6, T7(String, T1, T2, T3, T4, T5, T6, T7) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 7 parameters.
Public method | SetFailureT1, T2, T3, T4, T5, T6, T7, T8(String, T1, T2, T3, T4, T5, T6, T7, T8) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 8 parameters.
Public method | SetFailureT1, T2, T3, T4, T5, T6, T7, T8, T9(String, T1, T2, T3, T4, T5, T6, T7, T8, T9) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 9 parameters.
Public method | SetFailureT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 10 parameters.
Top
See Also

Reference

LogActivity Class
PostSharp.Patterns.Diagnostics Namespace


LogActivity.SetFailure Method

LogActivitySetFailure Method

Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure with the default failure message.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void SetFailure()
See Also

Reference

LogActivity Class
SetFailure Overload
PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Adding Custom Log Records Manually


LogActivity.SetFailure Method (String)

LogActivitySetFailure Method (String)

Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a parameterless failure message.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void SetFailure(
    string text
)

Parameters

text
Type: SystemString
The failure message.
See Also

Reference

LogActivity Class
SetFailure Overload
PostSharp.Patterns.Diagnostics Namespace


LogActivity.SetFailure Method (String, Object[])

LogActivitySetFailure Method (String, Object)

Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with an array of parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void SetFailure(
    string text,
    params Object[] args
)

Parameters

text
Type: SystemString
The failure message with parameters, for instance Invalid file at line {Line}.
args
Type: SystemObject
An array of parameters.
See Also

Reference

LogActivity Class
SetFailure Overload
PostSharp.Patterns.Diagnostics Namespace


LogActivity.SetFailure(T1) Method (String, T1)

LogActivitySetFailureT1 Method (String, T1)

Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 1 parameter.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void SetFailure<T1>(
    string text,
    T1 arg1
)

Parameters

text
Type: SystemString
The failure message with parameters, for instance Written {Count} lines.
arg1
Type: T1
Value of the first parameter.

Type Parameters

T1
Type of the first parameter.
See Also

Reference

LogActivity Class
SetFailure Overload
PostSharp.Patterns.Diagnostics Namespace


LogActivity.SetFailure(T1, T2) Method (String, T1, T2)

LogActivitySetFailureT1, T2 Method (String, T1, T2)

Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 2 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void SetFailure<T1, T2>(
    string text,
    T1 arg1,
    T2 arg2
)

Parameters

text
Type: SystemString
The failure message with parameters, for instance Written {Count} lines.
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
See Also

Reference

LogActivity Class
SetFailure Overload
PostSharp.Patterns.Diagnostics Namespace


LogActivity.SetFailure(T1, T2, T3) Method (String, T1, T2, T3)

LogActivitySetFailureT1, T2, T3 Method (String, T1, T2, T3)

Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 3 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void SetFailure<T1, T2, T3>(
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3
)

Parameters

text
Type: SystemString
The failure message with parameters, for instance Written {Count} lines.
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
See Also

Reference

LogActivity Class
SetFailure Overload
PostSharp.Patterns.Diagnostics Namespace


LogActivity.SetFailure(T1, T2, T3, T4) Method (String, T1, T2, T3, T4)

LogActivitySetFailureT1, T2, T3, T4 Method (String, T1, T2, T3, T4)

Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 4 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void SetFailure<T1, T2, T3, T4>(
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4
)

Parameters

text
Type: SystemString
The failure message with parameters, for instance Written {Count} lines.
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
See Also

Reference

LogActivity Class
SetFailure Overload
PostSharp.Patterns.Diagnostics Namespace


LogActivity.SetFailure(T1, T2, T3, T4, T5) Method (String, T1, T2, T3, T4, T5)

LogActivitySetFailureT1, T2, T3, T4, T5 Method (String, T1, T2, T3, T4, T5)

Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 5 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void SetFailure<T1, T2, T3, T4, T5>(
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5
)

Parameters

text
Type: SystemString
The failure message with parameters, for instance Written {Count} lines.
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
See Also

Reference

LogActivity Class
SetFailure Overload
PostSharp.Patterns.Diagnostics Namespace


LogActivity.SetFailure(T1, T2, T3, T4, T5, T6) Method (String, T1, T2, T3, T4, T5, T6)

LogActivitySetFailureT1, T2, T3, T4, T5, T6 Method (String, T1, T2, T3, T4, T5, T6)

Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 6 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void SetFailure<T1, T2, T3, T4, T5, T6>(
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6
)

Parameters

text
Type: SystemString
The failure message with parameters, for instance Written {Count} lines.
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
See Also

Reference

LogActivity Class
SetFailure Overload
PostSharp.Patterns.Diagnostics Namespace


LogActivity.SetFailure(T1, T2, T3, T4, T5, T6, T7) Method (String, T1, T2, T3, T4, T5, T6, T7)

LogActivitySetFailureT1, T2, T3, T4, T5, T6, T7 Method (String, T1, T2, T3, T4, T5, T6, T7)

Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 7 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void SetFailure<T1, T2, T3, T4, T5, T6, T7>(
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7
)

Parameters

text
Type: SystemString
The failure message with parameters, for instance Written {Count} lines.
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.
See Also

Reference

LogActivity Class
SetFailure Overload
PostSharp.Patterns.Diagnostics Namespace


LogActivity.SetFailure(T1, T2, T3, T4, T5, T6, T7, T8) Method (String, T1, T2, T3, T4, T5, T6, T7, T8)

LogActivitySetFailureT1, T2, T3, T4, T5, T6, T7, T8 Method (String, T1, T2, T3, T4, T5, T6, T7, T8)

Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 8 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void SetFailure<T1, T2, T3, T4, T5, T6, T7, T8>(
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7,
    T8 arg8
)

Parameters

text
Type: SystemString
The failure message with parameters, for instance Written {Count} lines.
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.
arg8
Type: T8
Value of the 8-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.
T8
Type of the 8-th parameter.
See Also

Reference

LogActivity Class
SetFailure Overload
PostSharp.Patterns.Diagnostics Namespace


LogActivity.SetFailure(T1, T2, T3, T4, T5, T6, T7, T8, T9) Method (String, T1, T2, T3, T4, T5, T6, T7, T8, T9)

LogActivitySetFailureT1, T2, T3, T4, T5, T6, T7, T8, T9 Method (String, T1, T2, T3, T4, T5, T6, T7, T8, T9)

Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 9 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void SetFailure<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7,
    T8 arg8,
    T9 arg9
)

Parameters

text
Type: SystemString
The failure message with parameters, for instance Written {Count} lines.
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.
arg8
Type: T8
Value of the 8-th parameter.
arg9
Type: T9
Value of the 9-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.
T8
Type of the 8-th parameter.
T9
Type of the 9-th parameter.
See Also

Reference

LogActivity Class
SetFailure Overload
PostSharp.Patterns.Diagnostics Namespace


LogActivity.SetFailure(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) Method (String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

LogActivitySetFailureT1, T2, T3, T4, T5, T6, T7, T8, T9, T10 Method (String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with failure and specifies a failure message with 10 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void SetFailure<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7,
    T8 arg8,
    T9 arg9,
    T10 arg10
)

Parameters

text
Type: SystemString
The failure message with parameters, for instance Written {Count} lines.
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.
arg8
Type: T8
Value of the 8-th parameter.
arg9
Type: T9
Value of the 9-th parameter.
arg10
Type: T10
Value of the 10-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.
T8
Type of the 8-th parameter.
T9
Type of the 9-th parameter.
T10
Type of the 10-th parameter.
See Also

Reference

LogActivity Class
SetFailure Overload
PostSharp.Patterns.Diagnostics Namespace


LogActivity.SetSuccess Method

LogActivitySetSuccess Method

Overload List
 | Name | Description
Public method | SetSuccess | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success with the default success message.
Public method | SetSuccess(String) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a parameterless success message.
Public method | SetSuccess(String, Object) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with an array of parameters.
Public method | SetSuccessT1(String, T1) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 1 parameter.
Public method | SetSuccessT1, T2(String, T1, T2) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 2 parameters.
Public method | SetSuccessT1, T2, T3(String, T1, T2, T3) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 3 parameters.
Public method | SetSuccessT1, T2, T3, T4(String, T1, T2, T3, T4) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 4 parameters.
Public method | SetSuccessT1, T2, T3, T4, T5(String, T1, T2, T3, T4, T5) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 5 parameters.
Public method | SetSuccessT1, T2, T3, T4, T5, T6(String, T1, T2, T3, T4, T5, T6) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 6 parameters.
Public method | SetSuccessT1, T2, T3, T4, T5, T6, T7(String, T1, T2, T3, T4, T5, T6, T7) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 7 parameters.
Public method | SetSuccessT1, T2, T3, T4, T5, T6, T7, T8(String, T1, T2, T3, T4, T5, T6, T7, T8) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 8 parameters.
Public method | SetSuccessT1, T2, T3, T4, T5, T6, T7, T8, T9(String, T1, T2, T3, T4, T5, T6, T7, T8, T9) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 9 parameters.
Public method | SetSuccessT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) | Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 10 parameters.
Top
See Also

Reference

LogActivity Class
PostSharp.Patterns.Diagnostics Namespace


LogActivity.SetSuccess Method

LogActivitySetSuccess Method

Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success with the default success message.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void SetSuccess()
See Also

Reference

LogActivity Class
SetSuccess Overload
PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Adding Custom Log Records Manually


LogActivity.SetSuccess Method (String)

LogActivitySetSuccess Method (String)

Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a parameterless success message.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void SetSuccess(
    string text
)

Parameters

text
Type: SystemString
The success message.
See Also

Reference

LogActivity Class
SetSuccess Overload
PostSharp.Patterns.Diagnostics Namespace


LogActivity.SetSuccess Method (String, Object[])

LogActivitySetSuccess Method (String, Object)

Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with an array of parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void SetSuccess(
    string text,
    params Object[] args
)

Parameters

text
Type: SystemString
The success message with parameters, for instance Written {Count} lines.
args
Type: SystemObject
An array of parameters.
See Also

Reference

LogActivity Class
SetSuccess Overload
PostSharp.Patterns.Diagnostics Namespace


LogActivity.SetSuccess(T1) Method (String, T1)

LogActivitySetSuccessT1 Method (String, T1)

Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 1 parameter.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void SetSuccess<T1>(
    string text,
    T1 arg1
)

Parameters

text
Type: SystemString
The success message with parameters, for instance Written {Count} lines.
arg1
Type: T1
Value of the first parameter.

Type Parameters

T1
Type of the first parameter.
See Also

Reference

LogActivity Class
SetSuccess Overload
PostSharp.Patterns.Diagnostics Namespace


LogActivity.SetSuccess(T1, T2) Method (String, T1, T2)

LogActivitySetSuccessT1, T2 Method (String, T1, T2)

Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 2 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void SetSuccess<T1, T2>(
    string text,
    T1 arg1,
    T2 arg2
)

Parameters

text
Type: SystemString
The success message with parameters, for instance Written {Count} lines.
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
See Also

Reference

LogActivity Class
SetSuccess Overload
PostSharp.Patterns.Diagnostics Namespace


LogActivity.SetSuccess(T1, T2, T3) Method (String, T1, T2, T3)

LogActivitySetSuccessT1, T2, T3 Method (String, T1, T2, T3)

Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 3 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void SetSuccess<T1, T2, T3>(
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3
)

Parameters

text
Type: SystemString
The success message with parameters, for instance Written {Count} lines.
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
See Also

Reference

LogActivity Class
SetSuccess Overload
PostSharp.Patterns.Diagnostics Namespace


LogActivity.SetSuccess(T1, T2, T3, T4) Method (String, T1, T2, T3, T4)

LogActivitySetSuccessT1, T2, T3, T4 Method (String, T1, T2, T3, T4)

Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 4 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void SetSuccess<T1, T2, T3, T4>(
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4
)

Parameters

text
Type: SystemString
The success message with parameters, for instance Written {Count} lines.
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
See Also

Reference

LogActivity Class
SetSuccess Overload
PostSharp.Patterns.Diagnostics Namespace


LogActivity.SetSuccess(T1, T2, T3, T4, T5) Method (String, T1, T2, T3, T4, T5)

LogActivitySetSuccessT1, T2, T3, T4, T5 Method (String, T1, T2, T3, T4, T5)

Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 5 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void SetSuccess<T1, T2, T3, T4, T5>(
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5
)

Parameters

text
Type: SystemString
The success message with parameters, for instance Written {Count} lines.
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
See Also

Reference

LogActivity Class
SetSuccess Overload
PostSharp.Patterns.Diagnostics Namespace


LogActivity.SetSuccess(T1, T2, T3, T4, T5, T6) Method (String, T1, T2, T3, T4, T5, T6)

LogActivitySetSuccessT1, T2, T3, T4, T5, T6 Method (String, T1, T2, T3, T4, T5, T6)

Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 6 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void SetSuccess<T1, T2, T3, T4, T5, T6>(
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6
)

Parameters

text
Type: SystemString
The success message with parameters, for instance Written {Count} lines.
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
See Also

Reference

LogActivity Class
SetSuccess Overload
PostSharp.Patterns.Diagnostics Namespace


LogActivity.SetSuccess(T1, T2, T3, T4, T5, T6, T7) Method (String, T1, T2, T3, T4, T5, T6, T7)

LogActivitySetSuccessT1, T2, T3, T4, T5, T6, T7 Method (String, T1, T2, T3, T4, T5, T6, T7)

Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 7 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void SetSuccess<T1, T2, T3, T4, T5, T6, T7>(
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7
)

Parameters

text
Type: SystemString
The success message with parameters, for instance Written {Count} lines.
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.
See Also

Reference

LogActivity Class
SetSuccess Overload
PostSharp.Patterns.Diagnostics Namespace


LogActivity.SetSuccess(T1, T2, T3, T4, T5, T6, T7, T8) Method (String, T1, T2, T3, T4, T5, T6, T7, T8)

LogActivitySetSuccessT1, T2, T3, T4, T5, T6, T7, T8 Method (String, T1, T2, T3, T4, T5, T6, T7, T8)

Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 8 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void SetSuccess<T1, T2, T3, T4, T5, T6, T7, T8>(
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7,
    T8 arg8
)

Parameters

text
Type: SystemString
The success message with parameters, for instance Written {Count} lines.
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.
arg8
Type: T8
Value of the 8-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.
T8
Type of the 8-th parameter.
See Also

Reference

LogActivity Class
SetSuccess Overload
PostSharp.Patterns.Diagnostics Namespace


LogActivity.SetSuccess(T1, T2, T3, T4, T5, T6, T7, T8, T9) Method (String, T1, T2, T3, T4, T5, T6, T7, T8, T9)

LogActivitySetSuccessT1, T2, T3, T4, T5, T6, T7, T8, T9 Method (String, T1, T2, T3, T4, T5, T6, T7, T8, T9)

Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 9 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void SetSuccess<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7,
    T8 arg8,
    T9 arg9
)

Parameters

text
Type: SystemString
The success message with parameters, for instance Written {Count} lines.
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.
arg8
Type: T8
Value of the 8-th parameter.
arg9
Type: T9
Value of the 9-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.
T8
Type of the 8-th parameter.
T9
Type of the 9-th parameter.
See Also

Reference

LogActivity Class
SetSuccess Overload
PostSharp.Patterns.Diagnostics Namespace


LogActivity.SetSuccess(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) Method (String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

LogActivitySetSuccessT1, T2, T3, T4, T5, T6, T7, T8, T9, T10 Method (String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

Ends an activity (opened with OpenActivity(String) or OpenAsyncActivity(String) with success and specifies a success message with 10 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void SetSuccess<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7,
    T8 arg8,
    T9 arg9,
    T10 arg10
)

Parameters

text
Type: SystemString
The success message with parameters, for instance Written {Count} lines.
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.
arg8
Type: T8
Value of the 8-th parameter.
arg9
Type: T9
Value of the 9-th parameter.
arg10
Type: T10
Value of the 10-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.
T8
Type of the 8-th parameter.
T9
Type of the 9-th parameter.
T10
Type of the 10-th parameter.
See Also

Reference

LogActivity Class
SetSuccess Overload
PostSharp.Patterns.Diagnostics Namespace


LogActivity.Suspend Method

LogActivitySuspend Method

Suspends the current async activity. The activity must than be resumed by a call of the Resume method. There is typically no need to invoke this method in user code because all async methods that use the Logger class are automatically instrumented.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Suspend()
See Also

Reference

LogActivity Class
PostSharp.Patterns.Diagnostics Namespace


LogActivityKind Enumeration

Kinds of LogActivity.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum LogActivityKind
Members
Member name | Value | Description
Default | 0 | Default, created by OpenActivity(LogActivityOptions, String) or OpenAsyncActivity(LogActivityOptions, String).
TaskLauncher | 1 | Activity of creating a Task.
Task | 2 | Code running in a Task.
Wait | 3 | Activity of waiting for a Task or another dispatcher object.
See Also

Reference

PostSharp.Patterns.Diagnostics Namespace


LogActivityOptions Structure

Options of a new LogActivity.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public struct LogActivityOptions

The LogActivityOptions type exposes the following members.

Properties
 | Name | Description
 | Default | Gets the default value of the LogActivityOptions type.
Public property | IsAsync | Determines whether the new LogActivityOptions is async.
Public property | Kind | Gets or sets the kind of LogActivity.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics Namespace


LogActivityOptions Properties

The LogActivityOptions type exposes the following members.

Properties
 | Name | Description
 | Default | Gets the default value of the LogActivityOptions type.
Public property | IsAsync | Determines whether the new LogActivityOptions is async.
Public property | Kind | Gets or sets the kind of LogActivity.
Top
See Also

Reference

LogActivityOptions Structure
PostSharp.Patterns.Diagnostics Namespace


LogActivityOptions.Default Property

LogActivityOptionsDefault Property

Gets the default value of the LogActivityOptions type.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static LogActivityOptions Default { get; }

Property Value

Type: LogActivityOptions
See Also

Reference

LogActivityOptions Structure
PostSharp.Patterns.Diagnostics Namespace


LogActivityOptions.IsAsync Property

LogActivityOptionsIsAsync Property

Determines whether the new LogActivityOptions is async.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsAsync { get; }

Property Value

Type: Boolean
See Also

Reference

LogActivityOptions Structure
PostSharp.Patterns.Diagnostics Namespace


LogActivityOptions.Kind Property

LogActivityOptionsKind Property

Gets or sets the kind of LogActivity.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivityKind Kind { get; set; }

Property Value

Type: LogActivityKind
See Also

Reference

LogActivityOptions Structure
PostSharp.Patterns.Diagnostics Namespace


LogAttribute Class

Custom attribute that, when applied on a method, causes PostSharp to implement tracing before and after execution of this method.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsMethodLevelAspect
PostSharp.Patterns.DiagnosticsLogAttributeBase
PostSharp.Patterns.DiagnosticsLogAttribute

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class LogAttribute : LogAttributeBase

The LogAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | LogAttribute | Initializes a new LogAttribute.
Public method | LogAttribute(String) | Initializes a new LogAttribute and specifies a logging profile.
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | ProfileName | Gets or sets the name of the LoggingProfile. (Inherited from LogAttributeBase.)
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(MethodBase) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Inherited from Aspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from MethodLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from MethodLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, MethodBase) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from MethodLevelAspect.)
Top
Remarks

By default, the current custom attribute follows the settings of the default profile, which adds a Debug message on entry and on success, and a Warning on exception. All messages include parameter values. You can change these default settings by setting the properties of this class, or by choosing a different logging profile. The values set to properties in this class override the values set by the logging profile.

See Also

Reference

PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Adding Custom Log Records Manually
Conceptual: Adding Detailed Logging to your Solution
Conceptual: Customizing the Appearance of Log Records
Conceptual: Logging
Conceptual: What's New in PostSharp 3.0


LogAttribute Constructor

Overload List
 | Name | Description
Public method | LogAttribute | Initializes a new LogAttribute.
Public method | LogAttribute(String) | Initializes a new LogAttribute and specifies a logging profile.
Top
See Also

Reference

LogAttribute Class
PostSharp.Patterns.Diagnostics Namespace


LogAttribute Constructor

Initializes a new LogAttribute.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogAttribute()
See Also

Reference

LogAttribute Class
LogAttribute Overload
PostSharp.Patterns.Diagnostics Namespace


LogAttribute Constructor (String)

Initializes a new LogAttribute and specifies a logging profile.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogAttribute(
    string profileName
)

Parameters

profileName
Type: SystemString
The name of the logging profile, or null to use the default logging profile.
See Also

Reference

LogAttribute Class
LogAttribute Overload
PostSharp.Patterns.Diagnostics Namespace


LogAttribute Properties

The LogAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | ProfileName | Gets or sets the name of the LoggingProfile. (Inherited from LogAttributeBase.)
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

LogAttribute Class
PostSharp.Patterns.Diagnostics Namespace


LogAttribute Methods

The LogAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(MethodBase) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Inherited from Aspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from MethodLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from MethodLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, MethodBase) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from MethodLevelAspect.)
Top
See Also

Reference

LogAttribute Class
PostSharp.Patterns.Diagnostics Namespace


LogAttributeBase Class

Base class for all method-level logging aspects.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsMethodLevelAspect
PostSharp.Patterns.DiagnosticsLogAttributeBase
PostSharp.Patterns.Diagnostics.AuditAuditAttribute
PostSharp.Patterns.DiagnosticsLogAttribute
PostSharp.Patterns.DiagnosticsLogExceptionAttribute

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class LogAttributeBase : MethodLevelAspect,
    ILogAspect, IAspect

The LogAttributeBase type exposes the following members.

Constructors
 | Name | Description
Protected method | LogAttributeBase | Initializes a new instance of the LogAttributeBase class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | ProfileName | Gets or sets the name of the LoggingProfile.
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(MethodBase) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Inherited from Aspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from MethodLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from MethodLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, MethodBase) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from MethodLevelAspect.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Customizing the Appearance of Log Records


LogAttributeBase Constructor

Initializes a new instance of the LogAttributeBase class

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected LogAttributeBase()
See Also

Reference

LogAttributeBase Class
PostSharp.Patterns.Diagnostics Namespace


LogAttributeBase Properties

The LogAttributeBase type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | ProfileName | Gets or sets the name of the LoggingProfile.
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

LogAttributeBase Class
PostSharp.Patterns.Diagnostics Namespace


LogAttributeBase.ProfileName Property

LogAttributeBaseProfileName Property

Gets or sets the name of the LoggingProfile.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string ProfileName { get; set; }

Property Value

Type: String

Implements

ILogAspectProfileName
See Also

Reference

LogAttributeBase Class
PostSharp.Patterns.Diagnostics Namespace


LogAttributeBase Methods

The LogAttributeBase type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(MethodBase) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Inherited from Aspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from MethodLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from MethodLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, MethodBase) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from MethodLevelAspect.)
Top
See Also

Reference

LogAttributeBase Class
PostSharp.Patterns.Diagnostics Namespace


LogExceptionAttribute Class

Custom attribute that, when applied on a method, causes PostSharp to implement tracing upon exception in this method.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsMethodLevelAspect
PostSharp.Patterns.DiagnosticsLogAttributeBase
PostSharp.Patterns.DiagnosticsLogExceptionAttribute

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class LogExceptionAttribute : LogAttributeBase

The LogExceptionAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | LogExceptionAttribute | Initializes a new LogExceptionAttribute.
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | ProfileName | Gets or sets the name of the LoggingProfile. (Inherited from LogAttributeBase.)
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(MethodBase) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Inherited from Aspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from MethodLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from MethodLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, MethodBase) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from MethodLevelAspect.)
Top
Remarks

Using this custom attribute is strictly equivalent to using the LogAttribute with the Exceptions profile and no other property set.

See Also

Reference

PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Customizing the Appearance of Log Records
Conceptual: Logging
Conceptual: What's New in PostSharp 3.0


LogExceptionAttribute Constructor

Initializes a new LogExceptionAttribute.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogExceptionAttribute()
See Also

Reference

LogExceptionAttribute Class
PostSharp.Patterns.Diagnostics Namespace


LogExceptionAttribute Properties

The LogExceptionAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | ProfileName | Gets or sets the name of the LoggingProfile. (Inherited from LogAttributeBase.)
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

LogExceptionAttribute Class
PostSharp.Patterns.Diagnostics Namespace


LogExceptionAttribute Methods

The LogExceptionAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(MethodBase) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Inherited from Aspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from MethodLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from MethodLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, MethodBase) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from MethodLevelAspect.)
Top
See Also

Reference

LogExceptionAttribute Class
PostSharp.Patterns.Diagnostics Namespace


Logger Class

Allows to emit custom log records and define custom activities.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLogger
PostSharp.Patterns.DiagnosticsLogActivity

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class Logger

The Logger type exposes the following members.

Properties
 | Name | Description
Public property | IsOpenActivityEnabled | Determines whether the current logging verbosity results in the OpenActivity(String) method to open a new activity and log the start, success or failure of the activity. When this property evaluates to false, calls to the OpenActivity(String) method, as well as all calls to the methods of the returned LogActivity, are basically ignored, even SetFailure and SetException(Exception).
Top
Methods
 | Name | Description
 | GetLogger(String) | Gets a Logger for a given role and for the calling type.
 | GetLogger(String, Type) | Gets a Logger for a given role and Type.
Public method | IsEnabled | Determines whether logging is enabled in the current Logger for a given LogLevel.
Public method | OpenActivity(String) | Opens a custom activity with an optional description, but without parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivity(String, Object) | Opens a custom activity with an array of parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivity(LogActivityOptions, String) | Opens a custom activity with an optional description, but without parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivity(LogActivityOptions, String, Object) | Opens a custom activity with an array of parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1(String, T1) | Opens a custom activity with a description containing 1 parameter. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1(LogActivityOptions, String, T1) | Opens a custom activity with a description containing 1 parameter. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) | Opens a custom activity with a description containing 10 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) | Opens a custom activity with a description containing 10 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2(String, T1, T2) | Opens a custom activity with a description containing 2 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2(LogActivityOptions, String, T1, T2) | Opens a custom activity with a description containing 2 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3(String, T1, T2, T3) | Opens a custom activity with a description containing 3 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3(LogActivityOptions, String, T1, T2, T3) | Opens a custom activity with a description containing 3 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4(String, T1, T2, T3, T4) | Opens a custom activity with a description containing 4 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4(LogActivityOptions, String, T1, T2, T3, T4) | Opens a custom activity with a description containing 4 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4, T5(String, T1, T2, T3, T4, T5) | Opens a custom activity with a description containing 5 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4, T5(LogActivityOptions, String, T1, T2, T3, T4, T5) | Opens a custom activity with a description containing 5 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4, T5, T6(String, T1, T2, T3, T4, T5, T6) | Opens a custom activity with a description containing 6 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4, T5, T6(LogActivityOptions, String, T1, T2, T3, T4, T5, T6) | Opens a custom activity with a description containing 6 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7(String, T1, T2, T3, T4, T5, T6, T7) | Opens a custom activity with a description containing 7 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7) | Opens a custom activity with a description containing 7 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7, T8(String, T1, T2, T3, T4, T5, T6, T7, T8) | Opens a custom activity with a description containing 8 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7, T8(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8) | Opens a custom activity with a description containing 8 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7, T8, T9(String, T1, T2, T3, T4, T5, T6, T7, T8, T9) | Opens a custom activity with a description containing 9 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7, T8, T9(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, T9) | Opens a custom activity with a description containing 9 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenAsyncActivity(String) | Opens an asynchronous custom activity with an optional description, but without parameters.
Public method | OpenAsyncActivity(String, Object) | Opens an asynchronous custom activity with an optional description and an array of parameters.
Public method | OpenAsyncActivity(LogActivityOptions, String) | Opens an asynchronous custom activity with an optional description, but without parameters.
Public method | OpenAsyncActivity(LogActivityOptions, String, Object) | Opens an asynchronous custom activity with an optional description and an array of parameters.
Public method | OpenAsyncActivityT1(String, T1) | Opens an asynchronous custom activity with a description containing 1 parameter.
Public method | OpenAsyncActivityT1(LogActivityOptions, String, T1) | Opens an asynchronous custom activity with a description containing 1 parameter.
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) | Opens an asynchronous custom activity with a description containing 10 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) | Opens an asynchronous custom activity with a description containing 10 parameters.
Public method | OpenAsyncActivityT1, T2(String, T1, T2) | Opens an asynchronous custom activity with a description containing 2 parameters.
Public method | OpenAsyncActivityT1, T2(LogActivityOptions, String, T1, T2) | Opens an asynchronous custom activity with a description containing 2 parameters.
Public method | OpenAsyncActivityT1, T2, T3(String, T1, T2, T3) | Opens an asynchronous custom activity with a description containing 3 parameters.
Public method | OpenAsyncActivityT1, T2, T3(LogActivityOptions, String, T1, T2, T3) | Opens an asynchronous custom activity with a description containing 3 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4(String, T1, T2, T3, T4) | Opens an asynchronous custom activity with a description containing 4 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4(LogActivityOptions, String, T1, T2, T3, T4) | Opens an asynchronous custom activity with a description containing 4 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4, T5(String, T1, T2, T3, T4, T5) | Opens an asynchronous custom activity with a description containing 5 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4, T5(LogActivityOptions, String, T1, T2, T3, T4, T5) | Opens an asynchronous custom activity with a description containing 5 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6(String, T1, T2, T3, T4, T5, T6) | Opens an asynchronous custom activity with a description containing 6 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6(LogActivityOptions, String, T1, T2, T3, T4, T5, T6) | Opens an asynchronous custom activity with a description containing 6 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7(String, T1, T2, T3, T4, T5, T6, T7) | Opens an asynchronous custom activity with a description containing 7 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7) | Opens an asynchronous custom activity with a description containing 7 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7, T8(String, T1, T2, T3, T4, T5, T6, T7, T8) | Opens an asynchronous custom activity with a description containing 8 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7, T8(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8) | Opens an asynchronous custom activity with a description containing 8 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7, T8, T9(String, T1, T2, T3, T4, T5, T6, T7, T8, T9) | Opens an asynchronous custom activity with a description containing 9 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7, T8, T9(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, T9) | Opens an asynchronous custom activity with a description containing 9 parameters.
Public method | Write(LogLevel, String) | Writes a custom log record without parameters.
Public method | Write(LogLevel, String, Object) | Writes a custom log record with an array of parameters.
Public method | WriteT1(LogLevel, String, T1) | Writes a custom log record with 1 parameter.
Public method | WriteT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(LogLevel, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) | Writes a custom log record with 10 parameters.
Public method | WriteT1, T2(LogLevel, String, T1, T2) | Writes a custom log record with 2 parameters.
Public method | WriteT1, T2, T3(LogLevel, String, T1, T2, T3) | Writes a custom log record with 3 parameters.
Public method | WriteT1, T2, T3, T4(LogLevel, String, T1, T2, T3, T4) | Writes a custom log record with 4 parameters.
Public method | WriteT1, T2, T3, T4, T5(LogLevel, String, T1, T2, T3, T4, T5) | Writes a custom log record with 5 parameters.
Public method | WriteT1, T2, T3, T4, T5, T6(LogLevel, String, T1, T2, T3, T4, T5, T6) | Writes a custom log record with 6 parameters.
Public method | WriteT1, T2, T3, T4, T5, T6, T7(LogLevel, String, T1, T2, T3, T4, T5, T6, T7) | Writes a custom log record with 7 parameters.
Public method | WriteT1, T2, T3, T4, T5, T6, T7, T8(LogLevel, String, T1, T2, T3, T4, T5, T6, T7, T8) | Writes a custom log record with 8 parameters.
Public method | WriteT1, T2, T3, T4, T5, T6, T7, T8, T9(LogLevel, String, T1, T2, T3, T4, T5, T6, T7, T8, T9) | Writes a custom log record with 9 parameters.
Public method | WriteException(LogLevel, Exception, String) | Writes a custom record without parameters and associates it with an Exception.
Public method | WriteException(LogLevel, Exception, String, Object) | Writes a custom record with an array of parameters and associates it with an Exception.
Public method | WriteExceptionT1(LogLevel, Exception, String, T1) | Writes a custom log record with 1 parameter and associates it with an Exception.
Public method | WriteExceptionT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(LogLevel, Exception, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) | Writes a custom log record with 10 parameters and associates it with an Exception.
Public method | WriteExceptionT1, T2(LogLevel, Exception, String, T1, T2) | Writes a custom log record with 2 parameters and associates it with an Exception.
Public method | WriteExceptionT1, T2, T3(LogLevel, Exception, String, T1, T2, T3) | Writes a custom log record with 3 parameters and associates it with an Exception.
Public method | WriteExceptionT1, T2, T3, T4(LogLevel, Exception, String, T1, T2, T3, T4) | Writes a custom log record with 4 parameters and associates it with an Exception.
Public method | WriteExceptionT1, T2, T3, T4, T5(LogLevel, Exception, String, T1, T2, T3, T4, T5) | Writes a custom log record with 5 parameters and associates it with an Exception.
Public method | WriteExceptionT1, T2, T3, T4, T5, T6(LogLevel, Exception, String, T1, T2, T3, T4, T5, T6) | Writes a custom log record with 6 parameters and associates it with an Exception.
Public method | WriteExceptionT1, T2, T3, T4, T5, T6, T7(LogLevel, Exception, String, T1, T2, T3, T4, T5, T6, T7) | Writes a custom log record with 7 parameters and associates it with an Exception.
Public method | WriteExceptionT1, T2, T3, T4, T5, T6, T7, T8(LogLevel, Exception, String, T1, T2, T3, T4, T5, T6, T7, T8) | Writes a custom log record with 8 parameters and associates it with an Exception.
Public method | WriteExceptionT1, T2, T3, T4, T5, T6, T7, T8, T9(LogLevel, Exception, String, T1, T2, T3, T4, T5, T6, T7, T8, T9) | Writes a custom log record with 9 parameters and associates it with an Exception.
Public method | WriteExecutionPoint | Emits a log record with the source file and line of the caller.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Adding Custom Log Records Manually
Conceptual: Handling Faults in the Logging Component


Logger Properties

The Logger type exposes the following members.

Properties
 | Name | Description
Public property | IsOpenActivityEnabled | Determines whether the current logging verbosity results in the OpenActivity(String) method to open a new activity and log the start, success or failure of the activity. When this property evaluates to false, calls to the OpenActivity(String) method, as well as all calls to the methods of the returned LogActivity, are basically ignored, even SetFailure and SetException(Exception).
Top
See Also

Reference

Logger Class
PostSharp.Patterns.Diagnostics Namespace


Logger.IsOpenActivityEnabled Property

LoggerIsOpenActivityEnabled Property

Determines whether the current logging verbosity results in the OpenActivity(String) method to open a new activity and log the start, success or failure of the activity. When this property evaluates to false, calls to the OpenActivity(String) method, as well as all calls to the methods of the returned LogActivity, are basically ignored, even SetFailure and SetException(Exception).

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsOpenActivityEnabled { get; }

Property Value

Type: Boolean
See Also

Reference

Logger Class
PostSharp.Patterns.Diagnostics Namespace


Logger Methods

The Logger type exposes the following members.

Methods
 | Name | Description
 | GetLogger(String) | Gets a Logger for a given role and for the calling type.
 | GetLogger(String, Type) | Gets a Logger for a given role and Type.
Public method | IsEnabled | Determines whether logging is enabled in the current Logger for a given LogLevel.
Public method | OpenActivity(String) | Opens a custom activity with an optional description, but without parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivity(String, Object) | Opens a custom activity with an array of parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivity(LogActivityOptions, String) | Opens a custom activity with an optional description, but without parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivity(LogActivityOptions, String, Object) | Opens a custom activity with an array of parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1(String, T1) | Opens a custom activity with a description containing 1 parameter. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1(LogActivityOptions, String, T1) | Opens a custom activity with a description containing 1 parameter. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) | Opens a custom activity with a description containing 10 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) | Opens a custom activity with a description containing 10 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2(String, T1, T2) | Opens a custom activity with a description containing 2 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2(LogActivityOptions, String, T1, T2) | Opens a custom activity with a description containing 2 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3(String, T1, T2, T3) | Opens a custom activity with a description containing 3 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3(LogActivityOptions, String, T1, T2, T3) | Opens a custom activity with a description containing 3 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4(String, T1, T2, T3, T4) | Opens a custom activity with a description containing 4 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4(LogActivityOptions, String, T1, T2, T3, T4) | Opens a custom activity with a description containing 4 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4, T5(String, T1, T2, T3, T4, T5) | Opens a custom activity with a description containing 5 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4, T5(LogActivityOptions, String, T1, T2, T3, T4, T5) | Opens a custom activity with a description containing 5 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4, T5, T6(String, T1, T2, T3, T4, T5, T6) | Opens a custom activity with a description containing 6 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4, T5, T6(LogActivityOptions, String, T1, T2, T3, T4, T5, T6) | Opens a custom activity with a description containing 6 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7(String, T1, T2, T3, T4, T5, T6, T7) | Opens a custom activity with a description containing 7 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7) | Opens a custom activity with a description containing 7 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7, T8(String, T1, T2, T3, T4, T5, T6, T7, T8) | Opens a custom activity with a description containing 8 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7, T8(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8) | Opens a custom activity with a description containing 8 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7, T8, T9(String, T1, T2, T3, T4, T5, T6, T7, T8, T9) | Opens a custom activity with a description containing 9 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7, T8, T9(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, T9) | Opens a custom activity with a description containing 9 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenAsyncActivity(String) | Opens an asynchronous custom activity with an optional description, but without parameters.
Public method | OpenAsyncActivity(String, Object) | Opens an asynchronous custom activity with an optional description and an array of parameters.
Public method | OpenAsyncActivity(LogActivityOptions, String) | Opens an asynchronous custom activity with an optional description, but without parameters.
Public method | OpenAsyncActivity(LogActivityOptions, String, Object) | Opens an asynchronous custom activity with an optional description and an array of parameters.
Public method | OpenAsyncActivityT1(String, T1) | Opens an asynchronous custom activity with a description containing 1 parameter.
Public method | OpenAsyncActivityT1(LogActivityOptions, String, T1) | Opens an asynchronous custom activity with a description containing 1 parameter.
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) | Opens an asynchronous custom activity with a description containing 10 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) | Opens an asynchronous custom activity with a description containing 10 parameters.
Public method | OpenAsyncActivityT1, T2(String, T1, T2) | Opens an asynchronous custom activity with a description containing 2 parameters.
Public method | OpenAsyncActivityT1, T2(LogActivityOptions, String, T1, T2) | Opens an asynchronous custom activity with a description containing 2 parameters.
Public method | OpenAsyncActivityT1, T2, T3(String, T1, T2, T3) | Opens an asynchronous custom activity with a description containing 3 parameters.
Public method | OpenAsyncActivityT1, T2, T3(LogActivityOptions, String, T1, T2, T3) | Opens an asynchronous custom activity with a description containing 3 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4(String, T1, T2, T3, T4) | Opens an asynchronous custom activity with a description containing 4 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4(LogActivityOptions, String, T1, T2, T3, T4) | Opens an asynchronous custom activity with a description containing 4 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4, T5(String, T1, T2, T3, T4, T5) | Opens an asynchronous custom activity with a description containing 5 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4, T5(LogActivityOptions, String, T1, T2, T3, T4, T5) | Opens an asynchronous custom activity with a description containing 5 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6(String, T1, T2, T3, T4, T5, T6) | Opens an asynchronous custom activity with a description containing 6 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6(LogActivityOptions, String, T1, T2, T3, T4, T5, T6) | Opens an asynchronous custom activity with a description containing 6 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7(String, T1, T2, T3, T4, T5, T6, T7) | Opens an asynchronous custom activity with a description containing 7 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7) | Opens an asynchronous custom activity with a description containing 7 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7, T8(String, T1, T2, T3, T4, T5, T6, T7, T8) | Opens an asynchronous custom activity with a description containing 8 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7, T8(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8) | Opens an asynchronous custom activity with a description containing 8 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7, T8, T9(String, T1, T2, T3, T4, T5, T6, T7, T8, T9) | Opens an asynchronous custom activity with a description containing 9 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7, T8, T9(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, T9) | Opens an asynchronous custom activity with a description containing 9 parameters.
Public method | Write(LogLevel, String) | Writes a custom log record without parameters.
Public method | Write(LogLevel, String, Object) | Writes a custom log record with an array of parameters.
Public method | WriteT1(LogLevel, String, T1) | Writes a custom log record with 1 parameter.
Public method | WriteT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(LogLevel, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) | Writes a custom log record with 10 parameters.
Public method | WriteT1, T2(LogLevel, String, T1, T2) | Writes a custom log record with 2 parameters.
Public method | WriteT1, T2, T3(LogLevel, String, T1, T2, T3) | Writes a custom log record with 3 parameters.
Public method | WriteT1, T2, T3, T4(LogLevel, String, T1, T2, T3, T4) | Writes a custom log record with 4 parameters.
Public method | WriteT1, T2, T3, T4, T5(LogLevel, String, T1, T2, T3, T4, T5) | Writes a custom log record with 5 parameters.
Public method | WriteT1, T2, T3, T4, T5, T6(LogLevel, String, T1, T2, T3, T4, T5, T6) | Writes a custom log record with 6 parameters.
Public method | WriteT1, T2, T3, T4, T5, T6, T7(LogLevel, String, T1, T2, T3, T4, T5, T6, T7) | Writes a custom log record with 7 parameters.
Public method | WriteT1, T2, T3, T4, T5, T6, T7, T8(LogLevel, String, T1, T2, T3, T4, T5, T6, T7, T8) | Writes a custom log record with 8 parameters.
Public method | WriteT1, T2, T3, T4, T5, T6, T7, T8, T9(LogLevel, String, T1, T2, T3, T4, T5, T6, T7, T8, T9) | Writes a custom log record with 9 parameters.
Public method | WriteException(LogLevel, Exception, String) | Writes a custom record without parameters and associates it with an Exception.
Public method | WriteException(LogLevel, Exception, String, Object) | Writes a custom record with an array of parameters and associates it with an Exception.
Public method | WriteExceptionT1(LogLevel, Exception, String, T1) | Writes a custom log record with 1 parameter and associates it with an Exception.
Public method | WriteExceptionT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(LogLevel, Exception, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) | Writes a custom log record with 10 parameters and associates it with an Exception.
Public method | WriteExceptionT1, T2(LogLevel, Exception, String, T1, T2) | Writes a custom log record with 2 parameters and associates it with an Exception.
Public method | WriteExceptionT1, T2, T3(LogLevel, Exception, String, T1, T2, T3) | Writes a custom log record with 3 parameters and associates it with an Exception.
Public method | WriteExceptionT1, T2, T3, T4(LogLevel, Exception, String, T1, T2, T3, T4) | Writes a custom log record with 4 parameters and associates it with an Exception.
Public method | WriteExceptionT1, T2, T3, T4, T5(LogLevel, Exception, String, T1, T2, T3, T4, T5) | Writes a custom log record with 5 parameters and associates it with an Exception.
Public method | WriteExceptionT1, T2, T3, T4, T5, T6(LogLevel, Exception, String, T1, T2, T3, T4, T5, T6) | Writes a custom log record with 6 parameters and associates it with an Exception.
Public method | WriteExceptionT1, T2, T3, T4, T5, T6, T7(LogLevel, Exception, String, T1, T2, T3, T4, T5, T6, T7) | Writes a custom log record with 7 parameters and associates it with an Exception.
Public method | WriteExceptionT1, T2, T3, T4, T5, T6, T7, T8(LogLevel, Exception, String, T1, T2, T3, T4, T5, T6, T7, T8) | Writes a custom log record with 8 parameters and associates it with an Exception.
Public method | WriteExceptionT1, T2, T3, T4, T5, T6, T7, T8, T9(LogLevel, Exception, String, T1, T2, T3, T4, T5, T6, T7, T8, T9) | Writes a custom log record with 9 parameters and associates it with an Exception.
Public method | WriteExecutionPoint | Emits a log record with the source file and line of the caller.
Top
See Also

Reference

Logger Class
PostSharp.Patterns.Diagnostics Namespace


Logger.GetLogger Method

LoggerGetLogger Method

Overload List
Name | Description
GetLogger(String) | Gets a Logger for a given role and for the calling type.
GetLogger(String, Type) | Gets a Logger for a given role and Type.
Top
See Also

Reference

Logger Class
PostSharp.Patterns.Diagnostics Namespace


Logger.GetLogger Method (String)

LoggerGetLogger Method (String)

Gets a Logger for a given role and for the calling type.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Logger GetLogger(
    string role = "Custom"
)

Parameters

role (Optional)
Type: SystemString
The role name (see LoggingRoles for a list of standard logging roles). The default value is Custom.

Return Value

Type: Logger
A Logger for role and the calling type.
See Also

Reference

Logger Class
GetLogger Overload
PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Adding Custom Log Records Manually


Logger.GetLogger Method (String, Type)

LoggerGetLogger Method (String, Type)

Gets a Logger for a given role and Type.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Logger GetLogger(
    string role,
    Type type
)

Parameters

role
Type: SystemString
The role name (see LoggingRoles for a list of standard logging roles).
type
Type: SystemType
The type that will emit the records.

Return Value

Type: Logger
A Logger for role and type.
See Also

Reference

Logger Class
GetLogger Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.IsEnabled Method

LoggerIsEnabled Method

Determines whether logging is enabled in the current Logger for a given LogLevel.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsEnabled(
    LogLevel level
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel
A LogLevel.

Return Value

Type: Boolean
true if logging is enabled for level, otherwise false.
See Also

Reference

Logger Class
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenActivity Method

LoggerOpenActivity Method

Overload List
 | Name | Description
Public method | OpenActivity(String) | Opens a custom activity with an optional description, but without parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivity(String, Object) | Opens a custom activity with an array of parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1(String, T1) | Opens a custom activity with a description containing 1 parameter. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivity(LogActivityOptions, String) | Opens a custom activity with an optional description, but without parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2(String, T1, T2) | Opens a custom activity with a description containing 2 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivity(LogActivityOptions, String, Object) | Opens a custom activity with an array of parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1(LogActivityOptions, String, T1) | Opens a custom activity with a description containing 1 parameter. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3(String, T1, T2, T3) | Opens a custom activity with a description containing 3 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2(LogActivityOptions, String, T1, T2) | Opens a custom activity with a description containing 2 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4(String, T1, T2, T3, T4) | Opens a custom activity with a description containing 4 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3(LogActivityOptions, String, T1, T2, T3) | Opens a custom activity with a description containing 3 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4, T5(String, T1, T2, T3, T4, T5) | Opens a custom activity with a description containing 5 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4(LogActivityOptions, String, T1, T2, T3, T4) | Opens a custom activity with a description containing 4 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4, T5, T6(String, T1, T2, T3, T4, T5, T6) | Opens a custom activity with a description containing 6 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4, T5(LogActivityOptions, String, T1, T2, T3, T4, T5) | Opens a custom activity with a description containing 5 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7(String, T1, T2, T3, T4, T5, T6, T7) | Opens a custom activity with a description containing 7 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4, T5, T6(LogActivityOptions, String, T1, T2, T3, T4, T5, T6) | Opens a custom activity with a description containing 6 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7, T8(String, T1, T2, T3, T4, T5, T6, T7, T8) | Opens a custom activity with a description containing 8 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7) | Opens a custom activity with a description containing 7 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7, T8, T9(String, T1, T2, T3, T4, T5, T6, T7, T8, T9) | Opens a custom activity with a description containing 9 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7, T8(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8) | Opens a custom activity with a description containing 8 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) | Opens a custom activity with a description containing 10 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7, T8, T9(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, T9) | Opens a custom activity with a description containing 9 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Public method | OpenActivityT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) | Opens a custom activity with a description containing 10 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.
Top
See Also

Reference

Logger Class
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenActivity Method (String)

LoggerOpenActivity Method (String)

Opens a custom activity with an optional description, but without parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenActivity(
    string text = null
)

Parameters

text (Optional)
Type: SystemString
A description of the activity, or null to use the caller method name as the activity description.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks
The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).
See Also

Reference

Logger Class
OpenActivity Overload
PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Adding Custom Log Records Manually


Logger.OpenActivity Method (String, Object[])

LoggerOpenActivity Method (String, Object)

Opens a custom activity with an array of parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenActivity(
    string text,
    params Object[] args
)

Parameters

text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}.)
args
Type: SystemObject
An array of parameters.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks
The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).
See Also

Reference

Logger Class
OpenActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenActivity(T1) Method (String, T1)

LoggerOpenActivityT1 Method (String, T1)

Opens a custom activity with a description containing 1 parameter. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenActivity<T1>(
    string text,
    T1 arg1
)

Parameters

text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.

Type Parameters

T1
Type of the first parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks
The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).
See Also

Reference

Logger Class
OpenActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenActivity Method (LogActivityOptions, String)

LoggerOpenActivity Method (LogActivityOptions, String)

Opens a custom activity with an optional description, but without parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenActivity(
    LogActivityOptions options,
    string text = null
)

Parameters

options
Type: PostSharp.Patterns.DiagnosticsLogActivityOptions
Characteristics of the new LogActivity.
text (Optional)
Type: SystemString
A description of the activity, or null to use the caller method name as the activity description.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks
The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).
See Also

Reference

Logger Class
OpenActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenActivity(T1, T2) Method (String, T1, T2)

LoggerOpenActivityT1, T2 Method (String, T1, T2)

Opens a custom activity with a description containing 2 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenActivity<T1, T2>(
    string text,
    T1 arg1,
    T2 arg2
)

Parameters

text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks
The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).
See Also

Reference

Logger Class
OpenActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenActivity Method (LogActivityOptions, String, Object[])

LoggerOpenActivity Method (LogActivityOptions, String, Object)

Opens a custom activity with an array of parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenActivity(
    LogActivityOptions options,
    string text,
    params Object[] args
)

Parameters

options
Type: PostSharp.Patterns.DiagnosticsLogActivityOptions
Characteristics of the new LogActivity.
text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}.)
args
Type: SystemObject
An array of parameters.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks
The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).
See Also

Reference

Logger Class
OpenActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenActivity(T1) Method (LogActivityOptions, String, T1)

LoggerOpenActivityT1 Method (LogActivityOptions, String, T1)

Opens a custom activity with a description containing 1 parameter. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenActivity<T1>(
    LogActivityOptions options,
    string text,
    T1 arg1
)

Parameters

options
Type: PostSharp.Patterns.DiagnosticsLogActivityOptions
Options of the new LogActivity.
text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.

Type Parameters

T1
Type of the first parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks
The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).
See Also

Reference

Logger Class
OpenActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenActivity(T1, T2, T3) Method (String, T1, T2, T3)

LoggerOpenActivityT1, T2, T3 Method (String, T1, T2, T3)

Opens a custom activity with a description containing 3 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenActivity<T1, T2, T3>(
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3
)

Parameters

text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks
The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).
See Also

Reference

Logger Class
OpenActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenActivity(T1, T2) Method (LogActivityOptions, String, T1, T2)

LoggerOpenActivityT1, T2 Method (LogActivityOptions, String, T1, T2)

Opens a custom activity with a description containing 2 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenActivity<T1, T2>(
    LogActivityOptions options,
    string text,
    T1 arg1,
    T2 arg2
)

Parameters

options
Type: PostSharp.Patterns.DiagnosticsLogActivityOptions
Options of the new LogActivity.
text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks
The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).
See Also

Reference

Logger Class
OpenActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenActivity(T1, T2, T3, T4) Method (String, T1, T2, T3, T4)

LoggerOpenActivityT1, T2, T3, T4 Method (String, T1, T2, T3, T4)

Opens a custom activity with a description containing 4 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenActivity<T1, T2, T3, T4>(
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4
)

Parameters

text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks
The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).
See Also

Reference

Logger Class
OpenActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenActivity(T1, T2, T3) Method (LogActivityOptions, String, T1, T2, T3)

LoggerOpenActivityT1, T2, T3 Method (LogActivityOptions, String, T1, T2, T3)

Opens a custom activity with a description containing 3 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenActivity<T1, T2, T3>(
    LogActivityOptions options,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3
)

Parameters

options
Type: PostSharp.Patterns.DiagnosticsLogActivityOptions
Options of the new LogActivity.
text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks
The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).
See Also

Reference

Logger Class
OpenActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenActivity(T1, T2, T3, T4, T5) Method (String, T1, T2, T3, T4, T5)

LoggerOpenActivityT1, T2, T3, T4, T5 Method (String, T1, T2, T3, T4, T5)

Opens a custom activity with a description containing 5 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenActivity<T1, T2, T3, T4, T5>(
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5
)

Parameters

text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks
The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).
See Also

Reference

Logger Class
OpenActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenActivity(T1, T2, T3, T4) Method (LogActivityOptions, String, T1, T2, T3, T4)

LoggerOpenActivityT1, T2, T3, T4 Method (LogActivityOptions, String, T1, T2, T3, T4)

Opens a custom activity with a description containing 4 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenActivity<T1, T2, T3, T4>(
    LogActivityOptions options,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4
)

Parameters

options
Type: PostSharp.Patterns.DiagnosticsLogActivityOptions
Options of the new LogActivity.
text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks
The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).
See Also

Reference

Logger Class
OpenActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenActivity(T1, T2, T3, T4, T5, T6) Method (String, T1, T2, T3, T4, T5, T6)

LoggerOpenActivityT1, T2, T3, T4, T5, T6 Method (String, T1, T2, T3, T4, T5, T6)

Opens a custom activity with a description containing 6 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenActivity<T1, T2, T3, T4, T5, T6>(
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6
)

Parameters

text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks
The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).
See Also

Reference

Logger Class
OpenActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenActivity(T1, T2, T3, T4, T5) Method (LogActivityOptions, String, T1, T2, T3, T4, T5)

LoggerOpenActivityT1, T2, T3, T4, T5 Method (LogActivityOptions, String, T1, T2, T3, T4, T5)

Opens a custom activity with a description containing 5 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenActivity<T1, T2, T3, T4, T5>(
    LogActivityOptions options,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5
)

Parameters

options
Type: PostSharp.Patterns.DiagnosticsLogActivityOptions
Options of the new LogActivity.
text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks
The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).
See Also

Reference

Logger Class
OpenActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenActivity(T1, T2, T3, T4, T5, T6, T7) Method (String, T1, T2, T3, T4, T5, T6, T7)

LoggerOpenActivityT1, T2, T3, T4, T5, T6, T7 Method (String, T1, T2, T3, T4, T5, T6, T7)

Opens a custom activity with a description containing 7 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenActivity<T1, T2, T3, T4, T5, T6, T7>(
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7
)

Parameters

text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks
The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).
See Also

Reference

Logger Class
OpenActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenActivity(T1, T2, T3, T4, T5, T6) Method (LogActivityOptions, String, T1, T2, T3, T4, T5, T6)

LoggerOpenActivityT1, T2, T3, T4, T5, T6 Method (LogActivityOptions, String, T1, T2, T3, T4, T5, T6)

Opens a custom activity with a description containing 6 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenActivity<T1, T2, T3, T4, T5, T6>(
    LogActivityOptions options,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6
)

Parameters

options
Type: PostSharp.Patterns.DiagnosticsLogActivityOptions
Options of the new LogActivity.
text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks
The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).
See Also

Reference

Logger Class
OpenActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenActivity(T1, T2, T3, T4, T5, T6, T7, T8) Method (String, T1, T2, T3, T4, T5, T6, T7, T8)

LoggerOpenActivityT1, T2, T3, T4, T5, T6, T7, T8 Method (String, T1, T2, T3, T4, T5, T6, T7, T8)

Opens a custom activity with a description containing 8 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenActivity<T1, T2, T3, T4, T5, T6, T7, T8>(
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7,
    T8 arg8
)

Parameters

text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.
arg8
Type: T8
Value of the 8-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.
T8
Type of the 8-th parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks
The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).
See Also

Reference

Logger Class
OpenActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenActivity(T1, T2, T3, T4, T5, T6, T7) Method (LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7)

LoggerOpenActivityT1, T2, T3, T4, T5, T6, T7 Method (LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7)

Opens a custom activity with a description containing 7 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenActivity<T1, T2, T3, T4, T5, T6, T7>(
    LogActivityOptions options,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7
)

Parameters

options
Type: PostSharp.Patterns.DiagnosticsLogActivityOptions
Options of the new LogActivity.
text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks
The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).
See Also

Reference

Logger Class
OpenActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenActivity(T1, T2, T3, T4, T5, T6, T7, T8, T9) Method (String, T1, T2, T3, T4, T5, T6, T7, T8, T9)

LoggerOpenActivityT1, T2, T3, T4, T5, T6, T7, T8, T9 Method (String, T1, T2, T3, T4, T5, T6, T7, T8, T9)

Opens a custom activity with a description containing 9 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenActivity<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7,
    T8 arg8,
    T9 arg9
)

Parameters

text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.
arg8
Type: T8
Value of the 8-th parameter.
arg9
Type: T9
Value of the 9-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.
T8
Type of the 8-th parameter.
T9
Type of the 9-th parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks
The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).
See Also

Reference

Logger Class
OpenActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenActivity(T1, T2, T3, T4, T5, T6, T7, T8) Method (LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8)

LoggerOpenActivityT1, T2, T3, T4, T5, T6, T7, T8 Method (LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8)

Opens a custom activity with a description containing 8 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenActivity<T1, T2, T3, T4, T5, T6, T7, T8>(
    LogActivityOptions options,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7,
    T8 arg8
)

Parameters

options
Type: PostSharp.Patterns.DiagnosticsLogActivityOptions
Options of the new LogActivity.
text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.
arg8
Type: T8
Value of the 8-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.
T8
Type of the 8-th parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks
The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).
See Also

Reference

Logger Class
OpenActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenActivity(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) Method (String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

LoggerOpenActivityT1, T2, T3, T4, T5, T6, T7, T8, T9, T10 Method (String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

Opens a custom activity with a description containing 10 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenActivity<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7,
    T8 arg8,
    T9 arg9,
    T10 arg10
)

Parameters

text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.
arg8
Type: T8
Value of the 8-th parameter.
arg9
Type: T9
Value of the 9-th parameter.
arg10
Type: T10
Value of the 10-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.
T8
Type of the 8-th parameter.
T9
Type of the 9-th parameter.
T10
Type of the 10-th parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks
The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).
See Also

Reference

Logger Class
OpenActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenActivity(T1, T2, T3, T4, T5, T6, T7, T8, T9) Method (LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, T9)

LoggerOpenActivityT1, T2, T3, T4, T5, T6, T7, T8, T9 Method (LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, T9)

Opens a custom activity with a description containing 9 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenActivity<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
    LogActivityOptions options,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7,
    T8 arg8,
    T9 arg9
)

Parameters

options
Type: PostSharp.Patterns.DiagnosticsLogActivityOptions
Options of the new LogActivity.
text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.
arg8
Type: T8
Value of the 8-th parameter.
arg9
Type: T9
Value of the 9-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.
T8
Type of the 8-th parameter.
T9
Type of the 9-th parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks
The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).
See Also

Reference

Logger Class
OpenActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenActivity(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) Method (LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

LoggerOpenActivityT1, T2, T3, T4, T5, T6, T7, T8, T9, T10 Method (LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

Opens a custom activity with a description containing 10 parameters. The activity must be synchronous, i.e. must fully execute on the same thread and must not be interrupted by an await or yield return operator.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenActivity<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
    LogActivityOptions options,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7,
    T8 arg8,
    T9 arg9,
    T10 arg10
)

Parameters

options
Type: PostSharp.Patterns.DiagnosticsLogActivityOptions
Options of the new LogActivity.
text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.
arg8
Type: T8
Value of the 8-th parameter.
arg9
Type: T9
Value of the 9-th parameter.
arg10
Type: T10
Value of the 10-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.
T8
Type of the 8-th parameter.
T9
Type of the 9-th parameter.
T10
Type of the 10-th parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks
The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).
See Also

Reference

Logger Class
OpenActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenAsyncActivity Method

LoggerOpenAsyncActivity Method

Overload List
 | Name | Description
Public method | OpenAsyncActivity(String) | Opens an asynchronous custom activity with an optional description, but without parameters.
Public method | OpenAsyncActivity(String, Object) | Opens an asynchronous custom activity with an optional description and an array of parameters.
Public method | OpenAsyncActivityT1(String, T1) | Opens an asynchronous custom activity with a description containing 1 parameter.
Public method | OpenAsyncActivity(LogActivityOptions, String) | Opens an asynchronous custom activity with an optional description, but without parameters.
Public method | OpenAsyncActivityT1, T2(String, T1, T2) | Opens an asynchronous custom activity with a description containing 2 parameters.
Public method | OpenAsyncActivity(LogActivityOptions, String, Object) | Opens an asynchronous custom activity with an optional description and an array of parameters.
Public method | OpenAsyncActivityT1(LogActivityOptions, String, T1) | Opens an asynchronous custom activity with a description containing 1 parameter.
Public method | OpenAsyncActivityT1, T2, T3(String, T1, T2, T3) | Opens an asynchronous custom activity with a description containing 3 parameters.
Public method | OpenAsyncActivityT1, T2(LogActivityOptions, String, T1, T2) | Opens an asynchronous custom activity with a description containing 2 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4(String, T1, T2, T3, T4) | Opens an asynchronous custom activity with a description containing 4 parameters.
Public method | OpenAsyncActivityT1, T2, T3(LogActivityOptions, String, T1, T2, T3) | Opens an asynchronous custom activity with a description containing 3 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4, T5(String, T1, T2, T3, T4, T5) | Opens an asynchronous custom activity with a description containing 5 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4(LogActivityOptions, String, T1, T2, T3, T4) | Opens an asynchronous custom activity with a description containing 4 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6(String, T1, T2, T3, T4, T5, T6) | Opens an asynchronous custom activity with a description containing 6 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4, T5(LogActivityOptions, String, T1, T2, T3, T4, T5) | Opens an asynchronous custom activity with a description containing 5 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7(String, T1, T2, T3, T4, T5, T6, T7) | Opens an asynchronous custom activity with a description containing 7 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6(LogActivityOptions, String, T1, T2, T3, T4, T5, T6) | Opens an asynchronous custom activity with a description containing 6 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7, T8(String, T1, T2, T3, T4, T5, T6, T7, T8) | Opens an asynchronous custom activity with a description containing 8 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7) | Opens an asynchronous custom activity with a description containing 7 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7, T8, T9(String, T1, T2, T3, T4, T5, T6, T7, T8, T9) | Opens an asynchronous custom activity with a description containing 9 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7, T8(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8) | Opens an asynchronous custom activity with a description containing 8 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) | Opens an asynchronous custom activity with a description containing 10 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7, T8, T9(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, T9) | Opens an asynchronous custom activity with a description containing 9 parameters.
Public method | OpenAsyncActivityT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) | Opens an asynchronous custom activity with a description containing 10 parameters.
Top
See Also

Reference

Logger Class
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenAsyncActivity Method (String)

LoggerOpenAsyncActivity Method (String)

Opens an asynchronous custom activity with an optional description, but without parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenAsyncActivity(
    string text
)

Parameters

text
Type: SystemString
A description of the activity, or null to use the caller method name as the activity description.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks

The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).

See Also

Reference

Logger Class
OpenAsyncActivity Overload
PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Adding Custom Log Records Manually


Logger.OpenAsyncActivity Method (String, Object[])

LoggerOpenAsyncActivity Method (String, Object)

Opens an asynchronous custom activity with an optional description and an array of parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenAsyncActivity(
    string text,
    params Object[] args
)

Parameters

text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
args
Type: SystemObject
An array of parameters.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks

The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).

See Also

Reference

Logger Class
OpenAsyncActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenAsyncActivity(T1) Method (String, T1)

LoggerOpenAsyncActivityT1 Method (String, T1)

Opens an asynchronous custom activity with a description containing 1 parameter.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenAsyncActivity<T1>(
    string text,
    T1 arg1
)

Parameters

text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.

Type Parameters

T1
Type of the first parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks

The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).

See Also

Reference

Logger Class
OpenAsyncActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenAsyncActivity Method (LogActivityOptions, String)

LoggerOpenAsyncActivity Method (LogActivityOptions, String)

Opens an asynchronous custom activity with an optional description, but without parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenAsyncActivity(
    LogActivityOptions options,
    string text
)

Parameters

options
Type: PostSharp.Patterns.DiagnosticsLogActivityOptions
Characteristics of the new LogActivity.
text
Type: SystemString
A description of the activity, or null to use the caller method name as the activity description.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks

The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).

See Also

Reference

Logger Class
OpenAsyncActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenAsyncActivity(T1, T2) Method (String, T1, T2)

LoggerOpenAsyncActivityT1, T2 Method (String, T1, T2)

Opens an asynchronous custom activity with a description containing 2 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenAsyncActivity<T1, T2>(
    string text,
    T1 arg1,
    T2 arg2
)

Parameters

text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks

The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).

See Also

Reference

Logger Class
OpenAsyncActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenAsyncActivity Method (LogActivityOptions, String, Object[])

LoggerOpenAsyncActivity Method (LogActivityOptions, String, Object)

Opens an asynchronous custom activity with an optional description and an array of parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenAsyncActivity(
    LogActivityOptions options,
    string text,
    params Object[] args
)

Parameters

options
Type: PostSharp.Patterns.DiagnosticsLogActivityOptions
Characteristics of the new LogActivity.
text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
args
Type: SystemObject
An array of parameters.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks

The activity must be closed using SetSuccess(String), SetFailure(String) or [!:LogActivity.SetESetESetESetESetException(Exception)].

See Also

Reference

Logger Class
OpenAsyncActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenAsyncActivity(T1) Method (LogActivityOptions, String, T1)

LoggerOpenAsyncActivityT1 Method (LogActivityOptions, String, T1)

Opens an asynchronous custom activity with a description containing 1 parameter.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenAsyncActivity<T1>(
    LogActivityOptions options,
    string text,
    T1 arg1
)

Parameters

options
Type: PostSharp.Patterns.DiagnosticsLogActivityOptions
Options of the new LogActivity.
text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.

Type Parameters

T1
Type of the first parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks

The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).

See Also

Reference

Logger Class
OpenAsyncActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenAsyncActivity(T1, T2, T3) Method (String, T1, T2, T3)

LoggerOpenAsyncActivityT1, T2, T3 Method (String, T1, T2, T3)

Opens an asynchronous custom activity with a description containing 3 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenAsyncActivity<T1, T2, T3>(
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3
)

Parameters

text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks

The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).

See Also

Reference

Logger Class
OpenAsyncActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenAsyncActivity(T1, T2) Method (LogActivityOptions, String, T1, T2)

LoggerOpenAsyncActivityT1, T2 Method (LogActivityOptions, String, T1, T2)

Opens an asynchronous custom activity with a description containing 2 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenAsyncActivity<T1, T2>(
    LogActivityOptions options,
    string text,
    T1 arg1,
    T2 arg2
)

Parameters

options
Type: PostSharp.Patterns.DiagnosticsLogActivityOptions
Options of the new LogActivity.
text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks

The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).

See Also

Reference

Logger Class
OpenAsyncActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenAsyncActivity(T1, T2, T3, T4) Method (String, T1, T2, T3, T4)

LoggerOpenAsyncActivityT1, T2, T3, T4 Method (String, T1, T2, T3, T4)

Opens an asynchronous custom activity with a description containing 4 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenAsyncActivity<T1, T2, T3, T4>(
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4
)

Parameters

text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks

The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).

See Also

Reference

Logger Class
OpenAsyncActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenAsyncActivity(T1, T2, T3) Method (LogActivityOptions, String, T1, T2, T3)

LoggerOpenAsyncActivityT1, T2, T3 Method (LogActivityOptions, String, T1, T2, T3)

Opens an asynchronous custom activity with a description containing 3 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenAsyncActivity<T1, T2, T3>(
    LogActivityOptions options,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3
)

Parameters

options
Type: PostSharp.Patterns.DiagnosticsLogActivityOptions
Options of the new LogActivity.
text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks

The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).

See Also

Reference

Logger Class
OpenAsyncActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenAsyncActivity(T1, T2, T3, T4, T5) Method (String, T1, T2, T3, T4, T5)

LoggerOpenAsyncActivityT1, T2, T3, T4, T5 Method (String, T1, T2, T3, T4, T5)

Opens an asynchronous custom activity with a description containing 5 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenAsyncActivity<T1, T2, T3, T4, T5>(
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5
)

Parameters

text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks

The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).

See Also

Reference

Logger Class
OpenAsyncActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenAsyncActivity(T1, T2, T3, T4) Method (LogActivityOptions, String, T1, T2, T3, T4)

LoggerOpenAsyncActivityT1, T2, T3, T4 Method (LogActivityOptions, String, T1, T2, T3, T4)

Opens an asynchronous custom activity with a description containing 4 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenAsyncActivity<T1, T2, T3, T4>(
    LogActivityOptions options,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4
)

Parameters

options
Type: PostSharp.Patterns.DiagnosticsLogActivityOptions
Options of the new LogActivity.
text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks

The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).

See Also

Reference

Logger Class
OpenAsyncActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenAsyncActivity(T1, T2, T3, T4, T5, T6) Method (String, T1, T2, T3, T4, T5, T6)

LoggerOpenAsyncActivityT1, T2, T3, T4, T5, T6 Method (String, T1, T2, T3, T4, T5, T6)

Opens an asynchronous custom activity with a description containing 6 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenAsyncActivity<T1, T2, T3, T4, T5, T6>(
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6
)

Parameters

text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks

The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).

See Also

Reference

Logger Class
OpenAsyncActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenAsyncActivity(T1, T2, T3, T4, T5) Method (LogActivityOptions, String, T1, T2, T3, T4, T5)

LoggerOpenAsyncActivityT1, T2, T3, T4, T5 Method (LogActivityOptions, String, T1, T2, T3, T4, T5)

Opens an asynchronous custom activity with a description containing 5 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenAsyncActivity<T1, T2, T3, T4, T5>(
    LogActivityOptions options,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5
)

Parameters

options
Type: PostSharp.Patterns.DiagnosticsLogActivityOptions
Options of the new LogActivity.
text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks

The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).

See Also

Reference

Logger Class
OpenAsyncActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenAsyncActivity(T1, T2, T3, T4, T5, T6, T7) Method (String, T1, T2, T3, T4, T5, T6, T7)

LoggerOpenAsyncActivityT1, T2, T3, T4, T5, T6, T7 Method (String, T1, T2, T3, T4, T5, T6, T7)

Opens an asynchronous custom activity with a description containing 7 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenAsyncActivity<T1, T2, T3, T4, T5, T6, T7>(
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7
)

Parameters

text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks

The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).

See Also

Reference

Logger Class
OpenAsyncActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenAsyncActivity(T1, T2, T3, T4, T5, T6) Method (LogActivityOptions, String, T1, T2, T3, T4, T5, T6)

LoggerOpenAsyncActivityT1, T2, T3, T4, T5, T6 Method (LogActivityOptions, String, T1, T2, T3, T4, T5, T6)

Opens an asynchronous custom activity with a description containing 6 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenAsyncActivity<T1, T2, T3, T4, T5, T6>(
    LogActivityOptions options,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6
)

Parameters

options
Type: PostSharp.Patterns.DiagnosticsLogActivityOptions
Options of the new LogActivity.
text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks

The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).

See Also

Reference

Logger Class
OpenAsyncActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenAsyncActivity(T1, T2, T3, T4, T5, T6, T7, T8) Method (String, T1, T2, T3, T4, T5, T6, T7, T8)

LoggerOpenAsyncActivityT1, T2, T3, T4, T5, T6, T7, T8 Method (String, T1, T2, T3, T4, T5, T6, T7, T8)

Opens an asynchronous custom activity with a description containing 8 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenAsyncActivity<T1, T2, T3, T4, T5, T6, T7, T8>(
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7,
    T8 arg8
)

Parameters

text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.
arg8
Type: T8
Value of the 8-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.
T8
Type of the 8-th parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks

The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).

See Also

Reference

Logger Class
OpenAsyncActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenAsyncActivity(T1, T2, T3, T4, T5, T6, T7) Method (LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7)

LoggerOpenAsyncActivityT1, T2, T3, T4, T5, T6, T7 Method (LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7)

Opens an asynchronous custom activity with a description containing 7 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenAsyncActivity<T1, T2, T3, T4, T5, T6, T7>(
    LogActivityOptions options,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7
)

Parameters

options
Type: PostSharp.Patterns.DiagnosticsLogActivityOptions
Options of the new LogActivity.
text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks

The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).

See Also

Reference

Logger Class
OpenAsyncActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenAsyncActivity(T1, T2, T3, T4, T5, T6, T7, T8, T9) Method (String, T1, T2, T3, T4, T5, T6, T7, T8, T9)

LoggerOpenAsyncActivityT1, T2, T3, T4, T5, T6, T7, T8, T9 Method (String, T1, T2, T3, T4, T5, T6, T7, T8, T9)

Opens an asynchronous custom activity with a description containing 9 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenAsyncActivity<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7,
    T8 arg8,
    T9 arg9
)

Parameters

text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.
arg8
Type: T8
Value of the 8-th parameter.
arg9
Type: T9
Value of the 9-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.
T8
Type of the 8-th parameter.
T9
Type of the 9-th parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks

The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).

See Also

Reference

Logger Class
OpenAsyncActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenAsyncActivity(T1, T2, T3, T4, T5, T6, T7, T8) Method (LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8)

LoggerOpenAsyncActivityT1, T2, T3, T4, T5, T6, T7, T8 Method (LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8)

Opens an asynchronous custom activity with a description containing 8 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenAsyncActivity<T1, T2, T3, T4, T5, T6, T7, T8>(
    LogActivityOptions options,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7,
    T8 arg8
)

Parameters

options
Type: PostSharp.Patterns.DiagnosticsLogActivityOptions
Options of the new LogActivity.
text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.
arg8
Type: T8
Value of the 8-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.
T8
Type of the 8-th parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks

The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).

See Also

Reference

Logger Class
OpenAsyncActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenAsyncActivity(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) Method (String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

LoggerOpenAsyncActivityT1, T2, T3, T4, T5, T6, T7, T8, T9, T10 Method (String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

Opens an asynchronous custom activity with a description containing 10 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenAsyncActivity<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7,
    T8 arg8,
    T9 arg9,
    T10 arg10
)

Parameters

text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.
arg8
Type: T8
Value of the 8-th parameter.
arg9
Type: T9
Value of the 9-th parameter.
arg10
Type: T10
Value of the 10-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.
T8
Type of the 8-th parameter.
T9
Type of the 9-th parameter.
T10
Type of the 10-th parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks

The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).

See Also

Reference

Logger Class
OpenAsyncActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenAsyncActivity(T1, T2, T3, T4, T5, T6, T7, T8, T9) Method (LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, T9)

LoggerOpenAsyncActivityT1, T2, T3, T4, T5, T6, T7, T8, T9 Method (LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, T9)

Opens an asynchronous custom activity with a description containing 9 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenAsyncActivity<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
    LogActivityOptions options,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7,
    T8 arg8,
    T9 arg9
)

Parameters

options
Type: PostSharp.Patterns.DiagnosticsLogActivityOptions
Options of the new LogActivity.
text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.
arg8
Type: T8
Value of the 8-th parameter.
arg9
Type: T9
Value of the 9-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.
T8
Type of the 8-th parameter.
T9
Type of the 9-th parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks

The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).

See Also

Reference

Logger Class
OpenAsyncActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.OpenAsyncActivity(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) Method (LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

LoggerOpenAsyncActivityT1, T2, T3, T4, T5, T6, T7, T8, T9, T10 Method (LogActivityOptions, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

Opens an asynchronous custom activity with a description containing 10 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivity OpenAsyncActivity<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
    LogActivityOptions options,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7,
    T8 arg8,
    T9 arg9,
    T10 arg10
)

Parameters

options
Type: PostSharp.Patterns.DiagnosticsLogActivityOptions
Options of the new LogActivity.
text
Type: SystemString
The description of the activity, including parameters (e.g. Writing {LineCount} line(s) in file {Path}).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.
arg8
Type: T8
Value of the 8-th parameter.
arg9
Type: T9
Value of the 9-th parameter.
arg10
Type: T10
Value of the 10-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.
T8
Type of the 8-th parameter.
T9
Type of the 9-th parameter.
T10
Type of the 10-th parameter.

Return Value

Type: LogActivity
A Logger representing the new activity.
Remarks

The activity must be closed using SetSuccess(String), SetFailure(String) or SetException(Exception).

See Also

Reference

Logger Class
OpenAsyncActivity Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.Write Method

LoggerWrite Method

Overload List
 | Name | Description
Public method | Write(LogLevel, String) | Writes a custom log record without parameters.
Public method | Write(LogLevel, String, Object) | Writes a custom log record with an array of parameters.
Public method | WriteT1(LogLevel, String, T1) | Writes a custom log record with 1 parameter.
Public method | WriteT1, T2(LogLevel, String, T1, T2) | Writes a custom log record with 2 parameters.
Public method | WriteT1, T2, T3(LogLevel, String, T1, T2, T3) | Writes a custom log record with 3 parameters.
Public method | WriteT1, T2, T3, T4(LogLevel, String, T1, T2, T3, T4) | Writes a custom log record with 4 parameters.
Public method | WriteT1, T2, T3, T4, T5(LogLevel, String, T1, T2, T3, T4, T5) | Writes a custom log record with 5 parameters.
Public method | WriteT1, T2, T3, T4, T5, T6(LogLevel, String, T1, T2, T3, T4, T5, T6) | Writes a custom log record with 6 parameters.
Public method | WriteT1, T2, T3, T4, T5, T6, T7(LogLevel, String, T1, T2, T3, T4, T5, T6, T7) | Writes a custom log record with 7 parameters.
Public method | WriteT1, T2, T3, T4, T5, T6, T7, T8(LogLevel, String, T1, T2, T3, T4, T5, T6, T7, T8) | Writes a custom log record with 8 parameters.
Public method | WriteT1, T2, T3, T4, T5, T6, T7, T8, T9(LogLevel, String, T1, T2, T3, T4, T5, T6, T7, T8, T9) | Writes a custom log record with 9 parameters.
Public method | WriteT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(LogLevel, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) | Writes a custom log record with 10 parameters.
Top
See Also

Reference

Logger Class
PostSharp.Patterns.Diagnostics Namespace


Logger.Write Method (LogLevel, String)

LoggerWrite Method (LogLevel, String)

Writes a custom log record without parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Write(
    LogLevel level,
    string text
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel
The severity of the record (e.g. Info or Warning).
text
Type: SystemString
The text of the log record.
See Also

Reference

Logger Class
Write Overload
PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Adding Custom Log Records Manually


Logger.Write Method (LogLevel, String, Object[])

LoggerWrite Method (LogLevel, String, Object)

Writes a custom log record with an array of parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Write(
    LogLevel level,
    string text,
    params Object[] args
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel
The severity of the record (e.g. Info or Warning).
text
Type: SystemString
The text of the log record, including parameters (e.g. Opening {Path} file {ShareMode} sharing mode.)
args
Type: SystemObject
An array of parameters.
See Also

Reference

Logger Class
Write Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.Write(T1) Method (LogLevel, String, T1)

LoggerWriteT1 Method (LogLevel, String, T1)

Writes a custom log record with 1 parameter.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Write<T1>(
    LogLevel level,
    string text,
    T1 arg1
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel
The severity of the record (e.g. Info or Warning).
text
Type: SystemString
The text of the log record, including parameters (e.g. Opening {Path} file {ShareMode} sharing mode).
arg1
Type: T1
Value of the first parameter.

Type Parameters

T1
Type of the first parameter.
See Also

Reference

Logger Class
Write Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.Write(T1, T2) Method (LogLevel, String, T1, T2)

LoggerWriteT1, T2 Method (LogLevel, String, T1, T2)

Writes a custom log record with 2 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Write<T1, T2>(
    LogLevel level,
    string text,
    T1 arg1,
    T2 arg2
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel
The severity of the record (e.g. Info or Warning).
text
Type: SystemString
The text of the log record, including parameters (e.g. Opening {Path} file {ShareMode} sharing mode).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
See Also

Reference

Logger Class
Write Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.Write(T1, T2, T3) Method (LogLevel, String, T1, T2, T3)

LoggerWriteT1, T2, T3 Method (LogLevel, String, T1, T2, T3)

Writes a custom log record with 3 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Write<T1, T2, T3>(
    LogLevel level,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel
The severity of the record (e.g. Info or Warning).
text
Type: SystemString
The text of the log record, including parameters (e.g. Opening {Path} file {ShareMode} sharing mode).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
See Also

Reference

Logger Class
Write Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.Write(T1, T2, T3, T4) Method (LogLevel, String, T1, T2, T3, T4)

LoggerWriteT1, T2, T3, T4 Method (LogLevel, String, T1, T2, T3, T4)

Writes a custom log record with 4 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Write<T1, T2, T3, T4>(
    LogLevel level,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel
The severity of the record (e.g. Info or Warning).
text
Type: SystemString
The text of the log record, including parameters (e.g. Opening {Path} file {ShareMode} sharing mode).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
See Also

Reference

Logger Class
Write Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.Write(T1, T2, T3, T4, T5) Method (LogLevel, String, T1, T2, T3, T4, T5)

LoggerWriteT1, T2, T3, T4, T5 Method (LogLevel, String, T1, T2, T3, T4, T5)

Writes a custom log record with 5 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Write<T1, T2, T3, T4, T5>(
    LogLevel level,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel
The severity of the record (e.g. Info or Warning).
text
Type: SystemString
The text of the log record, including parameters (e.g. Opening {Path} file {ShareMode} sharing mode).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
See Also

Reference

Logger Class
Write Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.Write(T1, T2, T3, T4, T5, T6) Method (LogLevel, String, T1, T2, T3, T4, T5, T6)

LoggerWriteT1, T2, T3, T4, T5, T6 Method (LogLevel, String, T1, T2, T3, T4, T5, T6)

Writes a custom log record with 6 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Write<T1, T2, T3, T4, T5, T6>(
    LogLevel level,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel
The severity of the record (e.g. Info or Warning).
text
Type: SystemString
The text of the log record, including parameters (e.g. Opening {Path} file {ShareMode} sharing mode).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
See Also

Reference

Logger Class
Write Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.Write(T1, T2, T3, T4, T5, T6, T7) Method (LogLevel, String, T1, T2, T3, T4, T5, T6, T7)

LoggerWriteT1, T2, T3, T4, T5, T6, T7 Method (LogLevel, String, T1, T2, T3, T4, T5, T6, T7)

Writes a custom log record with 7 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Write<T1, T2, T3, T4, T5, T6, T7>(
    LogLevel level,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel
The severity of the record (e.g. Info or Warning).
text
Type: SystemString
The text of the log record, including parameters (e.g. Opening {Path} file {ShareMode} sharing mode).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.
See Also

Reference

Logger Class
Write Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.Write(T1, T2, T3, T4, T5, T6, T7, T8) Method (LogLevel, String, T1, T2, T3, T4, T5, T6, T7, T8)

LoggerWriteT1, T2, T3, T4, T5, T6, T7, T8 Method (LogLevel, String, T1, T2, T3, T4, T5, T6, T7, T8)

Writes a custom log record with 8 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Write<T1, T2, T3, T4, T5, T6, T7, T8>(
    LogLevel level,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7,
    T8 arg8
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel
The severity of the record (e.g. Info or Warning).
text
Type: SystemString
The text of the log record, including parameters (e.g. Opening {Path} file {ShareMode} sharing mode).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.
arg8
Type: T8
Value of the 8-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.
T8
Type of the 8-th parameter.
See Also

Reference

Logger Class
Write Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.Write(T1, T2, T3, T4, T5, T6, T7, T8, T9) Method (LogLevel, String, T1, T2, T3, T4, T5, T6, T7, T8, T9)

LoggerWriteT1, T2, T3, T4, T5, T6, T7, T8, T9 Method (LogLevel, String, T1, T2, T3, T4, T5, T6, T7, T8, T9)

Writes a custom log record with 9 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Write<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
    LogLevel level,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7,
    T8 arg8,
    T9 arg9
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel
The severity of the record (e.g. Info or Warning).
text
Type: SystemString
The text of the log record, including parameters (e.g. Opening {Path} file {ShareMode} sharing mode).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.
arg8
Type: T8
Value of the 8-th parameter.
arg9
Type: T9
Value of the 9-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.
T8
Type of the 8-th parameter.
T9
Type of the 9-th parameter.
See Also

Reference

Logger Class
Write Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.Write(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) Method (LogLevel, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

LoggerWriteT1, T2, T3, T4, T5, T6, T7, T8, T9, T10 Method (LogLevel, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

Writes a custom log record with 10 parameters.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Write<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
    LogLevel level,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7,
    T8 arg8,
    T9 arg9,
    T10 arg10
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel
The severity of the record (e.g. Info or Warning).
text
Type: SystemString
The text of the log record, including parameters (e.g. Opening {Path} file {ShareMode} sharing mode).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.
arg8
Type: T8
Value of the 8-th parameter.
arg9
Type: T9
Value of the 9-th parameter.
arg10
Type: T10
Value of the 10-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.
T8
Type of the 8-th parameter.
T9
Type of the 9-th parameter.
T10
Type of the 10-th parameter.
See Also

Reference

Logger Class
Write Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.WriteException Method

LoggerWriteException Method

Overload List
 | Name | Description
Public method | WriteException(LogLevel, Exception, String) | Writes a custom record without parameters and associates it with an Exception.
Public method | WriteException(LogLevel, Exception, String, Object) | Writes a custom record with an array of parameters and associates it with an Exception.
Public method | WriteExceptionT1(LogLevel, Exception, String, T1) | Writes a custom log record with 1 parameter and associates it with an Exception.
Public method | WriteExceptionT1, T2(LogLevel, Exception, String, T1, T2) | Writes a custom log record with 2 parameters and associates it with an Exception.
Public method | WriteExceptionT1, T2, T3(LogLevel, Exception, String, T1, T2, T3) | Writes a custom log record with 3 parameters and associates it with an Exception.
Public method | WriteExceptionT1, T2, T3, T4(LogLevel, Exception, String, T1, T2, T3, T4) | Writes a custom log record with 4 parameters and associates it with an Exception.
Public method | WriteExceptionT1, T2, T3, T4, T5(LogLevel, Exception, String, T1, T2, T3, T4, T5) | Writes a custom log record with 5 parameters and associates it with an Exception.
Public method | WriteExceptionT1, T2, T3, T4, T5, T6(LogLevel, Exception, String, T1, T2, T3, T4, T5, T6) | Writes a custom log record with 6 parameters and associates it with an Exception.
Public method | WriteExceptionT1, T2, T3, T4, T5, T6, T7(LogLevel, Exception, String, T1, T2, T3, T4, T5, T6, T7) | Writes a custom log record with 7 parameters and associates it with an Exception.
Public method | WriteExceptionT1, T2, T3, T4, T5, T6, T7, T8(LogLevel, Exception, String, T1, T2, T3, T4, T5, T6, T7, T8) | Writes a custom log record with 8 parameters and associates it with an Exception.
Public method | WriteExceptionT1, T2, T3, T4, T5, T6, T7, T8, T9(LogLevel, Exception, String, T1, T2, T3, T4, T5, T6, T7, T8, T9) | Writes a custom log record with 9 parameters and associates it with an Exception.
Public method | WriteExceptionT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(LogLevel, Exception, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) | Writes a custom log record with 10 parameters and associates it with an Exception.
Top
See Also

Reference

Logger Class
PostSharp.Patterns.Diagnostics Namespace


Logger.WriteException Method (LogLevel, Exception, String)

LoggerWriteException Method (LogLevel, Exception, String)

Writes a custom record without parameters and associates it with an Exception.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void WriteException(
    LogLevel level,
    Exception exception,
    string text
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel
The severity of the record (e.g. Warning or Error).
exception
Type: SystemException
The Exception associated with the record.
text
Type: SystemString
The text of the log record.
See Also

Reference

Logger Class
WriteException Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.WriteException Method (LogLevel, Exception, String, Object[])

LoggerWriteException Method (LogLevel, Exception, String, Object)

Writes a custom record with an array of parameters and associates it with an Exception.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void WriteException(
    LogLevel level,
    Exception exception,
    string text,
    Object[] args
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel
The severity of the record (e.g. Warning or Error).
exception
Type: SystemException
The Exception associated with the record.
text
Type: SystemString
The text of the log record, including parameters (e.g. Opening {Path} file {ShareMode} sharing mode.)
args
Type: SystemObject
An array of parameters.
See Also

Reference

Logger Class
WriteException Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.WriteException(T1) Method (LogLevel, Exception, String, T1)

LoggerWriteExceptionT1 Method (LogLevel, Exception, String, T1)

Writes a custom log record with 1 parameter and associates it with an Exception.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void WriteException<T1>(
    LogLevel level,
    Exception exception,
    string text,
    T1 arg1
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel
The severity of the record (e.g. Warning or Error).
exception
Type: SystemException
The Exception associated with the record.
text
Type: SystemString
The text of the log record, including parameters (e.g. Opening {Path} file {ShareMode} sharing mode).
arg1
Type: T1
Value of the first parameter.

Type Parameters

T1
Type of the first parameter.
See Also

Reference

Logger Class
WriteException Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.WriteException(T1, T2) Method (LogLevel, Exception, String, T1, T2)

LoggerWriteExceptionT1, T2 Method (LogLevel, Exception, String, T1, T2)

Writes a custom log record with 2 parameters and associates it with an Exception.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void WriteException<T1, T2>(
    LogLevel level,
    Exception exception,
    string text,
    T1 arg1,
    T2 arg2
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel
The severity of the record (e.g. Warning or Error).
exception
Type: SystemException
The Exception associated with the record.
text
Type: SystemString
The text of the log record, including parameters (e.g. Opening {Path} file {ShareMode} sharing mode).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
See Also

Reference

Logger Class
WriteException Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.WriteException(T1, T2, T3) Method (LogLevel, Exception, String, T1, T2, T3)

LoggerWriteExceptionT1, T2, T3 Method (LogLevel, Exception, String, T1, T2, T3)

Writes a custom log record with 3 parameters and associates it with an Exception.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void WriteException<T1, T2, T3>(
    LogLevel level,
    Exception exception,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel
The severity of the record (e.g. Warning or Error).
exception
Type: SystemException
The Exception associated with the record.
text
Type: SystemString
The text of the log record, including parameters (e.g. Opening {Path} file {ShareMode} sharing mode).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
See Also

Reference

Logger Class
WriteException Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.WriteException(T1, T2, T3, T4) Method (LogLevel, Exception, String, T1, T2, T3, T4)

LoggerWriteExceptionT1, T2, T3, T4 Method (LogLevel, Exception, String, T1, T2, T3, T4)

Writes a custom log record with 4 parameters and associates it with an Exception.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void WriteException<T1, T2, T3, T4>(
    LogLevel level,
    Exception exception,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel
The severity of the record (e.g. Warning or Error).
exception
Type: SystemException
The Exception associated with the record.
text
Type: SystemString
The text of the log record, including parameters (e.g. Opening {Path} file {ShareMode} sharing mode).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
See Also

Reference

Logger Class
WriteException Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.WriteException(T1, T2, T3, T4, T5) Method (LogLevel, Exception, String, T1, T2, T3, T4, T5)

LoggerWriteExceptionT1, T2, T3, T4, T5 Method (LogLevel, Exception, String, T1, T2, T3, T4, T5)

Writes a custom log record with 5 parameters and associates it with an Exception.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void WriteException<T1, T2, T3, T4, T5>(
    LogLevel level,
    Exception exception,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel
The severity of the record (e.g. Warning or Error).
exception
Type: SystemException
The Exception associated with the record.
text
Type: SystemString
The text of the log record, including parameters (e.g. Opening {Path} file {ShareMode} sharing mode).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
See Also

Reference

Logger Class
WriteException Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.WriteException(T1, T2, T3, T4, T5, T6) Method (LogLevel, Exception, String, T1, T2, T3, T4, T5, T6)

LoggerWriteExceptionT1, T2, T3, T4, T5, T6 Method (LogLevel, Exception, String, T1, T2, T3, T4, T5, T6)

Writes a custom log record with 6 parameters and associates it with an Exception.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void WriteException<T1, T2, T3, T4, T5, T6>(
    LogLevel level,
    Exception exception,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel
The severity of the record (e.g. Warning or Error).
exception
Type: SystemException
The Exception associated with the record.
text
Type: SystemString
The text of the log record, including parameters (e.g. Opening {Path} file {ShareMode} sharing mode).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
See Also

Reference

Logger Class
WriteException Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.WriteException(T1, T2, T3, T4, T5, T6, T7) Method (LogLevel, Exception, String, T1, T2, T3, T4, T5, T6, T7)

LoggerWriteExceptionT1, T2, T3, T4, T5, T6, T7 Method (LogLevel, Exception, String, T1, T2, T3, T4, T5, T6, T7)

Writes a custom log record with 7 parameters and associates it with an Exception.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void WriteException<T1, T2, T3, T4, T5, T6, T7>(
    LogLevel level,
    Exception exception,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel
The severity of the record (e.g. Warning or Error).
exception
Type: SystemException
The Exception associated with the record.
text
Type: SystemString
The text of the log record, including parameters (e.g. Opening {Path} file {ShareMode} sharing mode).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.
See Also

Reference

Logger Class
WriteException Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.WriteException(T1, T2, T3, T4, T5, T6, T7, T8) Method (LogLevel, Exception, String, T1, T2, T3, T4, T5, T6, T7, T8)

LoggerWriteExceptionT1, T2, T3, T4, T5, T6, T7, T8 Method (LogLevel, Exception, String, T1, T2, T3, T4, T5, T6, T7, T8)

Writes a custom log record with 8 parameters and associates it with an Exception.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void WriteException<T1, T2, T3, T4, T5, T6, T7, T8>(
    LogLevel level,
    Exception exception,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7,
    T8 arg8
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel
The severity of the record (e.g. Warning or Error).
exception
Type: SystemException
The Exception associated with the record.
text
Type: SystemString
The text of the log record, including parameters (e.g. Opening {Path} file {ShareMode} sharing mode).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.
arg8
Type: T8
Value of the 8-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.
T8
Type of the 8-th parameter.
See Also

Reference

Logger Class
WriteException Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.WriteException(T1, T2, T3, T4, T5, T6, T7, T8, T9) Method (LogLevel, Exception, String, T1, T2, T3, T4, T5, T6, T7, T8, T9)

LoggerWriteExceptionT1, T2, T3, T4, T5, T6, T7, T8, T9 Method (LogLevel, Exception, String, T1, T2, T3, T4, T5, T6, T7, T8, T9)

Writes a custom log record with 9 parameters and associates it with an Exception.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void WriteException<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
    LogLevel level,
    Exception exception,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7,
    T8 arg8,
    T9 arg9
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel
The severity of the record (e.g. Warning or Error).
exception
Type: SystemException
The Exception associated with the record.
text
Type: SystemString
The text of the log record, including parameters (e.g. Opening {Path} file {ShareMode} sharing mode).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.
arg8
Type: T8
Value of the 8-th parameter.
arg9
Type: T9
Value of the 9-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.
T8
Type of the 8-th parameter.
T9
Type of the 9-th parameter.
See Also

Reference

Logger Class
WriteException Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.WriteException(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) Method (LogLevel, Exception, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

LoggerWriteExceptionT1, T2, T3, T4, T5, T6, T7, T8, T9, T10 Method (LogLevel, Exception, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

Writes a custom log record with 10 parameters and associates it with an Exception.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void WriteException<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
    LogLevel level,
    Exception exception,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7,
    T8 arg8,
    T9 arg9,
    T10 arg10
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel
The severity of the record (e.g. Warning or Error).
exception
Type: SystemException
The Exception associated with the record.
text
Type: SystemString
The text of the log record, including parameters (e.g. Opening {Path} file {ShareMode} sharing mode).
arg1
Type: T1
Value of the first parameter.
arg2
Type: T2
Value of the second parameter.
arg3
Type: T3
Value of the third parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.
arg8
Type: T8
Value of the 8-th parameter.
arg9
Type: T9
Value of the 9-th parameter.
arg10
Type: T10
Value of the 10-th parameter.

Type Parameters

T1
Type of the first parameter.
T2
Type of the second parameter.
T3
Type of the third parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.
T8
Type of the 8-th parameter.
T9
Type of the 9-th parameter.
T10
Type of the 10-th parameter.
See Also

Reference

Logger Class
WriteException Overload
PostSharp.Patterns.Diagnostics Namespace


Logger.WriteExecutionPoint Method

LoggerWriteExecutionPoint Method

Emits a log record with the source file and line of the caller.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void WriteExecutionPoint()
See Also

Reference

Logger Class
PostSharp.Patterns.Diagnostics Namespace


LoggingAbstractSource Class

Exposes the current LoggingTypeSource for a given role and Type.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingAbstractSource

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class LoggingAbstractSource

The LoggingAbstractSource type exposes the following members.

Properties
 | Name | Description
Public property | Role | Gets the role.
Public property | Source | Gets the LoggingTypeSource currently assigned to Role and Type.
Public property | Type | Gets the Type/
Top
Methods
 | Name | Description
Public method | IsEnabled | Determines whether logging is enabled for a given LogLevel for the current Role and Type.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics Namespace


LoggingAbstractSource Properties

The LoggingAbstractSource type exposes the following members.

Properties
 | Name | Description
Public property | Role | Gets the role.
Public property | Source | Gets the LoggingTypeSource currently assigned to Role and Type.
Public property | Type | Gets the Type/
Top
See Also

Reference

LoggingAbstractSource Class
PostSharp.Patterns.Diagnostics Namespace


LoggingAbstractSource.Role Property

LoggingAbstractSourceRole Property

Gets the role.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string Role { get; }

Property Value

Type: String
See Also

Reference

LoggingAbstractSource Class
PostSharp.Patterns.Diagnostics Namespace


LoggingAbstractSource.Source Property

LoggingAbstractSourceSource Property

Gets the LoggingTypeSource currently assigned to Role and Type.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingTypeSource Source { get; }

Property Value

Type: LoggingTypeSource
See Also

Reference

LoggingAbstractSource Class
PostSharp.Patterns.Diagnostics Namespace


LoggingAbstractSource.Type Property

LoggingAbstractSourceType Property

Gets the Type/

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Type Type { get; }

Property Value

Type: Type
See Also

Reference

LoggingAbstractSource Class
PostSharp.Patterns.Diagnostics Namespace


LoggingAbstractSource Methods

The LoggingAbstractSource type exposes the following members.

Methods
 | Name | Description
Public method | IsEnabled | Determines whether logging is enabled for a given LogLevel for the current Role and Type.
Top
See Also

Reference

LoggingAbstractSource Class
PostSharp.Patterns.Diagnostics Namespace


LoggingAbstractSource.IsEnabled Method

LoggingAbstractSourceIsEnabled Method

Determines whether logging is enabled for a given LogLevel for the current Role and Type.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsEnabled(
    LogLevel level
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel
A LogLevel.

Return Value

Type: Boolean
true if logging is enabled, otherwise false.
Remarks

In case of exception in the logic of this method, this method will report the exception to the ExceptionHandler and return false.

See Also

Reference

LoggingAbstractSource Class
PostSharp.Patterns.Diagnostics Namespace


LoggingBackend Class

Base class for all logging back-ends (sometimes names sinks, targets, listeners) of the PostSharp logging system.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingBackend
PostSharp.Patterns.Diagnostics.Backends.NullNullLoggingBackend
PostSharp.Patterns.Diagnostics.BackendsTextLoggingBackend

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class LoggingBackend : IDisposable

The LoggingBackend type exposes the following members.

Constructors
 | Name | Description
Protected method | LoggingBackend | Initializes a new LoggingBackend.
Top
Properties
 | Name | Description
Public property | CurrentContext | Gets the current LoggingContext.
Public property | IsCorrupted |
Public property | IsDisposed | Determines whether the current LoggingBackend has been disposed.
Public property | IsEnabled | Determines whether the current LoggingBackend is currently enabled. This property has precedence over, and does not affect, the minimal log levels set through the SetLevel(LogLevel) method.
Public property | Options | Gets the formatting and rendering options for the current LoggingBackend.
Top
Methods
 | Name | Description
Protected method | CreateAsyncCustomActivityContext | Creates a new AsyncCustomActivityLoggingContext.
Protected method | CreateAsyncMethodContext | Creates a new AsyncMethodLoggingContext for a given async method.
Protected method | CreateEphemeralContext | Creates a new EphemeralLoggingContext.
Protected method | CreateIteratorContext | Creates a new IteratorLoggingContext for a given iterator method.
Public method | CreateRecordBuilder | Creates a new LogRecordBuilder.
Protected method | CreateSyncCustomActivityContext | Creates a new SyncCustomActivityLoggingContext.
Protected method | CreateSyncMethodContext | Creates a new SyncMethodLoggingContext for a given normal (non-async, non-iterator) method.
Protected method | CreateThreadContext | Creates a new ThreadLoggingContext.
Protected method | CreateTypeSource | Creates LoggingTypeSource for the given role and type.
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Protected method | Dispose(Boolean) | Disposes the current object.
Public method | GetAsyncContextOfTask | Gets the AsyncMethodLoggingContext associated with a Task.
Protected method | GetBackendOptions | Gets the formatting and rendering options for the current LoggingBackend.
Public method | GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace.
Public method | GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type.
Public method | GetThreadContext | Returns the ThreadLoggingContext for the current Thread.
Public method | OpenAsyncContext | Gets an AsyncMethodLoggingContext for a given async method.
Public method | OpenCustomActivityContext | Gets a LoggingContext for a custom activity (opened using OpenActivity(String) or OpenAsyncActivity(String)).
Public method | OpenEphemeralContext | Gets an EphemeralLoggingContext for use in a given method. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record.
Public method | OpenIteratorContext | Gets an IteratorLoggingContext for a given iterator method.
Public method | OpenSyncContext | Gets a SyncMethodLoggingContext for a given normal (non-async, non-iterator) method.
Top
Remarks

If you want to implement your own logging back-end, deriving from the TextLoggingBackend class, which implements standard logic for logging a text.

See Also

Reference

PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Handling Faults in the Logging Component


LoggingBackend Constructor

Initializes a new LoggingBackend.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected LoggingBackend()
See Also

Reference

LoggingBackend Class
PostSharp.Patterns.Diagnostics Namespace


LoggingBackend Properties

The LoggingBackend type exposes the following members.

Properties
 | Name | Description
Public property | CurrentContext | Gets the current LoggingContext.
Public property | IsCorrupted |
Public property | IsDisposed | Determines whether the current LoggingBackend has been disposed.
Public property | IsEnabled | Determines whether the current LoggingBackend is currently enabled. This property has precedence over, and does not affect, the minimal log levels set through the SetLevel(LogLevel) method.
Public property | Options | Gets the formatting and rendering options for the current LoggingBackend.
Top
See Also

Reference

LoggingBackend Class
PostSharp.Patterns.Diagnostics Namespace


LoggingBackend.CurrentContext Property

LoggingBackendCurrentContext Property

Gets the current LoggingContext.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingContext CurrentContext { get; }

Property Value

Type: LoggingContext
See Also

Reference

LoggingBackend Class
PostSharp.Patterns.Diagnostics Namespace


LoggingBackend.IsCorrupted Property

LoggingBackendIsCorrupted Property

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsCorrupted { get; }

Property Value

Type: Boolean
See Also

Reference

LoggingBackend Class
PostSharp.Patterns.Diagnostics Namespace


LoggingBackend.IsDisposed Property

LoggingBackendIsDisposed Property

Determines whether the current LoggingBackend has been disposed.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsDisposed { get; }

Property Value

Type: Boolean
See Also

Reference

LoggingBackend Class
PostSharp.Patterns.Diagnostics Namespace


LoggingBackend.IsEnabled Property

LoggingBackendIsEnabled Property

Determines whether the current LoggingBackend is currently enabled. This property has precedence over, and does not affect, the minimal log levels set through the SetLevel(LogLevel) method.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsEnabled { get; set; }

Property Value

Type: Boolean
See Also

Reference

LoggingBackend Class
PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Handling Faults in the Logging Component


LoggingBackend.Options Property

LoggingBackendOptions Property

Gets the formatting and rendering options for the current LoggingBackend.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingBackendOptions Options { get; }

Property Value

Type: LoggingBackendOptions
See Also

Reference

LoggingBackend Class
PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Customizing the Appearance of Log Records


LoggingBackend Methods

The LoggingBackend type exposes the following members.

Methods
 | Name | Description
Protected method | CreateAsyncCustomActivityContext | Creates a new AsyncCustomActivityLoggingContext.
Protected method | CreateAsyncMethodContext | Creates a new AsyncMethodLoggingContext for a given async method.
Protected method | CreateEphemeralContext | Creates a new EphemeralLoggingContext.
Protected method | CreateIteratorContext | Creates a new IteratorLoggingContext for a given iterator method.
Public method | CreateRecordBuilder | Creates a new LogRecordBuilder.
Protected method | CreateSyncCustomActivityContext | Creates a new SyncCustomActivityLoggingContext.
Protected method | CreateSyncMethodContext | Creates a new SyncMethodLoggingContext for a given normal (non-async, non-iterator) method.
Protected method | CreateThreadContext | Creates a new ThreadLoggingContext.
Protected method | CreateTypeSource | Creates LoggingTypeSource for the given role and type.
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Protected method | Dispose(Boolean) | Disposes the current object.
Public method | GetAsyncContextOfTask | Gets the AsyncMethodLoggingContext associated with a Task.
Protected method | GetBackendOptions | Gets the formatting and rendering options for the current LoggingBackend.
Public method | GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace.
Public method | GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type.
Public method | GetThreadContext | Returns the ThreadLoggingContext for the current Thread.
Public method | OpenAsyncContext | Gets an AsyncMethodLoggingContext for a given async method.
Public method | OpenCustomActivityContext | Gets a LoggingContext for a custom activity (opened using OpenActivity(String) or OpenAsyncActivity(String)).
Public method | OpenEphemeralContext | Gets an EphemeralLoggingContext for use in a given method. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record.
Public method | OpenIteratorContext | Gets an IteratorLoggingContext for a given iterator method.
Public method | OpenSyncContext | Gets a SyncMethodLoggingContext for a given normal (non-async, non-iterator) method.
Top
See Also

Reference

LoggingBackend Class
PostSharp.Patterns.Diagnostics Namespace


LoggingBackend.CreateAsyncCustomActivityContext Method

LoggingBackendCreateAsyncCustomActivityContext Method

Creates a new AsyncCustomActivityLoggingContext.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual AsyncCustomActivityLoggingContext CreateAsyncCustomActivityContext()

Return Value

Type: AsyncCustomActivityLoggingContext
A new AsyncCustomActivityLoggingContext.
See Also

Reference

LoggingBackend Class
PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


LoggingBackend.CreateAsyncMethodContext Method

LoggingBackendCreateAsyncMethodContext Method

Creates a new AsyncMethodLoggingContext for a given async method.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual AsyncMethodLoggingContext CreateAsyncMethodContext()

Return Value

Type: AsyncMethodLoggingContext
A new AsyncMethodLoggingContext.
See Also

Reference

LoggingBackend Class
PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


LoggingBackend.CreateEphemeralContext Method

LoggingBackendCreateEphemeralContext Method

Creates a new EphemeralLoggingContext.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual EphemeralLoggingContext CreateEphemeralContext(
    ThreadLoggingContext threadContext
)

Parameters

threadContext
Type: PostSharp.Patterns.Diagnostics.ContextsThreadLoggingContext
The ThreadLoggingContext in which the new EphemeralLoggingContext will be used.

Return Value

Type: EphemeralLoggingContext
A new EphemeralLoggingContext to be use only in the thread of threadContext.
See Also

Reference

LoggingBackend Class
PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


LoggingBackend.CreateIteratorContext Method

LoggingBackendCreateIteratorContext Method

Creates a new IteratorLoggingContext for a given iterator method.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual IteratorLoggingContext CreateIteratorContext()

Return Value

Type: IteratorLoggingContext
See Also

Reference

LoggingBackend Class
PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


LoggingBackend.CreateRecordBuilder Method

LoggingBackendCreateRecordBuilder Method

Creates a new LogRecordBuilder.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract LogRecordBuilder CreateRecordBuilder()

Return Value

Type: LogRecordBuilder
A new LogRecordBuilder.
See Also

Reference

LoggingBackend Class
PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


LoggingBackend.CreateSyncCustomActivityContext Method

LoggingBackendCreateSyncCustomActivityContext Method

Creates a new SyncCustomActivityLoggingContext.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual SyncCustomActivityLoggingContext CreateSyncCustomActivityContext(
    ThreadLoggingContext threadContext
)

Parameters

threadContext
Type: PostSharp.Patterns.Diagnostics.ContextsThreadLoggingContext
The ThreadLoggingContext in which the SyncCustomActivityLoggingContext will be used.

Return Value

Type: SyncCustomActivityLoggingContext
A new SyncCustomActivityLoggingContext to be used only in the thread of threadContext.
See Also

Reference

LoggingBackend Class
PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


LoggingBackend.CreateSyncMethodContext Method

LoggingBackendCreateSyncMethodContext Method

Creates a new SyncMethodLoggingContext for a given normal (non-async, non-iterator) method.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual SyncMethodLoggingContext CreateSyncMethodContext(
    ThreadLoggingContext threadContext
)

Parameters

threadContext
Type: PostSharp.Patterns.Diagnostics.ContextsThreadLoggingContext
The ThreadLoggingContext in which the method is executed.

Return Value

Type: SyncMethodLoggingContext
A new SyncMethodLoggingContext to be used only in the thread of threadContext.
See Also

Reference

LoggingBackend Class
PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


LoggingBackend.CreateThreadContext Method

LoggingBackendCreateThreadContext Method

Creates a new ThreadLoggingContext.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual ThreadLoggingContext CreateThreadContext()

Return Value

Type: ThreadLoggingContext
A new ThreadLoggingContext.
See Also

Reference

LoggingBackend Class
PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


LoggingBackend.CreateTypeSource Method

LoggingBackendCreateTypeSource Method

Creates LoggingTypeSource for the given role and type.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected abstract LoggingTypeSource CreateTypeSource(
    LoggingNamespaceSource parent,
    Type type
)

Parameters

parent
Type: PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
type
Type: SystemType

Return Value

Type: LoggingTypeSource
See Also

Reference

LoggingBackend Class
PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


LoggingBackend.Dispose Method

LoggingBackendDispose Method

Overload List
 | Name | Description
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Protected method | Dispose(Boolean) | Disposes the current object.
Top
See Also

Reference

LoggingBackend Class
PostSharp.Patterns.Diagnostics Namespace


LoggingBackend.Dispose Method

LoggingBackendDispose Method

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Dispose()

Implements

IDisposableDispose
See Also

Reference

LoggingBackend Class
Dispose Overload
PostSharp.Patterns.Diagnostics Namespace


LoggingBackend.Dispose Method (Boolean)

LoggingBackendDispose Method (Boolean)

Disposes the current object.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void Dispose(
    bool disposing
)

Parameters

disposing
Type: SystemBoolean
true if the Dispose method has been called, false if the object is being finalized by the garbage collector.
See Also

Reference

LoggingBackend Class
Dispose Overload
PostSharp.Patterns.Diagnostics Namespace


LoggingBackend.GetAsyncContextOfTask Method

LoggingBackendGetAsyncContextOfTask Method

Gets the AsyncMethodLoggingContext associated with a Task.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AsyncMethodLoggingContext GetAsyncContextOfTask(
    Task task
)

Parameters

task
Type: System.Threading.TasksTask
A Task (typically representing an async method).

Return Value

Type: AsyncMethodLoggingContext
The AsyncMethodLoggingContext associated with task, or null if no AsyncMethodLoggingContext is associated with task.
See Also

Reference

LoggingBackend Class
PostSharp.Patterns.Diagnostics Namespace


LoggingBackend.GetBackendOptions Method

LoggingBackendGetBackendOptions Method

Gets the formatting and rendering options for the current LoggingBackend.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected abstract LoggingBackendOptions GetBackendOptions()

Return Value

Type: LoggingBackendOptions
The LoggingBackendOptions for the current LoggingBackend.
See Also

Reference

LoggingBackend Class
PostSharp.Patterns.Diagnostics Namespace


LoggingBackend.GetSource Method

LoggingBackendGetSource Method

Overload List
 | Name | Description
Public method | GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace.
Public method | GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type.
Top
See Also

Reference

LoggingBackend Class
PostSharp.Patterns.Diagnostics Namespace


LoggingBackend.GetSource Method (String, String)

LoggingBackendGetSource Method (String, String)

Returns a LoggingNamespaceSource for the given role and, optionally, namespace.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingNamespaceSource GetSource(
    string role,
    string ns = null
)

Parameters

role
Type: SystemString
The role. Typically one of the constants of the LoggingRoles type, or a custom role.
ns (Optional)
Type: SystemString
The namespace for which the LoggingNamespaceSource is requested, or null if the LoggingNamespaceSource is requested for the root namespace.

Return Value

Type: LoggingNamespaceSource
The LoggingNamespaceSource for role and ns. If no LoggingNamespaceSource exists for this role and type, this method shall create a new LoggingNamespaceSource.
See Also

Reference

LoggingBackend Class
GetSource Overload
PostSharp.Patterns.Diagnostics Namespace


LoggingBackend.GetSource Method (String, Type)

LoggingBackendGetSource Method (String, Type)

Returns a LoggingTypeSource for the given role and type.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingTypeSource GetSource(
    string role,
    Type type
)

Parameters

role
Type: SystemString
The role. Typically one of the constants of the LoggingRoles type, or a custom role.
type
Type: SystemType
The type.

Return Value

Type: LoggingTypeSource
The LoggingTypeSource for role and type. If no LoggingTypeSource exists for this role and type, this method shall create a new LoggingTypeSource.
See Also

Reference

LoggingBackend Class
GetSource Overload
PostSharp.Patterns.Diagnostics Namespace


LoggingBackend.GetThreadContext Method

LoggingBackendGetThreadContext Method

Returns the ThreadLoggingContext for the current Thread.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ThreadLoggingContext GetThreadContext()

Return Value

Type: ThreadLoggingContext
See Also

Reference

LoggingBackend Class
PostSharp.Patterns.Diagnostics Namespace


LoggingBackend.OpenAsyncContext Method

LoggingBackendOpenAsyncContext Method

Gets an AsyncMethodLoggingContext for a given async method.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AsyncMethodLoggingContext OpenAsyncContext(
    AsyncCallId asyncCallId,
    ref LogMemberInfo logMemberInfo
)

Parameters

asyncCallId
Type: PostSharp.AspectsAsyncCallId
The Task associated to the async method being logged, or null if the Task cannot be determined.
logMemberInfo
Type: PostSharp.Patterns.Diagnostics.ContextsLogMemberInfo
A reference to a LogMemberInfo describing the method being logged.

Return Value

Type: AsyncMethodLoggingContext
An AsyncMethodLoggingContext for logMemberInfo.
See Also

Reference

LoggingBackend Class
PostSharp.Patterns.Diagnostics Namespace


LoggingBackend.OpenCustomActivityContext Method

LoggingBackendOpenCustomActivityContext Method

Gets a LoggingContext for a custom activity (opened using OpenActivity(String) or OpenAsyncActivity(String)).

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingContext OpenCustomActivityContext(
    LoggingTypeSource type,
    LogActivityOptions options
)

Parameters

type
Type: PostSharp.Patterns.DiagnosticsLoggingTypeSource
The type to which the activity belongs.
options
Type: PostSharp.Patterns.DiagnosticsLogActivityOptions
Options of the new activity.

Return Value

Type: LoggingContext
A SyncCustomActivityLoggingContext if options.IsAsync is false, otherwise an AsyncCustomActivityLoggingContext.
See Also

Reference

LoggingBackend Class
PostSharp.Patterns.Diagnostics Namespace


LoggingBackend.OpenEphemeralContext Method

LoggingBackendOpenEphemeralContext Method

Gets an EphemeralLoggingContext for use in a given method. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public EphemeralLoggingContext OpenEphemeralContext(
    ref LogMemberInfo logMemberInfo
)

Parameters

logMemberInfo
Type: PostSharp.Patterns.Diagnostics.ContextsLogMemberInfo
A reference to a LogMemberInfo describing the method in which the record will be emitted.

Return Value

Type: EphemeralLoggingContext
An EphemeralLoggingContext.
See Also

Reference

LoggingBackend Class
PostSharp.Patterns.Diagnostics Namespace


LoggingBackend.OpenIteratorContext Method

LoggingBackendOpenIteratorContext Method

Gets an IteratorLoggingContext for a given iterator method.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IteratorLoggingContext OpenIteratorContext(
    IEnumerator enumerator,
    ref LogMemberInfo logMemberInfo
)

Parameters

enumerator
Type: System.CollectionsIEnumerator
The IEnumerator associated with the method to be logged.
logMemberInfo
Type: PostSharp.Patterns.Diagnostics.ContextsLogMemberInfo
A reference to a LogMemberInfo describing the method being logged.

Return Value

Type: IteratorLoggingContext
An IteratorLoggingContext for logMemberInfo.
See Also

Reference

LoggingBackend Class
PostSharp.Patterns.Diagnostics Namespace


LoggingBackend.OpenSyncContext Method

LoggingBackendOpenSyncContext Method

Gets a SyncMethodLoggingContext for a given normal (non-async, non-iterator) method.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SyncMethodLoggingContext OpenSyncContext(
    ref LogMemberInfo logMemberInfo
)

Parameters

logMemberInfo
Type: PostSharp.Patterns.Diagnostics.ContextsLogMemberInfo
A reference to a LogMemberInfo describing the method being logged.

Return Value

Type: SyncMethodLoggingContext
A SyncMethodLoggingContext for logMemberInfo.
See Also

Reference

LoggingBackend Class
PostSharp.Patterns.Diagnostics Namespace


LoggingBackendOptions Class

Options for the LoggingBackend class.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingBackendOptions
PostSharp.Patterns.Diagnostics.BackendsTextLoggingBackendOptions

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class LoggingBackendOptions

The LoggingBackendOptions type exposes the following members.

Constructors
 | Name | Description
Public method | LoggingBackendOptions | Initializes a new instance of the LoggingBackendOptions class
Top
Properties
 | Name | Description
Public property | ContextMaxLength | Max length of the Description property.
Public property | LogLevelIgnoredForSystemRecords | Determines whether the Level property is ignored by the current back-end for auto-generated (i.e. non-manual) logging records. Some back-ends may not support overriding the level of records.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Enabling and Disabling Logging At Run Time


LoggingBackendOptions Constructor

Initializes a new instance of the LoggingBackendOptions class

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingBackendOptions()
See Also

Reference

LoggingBackendOptions Class
PostSharp.Patterns.Diagnostics Namespace


LoggingBackendOptions Properties

The LoggingBackendOptions type exposes the following members.

Properties
 | Name | Description
Public property | ContextMaxLength | Max length of the Description property.
Public property | LogLevelIgnoredForSystemRecords | Determines whether the Level property is ignored by the current back-end for auto-generated (i.e. non-manual) logging records. Some back-ends may not support overriding the level of records.
Top
See Also

Reference

LoggingBackendOptions Class
PostSharp.Patterns.Diagnostics Namespace


LoggingBackendOptions.ContextMaxLength Property

LoggingBackendOptionsContextMaxLength Property

Max length of the Description property.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int ContextMaxLength { get; set; }

Property Value

Type: Int32
Remarks

This property determines the size of the buffer allocated to build the Description property. If the real length exceeds the value of ContextMaxLength, no exception is thrown, and the excess content is ignored.

See Also

Reference

LoggingBackendOptions Class
PostSharp.Patterns.Diagnostics Namespace


LoggingBackendOptions.LogLevelIgnoredForSystemRecords Property

LoggingBackendOptionsLogLevelIgnoredForSystemRecords Property

Determines whether the Level property is ignored by the current back-end for auto-generated (i.e. non-manual) logging records. Some back-ends may not support overriding the level of records.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual bool LogLevelIgnoredForSystemRecords { get; }

Property Value

Type: Boolean
See Also

Reference

LoggingBackendOptions Class
PostSharp.Patterns.Diagnostics Namespace


LoggingBuildTimeConfiguration Class

Root element of the XML configuration (postsharp.config) for the Logging component.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingBuildTimeConfiguration

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class LoggingBuildTimeConfiguration

The LoggingBuildTimeConfiguration type exposes the following members.

Constructors
 | Name | Description
Public method | LoggingBuildTimeConfiguration | Initializes a new instance of the LoggingBuildTimeConfiguration class
Top
Properties
 | Name | Description
Public property | Profiles | Gets the collection of logging profiles.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics Namespace


LoggingBuildTimeConfiguration Constructor

Initializes a new instance of the LoggingBuildTimeConfiguration class

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingBuildTimeConfiguration()
See Also

Reference

LoggingBuildTimeConfiguration Class
PostSharp.Patterns.Diagnostics Namespace


LoggingBuildTimeConfiguration Properties

The LoggingBuildTimeConfiguration type exposes the following members.

Properties
 | Name | Description
Public property | Profiles | Gets the collection of logging profiles.
Top
See Also

Reference

LoggingBuildTimeConfiguration Class
PostSharp.Patterns.Diagnostics Namespace


LoggingBuildTimeConfiguration.Profiles Property

LoggingBuildTimeConfigurationProfiles Property

Gets the collection of logging profiles.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingProfileCollection Profiles { get; }

Property Value

Type: LoggingProfileCollection
See Also

Reference

LoggingBuildTimeConfiguration Class
PostSharp.Patterns.Diagnostics Namespace


LoggingContextMismatchException Class

Inheritance Hierarchy
SystemObject
SystemException
PostSharp.Patterns.DiagnosticsLoggingContextMismatchException

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public class LoggingContextMismatchException : Exception
Constructors
 | Name | Description
Public method | LoggingContextMismatchException | Initializes a new instance of the LoggingContextMismatchException class
Public method | LoggingContextMismatchException(String) | Initializes a new instance of the LoggingContextMismatchException class
Protected method | LoggingContextMismatchException(SerializationInfo, StreamingContext) | Initializes a new instance of the LoggingContextMismatchException class
Public method | LoggingContextMismatchException(String, Exception) | Initializes a new instance of the LoggingContextMismatchException class
Top
See Also

Reference

PostSharp.Patterns.Diagnostics Namespace


LoggingContextMismatchException Constructor

Overload List
 | Name | Description
Public method | LoggingContextMismatchException | Initializes a new instance of the LoggingContextMismatchException class
Public method | LoggingContextMismatchException(String) | Initializes a new instance of the LoggingContextMismatchException class
Protected method | LoggingContextMismatchException(SerializationInfo, StreamingContext) | Initializes a new instance of the LoggingContextMismatchException class
Public method | LoggingContextMismatchException(String, Exception) | Initializes a new instance of the LoggingContextMismatchException class
Top
See Also

Reference

LoggingContextMismatchException Class
PostSharp.Patterns.Diagnostics Namespace


LoggingContextMismatchException Constructor

Initializes a new instance of the LoggingContextMismatchException class

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingContextMismatchException()
See Also

Reference

LoggingContextMismatchException Class
LoggingContextMismatchException Overload
PostSharp.Patterns.Diagnostics Namespace


LoggingContextMismatchException Constructor (String)

Initializes a new instance of the LoggingContextMismatchException class

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingContextMismatchException(
    string message
)

Parameters

message
Type: SystemString
See Also

Reference

LoggingContextMismatchException Class
LoggingContextMismatchException Overload
PostSharp.Patterns.Diagnostics Namespace


LoggingContextMismatchException Constructor (SerializationInfo, StreamingContext)

Initializes a new instance of the LoggingContextMismatchException class

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected LoggingContextMismatchException(
    SerializationInfo info,
    StreamingContext context
)

Parameters

info
Type: System.Runtime.SerializationSerializationInfo
context
Type: System.Runtime.SerializationStreamingContext
See Also

Reference

LoggingContextMismatchException Class
LoggingContextMismatchException Overload
PostSharp.Patterns.Diagnostics Namespace


LoggingContextMismatchException Constructor (String, Exception)

Initializes a new instance of the LoggingContextMismatchException class

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingContextMismatchException(
    string message,
    Exception inner
)

Parameters

message
Type: SystemString
inner
Type: SystemException
See Also

Reference

LoggingContextMismatchException Class
LoggingContextMismatchException Overload
PostSharp.Patterns.Diagnostics Namespace


LoggingExceptionInfo Class

Arguments of the OnInternalException(LoggingExceptionInfo) method.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingExceptionInfo

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class LoggingExceptionInfo

The LoggingExceptionInfo type exposes the following members.

Properties
 | Name | Description
Public property | Backend | Gets the LoggingBackend from which the exception stems, or null.
Public property | Exception | Gets the Exception object, or null if the Exception object has been lost, which is the case when there is an exception while logging
Public property | Source | Gets the LoggingNamespaceSource to which the exception is related, or null.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics Namespace


LoggingExceptionInfo Properties

The LoggingExceptionInfo type exposes the following members.

Properties
 | Name | Description
Public property | Backend | Gets the LoggingBackend from which the exception stems, or null.
Public property | Exception | Gets the Exception object, or null if the Exception object has been lost, which is the case when there is an exception while logging
Public property | Source | Gets the LoggingNamespaceSource to which the exception is related, or null.
Top
See Also

Reference

LoggingExceptionInfo Class
PostSharp.Patterns.Diagnostics Namespace


LoggingExceptionInfo.Backend Property

LoggingExceptionInfoBackend Property

Gets the LoggingBackend from which the exception stems, or null.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingBackend Backend { get; }

Property Value

Type: LoggingBackend
See Also

Reference

LoggingExceptionInfo Class
PostSharp.Patterns.Diagnostics Namespace


LoggingExceptionInfo.Exception Property

LoggingExceptionInfoException Property

Gets the Exception object, or null if the Exception object has been lost, which is the case when there is an exception while logging

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Exception Exception { get; }

Property Value

Type: Exception
See Also

Reference

LoggingExceptionInfo Class
PostSharp.Patterns.Diagnostics Namespace


LoggingExceptionInfo.Source Property

LoggingExceptionInfoSource Property

Gets the LoggingNamespaceSource to which the exception is related, or null.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingNamespaceSource Source { get; }

Property Value

Type: LoggingNamespaceSource
See Also

Reference

LoggingExceptionInfo Class
PostSharp.Patterns.Diagnostics Namespace


LoggingNamespaceSource Class

Allows to enable or disable logging for a whole namespace.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
PostSharp.Patterns.DiagnosticsLoggingTypeSource

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class LoggingNamespaceSource

The LoggingNamespaceSource type exposes the following members.

Properties
 | Name | Description
Public property | Backend | Gets the parent LoggingBackend.
Public property | DisplayFullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the DisplayFullName property does not include the arity, i.e. the full name of List<T> is System.Collections.Generic.List.
Public property | DisplayName | Gets the last component of the name of the type or namespace, in the form that should be reported to the log. For generic types, the DisplayName property does not include the arity, i.e. the name of List<T> is List.
Public property | FullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the FullName property includes the arity, i.e. the full name of List<T> is System.Collections.Generic.List`1.
Public property | Level | Gets the minimal LogLevel for which logging is enabled for the current namespace or type.
Public property | Name | Gets the last component of the name of the type or namespace. For instance, when FullName is PostSharp.Patterns.Diagnostics.LoggingBackend, Name is LoggingBackend. For generic types, the Name property includes the arity, i.e. the name of List<T> is List`1.
Public property | Parent | Gets the parent LoggingNamespaceSource, or null if the current object represents the root namespace.
Public property | Role | Gets the logging role for the current role. Typical values of this property are listed in the LoggingRoles class.
Top
Methods
 | Name | Description
Public method | Refresh | Refreshes the logging level from the back-end from the current node and all children nodes. The back-end-defined logging level is cached for performance reasons.
Public method | SetLevel | Sets the minimal LogLevel for which logging is enabled for the current namespace and type and all children namespaces and types.
Top
Remarks

Instances of the LoggingNamespaceSource and LoggingTypeSource classes form a forest where the roots are instances of the LoggingNamespaceSource, once instance per value of the Role property, where the FullName property is null, and LoggingTypeSource are the leaves of the trees.

See Also

Reference

PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Enabling and Disabling Logging At Run Time


LoggingNamespaceSource Properties

The LoggingNamespaceSource type exposes the following members.

Properties
 | Name | Description
Public property | Backend | Gets the parent LoggingBackend.
Public property | DisplayFullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the DisplayFullName property does not include the arity, i.e. the full name of List<T> is System.Collections.Generic.List.
Public property | DisplayName | Gets the last component of the name of the type or namespace, in the form that should be reported to the log. For generic types, the DisplayName property does not include the arity, i.e. the name of List<T> is List.
Public property | FullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the FullName property includes the arity, i.e. the full name of List<T> is System.Collections.Generic.List`1.
Public property | Level | Gets the minimal LogLevel for which logging is enabled for the current namespace or type.
Public property | Name | Gets the last component of the name of the type or namespace. For instance, when FullName is PostSharp.Patterns.Diagnostics.LoggingBackend, Name is LoggingBackend. For generic types, the Name property includes the arity, i.e. the name of List<T> is List`1.
Public property | Parent | Gets the parent LoggingNamespaceSource, or null if the current object represents the root namespace.
Public property | Role | Gets the logging role for the current role. Typical values of this property are listed in the LoggingRoles class.
Top
See Also

Reference

LoggingNamespaceSource Class
PostSharp.Patterns.Diagnostics Namespace


LoggingNamespaceSource.Backend Property

LoggingNamespaceSourceBackend Property

Gets the parent LoggingBackend.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingBackend Backend { get; }

Property Value

Type: LoggingBackend
See Also

Reference

LoggingNamespaceSource Class
PostSharp.Patterns.Diagnostics Namespace


LoggingNamespaceSource.DisplayFullName Property

LoggingNamespaceSourceDisplayFullName Property

Gets the full name of the current type or namespace (including the parent namespace). For generic types, the DisplayFullName property does not include the arity, i.e. the full name of List<T> is  System.Collections.Generic.List.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string DisplayFullName { get; }

Property Value

Type: String
See Also

Reference

LoggingNamespaceSource Class
PostSharp.Patterns.Diagnostics Namespace


LoggingNamespaceSource.DisplayName Property

LoggingNamespaceSourceDisplayName Property

Gets the last component of the name of the type or namespace, in the form that should be reported to the log. For generic types, the DisplayName property does not include the arity, i.e. the name of List<T> is List.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string DisplayName { get; }

Property Value

Type: String
See Also

Reference

LoggingNamespaceSource Class
PostSharp.Patterns.Diagnostics Namespace


LoggingNamespaceSource.FullName Property

LoggingNamespaceSourceFullName Property

Gets the full name of the current type or namespace (including the parent namespace). For generic types, the FullName property includes the arity, i.e. the full name of List<T> is  System.Collections.Generic.List`1.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string FullName { get; }

Property Value

Type: String
See Also

Reference

LoggingNamespaceSource Class
PostSharp.Patterns.Diagnostics Namespace


LoggingNamespaceSource.Level Property

LoggingNamespaceSourceLevel Property

Gets the minimal LogLevel for which logging is enabled for the current namespace or type.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogLevel Level { get; }

Property Value

Type: LogLevel
See Also

Reference

LoggingNamespaceSource Class
PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Enabling and Disabling Logging At Run Time


LoggingNamespaceSource.Name Property

LoggingNamespaceSourceName Property

Gets the last component of the name of the type or namespace. For instance, when FullName is PostSharp.Patterns.Diagnostics.LoggingBackend, Name is LoggingBackend. For generic types, the Name property includes the arity, i.e. the name of List<T> is List`1.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string Name { get; }

Property Value

Type: String
See Also

Reference

LoggingNamespaceSource Class
PostSharp.Patterns.Diagnostics Namespace


LoggingNamespaceSource.Parent Property

LoggingNamespaceSourceParent Property

Gets the parent LoggingNamespaceSource, or null if the current object represents the root namespace.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingNamespaceSource Parent { get; }

Property Value

Type: LoggingNamespaceSource
See Also

Reference

LoggingNamespaceSource Class
PostSharp.Patterns.Diagnostics Namespace


LoggingNamespaceSource.Role Property

LoggingNamespaceSourceRole Property

Gets the logging role for the current role. Typical values of this property are listed in the LoggingRoles class.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string Role { get; }

Property Value

Type: String
See Also

Reference

LoggingNamespaceSource Class
PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Enabling and Disabling Logging At Run Time


LoggingNamespaceSource Methods

The LoggingNamespaceSource type exposes the following members.

Methods
 | Name | Description
Public method | Refresh | Refreshes the logging level from the back-end from the current node and all children nodes. The back-end-defined logging level is cached for performance reasons.
Public method | SetLevel | Sets the minimal LogLevel for which logging is enabled for the current namespace and type and all children namespaces and types.
Top
See Also

Reference

LoggingNamespaceSource Class
PostSharp.Patterns.Diagnostics Namespace


LoggingNamespaceSource.Refresh Method

LoggingNamespaceSourceRefresh Method

Refreshes the logging level from the back-end from the current node and all children nodes. The back-end-defined logging level is cached for performance reasons.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void Refresh()
See Also

Reference

LoggingNamespaceSource Class
PostSharp.Patterns.Diagnostics Namespace


LoggingNamespaceSource.SetLevel Method

LoggingNamespaceSourceSetLevel Method

Sets the minimal LogLevel for which logging is enabled for the current namespace and type and all children namespaces and types.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void SetLevel(
    LogLevel level
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel
See Also

Reference

LoggingNamespaceSource Class
PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Enabling and Disabling Logging At Run Time


LoggingOptions Class

Represents the build-time options for logging records. This class is exposed by DefaultOptions and ExceptionOptions. The values of this class cannot be changed at run-time because they influence the way PostSharp instruments the code.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingOptions

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class LoggingOptions

The LoggingOptions type exposes the following members.

Constructors
 | Name | Description
Public method | LoggingOptions | Initializes a new LoggingOptions.
Top
Properties
 | Name | Description
Public property | IncludeGenericParameters | Not implemented.
Public property | IncludeParameterName | Determines whether the parameter names should be logged. The default value is false.
Public property | IncludeParameterType | Determines whether the parameter types should be logged. The default value is false.
Public property | IncludeParameterValue | Determines whether the parameter values should be logged. The default value is true.
Public property | IncludeReturnValue | Determines whether the return value should be logged. The default value is true.
Public property | IncludeThisValue | Determines whether the value of this argument in an instance method should be logged. The default value is false.
Public property | Level | Gets or sets the LogLevel with which the record should be emitted. The default value is Debug.
Top
Methods
 | Name | Description
Public method | Clone | Returns a clone of the current object.
Public method | Freeze | Prevents the object from being modified.
Public method | Merge | Merges the values of another LoggingOptions object within the current object. The values of the other object take precendence over the values of the current object.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Customizing the Appearance of Log Records


LoggingOptions Constructor

Initializes a new LoggingOptions.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingOptions()
See Also

Reference

LoggingOptions Class
PostSharp.Patterns.Diagnostics Namespace


LoggingOptions Properties

The LoggingOptions type exposes the following members.

Properties
 | Name | Description
Public property | IncludeGenericParameters | Not implemented.
Public property | IncludeParameterName | Determines whether the parameter names should be logged. The default value is false.
Public property | IncludeParameterType | Determines whether the parameter types should be logged. The default value is false.
Public property | IncludeParameterValue | Determines whether the parameter values should be logged. The default value is true.
Public property | IncludeReturnValue | Determines whether the return value should be logged. The default value is true.
Public property | IncludeThisValue | Determines whether the value of this argument in an instance method should be logged. The default value is false.
Public property | Level | Gets or sets the LogLevel with which the record should be emitted. The default value is Debug.
Top
See Also

Reference

LoggingOptions Class
PostSharp.Patterns.Diagnostics Namespace


LoggingOptions.IncludeGenericParameters Property

LoggingOptionsIncludeGenericParameters Property

Not implemented.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IncludeGenericParameters { get; set; }

Property Value

Type: Boolean
See Also

Reference

LoggingOptions Class
PostSharp.Patterns.Diagnostics Namespace


LoggingOptions.IncludeParameterName Property

LoggingOptionsIncludeParameterName Property

Determines whether the parameter names should be logged. The default value is false.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IncludeParameterName { get; set; }

Property Value

Type: Boolean
See Also

Reference

LoggingOptions Class
PostSharp.Patterns.Diagnostics Namespace


LoggingOptions.IncludeParameterType Property

LoggingOptionsIncludeParameterType Property

Determines whether the parameter types should be logged. The default value is false.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IncludeParameterType { get; set; }

Property Value

Type: Boolean
See Also

Reference

LoggingOptions Class
PostSharp.Patterns.Diagnostics Namespace


LoggingOptions.IncludeParameterValue Property

LoggingOptionsIncludeParameterValue Property

Determines whether the parameter values should be logged. The default value is true.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IncludeParameterValue { get; set; }

Property Value

Type: Boolean
See Also

Reference

LoggingOptions Class
PostSharp.Patterns.Diagnostics Namespace


LoggingOptions.IncludeReturnValue Property

LoggingOptionsIncludeReturnValue Property

Determines whether the return value should be logged. The default value is true.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IncludeReturnValue { get; set; }

Property Value

Type: Boolean
See Also

Reference

LoggingOptions Class
PostSharp.Patterns.Diagnostics Namespace


LoggingOptions.IncludeThisValue Property

LoggingOptionsIncludeThisValue Property

Determines whether the value of this argument in an instance method should be logged. The default value is false.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IncludeThisValue { get; set; }

Property Value

Type: Boolean
See Also

Reference

LoggingOptions Class
PostSharp.Patterns.Diagnostics Namespace


LoggingOptions.Level Property

LoggingOptionsLevel Property

Gets or sets the LogLevel with which the record should be emitted. The default value is Debug.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogLevel Level { get; set; }

Property Value

Type: LogLevel
See Also

Reference

LoggingOptions Class
PostSharp.Patterns.Diagnostics Namespace


LoggingOptions Methods

The LoggingOptions type exposes the following members.

Methods
 | Name | Description
Public method | Clone | Returns a clone of the current object.
Public method | Freeze | Prevents the object from being modified.
Public method | Merge | Merges the values of another LoggingOptions object within the current object. The values of the other object take precendence over the values of the current object.
Top
See Also

Reference

LoggingOptions Class
PostSharp.Patterns.Diagnostics Namespace


LoggingOptions.Clone Method

LoggingOptionsClone Method

Returns a clone of the current object.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual LoggingOptions Clone()

Return Value

Type: LoggingOptions
See Also

Reference

LoggingOptions Class
PostSharp.Patterns.Diagnostics Namespace


LoggingOptions.Freeze Method

LoggingOptionsFreeze Method

Prevents the object from being modified.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void Freeze()
See Also

Reference

LoggingOptions Class
PostSharp.Patterns.Diagnostics Namespace


LoggingOptions.Merge Method

LoggingOptionsMerge Method

Merges the values of another LoggingOptions object within the current object. The values of the other object take precendence over the values of the current object.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Merge(
    LoggingOptions overridingOptions
)

Parameters

overridingOptions
Type: PostSharp.Patterns.DiagnosticsLoggingOptions
Values to be merged into the current object.
See Also

Reference

LoggingOptions Class
PostSharp.Patterns.Diagnostics Namespace


LoggingProfile Class

Logging profiles are named configurations of logging aspects and influence the way PostSharp generates the code instrumentation. They are typically instantiated in postsharp.config.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingProfile

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class LoggingProfile

The LoggingProfile type exposes the following members.

Constructors
 | Name | Description
Public method | LoggingProfile | Initializes a new instance of the LoggingProfile class
Top
Properties
 | Name | Description
Public property | AllowDynamicEnabling | Determines whether logging can be dynamically enabled or disabled after initialization. The default value of this property is true. When it is set to false, PostSharp generates code that allows the JIT compiler to completely remove logging instructions for types that are not enabled.
Public property | Backend | Gets the LoggingBackend associated with the current profile.
Public property | DefaultOptions | Gets or sets the options for "normal" records, e.g. method entry, method success, or value change.
Public property | Description | Gets or sets a human-readable description for the current profile. The description is only used when representing the profile in PostSharp Tools for Visual Studio.
Public property | EnabledRecordKinds | Gets or sets the set of record kinds that are enabled for the given profile. Change it with care. Not all combinations are tested.
Public property | ExceptionOptions | Gets or sets the options for "exception" records, e.g. method exceptions or slow executions.
Public property | ExecutionTimeThreshold | Gets or sets the warning threshold, in milliseconds. If the execution of a method takes longer than that, its success is logged with Warning, and the time it took is logged. If the value is 0, this feature is disabled.
Public property | IncludeAwaitedTask | Determines whether the operand of the await operator should be included in the log.
Public property | IncludeExecutionTime | Indicates that the execution time of a method should be tracked and logged on exit.
Public property | IncludeSourceLineInfo | Determines whether source-line information should be included in the log.
Public property | Name | Gets or sets the name of the current profile. The name of the profile should match the constructor argument of the LogAttribute aspect.
Public property | Role | Gets or sets the role of the current profile. Profiles of different roles can have different run-time options, including different back-ends. See Roles to access role-based run-time options.
Top
Methods
 | Name | Description
Protected method | EnsureNotFrozen | Throws an InvalidOperationException if the Freeze method has been called on this object.
Protected method | Freeze | Prevents changes in the current object.
Public method | GetAbstractSource | Gets the LoggingAbstractSource for a given Type in the current profile.
Public method | ToString | Returns a string that represents the current object. (Overrides ObjectToString.)
Top
Remarks

Logging profiles can then be referred to from the LogAttribute. There are two system-defined logging profiles, Default (the default profile for LogAttribute), Exceptions (default for LogExceptionAttribute), and Audit (default for AuditAttribute).

See Also

Reference

PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Customizing the Appearance of Log Records


LoggingProfile Constructor

Initializes a new instance of the LoggingProfile class

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingProfile()
See Also

Reference

LoggingProfile Class
PostSharp.Patterns.Diagnostics Namespace


LoggingProfile Properties

The LoggingProfile type exposes the following members.

Properties
 | Name | Description
Public property | AllowDynamicEnabling | Determines whether logging can be dynamically enabled or disabled after initialization. The default value of this property is true. When it is set to false, PostSharp generates code that allows the JIT compiler to completely remove logging instructions for types that are not enabled.
Public property | Backend | Gets the LoggingBackend associated with the current profile.
Public property | DefaultOptions | Gets or sets the options for "normal" records, e.g. method entry, method success, or value change.
Public property | Description | Gets or sets a human-readable description for the current profile. The description is only used when representing the profile in PostSharp Tools for Visual Studio.
Public property | EnabledRecordKinds | Gets or sets the set of record kinds that are enabled for the given profile. Change it with care. Not all combinations are tested.
Public property | ExceptionOptions | Gets or sets the options for "exception" records, e.g. method exceptions or slow executions.
Public property | ExecutionTimeThreshold | Gets or sets the warning threshold, in milliseconds. If the execution of a method takes longer than that, its success is logged with Warning, and the time it took is logged. If the value is 0, this feature is disabled.
Public property | IncludeAwaitedTask | Determines whether the operand of the await operator should be included in the log.
Public property | IncludeExecutionTime | Indicates that the execution time of a method should be tracked and logged on exit.
Public property | IncludeSourceLineInfo | Determines whether source-line information should be included in the log.
Public property | Name | Gets or sets the name of the current profile. The name of the profile should match the constructor argument of the LogAttribute aspect.
Public property | Role | Gets or sets the role of the current profile. Profiles of different roles can have different run-time options, including different back-ends. See Roles to access role-based run-time options.
Top
See Also

Reference

LoggingProfile Class
PostSharp.Patterns.Diagnostics Namespace


LoggingProfile.AllowDynamicEnabling Property

LoggingProfileAllowDynamicEnabling Property

Determines whether logging can be dynamically enabled or disabled after initialization. The default value of this property is true. When it is set to false, PostSharp generates code that allows the JIT compiler to completely remove logging instructions for types that are not enabled.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool AllowDynamicEnabling { get; set; }

Property Value

Type: Boolean
See Also

Reference

LoggingProfile Class
PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Enabling and Disabling Logging At Run Time


LoggingProfile.Backend Property

LoggingProfileBackend Property

Gets the LoggingBackend associated with the current profile.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingBackend Backend { get; }

Property Value

Type: LoggingBackend
See Also

Reference

LoggingProfile Class
PostSharp.Patterns.Diagnostics Namespace


LoggingProfile.DefaultOptions Property

LoggingProfileDefaultOptions Property

Gets or sets the options for "normal" records, e.g. method entry, method success, or value change.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingOptions DefaultOptions { get; set; }

Property Value

Type: LoggingOptions
See Also

Reference

LoggingProfile Class
PostSharp.Patterns.Diagnostics Namespace


LoggingProfile.Description Property

LoggingProfileDescription Property

Gets or sets a human-readable description for the current profile. The description is only used when representing the profile in PostSharp Tools for Visual Studio.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string Description { get; set; }

Property Value

Type: String
See Also

Reference

LoggingProfile Class
PostSharp.Patterns.Diagnostics Namespace


LoggingProfile.EnabledRecordKinds Property

LoggingProfileEnabledRecordKinds Property

Gets or sets the set of record kinds that are enabled for the given profile. Change it with care. Not all combinations are tested.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogRecordKind EnabledRecordKinds { get; set; }

Property Value

Type: LogRecordKind
See Also

Reference

LoggingProfile Class
PostSharp.Patterns.Diagnostics Namespace


LoggingProfile.ExceptionOptions Property

LoggingProfileExceptionOptions Property

Gets or sets the options for "exception" records, e.g. method exceptions or slow executions.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingOptions ExceptionOptions { get; set; }

Property Value

Type: LoggingOptions
See Also

Reference

LoggingProfile Class
PostSharp.Patterns.Diagnostics Namespace


LoggingProfile.ExecutionTimeThreshold Property

LoggingProfileExecutionTimeThreshold Property

Gets or sets the warning threshold, in milliseconds. If the execution of a method takes longer than that, its success is logged with Warning, and the time it took is logged. If the value is 0, this feature is disabled.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int ExecutionTimeThreshold { get; set; }

Property Value

Type: Int32
See Also

Reference

LoggingProfile Class
PostSharp.Patterns.Diagnostics Namespace


LoggingProfile.IncludeAwaitedTask Property

LoggingProfileIncludeAwaitedTask Property

Determines whether the operand of the await operator should be included in the log.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IncludeAwaitedTask { get; set; }

Property Value

Type: Boolean
See Also

Reference

LoggingProfile Class
PostSharp.Patterns.Diagnostics Namespace


LoggingProfile.IncludeExecutionTime Property

LoggingProfileIncludeExecutionTime Property

Indicates that the execution time of a method should be tracked and logged on exit.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IncludeExecutionTime { get; set; }

Property Value

Type: Boolean
See Also

Reference

LoggingProfile Class
PostSharp.Patterns.Diagnostics Namespace


LoggingProfile.IncludeSourceLineInfo Property

LoggingProfileIncludeSourceLineInfo Property

Determines whether source-line information should be included in the log.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IncludeSourceLineInfo { get; set; }

Property Value

Type: Boolean
See Also

Reference

LoggingProfile Class
PostSharp.Patterns.Diagnostics Namespace


LoggingProfile.Name Property

LoggingProfileName Property

Gets or sets the name of the current profile. The name of the profile should match the constructor argument of the LogAttribute aspect.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string Name { get; set; }

Property Value

Type: String
See Also

Reference

LoggingProfile Class
PostSharp.Patterns.Diagnostics Namespace


LoggingProfile.Role Property

LoggingProfileRole Property

Gets or sets the role of the current profile. Profiles of different roles can have different run-time options, including different back-ends. See Roles to access role-based run-time options.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string Role { get; set; }

Property Value

Type: String
See Also

Reference

LoggingProfile Class
PostSharp.Patterns.Diagnostics Namespace


LoggingProfile Methods

The LoggingProfile type exposes the following members.

Methods
 | Name | Description
Protected method | EnsureNotFrozen | Throws an InvalidOperationException if the Freeze method has been called on this object.
Protected method | Freeze | Prevents changes in the current object.
Public method | GetAbstractSource | Gets the LoggingAbstractSource for a given Type in the current profile.
Public method | ToString | Returns a string that represents the current object. (Overrides ObjectToString.)
Top
See Also

Reference

LoggingProfile Class
PostSharp.Patterns.Diagnostics Namespace


LoggingProfile.EnsureNotFrozen Method

LoggingProfileEnsureNotFrozen Method

Throws an InvalidOperationException if the Freeze method has been called on this object.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected void EnsureNotFrozen()
See Also

Reference

LoggingProfile Class
PostSharp.Patterns.Diagnostics Namespace


LoggingProfile.Freeze Method

LoggingProfileFreeze Method

Prevents changes in the current object.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void Freeze()
See Also

Reference

LoggingProfile Class
PostSharp.Patterns.Diagnostics Namespace


LoggingProfile.GetAbstractSource Method

LoggingProfileGetAbstractSource Method

Gets the LoggingAbstractSource for a given Type in the current profile.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingAbstractSource GetAbstractSource(
    Type type
)

Parameters

type
Type: SystemType
A Type.

Return Value

Type: LoggingAbstractSource
The LoggingAbstractSource for the given type and the Role of the current LoggingProfile.
Remarks

When this method fails with an exception, the exception is reported to the ExceptionHandler, and a LoggingAbstractSource bound to the NullLoggingBackend is returned.

See Also

Reference

LoggingProfile Class
PostSharp.Patterns.Diagnostics Namespace


LoggingProfile.ToString Method

LoggingProfileToString Method

Returns a string that represents the current object.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override string ToString()

Return Value

Type: String
A string that represents the current object.
See Also

Reference

LoggingProfile Class
PostSharp.Patterns.Diagnostics Namespace


LoggingProfileCollection Class

Collection of instances of the LoggingProfile class.
Inheritance Hierarchy
SystemObject
System.Collections.ObjectModelCollection LoggingProfile
System.Collections.ObjectModelKeyedCollection String, LoggingProfile
PostSharp.Patterns.DiagnosticsLoggingProfileCollection

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class LoggingProfileCollection : KeyedCollection<string, LoggingProfile>

The LoggingProfileCollection type exposes the following members.

Constructors
 | Name | Description
Public method | LoggingProfileCollection | Initializes a new LoggingProfileCollection.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics Namespace


LoggingProfileCollection Constructor

Initializes a new LoggingProfileCollection.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingProfileCollection()
See Also

Reference

LoggingProfileCollection Class
PostSharp.Patterns.Diagnostics Namespace


LoggingProfileRepository Class

Provides access to logging profiles (LoggingProfile) at run-time. Exposed by the Profiles property. Note that each assembly of the AppDomain contains its own copy of each LoggingProfile used in this assembly, and each copy may be different, even if they have the same name.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingProfileRepository

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class LoggingProfileRepository

The LoggingProfileRepository type exposes the following members.

Constructors
 | Name | Description
Public method | LoggingProfileRepository | Initializes a new instance of the LoggingProfileRepository class
Top
Methods
 | Name | Description
Public method | GetProfile | Gets a profile given its name and declaring Assembly.
Public method | RegisterProfile | Register a LoggingProfile. This method is invoked by the code generated by PostSharp.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics Namespace


LoggingProfileRepository Constructor

Initializes a new instance of the LoggingProfileRepository class

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingProfileRepository()
See Also

Reference

LoggingProfileRepository Class
PostSharp.Patterns.Diagnostics Namespace


LoggingProfileRepository Methods

The LoggingProfileRepository type exposes the following members.

Methods
 | Name | Description
Public method | GetProfile | Gets a profile given its name and declaring Assembly.
Public method | RegisterProfile | Register a LoggingProfile. This method is invoked by the code generated by PostSharp.
Top
See Also

Reference

LoggingProfileRepository Class
PostSharp.Patterns.Diagnostics Namespace


LoggingProfileRepository.GetProfile Method

LoggingProfileRepositoryGetProfile Method

Gets a profile given its name and declaring Assembly.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingProfile GetProfile(
    string name,
    Assembly assembly
)

Parameters

name
Type: SystemString
Name of the profile.
assembly
Type: System.ReflectionAssembly
Assembly in which the profile is defined.

Return Value

Type: LoggingProfile
A LoggingProfile, or null if assembly does not contain a profile named name.
See Also

Reference

LoggingProfileRepository Class
PostSharp.Patterns.Diagnostics Namespace


LoggingProfileRepository.RegisterProfile Method

LoggingProfileRepositoryRegisterProfile Method

Register a LoggingProfile. This method is invoked by the code generated by PostSharp.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void RegisterProfile(
    string name,
    Assembly assembly,
    LoggingProfile profile
)

Parameters

name
Type: SystemString
Name of the profile.
assembly
Type: System.ReflectionAssembly
Assembly in which the profile is defined.
profile
Type: PostSharp.Patterns.DiagnosticsLoggingProfile
The profile itself.
See Also

Reference

LoggingProfileRepository Class
PostSharp.Patterns.Diagnostics Namespace


LoggingRoleConfiguration Class

Role-specific logging options. There is one instance of the LoggingRoleConfiguration class for each logging role. The LoggingRoleConfiguration is a run-time concept, with no build-time meaning.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingRoleConfiguration

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class LoggingRoleConfiguration : INotifyPropertyChanged

The LoggingRoleConfiguration type exposes the following members.

Properties
 | Name | Description
Public property | Backend | Gets or sets the back-end that implements logging for the given Role.
Public property | CustomRecordLoggingOptions | Gets the options that influence the rendering of log records emitted with the Logger class.
Public property | IsBackendSpecified | Determines whether the Backend has been explicitly specified. This property is false by default, which means that the Backend property will evaluate to DefaultBackend.
Public property | Role | Gets the role whose options are represented by the current object. See LoggingRoles for a list of standard logging roles.
Top
Methods
 | Name | Description
Public method | GetAbstractSource | Gets the LoggingAbstractSource for a given Type in the current role.
Top
Events
 | Name | Description
Public event | PropertyChanged | Event raised when a property of this class changes.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics Namespace


LoggingRoleConfiguration Properties

The LoggingRoleConfiguration type exposes the following members.

Properties
 | Name | Description
Public property | Backend | Gets or sets the back-end that implements logging for the given Role.
Public property | CustomRecordLoggingOptions | Gets the options that influence the rendering of log records emitted with the Logger class.
Public property | IsBackendSpecified | Determines whether the Backend has been explicitly specified. This property is false by default, which means that the Backend property will evaluate to DefaultBackend.
Public property | Role | Gets the role whose options are represented by the current object. See LoggingRoles for a list of standard logging roles.
Top
See Also

Reference

LoggingRoleConfiguration Class
PostSharp.Patterns.Diagnostics Namespace


LoggingRoleConfiguration.Backend Property

LoggingRoleConfigurationBackend Property

Gets or sets the back-end that implements logging for the given Role.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingBackend Backend { get; set; }

Property Value

Type: LoggingBackend
See Also

Reference

LoggingRoleConfiguration Class
PostSharp.Patterns.Diagnostics Namespace


LoggingRoleConfiguration.CustomRecordLoggingOptions Property

LoggingRoleConfigurationCustomRecordLoggingOptions Property

Gets the options that influence the rendering of log records emitted with the Logger class.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CustomRecordLoggingOptions CustomRecordLoggingOptions { get; }

Property Value

Type: CustomRecordLoggingOptions
See Also

Reference

LoggingRoleConfiguration Class
PostSharp.Patterns.Diagnostics Namespace


LoggingRoleConfiguration.IsBackendSpecified Property

LoggingRoleConfigurationIsBackendSpecified Property

Determines whether the Backend has been explicitly specified. This property is false by default, which means that the Backend property will evaluate to DefaultBackend.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsBackendSpecified { get; }

Property Value

Type: Boolean
See Also

Reference

LoggingRoleConfiguration Class
PostSharp.Patterns.Diagnostics Namespace


LoggingRoleConfiguration.Role Property

LoggingRoleConfigurationRole Property

Gets the role whose options are represented by the current object. See LoggingRoles for a list of standard logging roles.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string Role { get; }

Property Value

Type: String
See Also

Reference

LoggingRoleConfiguration Class
PostSharp.Patterns.Diagnostics Namespace


LoggingRoleConfiguration Methods

The LoggingRoleConfiguration type exposes the following members.

Methods
 | Name | Description
Public method | GetAbstractSource | Gets the LoggingAbstractSource for a given Type in the current role.
Top
See Also

Reference

LoggingRoleConfiguration Class
PostSharp.Patterns.Diagnostics Namespace


LoggingRoleConfiguration.GetAbstractSource Method

LoggingRoleConfigurationGetAbstractSource Method

Gets the LoggingAbstractSource for a given Type in the current role.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingAbstractSource GetAbstractSource(
    Type type
)

Parameters

type
Type: SystemType
A Type.

Return Value

Type: LoggingAbstractSource
The LoggingAbstractSource for the given type in the current role.
See Also

Reference

LoggingRoleConfiguration Class
PostSharp.Patterns.Diagnostics Namespace


LoggingRoleConfiguration Events

The LoggingRoleConfiguration type exposes the following members.

Events
 | Name | Description
Public event | PropertyChanged | Event raised when a property of this class changes.
Top
See Also

Reference

LoggingRoleConfiguration Class
PostSharp.Patterns.Diagnostics Namespace


LoggingRoleConfiguration.PropertyChanged Event

LoggingRoleConfigurationPropertyChanged Event

Event raised when a property of this class changes.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public event PropertyChangedEventHandler PropertyChanged

Value

Type: System.ComponentModelPropertyChangedEventHandler

Implements

INotifyPropertyChangedPropertyChanged
See Also

Reference

LoggingRoleConfiguration Class
PostSharp.Patterns.Diagnostics Namespace


LoggingRoleConfigurationRepository Class

Provides access to role-specific options (LoggingRoleConfiguration). This class is exposed on the Profiles.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingRoleConfigurationRepository

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class LoggingRoleConfigurationRepository : IEnumerable<LoggingRoleConfiguration>,
    IEnumerable

The LoggingRoleConfigurationRepository type exposes the following members.

Properties
 | Name | Description
Public property | Audit | Gets the LoggingRoleConfiguration object for the Audit role.
Public property | Caching | Gets the LoggingRoleConfiguration object for the Caching role.
Public property | Custom | Gets the LoggingRoleConfiguration object for the Custom role.
Public property | Item | Gets the LoggingRoleConfiguration for a given role.
Public property | Meta | Gets the LoggingRoleConfiguration object for the Meta role.
Public property | Tracing | Gets the LoggingRoleConfiguration object for the Tracing role.
Top
Methods
 | Name | Description
Public method | GetEnumerator | Returns an enumerator that iterates through the collection.
Top
Extension Methods
 | Name | Description
Public Extension Method | ToAdvisableCollectionLoggingRoleConfiguration | Converts an IEnumerableT into an AdvisableCollectionT. (Defined by Extensions.)
Public Extension Method | ToAdvisableDictionaryLoggingRoleConfiguration, TKey, TValue | Converts an IEnumerableT into a AdvisableDictionaryTKey, TValue given a method returning the item key and a method returning the item value. (Defined by Extensions.)
Public Extension Method | ToAdvisableHashSetLoggingRoleConfiguration | Converts an IEnumerableT into an AdvisableHashSetT. (Defined by Extensions.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics Namespace


LoggingRoleConfigurationRepository Properties

The LoggingRoleConfigurationRepository type exposes the following members.

Properties
 | Name | Description
Public property | Audit | Gets the LoggingRoleConfiguration object for the Audit role.
Public property | Caching | Gets the LoggingRoleConfiguration object for the Caching role.
Public property | Custom | Gets the LoggingRoleConfiguration object for the Custom role.
Public property | Item | Gets the LoggingRoleConfiguration for a given role.
Public property | Meta | Gets the LoggingRoleConfiguration object for the Meta role.
Public property | Tracing | Gets the LoggingRoleConfiguration object for the Tracing role.
Top
See Also

Reference

LoggingRoleConfigurationRepository Class
PostSharp.Patterns.Diagnostics Namespace


LoggingRoleConfigurationRepository.Audit Property

LoggingRoleConfigurationRepositoryAudit Property

Gets the LoggingRoleConfiguration object for the Audit role.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingRoleConfiguration Audit { get; }

Property Value

Type: LoggingRoleConfiguration
See Also

Reference

LoggingRoleConfigurationRepository Class
PostSharp.Patterns.Diagnostics Namespace


LoggingRoleConfigurationRepository.Caching Property

LoggingRoleConfigurationRepositoryCaching Property

Gets the LoggingRoleConfiguration object for the Caching role.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingRoleConfiguration Caching { get; }

Property Value

Type: LoggingRoleConfiguration
See Also

Reference

LoggingRoleConfigurationRepository Class
PostSharp.Patterns.Diagnostics Namespace


LoggingRoleConfigurationRepository.Custom Property

LoggingRoleConfigurationRepositoryCustom Property

Gets the LoggingRoleConfiguration object for the Custom role.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingRoleConfiguration Custom { get; }

Property Value

Type: LoggingRoleConfiguration
See Also

Reference

LoggingRoleConfigurationRepository Class
PostSharp.Patterns.Diagnostics Namespace


LoggingRoleConfigurationRepository.Item Property

LoggingRoleConfigurationRepositoryItem Property

Gets the LoggingRoleConfiguration for a given role.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingRoleConfiguration this[
    string role
] { get; }

Parameters

role
Type: SystemString
The role name. See LoggingRoles for a list of standard roles.

Return Value

Type: LoggingRoleConfiguration
A LoggingRoleConfiguration. If no LoggingRoleConfiguration exist for the specific role, a new instance is created and returned.
See Also

Reference

LoggingRoleConfigurationRepository Class
PostSharp.Patterns.Diagnostics Namespace


LoggingRoleConfigurationRepository.Meta Property

LoggingRoleConfigurationRepositoryMeta Property

Gets the LoggingRoleConfiguration object for the Meta role.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingRoleConfiguration Meta { get; }

Property Value

Type: LoggingRoleConfiguration
See Also

Reference

LoggingRoleConfigurationRepository Class
PostSharp.Patterns.Diagnostics Namespace


LoggingRoleConfigurationRepository.Tracing Property

LoggingRoleConfigurationRepositoryTracing Property

Gets the LoggingRoleConfiguration object for the Tracing role.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingRoleConfiguration Tracing { get; }

Property Value

Type: LoggingRoleConfiguration
See Also

Reference

LoggingRoleConfigurationRepository Class
PostSharp.Patterns.Diagnostics Namespace


LoggingRoleConfigurationRepository Methods

The LoggingRoleConfigurationRepository type exposes the following members.

Methods
 | Name | Description
Public method | GetEnumerator | Returns an enumerator that iterates through the collection.
Top
Extension Methods
 | Name | Description
Public Extension Method | ToAdvisableCollectionLoggingRoleConfiguration | Converts an IEnumerableT into an AdvisableCollectionT. (Defined by Extensions.)
Public Extension Method | ToAdvisableDictionaryLoggingRoleConfiguration, TKey, TValue | Converts an IEnumerableT into a AdvisableDictionaryTKey, TValue given a method returning the item key and a method returning the item value. (Defined by Extensions.)
Public Extension Method | ToAdvisableHashSetLoggingRoleConfiguration | Converts an IEnumerableT into an AdvisableHashSetT. (Defined by Extensions.)
Top
See Also

Reference

LoggingRoleConfigurationRepository Class
PostSharp.Patterns.Diagnostics Namespace


LoggingRoleConfigurationRepository.GetEnumerator Method

LoggingRoleConfigurationRepositoryGetEnumerator Method

Returns an enumerator that iterates through the collection.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IEnumerator<LoggingRoleConfiguration> GetEnumerator()

Return Value

Type: IEnumerator LoggingRoleConfiguration
An enumerator that can be used to iterate through the collection.

Implements

IEnumerableTGetEnumerator
See Also

Reference

LoggingRoleConfigurationRepository Class
PostSharp.Patterns.Diagnostics Namespace


LoggingRoles Class

List of standard logging roles.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingRoles

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static class LoggingRoles

The LoggingRoles type exposes the following members.

Fields
Name | Description
Audit | Audit.
Caching | Log records emitted by the Caching component.
Custom | Default role for custom logging using the Logger class.
Meta | Logging of the logging component itself.
Tracing | Default role for the Logging component.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Enabling and Disabling Logging At Run Time


LoggingRoles Fields

The LoggingRoles type exposes the following members.

Fields
Name | Description
Audit | Audit.
Caching | Log records emitted by the Caching component.
Custom | Default role for custom logging using the Logger class.
Meta | Logging of the logging component itself.
Tracing | Default role for the Logging component.
Top
See Also

Reference

LoggingRoles Class
PostSharp.Patterns.Diagnostics Namespace


LoggingRoles.Audit Field

LoggingRolesAudit Field

Audit.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string Audit = "Audit"

Field Value

Type: String
See Also

Reference

LoggingRoles Class
PostSharp.Patterns.Diagnostics Namespace


LoggingRoles.Caching Field

LoggingRolesCaching Field

Log records emitted by the Caching component.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string Caching = "Cache"

Field Value

Type: String
See Also

Reference

LoggingRoles Class
PostSharp.Patterns.Diagnostics Namespace


LoggingRoles.Custom Field

LoggingRolesCustom Field

Default role for custom logging using the Logger class.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string Custom = "Custom"

Field Value

Type: String
See Also

Reference

LoggingRoles Class
PostSharp.Patterns.Diagnostics Namespace


LoggingRoles.Meta Field

LoggingRolesMeta Field

Logging of the logging component itself.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string Meta = "Meta"

Field Value

Type: String
See Also

Reference

LoggingRoles Class
PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Handling Faults in the Logging Component


LoggingRoles.Tracing Field

LoggingRolesTracing Field

Default role for the Logging component.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string Tracing = "Trace"

Field Value

Type: String
See Also

Reference

LoggingRoles Class
PostSharp.Patterns.Diagnostics Namespace


LoggingServices Class

The entry point to configure PostSharp.Patterns.Diagnostics logging at run-time.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingServices

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class LoggingServices

The LoggingServices type exposes the following members.

Constructors
 | Name | Description
Public method | LoggingServices | Initializes a new instance of the LoggingServices class
Top
Properties
Name | Description
CurrentTimestamp | Gets a timestamp, in milliseconds.
DefaultBackend | Gets or sets the default LoggingBackend used for logging in the current application.
ExceptionHandler | Gets or sets the object that handles exceptions thrown by the logging logic. This property is set by default to an instance of the DefaultLoggingExceptionHandler class.
Profiles | Gets the repository of build-time logging profiles.
Roles | Gets the repository of role-specific run-time logging options.
Top
Methods
Name | Description
GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace.
GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type.
Initialize | Forces initialization of the PostSharp.Patterns.Diagnostics package, i.e. binds the Logger facade API (which is defined in the PostSharp.Patterns.Diagnostics package) to the implementation by the PostSharp.Patterns.Diagnostics package.
OnInternalException(Exception, LoggingTypeSource) | Method invoked when an exception is caught in logging code.
OnInternalException(Exception, LoggingTypeSource, LogRecordBuilder) |
Top
Events
Name | Description
DefaultBackendChanged | Event raised when the DefaultBackend property has changed.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics Namespace


LoggingServices Constructor

Initializes a new instance of the LoggingServices class

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingServices()
See Also

Reference

LoggingServices Class
PostSharp.Patterns.Diagnostics Namespace


LoggingServices Properties

The LoggingServices type exposes the following members.

Properties
Name | Description
CurrentTimestamp | Gets a timestamp, in milliseconds.
DefaultBackend | Gets or sets the default LoggingBackend used for logging in the current application.
ExceptionHandler | Gets or sets the object that handles exceptions thrown by the logging logic. This property is set by default to an instance of the DefaultLoggingExceptionHandler class.
Profiles | Gets the repository of build-time logging profiles.
Roles | Gets the repository of role-specific run-time logging options.
Top
See Also

Reference

LoggingServices Class
PostSharp.Patterns.Diagnostics Namespace


LoggingServices.CurrentTimestamp Property

LoggingServicesCurrentTimestamp Property

Gets a timestamp, in milliseconds.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static double CurrentTimestamp { get; }

Property Value

Type: Double
See Also

Reference

LoggingServices Class
PostSharp.Patterns.Diagnostics Namespace


LoggingServices.DefaultBackend Property

LoggingServicesDefaultBackend Property

Gets or sets the default LoggingBackend used for logging in the current application.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static LoggingBackend DefaultBackend { get; set; }

Property Value

Type: LoggingBackend
Remarks

The LoggingBackend can be set individually for each role by setting the Backend property of items of the Roles collection.

See Also

Reference

LoggingServices Class
PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Logging to Loupe


LoggingServices.ExceptionHandler Property

LoggingServicesExceptionHandler Property

Gets or sets the object that handles exceptions thrown by the logging logic. This property is set by default to an instance of the DefaultLoggingExceptionHandler class.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static ILoggingExceptionHandler ExceptionHandler { get; set; }

Property Value

Type: ILoggingExceptionHandler
See Also

Reference

LoggingServices Class
PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Handling Faults in the Logging Component


LoggingServices.Profiles Property

LoggingServicesProfiles Property

Gets the repository of build-time logging profiles.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static LoggingProfileRepository Profiles { get; }

Property Value

Type: LoggingProfileRepository
See Also

Reference

LoggingServices Class
PostSharp.Patterns.Diagnostics Namespace


LoggingServices.Roles Property

LoggingServicesRoles Property

Gets the repository of role-specific run-time logging options.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static LoggingRoleConfigurationRepository Roles { get; }

Property Value

Type: LoggingRoleConfigurationRepository
See Also

Reference

LoggingServices Class
PostSharp.Patterns.Diagnostics Namespace


LoggingServices Methods

The LoggingServices type exposes the following members.

Methods
Name | Description
GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace.
GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type.
Initialize | Forces initialization of the PostSharp.Patterns.Diagnostics package, i.e. binds the Logger facade API (which is defined in the PostSharp.Patterns.Diagnostics package) to the implementation by the PostSharp.Patterns.Diagnostics package.
OnInternalException(Exception, LoggingTypeSource) | Method invoked when an exception is caught in logging code.
OnInternalException(Exception, LoggingTypeSource, LogRecordBuilder) |
Top
See Also

Reference

LoggingServices Class
PostSharp.Patterns.Diagnostics Namespace


LoggingServices.GetSource Method

LoggingServicesGetSource Method

Overload List
Name | Description
GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace.
GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type.
Top
See Also

Reference

LoggingServices Class
PostSharp.Patterns.Diagnostics Namespace


LoggingServices.GetSource Method (String, String)

LoggingServicesGetSource Method (String, String)

Returns a LoggingNamespaceSource for the given role and, optionally, namespace.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static LoggingNamespaceSource GetSource(
    string role,
    string ns = null
)

Parameters

role
Type: SystemString
The role. Typically one of the constants of the LoggingRoles type, or a custom role.
ns (Optional)
Type: SystemString
The namespace for which the LoggingNamespaceSource is requested, or null if the LoggingNamespaceSource is requested for the root namespace.

Return Value

Type: LoggingNamespaceSource
The LoggingNamespaceSource for role and ns. If no LoggingNamespaceSource exists for this role and type, this method shall create a new LoggingNamespaceSource.
Remarks

This method returns a LoggingNamespaceSource for the LoggingBackend currently configured for the given role. Instances of the LoggingNamespaceSource classes are not shared by different instances of the LoggingBackend class, however several roles can share the same LoggingBackend instance. Therefore, you should configure a LoggingNamespaceSource after, and not before, assigning a LoggingBackend to the DefaultBackend property or a LoggingRoleConfiguration.

See Also

Reference

LoggingServices Class
GetSource Overload
PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Enabling and Disabling Logging At Run Time


LoggingServices.GetSource Method (String, Type)

LoggingServicesGetSource Method (String, Type)

Returns a LoggingTypeSource for the given role and type.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static LoggingTypeSource GetSource(
    string role,
    Type type
)

Parameters

role
Type: SystemString
The role. Typically one of the constants of the LoggingRoles type, or a custom role.
type
Type: SystemType
The type.

Return Value

Type: LoggingTypeSource
The LoggingTypeSource for role and type. If no LoggingTypeSource exists for this role and type, this method shall create a new LoggingTypeSource.
Remarks

This method returns a LoggingTypeSource for the LoggingBackend currently configured for the given role. Instances of the LoggingTypeSource classes are not shared by different instances of the LoggingBackend class, however several roles can share the same LoggingBackend instance. Therefore, you should configure a LoggingTypeSource after, and not before, assigning a LoggingBackend to the DefaultBackend property or a LoggingRoleConfiguration.

See Also

Reference

LoggingServices Class
GetSource Overload
PostSharp.Patterns.Diagnostics Namespace


LoggingServices.Initialize Method

LoggingServicesInitialize Method

Forces initialization of the PostSharp.Patterns.Diagnostics package, i.e. binds the Logger facade API (which is defined in the PostSharp.Patterns.Diagnostics package) to the implementation by the PostSharp.Patterns.Diagnostics package.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void Initialize()
See Also

Reference

LoggingServices Class
PostSharp.Patterns.Diagnostics Namespace


LoggingServices.OnInternalException Method

LoggingServicesOnInternalException Method

Overload List
Name | Description
OnInternalException(Exception, LoggingTypeSource) | Method invoked when an exception is caught in logging code.
OnInternalException(Exception, LoggingTypeSource, LogRecordBuilder) |
Top
See Also

Reference

LoggingServices Class
PostSharp.Patterns.Diagnostics Namespace


LoggingServices.OnInternalException Method (Exception, LoggingTypeSource)

LoggingServicesOnInternalException Method (Exception, LoggingTypeSource)

Method invoked when an exception is caught in logging code.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void OnInternalException(
    Exception exception,
    LoggingTypeSource source
)

Parameters

exception
Type: SystemException
The caught exception, or null if it is not available.
source
Type: PostSharp.Patterns.DiagnosticsLoggingTypeSource
The relevant LoggingTypeSource, or null if it could not be determined.
See Also

Reference

LoggingServices Class
OnInternalException Overload
PostSharp.Patterns.Diagnostics Namespace


LoggingServices.OnInternalException Method (Exception, LoggingTypeSource, LogRecordBuilder)

LoggingServicesOnInternalException Method (Exception, LoggingTypeSource, LogRecordBuilder)

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void OnInternalException(
    Exception exception,
    LoggingTypeSource source,
    LogRecordBuilder recordBuilder
)

Parameters

exception
Type: SystemException
source
Type: PostSharp.Patterns.DiagnosticsLoggingTypeSource
recordBuilder
Type: PostSharp.Patterns.Diagnostics.RecordBuildersLogRecordBuilder
See Also

Reference

LoggingServices Class
OnInternalException Overload
PostSharp.Patterns.Diagnostics Namespace


LoggingServices Events

The LoggingServices type exposes the following members.

Events
Name | Description
DefaultBackendChanged | Event raised when the DefaultBackend property has changed.
Top
See Also

Reference

LoggingServices Class
PostSharp.Patterns.Diagnostics Namespace


LoggingServices.DefaultBackendChanged Event

LoggingServicesDefaultBackendChanged Event

Event raised when the DefaultBackend property has changed.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static event EventHandler DefaultBackendChanged

Value

Type: SystemEventHandler
See Also

Reference

LoggingServices Class
PostSharp.Patterns.Diagnostics Namespace


LoggingServices.Formatters Class

LoggingServicesFormatters Class

Provides access to formatters. This class is exposed on the LoggingServicesFormatters property.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.FormattersFormatterRepository LoggingFormattingRole
PostSharp.Patterns.DiagnosticsLoggingServicesFormatters

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class Formatters : FormatterRepository<LoggingFormattingRole>
See Also

Reference

PostSharp.Patterns.Diagnostics Namespace


LoggingTypeSource Class

Allows to enable or disable logging for a specific SourceType and exposes some information regarding this SourceType/
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
PostSharp.Patterns.DiagnosticsLoggingTypeSource
More...

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class LoggingTypeSource : LoggingNamespaceSource,
    ILogger, ILoggerExceptionHandler

The LoggingTypeSource type exposes the following members.

Constructors
 | Name | Description
Protected method | LoggingTypeSource | Creates an instance of LoggingTypeSource.
Top
Properties
 | Name | Description
Public property | Backend | Gets the parent LoggingBackend. (Inherited from LoggingNamespaceSource.)
Public property | DisplayFullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the DisplayFullName property does not include the arity, i.e. the full name of List<T> is System.Collections.Generic.List. (Inherited from LoggingNamespaceSource.)
Public property | DisplayName | Gets the last component of the name of the type or namespace, in the form that should be reported to the log. For generic types, the DisplayName property does not include the arity, i.e. the name of List<T> is List. (Inherited from LoggingNamespaceSource.)
Public property | FullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the FullName property includes the arity, i.e. the full name of List<T> is System.Collections.Generic.List`1. (Inherited from LoggingNamespaceSource.)
Public property | GenericParameterCount | Gets the number of generic parameters in SourceType.
Public property | Level | Gets the minimal LogLevel for which logging is enabled for the current namespace or type. (Inherited from LoggingNamespaceSource.)
Public property | Name | Gets the last component of the name of the type or namespace. For instance, when FullName is PostSharp.Patterns.Diagnostics.LoggingBackend, Name is LoggingBackend. For generic types, the Name property includes the arity, i.e. the name of List<T> is List`1. (Inherited from LoggingNamespaceSource.)
Public property | Options | Gets the LoggingRoleConfiguration for the current role. This property is a shortcut to LoggingServices.Roles[this.Role].
Public property | Parent | Gets the parent LoggingNamespaceSource, or null if the current object represents the root namespace. (Inherited from LoggingNamespaceSource.)
Public property | Role | Gets the logging role for the current role. Typical values of this property are listed in the LoggingRoles class. (Inherited from LoggingNamespaceSource.)
Public property | SourceType | The type represented by the current LoggingTypeSource.
Top
Methods
 | Name | Description
Protected method | IsBackendEnabled | Checks whether logging is enabled in the back-end for the given level.
Public method | IsEnabled | Determines whether logging is enabled for the given LogLevel.
Public method | Refresh | Refreshes the logging level from the back-end from the current node and all children nodes. The back-end-defined logging level is cached for performance reasons. (Overrides LoggingNamespaceSourceRefresh.)
Public method | SetLevel | Sets the minimal LogLevel for which logging is enabled for the current namespace and type and all children namespaces and types. (Inherited from LoggingNamespaceSource.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Enabling and Disabling Logging At Run Time
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
PostSharp.Patterns.DiagnosticsLoggingTypeSource
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsightsApplicationInsightsLoggingTypeSource
PostSharp.Patterns.Diagnostics.Backends.AuditAuditTypeSource
PostSharp.Patterns.Diagnostics.Backends.CommonLoggingCommonLoggingLoggingTypeSource
PostSharp.Patterns.Diagnostics.Backends.ConsoleConsoleLoggingTypeSource
PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibraryEnterpriseLibraryLoggingTypeSource
PostSharp.Patterns.Diagnostics.Backends.EventSourceEventSourceLoggingTypeSource
PostSharp.Patterns.Diagnostics.Backends.Log4NetLog4NetLoggingTypeSource
PostSharp.Patterns.Diagnostics.Backends.LoupeLoupeLoggingTypeSource
PostSharp.Patterns.Diagnostics.Backends.MicrosoftMicrosoftLoggingTypeSource
PostSharp.Patterns.Diagnostics.Backends.NLogNLogLoggingTypeSource
PostSharp.Patterns.Diagnostics.Backends.SerilogSerilogLoggingTypeSource
PostSharp.Patterns.Diagnostics.Backends.TraceTraceLoggingTypeSource
PostSharp.Patterns.Diagnostics.Backends.TraceSourceTraceSourceLoggingTypeSource


LoggingTypeSource Constructor

Creates an instance of LoggingTypeSource.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected LoggingTypeSource(
    LoggingNamespaceSource parent,
    Type sourceType
)

Parameters

parent
Type: PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
The parent LoggingNamespaceSource.
sourceType
Type: SystemType
The SourceType represented by the new LoggingTypeSource.
See Also

Reference

LoggingTypeSource Class
PostSharp.Patterns.Diagnostics Namespace


LoggingTypeSource Properties

The LoggingTypeSource type exposes the following members.

Properties
 | Name | Description
Public property | Backend | Gets the parent LoggingBackend. (Inherited from LoggingNamespaceSource.)
Public property | DisplayFullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the DisplayFullName property does not include the arity, i.e. the full name of List<T> is System.Collections.Generic.List. (Inherited from LoggingNamespaceSource.)
Public property | DisplayName | Gets the last component of the name of the type or namespace, in the form that should be reported to the log. For generic types, the DisplayName property does not include the arity, i.e. the name of List<T> is List. (Inherited from LoggingNamespaceSource.)
Public property | FullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the FullName property includes the arity, i.e. the full name of List<T> is System.Collections.Generic.List`1. (Inherited from LoggingNamespaceSource.)
Public property | GenericParameterCount | Gets the number of generic parameters in SourceType.
Public property | Level | Gets the minimal LogLevel for which logging is enabled for the current namespace or type. (Inherited from LoggingNamespaceSource.)
Public property | Name | Gets the last component of the name of the type or namespace. For instance, when FullName is PostSharp.Patterns.Diagnostics.LoggingBackend, Name is LoggingBackend. For generic types, the Name property includes the arity, i.e. the name of List<T> is List`1. (Inherited from LoggingNamespaceSource.)
Public property | Options | Gets the LoggingRoleConfiguration for the current role. This property is a shortcut to LoggingServices.Roles[this.Role].
Public property | Parent | Gets the parent LoggingNamespaceSource, or null if the current object represents the root namespace. (Inherited from LoggingNamespaceSource.)
Public property | Role | Gets the logging role for the current role. Typical values of this property are listed in the LoggingRoles class. (Inherited from LoggingNamespaceSource.)
Public property | SourceType | The type represented by the current LoggingTypeSource.
Top
See Also

Reference

LoggingTypeSource Class
PostSharp.Patterns.Diagnostics Namespace


LoggingTypeSource.GenericParameterCount Property

LoggingTypeSourceGenericParameterCount Property

Gets the number of generic parameters in SourceType.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int GenericParameterCount { get; }

Property Value

Type: Int32
See Also

Reference

LoggingTypeSource Class
PostSharp.Patterns.Diagnostics Namespace


LoggingTypeSource.Options Property

LoggingTypeSourceOptions Property

Gets the LoggingRoleConfiguration for the current role. This property is a shortcut to LoggingServices.Roles[this.Role].

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingRoleConfiguration Options { get; }

Property Value

Type: LoggingRoleConfiguration
See Also

Reference

LoggingTypeSource Class
PostSharp.Patterns.Diagnostics Namespace


LoggingTypeSource.SourceType Property

LoggingTypeSourceSourceType Property

The type represented by the current LoggingTypeSource.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Type SourceType { get; }

Property Value

Type: Type
See Also

Reference

LoggingTypeSource Class
PostSharp.Patterns.Diagnostics Namespace


LoggingTypeSource Methods

The LoggingTypeSource type exposes the following members.

Methods
 | Name | Description
Protected method | IsBackendEnabled | Checks whether logging is enabled in the back-end for the given level.
Public method | IsEnabled | Determines whether logging is enabled for the given LogLevel.
Public method | Refresh | Refreshes the logging level from the back-end from the current node and all children nodes. The back-end-defined logging level is cached for performance reasons. (Overrides LoggingNamespaceSourceRefresh.)
Public method | SetLevel | Sets the minimal LogLevel for which logging is enabled for the current namespace and type and all children namespaces and types. (Inherited from LoggingNamespaceSource.)
Top
See Also

Reference

LoggingTypeSource Class
PostSharp.Patterns.Diagnostics Namespace


LoggingTypeSource.IsBackendEnabled Method

LoggingTypeSourceIsBackendEnabled Method

Checks whether logging is enabled in the back-end for the given level.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected abstract bool IsBackendEnabled(
    LogLevel level
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel

Return Value

Type: Boolean
Remarks

The result of this method is cached. To invalidate the cache, call the Refresh method.

See Also

Reference

LoggingTypeSource Class
PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


LoggingTypeSource.IsEnabled Method

LoggingTypeSourceIsEnabled Method

Determines whether logging is enabled for the given LogLevel.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsEnabled(
    LogLevel level
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel

Return Value

Type: Boolean
See Also

Reference

LoggingTypeSource Class
PostSharp.Patterns.Diagnostics Namespace


LoggingTypeSource.Refresh Method

LoggingTypeSourceRefresh Method

Refreshes the logging level from the back-end from the current node and all children nodes. The back-end-defined logging level is cached for performance reasons.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void Refresh()
See Also

Reference

LoggingTypeSource Class
PostSharp.Patterns.Diagnostics Namespace


LogLevel Enumeration

Specifies the severity of a logged message.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum LogLevel
Members
Member name | Value | Description
None | 0 | No message should be logged.
Trace | 1 | The message should be logged at Trace level (when applicable).
Debug | 2 | The message should be logged at Debug level (when applicable).
Info | 3 | The message should be logged at Info level (when applicable).
Warning | 4 | The message should be logged at Warning level (when applicable).
Error | 5 | The message should be logged at Error level (when applicable).
Critical | 6 | The message should be logged at Critical level (when applicable).
See Also

Reference

PostSharp.Patterns.Diagnostics Namespace

Other Resources

Conceptual: Customizing the Appearance of Log Records


LogRecordKind Enumeration

Kinds of log entry.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[FlagsAttribute]
public enum LogRecordKind
Members
Member name | Value | Description
None | 0 |
MethodEntry | 2 | Before method execution.
MethodSuccess | 4 | After successful method execution.
MethodException | 8 | After failed method execution (the method threw an exception).
AsyncMethodAwait | 16 | Before async method suspends execution.
AsyncMethodResume | 32 | After async method resumes execution.
ValueChanged | 64 | When value of a field or property changes.
CustomRecord | 128 | Custom record (emitted by Write(LogLevel, String).
CustomActivityEntry | 256 | Before a custom activity (emitted by OpenActivity(String) or OpenAsyncActivity(String)).
CustomActivityException | 512 | When a custom activity fails with an exception (emitted by SetException(Exception)).
CustomActivitySuccess | 1024 | When a custom activity succeeds (emitted by SetSuccess(String)).
CustomActivityFailure | 2048 | When a custom activity fails with a custom message (emitted by SetFailure(String).
IteratorYield | 4096 | When an iterator yields a result.
IteratorMoveNext | 8192 | Before the MoveNext method of an iterator executes.
ExecutionPoint | 16384 | Emitted by WriteExecutionPoint.
MethodOvertime | 32768 | After a method execution is successful but lasted more time than the threshold.
See Also

Reference

PostSharp.Patterns.Diagnostics Namespace


LogRecordKindExtensions Class

Extensions to the LogRecordKind enum.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLogRecordKindExtensions

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static class LogRecordKindExtensions

The LogRecordKindExtensions type exposes the following members.

Methods
Name | Description
IsClose | Determines whether a given LogRecordKind represents the closing of a context.
IsCustom | Determines whether a give LogRecordKind represents a custom record, emitted by the Logger class.
IsOpen | Determines whether a given LogRecordKind represents the opening of a context.
IsStandalone | Determines whether a given LogRecordKind represents a standalone record, i.e. a record that does not have a corresponding opening or closing. For instance, a CustomRecord is a standalone record.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics Namespace


LogRecordKindExtensions Methods

The LogRecordKindExtensions type exposes the following members.

Methods
Name | Description
IsClose | Determines whether a given LogRecordKind represents the closing of a context.
IsCustom | Determines whether a give LogRecordKind represents a custom record, emitted by the Logger class.
IsOpen | Determines whether a given LogRecordKind represents the opening of a context.
IsStandalone | Determines whether a given LogRecordKind represents a standalone record, i.e. a record that does not have a corresponding opening or closing. For instance, a CustomRecord is a standalone record.
Top
See Also

Reference

LogRecordKindExtensions Class
PostSharp.Patterns.Diagnostics Namespace


LogRecordKindExtensions.IsClose Method

LogRecordKindExtensionsIsClose Method

Determines whether a given LogRecordKind represents the closing of a context.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool IsClose(
    this LogRecordKind kind
)

Parameters

kind
Type: PostSharp.Patterns.DiagnosticsLogRecordKind
A LogRecordKind.

Return Value

Type: Boolean
true if kind represents the closing of a context, otherwise false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type LogRecordKind. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

LogRecordKindExtensions Class
PostSharp.Patterns.Diagnostics Namespace


LogRecordKindExtensions.IsCustom Method

LogRecordKindExtensionsIsCustom Method

Determines whether a give LogRecordKind represents a custom record, emitted by the Logger class.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool IsCustom(
    this LogRecordKind kind
)

Parameters

kind
Type: PostSharp.Patterns.DiagnosticsLogRecordKind
A LogRecordKind.

Return Value

Type: Boolean
true if kind is a custom kind of record emitted by the Logger class, otherwise false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type LogRecordKind. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

LogRecordKindExtensions Class
PostSharp.Patterns.Diagnostics Namespace


LogRecordKindExtensions.IsOpen Method

LogRecordKindExtensionsIsOpen Method

Determines whether a given LogRecordKind represents the opening of a context.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool IsOpen(
    this LogRecordKind kind
)

Parameters

kind
Type: PostSharp.Patterns.DiagnosticsLogRecordKind
A LogRecordKind.

Return Value

Type: Boolean
true if kind represents the opening of a context, otherwise false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type LogRecordKind. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

LogRecordKindExtensions Class
PostSharp.Patterns.Diagnostics Namespace


LogRecordKindExtensions.IsStandalone Method

LogRecordKindExtensionsIsStandalone Method

Determines whether a given LogRecordKind represents a standalone record, i.e. a record that does not have a corresponding opening or closing. For instance, a CustomRecord is a standalone record.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool IsStandalone(
    this LogRecordKind kind
)

Parameters

kind
Type: PostSharp.Patterns.DiagnosticsLogRecordKind
A LogRecordKind.

Return Value

Type: Boolean
true if kind is a standalone record, otherwise false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type LogRecordKind. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks

may represent an closing or a standalone record, depending on the context. This method shall return false for .

See Also

Reference

LogRecordKindExtensions Class
PostSharp.Patterns.Diagnostics Namespace
LogRecordKindMethodException
LogRecordKindMethodException


LogValueAttribute Class

Custom attribute that, when applied on a field or property, causes PostSharp to implement tracing when its value changes.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsLocationLevelAspect
PostSharp.Patterns.DiagnosticsLogValueAttribute

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class LogValueAttribute : LocationLevelAspect,
    ILogValueAspect, IAspect

The LogValueAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | LogValueAttribute | Initializes a new LogValueAttribute for the default profile.
Public method | LogValueAttribute(String) | Initializes a new LogValueAttribute and specifies a profile name.
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | ProfileName | Gets or sets the name of the LoggingProfile.
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from LocationLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from LocationLevelAspect.)
Public method | CompileTimeValidate(LocationInfo) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from LocationLevelAspect.)
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Inherited from Aspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from LocationLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, LocationInfo) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from LocationLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from LocationLevelAspect.)
Top
Remarks

By default, the current custom attribute follows the settings of the default profile, which adds a Debug message. You can change these default settings by choosing a different logging profile.

See Also

Reference

PostSharp.Patterns.Diagnostics Namespace


LogValueAttribute Constructor

Overload List
 | Name | Description
Public method | LogValueAttribute | Initializes a new LogValueAttribute for the default profile.
Public method | LogValueAttribute(String) | Initializes a new LogValueAttribute and specifies a profile name.
Top
See Also

Reference

LogValueAttribute Class
PostSharp.Patterns.Diagnostics Namespace


LogValueAttribute Constructor

Initializes a new LogValueAttribute for the default profile.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogValueAttribute()
See Also

Reference

LogValueAttribute Class
LogValueAttribute Overload
PostSharp.Patterns.Diagnostics Namespace


LogValueAttribute Constructor (String)

Initializes a new LogValueAttribute and specifies a profile name.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogValueAttribute(
    string profileName
)

Parameters

profileName
Type: SystemString
The name of the LoggingProfile to use.
See Also

Reference

LogValueAttribute Class
LogValueAttribute Overload
PostSharp.Patterns.Diagnostics Namespace


LogValueAttribute Properties

The LogValueAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | ProfileName | Gets or sets the name of the LoggingProfile.
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

LogValueAttribute Class
PostSharp.Patterns.Diagnostics Namespace


LogValueAttribute.ProfileName Property

LogValueAttributeProfileName Property

Gets or sets the name of the LoggingProfile.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string ProfileName { get; set; }

Property Value

Type: String

Implements

ILogValueAspectProfileName
See Also

Reference

LogValueAttribute Class
PostSharp.Patterns.Diagnostics Namespace


LogValueAttribute Methods

The LogValueAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from LocationLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from LocationLevelAspect.)
Public method | CompileTimeValidate(LocationInfo) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from LocationLevelAspect.)
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Inherited from Aspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from LocationLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, LocationInfo) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from LocationLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from LocationLevelAspect.)
Top
See Also

Reference

LogValueAttribute Class
PostSharp.Patterns.Diagnostics Namespace


NotLoggedAttribute Class

Indicates that the value of this parameter should not be logged.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Patterns.DiagnosticsNotLoggedAttribute

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class NotLoggedAttribute : Attribute

The NotLoggedAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | NotLoggedAttribute | Initializes a new instance of the NotLoggedAttribute class
Top
See Also

Reference

PostSharp.Patterns.Diagnostics Namespace


NotLoggedAttribute Constructor

Initializes a new instance of the NotLoggedAttribute class

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public NotLoggedAttribute()
See Also

Reference

NotLoggedAttribute Class
PostSharp.Patterns.Diagnostics Namespace


ThrowLoggingExceptionHandler Class

Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsThrowLoggingExceptionHandler

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ThrowLoggingExceptionHandler : ILoggingExceptionHandler

The ThrowLoggingExceptionHandler type exposes the following members.

Constructors
 | Name | Description
Public method | ThrowLoggingExceptionHandler | Initializes a new instance of the ThrowLoggingExceptionHandler class
Top
Methods
 | Name | Description
 | Initialize |
Public method | OnInternalException |
Public method | OnInvalidUserCode |
Top
See Also

Reference

PostSharp.Patterns.Diagnostics Namespace


ThrowLoggingExceptionHandler Constructor

Initializes a new instance of the ThrowLoggingExceptionHandler class

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ThrowLoggingExceptionHandler()
See Also

Reference

ThrowLoggingExceptionHandler Class
PostSharp.Patterns.Diagnostics Namespace


ThrowLoggingExceptionHandler Methods

The ThrowLoggingExceptionHandler type exposes the following members.

Methods
 | Name | Description
 | Initialize |
Public method | OnInternalException |
Public method | OnInvalidUserCode |
Top
See Also

Reference

ThrowLoggingExceptionHandler Class
PostSharp.Patterns.Diagnostics Namespace


ThrowLoggingExceptionHandler.Initialize Method

ThrowLoggingExceptionHandlerInitialize Method

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void Initialize()
See Also

Reference

ThrowLoggingExceptionHandler Class
PostSharp.Patterns.Diagnostics Namespace


ThrowLoggingExceptionHandler.OnInternalException Method

ThrowLoggingExceptionHandlerOnInternalException Method

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void OnInternalException(
    LoggingExceptionInfo exceptionInfo
)

Parameters

exceptionInfo
Type: PostSharp.Patterns.DiagnosticsLoggingExceptionInfo

Implements

ILoggingExceptionHandlerOnInternalException(LoggingExceptionInfo)
See Also

Reference

ThrowLoggingExceptionHandler Class
PostSharp.Patterns.Diagnostics Namespace


ThrowLoggingExceptionHandler.OnInvalidUserCode Method

ThrowLoggingExceptionHandlerOnInvalidUserCode Method

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void OnInvalidUserCode(
    ref CallerInfo callerInfo,
    LoggingTypeSource source,
    string message,
    params Object[] args
)

Parameters

callerInfo
Type: PostSharp.Patterns.Diagnostics.ContextsCallerInfo
source
Type: PostSharp.Patterns.DiagnosticsLoggingTypeSource
message
Type: SystemString
args
Type: SystemObject

Implements

ILoggingExceptionHandlerOnInvalidUserCode(CallerInfo, LoggingTypeSource, String, Object)
See Also

Reference

ThrowLoggingExceptionHandler Class
PostSharp.Patterns.Diagnostics Namespace


PostSharp.Patterns.Diagnostics.Audit Namespace

Classes
 | Class | Description
Public class | AuditAttribute | Custom attribute that, when applied to a method, causes PostSharp to audit execution of this method. Whenever an audited method is executed, the RecordPublished event is raised. You need to register your own logic to the RecordPublished event, for instance to append the record to a database table.
Public class | AuditRecord | Represents an audit record published by the RecordPublished event.
Public class | AuditRecordEventArgs | Arguments of the RecordPublished event.
Public class | AuditServices | Exposes a RecordPublished event, which is raised whenever an audited method is executed.


AuditAttribute Class

Custom attribute that, when applied to a method, causes PostSharp to audit execution of this method. Whenever an audited method is executed, the RecordPublished event is raised. You need to register your own logic to the RecordPublished event, for instance to append the record to a database table.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsMethodLevelAspect
PostSharp.Patterns.DiagnosticsLogAttributeBase
PostSharp.Patterns.Diagnostics.AuditAuditAttribute

Namespace: PostSharp.Patterns.Diagnostics.Audit
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class AuditAttribute : LogAttributeBase

The AuditAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | AuditAttribute | Initializes a new AuditAttribute.
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | ProfileName | Gets or sets the name of the LoggingProfile. (Inherited from LogAttributeBase.)
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(MethodBase) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Inherited from Aspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from MethodLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from MethodLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, MethodBase) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from MethodLevelAspect.)
Top
Remarks

Audit is a special kind of logging. The AuditAttribute aspects adds logging with the Audit profile, which is by default served by the AuditBackend back-end, which exposes a simple API to the AuditServices class.

The AuditAttribute aspect can be used side-by-side with the LogAttribute aspect.

See Also

Reference

PostSharp.Patterns.Diagnostics.Audit Namespace

Other Resources

Conceptual: Adding Audit to your Solution
Conceptual: Customizing the Appearance of Log Records


AuditAttribute Constructor

Initializes a new AuditAttribute.

Namespace: PostSharp.Patterns.Diagnostics.Audit
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AuditAttribute()
See Also

Reference

AuditAttribute Class
PostSharp.Patterns.Diagnostics.Audit Namespace


AuditAttribute Properties

The AuditAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | ProfileName | Gets or sets the name of the LoggingProfile. (Inherited from LogAttributeBase.)
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

AuditAttribute Class
PostSharp.Patterns.Diagnostics.Audit Namespace


AuditAttribute Methods

The AuditAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(MethodBase) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Inherited from Aspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from MethodLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from MethodLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, MethodBase) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from MethodLevelAspect.)
Top
See Also

Reference

AuditAttribute Class
PostSharp.Patterns.Diagnostics.Audit Namespace


AuditRecord Class

Represents an audit record published by the RecordPublished event.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.AuditAuditRecord

Namespace: PostSharp.Patterns.Diagnostics.Audit
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class AuditRecord

The AuditRecord type exposes the following members.

Constructors
 | Name | Description
Public method | AuditRecord | Initializes a new AuditRecord.
Top
Properties
 | Name | Description
Public property | DeclaringType | Gets the declaring type of the method.
Public property | Exception | Gets the Exception if the method failed, or null if the method succeeded.
Public property | MemberName | Gets the name of the method.
Public property | RecordKind | Gets the kind of record (typically MethodSuccess or MethodException).
Public property | Target | Gets the instance on which the method was executed, or null if the method is a static method.
Public property | Text | Gets a string describing the operation (typically, the method type, name, and parameters).
Public property | Time | Gets the time when the execution ended.
Top
Remarks

You can customize this class by inheritance. In this case, you also need to customize the AuditRecordBuilder and AuditBackend classes.

See Also

Reference

PostSharp.Patterns.Diagnostics.Audit Namespace

Other Resources

Conceptual: Adding Audit to your Solution


AuditRecord Constructor

Initializes a new AuditRecord.

Namespace: PostSharp.Patterns.Diagnostics.Audit
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AuditRecord(
    Type declaringType,
    string memberName,
    LogRecordKind recordKind
)

Parameters

declaringType
Type: SystemType
Declaring type of the audited method.
memberName
Type: SystemString
Name of the audited method.
recordKind
Type: PostSharp.Patterns.DiagnosticsLogRecordKind
Kind of record (typically MethodSuccess or MethodException).
See Also

Reference

AuditRecord Class
PostSharp.Patterns.Diagnostics.Audit Namespace


AuditRecord Properties

The AuditRecord type exposes the following members.

Properties
 | Name | Description
Public property | DeclaringType | Gets the declaring type of the method.
Public property | Exception | Gets the Exception if the method failed, or null if the method succeeded.
Public property | MemberName | Gets the name of the method.
Public property | RecordKind | Gets the kind of record (typically MethodSuccess or MethodException).
Public property | Target | Gets the instance on which the method was executed, or null if the method is a static method.
Public property | Text | Gets a string describing the operation (typically, the method type, name, and parameters).
Public property | Time | Gets the time when the execution ended.
Top
See Also

Reference

AuditRecord Class
PostSharp.Patterns.Diagnostics.Audit Namespace


AuditRecord.DeclaringType Property

AuditRecordDeclaringType Property

Gets the declaring type of the method.

Namespace: PostSharp.Patterns.Diagnostics.Audit
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Type DeclaringType { get; }

Property Value

Type: Type
See Also

Reference

AuditRecord Class
PostSharp.Patterns.Diagnostics.Audit Namespace


AuditRecord.Exception Property

AuditRecordException Property

Gets the Exception if the method failed, or null if the method succeeded.

Namespace: PostSharp.Patterns.Diagnostics.Audit
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Exception Exception { get; set; }

Property Value

Type: Exception
See Also

Reference

AuditRecord Class
PostSharp.Patterns.Diagnostics.Audit Namespace


AuditRecord.MemberName Property

AuditRecordMemberName Property

Gets the name of the method.

Namespace: PostSharp.Patterns.Diagnostics.Audit
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string MemberName { get; }

Property Value

Type: String
See Also

Reference

AuditRecord Class
PostSharp.Patterns.Diagnostics.Audit Namespace


AuditRecord.RecordKind Property

AuditRecordRecordKind Property

Gets the kind of record (typically MethodSuccess or MethodException).

Namespace: PostSharp.Patterns.Diagnostics.Audit
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogRecordKind RecordKind { get; }

Property Value

Type: LogRecordKind
See Also

Reference

AuditRecord Class
PostSharp.Patterns.Diagnostics.Audit Namespace


AuditRecord.Target Property

AuditRecordTarget Property

Gets the instance on which the method was executed, or null if the method is a static method.

Namespace: PostSharp.Patterns.Diagnostics.Audit
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Object Target { get; set; }

Property Value

Type: Object
See Also

Reference

AuditRecord Class
PostSharp.Patterns.Diagnostics.Audit Namespace


AuditRecord.Text Property

AuditRecordText Property

Gets a string describing the operation (typically, the method type, name, and parameters).

Namespace: PostSharp.Patterns.Diagnostics.Audit
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string Text { get; set; }

Property Value

Type: String
See Also

Reference

AuditRecord Class
PostSharp.Patterns.Diagnostics.Audit Namespace


AuditRecord.Time Property

AuditRecordTime Property

Gets the time when the execution ended.

Namespace: PostSharp.Patterns.Diagnostics.Audit
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public DateTime Time { get; }

Property Value

Type: DateTime
See Also

Reference

AuditRecord Class
PostSharp.Patterns.Diagnostics.Audit Namespace


AuditRecordEventArgs Class

Arguments of the RecordPublished event.
Inheritance Hierarchy
SystemObject
SystemEventArgs
PostSharp.Patterns.Diagnostics.AuditAuditRecordEventArgs

Namespace: PostSharp.Patterns.Diagnostics.Audit
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class AuditRecordEventArgs : EventArgs

The AuditRecordEventArgs type exposes the following members.

Constructors
 | Name | Description
Public method | AuditRecordEventArgs | Initializes a new AuditRecordEventArgs.
Top
Properties
 | Name | Description
Public property | Record | Gets the published record.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Audit Namespace


AuditRecordEventArgs Constructor

Initializes a new AuditRecordEventArgs.

Namespace: PostSharp.Patterns.Diagnostics.Audit
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AuditRecordEventArgs(
    AuditRecord record
)

Parameters

record
Type: PostSharp.Patterns.Diagnostics.AuditAuditRecord
The published AuditRecord.
See Also

Reference

AuditRecordEventArgs Class
PostSharp.Patterns.Diagnostics.Audit Namespace


AuditRecordEventArgs Properties

The AuditRecordEventArgs type exposes the following members.

Properties
 | Name | Description
Public property | Record | Gets the published record.
Top
See Also

Reference

AuditRecordEventArgs Class
PostSharp.Patterns.Diagnostics.Audit Namespace


AuditRecordEventArgs.Record Property

AuditRecordEventArgsRecord Property

Gets the published record.

Namespace: PostSharp.Patterns.Diagnostics.Audit
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AuditRecord Record { get; }

Property Value

Type: AuditRecord
See Also

Reference

AuditRecordEventArgs Class
PostSharp.Patterns.Diagnostics.Audit Namespace


AuditServices Class

Exposes a RecordPublished event, which is raised whenever an audited method is executed.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.AuditAuditServices

Namespace: PostSharp.Patterns.Diagnostics.Audit
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static class AuditServices

The AuditServices type exposes the following members.

Events
Name | Description
RecordPublished | Event raised whenever an audited method is executed.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Audit Namespace


AuditServices Events

The AuditServices type exposes the following members.

Events
Name | Description
RecordPublished | Event raised whenever an audited method is executed.
Top
See Also

Reference

AuditServices Class
PostSharp.Patterns.Diagnostics.Audit Namespace


AuditServices.RecordPublished Event

AuditServicesRecordPublished Event

Event raised whenever an audited method is executed.

Namespace: PostSharp.Patterns.Diagnostics.Audit
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static event EventHandler<AuditRecordEventArgs> RecordPublished

Value

Type: SystemEventHandler AuditRecordEventArgs
See Also

Reference

AuditServices Class
PostSharp.Patterns.Diagnostics.Audit Namespace

Other Resources

Conceptual: Adding Audit to your Solution


PostSharp.Patterns.Diagnostics.Backends Namespace

Classes
 | Class | Description
Public class | MetaLoggingBackend |
Public class | TextLoggingBackend | A base class for all text-based logging back-ends.
Public class | TextLoggingBackendOptions | Options for the TextLoggingBackendOptions class.


MetaLoggingBackend Class

Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingBackend
PostSharp.Patterns.Diagnostics.BackendsTextLoggingBackend
PostSharp.Patterns.Diagnostics.BackendsMetaLoggingBackend

Namespace: PostSharp.Patterns.Diagnostics.Backends
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class MetaLoggingBackend : TextLoggingBackend

The MetaLoggingBackend type exposes the following members.

Constructors
 | Name | Description
Public method | MetaLoggingBackend | Initializes a new instance of the MetaLoggingBackend class
Top
Properties
 | Name | Description
Public property | CurrentContext | Gets the current LoggingContext. (Inherited from LoggingBackend.)
Public property | IsCorrupted | (Inherited from LoggingBackend.)
Public property | IsDisposed | Determines whether the current LoggingBackend has been disposed. (Inherited from LoggingBackend.)
Public property | IsEnabled | Determines whether the current LoggingBackend is currently enabled. This property has precedence over, and does not affect, the minimal log levels set through the SetLevel(LogLevel) method. (Inherited from LoggingBackend.)
Public property | Options | Gets the back-end options. (Inherited from TextLoggingBackend.)
Top
Methods
 | Name | Description
Protected method | CreateAsyncCustomActivityContext | Creates a new AsyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateAsyncMethodContext | Creates a new AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Protected method | CreateEphemeralContext | Creates a new EphemeralLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateIteratorContext | Creates a new IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | CreateRecordBuilder | (Overrides LoggingBackendCreateRecordBuilder.)
Protected method | CreateSyncCustomActivityContext | Creates a new SyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateSyncMethodContext | Creates a new SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Protected method | CreateThreadContext | Creates a new ThreadLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateTypeSource | (Overrides LoggingBackendCreateTypeSource(LoggingNamespaceSource, Type).)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingBackend.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from TextLoggingBackend.)
Public method | GetAsyncContextOfTask | Gets the AsyncMethodLoggingContext associated with a Task. (Inherited from LoggingBackend.)
Protected method | GetBackendOptions | Gets the formatting and rendering options for the current LoggingBackend. (Inherited from TextLoggingBackend.)
Public method | GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace. (Inherited from LoggingBackend.)
Public method | GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type. (Inherited from LoggingBackend.)
Protected method | GetTextBackendOptions | (Overrides TextLoggingBackendGetTextBackendOptions.)
Public method | GetThreadContext | Returns the ThreadLoggingContext for the current Thread. (Inherited from LoggingBackend.)
Public method | OpenAsyncContext | Gets an AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Public method | OpenCustomActivityContext | Gets a LoggingContext for a custom activity (opened using OpenActivity(String) or OpenAsyncActivity(String)). (Inherited from LoggingBackend.)
Public method | OpenEphemeralContext | Gets an EphemeralLoggingContext for use in a given method. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record. (Inherited from LoggingBackend.)
Public method | OpenIteratorContext | Gets an IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | OpenSyncContext | Gets a SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Protected method | Write |
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends Namespace


MetaLoggingBackend Constructor

Initializes a new instance of the MetaLoggingBackend class

Namespace: PostSharp.Patterns.Diagnostics.Backends
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MetaLoggingBackend()
See Also

Reference

MetaLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends Namespace


MetaLoggingBackend Properties

The MetaLoggingBackend type exposes the following members.

Properties
 | Name | Description
Public property | CurrentContext | Gets the current LoggingContext. (Inherited from LoggingBackend.)
Public property | IsCorrupted | (Inherited from LoggingBackend.)
Public property | IsDisposed | Determines whether the current LoggingBackend has been disposed. (Inherited from LoggingBackend.)
Public property | IsEnabled | Determines whether the current LoggingBackend is currently enabled. This property has precedence over, and does not affect, the minimal log levels set through the SetLevel(LogLevel) method. (Inherited from LoggingBackend.)
Public property | Options | Gets the back-end options. (Inherited from TextLoggingBackend.)
Top
See Also

Reference

MetaLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends Namespace


MetaLoggingBackend Methods

The MetaLoggingBackend type exposes the following members.

Methods
 | Name | Description
Protected method | CreateAsyncCustomActivityContext | Creates a new AsyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateAsyncMethodContext | Creates a new AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Protected method | CreateEphemeralContext | Creates a new EphemeralLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateIteratorContext | Creates a new IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | CreateRecordBuilder | (Overrides LoggingBackendCreateRecordBuilder.)
Protected method | CreateSyncCustomActivityContext | Creates a new SyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateSyncMethodContext | Creates a new SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Protected method | CreateThreadContext | Creates a new ThreadLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateTypeSource | (Overrides LoggingBackendCreateTypeSource(LoggingNamespaceSource, Type).)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingBackend.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from TextLoggingBackend.)
Public method | GetAsyncContextOfTask | Gets the AsyncMethodLoggingContext associated with a Task. (Inherited from LoggingBackend.)
Protected method | GetBackendOptions | Gets the formatting and rendering options for the current LoggingBackend. (Inherited from TextLoggingBackend.)
Public method | GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace. (Inherited from LoggingBackend.)
Public method | GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type. (Inherited from LoggingBackend.)
Protected method | GetTextBackendOptions | (Overrides TextLoggingBackendGetTextBackendOptions.)
Public method | GetThreadContext | Returns the ThreadLoggingContext for the current Thread. (Inherited from LoggingBackend.)
Public method | OpenAsyncContext | Gets an AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Public method | OpenCustomActivityContext | Gets a LoggingContext for a custom activity (opened using OpenActivity(String) or OpenAsyncActivity(String)). (Inherited from LoggingBackend.)
Public method | OpenEphemeralContext | Gets an EphemeralLoggingContext for use in a given method. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record. (Inherited from LoggingBackend.)
Public method | OpenIteratorContext | Gets an IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | OpenSyncContext | Gets a SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Protected method | Write |
Top
See Also

Reference

MetaLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends Namespace


MetaLoggingBackend.CreateRecordBuilder Method

MetaLoggingBackendCreateRecordBuilder Method

Namespace: PostSharp.Patterns.Diagnostics.Backends
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override sealed LogRecordBuilder CreateRecordBuilder()

Return Value

Type: LogRecordBuilder
See Also

Reference

MetaLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends Namespace


MetaLoggingBackend.CreateTypeSource Method

MetaLoggingBackendCreateTypeSource Method

Namespace: PostSharp.Patterns.Diagnostics.Backends
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override sealed LoggingTypeSource CreateTypeSource(
    LoggingNamespaceSource parent,
    Type type
)

Parameters

parent
Type: PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
type
Type: SystemType

Return Value

Type: LoggingTypeSource
See Also

Reference

MetaLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends Namespace


MetaLoggingBackend.GetTextBackendOptions Method

MetaLoggingBackendGetTextBackendOptions Method

Namespace: PostSharp.Patterns.Diagnostics.Backends
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override TextLoggingBackendOptions GetTextBackendOptions()

Return Value

Type: TextLoggingBackendOptions
See Also

Reference

MetaLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends Namespace


MetaLoggingBackend.Write Method

MetaLoggingBackendWrite Method

Namespace: PostSharp.Patterns.Diagnostics.Backends
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void Write(
    LogLevel level,
    UnsafeString message,
    Exception exception
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel
message
Type: PostSharp.Patterns.FormattersUnsafeString
exception
Type: SystemException
See Also

Reference

MetaLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends Namespace


TextLoggingBackend Class

A base class for all text-based logging back-ends.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingBackend
PostSharp.Patterns.Diagnostics.BackendsTextLoggingBackend
More...

Namespace: PostSharp.Patterns.Diagnostics.Backends
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class TextLoggingBackend : LoggingBackend

The TextLoggingBackend type exposes the following members.

Constructors
 | Name | Description
Protected method | TextLoggingBackend | Initializes a new instance of the TextLoggingBackend class
Top
Properties
 | Name | Description
Public property | CurrentContext | Gets the current LoggingContext. (Inherited from LoggingBackend.)
Public property | IsCorrupted | (Inherited from LoggingBackend.)
Public property | IsDisposed | Determines whether the current LoggingBackend has been disposed. (Inherited from LoggingBackend.)
Public property | IsEnabled | Determines whether the current LoggingBackend is currently enabled. This property has precedence over, and does not affect, the minimal log levels set through the SetLevel(LogLevel) method. (Inherited from LoggingBackend.)
Public property | Options | Gets the back-end options.
Top
Methods
 | Name | Description
Protected method | CreateAsyncCustomActivityContext | Creates a new AsyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateAsyncMethodContext | Creates a new AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Protected method | CreateEphemeralContext | Creates a new EphemeralLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateIteratorContext | Creates a new IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | CreateRecordBuilder | Creates a new LogRecordBuilder. (Inherited from LoggingBackend.)
Protected method | CreateSyncCustomActivityContext | Creates a new SyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateSyncMethodContext | Creates a new SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Protected method | CreateThreadContext | Creates a new ThreadLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateTypeSource | Creates LoggingTypeSource for the given role and type. (Inherited from LoggingBackend.)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingBackend.)
Protected method | Dispose(Boolean) | Disposes the current object. (Overrides LoggingBackendDispose(Boolean).)
Public method | GetAsyncContextOfTask | Gets the AsyncMethodLoggingContext associated with a Task. (Inherited from LoggingBackend.)
Protected method | GetBackendOptions | Gets the formatting and rendering options for the current LoggingBackend. (Overrides LoggingBackendGetBackendOptions.)
Public method | GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace. (Inherited from LoggingBackend.)
Public method | GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type. (Inherited from LoggingBackend.)
Protected method | GetTextBackendOptions | Gets the options.
Public method | GetThreadContext | Returns the ThreadLoggingContext for the current Thread. (Inherited from LoggingBackend.)
Public method | OpenAsyncContext | Gets an AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Public method | OpenCustomActivityContext | Gets a LoggingContext for a custom activity (opened using OpenActivity(String) or OpenAsyncActivity(String)). (Inherited from LoggingBackend.)
Public method | OpenEphemeralContext | Gets an EphemeralLoggingContext for use in a given method. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record. (Inherited from LoggingBackend.)
Public method | OpenIteratorContext | Gets an IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | OpenSyncContext | Gets a SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingBackend
PostSharp.Patterns.Diagnostics.BackendsTextLoggingBackend
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsightsApplicationInsightsLoggingBackend
PostSharp.Patterns.Diagnostics.Backends.AuditAuditBackend
PostSharp.Patterns.Diagnostics.Backends.CommonLoggingCommonLoggingLoggingBackend
PostSharp.Patterns.Diagnostics.Backends.ConsoleConsoleLoggingBackend
PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibraryEnterpriseLibraryLoggingBackend
PostSharp.Patterns.Diagnostics.Backends.EventSourceEventSourceLoggingBackend
PostSharp.Patterns.Diagnostics.Backends.Log4NetLog4NetLoggingBackend
PostSharp.Patterns.Diagnostics.Backends.LoupeLoupeLoggingBackend
PostSharp.Patterns.Diagnostics.BackendsMetaLoggingBackend
PostSharp.Patterns.Diagnostics.Backends.MicrosoftMicrosoftLoggingBackend
PostSharp.Patterns.Diagnostics.Backends.NLogNLogLoggingBackend
PostSharp.Patterns.Diagnostics.Backends.SerilogSerilogLoggingBackend
PostSharp.Patterns.Diagnostics.Backends.TraceTraceLoggingBackend
PostSharp.Patterns.Diagnostics.Backends.TraceSourceTraceSourceLoggingBackend


TextLoggingBackend Constructor

Initializes a new instance of the TextLoggingBackend class

Namespace: PostSharp.Patterns.Diagnostics.Backends
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected TextLoggingBackend()
See Also

Reference

TextLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends Namespace


TextLoggingBackend Properties

The TextLoggingBackend type exposes the following members.

Properties
 | Name | Description
Public property | CurrentContext | Gets the current LoggingContext. (Inherited from LoggingBackend.)
Public property | IsCorrupted | (Inherited from LoggingBackend.)
Public property | IsDisposed | Determines whether the current LoggingBackend has been disposed. (Inherited from LoggingBackend.)
Public property | IsEnabled | Determines whether the current LoggingBackend is currently enabled. This property has precedence over, and does not affect, the minimal log levels set through the SetLevel(LogLevel) method. (Inherited from LoggingBackend.)
Public property | Options | Gets the back-end options.
Top
See Also

Reference

TextLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends Namespace


TextLoggingBackend.Options Property

TextLoggingBackendOptions Property

Gets the back-end options.

Namespace: PostSharp.Patterns.Diagnostics.Backends
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TextLoggingBackendOptions Options { get; }

Property Value

Type: TextLoggingBackendOptions
See Also

Reference

TextLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends Namespace


TextLoggingBackend Methods

The TextLoggingBackend type exposes the following members.

Methods
 | Name | Description
Protected method | CreateAsyncCustomActivityContext | Creates a new AsyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateAsyncMethodContext | Creates a new AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Protected method | CreateEphemeralContext | Creates a new EphemeralLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateIteratorContext | Creates a new IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | CreateRecordBuilder | Creates a new LogRecordBuilder. (Inherited from LoggingBackend.)
Protected method | CreateSyncCustomActivityContext | Creates a new SyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateSyncMethodContext | Creates a new SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Protected method | CreateThreadContext | Creates a new ThreadLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateTypeSource | Creates LoggingTypeSource for the given role and type. (Inherited from LoggingBackend.)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingBackend.)
Protected method | Dispose(Boolean) | Disposes the current object. (Overrides LoggingBackendDispose(Boolean).)
Public method | GetAsyncContextOfTask | Gets the AsyncMethodLoggingContext associated with a Task. (Inherited from LoggingBackend.)
Protected method | GetBackendOptions | Gets the formatting and rendering options for the current LoggingBackend. (Overrides LoggingBackendGetBackendOptions.)
Public method | GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace. (Inherited from LoggingBackend.)
Public method | GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type. (Inherited from LoggingBackend.)
Protected method | GetTextBackendOptions | Gets the options.
Public method | GetThreadContext | Returns the ThreadLoggingContext for the current Thread. (Inherited from LoggingBackend.)
Public method | OpenAsyncContext | Gets an AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Public method | OpenCustomActivityContext | Gets a LoggingContext for a custom activity (opened using OpenActivity(String) or OpenAsyncActivity(String)). (Inherited from LoggingBackend.)
Public method | OpenEphemeralContext | Gets an EphemeralLoggingContext for use in a given method. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record. (Inherited from LoggingBackend.)
Public method | OpenIteratorContext | Gets an IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | OpenSyncContext | Gets a SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Top
See Also

Reference

TextLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends Namespace


TextLoggingBackend.Dispose Method

TextLoggingBackendDispose Method

Overload List
 | Name | Description
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingBackend.)
Protected method | Dispose(Boolean) | Disposes the current object. (Overrides LoggingBackendDispose(Boolean).)
Top
See Also

Reference

TextLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends Namespace


TextLoggingBackend.Dispose Method (Boolean)

TextLoggingBackendDispose Method (Boolean)

Disposes the current object.

Namespace: PostSharp.Patterns.Diagnostics.Backends
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void Dispose(
    bool disposing
)

Parameters

disposing
Type: SystemBoolean
true if the Dispose method has been called, false if the object is being finalized by the garbage collector.
See Also

Reference

TextLoggingBackend Class
Dispose Overload
PostSharp.Patterns.Diagnostics.Backends Namespace


TextLoggingBackend.GetBackendOptions Method

TextLoggingBackendGetBackendOptions Method

Gets the formatting and rendering options for the current LoggingBackend.

Namespace: PostSharp.Patterns.Diagnostics.Backends
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override sealed LoggingBackendOptions GetBackendOptions()

Return Value

Type: LoggingBackendOptions
The LoggingBackendOptions for the current LoggingBackend.
See Also

Reference

TextLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends Namespace


TextLoggingBackend.GetTextBackendOptions Method

TextLoggingBackendGetTextBackendOptions Method

Gets the options.

Namespace: PostSharp.Patterns.Diagnostics.Backends
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected abstract TextLoggingBackendOptions GetTextBackendOptions()

Return Value

Type: TextLoggingBackendOptions
See Also

Reference

TextLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


TextLoggingBackendOptions Class

Options for the TextLoggingBackendOptions class.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingBackendOptions
PostSharp.Patterns.Diagnostics.BackendsTextLoggingBackendOptions
More...

Namespace: PostSharp.Patterns.Diagnostics.Backends
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class TextLoggingBackendOptions : LoggingBackendOptions

The TextLoggingBackendOptions type exposes the following members.

Constructors
 | Name | Description
Public method | TextLoggingBackendOptions | Initializes a new instance of the TextLoggingBackendOptions class
Top
Properties
 | Name | Description
Public property | ActionMaxLength | Max length of a log record. The default value is 2048.
Public property | AppendTrailingPeriod | Determines whether log messages should be ended with a trailing period. The default value is true because we really like trailing periods at PostSharp, but other opinions are valid.
Public property | ContextMaxLength | Max length of the Description property. (Inherited from LoggingBackendOptions.)
Public property | Delimiter | String used to separate different parts of the logging record. The default value is a pipe surrounded by spaces ( | ).
Public property | IncludeExceptionDetails | Determines whether exception details (basically Exception.ToString) should be appended to the log. The default value is false.
Public property | IncludeNamespace | Determines whether the full namespace of types should be included in the log. The default value is false.
Public property | IncludeType | Determines whether the name of the type of the logged method should be included in the log. The default value is true.
Public property | IndentSpaces | Number of spaces for each indentation level. The default value is 2.
Public property | LogLevelIgnoredForSystemRecords | Determines whether the Level property is ignored by the current back-end for auto-generated (i.e. non-manual) logging records. Some back-ends may not support overriding the level of records. (Inherited from LoggingBackendOptions.)
Public property | ShouldLogExceptionPredicate | Gets or sets a predicate that determines whether an exception should be logged. This predicate is evaluated only when the method entry is not logged. When the method entry is logged, exceptions are always logged.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends Namespace

Other Resources

Conceptual: Customizing the Appearance of Log Records
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingBackendOptions
PostSharp.Patterns.Diagnostics.BackendsTextLoggingBackendOptions
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsightsApplicationInsightsLoggingBackendOptions
PostSharp.Patterns.Diagnostics.Backends.AuditAuditBackendOptions
PostSharp.Patterns.Diagnostics.Backends.CommonLoggingCommonLoggingLoggingBackendOptions
PostSharp.Patterns.Diagnostics.Backends.ConsoleConsoleLoggingBackendOptions
PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibraryEnterpriseLibraryLoggingBackendOptions
PostSharp.Patterns.Diagnostics.Backends.EventSourceEventSourceLoggingBackendOptions
PostSharp.Patterns.Diagnostics.Backends.Log4NetLog4NetLoggingBackendOptions
PostSharp.Patterns.Diagnostics.Backends.LoupeLoupeLoggingBackendOptions
PostSharp.Patterns.Diagnostics.Backends.MicrosoftMicrosoftLoggingBackendOptions
PostSharp.Patterns.Diagnostics.Backends.NLogNLogLoggingBackendOptions
PostSharp.Patterns.Diagnostics.Backends.SerilogSerilogLoggingBackendOptions
PostSharp.Patterns.Diagnostics.Backends.TraceTraceLoggingBackendOptions
PostSharp.Patterns.Diagnostics.Backends.TraceSourceTraceSourceLoggingBackendOptions


TextLoggingBackendOptions Constructor

Initializes a new instance of the TextLoggingBackendOptions class

Namespace: PostSharp.Patterns.Diagnostics.Backends
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TextLoggingBackendOptions()
See Also

Reference

TextLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends Namespace


TextLoggingBackendOptions Properties

The TextLoggingBackendOptions type exposes the following members.

Properties
 | Name | Description
Public property | ActionMaxLength | Max length of a log record. The default value is 2048.
Public property | AppendTrailingPeriod | Determines whether log messages should be ended with a trailing period. The default value is true because we really like trailing periods at PostSharp, but other opinions are valid.
Public property | ContextMaxLength | Max length of the Description property. (Inherited from LoggingBackendOptions.)
Public property | Delimiter | String used to separate different parts of the logging record. The default value is a pipe surrounded by spaces ( | ).
Public property | IncludeExceptionDetails | Determines whether exception details (basically Exception.ToString) should be appended to the log. The default value is false.
Public property | IncludeNamespace | Determines whether the full namespace of types should be included in the log. The default value is false.
Public property | IncludeType | Determines whether the name of the type of the logged method should be included in the log. The default value is true.
Public property | IndentSpaces | Number of spaces for each indentation level. The default value is 2.
Public property | LogLevelIgnoredForSystemRecords | Determines whether the Level property is ignored by the current back-end for auto-generated (i.e. non-manual) logging records. Some back-ends may not support overriding the level of records. (Inherited from LoggingBackendOptions.)
Public property | ShouldLogExceptionPredicate | Gets or sets a predicate that determines whether an exception should be logged. This predicate is evaluated only when the method entry is not logged. When the method entry is logged, exceptions are always logged.
Top
See Also

Reference

TextLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends Namespace


TextLoggingBackendOptions.ActionMaxLength Property

TextLoggingBackendOptionsActionMaxLength Property

Max length of a log record. The default value is 2048.

Namespace: PostSharp.Patterns.Diagnostics.Backends
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int ActionMaxLength { get; set; }

Property Value

Type: Int32
Remarks

This property determines the size of the buffer allocated to build the record. If the real lenght exceeds the value of ActionMaxLength, no exception is thrown, and the excess content is ignored.

See Also

Reference

TextLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends Namespace


TextLoggingBackendOptions.AppendTrailingPeriod Property

TextLoggingBackendOptionsAppendTrailingPeriod Property

Determines whether log messages should be ended with a trailing period. The default value is true because we really like trailing periods at PostSharp, but other opinions are valid.

Namespace: PostSharp.Patterns.Diagnostics.Backends
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool AppendTrailingPeriod { get; set; }

Property Value

Type: Boolean
See Also

Reference

TextLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends Namespace


TextLoggingBackendOptions.Delimiter Property

TextLoggingBackendOptionsDelimiter Property

String used to separate different parts of the logging record. The default value is a pipe surrounded by spaces ( | ).

Namespace: PostSharp.Patterns.Diagnostics.Backends
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string Delimiter { get; set; }

Property Value

Type: String
See Also

Reference

TextLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends Namespace


TextLoggingBackendOptions.IncludeExceptionDetails Property

TextLoggingBackendOptionsIncludeExceptionDetails Property

Determines whether exception details (basically Exception.ToString) should be appended to the log. The default value is false.

Namespace: PostSharp.Patterns.Diagnostics.Backends
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IncludeExceptionDetails { get; set; }

Property Value

Type: Boolean
Remarks
Some back-ends may ignore this setting and always include exception details.
See Also

Reference

TextLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends Namespace


TextLoggingBackendOptions.IncludeNamespace Property

TextLoggingBackendOptionsIncludeNamespace Property

Determines whether the full namespace of types should be included in the log. The default value is false.

Namespace: PostSharp.Patterns.Diagnostics.Backends
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IncludeNamespace { get; set; }

Property Value

Type: Boolean
See Also

Reference

TextLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends Namespace


TextLoggingBackendOptions.IncludeType Property

TextLoggingBackendOptionsIncludeType Property

Determines whether the name of the type of the logged method should be included in the log. The default value is true.

Namespace: PostSharp.Patterns.Diagnostics.Backends
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IncludeType { get; set; }

Property Value

Type: Boolean
See Also

Reference

TextLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends Namespace


TextLoggingBackendOptions.IndentSpaces Property

TextLoggingBackendOptionsIndentSpaces Property

Number of spaces for each indentation level. The default value is 2.

Namespace: PostSharp.Patterns.Diagnostics.Backends
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int IndentSpaces { get; set; }

Property Value

Type: Int32
See Also

Reference

TextLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends Namespace


TextLoggingBackendOptions.ShouldLogExceptionPredicate Property

TextLoggingBackendOptionsShouldLogExceptionPredicate Property

Gets or sets a predicate that determines whether an exception should be logged. This predicate is evaluated only when the method entry is not logged. When the method entry is logged, exceptions are always logged.

Namespace: PostSharp.Patterns.Diagnostics.Backends
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Func<Exception, bool> ShouldLogExceptionPredicate { get; set; }

Property Value

Type: Func Exception, Boolean
See Also

Reference

TextLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends Namespace


PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights Namespace

Classes
 | Class | Description
Public class | ApplicationInsightsLoggingBackend | Logging back-end for Microsoft Application Insights.
Public class | ApplicationInsightsLoggingBackendOptions | Options for ApplicationInsightsLoggingBackend.
Public class | ApplicationInsightsLoggingTypeSource | Initializes a new ApplicationInsightsLoggingTypeSource.
Public class | ApplicationInsightsLogRecordBuilder | LogRecordBuilder for ApplicationInsightsLoggingBackend.


ApplicationInsightsLoggingBackend Class

Logging back-end for Microsoft Application Insights.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingBackend
PostSharp.Patterns.Diagnostics.BackendsTextLoggingBackend
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsightsApplicationInsightsLoggingBackend

Namespace: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights
Assembly: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights (in PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class ApplicationInsightsLoggingBackend : TextLoggingBackend

The ApplicationInsightsLoggingBackend type exposes the following members.

Constructors
 | Name | Description
Public method | ApplicationInsightsLoggingBackend | Initializes a new ApplicationInsightsLoggingBackend.
Public method | ApplicationInsightsLoggingBackend(String) | Creates ApplicationInsightsLoggingBackend that uses the given instrumentation key.
Top
Properties
 | Name | Description
Public property | CurrentContext | Gets the current LoggingContext. (Inherited from LoggingBackend.)
Public property | IsCorrupted | (Inherited from LoggingBackend.)
Public property | IsDisposed | Determines whether the current LoggingBackend has been disposed. (Inherited from LoggingBackend.)
Public property | IsEnabled | Determines whether the current LoggingBackend is currently enabled. This property has precedence over, and does not affect, the minimal log levels set through the SetLevel(LogLevel) method. (Inherited from LoggingBackend.)
Public property | Options | Gets the back-end options.
Top
Methods
 | Name | Description
Protected method | CreateAsyncCustomActivityContext | Creates a new AsyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateAsyncMethodContext | Creates a new AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Protected method | CreateEphemeralContext | Creates a new EphemeralLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateIteratorContext | Creates a new IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | CreateRecordBuilder | Creates a new LogRecordBuilder. (Overrides LoggingBackendCreateRecordBuilder.)
Protected method | CreateSyncCustomActivityContext | Creates a new SyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateSyncMethodContext | Creates a new SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Protected method | CreateThreadContext | Creates a new ThreadLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateTypeSource | Creates LoggingTypeSource for the given role and type. (Overrides LoggingBackendCreateTypeSource(LoggingNamespaceSource, Type).)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingBackend.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from TextLoggingBackend.)
Protected method | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Overrides ObjectFinalize.)
Public method | Flush | Flushes the in-memory buffer, to make sure buffered data reach the server immediately.
Public method | GetAsyncContextOfTask | Gets the AsyncMethodLoggingContext associated with a Task. (Inherited from LoggingBackend.)
Protected method | GetBackendOptions | Gets the formatting and rendering options for the current LoggingBackend. (Inherited from TextLoggingBackend.)
Public method | GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace. (Inherited from LoggingBackend.)
Public method | GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type. (Inherited from LoggingBackend.)
Protected method | GetTextBackendOptions | Gets the back-end options. (Overrides TextLoggingBackendGetTextBackendOptions.)
Public method | GetThreadContext | Returns the ThreadLoggingContext for the current Thread. (Inherited from LoggingBackend.)
Public method | OpenAsyncContext | Gets an AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Public method | OpenCustomActivityContext | Gets a LoggingContext for a custom activity (opened using OpenActivity(String) or OpenAsyncActivity(String)). (Inherited from LoggingBackend.)
Public method | OpenEphemeralContext | Gets an EphemeralLoggingContext for use in a given method. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record. (Inherited from LoggingBackend.)
Public method | OpenIteratorContext | Gets an IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | OpenSyncContext | Gets a SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights Namespace

Other Resources

Conceptual: Adding Detailed Logging to your Solution


ApplicationInsightsLoggingBackend Constructor

Overload List
 | Name | Description
Public method | ApplicationInsightsLoggingBackend | Initializes a new ApplicationInsightsLoggingBackend.
Public method | ApplicationInsightsLoggingBackend(String) | Creates ApplicationInsightsLoggingBackend that uses the given instrumentation key.
Top
See Also

Reference

ApplicationInsightsLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights Namespace


ApplicationInsightsLoggingBackend Constructor

Initializes a new ApplicationInsightsLoggingBackend.

Namespace: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights
Assembly: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights (in PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ApplicationInsightsLoggingBackend()
See Also

Reference

ApplicationInsightsLoggingBackend Class
ApplicationInsightsLoggingBackend Overload
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights Namespace


ApplicationInsightsLoggingBackend Constructor (String)

Creates ApplicationInsightsLoggingBackend that uses the given instrumentation key.

Namespace: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights
Assembly: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights (in PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ApplicationInsightsLoggingBackend(
    string instrumentationKey
)

Parameters

instrumentationKey
Type: SystemString
See Also

Reference

ApplicationInsightsLoggingBackend Class
ApplicationInsightsLoggingBackend Overload
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights Namespace


ApplicationInsightsLoggingBackend Properties

The ApplicationInsightsLoggingBackend type exposes the following members.

Properties
 | Name | Description
Public property | CurrentContext | Gets the current LoggingContext. (Inherited from LoggingBackend.)
Public property | IsCorrupted | (Inherited from LoggingBackend.)
Public property | IsDisposed | Determines whether the current LoggingBackend has been disposed. (Inherited from LoggingBackend.)
Public property | IsEnabled | Determines whether the current LoggingBackend is currently enabled. This property has precedence over, and does not affect, the minimal log levels set through the SetLevel(LogLevel) method. (Inherited from LoggingBackend.)
Public property | Options | Gets the back-end options.
Top
See Also

Reference

ApplicationInsightsLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights Namespace


ApplicationInsightsLoggingBackend.Options Property

ApplicationInsightsLoggingBackendOptions Property

Gets the back-end options.

Namespace: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights
Assembly: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights (in PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ApplicationInsightsLoggingBackendOptions Options { get; }

Property Value

Type: ApplicationInsightsLoggingBackendOptions
See Also

Reference

ApplicationInsightsLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights Namespace


ApplicationInsightsLoggingBackend Methods

The ApplicationInsightsLoggingBackend type exposes the following members.

Methods
 | Name | Description
Protected method | CreateAsyncCustomActivityContext | Creates a new AsyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateAsyncMethodContext | Creates a new AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Protected method | CreateEphemeralContext | Creates a new EphemeralLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateIteratorContext | Creates a new IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | CreateRecordBuilder | Creates a new LogRecordBuilder. (Overrides LoggingBackendCreateRecordBuilder.)
Protected method | CreateSyncCustomActivityContext | Creates a new SyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateSyncMethodContext | Creates a new SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Protected method | CreateThreadContext | Creates a new ThreadLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateTypeSource | Creates LoggingTypeSource for the given role and type. (Overrides LoggingBackendCreateTypeSource(LoggingNamespaceSource, Type).)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingBackend.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from TextLoggingBackend.)
Protected method | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Overrides ObjectFinalize.)
Public method | Flush | Flushes the in-memory buffer, to make sure buffered data reach the server immediately.
Public method | GetAsyncContextOfTask | Gets the AsyncMethodLoggingContext associated with a Task. (Inherited from LoggingBackend.)
Protected method | GetBackendOptions | Gets the formatting and rendering options for the current LoggingBackend. (Inherited from TextLoggingBackend.)
Public method | GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace. (Inherited from LoggingBackend.)
Public method | GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type. (Inherited from LoggingBackend.)
Protected method | GetTextBackendOptions | Gets the back-end options. (Overrides TextLoggingBackendGetTextBackendOptions.)
Public method | GetThreadContext | Returns the ThreadLoggingContext for the current Thread. (Inherited from LoggingBackend.)
Public method | OpenAsyncContext | Gets an AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Public method | OpenCustomActivityContext | Gets a LoggingContext for a custom activity (opened using OpenActivity(String) or OpenAsyncActivity(String)). (Inherited from LoggingBackend.)
Public method | OpenEphemeralContext | Gets an EphemeralLoggingContext for use in a given method. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record. (Inherited from LoggingBackend.)
Public method | OpenIteratorContext | Gets an IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | OpenSyncContext | Gets a SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Top
See Also

Reference

ApplicationInsightsLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights Namespace


ApplicationInsightsLoggingBackend.CreateRecordBuilder Method

ApplicationInsightsLoggingBackendCreateRecordBuilder Method

Creates a new LogRecordBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights
Assembly: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights (in PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override LogRecordBuilder CreateRecordBuilder()

Return Value

Type: LogRecordBuilder
A new LogRecordBuilder.
See Also

Reference

ApplicationInsightsLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


ApplicationInsightsLoggingBackend.CreateTypeSource Method

ApplicationInsightsLoggingBackendCreateTypeSource Method

Creates LoggingTypeSource for the given role and type.

Namespace: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights
Assembly: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights (in PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override LoggingTypeSource CreateTypeSource(
    LoggingNamespaceSource parent,
    Type type
)

Parameters

parent
Type: PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
type
Type: SystemType

Return Value

Type: LoggingTypeSource
See Also

Reference

ApplicationInsightsLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


ApplicationInsightsLoggingBackend.Finalize Method

ApplicationInsightsLoggingBackendFinalize Method

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.

Namespace: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights
Assembly: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights (in PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void Finalize()

Implements

ObjectFinalize
See Also

Reference

ApplicationInsightsLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights Namespace


ApplicationInsightsLoggingBackend.Flush Method

ApplicationInsightsLoggingBackendFlush Method

Flushes the in-memory buffer, to make sure buffered data reach the server immediately.

Namespace: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights
Assembly: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights (in PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Flush()
See Also

Reference

ApplicationInsightsLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights Namespace


ApplicationInsightsLoggingBackend.GetTextBackendOptions Method

ApplicationInsightsLoggingBackendGetTextBackendOptions Method

Gets the back-end options.

Namespace: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights
Assembly: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights (in PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override TextLoggingBackendOptions GetTextBackendOptions()

Return Value

Type: TextLoggingBackendOptions
See Also

Reference

ApplicationInsightsLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights Namespace


ApplicationInsightsLoggingBackendOptions Class

Options for ApplicationInsightsLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingBackendOptions
PostSharp.Patterns.Diagnostics.BackendsTextLoggingBackendOptions
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsightsApplicationInsightsLoggingBackendOptions

Namespace: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights
Assembly: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights (in PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class ApplicationInsightsLoggingBackendOptions : TextLoggingBackendOptions

The ApplicationInsightsLoggingBackendOptions type exposes the following members.

Constructors
 | Name | Description
Public method | ApplicationInsightsLoggingBackendOptions | Initializes a new instance of the ApplicationInsightsLoggingBackendOptions class
Top
Properties
 | Name | Description
Public property | ActionMaxLength | Max length of a log record. The default value is 2048. (Inherited from TextLoggingBackendOptions.)
Public property | AppendTrailingPeriod | Determines whether log messages should be ended with a trailing period. The default value is true because we really like trailing periods at PostSharp, but other opinions are valid. (Inherited from TextLoggingBackendOptions.)
Public property | ContextMaxLength | Max length of the Description property. (Inherited from LoggingBackendOptions.)
Public property | Delimiter | String used to separate different parts of the logging record. The default value is a pipe surrounded by spaces ( | ). (Inherited from TextLoggingBackendOptions.)
Public property | IncludeExceptionDetails | Determines whether exception details (basically Exception.ToString) should be appended to the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeNamespace | Determines whether the full namespace of types should be included in the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeType | Determines whether the name of the type of the logged method should be included in the log. The default value is true. (Inherited from TextLoggingBackendOptions.)
Public property | IndentSpaces | Number of spaces for each indentation level. The default value is 2. (Inherited from TextLoggingBackendOptions.)
Public property | LogLevelIgnoredForSystemRecords | Determines whether the Level property is ignored by the current back-end for auto-generated (i.e. non-manual) logging records. Some back-ends may not support overriding the level of records. (Inherited from LoggingBackendOptions.)
Public property | ShouldLogExceptionPredicate | Gets or sets a predicate that determines whether an exception should be logged. This predicate is evaluated only when the method entry is not logged. When the method entry is logged, exceptions are always logged. (Inherited from TextLoggingBackendOptions.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights Namespace


ApplicationInsightsLoggingBackendOptions Constructor

Initializes a new instance of the ApplicationInsightsLoggingBackendOptions class

Namespace: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights
Assembly: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights (in PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ApplicationInsightsLoggingBackendOptions()
See Also

Reference

ApplicationInsightsLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights Namespace


ApplicationInsightsLoggingBackendOptions Properties

The ApplicationInsightsLoggingBackendOptions type exposes the following members.

Properties
 | Name | Description
Public property | ActionMaxLength | Max length of a log record. The default value is 2048. (Inherited from TextLoggingBackendOptions.)
Public property | AppendTrailingPeriod | Determines whether log messages should be ended with a trailing period. The default value is true because we really like trailing periods at PostSharp, but other opinions are valid. (Inherited from TextLoggingBackendOptions.)
Public property | ContextMaxLength | Max length of the Description property. (Inherited from LoggingBackendOptions.)
Public property | Delimiter | String used to separate different parts of the logging record. The default value is a pipe surrounded by spaces ( | ). (Inherited from TextLoggingBackendOptions.)
Public property | IncludeExceptionDetails | Determines whether exception details (basically Exception.ToString) should be appended to the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeNamespace | Determines whether the full namespace of types should be included in the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeType | Determines whether the name of the type of the logged method should be included in the log. The default value is true. (Inherited from TextLoggingBackendOptions.)
Public property | IndentSpaces | Number of spaces for each indentation level. The default value is 2. (Inherited from TextLoggingBackendOptions.)
Public property | LogLevelIgnoredForSystemRecords | Determines whether the Level property is ignored by the current back-end for auto-generated (i.e. non-manual) logging records. Some back-ends may not support overriding the level of records. (Inherited from LoggingBackendOptions.)
Public property | ShouldLogExceptionPredicate | Gets or sets a predicate that determines whether an exception should be logged. This predicate is evaluated only when the method entry is not logged. When the method entry is logged, exceptions are always logged. (Inherited from TextLoggingBackendOptions.)
Top
See Also

Reference

ApplicationInsightsLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights Namespace


ApplicationInsightsLoggingTypeSource Class

Initializes a new ApplicationInsightsLoggingTypeSource.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
PostSharp.Patterns.DiagnosticsLoggingTypeSource
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsightsApplicationInsightsLoggingTypeSource

Namespace: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights
Assembly: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights (in PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class ApplicationInsightsLoggingTypeSource : LoggingTypeSource

The ApplicationInsightsLoggingTypeSource type exposes the following members.

Constructors
 | Name | Description
Public method | ApplicationInsightsLoggingTypeSource | Initializes a new ApplicationInsightsLoggingTypeSource.
Top
Properties
 | Name | Description
Public property | Backend | Gets the parent LoggingBackend. (Inherited from LoggingNamespaceSource.)
Public property | DisplayFullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the DisplayFullName property does not include the arity, i.e. the full name of List<T> is System.Collections.Generic.List. (Inherited from LoggingNamespaceSource.)
Public property | DisplayName | Gets the last component of the name of the type or namespace, in the form that should be reported to the log. For generic types, the DisplayName property does not include the arity, i.e. the name of List<T> is List. (Inherited from LoggingNamespaceSource.)
Public property | FullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the FullName property includes the arity, i.e. the full name of List<T> is System.Collections.Generic.List`1. (Inherited from LoggingNamespaceSource.)
Public property | GenericParameterCount | Gets the number of generic parameters in SourceType. (Inherited from LoggingTypeSource.)
Public property | Level | Gets the minimal LogLevel for which logging is enabled for the current namespace or type. (Inherited from LoggingNamespaceSource.)
Public property | Name | Gets the last component of the name of the type or namespace. For instance, when FullName is PostSharp.Patterns.Diagnostics.LoggingBackend, Name is LoggingBackend. For generic types, the Name property includes the arity, i.e. the name of List<T> is List`1. (Inherited from LoggingNamespaceSource.)
Public property | Options | Gets the LoggingRoleConfiguration for the current role. This property is a shortcut to LoggingServices.Roles[this.Role]. (Inherited from LoggingTypeSource.)
Public property | Parent | Gets the parent LoggingNamespaceSource, or null if the current object represents the root namespace. (Inherited from LoggingNamespaceSource.)
Public property | Role | Gets the logging role for the current role. Typical values of this property are listed in the LoggingRoles class. (Inherited from LoggingNamespaceSource.)
Public property | SourceType | The type represented by the current LoggingTypeSource. (Inherited from LoggingTypeSource.)
Top
Methods
 | Name | Description
Protected method | IsBackendEnabled | Checks whether logging is enabled in the back-end for the given level. (Overrides LoggingTypeSourceIsBackendEnabled(LogLevel).)
Public method | IsEnabled | Determines whether logging is enabled for the given LogLevel. (Inherited from LoggingTypeSource.)
Public method | Refresh | Refreshes the logging level from the back-end from the current node and all children nodes. The back-end-defined logging level is cached for performance reasons. (Inherited from LoggingTypeSource.)
Public method | SetLevel | Sets the minimal LogLevel for which logging is enabled for the current namespace and type and all children namespaces and types. (Inherited from LoggingNamespaceSource.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights Namespace


ApplicationInsightsLoggingTypeSource Constructor

Initializes a new ApplicationInsightsLoggingTypeSource.

Namespace: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights
Assembly: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights (in PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ApplicationInsightsLoggingTypeSource(
    LoggingNamespaceSource parent,
    Type type
)

Parameters

parent
Type: PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
The parent LoggingNamespaceSource.
type
Type: SystemType
The source Type emitting the log records.
See Also

Reference

ApplicationInsightsLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights Namespace


ApplicationInsightsLoggingTypeSource Properties

The ApplicationInsightsLoggingTypeSource type exposes the following members.

Properties
 | Name | Description
Public property | Backend | Gets the parent LoggingBackend. (Inherited from LoggingNamespaceSource.)
Public property | DisplayFullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the DisplayFullName property does not include the arity, i.e. the full name of List<T> is System.Collections.Generic.List. (Inherited from LoggingNamespaceSource.)
Public property | DisplayName | Gets the last component of the name of the type or namespace, in the form that should be reported to the log. For generic types, the DisplayName property does not include the arity, i.e. the name of List<T> is List. (Inherited from LoggingNamespaceSource.)
Public property | FullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the FullName property includes the arity, i.e. the full name of List<T> is System.Collections.Generic.List`1. (Inherited from LoggingNamespaceSource.)
Public property | GenericParameterCount | Gets the number of generic parameters in SourceType. (Inherited from LoggingTypeSource.)
Public property | Level | Gets the minimal LogLevel for which logging is enabled for the current namespace or type. (Inherited from LoggingNamespaceSource.)
Public property | Name | Gets the last component of the name of the type or namespace. For instance, when FullName is PostSharp.Patterns.Diagnostics.LoggingBackend, Name is LoggingBackend. For generic types, the Name property includes the arity, i.e. the name of List<T> is List`1. (Inherited from LoggingNamespaceSource.)
Public property | Options | Gets the LoggingRoleConfiguration for the current role. This property is a shortcut to LoggingServices.Roles[this.Role]. (Inherited from LoggingTypeSource.)
Public property | Parent | Gets the parent LoggingNamespaceSource, or null if the current object represents the root namespace. (Inherited from LoggingNamespaceSource.)
Public property | Role | Gets the logging role for the current role. Typical values of this property are listed in the LoggingRoles class. (Inherited from LoggingNamespaceSource.)
Public property | SourceType | The type represented by the current LoggingTypeSource. (Inherited from LoggingTypeSource.)
Top
See Also

Reference

ApplicationInsightsLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights Namespace


ApplicationInsightsLoggingTypeSource Methods

The ApplicationInsightsLoggingTypeSource type exposes the following members.

Methods
 | Name | Description
Protected method | IsBackendEnabled | Checks whether logging is enabled in the back-end for the given level. (Overrides LoggingTypeSourceIsBackendEnabled(LogLevel).)
Public method | IsEnabled | Determines whether logging is enabled for the given LogLevel. (Inherited from LoggingTypeSource.)
Public method | Refresh | Refreshes the logging level from the back-end from the current node and all children nodes. The back-end-defined logging level is cached for performance reasons. (Inherited from LoggingTypeSource.)
Public method | SetLevel | Sets the minimal LogLevel for which logging is enabled for the current namespace and type and all children namespaces and types. (Inherited from LoggingNamespaceSource.)
Top
See Also

Reference

ApplicationInsightsLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights Namespace


ApplicationInsightsLoggingTypeSource.IsBackendEnabled Method

ApplicationInsightsLoggingTypeSourceIsBackendEnabled Method

Checks whether logging is enabled in the back-end for the given level.

Namespace: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights
Assembly: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights (in PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override bool IsBackendEnabled(
    LogLevel level
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel

Return Value

Type: Boolean
Remarks

The result of this method is cached. To invalidate the cache, call the Refresh method.

See Also

Reference

ApplicationInsightsLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


ApplicationInsightsLogRecordBuilder Class

LogRecordBuilder for ApplicationInsightsLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.RecordBuildersLogRecordBuilder
PostSharp.Patterns.Diagnostics.RecordBuildersTextLogRecordBuilder
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsightsApplicationInsightsLogRecordBuilder

Namespace: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights
Assembly: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights (in PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class ApplicationInsightsLogRecordBuilder : TextLogRecordBuilder

The ApplicationInsightsLogRecordBuilder type exposes the following members.

Constructors
 | Name | Description
Public method | ApplicationInsightsLogRecordBuilder | Initializes a new ApplicationInsightsLogRecordBuilder.
Top
Properties
 | Name | Description
Public property | Backend | Gets the parent back-end. (Inherited from TextLogRecordBuilder.)
Public property | BackendOptions | Shortcut for this.Backend.Options. (Inherited from TextLogRecordBuilder.)
Protected property | Context | Gets the LoggingContext to which the record belongs. (Inherited from LogRecordBuilder.)
Public property | Exception | Gets the Exception for the current record, or null if no exception is associated to the current record. (Inherited from TextLogRecordBuilder.)
Public property | IsDisposed | (Inherited from LogRecordBuilder.)
Protected property | Level | Gets the LogLevel for the current record. (Inherited from TextLogRecordBuilder.)
Public property | MemberName | Gets the name of the method, property or field for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Options | Gets the LoggingOptions for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Profile | Gets the LoggingProfile for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | RecordKind | Gets the kind of the current record (e.g. MethodEntry or MethodException). (Inherited from LogRecordBuilder.)
Public property | SourceLineInfo | Gets the SourceLineInfo for the current record. (Inherited from TextLogRecordBuilder.)
Public property | SourceType | Gets the source Type of the current record. (Inherited from TextLogRecordBuilder.)
Protected property | StringBuilder | Gets the current UnsafeStringBuilder where everything is being appended. (Inherited from TextLogRecordBuilder.)
Protected property | ThreadContext | Gets the ThreadLoggingContext to which the current LogRecordBuilder belongs. (Inherited from LogRecordBuilder.)
Protected property | TypeSource | Gets the LoggingTypeSource for the current record. (Inherited from TextLogRecordBuilder.)
Top
Methods
 | Name | Description
Protected method | AppendAsyncInfo | Appends information about the async method to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendClosingParenthesisConditional | Appends a closing parenthesis to the current StringBuilder if required. (Inherited from TextLogRecordBuilder.)
Protected method | AppendComma | (Inherited from TextLogRecordBuilder.)
Protected method | AppendCommaConditional | Appends a comma to the current StringBuilder, unless this method is invoked for the first time for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription | Appends the context Description (or the TypeSource name, if the type of the context is not equal to the source type of the record) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription(LoggingContext) | (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiter | Appends a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiterConditional | Appends a Delimiter to the current StringBuilder if the RequireDelimiter method has been called previously. (Inherited from TextLogRecordBuilder.)
Protected method | AppendEpilogue | Appends the final part of log message to StringBuilder. This includes state machine number and execution time where relevant, but does not include exception details. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExceptionDetails | Appends exception details to StringBuilder if IncludeExceptionDetails is set. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTime | Appends the execution time to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTimeThreshold | Appends the execution time threshold to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendIndentString | Appends indentation for the given to StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendMemberName | Appends name of the member for the current record (including the declaring type name, subject to the IncludeType property) to the current StringBuilder, as well as an opening parenthesis. (Inherited from TextLogRecordBuilder.)
Protected method | AppendOpeningParenthesis | Appends an opening parenthesis to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendProlog | Appends the indent string, context description, and the record kind to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendRecordKind | Appends the LogRecordKind of the current record to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameter(SemanticParameterKind, String, String, String, Int32) | Appends a parameter of String type to the current StringBuilder. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSourceLineInfo | Appends source (file, line) information to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpaces | Appends a given number of spaces to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpecialChar | Appends a special Char (which may require escaping with specific back-ends) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTrailingPeriod | Appends a trailing period (.) to the current StringBuilder, respecting the AppendTrailingPeriod property. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTypeName | Appends the name of the TypeSource to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | BeginCustomRecord | (Overrides TextLogRecordBuilderBeginCustomRecord(LoggingContext, CustomLogRecordInfo).)
Public method | BeginRecord | Initializes the current LogRecordBuilder to emit a standard (i.e. non-custom) record for a given context and method. (Overrides TextLogRecordBuilderBeginRecord(LoggingContext, LogRecordInfo, LogMemberInfo).)
Public method | Complete | Emits the record and resets the current LogRecordBuilder. This method invoked after all SetThisT(T), SetParameterT(Int32, String, ParameterKind, String, T) and similar methods have been called. (Inherited from LogRecordBuilder.)
Public method | Dispose | (Inherited from LogRecordBuilder.)
Protected method | EmitRecord | Emits the record. Invoked by the Complete method. (Inherited from TextLogRecordBuilder.)
Protected method | EmitRecord(Boolean) | Emits the record and specifies whether exception details should be appended to the text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescription | Ends building the context Description and starts building the action text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescriptionConditional | Switches between building the context Description and the action text. If the EndContextDescriptionConditional method has been previously invoked, subsequent calls are ignored. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescription | Obsolete. Gets the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescriptionUnsafe | Obsolete. Gets an UnsafeString representing the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextForDescription | Obsolete. Gets the LoggingContext that should be used when getting or appending the Description. (Inherited from TextLogRecordBuilder.)
Protected method | GetSourceName | Gets the name of the TypeSource for the current record, respecting the IncludeNamespace property. (Inherited from TextLogRecordBuilder.)
Protected method | HasRecordKindName | Determines whether the AppendRecordKind will append anything for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | MustBuildContextDescription | Determines whether the current Description should be appended to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | RequireComma | Makes the AppendCommaConditional to append a comma even if it's invoked for the first time. (Inherited from TextLogRecordBuilder.)
Protected method | RequireDelimiter | Causes the next call to the AppendDelimiterConditional to append a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | Reset | Resets all fields and properties of the current LogRecordBuilder to their initial value. Invoked by the Complete method. (Overrides TextLogRecordBuilderReset.)
Public method | SetException | Sets the exception for the method or activity. (Overrides TextLogRecordBuilderSetException(Exception).)
Public method | SetExecutionTime | Sets the method or activity execution time. (Inherited from TextLogRecordBuilder.)
Public method | SetMethodGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T) | Sets the value of a given parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Overrides TextLogRecordBuilderSetParameterT(Int32, String, ParameterKind, String, T, IFormatterT).)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from TextLogRecordBuilder.)
Public method | SetRefStructParameter | (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T) | Sets a given return value (there can be several return values in C# 7.0) and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Overrides TextLogRecordBuilderSetReturnValueT(Int32, String, String, T, IFormatterT).)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetThisT(T) | Sets the this (instance) value and uses the default formatter. This method is only invoked if the IncludeThisValue property is true. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Overrides TextLogRecordBuilderSetThisT(T, IFormatterT).)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetTypeGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Protected method | ShouldLogExceptionDetails | Determines whether exception details should be appended to the text of the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | ToString | Returns a string that represents the current object. (Inherited from TextLogRecordBuilder.)
Protected method | Write | Writes the final message to the back-end. (Overrides TextLogRecordBuilderWrite(UnsafeString).)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T) | Writes a custom parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | WriteCustomString | Write a chunk of custom string. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights Namespace


ApplicationInsightsLogRecordBuilder Constructor

Initializes a new ApplicationInsightsLogRecordBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights
Assembly: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights (in PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ApplicationInsightsLogRecordBuilder(
    ApplicationInsightsLoggingBackend backend
)

Parameters

backend
Type: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsightsApplicationInsightsLoggingBackend
The parent ApplicationInsightsLoggingBackend.
See Also

Reference

ApplicationInsightsLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights Namespace


ApplicationInsightsLogRecordBuilder Properties

The ApplicationInsightsLogRecordBuilder type exposes the following members.

Properties
 | Name | Description
Public property | Backend | Gets the parent back-end. (Inherited from TextLogRecordBuilder.)
Public property | BackendOptions | Shortcut for this.Backend.Options. (Inherited from TextLogRecordBuilder.)
Protected property | Context | Gets the LoggingContext to which the record belongs. (Inherited from LogRecordBuilder.)
Public property | Exception | Gets the Exception for the current record, or null if no exception is associated to the current record. (Inherited from TextLogRecordBuilder.)
Public property | IsDisposed | (Inherited from LogRecordBuilder.)
Protected property | Level | Gets the LogLevel for the current record. (Inherited from TextLogRecordBuilder.)
Public property | MemberName | Gets the name of the method, property or field for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Options | Gets the LoggingOptions for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Profile | Gets the LoggingProfile for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | RecordKind | Gets the kind of the current record (e.g. MethodEntry or MethodException). (Inherited from LogRecordBuilder.)
Public property | SourceLineInfo | Gets the SourceLineInfo for the current record. (Inherited from TextLogRecordBuilder.)
Public property | SourceType | Gets the source Type of the current record. (Inherited from TextLogRecordBuilder.)
Protected property | StringBuilder | Gets the current UnsafeStringBuilder where everything is being appended. (Inherited from TextLogRecordBuilder.)
Protected property | ThreadContext | Gets the ThreadLoggingContext to which the current LogRecordBuilder belongs. (Inherited from LogRecordBuilder.)
Protected property | TypeSource | Gets the LoggingTypeSource for the current record. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

ApplicationInsightsLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights Namespace


ApplicationInsightsLogRecordBuilder Methods

The ApplicationInsightsLogRecordBuilder type exposes the following members.

Methods
 | Name | Description
Protected method | AppendAsyncInfo | Appends information about the async method to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendClosingParenthesisConditional | Appends a closing parenthesis to the current StringBuilder if required. (Inherited from TextLogRecordBuilder.)
Protected method | AppendComma | (Inherited from TextLogRecordBuilder.)
Protected method | AppendCommaConditional | Appends a comma to the current StringBuilder, unless this method is invoked for the first time for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription | Appends the context Description (or the TypeSource name, if the type of the context is not equal to the source type of the record) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription(LoggingContext) | (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiter | Appends a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiterConditional | Appends a Delimiter to the current StringBuilder if the RequireDelimiter method has been called previously. (Inherited from TextLogRecordBuilder.)
Protected method | AppendEpilogue | Appends the final part of log message to StringBuilder. This includes state machine number and execution time where relevant, but does not include exception details. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExceptionDetails | Appends exception details to StringBuilder if IncludeExceptionDetails is set. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTime | Appends the execution time to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTimeThreshold | Appends the execution time threshold to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendIndentString | Appends indentation for the given to StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendMemberName | Appends name of the member for the current record (including the declaring type name, subject to the IncludeType property) to the current StringBuilder, as well as an opening parenthesis. (Inherited from TextLogRecordBuilder.)
Protected method | AppendOpeningParenthesis | Appends an opening parenthesis to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendProlog | Appends the indent string, context description, and the record kind to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendRecordKind | Appends the LogRecordKind of the current record to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameter(SemanticParameterKind, String, String, String, Int32) | Appends a parameter of String type to the current StringBuilder. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSourceLineInfo | Appends source (file, line) information to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpaces | Appends a given number of spaces to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpecialChar | Appends a special Char (which may require escaping with specific back-ends) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTrailingPeriod | Appends a trailing period (.) to the current StringBuilder, respecting the AppendTrailingPeriod property. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTypeName | Appends the name of the TypeSource to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | BeginCustomRecord | (Overrides TextLogRecordBuilderBeginCustomRecord(LoggingContext, CustomLogRecordInfo).)
Public method | BeginRecord | Initializes the current LogRecordBuilder to emit a standard (i.e. non-custom) record for a given context and method. (Overrides TextLogRecordBuilderBeginRecord(LoggingContext, LogRecordInfo, LogMemberInfo).)
Public method | Complete | Emits the record and resets the current LogRecordBuilder. This method invoked after all SetThisT(T), SetParameterT(Int32, String, ParameterKind, String, T) and similar methods have been called. (Inherited from LogRecordBuilder.)
Public method | Dispose | (Inherited from LogRecordBuilder.)
Protected method | EmitRecord | Emits the record. Invoked by the Complete method. (Inherited from TextLogRecordBuilder.)
Protected method | EmitRecord(Boolean) | Emits the record and specifies whether exception details should be appended to the text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescription | Ends building the context Description and starts building the action text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescriptionConditional | Switches between building the context Description and the action text. If the EndContextDescriptionConditional method has been previously invoked, subsequent calls are ignored. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescription | Obsolete. Gets the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescriptionUnsafe | Obsolete. Gets an UnsafeString representing the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextForDescription | Obsolete. Gets the LoggingContext that should be used when getting or appending the Description. (Inherited from TextLogRecordBuilder.)
Protected method | GetSourceName | Gets the name of the TypeSource for the current record, respecting the IncludeNamespace property. (Inherited from TextLogRecordBuilder.)
Protected method | HasRecordKindName | Determines whether the AppendRecordKind will append anything for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | MustBuildContextDescription | Determines whether the current Description should be appended to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | RequireComma | Makes the AppendCommaConditional to append a comma even if it's invoked for the first time. (Inherited from TextLogRecordBuilder.)
Protected method | RequireDelimiter | Causes the next call to the AppendDelimiterConditional to append a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | Reset | Resets all fields and properties of the current LogRecordBuilder to their initial value. Invoked by the Complete method. (Overrides TextLogRecordBuilderReset.)
Public method | SetException | Sets the exception for the method or activity. (Overrides TextLogRecordBuilderSetException(Exception).)
Public method | SetExecutionTime | Sets the method or activity execution time. (Inherited from TextLogRecordBuilder.)
Public method | SetMethodGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T) | Sets the value of a given parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Overrides TextLogRecordBuilderSetParameterT(Int32, String, ParameterKind, String, T, IFormatterT).)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from TextLogRecordBuilder.)
Public method | SetRefStructParameter | (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T) | Sets a given return value (there can be several return values in C# 7.0) and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Overrides TextLogRecordBuilderSetReturnValueT(Int32, String, String, T, IFormatterT).)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetThisT(T) | Sets the this (instance) value and uses the default formatter. This method is only invoked if the IncludeThisValue property is true. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Overrides TextLogRecordBuilderSetThisT(T, IFormatterT).)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetTypeGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Protected method | ShouldLogExceptionDetails | Determines whether exception details should be appended to the text of the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | ToString | Returns a string that represents the current object. (Inherited from TextLogRecordBuilder.)
Protected method | Write | Writes the final message to the back-end. (Overrides TextLogRecordBuilderWrite(UnsafeString).)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T) | Writes a custom parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | WriteCustomString | Write a chunk of custom string. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

ApplicationInsightsLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights Namespace


ApplicationInsightsLogRecordBuilder.BeginCustomRecord Method

ApplicationInsightsLogRecordBuilderBeginCustomRecord Method

Namespace: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights
Assembly: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights (in PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void BeginCustomRecord(
    LoggingContext context,
    ref CustomLogRecordInfo logRecordInfo
)

Parameters

context
Type: PostSharp.Patterns.Diagnostics.ContextsLoggingContext
logRecordInfo
Type: PostSharp.Patterns.Diagnostics.ContextsCustomLogRecordInfo
See Also

Reference

ApplicationInsightsLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights Namespace


ApplicationInsightsLogRecordBuilder.BeginRecord Method

ApplicationInsightsLogRecordBuilderBeginRecord Method

Initializes the current LogRecordBuilder to emit a standard (i.e. non-custom) record for a given context and method.

Namespace: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights
Assembly: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights (in PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void BeginRecord(
    LoggingContext context,
    ref LogRecordInfo logRecordInfo,
    ref LogMemberInfo logMemberInfo
)

Parameters

context
Type: PostSharp.Patterns.Diagnostics.ContextsLoggingContext
The parent LoggingContext of the record.
logRecordInfo
Type: PostSharp.Patterns.Diagnostics.ContextsLogRecordInfo
logMemberInfo
Type: PostSharp.Patterns.Diagnostics.ContextsLogMemberInfo
See Also

Reference

ApplicationInsightsLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights Namespace


ApplicationInsightsLogRecordBuilder.Reset Method

ApplicationInsightsLogRecordBuilderReset Method

Resets all fields and properties of the current LogRecordBuilder to their initial value. Invoked by the Complete method.

Namespace: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights
Assembly: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights (in PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void Reset()
See Also

Reference

ApplicationInsightsLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights Namespace


ApplicationInsightsLogRecordBuilder.SetException Method

ApplicationInsightsLogRecordBuilderSetException Method

Sets the exception for the method or activity.

Namespace: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights
Assembly: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights (in PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void SetException(
    Exception exception
)

Parameters

exception
Type: SystemException
An Exception.
See Also

Reference

ApplicationInsightsLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights Namespace


ApplicationInsightsLogRecordBuilder.SetParameter Method

ApplicationInsightsLogRecordBuilderSetParameter Method

Overload List
 | Name | Description
Public method | SetParameterT(Int32, String, ParameterKind, String, T) | Sets the value of a given parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Overrides TextLogRecordBuilderSetParameterT(Int32, String, ParameterKind, String, T, IFormatterT).)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

ApplicationInsightsLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights Namespace


ApplicationInsightsLogRecordBuilder.SetParameter(T) Method (Int32, String, ParameterKind, String, T, IFormatter(T))

ApplicationInsightsLogRecordBuilderSetParameterT Method (Int32, String, ParameterKind, String, T, IFormatterT)

Sets the value of a given parameter and specifies the FormatterT.

Namespace: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights
Assembly: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights (in PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void SetParameter<T>(
    int index,
    string parameterName,
    ParameterKind parameterKind,
    string typeName,
    T value,
    IFormatter<T> formatter
)

Parameters

index
Type: SystemInt32
Index of the parameter in the list of method parameters.
parameterName
Type: SystemString
Name of the parameter (only included if the IncludeParameterName property is true).
parameterKind
Type: PostSharp.ReflectionParameterKind
The kind of the parameter (whether the parameter is by ref or by value, input or output).
typeName
Type: SystemString
Formatted name of the type T (only included if the IncludeParameterType property is true).
value
Type: T
Value of the parameter (only included if the IncludeParameterValue property is true).
formatter
Type: PostSharp.Patterns.FormattersIFormatter T
Formatter to be used to format value.

Type Parameters

T
Type of the parameter.
Remarks
The return value is set by the method SetReturnValueT(Int32, String, String, T, IFormatterT). Thus the value of the parameterKind is never ReturnValue or ReturnRef.
See Also

Reference

ApplicationInsightsLogRecordBuilder Class
SetParameter Overload
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights Namespace


ApplicationInsightsLogRecordBuilder.SetReturnValue Method

ApplicationInsightsLogRecordBuilderSetReturnValue Method

Overload List
 | Name | Description
Public method | SetReturnValueT(Int32, String, String, T) | Sets a given return value (there can be several return values in C# 7.0) and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Overrides TextLogRecordBuilderSetReturnValueT(Int32, String, String, T, IFormatterT).)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

ApplicationInsightsLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights Namespace


ApplicationInsightsLogRecordBuilder.SetReturnValue(T) Method (Int32, String, String, T, IFormatter(T))

ApplicationInsightsLogRecordBuilderSetReturnValueT Method (Int32, String, String, T, IFormatterT)

Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter.

Namespace: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights
Assembly: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights (in PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void SetReturnValue<T>(
    int index,
    string returnValueName,
    string typeName,
    T value,
    IFormatter<T> formatter
)

Parameters

index
Type: SystemInt32
Index of the return value.
returnValueName
Type: SystemString
Name of the return value, or null if there is only one return value in the method.
typeName
Type: SystemString
Formatted name of the type T.
value
Type: T
Return value.
formatter
Type: PostSharp.Patterns.FormattersIFormatter T
The formatter to be used to format T.

Type Parameters

T
Type of the return value.
See Also

Reference

ApplicationInsightsLogRecordBuilder Class
SetReturnValue Overload
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights Namespace


ApplicationInsightsLogRecordBuilder.SetThis Method

ApplicationInsightsLogRecordBuilderSetThis Method

Overload List
 | Name | Description
Public method | SetThisT(T) | Sets the this (instance) value and uses the default formatter. This method is only invoked if the IncludeThisValue property is true. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Overrides TextLogRecordBuilderSetThisT(T, IFormatterT).)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

ApplicationInsightsLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights Namespace


ApplicationInsightsLogRecordBuilder.SetThis(T) Method (T, IFormatter(T))

ApplicationInsightsLogRecordBuilderSetThisT Method (T, IFormatterT)

Sets the this (instance) value and uses a given formatter.

Namespace: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights
Assembly: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights (in PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void SetThis<T>(
    T value,
    IFormatter<T> formatter
)

Parameters

value
Type: T
The value of the this instance.
formatter
Type: PostSharp.Patterns.FormattersIFormatter T
The formatter to be used.

Type Parameters

T
Type of the class being logged.
See Also

Reference

ApplicationInsightsLogRecordBuilder Class
SetThis Overload
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights Namespace


ApplicationInsightsLogRecordBuilder.Write Method

ApplicationInsightsLogRecordBuilderWrite Method

Writes the final message to the back-end.

Namespace: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights
Assembly: PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights (in PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void Write(
    UnsafeString message
)

Parameters

message
Type: PostSharp.Patterns.FormattersUnsafeString
The final message.
See Also

Reference

ApplicationInsightsLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsights Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


PostSharp.Patterns.Diagnostics.Backends.Audit Namespace

Classes
 | Class | Description
Public class | AuditBackend | A specialized back-end that publishes audit records to the RecordPublished event.
Public class | AuditBackendOptions | Options of AuditBackend.
Public class | AuditRecordBuilder | Record builder for the AuditBackend.
Public class | AuditTypeSource | Represents a type logged using the AuditBackend.


AuditBackend Class

A specialized back-end that publishes audit records to the RecordPublished event.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingBackend
PostSharp.Patterns.Diagnostics.BackendsTextLoggingBackend
PostSharp.Patterns.Diagnostics.Backends.AuditAuditBackend

Namespace: PostSharp.Patterns.Diagnostics.Backends.Audit
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class AuditBackend : TextLoggingBackend

The AuditBackend type exposes the following members.

Constructors
 | Name | Description
Public method | AuditBackend | Initializes a new AuditBackend.
Top
Properties
 | Name | Description
Public property | CurrentContext | Gets the current LoggingContext. (Inherited from LoggingBackend.)
Public property | IsCorrupted | (Inherited from LoggingBackend.)
Public property | IsDisposed | Determines whether the current LoggingBackend has been disposed. (Inherited from LoggingBackend.)
Public property | IsEnabled | Determines whether the current LoggingBackend is currently enabled. This property has precedence over, and does not affect, the minimal log levels set through the SetLevel(LogLevel) method. (Inherited from LoggingBackend.)
Public property | Options | Gets the back-end options.
Top
Methods
 | Name | Description
Protected method | CreateAsyncCustomActivityContext | Creates a new AsyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateAsyncMethodContext | Creates a new AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Protected method | CreateEphemeralContext | Creates a new EphemeralLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateIteratorContext | Creates a new IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | CreateRecordBuilder | Creates a new LogRecordBuilder. (Overrides LoggingBackendCreateRecordBuilder.)
Protected method | CreateSyncCustomActivityContext | Creates a new SyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateSyncMethodContext | Creates a new SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Protected method | CreateThreadContext | Creates a new ThreadLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateTypeSource | Creates LoggingTypeSource for the given role and type. (Overrides LoggingBackendCreateTypeSource(LoggingNamespaceSource, Type).)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingBackend.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from TextLoggingBackend.)
Public method | GetAsyncContextOfTask | Gets the AsyncMethodLoggingContext associated with a Task. (Inherited from LoggingBackend.)
Protected method | GetBackendOptions | Gets the formatting and rendering options for the current LoggingBackend. (Inherited from TextLoggingBackend.)
Public method | GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace. (Inherited from LoggingBackend.)
Public method | GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type. (Inherited from LoggingBackend.)
Protected method | GetTextBackendOptions | Gets the options. (Overrides TextLoggingBackendGetTextBackendOptions.)
Public method | GetThreadContext | Returns the ThreadLoggingContext for the current Thread. (Inherited from LoggingBackend.)
Public method | OpenAsyncContext | Gets an AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Public method | OpenCustomActivityContext | Gets a LoggingContext for a custom activity (opened using OpenActivity(String) or OpenAsyncActivity(String)). (Inherited from LoggingBackend.)
Public method | OpenEphemeralContext | Gets an EphemeralLoggingContext for use in a given method. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record. (Inherited from LoggingBackend.)
Public method | OpenIteratorContext | Gets an IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | OpenSyncContext | Gets a SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Public method | PublishRecord | Publishes an AuditRecord to the RecordPublished event.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Audit Namespace


AuditBackend Constructor

Initializes a new AuditBackend.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Audit
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AuditBackend()
See Also

Reference

AuditBackend Class
PostSharp.Patterns.Diagnostics.Backends.Audit Namespace


AuditBackend Properties

The AuditBackend type exposes the following members.

Properties
 | Name | Description
Public property | CurrentContext | Gets the current LoggingContext. (Inherited from LoggingBackend.)
Public property | IsCorrupted | (Inherited from LoggingBackend.)
Public property | IsDisposed | Determines whether the current LoggingBackend has been disposed. (Inherited from LoggingBackend.)
Public property | IsEnabled | Determines whether the current LoggingBackend is currently enabled. This property has precedence over, and does not affect, the minimal log levels set through the SetLevel(LogLevel) method. (Inherited from LoggingBackend.)
Public property | Options | Gets the back-end options.
Top
See Also

Reference

AuditBackend Class
PostSharp.Patterns.Diagnostics.Backends.Audit Namespace


AuditBackend.Options Property

AuditBackendOptions Property

Gets the back-end options.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Audit
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AuditBackendOptions Options { get; }

Property Value

Type: AuditBackendOptions
See Also

Reference

AuditBackend Class
PostSharp.Patterns.Diagnostics.Backends.Audit Namespace


AuditBackend Methods

The AuditBackend type exposes the following members.

Methods
 | Name | Description
Protected method | CreateAsyncCustomActivityContext | Creates a new AsyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateAsyncMethodContext | Creates a new AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Protected method | CreateEphemeralContext | Creates a new EphemeralLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateIteratorContext | Creates a new IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | CreateRecordBuilder | Creates a new LogRecordBuilder. (Overrides LoggingBackendCreateRecordBuilder.)
Protected method | CreateSyncCustomActivityContext | Creates a new SyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateSyncMethodContext | Creates a new SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Protected method | CreateThreadContext | Creates a new ThreadLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateTypeSource | Creates LoggingTypeSource for the given role and type. (Overrides LoggingBackendCreateTypeSource(LoggingNamespaceSource, Type).)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingBackend.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from TextLoggingBackend.)
Public method | GetAsyncContextOfTask | Gets the AsyncMethodLoggingContext associated with a Task. (Inherited from LoggingBackend.)
Protected method | GetBackendOptions | Gets the formatting and rendering options for the current LoggingBackend. (Inherited from TextLoggingBackend.)
Public method | GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace. (Inherited from LoggingBackend.)
Public method | GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type. (Inherited from LoggingBackend.)
Protected method | GetTextBackendOptions | Gets the options. (Overrides TextLoggingBackendGetTextBackendOptions.)
Public method | GetThreadContext | Returns the ThreadLoggingContext for the current Thread. (Inherited from LoggingBackend.)
Public method | OpenAsyncContext | Gets an AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Public method | OpenCustomActivityContext | Gets a LoggingContext for a custom activity (opened using OpenActivity(String) or OpenAsyncActivity(String)). (Inherited from LoggingBackend.)
Public method | OpenEphemeralContext | Gets an EphemeralLoggingContext for use in a given method. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record. (Inherited from LoggingBackend.)
Public method | OpenIteratorContext | Gets an IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | OpenSyncContext | Gets a SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Public method | PublishRecord | Publishes an AuditRecord to the RecordPublished event.
Top
See Also

Reference

AuditBackend Class
PostSharp.Patterns.Diagnostics.Backends.Audit Namespace


AuditBackend.CreateRecordBuilder Method

AuditBackendCreateRecordBuilder Method

Creates a new LogRecordBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Audit
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override LogRecordBuilder CreateRecordBuilder()

Return Value

Type: LogRecordBuilder
A new LogRecordBuilder.
See Also

Reference

AuditBackend Class
PostSharp.Patterns.Diagnostics.Backends.Audit Namespace

Other Resources

Conceptual: Adding Audit to your Solution
Conceptual: Implementing an Adapter to a Custom Logging Framework


AuditBackend.CreateTypeSource Method

AuditBackendCreateTypeSource Method

Creates LoggingTypeSource for the given role and type.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Audit
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override LoggingTypeSource CreateTypeSource(
    LoggingNamespaceSource parent,
    Type type
)

Parameters

parent
Type: PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
type
Type: SystemType

Return Value

Type: LoggingTypeSource
See Also

Reference

AuditBackend Class
PostSharp.Patterns.Diagnostics.Backends.Audit Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


AuditBackend.GetTextBackendOptions Method

AuditBackendGetTextBackendOptions Method

Gets the options.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Audit
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override TextLoggingBackendOptions GetTextBackendOptions()

Return Value

Type: TextLoggingBackendOptions
See Also

Reference

AuditBackend Class
PostSharp.Patterns.Diagnostics.Backends.Audit Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


AuditBackend.PublishRecord Method

AuditBackendPublishRecord Method

Publishes an AuditRecord to the RecordPublished event.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Audit
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void PublishRecord(
    AuditRecord record
)

Parameters

record
Type: PostSharp.Patterns.Diagnostics.AuditAuditRecord
See Also

Reference

AuditBackend Class
PostSharp.Patterns.Diagnostics.Backends.Audit Namespace


AuditBackendOptions Class

Options of AuditBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingBackendOptions
PostSharp.Patterns.Diagnostics.BackendsTextLoggingBackendOptions
PostSharp.Patterns.Diagnostics.Backends.AuditAuditBackendOptions

Namespace: PostSharp.Patterns.Diagnostics.Backends.Audit
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class AuditBackendOptions : TextLoggingBackendOptions

The AuditBackendOptions type exposes the following members.

Constructors
 | Name | Description
Public method | AuditBackendOptions | Initializes a new AuditBackendOptions.
Top
Properties
 | Name | Description
Public property | ActionMaxLength | Max length of a log record. The default value is 2048. (Inherited from TextLoggingBackendOptions.)
Public property | AppendTrailingPeriod | Determines whether log messages should be ended with a trailing period. The default value is true because we really like trailing periods at PostSharp, but other opinions are valid. (Inherited from TextLoggingBackendOptions.)
Public property | ContextMaxLength | Max length of the Description property. (Inherited from LoggingBackendOptions.)
Public property | Delimiter | String used to separate different parts of the logging record. The default value is a pipe surrounded by spaces ( | ). (Inherited from TextLoggingBackendOptions.)
Public property | IncludeExceptionDetails | Determines whether exception details (basically Exception.ToString) should be appended to the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeNamespace | Determines whether the full namespace of types should be included in the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeType | Determines whether the name of the type of the logged method should be included in the log. The default value is true. (Inherited from TextLoggingBackendOptions.)
Public property | IndentSpaces | Number of spaces for each indentation level. The default value is 2. (Inherited from TextLoggingBackendOptions.)
Public property | LogLevelIgnoredForSystemRecords | Determines whether the Level property is ignored by the current back-end for auto-generated (i.e. non-manual) logging records. Some back-ends may not support overriding the level of records. (Inherited from LoggingBackendOptions.)
Public property | ShouldLogExceptionPredicate | Gets or sets a predicate that determines whether an exception should be logged. This predicate is evaluated only when the method entry is not logged. When the method entry is logged, exceptions are always logged. (Inherited from TextLoggingBackendOptions.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Audit Namespace


AuditBackendOptions Constructor

Initializes a new AuditBackendOptions.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Audit
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AuditBackendOptions()
See Also

Reference

AuditBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.Audit Namespace


AuditBackendOptions Properties

The AuditBackendOptions type exposes the following members.

Properties
 | Name | Description
Public property | ActionMaxLength | Max length of a log record. The default value is 2048. (Inherited from TextLoggingBackendOptions.)
Public property | AppendTrailingPeriod | Determines whether log messages should be ended with a trailing period. The default value is true because we really like trailing periods at PostSharp, but other opinions are valid. (Inherited from TextLoggingBackendOptions.)
Public property | ContextMaxLength | Max length of the Description property. (Inherited from LoggingBackendOptions.)
Public property | Delimiter | String used to separate different parts of the logging record. The default value is a pipe surrounded by spaces ( | ). (Inherited from TextLoggingBackendOptions.)
Public property | IncludeExceptionDetails | Determines whether exception details (basically Exception.ToString) should be appended to the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeNamespace | Determines whether the full namespace of types should be included in the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeType | Determines whether the name of the type of the logged method should be included in the log. The default value is true. (Inherited from TextLoggingBackendOptions.)
Public property | IndentSpaces | Number of spaces for each indentation level. The default value is 2. (Inherited from TextLoggingBackendOptions.)
Public property | LogLevelIgnoredForSystemRecords | Determines whether the Level property is ignored by the current back-end for auto-generated (i.e. non-manual) logging records. Some back-ends may not support overriding the level of records. (Inherited from LoggingBackendOptions.)
Public property | ShouldLogExceptionPredicate | Gets or sets a predicate that determines whether an exception should be logged. This predicate is evaluated only when the method entry is not logged. When the method entry is logged, exceptions are always logged. (Inherited from TextLoggingBackendOptions.)
Top
See Also

Reference

AuditBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.Audit Namespace


AuditRecordBuilder Class

Record builder for the AuditBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.RecordBuildersLogRecordBuilder
PostSharp.Patterns.Diagnostics.RecordBuildersTextLogRecordBuilder
PostSharp.Patterns.Diagnostics.Backends.AuditAuditRecordBuilder

Namespace: PostSharp.Patterns.Diagnostics.Backends.Audit
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class AuditRecordBuilder : TextLogRecordBuilder

The AuditRecordBuilder type exposes the following members.

Constructors
 | Name | Description
Public method | AuditRecordBuilder | Initializes a new AuditRecordBuilder.
Top
Properties
 | Name | Description
Public property | Backend | Gets the current AuditBackend.
Public property | BackendOptions | Shortcut for this.Backend.Options. (Inherited from TextLogRecordBuilder.)
Protected property | Context | Gets the LoggingContext to which the record belongs. (Inherited from LogRecordBuilder.)
Public property | CurrentRecord | Gets the AuditRecord being currently built.
Public property | Exception | Gets the Exception for the current record, or null if no exception is associated to the current record. (Inherited from TextLogRecordBuilder.)
Public property | IsDisposed | (Inherited from LogRecordBuilder.)
Protected property | Level | Gets the LogLevel for the current record. (Inherited from TextLogRecordBuilder.)
Public property | MemberName | Gets the name of the method, property or field for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Options | Gets the LoggingOptions for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Profile | Gets the LoggingProfile for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | RecordKind | Gets the kind of the current record (e.g. MethodEntry or MethodException). (Inherited from LogRecordBuilder.)
Public property | SourceLineInfo | Gets the SourceLineInfo for the current record. (Inherited from TextLogRecordBuilder.)
Public property | SourceType | Gets the source Type of the current record. (Inherited from TextLogRecordBuilder.)
Protected property | StringBuilder | Gets the current UnsafeStringBuilder where everything is being appended. (Inherited from TextLogRecordBuilder.)
Protected property | ThreadContext | Gets the ThreadLoggingContext to which the current LogRecordBuilder belongs. (Inherited from LogRecordBuilder.)
Protected property | TypeSource | Gets the LoggingTypeSource for the current record. (Inherited from TextLogRecordBuilder.)
Top
Methods
 | Name | Description
Protected method | AppendAsyncInfo | Appends information about the async method to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendClosingParenthesisConditional | Appends a closing parenthesis to the current StringBuilder if required. (Inherited from TextLogRecordBuilder.)
Protected method | AppendComma | (Inherited from TextLogRecordBuilder.)
Protected method | AppendCommaConditional | Appends a comma to the current StringBuilder, unless this method is invoked for the first time for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription | Appends the context Description (or the TypeSource name, if the type of the context is not equal to the source type of the record) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription(LoggingContext) | (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiter | Appends a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiterConditional | Appends a Delimiter to the current StringBuilder if the RequireDelimiter method has been called previously. (Inherited from TextLogRecordBuilder.)
Protected method | AppendEpilogue | Appends the final part of log message to StringBuilder. This includes state machine number and execution time where relevant, but does not include exception details. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExceptionDetails | Appends exception details to StringBuilder if IncludeExceptionDetails is set. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTime | Appends the execution time to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTimeThreshold | Appends the execution time threshold to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendIndentString | Appends indentation for the given to StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendMemberName | Appends name of the member for the current record (including the declaring type name, subject to the IncludeType property) to the current StringBuilder, as well as an opening parenthesis. (Inherited from TextLogRecordBuilder.)
Protected method | AppendOpeningParenthesis | Appends an opening parenthesis to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendProlog | Appends the indent string, context description, and the record kind to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendRecordKind | Appends the LogRecordKind of the current record to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameter(SemanticParameterKind, String, String, String, Int32) | Appends a parameter of String type to the current StringBuilder. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSourceLineInfo | Appends source (file, line) information to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpaces | Appends a given number of spaces to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpecialChar | Appends a special Char (which may require escaping with specific back-ends) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTrailingPeriod | Appends a trailing period (.) to the current StringBuilder, respecting the AppendTrailingPeriod property. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTypeName | Appends the name of the TypeSource to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | BeginCustomRecord | Initializes the current LogRecordBuilder to emit a custom record. (Inherited from TextLogRecordBuilder.)
Public method | BeginRecord | Initializes the current LogRecordBuilder to emit a standard (i.e. non-custom) record for a given context and method. (Overrides TextLogRecordBuilderBeginRecord(LoggingContext, LogRecordInfo, LogMemberInfo).)
Public method | Complete | Emits the record and resets the current LogRecordBuilder. This method invoked after all SetThisT(T), SetParameterT(Int32, String, ParameterKind, String, T) and similar methods have been called. (Inherited from LogRecordBuilder.)
Protected method | CreateRecord | Creates an AuditRecord.
Public method | Dispose | (Inherited from LogRecordBuilder.)
Protected method | EmitRecord | Emits the record. Invoked by the Complete method. (Inherited from TextLogRecordBuilder.)
Protected method | EmitRecord(Boolean) | Emits the record and specifies whether exception details should be appended to the text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescription | Ends building the context Description and starts building the action text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescriptionConditional | Switches between building the context Description and the action text. If the EndContextDescriptionConditional method has been previously invoked, subsequent calls are ignored. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescription | Obsolete. Gets the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescriptionUnsafe | Obsolete. Gets an UnsafeString representing the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextForDescription | Obsolete. Gets the LoggingContext that should be used when getting or appending the Description. (Inherited from TextLogRecordBuilder.)
Protected method | GetSourceName | Gets the name of the TypeSource for the current record, respecting the IncludeNamespace property. (Inherited from TextLogRecordBuilder.)
Protected method | HasRecordKindName | Determines whether the AppendRecordKind will append anything for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | MustBuildContextDescription | Determines whether the current Description should be appended to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | RequireComma | Makes the AppendCommaConditional to append a comma even if it's invoked for the first time. (Inherited from TextLogRecordBuilder.)
Protected method | RequireDelimiter | Causes the next call to the AppendDelimiterConditional to append a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | Reset | Resets all fields and properties of the current LogRecordBuilder to their initial value. Invoked by the Complete method. (Inherited from TextLogRecordBuilder.)
Public method | SetException | Sets the exception for the method or activity. (Overrides TextLogRecordBuilderSetException(Exception).)
Public method | SetExecutionTime | Sets the method or activity execution time. (Inherited from TextLogRecordBuilder.)
Public method | SetMethodGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T) | Sets the value of a given parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from TextLogRecordBuilder.)
Public method | SetRefStructParameter | (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T) | Sets a given return value (there can be several return values in C# 7.0) and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetThisT(T) | Sets the this (instance) value and uses the default formatter. This method is only invoked if the IncludeThisValue property is true. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Overrides TextLogRecordBuilderSetThisT(T, IFormatterT).)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetTypeGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Protected method | ShouldLogExceptionDetails | Determines whether exception details should be appended to the text of the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | ToString | Returns a string that represents the current object. (Inherited from TextLogRecordBuilder.)
Protected method | Write | Writes the final message to the back-end. (Overrides TextLogRecordBuilderWrite(UnsafeString).)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T) | Writes a custom parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | WriteCustomString | Write a chunk of custom string. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Audit Namespace

Other Resources

Conceptual: Adding Audit to your Solution


AuditRecordBuilder Constructor

Initializes a new AuditRecordBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Audit
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AuditRecordBuilder(
    AuditBackend backend
)

Parameters

backend
Type: PostSharp.Patterns.Diagnostics.Backends.AuditAuditBackend
The parent AuditBackend.
See Also

Reference

AuditRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Audit Namespace


AuditRecordBuilder Properties

The AuditRecordBuilder type exposes the following members.

Properties
 | Name | Description
Public property | Backend | Gets the current AuditBackend.
Public property | BackendOptions | Shortcut for this.Backend.Options. (Inherited from TextLogRecordBuilder.)
Protected property | Context | Gets the LoggingContext to which the record belongs. (Inherited from LogRecordBuilder.)
Public property | CurrentRecord | Gets the AuditRecord being currently built.
Public property | Exception | Gets the Exception for the current record, or null if no exception is associated to the current record. (Inherited from TextLogRecordBuilder.)
Public property | IsDisposed | (Inherited from LogRecordBuilder.)
Protected property | Level | Gets the LogLevel for the current record. (Inherited from TextLogRecordBuilder.)
Public property | MemberName | Gets the name of the method, property or field for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Options | Gets the LoggingOptions for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Profile | Gets the LoggingProfile for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | RecordKind | Gets the kind of the current record (e.g. MethodEntry or MethodException). (Inherited from LogRecordBuilder.)
Public property | SourceLineInfo | Gets the SourceLineInfo for the current record. (Inherited from TextLogRecordBuilder.)
Public property | SourceType | Gets the source Type of the current record. (Inherited from TextLogRecordBuilder.)
Protected property | StringBuilder | Gets the current UnsafeStringBuilder where everything is being appended. (Inherited from TextLogRecordBuilder.)
Protected property | ThreadContext | Gets the ThreadLoggingContext to which the current LogRecordBuilder belongs. (Inherited from LogRecordBuilder.)
Protected property | TypeSource | Gets the LoggingTypeSource for the current record. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

AuditRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Audit Namespace


AuditRecordBuilder.Backend Property

AuditRecordBuilderBackend Property

Gets the current AuditBackend.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Audit
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AuditBackend Backend { get; }

Property Value

Type: AuditBackend
See Also

Reference

AuditRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Audit Namespace


AuditRecordBuilder.CurrentRecord Property

AuditRecordBuilderCurrentRecord Property

Gets the AuditRecord being currently built.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Audit
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AuditRecord CurrentRecord { get; }

Property Value

Type: AuditRecord
See Also

Reference

AuditRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Audit Namespace

Other Resources

Conceptual: Adding Audit to your Solution


AuditRecordBuilder Methods

The AuditRecordBuilder type exposes the following members.

Methods
 | Name | Description
Protected method | AppendAsyncInfo | Appends information about the async method to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendClosingParenthesisConditional | Appends a closing parenthesis to the current StringBuilder if required. (Inherited from TextLogRecordBuilder.)
Protected method | AppendComma | (Inherited from TextLogRecordBuilder.)
Protected method | AppendCommaConditional | Appends a comma to the current StringBuilder, unless this method is invoked for the first time for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription | Appends the context Description (or the TypeSource name, if the type of the context is not equal to the source type of the record) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription(LoggingContext) | (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiter | Appends a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiterConditional | Appends a Delimiter to the current StringBuilder if the RequireDelimiter method has been called previously. (Inherited from TextLogRecordBuilder.)
Protected method | AppendEpilogue | Appends the final part of log message to StringBuilder. This includes state machine number and execution time where relevant, but does not include exception details. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExceptionDetails | Appends exception details to StringBuilder if IncludeExceptionDetails is set. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTime | Appends the execution time to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTimeThreshold | Appends the execution time threshold to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendIndentString | Appends indentation for the given to StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendMemberName | Appends name of the member for the current record (including the declaring type name, subject to the IncludeType property) to the current StringBuilder, as well as an opening parenthesis. (Inherited from TextLogRecordBuilder.)
Protected method | AppendOpeningParenthesis | Appends an opening parenthesis to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendProlog | Appends the indent string, context description, and the record kind to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendRecordKind | Appends the LogRecordKind of the current record to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameter(SemanticParameterKind, String, String, String, Int32) | Appends a parameter of String type to the current StringBuilder. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSourceLineInfo | Appends source (file, line) information to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpaces | Appends a given number of spaces to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpecialChar | Appends a special Char (which may require escaping with specific back-ends) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTrailingPeriod | Appends a trailing period (.) to the current StringBuilder, respecting the AppendTrailingPeriod property. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTypeName | Appends the name of the TypeSource to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | BeginCustomRecord | Initializes the current LogRecordBuilder to emit a custom record. (Inherited from TextLogRecordBuilder.)
Public method | BeginRecord | Initializes the current LogRecordBuilder to emit a standard (i.e. non-custom) record for a given context and method. (Overrides TextLogRecordBuilderBeginRecord(LoggingContext, LogRecordInfo, LogMemberInfo).)
Public method | Complete | Emits the record and resets the current LogRecordBuilder. This method invoked after all SetThisT(T), SetParameterT(Int32, String, ParameterKind, String, T) and similar methods have been called. (Inherited from LogRecordBuilder.)
Protected method | CreateRecord | Creates an AuditRecord.
Public method | Dispose | (Inherited from LogRecordBuilder.)
Protected method | EmitRecord | Emits the record. Invoked by the Complete method. (Inherited from TextLogRecordBuilder.)
Protected method | EmitRecord(Boolean) | Emits the record and specifies whether exception details should be appended to the text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescription | Ends building the context Description and starts building the action text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescriptionConditional | Switches between building the context Description and the action text. If the EndContextDescriptionConditional method has been previously invoked, subsequent calls are ignored. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescription | Obsolete. Gets the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescriptionUnsafe | Obsolete. Gets an UnsafeString representing the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextForDescription | Obsolete. Gets the LoggingContext that should be used when getting or appending the Description. (Inherited from TextLogRecordBuilder.)
Protected method | GetSourceName | Gets the name of the TypeSource for the current record, respecting the IncludeNamespace property. (Inherited from TextLogRecordBuilder.)
Protected method | HasRecordKindName | Determines whether the AppendRecordKind will append anything for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | MustBuildContextDescription | Determines whether the current Description should be appended to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | RequireComma | Makes the AppendCommaConditional to append a comma even if it's invoked for the first time. (Inherited from TextLogRecordBuilder.)
Protected method | RequireDelimiter | Causes the next call to the AppendDelimiterConditional to append a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | Reset | Resets all fields and properties of the current LogRecordBuilder to their initial value. Invoked by the Complete method. (Inherited from TextLogRecordBuilder.)
Public method | SetException | Sets the exception for the method or activity. (Overrides TextLogRecordBuilderSetException(Exception).)
Public method | SetExecutionTime | Sets the method or activity execution time. (Inherited from TextLogRecordBuilder.)
Public method | SetMethodGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T) | Sets the value of a given parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from TextLogRecordBuilder.)
Public method | SetRefStructParameter | (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T) | Sets a given return value (there can be several return values in C# 7.0) and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetThisT(T) | Sets the this (instance) value and uses the default formatter. This method is only invoked if the IncludeThisValue property is true. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Overrides TextLogRecordBuilderSetThisT(T, IFormatterT).)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetTypeGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Protected method | ShouldLogExceptionDetails | Determines whether exception details should be appended to the text of the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | ToString | Returns a string that represents the current object. (Inherited from TextLogRecordBuilder.)
Protected method | Write | Writes the final message to the back-end. (Overrides TextLogRecordBuilderWrite(UnsafeString).)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T) | Writes a custom parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | WriteCustomString | Write a chunk of custom string. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

AuditRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Audit Namespace


AuditRecordBuilder.BeginRecord Method

AuditRecordBuilderBeginRecord Method

Initializes the current LogRecordBuilder to emit a standard (i.e. non-custom) record for a given context and method.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Audit
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void BeginRecord(
    LoggingContext context,
    ref LogRecordInfo recordInfo,
    ref LogMemberInfo memberInfo
)

Parameters

context
Type: PostSharp.Patterns.Diagnostics.ContextsLoggingContext
The parent LoggingContext of the record.
recordInfo
Type: PostSharp.Patterns.Diagnostics.ContextsLogRecordInfo
Information about the record.
memberInfo
Type: PostSharp.Patterns.Diagnostics.ContextsLogMemberInfo
Information about the method, property, or field.
See Also

Reference

AuditRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Audit Namespace


AuditRecordBuilder.CreateRecord Method

AuditRecordBuilderCreateRecord Method

Creates an AuditRecord.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Audit
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual AuditRecord CreateRecord(
    LoggingContext context,
    ref LogRecordInfo recordInfo,
    ref LogMemberInfo memberInfo
)

Parameters

context
Type: PostSharp.Patterns.Diagnostics.ContextsLoggingContext
The context of the record.
recordInfo
Type: PostSharp.Patterns.Diagnostics.ContextsLogRecordInfo
Information about the record.
memberInfo
Type: PostSharp.Patterns.Diagnostics.ContextsLogMemberInfo
Information about the method, property, or field.

Return Value

Type: AuditRecord
An AuditRecord.
See Also

Reference

AuditRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Audit Namespace

Other Resources

Conceptual: Adding Audit to your Solution


AuditRecordBuilder.SetException Method

AuditRecordBuilderSetException Method

Sets the exception for the method or activity.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Audit
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void SetException(
    Exception exception
)

Parameters

exception
Type: SystemException
An Exception.
See Also

Reference

AuditRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Audit Namespace


AuditRecordBuilder.SetThis Method

AuditRecordBuilderSetThis Method

Overload List
 | Name | Description
Public method | SetThisT(T) | Sets the this (instance) value and uses the default formatter. This method is only invoked if the IncludeThisValue property is true. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Overrides TextLogRecordBuilderSetThisT(T, IFormatterT).)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

AuditRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Audit Namespace


AuditRecordBuilder.SetThis(T) Method (T, IFormatter(T))

AuditRecordBuilderSetThisT Method (T, IFormatterT)

Sets the this (instance) value and uses a given formatter.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Audit
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void SetThis<T>(
    T value,
    IFormatter<T> formatter
)

Parameters

value
Type: T
The value of the this instance.
formatter
Type: PostSharp.Patterns.FormattersIFormatter T
The formatter to be used.

Type Parameters

T
Type of the class being logged.
See Also

Reference

AuditRecordBuilder Class
SetThis Overload
PostSharp.Patterns.Diagnostics.Backends.Audit Namespace


AuditRecordBuilder.Write Method

AuditRecordBuilderWrite Method

Writes the final message to the back-end.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Audit
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void Write(
    UnsafeString message
)

Parameters

message
Type: PostSharp.Patterns.FormattersUnsafeString
The final message.
See Also

Reference

AuditRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Audit Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


AuditTypeSource Class

Represents a type logged using the AuditBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
PostSharp.Patterns.DiagnosticsLoggingTypeSource
PostSharp.Patterns.Diagnostics.Backends.AuditAuditTypeSource

Namespace: PostSharp.Patterns.Diagnostics.Backends.Audit
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class AuditTypeSource : LoggingTypeSource

The AuditTypeSource type exposes the following members.

Constructors
 | Name | Description
Public method | AuditTypeSource | Initializes a new AuditTypeSource.
Top
Properties
 | Name | Description
Public property | Backend | Gets the parent LoggingBackend. (Inherited from LoggingNamespaceSource.)
Public property | DisplayFullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the DisplayFullName property does not include the arity, i.e. the full name of List<T> is System.Collections.Generic.List. (Inherited from LoggingNamespaceSource.)
Public property | DisplayName | Gets the last component of the name of the type or namespace, in the form that should be reported to the log. For generic types, the DisplayName property does not include the arity, i.e. the name of List<T> is List. (Inherited from LoggingNamespaceSource.)
Public property | FullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the FullName property includes the arity, i.e. the full name of List<T> is System.Collections.Generic.List`1. (Inherited from LoggingNamespaceSource.)
Public property | GenericParameterCount | Gets the number of generic parameters in SourceType. (Inherited from LoggingTypeSource.)
Public property | Level | Gets the minimal LogLevel for which logging is enabled for the current namespace or type. (Inherited from LoggingNamespaceSource.)
Public property | Name | Gets the last component of the name of the type or namespace. For instance, when FullName is PostSharp.Patterns.Diagnostics.LoggingBackend, Name is LoggingBackend. For generic types, the Name property includes the arity, i.e. the name of List<T> is List`1. (Inherited from LoggingNamespaceSource.)
Public property | Options | Gets the LoggingRoleConfiguration for the current role. This property is a shortcut to LoggingServices.Roles[this.Role]. (Inherited from LoggingTypeSource.)
Public property | Parent | Gets the parent LoggingNamespaceSource, or null if the current object represents the root namespace. (Inherited from LoggingNamespaceSource.)
Public property | Role | Gets the logging role for the current role. Typical values of this property are listed in the LoggingRoles class. (Inherited from LoggingNamespaceSource.)
Public property | SourceType | The type represented by the current LoggingTypeSource. (Inherited from LoggingTypeSource.)
Top
Methods
 | Name | Description
Protected method | IsBackendEnabled | Checks whether logging is enabled in the back-end for the given level. (Overrides LoggingTypeSourceIsBackendEnabled(LogLevel).)
Public method | IsEnabled | Determines whether logging is enabled for the given LogLevel. (Inherited from LoggingTypeSource.)
Public method | Refresh | Refreshes the logging level from the back-end from the current node and all children nodes. The back-end-defined logging level is cached for performance reasons. (Inherited from LoggingTypeSource.)
Public method | SetLevel | Sets the minimal LogLevel for which logging is enabled for the current namespace and type and all children namespaces and types. (Inherited from LoggingNamespaceSource.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Audit Namespace


AuditTypeSource Constructor

Initializes a new AuditTypeSource.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Audit
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AuditTypeSource(
    LoggingNamespaceSource parent,
    Type type
)

Parameters

parent
Type: PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
The parent LoggingNamespaceSource.
type
Type: SystemType
The declaring type of audited methods.
See Also

Reference

AuditTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.Audit Namespace


AuditTypeSource Properties

The AuditTypeSource type exposes the following members.

Properties
 | Name | Description
Public property | Backend | Gets the parent LoggingBackend. (Inherited from LoggingNamespaceSource.)
Public property | DisplayFullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the DisplayFullName property does not include the arity, i.e. the full name of List<T> is System.Collections.Generic.List. (Inherited from LoggingNamespaceSource.)
Public property | DisplayName | Gets the last component of the name of the type or namespace, in the form that should be reported to the log. For generic types, the DisplayName property does not include the arity, i.e. the name of List<T> is List. (Inherited from LoggingNamespaceSource.)
Public property | FullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the FullName property includes the arity, i.e. the full name of List<T> is System.Collections.Generic.List`1. (Inherited from LoggingNamespaceSource.)
Public property | GenericParameterCount | Gets the number of generic parameters in SourceType. (Inherited from LoggingTypeSource.)
Public property | Level | Gets the minimal LogLevel for which logging is enabled for the current namespace or type. (Inherited from LoggingNamespaceSource.)
Public property | Name | Gets the last component of the name of the type or namespace. For instance, when FullName is PostSharp.Patterns.Diagnostics.LoggingBackend, Name is LoggingBackend. For generic types, the Name property includes the arity, i.e. the name of List<T> is List`1. (Inherited from LoggingNamespaceSource.)
Public property | Options | Gets the LoggingRoleConfiguration for the current role. This property is a shortcut to LoggingServices.Roles[this.Role]. (Inherited from LoggingTypeSource.)
Public property | Parent | Gets the parent LoggingNamespaceSource, or null if the current object represents the root namespace. (Inherited from LoggingNamespaceSource.)
Public property | Role | Gets the logging role for the current role. Typical values of this property are listed in the LoggingRoles class. (Inherited from LoggingNamespaceSource.)
Public property | SourceType | The type represented by the current LoggingTypeSource. (Inherited from LoggingTypeSource.)
Top
See Also

Reference

AuditTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.Audit Namespace


AuditTypeSource Methods

The AuditTypeSource type exposes the following members.

Methods
 | Name | Description
Protected method | IsBackendEnabled | Checks whether logging is enabled in the back-end for the given level. (Overrides LoggingTypeSourceIsBackendEnabled(LogLevel).)
Public method | IsEnabled | Determines whether logging is enabled for the given LogLevel. (Inherited from LoggingTypeSource.)
Public method | Refresh | Refreshes the logging level from the back-end from the current node and all children nodes. The back-end-defined logging level is cached for performance reasons. (Inherited from LoggingTypeSource.)
Public method | SetLevel | Sets the minimal LogLevel for which logging is enabled for the current namespace and type and all children namespaces and types. (Inherited from LoggingNamespaceSource.)
Top
See Also

Reference

AuditTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.Audit Namespace


AuditTypeSource.IsBackendEnabled Method

AuditTypeSourceIsBackendEnabled Method

Checks whether logging is enabled in the back-end for the given level.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Audit
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override bool IsBackendEnabled(
    LogLevel level
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel

Return Value

Type: Boolean
Remarks

The result of this method is cached. To invalidate the cache, call the Refresh method.

See Also

Reference

AuditTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.Audit Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


PostSharp.Patterns.Diagnostics.Backends.CommonLogging Namespace

Classes
 | Class | Description
Public class | CommonLoggingLoggingBackend | Logging back-end for Common.Logging.
Public class | CommonLoggingLoggingBackendOptions | Options for CommonLoggingLoggingBackend.
Public class | CommonLoggingLoggingTypeSource | LoggingTypeSource for CommonLoggingLoggingBackend.
Public class | CommonLoggingRecordBuilder | The LogRecordBuilder for CommonLoggingLoggingBackend.


CommonLoggingLoggingBackend Class

Logging back-end for Common.Logging.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingBackend
PostSharp.Patterns.Diagnostics.BackendsTextLoggingBackend
PostSharp.Patterns.Diagnostics.Backends.CommonLoggingCommonLoggingLoggingBackend

Namespace: PostSharp.Patterns.Diagnostics.Backends.CommonLogging
Assembly: PostSharp.Patterns.Diagnostics.Backends.CommonLogging (in PostSharp.Patterns.Diagnostics.Backends.CommonLogging.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class CommonLoggingLoggingBackend : TextLoggingBackend

The CommonLoggingLoggingBackend type exposes the following members.

Constructors
 | Name | Description
Public method | CommonLoggingLoggingBackend | Initializes a new CommonLoggingLoggingBackend.
Top
Properties
 | Name | Description
Public property | CurrentContext | Gets the current LoggingContext. (Inherited from LoggingBackend.)
Public property | IsCorrupted | (Inherited from LoggingBackend.)
Public property | IsDisposed | Determines whether the current LoggingBackend has been disposed. (Inherited from LoggingBackend.)
Public property | IsEnabled | Determines whether the current LoggingBackend is currently enabled. This property has precedence over, and does not affect, the minimal log levels set through the SetLevel(LogLevel) method. (Inherited from LoggingBackend.)
Public property | Options | Gets the back-end options.
Top
Methods
 | Name | Description
Protected method | CreateAsyncCustomActivityContext | Creates a new AsyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateAsyncMethodContext | Creates a new AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Protected method | CreateEphemeralContext | Creates a new EphemeralLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateIteratorContext | Creates a new IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | CreateRecordBuilder | Creates a new LogRecordBuilder. (Overrides LoggingBackendCreateRecordBuilder.)
Protected method | CreateSyncCustomActivityContext | Creates a new SyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateSyncMethodContext | Creates a new SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Protected method | CreateThreadContext | Creates a new ThreadLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateTypeSource | Creates LoggingTypeSource for the given role and type. (Overrides LoggingBackendCreateTypeSource(LoggingNamespaceSource, Type).)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingBackend.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from TextLoggingBackend.)
Public method | GetAsyncContextOfTask | Gets the AsyncMethodLoggingContext associated with a Task. (Inherited from LoggingBackend.)
Protected method | GetBackendOptions | Gets the formatting and rendering options for the current LoggingBackend. (Inherited from TextLoggingBackend.)
Public method | GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace. (Inherited from LoggingBackend.)
Public method | GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type. (Inherited from LoggingBackend.)
Protected method | GetTextBackendOptions | Gets the options. (Overrides TextLoggingBackendGetTextBackendOptions.)
Public method | GetThreadContext | Returns the ThreadLoggingContext for the current Thread. (Inherited from LoggingBackend.)
Public method | OpenAsyncContext | Gets an AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Public method | OpenCustomActivityContext | Gets a LoggingContext for a custom activity (opened using OpenActivity(String) or OpenAsyncActivity(String)). (Inherited from LoggingBackend.)
Public method | OpenEphemeralContext | Gets an EphemeralLoggingContext for use in a given method. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record. (Inherited from LoggingBackend.)
Public method | OpenIteratorContext | Gets an IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | OpenSyncContext | Gets a SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.CommonLogging Namespace

Other Resources

Conceptual: Adding Detailed Logging to your Solution
Conceptual: Logging to Common.Logging


CommonLoggingLoggingBackend Constructor

Initializes a new CommonLoggingLoggingBackend.

Namespace: PostSharp.Patterns.Diagnostics.Backends.CommonLogging
Assembly: PostSharp.Patterns.Diagnostics.Backends.CommonLogging (in PostSharp.Patterns.Diagnostics.Backends.CommonLogging.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CommonLoggingLoggingBackend()
See Also

Reference

CommonLoggingLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.CommonLogging Namespace


CommonLoggingLoggingBackend Properties

The CommonLoggingLoggingBackend type exposes the following members.

Properties
 | Name | Description
Public property | CurrentContext | Gets the current LoggingContext. (Inherited from LoggingBackend.)
Public property | IsCorrupted | (Inherited from LoggingBackend.)
Public property | IsDisposed | Determines whether the current LoggingBackend has been disposed. (Inherited from LoggingBackend.)
Public property | IsEnabled | Determines whether the current LoggingBackend is currently enabled. This property has precedence over, and does not affect, the minimal log levels set through the SetLevel(LogLevel) method. (Inherited from LoggingBackend.)
Public property | Options | Gets the back-end options.
Top
See Also

Reference

CommonLoggingLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.CommonLogging Namespace


CommonLoggingLoggingBackend.Options Property

CommonLoggingLoggingBackendOptions Property

Gets the back-end options.

Namespace: PostSharp.Patterns.Diagnostics.Backends.CommonLogging
Assembly: PostSharp.Patterns.Diagnostics.Backends.CommonLogging (in PostSharp.Patterns.Diagnostics.Backends.CommonLogging.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CommonLoggingLoggingBackendOptions Options { get; }

Property Value

Type: CommonLoggingLoggingBackendOptions
See Also

Reference

CommonLoggingLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.CommonLogging Namespace


CommonLoggingLoggingBackend Methods

The CommonLoggingLoggingBackend type exposes the following members.

Methods
 | Name | Description
Protected method | CreateAsyncCustomActivityContext | Creates a new AsyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateAsyncMethodContext | Creates a new AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Protected method | CreateEphemeralContext | Creates a new EphemeralLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateIteratorContext | Creates a new IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | CreateRecordBuilder | Creates a new LogRecordBuilder. (Overrides LoggingBackendCreateRecordBuilder.)
Protected method | CreateSyncCustomActivityContext | Creates a new SyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateSyncMethodContext | Creates a new SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Protected method | CreateThreadContext | Creates a new ThreadLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateTypeSource | Creates LoggingTypeSource for the given role and type. (Overrides LoggingBackendCreateTypeSource(LoggingNamespaceSource, Type).)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingBackend.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from TextLoggingBackend.)
Public method | GetAsyncContextOfTask | Gets the AsyncMethodLoggingContext associated with a Task. (Inherited from LoggingBackend.)
Protected method | GetBackendOptions | Gets the formatting and rendering options for the current LoggingBackend. (Inherited from TextLoggingBackend.)
Public method | GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace. (Inherited from LoggingBackend.)
Public method | GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type. (Inherited from LoggingBackend.)
Protected method | GetTextBackendOptions | Gets the options. (Overrides TextLoggingBackendGetTextBackendOptions.)
Public method | GetThreadContext | Returns the ThreadLoggingContext for the current Thread. (Inherited from LoggingBackend.)
Public method | OpenAsyncContext | Gets an AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Public method | OpenCustomActivityContext | Gets a LoggingContext for a custom activity (opened using OpenActivity(String) or OpenAsyncActivity(String)). (Inherited from LoggingBackend.)
Public method | OpenEphemeralContext | Gets an EphemeralLoggingContext for use in a given method. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record. (Inherited from LoggingBackend.)
Public method | OpenIteratorContext | Gets an IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | OpenSyncContext | Gets a SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Top
See Also

Reference

CommonLoggingLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.CommonLogging Namespace


CommonLoggingLoggingBackend.CreateRecordBuilder Method

CommonLoggingLoggingBackendCreateRecordBuilder Method

Creates a new LogRecordBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Backends.CommonLogging
Assembly: PostSharp.Patterns.Diagnostics.Backends.CommonLogging (in PostSharp.Patterns.Diagnostics.Backends.CommonLogging.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override LogRecordBuilder CreateRecordBuilder()

Return Value

Type: LogRecordBuilder
A new LogRecordBuilder.
See Also

Reference

CommonLoggingLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.CommonLogging Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


CommonLoggingLoggingBackend.CreateTypeSource Method

CommonLoggingLoggingBackendCreateTypeSource Method

Creates LoggingTypeSource for the given role and type.

Namespace: PostSharp.Patterns.Diagnostics.Backends.CommonLogging
Assembly: PostSharp.Patterns.Diagnostics.Backends.CommonLogging (in PostSharp.Patterns.Diagnostics.Backends.CommonLogging.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override LoggingTypeSource CreateTypeSource(
    LoggingNamespaceSource parent,
    Type type
)

Parameters

parent
Type: PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
type
Type: SystemType

Return Value

Type: LoggingTypeSource
See Also

Reference

CommonLoggingLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.CommonLogging Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


CommonLoggingLoggingBackend.GetTextBackendOptions Method

CommonLoggingLoggingBackendGetTextBackendOptions Method

Gets the options.

Namespace: PostSharp.Patterns.Diagnostics.Backends.CommonLogging
Assembly: PostSharp.Patterns.Diagnostics.Backends.CommonLogging (in PostSharp.Patterns.Diagnostics.Backends.CommonLogging.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override TextLoggingBackendOptions GetTextBackendOptions()

Return Value

Type: TextLoggingBackendOptions
See Also

Reference

CommonLoggingLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.CommonLogging Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


CommonLoggingLoggingBackendOptions Class

Options for CommonLoggingLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingBackendOptions
PostSharp.Patterns.Diagnostics.BackendsTextLoggingBackendOptions
PostSharp.Patterns.Diagnostics.Backends.CommonLoggingCommonLoggingLoggingBackendOptions

Namespace: PostSharp.Patterns.Diagnostics.Backends.CommonLogging
Assembly: PostSharp.Patterns.Diagnostics.Backends.CommonLogging (in PostSharp.Patterns.Diagnostics.Backends.CommonLogging.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class CommonLoggingLoggingBackendOptions : TextLoggingBackendOptions

The CommonLoggingLoggingBackendOptions type exposes the following members.

Constructors
 | Name | Description
Public method | CommonLoggingLoggingBackendOptions | Initializes a new instance of the CommonLoggingLoggingBackendOptions class
Top
Properties
 | Name | Description
Public property | ActionMaxLength | Max length of a log record. The default value is 2048. (Inherited from TextLoggingBackendOptions.)
Public property | AppendTrailingPeriod | Determines whether log messages should be ended with a trailing period. The default value is true because we really like trailing periods at PostSharp, but other opinions are valid. (Inherited from TextLoggingBackendOptions.)
Public property | ContextMaxLength | Max length of the Description property. (Inherited from LoggingBackendOptions.)
Public property | Delimiter | String used to separate different parts of the logging record. The default value is a pipe surrounded by spaces ( | ). (Inherited from TextLoggingBackendOptions.)
Public property | GetLogger | Function that returns a Common Logging ILog interface for a given CommonLoggingLoggingTypeSource. The default implementation is to call LogManager.GetLogger( typeSource.Role ).
Public property | IncludeExceptionDetails | Determines whether exception details (basically Exception.ToString) should be appended to the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeNamespace | Determines whether the full namespace of types should be included in the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeType | Determines whether the name of the type of the logged method should be included in the log. The default value is true. (Inherited from TextLoggingBackendOptions.)
Public property | IndentSpaces | Number of spaces for each indentation level. The default value is 2. (Inherited from TextLoggingBackendOptions.)
Public property | LogLevelIgnoredForSystemRecords | Determines whether the Level property is ignored by the current back-end for auto-generated (i.e. non-manual) logging records. Some back-ends may not support overriding the level of records. (Inherited from LoggingBackendOptions.)
Public property | ShouldLogExceptionPredicate | Gets or sets a predicate that determines whether an exception should be logged. This predicate is evaluated only when the method entry is not logged. When the method entry is logged, exceptions are always logged. (Inherited from TextLoggingBackendOptions.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.CommonLogging Namespace


CommonLoggingLoggingBackendOptions Constructor

Initializes a new instance of the CommonLoggingLoggingBackendOptions class

Namespace: PostSharp.Patterns.Diagnostics.Backends.CommonLogging
Assembly: PostSharp.Patterns.Diagnostics.Backends.CommonLogging (in PostSharp.Patterns.Diagnostics.Backends.CommonLogging.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CommonLoggingLoggingBackendOptions()
See Also

Reference

CommonLoggingLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.CommonLogging Namespace


CommonLoggingLoggingBackendOptions Properties

The CommonLoggingLoggingBackendOptions type exposes the following members.

Properties
 | Name | Description
Public property | ActionMaxLength | Max length of a log record. The default value is 2048. (Inherited from TextLoggingBackendOptions.)
Public property | AppendTrailingPeriod | Determines whether log messages should be ended with a trailing period. The default value is true because we really like trailing periods at PostSharp, but other opinions are valid. (Inherited from TextLoggingBackendOptions.)
Public property | ContextMaxLength | Max length of the Description property. (Inherited from LoggingBackendOptions.)
Public property | Delimiter | String used to separate different parts of the logging record. The default value is a pipe surrounded by spaces ( | ). (Inherited from TextLoggingBackendOptions.)
Public property | GetLogger | Function that returns a Common Logging ILog interface for a given CommonLoggingLoggingTypeSource. The default implementation is to call LogManager.GetLogger( typeSource.Role ).
Public property | IncludeExceptionDetails | Determines whether exception details (basically Exception.ToString) should be appended to the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeNamespace | Determines whether the full namespace of types should be included in the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeType | Determines whether the name of the type of the logged method should be included in the log. The default value is true. (Inherited from TextLoggingBackendOptions.)
Public property | IndentSpaces | Number of spaces for each indentation level. The default value is 2. (Inherited from TextLoggingBackendOptions.)
Public property | LogLevelIgnoredForSystemRecords | Determines whether the Level property is ignored by the current back-end for auto-generated (i.e. non-manual) logging records. Some back-ends may not support overriding the level of records. (Inherited from LoggingBackendOptions.)
Public property | ShouldLogExceptionPredicate | Gets or sets a predicate that determines whether an exception should be logged. This predicate is evaluated only when the method entry is not logged. When the method entry is logged, exceptions are always logged. (Inherited from TextLoggingBackendOptions.)
Top
See Also

Reference

CommonLoggingLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.CommonLogging Namespace


CommonLoggingLoggingBackendOptions.GetLogger Property

CommonLoggingLoggingBackendOptionsGetLogger Property

Function that returns a Common Logging ILog interface for a given CommonLoggingLoggingTypeSource. The default implementation is to call LogManager.GetLogger( typeSource.Role ).

Namespace: PostSharp.Patterns.Diagnostics.Backends.CommonLogging
Assembly: PostSharp.Patterns.Diagnostics.Backends.CommonLogging (in PostSharp.Patterns.Diagnostics.Backends.CommonLogging.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Func<CommonLoggingLoggingTypeSource, ILog> GetLogger { get; set; }

Property Value

Type: Func CommonLoggingLoggingTypeSource, ILog
See Also

Reference

CommonLoggingLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.CommonLogging Namespace


CommonLoggingLoggingTypeSource Class

LoggingTypeSource for CommonLoggingLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
PostSharp.Patterns.DiagnosticsLoggingTypeSource
PostSharp.Patterns.Diagnostics.Backends.CommonLoggingCommonLoggingLoggingTypeSource

Namespace: PostSharp.Patterns.Diagnostics.Backends.CommonLogging
Assembly: PostSharp.Patterns.Diagnostics.Backends.CommonLogging (in PostSharp.Patterns.Diagnostics.Backends.CommonLogging.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class CommonLoggingLoggingTypeSource : LoggingTypeSource

The CommonLoggingLoggingTypeSource type exposes the following members.

Constructors
 | Name | Description
Public method | CommonLoggingLoggingTypeSource | Initializes a new CommonLoggingLoggingTypeSource.
Top
Properties
 | Name | Description
Public property | Backend | Gets the parent LoggingBackend. (Inherited from LoggingNamespaceSource.)
Public property | DisplayFullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the DisplayFullName property does not include the arity, i.e. the full name of List<T> is System.Collections.Generic.List. (Inherited from LoggingNamespaceSource.)
Public property | DisplayName | Gets the last component of the name of the type or namespace, in the form that should be reported to the log. For generic types, the DisplayName property does not include the arity, i.e. the name of List<T> is List. (Inherited from LoggingNamespaceSource.)
Public property | FullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the FullName property includes the arity, i.e. the full name of List<T> is System.Collections.Generic.List`1. (Inherited from LoggingNamespaceSource.)
Public property | GenericParameterCount | Gets the number of generic parameters in SourceType. (Inherited from LoggingTypeSource.)
Public property | Level | Gets the minimal LogLevel for which logging is enabled for the current namespace or type. (Inherited from LoggingNamespaceSource.)
Public property | Logger | Gets the ILog to which messages will be written.
Public property | Name | Gets the last component of the name of the type or namespace. For instance, when FullName is PostSharp.Patterns.Diagnostics.LoggingBackend, Name is LoggingBackend. For generic types, the Name property includes the arity, i.e. the name of List<T> is List`1. (Inherited from LoggingNamespaceSource.)
Public property | Options | Gets the LoggingRoleConfiguration for the current role. This property is a shortcut to LoggingServices.Roles[this.Role]. (Inherited from LoggingTypeSource.)
Public property | Parent | Gets the parent LoggingNamespaceSource, or null if the current object represents the root namespace. (Inherited from LoggingNamespaceSource.)
Public property | Role | Gets the logging role for the current role. Typical values of this property are listed in the LoggingRoles class. (Inherited from LoggingNamespaceSource.)
Public property | SourceType | The type represented by the current LoggingTypeSource. (Inherited from LoggingTypeSource.)
Top
Methods
 | Name | Description
Protected method | IsBackendEnabled | Checks whether logging is enabled in the back-end for the given level. (Overrides LoggingTypeSourceIsBackendEnabled(LogLevel).)
Public method | IsEnabled | Determines whether logging is enabled for the given LogLevel. (Inherited from LoggingTypeSource.)
Public method | Refresh | Refreshes the logging level from the back-end from the current node and all children nodes. The back-end-defined logging level is cached for performance reasons. (Inherited from LoggingTypeSource.)
Public method | SetLevel | Sets the minimal LogLevel for which logging is enabled for the current namespace and type and all children namespaces and types. (Inherited from LoggingNamespaceSource.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.CommonLogging Namespace


CommonLoggingLoggingTypeSource Constructor

Initializes a new CommonLoggingLoggingTypeSource.

Namespace: PostSharp.Patterns.Diagnostics.Backends.CommonLogging
Assembly: PostSharp.Patterns.Diagnostics.Backends.CommonLogging (in PostSharp.Patterns.Diagnostics.Backends.CommonLogging.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CommonLoggingLoggingTypeSource(
    LoggingNamespaceSource parent,
    Type type
)

Parameters

parent
Type: PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
The parent LoggingNamespaceSource.
type
Type: SystemType
The source Type from which log records will be emitted.
See Also

Reference

CommonLoggingLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.CommonLogging Namespace


CommonLoggingLoggingTypeSource Properties

The CommonLoggingLoggingTypeSource type exposes the following members.

Properties
 | Name | Description
Public property | Backend | Gets the parent LoggingBackend. (Inherited from LoggingNamespaceSource.)
Public property | DisplayFullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the DisplayFullName property does not include the arity, i.e. the full name of List<T> is System.Collections.Generic.List. (Inherited from LoggingNamespaceSource.)
Public property | DisplayName | Gets the last component of the name of the type or namespace, in the form that should be reported to the log. For generic types, the DisplayName property does not include the arity, i.e. the name of List<T> is List. (Inherited from LoggingNamespaceSource.)
Public property | FullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the FullName property includes the arity, i.e. the full name of List<T> is System.Collections.Generic.List`1. (Inherited from LoggingNamespaceSource.)
Public property | GenericParameterCount | Gets the number of generic parameters in SourceType. (Inherited from LoggingTypeSource.)
Public property | Level | Gets the minimal LogLevel for which logging is enabled for the current namespace or type. (Inherited from LoggingNamespaceSource.)
Public property | Logger | Gets the ILog to which messages will be written.
Public property | Name | Gets the last component of the name of the type or namespace. For instance, when FullName is PostSharp.Patterns.Diagnostics.LoggingBackend, Name is LoggingBackend. For generic types, the Name property includes the arity, i.e. the name of List<T> is List`1. (Inherited from LoggingNamespaceSource.)
Public property | Options | Gets the LoggingRoleConfiguration for the current role. This property is a shortcut to LoggingServices.Roles[this.Role]. (Inherited from LoggingTypeSource.)
Public property | Parent | Gets the parent LoggingNamespaceSource, or null if the current object represents the root namespace. (Inherited from LoggingNamespaceSource.)
Public property | Role | Gets the logging role for the current role. Typical values of this property are listed in the LoggingRoles class. (Inherited from LoggingNamespaceSource.)
Public property | SourceType | The type represented by the current LoggingTypeSource. (Inherited from LoggingTypeSource.)
Top
See Also

Reference

CommonLoggingLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.CommonLogging Namespace


CommonLoggingLoggingTypeSource.Logger Property

CommonLoggingLoggingTypeSourceLogger Property

Gets the ILog to which messages will be written.

Namespace: PostSharp.Patterns.Diagnostics.Backends.CommonLogging
Assembly: PostSharp.Patterns.Diagnostics.Backends.CommonLogging (in PostSharp.Patterns.Diagnostics.Backends.CommonLogging.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ILog Logger { get; }

Property Value

Type: ILog
See Also

Reference

CommonLoggingLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.CommonLogging Namespace


CommonLoggingLoggingTypeSource Methods

The CommonLoggingLoggingTypeSource type exposes the following members.

Methods
 | Name | Description
Protected method | IsBackendEnabled | Checks whether logging is enabled in the back-end for the given level. (Overrides LoggingTypeSourceIsBackendEnabled(LogLevel).)
Public method | IsEnabled | Determines whether logging is enabled for the given LogLevel. (Inherited from LoggingTypeSource.)
Public method | Refresh | Refreshes the logging level from the back-end from the current node and all children nodes. The back-end-defined logging level is cached for performance reasons. (Inherited from LoggingTypeSource.)
Public method | SetLevel | Sets the minimal LogLevel for which logging is enabled for the current namespace and type and all children namespaces and types. (Inherited from LoggingNamespaceSource.)
Top
See Also

Reference

CommonLoggingLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.CommonLogging Namespace


CommonLoggingLoggingTypeSource.IsBackendEnabled Method

CommonLoggingLoggingTypeSourceIsBackendEnabled Method

Checks whether logging is enabled in the back-end for the given level.

Namespace: PostSharp.Patterns.Diagnostics.Backends.CommonLogging
Assembly: PostSharp.Patterns.Diagnostics.Backends.CommonLogging (in PostSharp.Patterns.Diagnostics.Backends.CommonLogging.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override bool IsBackendEnabled(
    LogLevel level
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel

Return Value

Type: Boolean
Remarks

The result of this method is cached. To invalidate the cache, call the Refresh method.

See Also

Reference

CommonLoggingLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.CommonLogging Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


CommonLoggingRecordBuilder Class

The LogRecordBuilder for CommonLoggingLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.RecordBuildersLogRecordBuilder
PostSharp.Patterns.Diagnostics.RecordBuildersTextLogRecordBuilder
PostSharp.Patterns.Diagnostics.Backends.CommonLoggingCommonLoggingRecordBuilder

Namespace: PostSharp.Patterns.Diagnostics.Backends.CommonLogging
Assembly: PostSharp.Patterns.Diagnostics.Backends.CommonLogging (in PostSharp.Patterns.Diagnostics.Backends.CommonLogging.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class CommonLoggingRecordBuilder : TextLogRecordBuilder

The CommonLoggingRecordBuilder type exposes the following members.

Constructors
 | Name | Description
Public method | CommonLoggingRecordBuilder | Initializes a new CommonLoggingRecordBuilder.
Top
Properties
 | Name | Description
Public property | Backend | Gets the parent back-end. (Inherited from TextLogRecordBuilder.)
Public property | BackendOptions | Shortcut for this.Backend.Options. (Inherited from TextLogRecordBuilder.)
Protected property | Context | Gets the LoggingContext to which the record belongs. (Inherited from LogRecordBuilder.)
Public property | Exception | Gets the Exception for the current record, or null if no exception is associated to the current record. (Inherited from TextLogRecordBuilder.)
Public property | IsDisposed | (Inherited from LogRecordBuilder.)
Protected property | Level | Gets the LogLevel for the current record. (Inherited from TextLogRecordBuilder.)
Public property | MemberName | Gets the name of the method, property or field for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Options | Gets the LoggingOptions for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Profile | Gets the LoggingProfile for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | RecordKind | Gets the kind of the current record (e.g. MethodEntry or MethodException). (Inherited from LogRecordBuilder.)
Public property | SourceLineInfo | Gets the SourceLineInfo for the current record. (Inherited from TextLogRecordBuilder.)
Public property | SourceType | Gets the source Type of the current record. (Inherited from TextLogRecordBuilder.)
Protected property | StringBuilder | Gets the current UnsafeStringBuilder where everything is being appended. (Inherited from TextLogRecordBuilder.)
Protected property | ThreadContext | Gets the ThreadLoggingContext to which the current LogRecordBuilder belongs. (Inherited from LogRecordBuilder.)
Protected property | TypeSource | Gets the LoggingTypeSource for the current record. (Inherited from TextLogRecordBuilder.)
Top
Methods
 | Name | Description
Protected method | AppendAsyncInfo | Appends information about the async method to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendClosingParenthesisConditional | Appends a closing parenthesis to the current StringBuilder if required. (Inherited from TextLogRecordBuilder.)
Protected method | AppendComma | (Inherited from TextLogRecordBuilder.)
Protected method | AppendCommaConditional | Appends a comma to the current StringBuilder, unless this method is invoked for the first time for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription | Appends the context Description (or the TypeSource name, if the type of the context is not equal to the source type of the record) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription(LoggingContext) | (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiter | Appends a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiterConditional | Appends a Delimiter to the current StringBuilder if the RequireDelimiter method has been called previously. (Inherited from TextLogRecordBuilder.)
Protected method | AppendEpilogue | Appends the final part of log message to StringBuilder. This includes state machine number and execution time where relevant, but does not include exception details. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExceptionDetails | Appends exception details to StringBuilder if IncludeExceptionDetails is set. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTime | Appends the execution time to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTimeThreshold | Appends the execution time threshold to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendIndentString | Appends indentation for the given to StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendMemberName | Appends name of the member for the current record (including the declaring type name, subject to the IncludeType property) to the current StringBuilder, as well as an opening parenthesis. (Inherited from TextLogRecordBuilder.)
Protected method | AppendOpeningParenthesis | Appends an opening parenthesis to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendProlog | Appends the indent string, context description, and the record kind to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendRecordKind | Appends the LogRecordKind of the current record to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameter(SemanticParameterKind, String, String, String, Int32) | Appends a parameter of String type to the current StringBuilder. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSourceLineInfo | Appends source (file, line) information to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpaces | Appends a given number of spaces to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpecialChar | Appends a special Char (which may require escaping with specific back-ends) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTrailingPeriod | Appends a trailing period (.) to the current StringBuilder, respecting the AppendTrailingPeriod property. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTypeName | Appends the name of the TypeSource to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | BeginCustomRecord | Initializes the current LogRecordBuilder to emit a custom record. (Inherited from TextLogRecordBuilder.)
Public method | BeginRecord | Initializes the current LogRecordBuilder to emit a standard (i.e. non-custom) record for a given context and method. (Inherited from TextLogRecordBuilder.)
Public method | Complete | Emits the record and resets the current LogRecordBuilder. This method invoked after all SetThisT(T), SetParameterT(Int32, String, ParameterKind, String, T) and similar methods have been called. (Inherited from LogRecordBuilder.)
Public method | Dispose | (Inherited from LogRecordBuilder.)
Protected method | EmitRecord | Emits the record. Invoked by the Complete method. (Inherited from TextLogRecordBuilder.)
Protected method | EmitRecord(Boolean) | Emits the record and specifies whether exception details should be appended to the text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescription | Ends building the context Description and starts building the action text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescriptionConditional | Switches between building the context Description and the action text. If the EndContextDescriptionConditional method has been previously invoked, subsequent calls are ignored. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescription | Obsolete. Gets the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescriptionUnsafe | Obsolete. Gets an UnsafeString representing the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextForDescription | Obsolete. Gets the LoggingContext that should be used when getting or appending the Description. (Inherited from TextLogRecordBuilder.)
Protected method | GetSourceName | Gets the name of the TypeSource for the current record, respecting the IncludeNamespace property. (Inherited from TextLogRecordBuilder.)
Protected method | HasRecordKindName | Determines whether the AppendRecordKind will append anything for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | MustBuildContextDescription | Determines whether the current Description should be appended to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | RequireComma | Makes the AppendCommaConditional to append a comma even if it's invoked for the first time. (Inherited from TextLogRecordBuilder.)
Protected method | RequireDelimiter | Causes the next call to the AppendDelimiterConditional to append a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | Reset | Resets all fields and properties of the current LogRecordBuilder to their initial value. Invoked by the Complete method. (Inherited from TextLogRecordBuilder.)
Public method | SetException | Sets the exception for the method or activity. (Inherited from TextLogRecordBuilder.)
Public method | SetExecutionTime | Sets the method or activity execution time. (Inherited from TextLogRecordBuilder.)
Public method | SetMethodGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T) | Sets the value of a given parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from TextLogRecordBuilder.)
Public method | SetRefStructParameter | (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T) | Sets a given return value (there can be several return values in C# 7.0) and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetThisT(T) | Sets the this (instance) value and uses the default formatter. This method is only invoked if the IncludeThisValue property is true. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetTypeGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Protected method | ShouldLogExceptionDetails | Determines whether exception details should be appended to the text of the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | ToString | Returns a string that represents the current object. (Inherited from TextLogRecordBuilder.)
Protected method | Write | Writes the final message to the back-end. (Overrides TextLogRecordBuilderWrite(UnsafeString).)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T) | Writes a custom parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | WriteCustomString | Write a chunk of custom string. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.CommonLogging Namespace


CommonLoggingRecordBuilder Constructor

Initializes a new CommonLoggingRecordBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Backends.CommonLogging
Assembly: PostSharp.Patterns.Diagnostics.Backends.CommonLogging (in PostSharp.Patterns.Diagnostics.Backends.CommonLogging.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CommonLoggingRecordBuilder(
    CommonLoggingLoggingBackend backend
)

Parameters

backend
Type: PostSharp.Patterns.Diagnostics.Backends.CommonLoggingCommonLoggingLoggingBackend
The parent CommonLoggingLoggingBackend.
See Also

Reference

CommonLoggingRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.CommonLogging Namespace


CommonLoggingRecordBuilder Properties

The CommonLoggingRecordBuilder type exposes the following members.

Properties
 | Name | Description
Public property | Backend | Gets the parent back-end. (Inherited from TextLogRecordBuilder.)
Public property | BackendOptions | Shortcut for this.Backend.Options. (Inherited from TextLogRecordBuilder.)
Protected property | Context | Gets the LoggingContext to which the record belongs. (Inherited from LogRecordBuilder.)
Public property | Exception | Gets the Exception for the current record, or null if no exception is associated to the current record. (Inherited from TextLogRecordBuilder.)
Public property | IsDisposed | (Inherited from LogRecordBuilder.)
Protected property | Level | Gets the LogLevel for the current record. (Inherited from TextLogRecordBuilder.)
Public property | MemberName | Gets the name of the method, property or field for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Options | Gets the LoggingOptions for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Profile | Gets the LoggingProfile for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | RecordKind | Gets the kind of the current record (e.g. MethodEntry or MethodException). (Inherited from LogRecordBuilder.)
Public property | SourceLineInfo | Gets the SourceLineInfo for the current record. (Inherited from TextLogRecordBuilder.)
Public property | SourceType | Gets the source Type of the current record. (Inherited from TextLogRecordBuilder.)
Protected property | StringBuilder | Gets the current UnsafeStringBuilder where everything is being appended. (Inherited from TextLogRecordBuilder.)
Protected property | ThreadContext | Gets the ThreadLoggingContext to which the current LogRecordBuilder belongs. (Inherited from LogRecordBuilder.)
Protected property | TypeSource | Gets the LoggingTypeSource for the current record. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

CommonLoggingRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.CommonLogging Namespace


CommonLoggingRecordBuilder Methods

The CommonLoggingRecordBuilder type exposes the following members.

Methods
 | Name | Description
Protected method | AppendAsyncInfo | Appends information about the async method to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendClosingParenthesisConditional | Appends a closing parenthesis to the current StringBuilder if required. (Inherited from TextLogRecordBuilder.)
Protected method | AppendComma | (Inherited from TextLogRecordBuilder.)
Protected method | AppendCommaConditional | Appends a comma to the current StringBuilder, unless this method is invoked for the first time for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription | Appends the context Description (or the TypeSource name, if the type of the context is not equal to the source type of the record) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription(LoggingContext) | (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiter | Appends a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiterConditional | Appends a Delimiter to the current StringBuilder if the RequireDelimiter method has been called previously. (Inherited from TextLogRecordBuilder.)
Protected method | AppendEpilogue | Appends the final part of log message to StringBuilder. This includes state machine number and execution time where relevant, but does not include exception details. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExceptionDetails | Appends exception details to StringBuilder if IncludeExceptionDetails is set. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTime | Appends the execution time to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTimeThreshold | Appends the execution time threshold to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendIndentString | Appends indentation for the given to StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendMemberName | Appends name of the member for the current record (including the declaring type name, subject to the IncludeType property) to the current StringBuilder, as well as an opening parenthesis. (Inherited from TextLogRecordBuilder.)
Protected method | AppendOpeningParenthesis | Appends an opening parenthesis to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendProlog | Appends the indent string, context description, and the record kind to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendRecordKind | Appends the LogRecordKind of the current record to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameter(SemanticParameterKind, String, String, String, Int32) | Appends a parameter of String type to the current StringBuilder. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSourceLineInfo | Appends source (file, line) information to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpaces | Appends a given number of spaces to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpecialChar | Appends a special Char (which may require escaping with specific back-ends) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTrailingPeriod | Appends a trailing period (.) to the current StringBuilder, respecting the AppendTrailingPeriod property. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTypeName | Appends the name of the TypeSource to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | BeginCustomRecord | Initializes the current LogRecordBuilder to emit a custom record. (Inherited from TextLogRecordBuilder.)
Public method | BeginRecord | Initializes the current LogRecordBuilder to emit a standard (i.e. non-custom) record for a given context and method. (Inherited from TextLogRecordBuilder.)
Public method | Complete | Emits the record and resets the current LogRecordBuilder. This method invoked after all SetThisT(T), SetParameterT(Int32, String, ParameterKind, String, T) and similar methods have been called. (Inherited from LogRecordBuilder.)
Public method | Dispose | (Inherited from LogRecordBuilder.)
Protected method | EmitRecord | Emits the record. Invoked by the Complete method. (Inherited from TextLogRecordBuilder.)
Protected method | EmitRecord(Boolean) | Emits the record and specifies whether exception details should be appended to the text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescription | Ends building the context Description and starts building the action text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescriptionConditional | Switches between building the context Description and the action text. If the EndContextDescriptionConditional method has been previously invoked, subsequent calls are ignored. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescription | Obsolete. Gets the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescriptionUnsafe | Obsolete. Gets an UnsafeString representing the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextForDescription | Obsolete. Gets the LoggingContext that should be used when getting or appending the Description. (Inherited from TextLogRecordBuilder.)
Protected method | GetSourceName | Gets the name of the TypeSource for the current record, respecting the IncludeNamespace property. (Inherited from TextLogRecordBuilder.)
Protected method | HasRecordKindName | Determines whether the AppendRecordKind will append anything for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | MustBuildContextDescription | Determines whether the current Description should be appended to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | RequireComma | Makes the AppendCommaConditional to append a comma even if it's invoked for the first time. (Inherited from TextLogRecordBuilder.)
Protected method | RequireDelimiter | Causes the next call to the AppendDelimiterConditional to append a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | Reset | Resets all fields and properties of the current LogRecordBuilder to their initial value. Invoked by the Complete method. (Inherited from TextLogRecordBuilder.)
Public method | SetException | Sets the exception for the method or activity. (Inherited from TextLogRecordBuilder.)
Public method | SetExecutionTime | Sets the method or activity execution time. (Inherited from TextLogRecordBuilder.)
Public method | SetMethodGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T) | Sets the value of a given parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from TextLogRecordBuilder.)
Public method | SetRefStructParameter | (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T) | Sets a given return value (there can be several return values in C# 7.0) and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetThisT(T) | Sets the this (instance) value and uses the default formatter. This method is only invoked if the IncludeThisValue property is true. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetTypeGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Protected method | ShouldLogExceptionDetails | Determines whether exception details should be appended to the text of the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | ToString | Returns a string that represents the current object. (Inherited from TextLogRecordBuilder.)
Protected method | Write | Writes the final message to the back-end. (Overrides TextLogRecordBuilderWrite(UnsafeString).)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T) | Writes a custom parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | WriteCustomString | Write a chunk of custom string. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

CommonLoggingRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.CommonLogging Namespace


CommonLoggingRecordBuilder.Write Method

CommonLoggingRecordBuilderWrite Method

Writes the final message to the back-end.

Namespace: PostSharp.Patterns.Diagnostics.Backends.CommonLogging
Assembly: PostSharp.Patterns.Diagnostics.Backends.CommonLogging (in PostSharp.Patterns.Diagnostics.Backends.CommonLogging.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void Write(
    UnsafeString message
)

Parameters

message
Type: PostSharp.Patterns.FormattersUnsafeString
The final message.
See Also

Reference

CommonLoggingRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.CommonLogging Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


PostSharp.Patterns.Diagnostics.Backends.Console Namespace

Classes
 | Class | Description
Public class | ConsoleLoggingBackend | Logging back-end that logs to Out.
Public class | ConsoleLoggingBackendOptions | Options the for ConsoleLoggingBackend class.
Public class | ConsoleLoggingTypeSource | The LoggingTypeSource for ConsoleLoggingBackend.
Public class | ConsoleLogRecordBuilder | The LogRecordBuilder for ConsoleLoggingBackend.
Public class | ConsoleTheme | A simple implementation of a color theme that allows only for two colors per LogLevel.
Public class | ConsoleThemes | A collection of color themes for use with the ConsoleLoggingBackend.
Public class | ConsoleThemeStyle | Represents a style in a console theme.
Public class | LogLevelArrayT | A high-performance map of LogLevel to something else.
Interfaces
 | Interface | Description
Public interface | IConsoleTheme | Exposes the semantics of a console color theme. A simple implementation is provided by the ConsoleTheme class, and ready-made themes are exposed on the ConsoleThemes class.
Enumerations
 | Enumeration | Description
Public enumeration | ConsoleThemeItem | Enumeration of item kinds that can be themed.


ConsoleLoggingBackend Class

Logging back-end that logs to Out.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingBackend
PostSharp.Patterns.Diagnostics.BackendsTextLoggingBackend
PostSharp.Patterns.Diagnostics.Backends.ConsoleConsoleLoggingBackend

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class ConsoleLoggingBackend : TextLoggingBackend

The ConsoleLoggingBackend type exposes the following members.

Constructors
 | Name | Description
Public method | ConsoleLoggingBackend | Initializes a new ConsoleLoggingBackend.
Top
Properties
 | Name | Description
Public property | CurrentContext | Gets the current LoggingContext. (Inherited from LoggingBackend.)
Public property | IsCorrupted | (Inherited from LoggingBackend.)
Public property | IsDisposed | Determines whether the current LoggingBackend has been disposed. (Inherited from LoggingBackend.)
Public property | IsEnabled | Determines whether the current LoggingBackend is currently enabled. This property has precedence over, and does not affect, the minimal log levels set through the SetLevel(LogLevel) method. (Inherited from LoggingBackend.)
Public property | Options | Gets the back-end options.
Top
Methods
 | Name | Description
Protected method | CreateAsyncCustomActivityContext | Creates a new AsyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateAsyncMethodContext | Creates a new AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Protected method | CreateEphemeralContext | Creates a new EphemeralLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateIteratorContext | Creates a new IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | CreateRecordBuilder | Creates a new LogRecordBuilder. (Overrides LoggingBackendCreateRecordBuilder.)
Protected method | CreateSyncCustomActivityContext | Creates a new SyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateSyncMethodContext | Creates a new SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Protected method | CreateThreadContext | Creates a new ThreadLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateTypeSource | Creates LoggingTypeSource for the given role and type. (Overrides LoggingBackendCreateTypeSource(LoggingNamespaceSource, Type).)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingBackend.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from TextLoggingBackend.)
Public method | GetAsyncContextOfTask | Gets the AsyncMethodLoggingContext associated with a Task. (Inherited from LoggingBackend.)
Protected method | GetBackendOptions | Gets the formatting and rendering options for the current LoggingBackend. (Inherited from TextLoggingBackend.)
Public method | GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace. (Inherited from LoggingBackend.)
Public method | GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type. (Inherited from LoggingBackend.)
Protected method | GetTextBackendOptions | Gets the options. (Overrides TextLoggingBackendGetTextBackendOptions.)
Public method | GetThreadContext | Returns the ThreadLoggingContext for the current Thread. (Inherited from LoggingBackend.)
Public method | OpenAsyncContext | Gets an AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Public method | OpenCustomActivityContext | Gets a LoggingContext for a custom activity (opened using OpenActivity(String) or OpenAsyncActivity(String)). (Inherited from LoggingBackend.)
Public method | OpenEphemeralContext | Gets an EphemeralLoggingContext for use in a given method. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record. (Inherited from LoggingBackend.)
Public method | OpenIteratorContext | Gets an IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | OpenSyncContext | Gets a SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Console Namespace

Other Resources

Conceptual: Adding Detailed Logging to your Solution
Conceptual: Logging to the system console


ConsoleLoggingBackend Constructor

Initializes a new ConsoleLoggingBackend.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ConsoleLoggingBackend()
See Also

Reference

ConsoleLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleLoggingBackend Properties

The ConsoleLoggingBackend type exposes the following members.

Properties
 | Name | Description
Public property | CurrentContext | Gets the current LoggingContext. (Inherited from LoggingBackend.)
Public property | IsCorrupted | (Inherited from LoggingBackend.)
Public property | IsDisposed | Determines whether the current LoggingBackend has been disposed. (Inherited from LoggingBackend.)
Public property | IsEnabled | Determines whether the current LoggingBackend is currently enabled. This property has precedence over, and does not affect, the minimal log levels set through the SetLevel(LogLevel) method. (Inherited from LoggingBackend.)
Public property | Options | Gets the back-end options.
Top
See Also

Reference

ConsoleLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleLoggingBackend.Options Property

ConsoleLoggingBackendOptions Property

Gets the back-end options.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ConsoleLoggingBackendOptions Options { get; }

Property Value

Type: ConsoleLoggingBackendOptions
See Also

Reference

ConsoleLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleLoggingBackend Methods

The ConsoleLoggingBackend type exposes the following members.

Methods
 | Name | Description
Protected method | CreateAsyncCustomActivityContext | Creates a new AsyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateAsyncMethodContext | Creates a new AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Protected method | CreateEphemeralContext | Creates a new EphemeralLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateIteratorContext | Creates a new IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | CreateRecordBuilder | Creates a new LogRecordBuilder. (Overrides LoggingBackendCreateRecordBuilder.)
Protected method | CreateSyncCustomActivityContext | Creates a new SyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateSyncMethodContext | Creates a new SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Protected method | CreateThreadContext | Creates a new ThreadLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateTypeSource | Creates LoggingTypeSource for the given role and type. (Overrides LoggingBackendCreateTypeSource(LoggingNamespaceSource, Type).)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingBackend.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from TextLoggingBackend.)
Public method | GetAsyncContextOfTask | Gets the AsyncMethodLoggingContext associated with a Task. (Inherited from LoggingBackend.)
Protected method | GetBackendOptions | Gets the formatting and rendering options for the current LoggingBackend. (Inherited from TextLoggingBackend.)
Public method | GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace. (Inherited from LoggingBackend.)
Public method | GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type. (Inherited from LoggingBackend.)
Protected method | GetTextBackendOptions | Gets the options. (Overrides TextLoggingBackendGetTextBackendOptions.)
Public method | GetThreadContext | Returns the ThreadLoggingContext for the current Thread. (Inherited from LoggingBackend.)
Public method | OpenAsyncContext | Gets an AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Public method | OpenCustomActivityContext | Gets a LoggingContext for a custom activity (opened using OpenActivity(String) or OpenAsyncActivity(String)). (Inherited from LoggingBackend.)
Public method | OpenEphemeralContext | Gets an EphemeralLoggingContext for use in a given method. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record. (Inherited from LoggingBackend.)
Public method | OpenIteratorContext | Gets an IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | OpenSyncContext | Gets a SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Top
See Also

Reference

ConsoleLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleLoggingBackend.CreateRecordBuilder Method

ConsoleLoggingBackendCreateRecordBuilder Method

Creates a new LogRecordBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override LogRecordBuilder CreateRecordBuilder()

Return Value

Type: LogRecordBuilder
A new LogRecordBuilder.
See Also

Reference

ConsoleLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


ConsoleLoggingBackend.CreateTypeSource Method

ConsoleLoggingBackendCreateTypeSource Method

Creates LoggingTypeSource for the given role and type.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override LoggingTypeSource CreateTypeSource(
    LoggingNamespaceSource parent,
    Type type
)

Parameters

parent
Type: PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
type
Type: SystemType

Return Value

Type: LoggingTypeSource
See Also

Reference

ConsoleLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


ConsoleLoggingBackend.GetTextBackendOptions Method

ConsoleLoggingBackendGetTextBackendOptions Method

Gets the options.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override TextLoggingBackendOptions GetTextBackendOptions()

Return Value

Type: TextLoggingBackendOptions
See Also

Reference

ConsoleLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


ConsoleLoggingBackendOptions Class

Options the for ConsoleLoggingBackend class.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingBackendOptions
PostSharp.Patterns.Diagnostics.BackendsTextLoggingBackendOptions
PostSharp.Patterns.Diagnostics.Backends.ConsoleConsoleLoggingBackendOptions

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class ConsoleLoggingBackendOptions : TextLoggingBackendOptions

The ConsoleLoggingBackendOptions type exposes the following members.

Constructors
 | Name | Description
Public method | ConsoleLoggingBackendOptions | Initializes a new ConsoleLoggingBackendOptions.
Top
Properties
 | Name | Description
Public property | ActionMaxLength | Max length of a log record. The default value is 2048. (Inherited from TextLoggingBackendOptions.)
Public property | AppendTrailingPeriod | Determines whether log messages should be ended with a trailing period. The default value is true because we really like trailing periods at PostSharp, but other opinions are valid. (Inherited from TextLoggingBackendOptions.)
Public property | ContextMaxLength | Max length of the Description property. (Inherited from LoggingBackendOptions.)
Public property | Delimiter | String used to separate different parts of the logging record. The default value is a pipe surrounded by spaces ( | ). (Inherited from TextLoggingBackendOptions.)
Public property | IncludeExceptionDetails | Determines whether exception details (basically Exception.ToString) should be appended to the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeLevel | Determines whether the LogLevel should be written to the console. The default value is true.
Public property | IncludeNamespace | Determines whether the full namespace of types should be included in the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeRole | Determines whether the role should be written to the console. The default value is true.
Public property | IncludeTimestamp | Determines whether the current date and time should be written to the console. The default value is false.
Public property | IncludeType | Determines whether the name of the type of the logged method should be included in the log. The default value is true. (Inherited from TextLoggingBackendOptions.)
Public property | IndentSpaces | Number of spaces for each indentation level. The default value is 2. (Inherited from TextLoggingBackendOptions.)
Public property | LogLevelIgnoredForSystemRecords | Determines whether the Level property is ignored by the current back-end for auto-generated (i.e. non-manual) logging records. Some back-ends may not support overriding the level of records. (Inherited from LoggingBackendOptions.)
Public property | PreferSystemColors | When true, the console logger will not attempt to use VT ANSI codes to format the output.
Public property | RoleWidth | Minimal width of the role column. The default value is 6.
Public property | ShouldLogExceptionPredicate | Gets or sets a predicate that determines whether an exception should be logged. This predicate is evaluated only when the method entry is not logged. When the method entry is logged, exceptions are always logged. (Inherited from TextLoggingBackendOptions.)
Public property | Theme | Gets the color theme. A set of ready-made themes are exposed on the ConsoleThemes class.
Public property | TimestampFormat | Gets or sets the formatting string used to render a value of the DateTimeOffset type when the IncludeTimestamp property is set to true. The default value is null.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleLoggingBackendOptions Constructor

Initializes a new ConsoleLoggingBackendOptions.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ConsoleLoggingBackendOptions()
See Also

Reference

ConsoleLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleLoggingBackendOptions Properties

The ConsoleLoggingBackendOptions type exposes the following members.

Properties
 | Name | Description
Public property | ActionMaxLength | Max length of a log record. The default value is 2048. (Inherited from TextLoggingBackendOptions.)
Public property | AppendTrailingPeriod | Determines whether log messages should be ended with a trailing period. The default value is true because we really like trailing periods at PostSharp, but other opinions are valid. (Inherited from TextLoggingBackendOptions.)
Public property | ContextMaxLength | Max length of the Description property. (Inherited from LoggingBackendOptions.)
Public property | Delimiter | String used to separate different parts of the logging record. The default value is a pipe surrounded by spaces ( | ). (Inherited from TextLoggingBackendOptions.)
Public property | IncludeExceptionDetails | Determines whether exception details (basically Exception.ToString) should be appended to the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeLevel | Determines whether the LogLevel should be written to the console. The default value is true.
Public property | IncludeNamespace | Determines whether the full namespace of types should be included in the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeRole | Determines whether the role should be written to the console. The default value is true.
Public property | IncludeTimestamp | Determines whether the current date and time should be written to the console. The default value is false.
Public property | IncludeType | Determines whether the name of the type of the logged method should be included in the log. The default value is true. (Inherited from TextLoggingBackendOptions.)
Public property | IndentSpaces | Number of spaces for each indentation level. The default value is 2. (Inherited from TextLoggingBackendOptions.)
Public property | LogLevelIgnoredForSystemRecords | Determines whether the Level property is ignored by the current back-end for auto-generated (i.e. non-manual) logging records. Some back-ends may not support overriding the level of records. (Inherited from LoggingBackendOptions.)
Public property | PreferSystemColors | When true, the console logger will not attempt to use VT ANSI codes to format the output.
Public property | RoleWidth | Minimal width of the role column. The default value is 6.
Public property | ShouldLogExceptionPredicate | Gets or sets a predicate that determines whether an exception should be logged. This predicate is evaluated only when the method entry is not logged. When the method entry is logged, exceptions are always logged. (Inherited from TextLoggingBackendOptions.)
Public property | Theme | Gets the color theme. A set of ready-made themes are exposed on the ConsoleThemes class.
Public property | TimestampFormat | Gets or sets the formatting string used to render a value of the DateTimeOffset type when the IncludeTimestamp property is set to true. The default value is null.
Top
See Also

Reference

ConsoleLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleLoggingBackendOptions.IncludeLevel Property

ConsoleLoggingBackendOptionsIncludeLevel Property

Determines whether the LogLevel should be written to the console. The default value is true.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IncludeLevel { get; set; }

Property Value

Type: Boolean
See Also

Reference

ConsoleLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleLoggingBackendOptions.IncludeRole Property

ConsoleLoggingBackendOptionsIncludeRole Property

Determines whether the role should be written to the console. The default value is true.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IncludeRole { get; set; }

Property Value

Type: Boolean
See Also

Reference

ConsoleLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleLoggingBackendOptions.IncludeTimestamp Property

ConsoleLoggingBackendOptionsIncludeTimestamp Property

Determines whether the current date and time should be written to the console. The default value is false.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IncludeTimestamp { get; set; }

Property Value

Type: Boolean
See Also

Reference

ConsoleLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleLoggingBackendOptions.PreferSystemColors Property

ConsoleLoggingBackendOptionsPreferSystemColors Property

When true, the console logger will not attempt to use VT ANSI codes to format the output.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool PreferSystemColors { get; set; }

Property Value

Type: Boolean
See Also

Reference

ConsoleLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleLoggingBackendOptions.RoleWidth Property

ConsoleLoggingBackendOptionsRoleWidth Property

Minimal width of the role column. The default value is 6.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int RoleWidth { get; set; }

Property Value

Type: Int32
See Also

Reference

ConsoleLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleLoggingBackendOptions.Theme Property

ConsoleLoggingBackendOptionsTheme Property

Gets the color theme. A set of ready-made themes are exposed on the ConsoleThemes class.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IConsoleTheme Theme { get; set; }

Property Value

Type: IConsoleTheme
See Also

Reference

ConsoleLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace

Other Resources

Conceptual: Logging to the system console


ConsoleLoggingBackendOptions.TimestampFormat Property

ConsoleLoggingBackendOptionsTimestampFormat Property

Gets or sets the formatting string used to render a value of the DateTimeOffset type when the IncludeTimestamp property is set to true. The default value is null.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string TimestampFormat { get; set; }

Property Value

Type: String
See Also

Reference

ConsoleLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleLoggingTypeSource Class

The LoggingTypeSource for ConsoleLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
PostSharp.Patterns.DiagnosticsLoggingTypeSource
PostSharp.Patterns.Diagnostics.Backends.ConsoleConsoleLoggingTypeSource

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class ConsoleLoggingTypeSource : LoggingTypeSource

The ConsoleLoggingTypeSource type exposes the following members.

Constructors
 | Name | Description
Public method | ConsoleLoggingTypeSource | Initializes a new ConsoleLoggingTypeSource.
Top
Properties
 | Name | Description
Public property | Backend | Gets the parent LoggingBackend. (Inherited from LoggingNamespaceSource.)
Public property | DisplayFullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the DisplayFullName property does not include the arity, i.e. the full name of List<T> is System.Collections.Generic.List. (Inherited from LoggingNamespaceSource.)
Public property | DisplayName | Gets the last component of the name of the type or namespace, in the form that should be reported to the log. For generic types, the DisplayName property does not include the arity, i.e. the name of List<T> is List. (Inherited from LoggingNamespaceSource.)
Public property | FullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the FullName property includes the arity, i.e. the full name of List<T> is System.Collections.Generic.List`1. (Inherited from LoggingNamespaceSource.)
Public property | GenericParameterCount | Gets the number of generic parameters in SourceType. (Inherited from LoggingTypeSource.)
Public property | Level | Gets the minimal LogLevel for which logging is enabled for the current namespace or type. (Inherited from LoggingNamespaceSource.)
Public property | Name | Gets the last component of the name of the type or namespace. For instance, when FullName is PostSharp.Patterns.Diagnostics.LoggingBackend, Name is LoggingBackend. For generic types, the Name property includes the arity, i.e. the name of List<T> is List`1. (Inherited from LoggingNamespaceSource.)
Public property | Options | Gets the LoggingRoleConfiguration for the current role. This property is a shortcut to LoggingServices.Roles[this.Role]. (Inherited from LoggingTypeSource.)
Public property | Parent | Gets the parent LoggingNamespaceSource, or null if the current object represents the root namespace. (Inherited from LoggingNamespaceSource.)
Public property | Role | Gets the logging role for the current role. Typical values of this property are listed in the LoggingRoles class. (Inherited from LoggingNamespaceSource.)
Public property | SourceType | The type represented by the current LoggingTypeSource. (Inherited from LoggingTypeSource.)
Top
Methods
 | Name | Description
Protected method | IsBackendEnabled | Checks whether logging is enabled in the back-end for the given level. (Overrides LoggingTypeSourceIsBackendEnabled(LogLevel).)
Public method | IsEnabled | Determines whether logging is enabled for the given LogLevel. (Inherited from LoggingTypeSource.)
Public method | Refresh | Refreshes the logging level from the back-end from the current node and all children nodes. The back-end-defined logging level is cached for performance reasons. (Inherited from LoggingTypeSource.)
Public method | SetLevel | Sets the minimal LogLevel for which logging is enabled for the current namespace and type and all children namespaces and types. (Inherited from LoggingNamespaceSource.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleLoggingTypeSource Constructor

Initializes a new ConsoleLoggingTypeSource.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ConsoleLoggingTypeSource(
    LoggingNamespaceSource parent,
    Type type
)

Parameters

parent
Type: PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
The parent LoggingNamespaceSource.
type
Type: SystemType
The Type being logged.
See Also

Reference

ConsoleLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleLoggingTypeSource Properties

The ConsoleLoggingTypeSource type exposes the following members.

Properties
 | Name | Description
Public property | Backend | Gets the parent LoggingBackend. (Inherited from LoggingNamespaceSource.)
Public property | DisplayFullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the DisplayFullName property does not include the arity, i.e. the full name of List<T> is System.Collections.Generic.List. (Inherited from LoggingNamespaceSource.)
Public property | DisplayName | Gets the last component of the name of the type or namespace, in the form that should be reported to the log. For generic types, the DisplayName property does not include the arity, i.e. the name of List<T> is List. (Inherited from LoggingNamespaceSource.)
Public property | FullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the FullName property includes the arity, i.e. the full name of List<T> is System.Collections.Generic.List`1. (Inherited from LoggingNamespaceSource.)
Public property | GenericParameterCount | Gets the number of generic parameters in SourceType. (Inherited from LoggingTypeSource.)
Public property | Level | Gets the minimal LogLevel for which logging is enabled for the current namespace or type. (Inherited from LoggingNamespaceSource.)
Public property | Name | Gets the last component of the name of the type or namespace. For instance, when FullName is PostSharp.Patterns.Diagnostics.LoggingBackend, Name is LoggingBackend. For generic types, the Name property includes the arity, i.e. the name of List<T> is List`1. (Inherited from LoggingNamespaceSource.)
Public property | Options | Gets the LoggingRoleConfiguration for the current role. This property is a shortcut to LoggingServices.Roles[this.Role]. (Inherited from LoggingTypeSource.)
Public property | Parent | Gets the parent LoggingNamespaceSource, or null if the current object represents the root namespace. (Inherited from LoggingNamespaceSource.)
Public property | Role | Gets the logging role for the current role. Typical values of this property are listed in the LoggingRoles class. (Inherited from LoggingNamespaceSource.)
Public property | SourceType | The type represented by the current LoggingTypeSource. (Inherited from LoggingTypeSource.)
Top
See Also

Reference

ConsoleLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleLoggingTypeSource Methods

The ConsoleLoggingTypeSource type exposes the following members.

Methods
 | Name | Description
Protected method | IsBackendEnabled | Checks whether logging is enabled in the back-end for the given level. (Overrides LoggingTypeSourceIsBackendEnabled(LogLevel).)
Public method | IsEnabled | Determines whether logging is enabled for the given LogLevel. (Inherited from LoggingTypeSource.)
Public method | Refresh | Refreshes the logging level from the back-end from the current node and all children nodes. The back-end-defined logging level is cached for performance reasons. (Inherited from LoggingTypeSource.)
Public method | SetLevel | Sets the minimal LogLevel for which logging is enabled for the current namespace and type and all children namespaces and types. (Inherited from LoggingNamespaceSource.)
Top
See Also

Reference

ConsoleLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleLoggingTypeSource.IsBackendEnabled Method

ConsoleLoggingTypeSourceIsBackendEnabled Method

Checks whether logging is enabled in the back-end for the given level.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override bool IsBackendEnabled(
    LogLevel level
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel

Return Value

Type: Boolean
Remarks

The result of this method is cached. To invalidate the cache, call the Refresh method.

See Also

Reference

ConsoleLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


ConsoleLogRecordBuilder Class

The LogRecordBuilder for ConsoleLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.RecordBuildersLogRecordBuilder
PostSharp.Patterns.Diagnostics.RecordBuildersTextLogRecordBuilder
PostSharp.Patterns.Diagnostics.Backends.ConsoleConsoleLogRecordBuilder

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class ConsoleLogRecordBuilder : TextLogRecordBuilder

The ConsoleLogRecordBuilder type exposes the following members.

Constructors
 | Name | Description
Public method | ConsoleLogRecordBuilder | Initializes a new ConsoleLogRecordBuilder.
Top
Properties
 | Name | Description
Public property | Backend | Gets the parent back-end. (Inherited from TextLogRecordBuilder.)
Public property | BackendOptions | Gets the back-end options.
Protected property | Context | Gets the LoggingContext to which the record belongs. (Inherited from LogRecordBuilder.)
Public property | Exception | Gets the Exception for the current record, or null if no exception is associated to the current record. (Inherited from TextLogRecordBuilder.)
Public property | IsDisposed | (Inherited from LogRecordBuilder.)
Protected property | Level | Gets the LogLevel for the current record. (Inherited from TextLogRecordBuilder.)
Public property | MemberName | Gets the name of the method, property or field for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Options | Gets the LoggingOptions for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Profile | Gets the LoggingProfile for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | RecordKind | Gets the kind of the current record (e.g. MethodEntry or MethodException). (Inherited from LogRecordBuilder.)
Public property | SourceLineInfo | Gets the SourceLineInfo for the current record. (Inherited from TextLogRecordBuilder.)
Public property | SourceType | Gets the source Type of the current record. (Inherited from TextLogRecordBuilder.)
Protected property | StringBuilder | Gets the current UnsafeStringBuilder where everything is being appended. (Inherited from TextLogRecordBuilder.)
Protected property | ThreadContext | Gets the ThreadLoggingContext to which the current LogRecordBuilder belongs. (Inherited from LogRecordBuilder.)
Protected property | TypeSource | Gets the LoggingTypeSource for the current record. (Inherited from TextLogRecordBuilder.)
Top
Methods
 | Name | Description
Protected method | AppendAsyncInfo | Appends information about the async method to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendClosingParenthesisConditional | Appends a closing parenthesis to the current StringBuilder if required. (Inherited from TextLogRecordBuilder.)
Protected method | AppendComma | (Inherited from TextLogRecordBuilder.)
Protected method | AppendCommaConditional | Appends a comma to the current StringBuilder, unless this method is invoked for the first time for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription | Appends the context Description (or the TypeSource name, if the type of the context is not equal to the source type of the record) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription(LoggingContext) | (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiter | Appends a Delimiter to the current StringBuilder. (Overrides TextLogRecordBuilderAppendDelimiter.)
Protected method | AppendDelimiterConditional | Appends a Delimiter to the current StringBuilder if the RequireDelimiter method has been called previously. (Inherited from TextLogRecordBuilder.)
Protected method | AppendEpilogue | Appends the final part of log message to StringBuilder. This includes state machine number and execution time where relevant, but does not include exception details. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExceptionDetails | Appends exception details to StringBuilder if IncludeExceptionDetails is set. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTime | Appends the execution time to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTimeThreshold | Appends the execution time threshold to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendIndentString | Appends indentation for the given to StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendMemberName | Appends name of the member for the current record (including the declaring type name, subject to the IncludeType property) to the current StringBuilder, as well as an opening parenthesis. (Inherited from TextLogRecordBuilder.)
Protected method | AppendOpeningParenthesis | Appends an opening parenthesis to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendProlog | Appends the indent string, context description, and the record kind to the current StringBuilder. (Overrides TextLogRecordBuilderAppendProlog.)
Protected method | AppendRecordKind | Appends the LogRecordKind of the current record to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameter(SemanticParameterKind, String, String, String, Int32) | Appends a parameter of String type to the current StringBuilder. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Overrides TextLogRecordBuilderAppendSemanticParameter(SemanticParameterKind, String, String, String, Int32).)
Protected method | AppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Overrides TextLogRecordBuilderAppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32).)
Protected method | AppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Overrides TextLogRecordBuilderAppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32).)
Protected method | AppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSourceLineInfo | Appends source (file, line) information to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpaces | Appends a given number of spaces to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpecialChar | Appends a special Char (which may require escaping with specific back-ends) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTrailingPeriod | Appends a trailing period (.) to the current StringBuilder, respecting the AppendTrailingPeriod property. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTypeName | Appends the name of the TypeSource to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | BeginCustomRecord | Initializes the current LogRecordBuilder to emit a custom record. (Inherited from TextLogRecordBuilder.)
Public method | BeginRecord | Initializes the current LogRecordBuilder to emit a standard (i.e. non-custom) record for a given context and method. (Inherited from TextLogRecordBuilder.)
Protected method | BeginThemedText | Sets the theme item for the next characters appended to the StringBuilder.
Public method | Complete | Emits the record and resets the current LogRecordBuilder. This method invoked after all SetThisT(T), SetParameterT(Int32, String, ParameterKind, String, T) and similar methods have been called. (Inherited from LogRecordBuilder.)
Public method | Dispose | (Inherited from LogRecordBuilder.)
Protected method | EmitRecord | Emits the record. Invoked by the Complete method. (Overrides TextLogRecordBuilderEmitRecord.)
Protected method | EmitRecord(Boolean) | Emits the record and specifies whether exception details should be appended to the text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescription | Ends building the context Description and starts building the action text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescriptionConditional | Switches between building the context Description and the action text. If the EndContextDescriptionConditional method has been previously invoked, subsequent calls are ignored. (Inherited from TextLogRecordBuilder.)
Protected method | EndThemedText | Resets the current theme to Text.
Protected method | GetContextDescription | Obsolete. Gets the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescriptionUnsafe | Obsolete. Gets an UnsafeString representing the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextForDescription | Obsolete. Gets the LoggingContext that should be used when getting or appending the Description. (Inherited from TextLogRecordBuilder.)
Protected method | GetSourceName | Gets the name of the TypeSource for the current record, respecting the IncludeNamespace property. (Inherited from TextLogRecordBuilder.)
Protected method | HasRecordKindName | Determines whether the AppendRecordKind will append anything for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | MustBuildContextDescription | Determines whether the current Description should be appended to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | RequireComma | Makes the AppendCommaConditional to append a comma even if it's invoked for the first time. (Inherited from TextLogRecordBuilder.)
Protected method | RequireDelimiter | Causes the next call to the AppendDelimiterConditional to append a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | Reset | Resets all fields and properties of the current LogRecordBuilder to their initial value. Invoked by the Complete method. (Overrides TextLogRecordBuilderReset.)
Public method | SetException | Sets the exception for the method or activity. (Inherited from TextLogRecordBuilder.)
Public method | SetExecutionTime | Sets the method or activity execution time. (Inherited from TextLogRecordBuilder.)
Public method | SetMethodGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T) | Sets the value of a given parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from TextLogRecordBuilder.)
Public method | SetRefStructParameter | (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T) | Sets a given return value (there can be several return values in C# 7.0) and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetThisT(T) | Sets the this (instance) value and uses the default formatter. This method is only invoked if the IncludeThisValue property is true. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetTypeGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Protected method | ShouldLogExceptionDetails | Determines whether exception details should be appended to the text of the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | ToString | Returns a string that represents the current object. (Inherited from TextLogRecordBuilder.)
Protected method | Write | Write the current log record to the console.
Protected method | Write(UnsafeString) | Writes the final message to the back-end. (Overrides TextLogRecordBuilderWrite(UnsafeString).)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T) | Writes a custom parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | WriteCustomString | Write a chunk of custom string. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleLogRecordBuilder Constructor

Initializes a new ConsoleLogRecordBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ConsoleLogRecordBuilder(
    ConsoleLoggingBackend backend
)

Parameters

backend
Type: PostSharp.Patterns.Diagnostics.Backends.ConsoleConsoleLoggingBackend
The parent ConsoleLoggingBackend.
See Also

Reference

ConsoleLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleLogRecordBuilder Properties

The ConsoleLogRecordBuilder type exposes the following members.

Properties
 | Name | Description
Public property | Backend | Gets the parent back-end. (Inherited from TextLogRecordBuilder.)
Public property | BackendOptions | Gets the back-end options.
Protected property | Context | Gets the LoggingContext to which the record belongs. (Inherited from LogRecordBuilder.)
Public property | Exception | Gets the Exception for the current record, or null if no exception is associated to the current record. (Inherited from TextLogRecordBuilder.)
Public property | IsDisposed | (Inherited from LogRecordBuilder.)
Protected property | Level | Gets the LogLevel for the current record. (Inherited from TextLogRecordBuilder.)
Public property | MemberName | Gets the name of the method, property or field for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Options | Gets the LoggingOptions for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Profile | Gets the LoggingProfile for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | RecordKind | Gets the kind of the current record (e.g. MethodEntry or MethodException). (Inherited from LogRecordBuilder.)
Public property | SourceLineInfo | Gets the SourceLineInfo for the current record. (Inherited from TextLogRecordBuilder.)
Public property | SourceType | Gets the source Type of the current record. (Inherited from TextLogRecordBuilder.)
Protected property | StringBuilder | Gets the current UnsafeStringBuilder where everything is being appended. (Inherited from TextLogRecordBuilder.)
Protected property | ThreadContext | Gets the ThreadLoggingContext to which the current LogRecordBuilder belongs. (Inherited from LogRecordBuilder.)
Protected property | TypeSource | Gets the LoggingTypeSource for the current record. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

ConsoleLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleLogRecordBuilder.BackendOptions Property

ConsoleLogRecordBuilderBackendOptions Property

Gets the back-end options.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ConsoleLoggingBackendOptions BackendOptions { get; }

Property Value

Type: ConsoleLoggingBackendOptions
See Also

Reference

ConsoleLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleLogRecordBuilder Methods

The ConsoleLogRecordBuilder type exposes the following members.

Methods
 | Name | Description
Protected method | AppendAsyncInfo | Appends information about the async method to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendClosingParenthesisConditional | Appends a closing parenthesis to the current StringBuilder if required. (Inherited from TextLogRecordBuilder.)
Protected method | AppendComma | (Inherited from TextLogRecordBuilder.)
Protected method | AppendCommaConditional | Appends a comma to the current StringBuilder, unless this method is invoked for the first time for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription | Appends the context Description (or the TypeSource name, if the type of the context is not equal to the source type of the record) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription(LoggingContext) | (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiter | Appends a Delimiter to the current StringBuilder. (Overrides TextLogRecordBuilderAppendDelimiter.)
Protected method | AppendDelimiterConditional | Appends a Delimiter to the current StringBuilder if the RequireDelimiter method has been called previously. (Inherited from TextLogRecordBuilder.)
Protected method | AppendEpilogue | Appends the final part of log message to StringBuilder. This includes state machine number and execution time where relevant, but does not include exception details. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExceptionDetails | Appends exception details to StringBuilder if IncludeExceptionDetails is set. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTime | Appends the execution time to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTimeThreshold | Appends the execution time threshold to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendIndentString | Appends indentation for the given to StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendMemberName | Appends name of the member for the current record (including the declaring type name, subject to the IncludeType property) to the current StringBuilder, as well as an opening parenthesis. (Inherited from TextLogRecordBuilder.)
Protected method | AppendOpeningParenthesis | Appends an opening parenthesis to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendProlog | Appends the indent string, context description, and the record kind to the current StringBuilder. (Overrides TextLogRecordBuilderAppendProlog.)
Protected method | AppendRecordKind | Appends the LogRecordKind of the current record to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameter(SemanticParameterKind, String, String, String, Int32) | Appends a parameter of String type to the current StringBuilder. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Overrides TextLogRecordBuilderAppendSemanticParameter(SemanticParameterKind, String, String, String, Int32).)
Protected method | AppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Overrides TextLogRecordBuilderAppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32).)
Protected method | AppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Overrides TextLogRecordBuilderAppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32).)
Protected method | AppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSourceLineInfo | Appends source (file, line) information to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpaces | Appends a given number of spaces to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpecialChar | Appends a special Char (which may require escaping with specific back-ends) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTrailingPeriod | Appends a trailing period (.) to the current StringBuilder, respecting the AppendTrailingPeriod property. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTypeName | Appends the name of the TypeSource to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | BeginCustomRecord | Initializes the current LogRecordBuilder to emit a custom record. (Inherited from TextLogRecordBuilder.)
Public method | BeginRecord | Initializes the current LogRecordBuilder to emit a standard (i.e. non-custom) record for a given context and method. (Inherited from TextLogRecordBuilder.)
Protected method | BeginThemedText | Sets the theme item for the next characters appended to the StringBuilder.
Public method | Complete | Emits the record and resets the current LogRecordBuilder. This method invoked after all SetThisT(T), SetParameterT(Int32, String, ParameterKind, String, T) and similar methods have been called. (Inherited from LogRecordBuilder.)
Public method | Dispose | (Inherited from LogRecordBuilder.)
Protected method | EmitRecord | Emits the record. Invoked by the Complete method. (Overrides TextLogRecordBuilderEmitRecord.)
Protected method | EmitRecord(Boolean) | Emits the record and specifies whether exception details should be appended to the text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescription | Ends building the context Description and starts building the action text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescriptionConditional | Switches between building the context Description and the action text. If the EndContextDescriptionConditional method has been previously invoked, subsequent calls are ignored. (Inherited from TextLogRecordBuilder.)
Protected method | EndThemedText | Resets the current theme to Text.
Protected method | GetContextDescription | Obsolete. Gets the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescriptionUnsafe | Obsolete. Gets an UnsafeString representing the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextForDescription | Obsolete. Gets the LoggingContext that should be used when getting or appending the Description. (Inherited from TextLogRecordBuilder.)
Protected method | GetSourceName | Gets the name of the TypeSource for the current record, respecting the IncludeNamespace property. (Inherited from TextLogRecordBuilder.)
Protected method | HasRecordKindName | Determines whether the AppendRecordKind will append anything for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | MustBuildContextDescription | Determines whether the current Description should be appended to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | RequireComma | Makes the AppendCommaConditional to append a comma even if it's invoked for the first time. (Inherited from TextLogRecordBuilder.)
Protected method | RequireDelimiter | Causes the next call to the AppendDelimiterConditional to append a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | Reset | Resets all fields and properties of the current LogRecordBuilder to their initial value. Invoked by the Complete method. (Overrides TextLogRecordBuilderReset.)
Public method | SetException | Sets the exception for the method or activity. (Inherited from TextLogRecordBuilder.)
Public method | SetExecutionTime | Sets the method or activity execution time. (Inherited from TextLogRecordBuilder.)
Public method | SetMethodGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T) | Sets the value of a given parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from TextLogRecordBuilder.)
Public method | SetRefStructParameter | (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T) | Sets a given return value (there can be several return values in C# 7.0) and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetThisT(T) | Sets the this (instance) value and uses the default formatter. This method is only invoked if the IncludeThisValue property is true. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetTypeGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Protected method | ShouldLogExceptionDetails | Determines whether exception details should be appended to the text of the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | ToString | Returns a string that represents the current object. (Inherited from TextLogRecordBuilder.)
Protected method | Write | Write the current log record to the console.
Protected method | Write(UnsafeString) | Writes the final message to the back-end. (Overrides TextLogRecordBuilderWrite(UnsafeString).)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T) | Writes a custom parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | WriteCustomString | Write a chunk of custom string. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

ConsoleLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleLogRecordBuilder.AppendDelimiter Method

ConsoleLogRecordBuilderAppendDelimiter Method

Appends a Delimiter to the current StringBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void AppendDelimiter()
See Also

Reference

ConsoleLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleLogRecordBuilder.AppendProlog Method

ConsoleLogRecordBuilderAppendProlog Method

Appends the indent string, context description, and the record kind to the current StringBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void AppendProlog()
See Also

Reference

ConsoleLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleLogRecordBuilder.AppendSemanticParameter Method

ConsoleLogRecordBuilderAppendSemanticParameter Method

Overload List
 | Name | Description
Protected method | AppendSemanticParameter(SemanticParameterKind, String, String, String, Int32) | Appends a parameter of String type to the current StringBuilder. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Overrides TextLogRecordBuilderAppendSemanticParameter(SemanticParameterKind, String, String, String, Int32).)
Protected method | AppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Overrides TextLogRecordBuilderAppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32).)
Protected method | AppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Overrides TextLogRecordBuilderAppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32).)
Protected method | AppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

ConsoleLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleLogRecordBuilder.AppendSemanticParameter Method (SemanticParameterKind, String, String, String, Int32)

ConsoleLogRecordBuilderAppendSemanticParameter Method (SemanticParameterKind, String, String, String, Int32)

Appends a parameter of String type to the current StringBuilder. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void AppendSemanticParameter(
    SemanticParameterKind kind,
    string name,
    string value,
    string prefix,
    int index
)

Parameters

kind
Type: PostSharp.Patterns.Diagnostics.RecordBuildersSemanticParameterKind
Kind of semantic parameter.
name
Type: SystemString
Parameter name. The name parameter itself is not guaranteed to be unique in a given record. However, in combination with prefix and index, it is guaranteed to be unique.
value
Type: SystemString
Parameter value.
prefix
Type: SystemString
Prefix to be prepended to name, or null if there is no prefix.
index
Type: SystemInt32
Index of the parameter value, if there are several values for the same parameter name, or -1 if there is a single parameter value for this parameter name.
See Also

Reference

ConsoleLogRecordBuilder Class
AppendSemanticParameter Overload
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleLogRecordBuilder.AppendSemanticParameter(T) Method (SemanticParameterKind, ArraySegment(Char), T, IFormatter(T), String, Int32)

ConsoleLogRecordBuilderAppendSemanticParameterT Method (SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32)

Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void AppendSemanticParameter<T>(
    SemanticParameterKind kind,
    ArraySegment<char> name,
    T value,
    IFormatter<T> formatter,
    string prefix,
    int index = -1
)

Parameters

kind
Type: PostSharp.Patterns.Diagnostics.RecordBuildersSemanticParameterKind
Kind of semantic parameter.
name
Type: SystemArraySegment Char
Parameter name. The name parameter itself is not guaranteed to be unique in a given record. However, in combination with prefix and index, it is guaranteed to be unique.
value
Type: T
Parameter value.
formatter
Type: PostSharp.Patterns.FormattersIFormatter T
The formatter to be used to format value.
prefix
Type: SystemString
Prefix to be prepended to name, or null if there is no prefix.
index (Optional)
Type: SystemInt32
Index of the parameter value, if there are several values for the same parameter name, or -1 if there is a single parameter value for this parameter name.

Type Parameters

T
See Also

Reference

ConsoleLogRecordBuilder Class
AppendSemanticParameter Overload
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleLogRecordBuilder.AppendSemanticParameter(T) Method (SemanticParameterKind, String, T, IFormatter(T), String, Int32)

ConsoleLogRecordBuilderAppendSemanticParameterT Method (SemanticParameterKind, String, T, IFormatterT, String, Int32)

Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void AppendSemanticParameter<T>(
    SemanticParameterKind kind,
    string name,
    T value,
    IFormatter<T> formatter,
    string prefix,
    int index
)

Parameters

kind
Type: PostSharp.Patterns.Diagnostics.RecordBuildersSemanticParameterKind
Kind of semantic parameter.
name
Type: SystemString
Parameter name. The name parameter itself is not guaranteed to be unique in a given record. However, in combination with prefix and index, it is guaranteed to be unique.
value
Type: T
Parameter value.
formatter
Type: PostSharp.Patterns.FormattersIFormatter T
The formatter to be used to format value.
prefix
Type: SystemString
Prefix to be prepended to name, or null if there is no prefix.
index
Type: SystemInt32
Index of the parameter value, if there are several values for the same parameter name, or -1 if there is a single parameter value for this parameter name.

Type Parameters

T
See Also

Reference

ConsoleLogRecordBuilder Class
AppendSemanticParameter Overload
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleLogRecordBuilder.BeginThemedText Method

ConsoleLogRecordBuilderBeginThemedText Method

Sets the theme item for the next characters appended to the StringBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected void BeginThemedText(
    ConsoleThemeItem item
)

Parameters

item
Type: PostSharp.Patterns.Diagnostics.Backends.ConsoleConsoleThemeItem
Theme item.
See Also

Reference

ConsoleLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleLogRecordBuilder.EmitRecord Method

ConsoleLogRecordBuilderEmitRecord Method

Overload List
 | Name | Description
Protected method | EmitRecord | Emits the record. Invoked by the Complete method. (Overrides TextLogRecordBuilderEmitRecord.)
Protected method | EmitRecord(Boolean) | Emits the record and specifies whether exception details should be appended to the text. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

ConsoleLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleLogRecordBuilder.EmitRecord Method

ConsoleLogRecordBuilderEmitRecord Method

Emits the record. Invoked by the Complete method.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void EmitRecord()
See Also

Reference

ConsoleLogRecordBuilder Class
EmitRecord Overload
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleLogRecordBuilder.EndThemedText Method

ConsoleLogRecordBuilderEndThemedText Method

Resets the current theme to Text.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected void EndThemedText()
See Also

Reference

ConsoleLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleLogRecordBuilder.Reset Method

ConsoleLogRecordBuilderReset Method

Resets all fields and properties of the current LogRecordBuilder to their initial value. Invoked by the Complete method.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void Reset()
See Also

Reference

ConsoleLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleLogRecordBuilder.Write Method

ConsoleLogRecordBuilderWrite Method

Overload List
 | Name | Description
Protected method | Write | Write the current log record to the console.
Protected method | Write(UnsafeString) | Writes the final message to the back-end. (Overrides TextLogRecordBuilderWrite(UnsafeString).)
Top
See Also

Reference

ConsoleLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleLogRecordBuilder.Write Method

ConsoleLogRecordBuilderWrite Method

Write the current log record to the console.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void Write()
See Also

Reference

ConsoleLogRecordBuilder Class
Write Overload
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleLogRecordBuilder.Write Method (UnsafeString)

ConsoleLogRecordBuilderWrite Method (UnsafeString)

Writes the final message to the back-end.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override sealed void Write(
    UnsafeString message
)

Parameters

message
Type: PostSharp.Patterns.FormattersUnsafeString
The final message.
See Also

Reference

ConsoleLogRecordBuilder Class
Write Overload
PostSharp.Patterns.Diagnostics.Backends.Console Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


ConsoleTheme Class

A simple implementation of a color theme that allows only for two colors per LogLevel.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.Backends.ConsoleConsoleTheme

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class ConsoleTheme : IConsoleTheme

The ConsoleTheme type exposes the following members.

Constructors
 | Name | Description
Public method | ConsoleTheme(Boolean) | Initializes a new ConsoleTheme.
Public method | ConsoleTheme(ConsoleTheme) | Initializes a new ConsoleTheme and copies all values from a given other ConsoleTheme.
Top
Properties
 | Name | Description
Public property | HightlightedStyles | Gets the styles used for highlighted text.
Public property | NormalStyles | Gets the styles used for normal text.
Public property | SupportsAnsiCodes | Determines whether the theme supports VT escape codes.
Top
Methods
 | Name | Description
Public method | AddHightlightedItem | Specifies that a ConsoleThemeItem should be formatted using the hightlighted style.
Public method | Clone | Returns an editable copy of the current ConsoleTheme.
Public method | Freeze | Prevents modifications in the current ConsoleTheme.
Public method | GetStyle | Gets the ConsoleThemeStyle for a specific theme item.
Public method | RemoveHighlightedItem | Specifies that a ConsoleThemeItem should be formatted using the normal style.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Console Namespace

Other Resources

Conceptual: Logging to the system console


ConsoleTheme Constructor

Overload List
 | Name | Description
Public method | ConsoleTheme(Boolean) | Initializes a new ConsoleTheme.
Public method | ConsoleTheme(ConsoleTheme) | Initializes a new ConsoleTheme and copies all values from a given other ConsoleTheme.
Top
See Also

Reference

ConsoleTheme Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleTheme Constructor (Boolean)

Initializes a new ConsoleTheme.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ConsoleTheme(
    bool supportsAnsiCodes = true
)

Parameters

supportsAnsiCodes (Optional)
Type: SystemBoolean
Determines whether the theme supports VT ANSI codes.
See Also

Reference

ConsoleTheme Class
ConsoleTheme Overload
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleTheme Constructor (ConsoleTheme)

Initializes a new ConsoleTheme and copies all values from a given other ConsoleTheme.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ConsoleTheme(
    ConsoleTheme model
)

Parameters

model
Type: PostSharp.Patterns.Diagnostics.Backends.ConsoleConsoleTheme
The ConsoleTheme from which all values will be copied.
See Also

Reference

ConsoleTheme Class
ConsoleTheme Overload
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleTheme Properties

The ConsoleTheme type exposes the following members.

Properties
 | Name | Description
Public property | HightlightedStyles | Gets the styles used for highlighted text.
Public property | NormalStyles | Gets the styles used for normal text.
Public property | SupportsAnsiCodes | Determines whether the theme supports VT escape codes.
Top
See Also

Reference

ConsoleTheme Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleTheme.HightlightedStyles Property

ConsoleThemeHightlightedStyles Property

Gets the styles used for highlighted text.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogLevelArray<ConsoleThemeStyle> HightlightedStyles { get; }

Property Value

Type: LogLevelArray ConsoleThemeStyle
See Also

Reference

ConsoleTheme Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleTheme.NormalStyles Property

ConsoleThemeNormalStyles Property

Gets the styles used for normal text.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogLevelArray<ConsoleThemeStyle> NormalStyles { get; }

Property Value

Type: LogLevelArray ConsoleThemeStyle
See Also

Reference

ConsoleTheme Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleTheme.SupportsAnsiCodes Property

ConsoleThemeSupportsAnsiCodes Property

Determines whether the theme supports VT escape codes.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool SupportsAnsiCodes { get; }

Property Value

Type: Boolean

Implements

IConsoleThemeSupportsAnsiCodes
See Also

Reference

ConsoleTheme Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleTheme Methods

The ConsoleTheme type exposes the following members.

Methods
 | Name | Description
Public method | AddHightlightedItem | Specifies that a ConsoleThemeItem should be formatted using the hightlighted style.
Public method | Clone | Returns an editable copy of the current ConsoleTheme.
Public method | Freeze | Prevents modifications in the current ConsoleTheme.
Public method | GetStyle | Gets the ConsoleThemeStyle for a specific theme item.
Public method | RemoveHighlightedItem | Specifies that a ConsoleThemeItem should be formatted using the normal style.
Top
See Also

Reference

ConsoleTheme Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleTheme.AddHightlightedItem Method

ConsoleThemeAddHightlightedItem Method

Specifies that a ConsoleThemeItem should be formatted using the hightlighted style.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void AddHightlightedItem(
    ConsoleThemeItem item
)

Parameters

item
Type: PostSharp.Patterns.Diagnostics.Backends.ConsoleConsoleThemeItem
A ConsoleThemeItem.
See Also

Reference

ConsoleTheme Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleTheme.Clone Method

ConsoleThemeClone Method

Returns an editable copy of the current ConsoleTheme.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ConsoleTheme Clone()

Return Value

Type: ConsoleTheme
An editable copy of the current ConsoleTheme.
See Also

Reference

ConsoleTheme Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace

Other Resources

Conceptual: Logging to the system console


ConsoleTheme.Freeze Method

ConsoleThemeFreeze Method

Prevents modifications in the current ConsoleTheme.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Freeze()
See Also

Reference

ConsoleTheme Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleTheme.GetStyle Method

ConsoleThemeGetStyle Method

Gets the ConsoleThemeStyle for a specific theme item.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual ConsoleThemeStyle GetStyle(
    string role,
    LogLevel level,
    LogRecordKind kind,
    ConsoleThemeItem item
)

Parameters

role
Type: SystemString
Role of the log record.
level
Type: PostSharp.Patterns.DiagnosticsLogLevel
Level of the log record.
kind
Type: PostSharp.Patterns.DiagnosticsLogRecordKind
Kind of the log record.
item
Type: PostSharp.Patterns.Diagnostics.Backends.ConsoleConsoleThemeItem
Kind of item inside the log record.

Return Value

Type: ConsoleThemeStyle
A ConsoleThemeStyle.

Implements

IConsoleThemeGetStyle(String, LogLevel, LogRecordKind, ConsoleThemeItem)
See Also

Reference

ConsoleTheme Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace

Other Resources

Conceptual: Logging to the system console


ConsoleTheme.RemoveHighlightedItem Method

ConsoleThemeRemoveHighlightedItem Method

Specifies that a ConsoleThemeItem should be formatted using the normal style.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void RemoveHighlightedItem(
    ConsoleThemeItem item
)

Parameters

item
Type: PostSharp.Patterns.Diagnostics.Backends.ConsoleConsoleThemeItem
A ConsoleThemeItem.
See Also

Reference

ConsoleTheme Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleThemeItem Enumeration

Enumeration of item kinds that can be themed.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum ConsoleThemeItem
Members
Member name | Value | Description
None | 0 | None.
Text | 1 | Normal message text.
LevelTrace | 2 | The LogLevel, when it is equal to Trace.
LevelDebug | 3 | The LogLevel, when it is equal to Debug.
LevelInfo | 4 | The LogLevel, when it is equal to Info.
LevelWarning | 5 | The LogLevel, when it is equal to Warning.
LevelError | 6 | The LogLevel, when it is equal to Error.
LevelCritical | 7 | The LogLevel, when it is equal to Critical.
RecordKind | 8 | The LogLevel, when it is equal to Trace.
MemberName | 9 | The member name.
TypeName | 10 | The type name.
This | 11 | The value of the this parameter.
Exception | 12 | The exception type.
ParameterType | 13 | A parameter type.
ParameterName | 14 | A parameter name.
ParameterValue | 15 | A parameter value.
ReturnItemName | 16 | The name of a return item, if the method returns a tuple.
ReturnItemValue | 17 | The value of a return item, if the method returns a tuple.
ReturnValue | 18 | The return value.
CustomParameter | 19 | A parameter in a custom string.
SourceFile | 20 | The path of the source file.
SourceLine | 21 | The line of the source file.
Duration | 22 | The duration of the method execution.
AwaitedContextId | 23 | The id of the awaited context.
AwaitedType | 24 | The name of the type that returned the awaitable.
AwaitedMethod | 25 | The name of the method that returned the awaitable.
ContextId | 26 | The id of the current context.
Role | 27 | The role of the logging record.
Time | 28 | The current time.
OtherSemanticParameter | 29 | Another semantic parameter.
Delimiter | 30 | A delimiter (such as a comma).
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleThemes Class

A collection of color themes for use with the ConsoleLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.Backends.ConsoleConsoleThemes

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static class ConsoleThemes

The ConsoleThemes type exposes the following members.

Properties
Name | Description
Classic | The classic and default theme. Does not hightlight individual parameters.
Dark | The most readable theme for use on black background. Highlights parameter and return values.
None | No formatting.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Console Namespace

Other Resources

Conceptual: Logging to the system console


ConsoleThemes Properties

The ConsoleThemes type exposes the following members.

Properties
Name | Description
Classic | The classic and default theme. Does not hightlight individual parameters.
Dark | The most readable theme for use on black background. Highlights parameter and return values.
None | No formatting.
Top
See Also

Reference

ConsoleThemes Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleThemes.Classic Property

ConsoleThemesClassic Property

The classic and default theme. Does not hightlight individual parameters.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static IConsoleTheme Classic { get; }

Property Value

Type: IConsoleTheme
See Also

Reference

ConsoleThemes Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace

Other Resources

Conceptual: Logging to the system console


ConsoleThemes.Dark Property

ConsoleThemesDark Property

The most readable theme for use on black background. Highlights parameter and return values.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static ConsoleTheme Dark { get; }

Property Value

Type: ConsoleTheme
See Also

Reference

ConsoleThemes Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace

Other Resources

Conceptual: Logging to the system console


ConsoleThemes.None Property

ConsoleThemesNone Property

No formatting.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static IConsoleTheme None { get; }

Property Value

Type: IConsoleTheme
See Also

Reference

ConsoleThemes Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace

Other Resources

Conceptual: Logging to the system console


ConsoleThemeStyle Class

Represents a style in a console theme.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.Backends.ConsoleConsoleThemeStyle

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ConsoleThemeStyle

The ConsoleThemeStyle type exposes the following members.

Constructors
 | Name | Description
Public method | ConsoleThemeStyle | Initializes a new ConsoleThemeStyle.
Top
Properties
 | Name | Description
Public property | AnsiCode | Gets the VT ANSI code for the style.
Public property | BackgroundColor | Gets the background color (used as a fallback when the console does not support VT ANSI codes).
Public property | ForegroundColor | Gets the foreground color (used as a fallback when the console does not support VT ANSI codes).
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleThemeStyle Constructor

Initializes a new ConsoleThemeStyle.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ConsoleThemeStyle(
    string ansiCode,
    Nullable<ConsoleColor> foregroundColor,
    Nullable<ConsoleColor> backgroundColor = null
)

Parameters

ansiCode
Type: SystemString
The VT ANSI code for the style. This parameter can be null if the whole theme does not support VT ANSI codes.
foregroundColor
Type: SystemNullable ConsoleColor
The foreground color (used as a fallback when the console does not support VT ANSI codes).
backgroundColor (Optional)
Type: SystemNullable ConsoleColor
The background color (used as a fallback when the console does not support VT ANSI codes).
See Also

Reference

ConsoleThemeStyle Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleThemeStyle Properties

The ConsoleThemeStyle type exposes the following members.

Properties
 | Name | Description
Public property | AnsiCode | Gets the VT ANSI code for the style.
Public property | BackgroundColor | Gets the background color (used as a fallback when the console does not support VT ANSI codes).
Public property | ForegroundColor | Gets the foreground color (used as a fallback when the console does not support VT ANSI codes).
Top
See Also

Reference

ConsoleThemeStyle Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleThemeStyle.AnsiCode Property

ConsoleThemeStyleAnsiCode Property

Gets the VT ANSI code for the style.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string AnsiCode { get; }

Property Value

Type: String
Remarks

This property can return null if the whole theme does not support VT ANSI codes.

See Also

Reference

ConsoleThemeStyle Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleThemeStyle.BackgroundColor Property

ConsoleThemeStyleBackgroundColor Property

Gets the background color (used as a fallback when the console does not support VT ANSI codes).

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Nullable<ConsoleColor> BackgroundColor { get; }

Property Value

Type: Nullable ConsoleColor
See Also

Reference

ConsoleThemeStyle Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


ConsoleThemeStyle.ForegroundColor Property

ConsoleThemeStyleForegroundColor Property

Gets the foreground color (used as a fallback when the console does not support VT ANSI codes).

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Nullable<ConsoleColor> ForegroundColor { get; }

Property Value

Type: Nullable ConsoleColor
See Also

Reference

ConsoleThemeStyle Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


IConsoleTheme Interface

Exposes the semantics of a console color theme. A simple implementation is provided by the ConsoleTheme class, and ready-made themes are exposed on the ConsoleThemes class.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IConsoleTheme

The IConsoleTheme type exposes the following members.

Properties
 | Name | Description
Public property | SupportsAnsiCodes | Determines whether the theme supports VT escape codes.
Public property | SupportsThemeItems | Determines whether the theme supports differentiating the style according to the ConsoleThemeItem.
Top
Methods
 | Name | Description
Public method | GetStyle | Gets the ConsoleThemeStyle for a specific theme item.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Console Namespace

Other Resources

Conceptual: Logging to the system console


IConsoleTheme Properties

The IConsoleTheme type exposes the following members.

Properties
 | Name | Description
Public property | SupportsAnsiCodes | Determines whether the theme supports VT escape codes.
Public property | SupportsThemeItems | Determines whether the theme supports differentiating the style according to the ConsoleThemeItem.
Top
See Also

Reference

IConsoleTheme Interface
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


IConsoleTheme.SupportsAnsiCodes Property

IConsoleThemeSupportsAnsiCodes Property

Determines whether the theme supports VT escape codes.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
bool SupportsAnsiCodes { get; }

Property Value

Type: Boolean
See Also

Reference

IConsoleTheme Interface
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


IConsoleTheme.SupportsThemeItems Property

IConsoleThemeSupportsThemeItems Property

Determines whether the theme supports differentiating the style according to the ConsoleThemeItem.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
bool SupportsThemeItems { get; }

Property Value

Type: Boolean
See Also

Reference

IConsoleTheme Interface
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


IConsoleTheme Methods

The IConsoleTheme type exposes the following members.

Methods
 | Name | Description
Public method | GetStyle | Gets the ConsoleThemeStyle for a specific theme item.
Top
See Also

Reference

IConsoleTheme Interface
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


IConsoleTheme.GetStyle Method

IConsoleThemeGetStyle Method

Gets the ConsoleThemeStyle for a specific theme item.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
ConsoleThemeStyle GetStyle(
    string role,
    LogLevel level,
    LogRecordKind kind,
    ConsoleThemeItem item
)

Parameters

role
Type: SystemString
Role of the log record.
level
Type: PostSharp.Patterns.DiagnosticsLogLevel
Level of the log record.
kind
Type: PostSharp.Patterns.DiagnosticsLogRecordKind
Kind of the log record.
item
Type: PostSharp.Patterns.Diagnostics.Backends.ConsoleConsoleThemeItem
Kind of item inside the log record.

Return Value

Type: ConsoleThemeStyle
A ConsoleThemeStyle.
See Also

Reference

IConsoleTheme Interface
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


LogLevelArray(T) Class

LogLevelArrayT Class

A high-performance map of LogLevel to something else.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.Backends.ConsoleLogLevelArrayT

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class LogLevelArray<T>

Type Parameters

T

The LogLevelArrayT type exposes the following members.

Properties
 | Name | Description
Public property | Item | Gets or sets the value corresponding to a given LogLevel.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Console Namespace


LogLevelArray(T) Properties

LogLevelArrayT Properties

The LogLevelArrayT generic type exposes the following members.

Properties
 | Name | Description
Public property | Item | Gets or sets the value corresponding to a given LogLevel.
Top
See Also

Reference

LogLevelArrayT Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


LogLevelArray(T).Item Property

LogLevelArrayTItem Property

Gets or sets the value corresponding to a given LogLevel.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Console
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public T this[
    LogLevel level
] { get; set; }

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel
A LogLevel.

Return Value

Type: T
The value mapped to level.
See Also

Reference

LogLevelArrayT Class
PostSharp.Patterns.Diagnostics.Backends.Console Namespace


PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary Namespace

Classes
 | Class | Description
Public class | EnterpriseLibraryLoggingBackend | Logging back-end for Enterprise Library.
Public class | EnterpriseLibraryLoggingBackendOptions | Options for EnterpriseLibraryLoggingBackend.
Public class | EnterpriseLibraryLoggingTypeSource | LoggingTypeSource for EnterpriseLibraryLoggingBackend.
Public class | EnterpriseLibraryLogRecordBuilder | LogRecordBuilder for EnterpriseLibraryLoggingBackend.


EnterpriseLibraryLoggingBackend Class

Logging back-end for Enterprise Library.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingBackend
PostSharp.Patterns.Diagnostics.BackendsTextLoggingBackend
PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibraryEnterpriseLibraryLoggingBackend

Namespace: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary
Assembly: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary (in PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class EnterpriseLibraryLoggingBackend : TextLoggingBackend

The EnterpriseLibraryLoggingBackend type exposes the following members.

Constructors
Name Description
Public method EnterpriseLibraryLoggingBackend
Initializes a new EnterpriseLibraryLoggingBackend and uses
Copy
Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Writer
.
Public method EnterpriseLibraryLoggingBackend(LogWriter)
Initializes a new EnterpriseLibraryLoggingBackend and uses a specific LogWriter.
Top
Properties
 | Name | Description
Public property | CurrentContext | Gets the current LoggingContext. (Inherited from LoggingBackend.)
Public property | IsCorrupted | (Inherited from LoggingBackend.)
Public property | IsDisposed | Determines whether the current LoggingBackend has been disposed. (Inherited from LoggingBackend.)
Public property | IsEnabled | Determines whether the current LoggingBackend is currently enabled. This property has precedence over, and does not affect, the minimal log levels set through the SetLevel(LogLevel) method. (Inherited from LoggingBackend.)
Public property | LogWriter | Gets the target LogWriter.
Public property | Options | Gets the back-end options.
Top
Methods
 | Name | Description
Protected method | CreateAsyncCustomActivityContext | Creates a new AsyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateAsyncMethodContext | Creates a new AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Protected method | CreateEphemeralContext | Creates a new EphemeralLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateIteratorContext | Creates a new IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | CreateRecordBuilder | Creates a new LogRecordBuilder. (Overrides LoggingBackendCreateRecordBuilder.)
Protected method | CreateSyncCustomActivityContext | Creates a new SyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateSyncMethodContext | Creates a new SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Protected method | CreateThreadContext | Creates a new ThreadLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateTypeSource | Creates LoggingTypeSource for the given role and type. (Overrides LoggingBackendCreateTypeSource(LoggingNamespaceSource, Type).)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingBackend.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from TextLoggingBackend.)
Public method | GetAsyncContextOfTask | Gets the AsyncMethodLoggingContext associated with a Task. (Inherited from LoggingBackend.)
Protected method | GetBackendOptions | Gets the formatting and rendering options for the current LoggingBackend. (Inherited from TextLoggingBackend.)
Public method | GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace. (Inherited from LoggingBackend.)
Public method | GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type. (Inherited from LoggingBackend.)
Protected method | GetTextBackendOptions | Gets the options. (Overrides TextLoggingBackendGetTextBackendOptions.)
Public method | GetThreadContext | Returns the ThreadLoggingContext for the current Thread. (Inherited from LoggingBackend.)
Public method | OpenAsyncContext | Gets an AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Public method | OpenCustomActivityContext | Gets a LoggingContext for a custom activity (opened using OpenActivity(String) or OpenAsyncActivity(String)). (Inherited from LoggingBackend.)
Public method | OpenEphemeralContext | Gets an EphemeralLoggingContext for use in a given method. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record. (Inherited from LoggingBackend.)
Public method | OpenIteratorContext | Gets an IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | OpenSyncContext | Gets a SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary Namespace

Other Resources

Conceptual: Adding Detailed Logging to your Solution


EnterpriseLibraryLoggingBackend Constructor

Overload List
Name Description
Public method EnterpriseLibraryLoggingBackend
Initializes a new EnterpriseLibraryLoggingBackend and uses
Copy
Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Writer
.
Public method EnterpriseLibraryLoggingBackend(LogWriter)
Initializes a new EnterpriseLibraryLoggingBackend and uses a specific LogWriter.
Top
See Also

Reference

EnterpriseLibraryLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary Namespace


EnterpriseLibraryLoggingBackend Constructor

Initializes a new EnterpriseLibraryLoggingBackend and uses
Copy
Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Writer
.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary
Assembly: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary (in PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public EnterpriseLibraryLoggingBackend()
See Also

Reference

EnterpriseLibraryLoggingBackend Class
EnterpriseLibraryLoggingBackend Overload
PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary Namespace


EnterpriseLibraryLoggingBackend Constructor (LogWriter)

Initializes a new EnterpriseLibraryLoggingBackend and uses a specific LogWriter.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary
Assembly: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary (in PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public EnterpriseLibraryLoggingBackend(
    LogWriter logWriter
)

Parameters

logWriter
Type: LogWriter
The LogWriter that should be written into.
See Also

Reference

EnterpriseLibraryLoggingBackend Class
EnterpriseLibraryLoggingBackend Overload
PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary Namespace


EnterpriseLibraryLoggingBackend Properties

The EnterpriseLibraryLoggingBackend type exposes the following members.

Properties
 | Name | Description
Public property | CurrentContext | Gets the current LoggingContext. (Inherited from LoggingBackend.)
Public property | IsCorrupted | (Inherited from LoggingBackend.)
Public property | IsDisposed | Determines whether the current LoggingBackend has been disposed. (Inherited from LoggingBackend.)
Public property | IsEnabled | Determines whether the current LoggingBackend is currently enabled. This property has precedence over, and does not affect, the minimal log levels set through the SetLevel(LogLevel) method. (Inherited from LoggingBackend.)
Public property | LogWriter | Gets the target LogWriter.
Public property | Options | Gets the back-end options.
Top
See Also

Reference

EnterpriseLibraryLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary Namespace


EnterpriseLibraryLoggingBackend.LogWriter Property

EnterpriseLibraryLoggingBackendLogWriter Property

Gets the target LogWriter.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary
Assembly: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary (in PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogWriter LogWriter { get; }

Property Value

Type: LogWriter
See Also

Reference

EnterpriseLibraryLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary Namespace


EnterpriseLibraryLoggingBackend.Options Property

EnterpriseLibraryLoggingBackendOptions Property

Gets the back-end options.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary
Assembly: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary (in PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public EnterpriseLibraryLoggingBackendOptions Options { get; }

Property Value

Type: EnterpriseLibraryLoggingBackendOptions
See Also

Reference

EnterpriseLibraryLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary Namespace


EnterpriseLibraryLoggingBackend Methods

The EnterpriseLibraryLoggingBackend type exposes the following members.

Methods
 | Name | Description
Protected method | CreateAsyncCustomActivityContext | Creates a new AsyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateAsyncMethodContext | Creates a new AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Protected method | CreateEphemeralContext | Creates a new EphemeralLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateIteratorContext | Creates a new IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | CreateRecordBuilder | Creates a new LogRecordBuilder. (Overrides LoggingBackendCreateRecordBuilder.)
Protected method | CreateSyncCustomActivityContext | Creates a new SyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateSyncMethodContext | Creates a new SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Protected method | CreateThreadContext | Creates a new ThreadLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateTypeSource | Creates LoggingTypeSource for the given role and type. (Overrides LoggingBackendCreateTypeSource(LoggingNamespaceSource, Type).)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingBackend.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from TextLoggingBackend.)
Public method | GetAsyncContextOfTask | Gets the AsyncMethodLoggingContext associated with a Task. (Inherited from LoggingBackend.)
Protected method | GetBackendOptions | Gets the formatting and rendering options for the current LoggingBackend. (Inherited from TextLoggingBackend.)
Public method | GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace. (Inherited from LoggingBackend.)
Public method | GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type. (Inherited from LoggingBackend.)
Protected method | GetTextBackendOptions | Gets the options. (Overrides TextLoggingBackendGetTextBackendOptions.)
Public method | GetThreadContext | Returns the ThreadLoggingContext for the current Thread. (Inherited from LoggingBackend.)
Public method | OpenAsyncContext | Gets an AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Public method | OpenCustomActivityContext | Gets a LoggingContext for a custom activity (opened using OpenActivity(String) or OpenAsyncActivity(String)). (Inherited from LoggingBackend.)
Public method | OpenEphemeralContext | Gets an EphemeralLoggingContext for use in a given method. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record. (Inherited from LoggingBackend.)
Public method | OpenIteratorContext | Gets an IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | OpenSyncContext | Gets a SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Top
See Also

Reference

EnterpriseLibraryLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary Namespace


EnterpriseLibraryLoggingBackend.CreateRecordBuilder Method

EnterpriseLibraryLoggingBackendCreateRecordBuilder Method

Creates a new LogRecordBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary
Assembly: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary (in PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override LogRecordBuilder CreateRecordBuilder()

Return Value

Type: LogRecordBuilder
A new LogRecordBuilder.
See Also

Reference

EnterpriseLibraryLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


EnterpriseLibraryLoggingBackend.CreateTypeSource Method

EnterpriseLibraryLoggingBackendCreateTypeSource Method

Creates LoggingTypeSource for the given role and type.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary
Assembly: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary (in PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override LoggingTypeSource CreateTypeSource(
    LoggingNamespaceSource parent,
    Type type
)

Parameters

parent
Type: PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
type
Type: SystemType

Return Value

Type: LoggingTypeSource
See Also

Reference

EnterpriseLibraryLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


EnterpriseLibraryLoggingBackend.GetTextBackendOptions Method

EnterpriseLibraryLoggingBackendGetTextBackendOptions Method

Gets the options.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary
Assembly: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary (in PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override TextLoggingBackendOptions GetTextBackendOptions()

Return Value

Type: TextLoggingBackendOptions
See Also

Reference

EnterpriseLibraryLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


EnterpriseLibraryLoggingBackendOptions Class

Options for EnterpriseLibraryLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingBackendOptions
PostSharp.Patterns.Diagnostics.BackendsTextLoggingBackendOptions
PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibraryEnterpriseLibraryLoggingBackendOptions

Namespace: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary
Assembly: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary (in PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class EnterpriseLibraryLoggingBackendOptions : TextLoggingBackendOptions

The EnterpriseLibraryLoggingBackendOptions type exposes the following members.

Constructors
 | Name | Description
Public method | EnterpriseLibraryLoggingBackendOptions | Initializes a new instance of the EnterpriseLibraryLoggingBackendOptions class
Top
Properties
 | Name | Description
Public property | ActionMaxLength | Max length of a log record. The default value is 2048. (Inherited from TextLoggingBackendOptions.)
Public property | AppendTrailingPeriod | Determines whether log messages should be ended with a trailing period. The default value is true because we really like trailing periods at PostSharp, but other opinions are valid. (Inherited from TextLoggingBackendOptions.)
Public property | ContextMaxLength | Max length of the Description property. (Inherited from LoggingBackendOptions.)
Public property | Delimiter | String used to separate different parts of the logging record. The default value is a pipe surrounded by spaces ( | ). (Inherited from TextLoggingBackendOptions.)
Public property | GetCategories | Function that maps an EnterpriseLibraryLoggingTypeSource to a set of strings that will be assigned to the Categories property of log entries (see LogEntry). The default behavior is to invoke the GetCategories method, which returns the role, the name of the EnterpriseLibraryLoggingTypeSource type and the name of all parent LoggingNamespaceSource.
Public property | IncludeExceptionDetails | Determines whether exception details (basically Exception.ToString) should be appended to the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeNamespace | Determines whether the full namespace of types should be included in the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeType | Determines whether the name of the type of the logged method should be included in the log. The default value is true. (Inherited from TextLoggingBackendOptions.)
Public property | IndentSpaces | Number of spaces for each indentation level. The default value is 2. (Inherited from TextLoggingBackendOptions.)
Public property | LogLevelIgnoredForSystemRecords | Determines whether the Level property is ignored by the current back-end for auto-generated (i.e. non-manual) logging records. Some back-ends may not support overriding the level of records. (Inherited from LoggingBackendOptions.)
Public property | ShouldLogExceptionPredicate | Gets or sets a predicate that determines whether an exception should be logged. This predicate is evaluated only when the method entry is not logged. When the method entry is logged, exceptions are always logged. (Inherited from TextLoggingBackendOptions.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary Namespace


EnterpriseLibraryLoggingBackendOptions Constructor

Initializes a new instance of the EnterpriseLibraryLoggingBackendOptions class

Namespace: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary
Assembly: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary (in PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public EnterpriseLibraryLoggingBackendOptions()
See Also

Reference

EnterpriseLibraryLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary Namespace


EnterpriseLibraryLoggingBackendOptions Properties

The EnterpriseLibraryLoggingBackendOptions type exposes the following members.

Properties
 | Name | Description
Public property | ActionMaxLength | Max length of a log record. The default value is 2048. (Inherited from TextLoggingBackendOptions.)
Public property | AppendTrailingPeriod | Determines whether log messages should be ended with a trailing period. The default value is true because we really like trailing periods at PostSharp, but other opinions are valid. (Inherited from TextLoggingBackendOptions.)
Public property | ContextMaxLength | Max length of the Description property. (Inherited from LoggingBackendOptions.)
Public property | Delimiter | String used to separate different parts of the logging record. The default value is a pipe surrounded by spaces ( | ). (Inherited from TextLoggingBackendOptions.)
Public property | GetCategories | Function that maps an EnterpriseLibraryLoggingTypeSource to a set of strings that will be assigned to the Categories property of log entries (see LogEntry). The default behavior is to invoke the GetCategories method, which returns the role, the name of the EnterpriseLibraryLoggingTypeSource type and the name of all parent LoggingNamespaceSource.
Public property | IncludeExceptionDetails | Determines whether exception details (basically Exception.ToString) should be appended to the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeNamespace | Determines whether the full namespace of types should be included in the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeType | Determines whether the name of the type of the logged method should be included in the log. The default value is true. (Inherited from TextLoggingBackendOptions.)
Public property | IndentSpaces | Number of spaces for each indentation level. The default value is 2. (Inherited from TextLoggingBackendOptions.)
Public property | LogLevelIgnoredForSystemRecords | Determines whether the Level property is ignored by the current back-end for auto-generated (i.e. non-manual) logging records. Some back-ends may not support overriding the level of records. (Inherited from LoggingBackendOptions.)
Public property | ShouldLogExceptionPredicate | Gets or sets a predicate that determines whether an exception should be logged. This predicate is evaluated only when the method entry is not logged. When the method entry is logged, exceptions are always logged. (Inherited from TextLoggingBackendOptions.)
Top
See Also

Reference

EnterpriseLibraryLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary Namespace


EnterpriseLibraryLoggingBackendOptions.GetCategories Property

EnterpriseLibraryLoggingBackendOptionsGetCategories Property

Function that maps an EnterpriseLibraryLoggingTypeSource to a set of strings that will be assigned to the Categories property of log entries (see LogEntry). The default behavior is to invoke the GetCategories method, which returns the role, the name of the EnterpriseLibraryLoggingTypeSource type and the name of all parent LoggingNamespaceSource.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary
Assembly: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary (in PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Func<EnterpriseLibraryLoggingTypeSource, IEnumerable<string>> GetCategories { get; set; }

Property Value

Type: Func EnterpriseLibraryLoggingTypeSource, IEnumerable String
See Also

Reference

EnterpriseLibraryLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary Namespace


EnterpriseLibraryLoggingTypeSource Class

LoggingTypeSource for EnterpriseLibraryLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
PostSharp.Patterns.DiagnosticsLoggingTypeSource
PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibraryEnterpriseLibraryLoggingTypeSource

Namespace: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary
Assembly: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary (in PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class EnterpriseLibraryLoggingTypeSource : LoggingTypeSource

The EnterpriseLibraryLoggingTypeSource type exposes the following members.

Constructors
 | Name | Description
Public method | EnterpriseLibraryLoggingTypeSource | Initializes a new EnterpriseLibraryLoggingTypeSource.
Top
Properties
 | Name | Description
Public property | Backend | Gets the parent LoggingBackend. (Inherited from LoggingNamespaceSource.)
Public property | Categories | Gets or sets the collection that will be assigned to the Categories property of the LogEntry class. Unless the GetCategories option has been changed, this property caches the result of the GetCategories method.
Public property | DisplayFullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the DisplayFullName property does not include the arity, i.e. the full name of List<T> is System.Collections.Generic.List. (Inherited from LoggingNamespaceSource.)
Public property | DisplayName | Gets the last component of the name of the type or namespace, in the form that should be reported to the log. For generic types, the DisplayName property does not include the arity, i.e. the name of List<T> is List. (Inherited from LoggingNamespaceSource.)
Public property | FullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the FullName property includes the arity, i.e. the full name of List<T> is System.Collections.Generic.List`1. (Inherited from LoggingNamespaceSource.)
Public property | GenericParameterCount | Gets the number of generic parameters in SourceType. (Inherited from LoggingTypeSource.)
Public property | Level | Gets the minimal LogLevel for which logging is enabled for the current namespace or type. (Inherited from LoggingNamespaceSource.)
Public property | Name | Gets the last component of the name of the type or namespace. For instance, when FullName is PostSharp.Patterns.Diagnostics.LoggingBackend, Name is LoggingBackend. For generic types, the Name property includes the arity, i.e. the name of List<T> is List`1. (Inherited from LoggingNamespaceSource.)
Public property | Options | Gets the LoggingRoleConfiguration for the current role. This property is a shortcut to LoggingServices.Roles[this.Role]. (Inherited from LoggingTypeSource.)
Public property | Parent | Gets the parent LoggingNamespaceSource, or null if the current object represents the root namespace. (Inherited from LoggingNamespaceSource.)
Public property | Role | Gets the logging role for the current role. Typical values of this property are listed in the LoggingRoles class. (Inherited from LoggingNamespaceSource.)
Public property | SourceType | The type represented by the current LoggingTypeSource. (Inherited from LoggingTypeSource.)
Top
Methods
 | Name | Description
Public method | GetCategories | Returns a list of strings composed that are used to populate the Categories property, unless the GetCategories function has been overwritten. The default behavior of GetCategories is to return the current role, the full name of the current type, and the full name of all parent namespaces.
Protected method | IsBackendEnabled | Checks whether logging is enabled in the back-end for the given level. (Overrides LoggingTypeSourceIsBackendEnabled(LogLevel).)
Public method | IsEnabled | Determines whether logging is enabled for the given LogLevel. (Inherited from LoggingTypeSource.)
Public method | Refresh | Refreshes the logging level from the back-end from the current node and all children nodes. The back-end-defined logging level is cached for performance reasons. (Inherited from LoggingTypeSource.)
Public method | SetLevel | Sets the minimal LogLevel for which logging is enabled for the current namespace and type and all children namespaces and types. (Inherited from LoggingNamespaceSource.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary Namespace


EnterpriseLibraryLoggingTypeSource Constructor

Initializes a new EnterpriseLibraryLoggingTypeSource.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary
Assembly: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary (in PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public EnterpriseLibraryLoggingTypeSource(
    LoggingNamespaceSource parent,
    Type sourceType
)

Parameters

parent
Type: PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
The parent LoggingNamespaceSource.
sourceType
Type: SystemType
The source Type that will emit the records.
See Also

Reference

EnterpriseLibraryLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary Namespace


EnterpriseLibraryLoggingTypeSource Properties

The EnterpriseLibraryLoggingTypeSource type exposes the following members.

Properties
 | Name | Description
Public property | Backend | Gets the parent LoggingBackend. (Inherited from LoggingNamespaceSource.)
Public property | Categories | Gets or sets the collection that will be assigned to the Categories property of the LogEntry class. Unless the GetCategories option has been changed, this property caches the result of the GetCategories method.
Public property | DisplayFullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the DisplayFullName property does not include the arity, i.e. the full name of List<T> is System.Collections.Generic.List. (Inherited from LoggingNamespaceSource.)
Public property | DisplayName | Gets the last component of the name of the type or namespace, in the form that should be reported to the log. For generic types, the DisplayName property does not include the arity, i.e. the name of List<T> is List. (Inherited from LoggingNamespaceSource.)
Public property | FullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the FullName property includes the arity, i.e. the full name of List<T> is System.Collections.Generic.List`1. (Inherited from LoggingNamespaceSource.)
Public property | GenericParameterCount | Gets the number of generic parameters in SourceType. (Inherited from LoggingTypeSource.)
Public property | Level | Gets the minimal LogLevel for which logging is enabled for the current namespace or type. (Inherited from LoggingNamespaceSource.)
Public property | Name | Gets the last component of the name of the type or namespace. For instance, when FullName is PostSharp.Patterns.Diagnostics.LoggingBackend, Name is LoggingBackend. For generic types, the Name property includes the arity, i.e. the name of List<T> is List`1. (Inherited from LoggingNamespaceSource.)
Public property | Options | Gets the LoggingRoleConfiguration for the current role. This property is a shortcut to LoggingServices.Roles[this.Role]. (Inherited from LoggingTypeSource.)
Public property | Parent | Gets the parent LoggingNamespaceSource, or null if the current object represents the root namespace. (Inherited from LoggingNamespaceSource.)
Public property | Role | Gets the logging role for the current role. Typical values of this property are listed in the LoggingRoles class. (Inherited from LoggingNamespaceSource.)
Public property | SourceType | The type represented by the current LoggingTypeSource. (Inherited from LoggingTypeSource.)
Top
See Also

Reference

EnterpriseLibraryLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary Namespace


EnterpriseLibraryLoggingTypeSource.Categories Property

EnterpriseLibraryLoggingTypeSourceCategories Property

Gets or sets the collection that will be assigned to the Categories property of the LogEntry class. Unless the GetCategories option has been changed, this property caches the result of the GetCategories method.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary
Assembly: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary (in PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ReadOnlyCollection<string> Categories { get; }

Property Value

Type: ReadOnlyCollection String
See Also

Reference

EnterpriseLibraryLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary Namespace


EnterpriseLibraryLoggingTypeSource Methods

The EnterpriseLibraryLoggingTypeSource type exposes the following members.

Methods
 | Name | Description
Public method | GetCategories | Returns a list of strings composed that are used to populate the Categories property, unless the GetCategories function has been overwritten. The default behavior of GetCategories is to return the current role, the full name of the current type, and the full name of all parent namespaces.
Protected method | IsBackendEnabled | Checks whether logging is enabled in the back-end for the given level. (Overrides LoggingTypeSourceIsBackendEnabled(LogLevel).)
Public method | IsEnabled | Determines whether logging is enabled for the given LogLevel. (Inherited from LoggingTypeSource.)
Public method | Refresh | Refreshes the logging level from the back-end from the current node and all children nodes. The back-end-defined logging level is cached for performance reasons. (Inherited from LoggingTypeSource.)
Public method | SetLevel | Sets the minimal LogLevel for which logging is enabled for the current namespace and type and all children namespaces and types. (Inherited from LoggingNamespaceSource.)
Top
See Also

Reference

EnterpriseLibraryLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary Namespace


EnterpriseLibraryLoggingTypeSource.GetCategories Method

EnterpriseLibraryLoggingTypeSourceGetCategories Method

Returns a list of strings composed that are used to populate the Categories property, unless the GetCategories function has been overwritten. The default behavior of GetCategories is to return the current role, the full name of the current type, and the full name of all parent namespaces.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary
Assembly: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary (in PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual IEnumerable<string> GetCategories()

Return Value

Type: IEnumerable String
A list of categories, as described above.
See Also

Reference

EnterpriseLibraryLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary Namespace


EnterpriseLibraryLoggingTypeSource.IsBackendEnabled Method

EnterpriseLibraryLoggingTypeSourceIsBackendEnabled Method

Checks whether logging is enabled in the back-end for the given level.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary
Assembly: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary (in PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override bool IsBackendEnabled(
    LogLevel level
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel

Return Value

Type: Boolean
Remarks

The result of this method is cached. To invalidate the cache, call the Refresh method.

See Also

Reference

EnterpriseLibraryLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


EnterpriseLibraryLogRecordBuilder Class

LogRecordBuilder for EnterpriseLibraryLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.RecordBuildersLogRecordBuilder
PostSharp.Patterns.Diagnostics.RecordBuildersTextLogRecordBuilder
PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibraryEnterpriseLibraryLogRecordBuilder

Namespace: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary
Assembly: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary (in PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class EnterpriseLibraryLogRecordBuilder : TextLogRecordBuilder

The EnterpriseLibraryLogRecordBuilder type exposes the following members.

Constructors
 | Name | Description
Public method | EnterpriseLibraryLogRecordBuilder | Initializes a new EnterpriseLibraryLogRecordBuilder.
Top
Properties
 | Name | Description
Public property | Backend | Gets the parent back-end. (Inherited from TextLogRecordBuilder.)
Public property | BackendOptions | Shortcut for this.Backend.Options. (Inherited from TextLogRecordBuilder.)
Protected property | Context | Gets the LoggingContext to which the record belongs. (Inherited from LogRecordBuilder.)
Public property | Exception | Gets the Exception for the current record, or null if no exception is associated to the current record. (Inherited from TextLogRecordBuilder.)
Public property | IsDisposed | (Inherited from LogRecordBuilder.)
Protected property | Level | Gets the LogLevel for the current record. (Inherited from TextLogRecordBuilder.)
Public property | MemberName | Gets the name of the method, property or field for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Options | Gets the LoggingOptions for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Profile | Gets the LoggingProfile for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | RecordKind | Gets the kind of the current record (e.g. MethodEntry or MethodException). (Inherited from LogRecordBuilder.)
Public property | SourceLineInfo | Gets the SourceLineInfo for the current record. (Inherited from TextLogRecordBuilder.)
Public property | SourceType | Gets the source Type of the current record. (Inherited from TextLogRecordBuilder.)
Protected property | StringBuilder | Gets the current UnsafeStringBuilder where everything is being appended. (Inherited from TextLogRecordBuilder.)
Protected property | ThreadContext | Gets the ThreadLoggingContext to which the current LogRecordBuilder belongs. (Inherited from LogRecordBuilder.)
Protected property | TypeSource | Gets the LoggingTypeSource for the current record. (Inherited from TextLogRecordBuilder.)
Top
Methods
 | Name | Description
Protected method | AppendAsyncInfo | Appends information about the async method to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendClosingParenthesisConditional | Appends a closing parenthesis to the current StringBuilder if required. (Inherited from TextLogRecordBuilder.)
Protected method | AppendComma | (Inherited from TextLogRecordBuilder.)
Protected method | AppendCommaConditional | Appends a comma to the current StringBuilder, unless this method is invoked for the first time for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription | Appends the context Description (or the TypeSource name, if the type of the context is not equal to the source type of the record) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription(LoggingContext) | (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiter | Appends a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiterConditional | Appends a Delimiter to the current StringBuilder if the RequireDelimiter method has been called previously. (Inherited from TextLogRecordBuilder.)
Protected method | AppendEpilogue | Appends the final part of log message to StringBuilder. This includes state machine number and execution time where relevant, but does not include exception details. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExceptionDetails | Appends exception details to StringBuilder if IncludeExceptionDetails is set. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTime | Appends the execution time to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTimeThreshold | Appends the execution time threshold to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendIndentString | Appends indentation for the given to StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendMemberName | Appends name of the member for the current record (including the declaring type name, subject to the IncludeType property) to the current StringBuilder, as well as an opening parenthesis. (Inherited from TextLogRecordBuilder.)
Protected method | AppendOpeningParenthesis | Appends an opening parenthesis to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendProlog | Appends the indent string, context description, and the record kind to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendRecordKind | Appends the LogRecordKind of the current record to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameter(SemanticParameterKind, String, String, String, Int32) | Appends a parameter of String type to the current StringBuilder. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSourceLineInfo | Appends source (file, line) information to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpaces | Appends a given number of spaces to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpecialChar | Appends a special Char (which may require escaping with specific back-ends) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTrailingPeriod | Appends a trailing period (.) to the current StringBuilder, respecting the AppendTrailingPeriod property. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTypeName | Appends the name of the TypeSource to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | BeginCustomRecord | Initializes the current LogRecordBuilder to emit a custom record. (Inherited from TextLogRecordBuilder.)
Public method | BeginRecord | Initializes the current LogRecordBuilder to emit a standard (i.e. non-custom) record for a given context and method. (Inherited from TextLogRecordBuilder.)
Public method | Complete | Emits the record and resets the current LogRecordBuilder. This method invoked after all SetThisT(T), SetParameterT(Int32, String, ParameterKind, String, T) and similar methods have been called. (Inherited from LogRecordBuilder.)
Public method | Dispose | (Inherited from LogRecordBuilder.)
Protected method | EmitRecord | Emits the record. Invoked by the Complete method. (Overrides TextLogRecordBuilderEmitRecord.)
Protected method | EmitRecord(Boolean) | Emits the record and specifies whether exception details should be appended to the text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescription | Ends building the context Description and starts building the action text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescriptionConditional | Switches between building the context Description and the action text. If the EndContextDescriptionConditional method has been previously invoked, subsequent calls are ignored. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescription | Obsolete. Gets the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescriptionUnsafe | Obsolete. Gets an UnsafeString representing the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextForDescription | Obsolete. Gets the LoggingContext that should be used when getting or appending the Description. (Inherited from TextLogRecordBuilder.)
Protected method | GetSourceName | Gets the name of the TypeSource for the current record, respecting the IncludeNamespace property. (Inherited from TextLogRecordBuilder.)
Protected method | HasRecordKindName | Determines whether the AppendRecordKind will append anything for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | MustBuildContextDescription | Determines whether the current Description should be appended to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | RequireComma | Makes the AppendCommaConditional to append a comma even if it's invoked for the first time. (Inherited from TextLogRecordBuilder.)
Protected method | RequireDelimiter | Causes the next call to the AppendDelimiterConditional to append a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | Reset | Resets all fields and properties of the current LogRecordBuilder to their initial value. Invoked by the Complete method. (Inherited from TextLogRecordBuilder.)
Public method | SetException | Sets the exception for the method or activity. (Inherited from TextLogRecordBuilder.)
Public method | SetExecutionTime | Sets the method or activity execution time. (Inherited from TextLogRecordBuilder.)
Public method | SetMethodGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T) | Sets the value of a given parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from TextLogRecordBuilder.)
Public method | SetRefStructParameter | (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T) | Sets a given return value (there can be several return values in C# 7.0) and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetThisT(T) | Sets the this (instance) value and uses the default formatter. This method is only invoked if the IncludeThisValue property is true. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetTypeGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Protected method | ShouldLogExceptionDetails | Determines whether exception details should be appended to the text of the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | ToString | Returns a string that represents the current object. (Inherited from TextLogRecordBuilder.)
Protected method | Write | Writes the final message to the back-end. (Overrides TextLogRecordBuilderWrite(UnsafeString).)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T) | Writes a custom parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | WriteCustomString | Write a chunk of custom string. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary Namespace


EnterpriseLibraryLogRecordBuilder Constructor

Initializes a new EnterpriseLibraryLogRecordBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary
Assembly: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary (in PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public EnterpriseLibraryLogRecordBuilder(
    EnterpriseLibraryLoggingBackend backend
)

Parameters

backend
Type: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibraryEnterpriseLibraryLoggingBackend
The parent EnterpriseLibraryLoggingBackend.
See Also

Reference

EnterpriseLibraryLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary Namespace


EnterpriseLibraryLogRecordBuilder Properties

The EnterpriseLibraryLogRecordBuilder type exposes the following members.

Properties
 | Name | Description
Public property | Backend | Gets the parent back-end. (Inherited from TextLogRecordBuilder.)
Public property | BackendOptions | Shortcut for this.Backend.Options. (Inherited from TextLogRecordBuilder.)
Protected property | Context | Gets the LoggingContext to which the record belongs. (Inherited from LogRecordBuilder.)
Public property | Exception | Gets the Exception for the current record, or null if no exception is associated to the current record. (Inherited from TextLogRecordBuilder.)
Public property | IsDisposed | (Inherited from LogRecordBuilder.)
Protected property | Level | Gets the LogLevel for the current record. (Inherited from TextLogRecordBuilder.)
Public property | MemberName | Gets the name of the method, property or field for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Options | Gets the LoggingOptions for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Profile | Gets the LoggingProfile for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | RecordKind | Gets the kind of the current record (e.g. MethodEntry or MethodException). (Inherited from LogRecordBuilder.)
Public property | SourceLineInfo | Gets the SourceLineInfo for the current record. (Inherited from TextLogRecordBuilder.)
Public property | SourceType | Gets the source Type of the current record. (Inherited from TextLogRecordBuilder.)
Protected property | StringBuilder | Gets the current UnsafeStringBuilder where everything is being appended. (Inherited from TextLogRecordBuilder.)
Protected property | ThreadContext | Gets the ThreadLoggingContext to which the current LogRecordBuilder belongs. (Inherited from LogRecordBuilder.)
Protected property | TypeSource | Gets the LoggingTypeSource for the current record. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

EnterpriseLibraryLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary Namespace


EnterpriseLibraryLogRecordBuilder Methods

The EnterpriseLibraryLogRecordBuilder type exposes the following members.

Methods
 | Name | Description
Protected method | AppendAsyncInfo | Appends information about the async method to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendClosingParenthesisConditional | Appends a closing parenthesis to the current StringBuilder if required. (Inherited from TextLogRecordBuilder.)
Protected method | AppendComma | (Inherited from TextLogRecordBuilder.)
Protected method | AppendCommaConditional | Appends a comma to the current StringBuilder, unless this method is invoked for the first time for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription | Appends the context Description (or the TypeSource name, if the type of the context is not equal to the source type of the record) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription(LoggingContext) | (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiter | Appends a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiterConditional | Appends a Delimiter to the current StringBuilder if the RequireDelimiter method has been called previously. (Inherited from TextLogRecordBuilder.)
Protected method | AppendEpilogue | Appends the final part of log message to StringBuilder. This includes state machine number and execution time where relevant, but does not include exception details. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExceptionDetails | Appends exception details to StringBuilder if IncludeExceptionDetails is set. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTime | Appends the execution time to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTimeThreshold | Appends the execution time threshold to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendIndentString | Appends indentation for the given to StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendMemberName | Appends name of the member for the current record (including the declaring type name, subject to the IncludeType property) to the current StringBuilder, as well as an opening parenthesis. (Inherited from TextLogRecordBuilder.)
Protected method | AppendOpeningParenthesis | Appends an opening parenthesis to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendProlog | Appends the indent string, context description, and the record kind to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendRecordKind | Appends the LogRecordKind of the current record to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameter(SemanticParameterKind, String, String, String, Int32) | Appends a parameter of String type to the current StringBuilder. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSourceLineInfo | Appends source (file, line) information to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpaces | Appends a given number of spaces to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpecialChar | Appends a special Char (which may require escaping with specific back-ends) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTrailingPeriod | Appends a trailing period (.) to the current StringBuilder, respecting the AppendTrailingPeriod property. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTypeName | Appends the name of the TypeSource to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | BeginCustomRecord | Initializes the current LogRecordBuilder to emit a custom record. (Inherited from TextLogRecordBuilder.)
Public method | BeginRecord | Initializes the current LogRecordBuilder to emit a standard (i.e. non-custom) record for a given context and method. (Inherited from TextLogRecordBuilder.)
Public method | Complete | Emits the record and resets the current LogRecordBuilder. This method invoked after all SetThisT(T), SetParameterT(Int32, String, ParameterKind, String, T) and similar methods have been called. (Inherited from LogRecordBuilder.)
Public method | Dispose | (Inherited from LogRecordBuilder.)
Protected method | EmitRecord | Emits the record. Invoked by the Complete method. (Overrides TextLogRecordBuilderEmitRecord.)
Protected method | EmitRecord(Boolean) | Emits the record and specifies whether exception details should be appended to the text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescription | Ends building the context Description and starts building the action text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescriptionConditional | Switches between building the context Description and the action text. If the EndContextDescriptionConditional method has been previously invoked, subsequent calls are ignored. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescription | Obsolete. Gets the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescriptionUnsafe | Obsolete. Gets an UnsafeString representing the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextForDescription | Obsolete. Gets the LoggingContext that should be used when getting or appending the Description. (Inherited from TextLogRecordBuilder.)
Protected method | GetSourceName | Gets the name of the TypeSource for the current record, respecting the IncludeNamespace property. (Inherited from TextLogRecordBuilder.)
Protected method | HasRecordKindName | Determines whether the AppendRecordKind will append anything for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | MustBuildContextDescription | Determines whether the current Description should be appended to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | RequireComma | Makes the AppendCommaConditional to append a comma even if it's invoked for the first time. (Inherited from TextLogRecordBuilder.)
Protected method | RequireDelimiter | Causes the next call to the AppendDelimiterConditional to append a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | Reset | Resets all fields and properties of the current LogRecordBuilder to their initial value. Invoked by the Complete method. (Inherited from TextLogRecordBuilder.)
Public method | SetException | Sets the exception for the method or activity. (Inherited from TextLogRecordBuilder.)
Public method | SetExecutionTime | Sets the method or activity execution time. (Inherited from TextLogRecordBuilder.)
Public method | SetMethodGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T) | Sets the value of a given parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from TextLogRecordBuilder.)
Public method | SetRefStructParameter | (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T) | Sets a given return value (there can be several return values in C# 7.0) and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetThisT(T) | Sets the this (instance) value and uses the default formatter. This method is only invoked if the IncludeThisValue property is true. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetTypeGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Protected method | ShouldLogExceptionDetails | Determines whether exception details should be appended to the text of the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | ToString | Returns a string that represents the current object. (Inherited from TextLogRecordBuilder.)
Protected method | Write | Writes the final message to the back-end. (Overrides TextLogRecordBuilderWrite(UnsafeString).)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T) | Writes a custom parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | WriteCustomString | Write a chunk of custom string. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

EnterpriseLibraryLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary Namespace


EnterpriseLibraryLogRecordBuilder.EmitRecord Method

EnterpriseLibraryLogRecordBuilderEmitRecord Method

Overload List
 | Name | Description
Protected method | EmitRecord | Emits the record. Invoked by the Complete method. (Overrides TextLogRecordBuilderEmitRecord.)
Protected method | EmitRecord(Boolean) | Emits the record and specifies whether exception details should be appended to the text. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

EnterpriseLibraryLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary Namespace


EnterpriseLibraryLogRecordBuilder.EmitRecord Method

EnterpriseLibraryLogRecordBuilderEmitRecord Method

Emits the record. Invoked by the Complete method.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary
Assembly: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary (in PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void EmitRecord()
See Also

Reference

EnterpriseLibraryLogRecordBuilder Class
EmitRecord Overload
PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary Namespace


EnterpriseLibraryLogRecordBuilder.Write Method

EnterpriseLibraryLogRecordBuilderWrite Method

Writes the final message to the back-end.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary
Assembly: PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary (in PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void Write(
    UnsafeString message
)

Parameters

message
Type: PostSharp.Patterns.FormattersUnsafeString
The final message.
See Also

Reference

EnterpriseLibraryLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibrary Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace

Classes
 | Class | Description
Public class | EventSourceLoggingBackend | Logging back-end that uses EventSource.
Public class | EventSourceLoggingBackendOptions | Options for EventSourceLoggingBackend.
Public class | EventSourceLoggingTypeSource | The LoggingTypeSource for EventSourceLoggingBackend.
Public class | EventSourceLogRecordBuilder | The LogRecordBuilder for EventSourceLoggingBackend.
Public class | PostSharpEventSource | The PostSharp.Patterns.Diagnostics.Backends.EventSource targeted by EventSourceLoggingBackend.
Public class | PostSharpEventSourceEventIds | Defines the event ids.
Public class | PostSharpEventSourceTasks | Defines the task ids (a task groups several messages).


EventSourceLoggingBackend Class

Logging back-end that uses EventSource.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingBackend
PostSharp.Patterns.Diagnostics.BackendsTextLoggingBackend
PostSharp.Patterns.Diagnostics.Backends.EventSourceEventSourceLoggingBackend

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class EventSourceLoggingBackend : TextLoggingBackend

The EventSourceLoggingBackend type exposes the following members.

Constructors
 | Name | Description
Public method | EventSourceLoggingBackend | Initializes a new EventSourceLoggingBackend with the default event source.
Public method | EventSourceLoggingBackend(PostSharpEventSource) | Initializes a new EventSourceLoggingBackend and specifies a custom PostSharpEventSource.
Top
Properties
 | Name | Description
Public property | CurrentContext | Gets the current LoggingContext. (Inherited from LoggingBackend.)
Public property | EventSource | The EventSource to which events will be written.
Public property | IsCorrupted | (Inherited from LoggingBackend.)
Public property | IsDisposed | Determines whether the current LoggingBackend has been disposed. (Inherited from LoggingBackend.)
Public property | IsEnabled | Determines whether the current LoggingBackend is currently enabled. This property has precedence over, and does not affect, the minimal log levels set through the SetLevel(LogLevel) method. (Inherited from LoggingBackend.)
Public property | Options | Gets the back-end options.
Top
Methods
 | Name | Description
Protected method | CreateAsyncCustomActivityContext | Creates a new AsyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateAsyncMethodContext | Creates a new AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Protected method | CreateEphemeralContext | Creates a new EphemeralLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateIteratorContext | Creates a new IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | CreateRecordBuilder | Creates a new LogRecordBuilder. (Overrides LoggingBackendCreateRecordBuilder.)
Protected method | CreateSyncCustomActivityContext | Creates a new SyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateSyncMethodContext | Creates a new SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Protected method | CreateThreadContext | Creates a new ThreadLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateTypeSource | Creates LoggingTypeSource for the given role and type. (Overrides LoggingBackendCreateTypeSource(LoggingNamespaceSource, Type).)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingBackend.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from TextLoggingBackend.)
Public method | GetAsyncContextOfTask | Gets the AsyncMethodLoggingContext associated with a Task. (Inherited from LoggingBackend.)
Protected method | GetBackendOptions | Gets the formatting and rendering options for the current LoggingBackend. (Inherited from TextLoggingBackend.)
Public method | GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace. (Inherited from LoggingBackend.)
Public method | GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type. (Inherited from LoggingBackend.)
Protected method | GetTextBackendOptions | Gets the options. (Overrides TextLoggingBackendGetTextBackendOptions.)
Public method | GetThreadContext | Returns the ThreadLoggingContext for the current Thread. (Inherited from LoggingBackend.)
Public method | OpenAsyncContext | Gets an AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Public method | OpenCustomActivityContext | Gets a LoggingContext for a custom activity (opened using OpenActivity(String) or OpenAsyncActivity(String)). (Inherited from LoggingBackend.)
Public method | OpenEphemeralContext | Gets an EphemeralLoggingContext for use in a given method. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record. (Inherited from LoggingBackend.)
Public method | OpenIteratorContext | Gets an IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | OpenSyncContext | Gets a SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Top
Remarks
Can be used with ETW or Enterprise Library Semantic Logging.
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace

Other Resources

Conceptual: Adding Detailed Logging to your Solution
Conceptual: Logging to ETW


EventSourceLoggingBackend Constructor

Overload List
 | Name | Description
Public method | EventSourceLoggingBackend | Initializes a new EventSourceLoggingBackend with the default event source.
Public method | EventSourceLoggingBackend(PostSharpEventSource) | Initializes a new EventSourceLoggingBackend and specifies a custom PostSharpEventSource.
Top
See Also

Reference

EventSourceLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


EventSourceLoggingBackend Constructor

Initializes a new EventSourceLoggingBackend with the default event source.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public EventSourceLoggingBackend()
See Also

Reference

EventSourceLoggingBackend Class
EventSourceLoggingBackend Overload
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


EventSourceLoggingBackend Constructor (PostSharpEventSource)

Initializes a new EventSourceLoggingBackend and specifies a custom PostSharpEventSource.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public EventSourceLoggingBackend(
    PostSharpEventSource eventSource
)

Parameters

eventSource
Type: PostSharp.Patterns.Diagnostics.Backends.EventSourcePostSharpEventSource
The EventSource to which events will be written.
See Also

Reference

EventSourceLoggingBackend Class
EventSourceLoggingBackend Overload
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


EventSourceLoggingBackend Properties

The EventSourceLoggingBackend type exposes the following members.

Properties
 | Name | Description
Public property | CurrentContext | Gets the current LoggingContext. (Inherited from LoggingBackend.)
Public property | EventSource | The EventSource to which events will be written.
Public property | IsCorrupted | (Inherited from LoggingBackend.)
Public property | IsDisposed | Determines whether the current LoggingBackend has been disposed. (Inherited from LoggingBackend.)
Public property | IsEnabled | Determines whether the current LoggingBackend is currently enabled. This property has precedence over, and does not affect, the minimal log levels set through the SetLevel(LogLevel) method. (Inherited from LoggingBackend.)
Public property | Options | Gets the back-end options.
Top
See Also

Reference

EventSourceLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


EventSourceLoggingBackend.EventSource Property

EventSourceLoggingBackendEventSource Property

The EventSource to which events will be written.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public PostSharpEventSource EventSource { get; }

Property Value

Type: PostSharpEventSource
See Also

Reference

EventSourceLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


EventSourceLoggingBackend.Options Property

EventSourceLoggingBackendOptions Property

Gets the back-end options.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public EventSourceLoggingBackendOptions Options { get; }

Property Value

Type: EventSourceLoggingBackendOptions
See Also

Reference

EventSourceLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


EventSourceLoggingBackend Methods

The EventSourceLoggingBackend type exposes the following members.

Methods
 | Name | Description
Protected method | CreateAsyncCustomActivityContext | Creates a new AsyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateAsyncMethodContext | Creates a new AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Protected method | CreateEphemeralContext | Creates a new EphemeralLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateIteratorContext | Creates a new IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | CreateRecordBuilder | Creates a new LogRecordBuilder. (Overrides LoggingBackendCreateRecordBuilder.)
Protected method | CreateSyncCustomActivityContext | Creates a new SyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateSyncMethodContext | Creates a new SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Protected method | CreateThreadContext | Creates a new ThreadLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateTypeSource | Creates LoggingTypeSource for the given role and type. (Overrides LoggingBackendCreateTypeSource(LoggingNamespaceSource, Type).)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingBackend.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from TextLoggingBackend.)
Public method | GetAsyncContextOfTask | Gets the AsyncMethodLoggingContext associated with a Task. (Inherited from LoggingBackend.)
Protected method | GetBackendOptions | Gets the formatting and rendering options for the current LoggingBackend. (Inherited from TextLoggingBackend.)
Public method | GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace. (Inherited from LoggingBackend.)
Public method | GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type. (Inherited from LoggingBackend.)
Protected method | GetTextBackendOptions | Gets the options. (Overrides TextLoggingBackendGetTextBackendOptions.)
Public method | GetThreadContext | Returns the ThreadLoggingContext for the current Thread. (Inherited from LoggingBackend.)
Public method | OpenAsyncContext | Gets an AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Public method | OpenCustomActivityContext | Gets a LoggingContext for a custom activity (opened using OpenActivity(String) or OpenAsyncActivity(String)). (Inherited from LoggingBackend.)
Public method | OpenEphemeralContext | Gets an EphemeralLoggingContext for use in a given method. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record. (Inherited from LoggingBackend.)
Public method | OpenIteratorContext | Gets an IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | OpenSyncContext | Gets a SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Top
See Also

Reference

EventSourceLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


EventSourceLoggingBackend.CreateRecordBuilder Method

EventSourceLoggingBackendCreateRecordBuilder Method

Creates a new LogRecordBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override LogRecordBuilder CreateRecordBuilder()

Return Value

Type: LogRecordBuilder
A new LogRecordBuilder.
See Also

Reference

EventSourceLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


EventSourceLoggingBackend.CreateTypeSource Method

EventSourceLoggingBackendCreateTypeSource Method

Creates LoggingTypeSource for the given role and type.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override LoggingTypeSource CreateTypeSource(
    LoggingNamespaceSource parent,
    Type type
)

Parameters

parent
Type: PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
type
Type: SystemType

Return Value

Type: LoggingTypeSource
See Also

Reference

EventSourceLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


EventSourceLoggingBackend.GetTextBackendOptions Method

EventSourceLoggingBackendGetTextBackendOptions Method

Gets the options.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override TextLoggingBackendOptions GetTextBackendOptions()

Return Value

Type: TextLoggingBackendOptions
See Also

Reference

EventSourceLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


EventSourceLoggingBackendOptions Class

Options for EventSourceLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingBackendOptions
PostSharp.Patterns.Diagnostics.BackendsTextLoggingBackendOptions
PostSharp.Patterns.Diagnostics.Backends.EventSourceEventSourceLoggingBackendOptions

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class EventSourceLoggingBackendOptions : TextLoggingBackendOptions

The EventSourceLoggingBackendOptions type exposes the following members.

Constructors
 | Name | Description
Public method | EventSourceLoggingBackendOptions | Initializes a new instance of the EventSourceLoggingBackendOptions class
Top
Properties
 | Name | Description
Public property | ActionMaxLength | Max length of a log record. The default value is 2048. (Inherited from TextLoggingBackendOptions.)
Public property | AppendTrailingPeriod | Determines whether log messages should be ended with a trailing period. The default value is true because we really like trailing periods at PostSharp, but other opinions are valid. (Inherited from TextLoggingBackendOptions.)
Public property | ContextMaxLength | Max length of the Description property. (Inherited from LoggingBackendOptions.)
Public property | Delimiter | String used to separate different parts of the logging record. The default value is a pipe surrounded by spaces ( | ). (Inherited from TextLoggingBackendOptions.)
Public property | IncludeExceptionDetails | Determines whether exception details (basically Exception.ToString) should be appended to the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeNamespace | Determines whether the full namespace of types should be included in the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeType | Determines whether the name of the type of the logged method should be included in the log. The default value is true. (Inherited from TextLoggingBackendOptions.)
Public property | IndentSpaces | Number of spaces for each indentation level. The default value is 2. (Inherited from TextLoggingBackendOptions.)
Public property | LogLevelIgnoredForSystemRecords | Determines whether the Level property is ignored by the current back-end for auto-generated (i.e. non-manual) logging records. Some back-ends may not support overriding the level of records. (Overrides LoggingBackendOptionsLogLevelIgnoredForSystemRecords.)
Public property | ShouldLogExceptionPredicate | Gets or sets a predicate that determines whether an exception should be logged. This predicate is evaluated only when the method entry is not logged. When the method entry is logged, exceptions are always logged. (Inherited from TextLoggingBackendOptions.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


EventSourceLoggingBackendOptions Constructor

Initializes a new instance of the EventSourceLoggingBackendOptions class

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public EventSourceLoggingBackendOptions()
See Also

Reference

EventSourceLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


EventSourceLoggingBackendOptions Properties

The EventSourceLoggingBackendOptions type exposes the following members.

Properties
 | Name | Description
Public property | ActionMaxLength | Max length of a log record. The default value is 2048. (Inherited from TextLoggingBackendOptions.)
Public property | AppendTrailingPeriod | Determines whether log messages should be ended with a trailing period. The default value is true because we really like trailing periods at PostSharp, but other opinions are valid. (Inherited from TextLoggingBackendOptions.)
Public property | ContextMaxLength | Max length of the Description property. (Inherited from LoggingBackendOptions.)
Public property | Delimiter | String used to separate different parts of the logging record. The default value is a pipe surrounded by spaces ( | ). (Inherited from TextLoggingBackendOptions.)
Public property | IncludeExceptionDetails | Determines whether exception details (basically Exception.ToString) should be appended to the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeNamespace | Determines whether the full namespace of types should be included in the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeType | Determines whether the name of the type of the logged method should be included in the log. The default value is true. (Inherited from TextLoggingBackendOptions.)
Public property | IndentSpaces | Number of spaces for each indentation level. The default value is 2. (Inherited from TextLoggingBackendOptions.)
Public property | LogLevelIgnoredForSystemRecords | Determines whether the Level property is ignored by the current back-end for auto-generated (i.e. non-manual) logging records. Some back-ends may not support overriding the level of records. (Overrides LoggingBackendOptionsLogLevelIgnoredForSystemRecords.)
Public property | ShouldLogExceptionPredicate | Gets or sets a predicate that determines whether an exception should be logged. This predicate is evaluated only when the method entry is not logged. When the method entry is logged, exceptions are always logged. (Inherited from TextLoggingBackendOptions.)
Top
See Also

Reference

EventSourceLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


EventSourceLoggingBackendOptions.LogLevelIgnoredForSystemRecords Property

EventSourceLoggingBackendOptionsLogLevelIgnoredForSystemRecords Property

Determines whether the Level property is ignored by the current back-end for auto-generated (i.e. non-manual) logging records. Some back-ends may not support overriding the level of records.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool LogLevelIgnoredForSystemRecords { get; }

Property Value

Type: Boolean
See Also

Reference

EventSourceLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


EventSourceLoggingTypeSource Class

The LoggingTypeSource for EventSourceLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
PostSharp.Patterns.DiagnosticsLoggingTypeSource
PostSharp.Patterns.Diagnostics.Backends.EventSourceEventSourceLoggingTypeSource

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class EventSourceLoggingTypeSource : LoggingTypeSource

The EventSourceLoggingTypeSource type exposes the following members.

Constructors
 | Name | Description
Public method | EventSourceLoggingTypeSource | Initializes a new EventSourceLoggingTypeSource.
Top
Properties
 | Name | Description
Public property | Backend | Gets the parent LoggingBackend. (Inherited from LoggingNamespaceSource.)
Public property | DisplayFullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the DisplayFullName property does not include the arity, i.e. the full name of List<T> is System.Collections.Generic.List. (Inherited from LoggingNamespaceSource.)
Public property | DisplayName | Gets the last component of the name of the type or namespace, in the form that should be reported to the log. For generic types, the DisplayName property does not include the arity, i.e. the name of List<T> is List. (Inherited from LoggingNamespaceSource.)
Public property | FullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the FullName property includes the arity, i.e. the full name of List<T> is System.Collections.Generic.List`1. (Inherited from LoggingNamespaceSource.)
Public property | GenericParameterCount | Gets the number of generic parameters in SourceType. (Inherited from LoggingTypeSource.)
Public property | Level | Gets the minimal LogLevel for which logging is enabled for the current namespace or type. (Inherited from LoggingNamespaceSource.)
Public property | Name | Gets the last component of the name of the type or namespace. For instance, when FullName is PostSharp.Patterns.Diagnostics.LoggingBackend, Name is LoggingBackend. For generic types, the Name property includes the arity, i.e. the name of List<T> is List`1. (Inherited from LoggingNamespaceSource.)
Public property | Options | Gets the LoggingRoleConfiguration for the current role. This property is a shortcut to LoggingServices.Roles[this.Role]. (Inherited from LoggingTypeSource.)
Public property | Parent | Gets the parent LoggingNamespaceSource, or null if the current object represents the root namespace. (Inherited from LoggingNamespaceSource.)
Public property | Role | Gets the logging role for the current role. Typical values of this property are listed in the LoggingRoles class. (Inherited from LoggingNamespaceSource.)
Public property | SourceType | The type represented by the current LoggingTypeSource. (Inherited from LoggingTypeSource.)
Top
Methods
 | Name | Description
Protected method | IsBackendEnabled | Checks whether logging is enabled in the back-end for the given level. (Overrides LoggingTypeSourceIsBackendEnabled(LogLevel).)
Public method | IsEnabled | Determines whether logging is enabled for the given LogLevel. (Inherited from LoggingTypeSource.)
Public method | Refresh | Refreshes the logging level from the back-end from the current node and all children nodes. The back-end-defined logging level is cached for performance reasons. (Inherited from LoggingTypeSource.)
Public method | SetLevel | Sets the minimal LogLevel for which logging is enabled for the current namespace and type and all children namespaces and types. (Inherited from LoggingNamespaceSource.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


EventSourceLoggingTypeSource Constructor

Initializes a new EventSourceLoggingTypeSource.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public EventSourceLoggingTypeSource(
    LoggingNamespaceSource parent,
    Type type
)

Parameters

parent
Type: PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
The parent LoggingNamespaceSource.
type
Type: SystemType
The Type being logged.
See Also

Reference

EventSourceLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


EventSourceLoggingTypeSource Properties

The EventSourceLoggingTypeSource type exposes the following members.

Properties
 | Name | Description
Public property | Backend | Gets the parent LoggingBackend. (Inherited from LoggingNamespaceSource.)
Public property | DisplayFullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the DisplayFullName property does not include the arity, i.e. the full name of List<T> is System.Collections.Generic.List. (Inherited from LoggingNamespaceSource.)
Public property | DisplayName | Gets the last component of the name of the type or namespace, in the form that should be reported to the log. For generic types, the DisplayName property does not include the arity, i.e. the name of List<T> is List. (Inherited from LoggingNamespaceSource.)
Public property | FullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the FullName property includes the arity, i.e. the full name of List<T> is System.Collections.Generic.List`1. (Inherited from LoggingNamespaceSource.)
Public property | GenericParameterCount | Gets the number of generic parameters in SourceType. (Inherited from LoggingTypeSource.)
Public property | Level | Gets the minimal LogLevel for which logging is enabled for the current namespace or type. (Inherited from LoggingNamespaceSource.)
Public property | Name | Gets the last component of the name of the type or namespace. For instance, when FullName is PostSharp.Patterns.Diagnostics.LoggingBackend, Name is LoggingBackend. For generic types, the Name property includes the arity, i.e. the name of List<T> is List`1. (Inherited from LoggingNamespaceSource.)
Public property | Options | Gets the LoggingRoleConfiguration for the current role. This property is a shortcut to LoggingServices.Roles[this.Role]. (Inherited from LoggingTypeSource.)
Public property | Parent | Gets the parent LoggingNamespaceSource, or null if the current object represents the root namespace. (Inherited from LoggingNamespaceSource.)
Public property | Role | Gets the logging role for the current role. Typical values of this property are listed in the LoggingRoles class. (Inherited from LoggingNamespaceSource.)
Public property | SourceType | The type represented by the current LoggingTypeSource. (Inherited from LoggingTypeSource.)
Top
See Also

Reference

EventSourceLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


EventSourceLoggingTypeSource Methods

The EventSourceLoggingTypeSource type exposes the following members.

Methods
 | Name | Description
Protected method | IsBackendEnabled | Checks whether logging is enabled in the back-end for the given level. (Overrides LoggingTypeSourceIsBackendEnabled(LogLevel).)
Public method | IsEnabled | Determines whether logging is enabled for the given LogLevel. (Inherited from LoggingTypeSource.)
Public method | Refresh | Refreshes the logging level from the back-end from the current node and all children nodes. The back-end-defined logging level is cached for performance reasons. (Inherited from LoggingTypeSource.)
Public method | SetLevel | Sets the minimal LogLevel for which logging is enabled for the current namespace and type and all children namespaces and types. (Inherited from LoggingNamespaceSource.)
Top
See Also

Reference

EventSourceLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


EventSourceLoggingTypeSource.IsBackendEnabled Method

EventSourceLoggingTypeSourceIsBackendEnabled Method

Checks whether logging is enabled in the back-end for the given level.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override bool IsBackendEnabled(
    LogLevel level
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel

Return Value

Type: Boolean
Remarks

The result of this method is cached. To invalidate the cache, call the Refresh method.

See Also

Reference

EventSourceLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


EventSourceLogRecordBuilder Class

The LogRecordBuilder for EventSourceLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.RecordBuildersLogRecordBuilder
PostSharp.Patterns.Diagnostics.RecordBuildersTextLogRecordBuilder
PostSharp.Patterns.Diagnostics.Backends.EventSourceEventSourceLogRecordBuilder

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class EventSourceLogRecordBuilder : TextLogRecordBuilder

The EventSourceLogRecordBuilder type exposes the following members.

Constructors
 | Name | Description
Public method | EventSourceLogRecordBuilder | Initializes a new EventSourceLogRecordBuilder/
Top
Properties
 | Name | Description
Public property | Backend | Gets the parent back-end. (Inherited from TextLogRecordBuilder.)
Public property | BackendOptions | Shortcut for this.Backend.Options. (Inherited from TextLogRecordBuilder.)
Protected property | Context | Gets the LoggingContext to which the record belongs. (Inherited from LogRecordBuilder.)
Public property | Exception | Gets the Exception for the current record, or null if no exception is associated to the current record. (Inherited from TextLogRecordBuilder.)
Public property | IsDisposed | (Inherited from LogRecordBuilder.)
Protected property | Level | Gets the LogLevel for the current record. (Inherited from TextLogRecordBuilder.)
Public property | MemberName | Gets the name of the method, property or field for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Options | Gets the LoggingOptions for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Profile | Gets the LoggingProfile for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | RecordKind | Gets the kind of the current record (e.g. MethodEntry or MethodException). (Inherited from LogRecordBuilder.)
Public property | SourceLineInfo | Gets the SourceLineInfo for the current record. (Inherited from TextLogRecordBuilder.)
Public property | SourceType | Gets the source Type of the current record. (Inherited from TextLogRecordBuilder.)
Protected property | StringBuilder | Gets the current UnsafeStringBuilder where everything is being appended. (Inherited from TextLogRecordBuilder.)
Protected property | ThreadContext | Gets the ThreadLoggingContext to which the current LogRecordBuilder belongs. (Inherited from LogRecordBuilder.)
Protected property | TypeSource | Gets the LoggingTypeSource for the current record. (Inherited from TextLogRecordBuilder.)
Top
Methods
 | Name | Description
Protected method | AppendAsyncInfo | Appends information about the async method to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendClosingParenthesisConditional | Appends a closing parenthesis to the current StringBuilder if required. (Inherited from TextLogRecordBuilder.)
Protected method | AppendComma | (Inherited from TextLogRecordBuilder.)
Protected method | AppendCommaConditional | Appends a comma to the current StringBuilder, unless this method is invoked for the first time for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription | Appends the context Description (or the TypeSource name, if the type of the context is not equal to the source type of the record) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription(LoggingContext) | (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiter | Appends a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiterConditional | Appends a Delimiter to the current StringBuilder if the RequireDelimiter method has been called previously. (Inherited from TextLogRecordBuilder.)
Protected method | AppendEpilogue | Appends the final part of log message to StringBuilder. This includes state machine number and execution time where relevant, but does not include exception details. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExceptionDetails | Appends exception details to StringBuilder if IncludeExceptionDetails is set. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTime | Appends the execution time to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTimeThreshold | Appends the execution time threshold to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendIndentString | Appends indentation for the given to StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendMemberName | Appends name of the member for the current record (including the declaring type name, subject to the IncludeType property) to the current StringBuilder, as well as an opening parenthesis. (Inherited from TextLogRecordBuilder.)
Protected method | AppendOpeningParenthesis | Appends an opening parenthesis to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendProlog | Appends the indent string, context description, and the record kind to the current StringBuilder. (Overrides TextLogRecordBuilderAppendProlog.)
Protected method | AppendRecordKind | Appends the LogRecordKind of the current record to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameter(SemanticParameterKind, String, String, String, Int32) | Appends a parameter of String type to the current StringBuilder. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSourceLineInfo | Appends source (file, line) information to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpaces | Appends a given number of spaces to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpecialChar | Appends a special Char (which may require escaping with specific back-ends) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTrailingPeriod | Appends a trailing period (.) to the current StringBuilder, respecting the AppendTrailingPeriod property. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTypeName | Appends the name of the TypeSource to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | BeginCustomRecord | Initializes the current LogRecordBuilder to emit a custom record. (Inherited from TextLogRecordBuilder.)
Public method | BeginRecord | Initializes the current LogRecordBuilder to emit a standard (i.e. non-custom) record for a given context and method. (Inherited from TextLogRecordBuilder.)
Public method | Complete | Emits the record and resets the current LogRecordBuilder. This method invoked after all SetThisT(T), SetParameterT(Int32, String, ParameterKind, String, T) and similar methods have been called. (Inherited from LogRecordBuilder.)
Public method | Dispose | (Inherited from LogRecordBuilder.)
Protected method | EmitRecord | Emits the record. Invoked by the Complete method. (Overrides TextLogRecordBuilderEmitRecord.)
Protected method | EmitRecord(Boolean) | Emits the record and specifies whether exception details should be appended to the text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescription | Ends building the context Description and starts building the action text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescriptionConditional | Switches between building the context Description and the action text. If the EndContextDescriptionConditional method has been previously invoked, subsequent calls are ignored. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescription | Obsolete. Gets the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescriptionUnsafe | Obsolete. Gets an UnsafeString representing the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextForDescription | Obsolete. Gets the LoggingContext that should be used when getting or appending the Description. (Inherited from TextLogRecordBuilder.)
Protected method | GetSourceName | Gets the name of the TypeSource for the current record, respecting the IncludeNamespace property. (Inherited from TextLogRecordBuilder.)
Protected method | HasRecordKindName | Determines whether the AppendRecordKind will append anything for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | MustBuildContextDescription | Determines whether the current Description should be appended to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | RequireComma | Makes the AppendCommaConditional to append a comma even if it's invoked for the first time. (Inherited from TextLogRecordBuilder.)
Protected method | RequireDelimiter | Causes the next call to the AppendDelimiterConditional to append a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | Reset | Resets all fields and properties of the current LogRecordBuilder to their initial value. Invoked by the Complete method. (Inherited from TextLogRecordBuilder.)
Public method | SetException | Sets the exception for the method or activity. (Inherited from TextLogRecordBuilder.)
Public method | SetExecutionTime | Sets the method or activity execution time. (Inherited from TextLogRecordBuilder.)
Public method | SetMethodGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T) | Sets the value of a given parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from TextLogRecordBuilder.)
Public method | SetRefStructParameter | (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T) | Sets a given return value (there can be several return values in C# 7.0) and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetThisT(T) | Sets the this (instance) value and uses the default formatter. This method is only invoked if the IncludeThisValue property is true. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetTypeGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Protected method | ShouldLogExceptionDetails | Determines whether exception details should be appended to the text of the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | ToString | Returns a string that represents the current object. (Inherited from TextLogRecordBuilder.)
Protected method | Write | Writes the final message to the back-end. (Overrides TextLogRecordBuilderWrite(UnsafeString).)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T) | Writes a custom parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | WriteCustomString | Write a chunk of custom string. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


EventSourceLogRecordBuilder Constructor

Initializes a new EventSourceLogRecordBuilder/

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public EventSourceLogRecordBuilder(
    EventSourceLoggingBackend backend
)

Parameters

backend
Type: PostSharp.Patterns.Diagnostics.Backends.EventSourceEventSourceLoggingBackend
The parent EventSourceLoggingBackend.
See Also

Reference

EventSourceLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


EventSourceLogRecordBuilder Properties

The EventSourceLogRecordBuilder type exposes the following members.

Properties
 | Name | Description
Public property | Backend | Gets the parent back-end. (Inherited from TextLogRecordBuilder.)
Public property | BackendOptions | Shortcut for this.Backend.Options. (Inherited from TextLogRecordBuilder.)
Protected property | Context | Gets the LoggingContext to which the record belongs. (Inherited from LogRecordBuilder.)
Public property | Exception | Gets the Exception for the current record, or null if no exception is associated to the current record. (Inherited from TextLogRecordBuilder.)
Public property | IsDisposed | (Inherited from LogRecordBuilder.)
Protected property | Level | Gets the LogLevel for the current record. (Inherited from TextLogRecordBuilder.)
Public property | MemberName | Gets the name of the method, property or field for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Options | Gets the LoggingOptions for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Profile | Gets the LoggingProfile for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | RecordKind | Gets the kind of the current record (e.g. MethodEntry or MethodException). (Inherited from LogRecordBuilder.)
Public property | SourceLineInfo | Gets the SourceLineInfo for the current record. (Inherited from TextLogRecordBuilder.)
Public property | SourceType | Gets the source Type of the current record. (Inherited from TextLogRecordBuilder.)
Protected property | StringBuilder | Gets the current UnsafeStringBuilder where everything is being appended. (Inherited from TextLogRecordBuilder.)
Protected property | ThreadContext | Gets the ThreadLoggingContext to which the current LogRecordBuilder belongs. (Inherited from LogRecordBuilder.)
Protected property | TypeSource | Gets the LoggingTypeSource for the current record. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

EventSourceLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


EventSourceLogRecordBuilder Methods

The EventSourceLogRecordBuilder type exposes the following members.

Methods
 | Name | Description
Protected method | AppendAsyncInfo | Appends information about the async method to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendClosingParenthesisConditional | Appends a closing parenthesis to the current StringBuilder if required. (Inherited from TextLogRecordBuilder.)
Protected method | AppendComma | (Inherited from TextLogRecordBuilder.)
Protected method | AppendCommaConditional | Appends a comma to the current StringBuilder, unless this method is invoked for the first time for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription | Appends the context Description (or the TypeSource name, if the type of the context is not equal to the source type of the record) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription(LoggingContext) | (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiter | Appends a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiterConditional | Appends a Delimiter to the current StringBuilder if the RequireDelimiter method has been called previously. (Inherited from TextLogRecordBuilder.)
Protected method | AppendEpilogue | Appends the final part of log message to StringBuilder. This includes state machine number and execution time where relevant, but does not include exception details. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExceptionDetails | Appends exception details to StringBuilder if IncludeExceptionDetails is set. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTime | Appends the execution time to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTimeThreshold | Appends the execution time threshold to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendIndentString | Appends indentation for the given to StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendMemberName | Appends name of the member for the current record (including the declaring type name, subject to the IncludeType property) to the current StringBuilder, as well as an opening parenthesis. (Inherited from TextLogRecordBuilder.)
Protected method | AppendOpeningParenthesis | Appends an opening parenthesis to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendProlog | Appends the indent string, context description, and the record kind to the current StringBuilder. (Overrides TextLogRecordBuilderAppendProlog.)
Protected method | AppendRecordKind | Appends the LogRecordKind of the current record to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameter(SemanticParameterKind, String, String, String, Int32) | Appends a parameter of String type to the current StringBuilder. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSourceLineInfo | Appends source (file, line) information to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpaces | Appends a given number of spaces to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpecialChar | Appends a special Char (which may require escaping with specific back-ends) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTrailingPeriod | Appends a trailing period (.) to the current StringBuilder, respecting the AppendTrailingPeriod property. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTypeName | Appends the name of the TypeSource to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | BeginCustomRecord | Initializes the current LogRecordBuilder to emit a custom record. (Inherited from TextLogRecordBuilder.)
Public method | BeginRecord | Initializes the current LogRecordBuilder to emit a standard (i.e. non-custom) record for a given context and method. (Inherited from TextLogRecordBuilder.)
Public method | Complete | Emits the record and resets the current LogRecordBuilder. This method invoked after all SetThisT(T), SetParameterT(Int32, String, ParameterKind, String, T) and similar methods have been called. (Inherited from LogRecordBuilder.)
Public method | Dispose | (Inherited from LogRecordBuilder.)
Protected method | EmitRecord | Emits the record. Invoked by the Complete method. (Overrides TextLogRecordBuilderEmitRecord.)
Protected method | EmitRecord(Boolean) | Emits the record and specifies whether exception details should be appended to the text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescription | Ends building the context Description and starts building the action text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescriptionConditional | Switches between building the context Description and the action text. If the EndContextDescriptionConditional method has been previously invoked, subsequent calls are ignored. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescription | Obsolete. Gets the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescriptionUnsafe | Obsolete. Gets an UnsafeString representing the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextForDescription | Obsolete. Gets the LoggingContext that should be used when getting or appending the Description. (Inherited from TextLogRecordBuilder.)
Protected method | GetSourceName | Gets the name of the TypeSource for the current record, respecting the IncludeNamespace property. (Inherited from TextLogRecordBuilder.)
Protected method | HasRecordKindName | Determines whether the AppendRecordKind will append anything for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | MustBuildContextDescription | Determines whether the current Description should be appended to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | RequireComma | Makes the AppendCommaConditional to append a comma even if it's invoked for the first time. (Inherited from TextLogRecordBuilder.)
Protected method | RequireDelimiter | Causes the next call to the AppendDelimiterConditional to append a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | Reset | Resets all fields and properties of the current LogRecordBuilder to their initial value. Invoked by the Complete method. (Inherited from TextLogRecordBuilder.)
Public method | SetException | Sets the exception for the method or activity. (Inherited from TextLogRecordBuilder.)
Public method | SetExecutionTime | Sets the method or activity execution time. (Inherited from TextLogRecordBuilder.)
Public method | SetMethodGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T) | Sets the value of a given parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from TextLogRecordBuilder.)
Public method | SetRefStructParameter | (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T) | Sets a given return value (there can be several return values in C# 7.0) and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetThisT(T) | Sets the this (instance) value and uses the default formatter. This method is only invoked if the IncludeThisValue property is true. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetTypeGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Protected method | ShouldLogExceptionDetails | Determines whether exception details should be appended to the text of the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | ToString | Returns a string that represents the current object. (Inherited from TextLogRecordBuilder.)
Protected method | Write | Writes the final message to the back-end. (Overrides TextLogRecordBuilderWrite(UnsafeString).)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T) | Writes a custom parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | WriteCustomString | Write a chunk of custom string. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

EventSourceLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


EventSourceLogRecordBuilder.AppendProlog Method

EventSourceLogRecordBuilderAppendProlog Method

Appends the indent string, context description, and the record kind to the current StringBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void AppendProlog()
See Also

Reference

EventSourceLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


EventSourceLogRecordBuilder.EmitRecord Method

EventSourceLogRecordBuilderEmitRecord Method

Overload List
 | Name | Description
Protected method | EmitRecord | Emits the record. Invoked by the Complete method. (Overrides TextLogRecordBuilderEmitRecord.)
Protected method | EmitRecord(Boolean) | Emits the record and specifies whether exception details should be appended to the text. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

EventSourceLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


EventSourceLogRecordBuilder.EmitRecord Method

EventSourceLogRecordBuilderEmitRecord Method

Emits the record. Invoked by the Complete method.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void EmitRecord()
See Also

Reference

EventSourceLogRecordBuilder Class
EmitRecord Overload
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


EventSourceLogRecordBuilder.Write Method

EventSourceLogRecordBuilderWrite Method

Writes the final message to the back-end.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void Write(
    UnsafeString message
)

Parameters

message
Type: PostSharp.Patterns.FormattersUnsafeString
The final message.
See Also

Reference

EventSourceLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


PostSharpEventSource Class

The PostSharp.Patterns.Diagnostics.Backends.EventSource targeted by EventSourceLoggingBackend.
Inheritance Hierarchy
SystemObject
System.Diagnostics.TracingEventSource
PostSharp.Patterns.Diagnostics.Backends.EventSourcePostSharpEventSource

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class PostSharpEventSource : EventSource

The PostSharpEventSource type exposes the following members.

Constructors
 | Name | Description
Public method | PostSharpEventSource | Initializes a new PostSharpEventSource.
Top
Methods
 | Name | Description
Public method | IsEnabled | Checks whether logging for the given level is enabled.
Public method | Log | Emits a log record.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


PostSharpEventSource Constructor

Initializes a new PostSharpEventSource.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public PostSharpEventSource()
See Also

Reference

PostSharpEventSource Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


PostSharpEventSource Methods

The PostSharpEventSource type exposes the following members.

Methods
 | Name | Description
Public method | IsEnabled | Checks whether logging for the given level is enabled.
Public method | Log | Emits a log record.
Top
See Also

Reference

PostSharpEventSource Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


PostSharpEventSource.IsEnabled Method

PostSharpEventSourceIsEnabled Method

Checks whether logging for the given level is enabled.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsEnabled(
    EventLevel level
)

Parameters

level
Type: System.Diagnostics.TracingEventLevel

Return Value

Type: Boolean
See Also

Reference

PostSharpEventSource Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


PostSharpEventSource.Log Method

PostSharpEventSourceLog Method

Emits a log record.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Log(
    LogLevel logLevel,
    LogRecordKind recordKind,
    string role,
    string type,
    UnsafeString contextDescription,
    UnsafeString message,
    int indentLevel
)

Parameters

logLevel
Type: PostSharp.Patterns.DiagnosticsLogLevel
Log level.
recordKind
Type: PostSharp.Patterns.DiagnosticsLogRecordKind
Record kind.
role
Type: SystemString
Logging role (see LoggingRoles).
type
Type: SystemString
Full name of the type emitting the record.
contextDescription
Type: PostSharp.Patterns.FormattersUnsafeString
Context description.
message
Type: PostSharp.Patterns.FormattersUnsafeString
Message.
indentLevel
Type: SystemInt32
Indentation level.
See Also

Reference

PostSharpEventSource Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


PostSharpEventSource.EventIds Class

PostSharpEventSourceEventIds Class

Defines the event ids.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.Backends.EventSourcePostSharpEventSourceEventIds

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static class EventIds

The PostSharpEventSourceEventIds type exposes the following members.

Fields
Name | Description
AsyncMethodAwait | AsyncMethodAwait.
AsyncMethodResume | AsyncMethodResume.
CustomActivityEntry | CustomActivityEntry.
CustomActivityException | CustomActivityException.
CustomActivityFailure | CustomActivityFailure.
CustomActivitySuccess | CustomActivitySuccess.
CustomCritical | CustomRecord with Critical level.
CustomError | CustomRecord with Error level.
CustomInfo | CustomRecord with Info level.
CustomVerbose | CustomRecord with Trace and Debug levels.
CustomWarning | CustomRecord with Warning level.
ExecutionPoint | ExecutionPoint.
IteratorMoveNext | IteratorMoveNext.
IteratorYield | IteratorYield.
MethodEntry | MethodEntry.
MethodException | MethodException.
MethodOvertime | MethodOvertime.
MethodSuccess | MethodSuccess.
ValueChanged | ValueChanged.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


EventIds Fields

The PostSharpEventSourceEventIds type exposes the following members.

Fields
Name | Description
AsyncMethodAwait | AsyncMethodAwait.
AsyncMethodResume | AsyncMethodResume.
CustomActivityEntry | CustomActivityEntry.
CustomActivityException | CustomActivityException.
CustomActivityFailure | CustomActivityFailure.
CustomActivitySuccess | CustomActivitySuccess.
CustomCritical | CustomRecord with Critical level.
CustomError | CustomRecord with Error level.
CustomInfo | CustomRecord with Info level.
CustomVerbose | CustomRecord with Trace and Debug levels.
CustomWarning | CustomRecord with Warning level.
ExecutionPoint | ExecutionPoint.
IteratorMoveNext | IteratorMoveNext.
IteratorYield | IteratorYield.
MethodEntry | MethodEntry.
MethodException | MethodException.
MethodOvertime | MethodOvertime.
MethodSuccess | MethodSuccess.
ValueChanged | ValueChanged.
Top
See Also

Reference

PostSharpEventSourceEventIds Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


PostSharpEventSource.EventIds.AsyncMethodAwait Field

PostSharpEventSourceEventIdsAsyncMethodAwait Field

AsyncMethodAwait.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const int AsyncMethodAwait = 5

Field Value

Type: Int32
See Also

Reference

PostSharpEventSourceEventIds Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


PostSharpEventSource.EventIds.AsyncMethodResume Field

PostSharpEventSourceEventIdsAsyncMethodResume Field

AsyncMethodResume.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const int AsyncMethodResume = 6

Field Value

Type: Int32
See Also

Reference

PostSharpEventSourceEventIds Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


PostSharpEventSource.EventIds.CustomActivityEntry Field

PostSharpEventSourceEventIdsCustomActivityEntry Field

CustomActivityEntry.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const int CustomActivityEntry = 13

Field Value

Type: Int32
See Also

Reference

PostSharpEventSourceEventIds Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


PostSharpEventSource.EventIds.CustomActivityException Field

PostSharpEventSourceEventIdsCustomActivityException Field

CustomActivityException.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const int CustomActivityException = 14

Field Value

Type: Int32
See Also

Reference

PostSharpEventSourceEventIds Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


PostSharpEventSource.EventIds.CustomActivityFailure Field

PostSharpEventSourceEventIdsCustomActivityFailure Field

CustomActivityFailure.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const int CustomActivityFailure = 16

Field Value

Type: Int32
See Also

Reference

PostSharpEventSourceEventIds Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


PostSharpEventSource.EventIds.CustomActivitySuccess Field

PostSharpEventSourceEventIdsCustomActivitySuccess Field

CustomActivitySuccess.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const int CustomActivitySuccess = 15

Field Value

Type: Int32
See Also

Reference

PostSharpEventSourceEventIds Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


PostSharpEventSource.EventIds.CustomCritical Field

PostSharpEventSourceEventIdsCustomCritical Field

CustomRecord with Critical level.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const int CustomCritical = 12

Field Value

Type: Int32
See Also

Reference

PostSharpEventSourceEventIds Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


PostSharpEventSource.EventIds.CustomError Field

PostSharpEventSourceEventIdsCustomError Field

CustomRecord with Error level.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const int CustomError = 11

Field Value

Type: Int32
See Also

Reference

PostSharpEventSourceEventIds Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


PostSharpEventSource.EventIds.CustomInfo Field

PostSharpEventSourceEventIdsCustomInfo Field

CustomRecord with Info level.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const int CustomInfo = 9

Field Value

Type: Int32
See Also

Reference

PostSharpEventSourceEventIds Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


PostSharpEventSource.EventIds.CustomVerbose Field

PostSharpEventSourceEventIdsCustomVerbose Field

CustomRecord with Trace and Debug levels.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const int CustomVerbose = 8

Field Value

Type: Int32
See Also

Reference

PostSharpEventSourceEventIds Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


PostSharpEventSource.EventIds.CustomWarning Field

PostSharpEventSourceEventIdsCustomWarning Field

CustomRecord with Warning level.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const int CustomWarning = 10

Field Value

Type: Int32
See Also

Reference

PostSharpEventSourceEventIds Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


PostSharpEventSource.EventIds.ExecutionPoint Field

PostSharpEventSourceEventIdsExecutionPoint Field

ExecutionPoint.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const int ExecutionPoint = 19

Field Value

Type: Int32
See Also

Reference

PostSharpEventSourceEventIds Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


PostSharpEventSource.EventIds.IteratorMoveNext Field

PostSharpEventSourceEventIdsIteratorMoveNext Field

IteratorMoveNext.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const int IteratorMoveNext = 18

Field Value

Type: Int32
See Also

Reference

PostSharpEventSourceEventIds Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


PostSharpEventSource.EventIds.IteratorYield Field

PostSharpEventSourceEventIdsIteratorYield Field

IteratorYield.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const int IteratorYield = 17

Field Value

Type: Int32
See Also

Reference

PostSharpEventSourceEventIds Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


PostSharpEventSource.EventIds.MethodEntry Field

PostSharpEventSourceEventIdsMethodEntry Field

MethodEntry.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const int MethodEntry = 1

Field Value

Type: Int32
See Also

Reference

PostSharpEventSourceEventIds Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


PostSharpEventSource.EventIds.MethodException Field

PostSharpEventSourceEventIdsMethodException Field

MethodException.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const int MethodException = 3

Field Value

Type: Int32
See Also

Reference

PostSharpEventSourceEventIds Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


PostSharpEventSource.EventIds.MethodOvertime Field

PostSharpEventSourceEventIdsMethodOvertime Field

MethodOvertime.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const int MethodOvertime = 4

Field Value

Type: Int32
See Also

Reference

PostSharpEventSourceEventIds Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


PostSharpEventSource.EventIds.MethodSuccess Field

PostSharpEventSourceEventIdsMethodSuccess Field

MethodSuccess.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const int MethodSuccess = 2

Field Value

Type: Int32
See Also

Reference

PostSharpEventSourceEventIds Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


PostSharpEventSource.EventIds.ValueChanged Field

PostSharpEventSourceEventIdsValueChanged Field

ValueChanged.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const int ValueChanged = 7

Field Value

Type: Int32
See Also

Reference

PostSharpEventSourceEventIds Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


PostSharpEventSource.Tasks Class

PostSharpEventSourceTasks Class

Defines the task ids (a task groups several messages).
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.Backends.EventSourcePostSharpEventSourceTasks

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static class Tasks

The PostSharpEventSourceTasks type exposes the following members.

Fields
Name | Description
CustomActivity | Custom activity execution.
Message | Custom message.
Method | Method execution.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


Tasks Fields

The PostSharpEventSourceTasks type exposes the following members.

Fields
Name | Description
CustomActivity | Custom activity execution.
Message | Custom message.
Method | Method execution.
Top
See Also

Reference

PostSharpEventSourceTasks Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


PostSharpEventSource.Tasks.CustomActivity Field

PostSharpEventSourceTasksCustomActivity Field

Custom activity execution.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const EventTask CustomActivity =

Field Value

Type: EventTask
See Also

Reference

PostSharpEventSourceTasks Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


PostSharpEventSource.Tasks.Message Field

PostSharpEventSourceTasksMessage Field

Custom message.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const EventTask Message =

Field Value

Type: EventTask
See Also

Reference

PostSharpEventSourceTasks Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


PostSharpEventSource.Tasks.Method Field

PostSharpEventSourceTasksMethod Field

Method execution.

Namespace: PostSharp.Patterns.Diagnostics.Backends.EventSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const EventTask Method =

Field Value

Type: EventTask
See Also

Reference

PostSharpEventSourceTasks Class
PostSharp.Patterns.Diagnostics.Backends.EventSource Namespace


PostSharp.Patterns.Diagnostics.Backends.Log4Net Namespace

Classes
 | Class | Description
Public class | Log4NetLoggingBackend | Logging back-end for log4net.
Public class | Log4NetLoggingBackendOptions | Options for Log4NetLoggingBackend.
Public class | Log4NetLoggingTypeSource | LoggingTypeSource for Log4NetLoggingBackend.
Public class | Log4NetLogRecordBuilder | LogRecordBuilder for Log4NetLoggingBackend.


Log4NetLoggingBackend Class

Logging back-end for log4net.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingBackend
PostSharp.Patterns.Diagnostics.BackendsTextLoggingBackend
PostSharp.Patterns.Diagnostics.Backends.Log4NetLog4NetLoggingBackend

Namespace: PostSharp.Patterns.Diagnostics.Backends.Log4Net
Assembly: PostSharp.Patterns.Diagnostics.Backends.Log4Net (in PostSharp.Patterns.Diagnostics.Backends.Log4Net.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class Log4NetLoggingBackend : TextLoggingBackend

The Log4NetLoggingBackend type exposes the following members.

Constructors
 | Name | Description
Public method | Log4NetLoggingBackend | Initializes a new Log4NetLoggingBackend.
Public method | Log4NetLoggingBackend(ILoggerRepository) | Initializes a new Log4NetLoggingBackend.
Top
Properties
 | Name | Description
Public property | CurrentContext | Gets the current LoggingContext. (Inherited from LoggingBackend.)
Public property | IsCorrupted | (Inherited from LoggingBackend.)
Public property | IsDisposed | Determines whether the current LoggingBackend has been disposed. (Inherited from LoggingBackend.)
Public property | IsEnabled | Determines whether the current LoggingBackend is currently enabled. This property has precedence over, and does not affect, the minimal log levels set through the SetLevel(LogLevel) method. (Inherited from LoggingBackend.)
Public property | Options | Gets the back-end options.
Public property | Repository | Gets the log4net repository from which the loggers are retrieved.
Top
Methods
 | Name | Description
Protected method | CreateAsyncCustomActivityContext | Creates a new AsyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateAsyncMethodContext | Creates a new AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Protected method | CreateEphemeralContext | Creates a new EphemeralLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateIteratorContext | Creates a new IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | CreateRecordBuilder | Creates a new LogRecordBuilder. (Overrides LoggingBackendCreateRecordBuilder.)
Protected method | CreateSyncCustomActivityContext | Creates a new SyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateSyncMethodContext | Creates a new SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Protected method | CreateThreadContext | Creates a new ThreadLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateTypeSource | Creates LoggingTypeSource for the given role and type. (Overrides LoggingBackendCreateTypeSource(LoggingNamespaceSource, Type).)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingBackend.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from TextLoggingBackend.)
Public method | GetAsyncContextOfTask | Gets the AsyncMethodLoggingContext associated with a Task. (Inherited from LoggingBackend.)
Protected method | GetBackendOptions | Gets the formatting and rendering options for the current LoggingBackend. (Inherited from TextLoggingBackend.)
Public method | GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace. (Inherited from LoggingBackend.)
Public method | GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type. (Inherited from LoggingBackend.)
Protected method | GetTextBackendOptions | Gets the options. (Overrides TextLoggingBackendGetTextBackendOptions.)
Public method | GetThreadContext | Returns the ThreadLoggingContext for the current Thread. (Inherited from LoggingBackend.)
Public method | OpenAsyncContext | Gets an AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Public method | OpenCustomActivityContext | Gets a LoggingContext for a custom activity (opened using OpenActivity(String) or OpenAsyncActivity(String)). (Inherited from LoggingBackend.)
Public method | OpenEphemeralContext | Gets an EphemeralLoggingContext for use in a given method. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record. (Inherited from LoggingBackend.)
Public method | OpenIteratorContext | Gets an IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | OpenSyncContext | Gets a SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Log4Net Namespace

Other Resources

Conceptual: Adding Detailed Logging to your Solution
Conceptual: Logging to log4net


Log4NetLoggingBackend Constructor

Overload List
 | Name | Description
Public method | Log4NetLoggingBackend | Initializes a new Log4NetLoggingBackend.
Public method | Log4NetLoggingBackend(ILoggerRepository) | Initializes a new Log4NetLoggingBackend.
Top
See Also

Reference

Log4NetLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Log4Net Namespace


Log4NetLoggingBackend Constructor

Initializes a new Log4NetLoggingBackend.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Log4Net
Assembly: PostSharp.Patterns.Diagnostics.Backends.Log4Net (in PostSharp.Patterns.Diagnostics.Backends.Log4Net.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Log4NetLoggingBackend()
Remarks
Throws PlatformNotSupportedException on platforms where log4net does not support default repositories.
See Also

Reference

Log4NetLoggingBackend Class
Log4NetLoggingBackend Overload
PostSharp.Patterns.Diagnostics.Backends.Log4Net Namespace


Log4NetLoggingBackend Constructor (ILoggerRepository)

Initializes a new Log4NetLoggingBackend.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Log4Net
Assembly: PostSharp.Patterns.Diagnostics.Backends.Log4Net (in PostSharp.Patterns.Diagnostics.Backends.Log4Net.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Log4NetLoggingBackend(
    ILoggerRepository repository
)

Parameters

repository
Type: ILoggerRepository
Repository to store loggers in.
See Also

Reference

Log4NetLoggingBackend Class
Log4NetLoggingBackend Overload
PostSharp.Patterns.Diagnostics.Backends.Log4Net Namespace


Log4NetLoggingBackend Properties

The Log4NetLoggingBackend type exposes the following members.

Properties
 | Name | Description
Public property | CurrentContext | Gets the current LoggingContext. (Inherited from LoggingBackend.)
Public property | IsCorrupted | (Inherited from LoggingBackend.)
Public property | IsDisposed | Determines whether the current LoggingBackend has been disposed. (Inherited from LoggingBackend.)
Public property | IsEnabled | Determines whether the current LoggingBackend is currently enabled. This property has precedence over, and does not affect, the minimal log levels set through the SetLevel(LogLevel) method. (Inherited from LoggingBackend.)
Public property | Options | Gets the back-end options.
Public property | Repository | Gets the log4net repository from which the loggers are retrieved.
Top
See Also

Reference

Log4NetLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Log4Net Namespace


Log4NetLoggingBackend.Options Property

Log4NetLoggingBackendOptions Property

Gets the back-end options.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Log4Net
Assembly: PostSharp.Patterns.Diagnostics.Backends.Log4Net (in PostSharp.Patterns.Diagnostics.Backends.Log4Net.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Log4NetLoggingBackendOptions Options { get; }

Property Value

Type: Log4NetLoggingBackendOptions
See Also

Reference

Log4NetLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Log4Net Namespace


Log4NetLoggingBackend.Repository Property

Log4NetLoggingBackendRepository Property

Gets the log4net repository from which the loggers are retrieved.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Log4Net
Assembly: PostSharp.Patterns.Diagnostics.Backends.Log4Net (in PostSharp.Patterns.Diagnostics.Backends.Log4Net.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ILoggerRepository Repository { get; }

Property Value

Type: ILoggerRepository
See Also

Reference

Log4NetLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Log4Net Namespace


Log4NetLoggingBackend Methods

The Log4NetLoggingBackend type exposes the following members.

Methods
 | Name | Description
Protected method | CreateAsyncCustomActivityContext | Creates a new AsyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateAsyncMethodContext | Creates a new AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Protected method | CreateEphemeralContext | Creates a new EphemeralLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateIteratorContext | Creates a new IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | CreateRecordBuilder | Creates a new LogRecordBuilder. (Overrides LoggingBackendCreateRecordBuilder.)
Protected method | CreateSyncCustomActivityContext | Creates a new SyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateSyncMethodContext | Creates a new SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Protected method | CreateThreadContext | Creates a new ThreadLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateTypeSource | Creates LoggingTypeSource for the given role and type. (Overrides LoggingBackendCreateTypeSource(LoggingNamespaceSource, Type).)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingBackend.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from TextLoggingBackend.)
Public method | GetAsyncContextOfTask | Gets the AsyncMethodLoggingContext associated with a Task. (Inherited from LoggingBackend.)
Protected method | GetBackendOptions | Gets the formatting and rendering options for the current LoggingBackend. (Inherited from TextLoggingBackend.)
Public method | GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace. (Inherited from LoggingBackend.)
Public method | GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type. (Inherited from LoggingBackend.)
Protected method | GetTextBackendOptions | Gets the options. (Overrides TextLoggingBackendGetTextBackendOptions.)
Public method | GetThreadContext | Returns the ThreadLoggingContext for the current Thread. (Inherited from LoggingBackend.)
Public method | OpenAsyncContext | Gets an AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Public method | OpenCustomActivityContext | Gets a LoggingContext for a custom activity (opened using OpenActivity(String) or OpenAsyncActivity(String)). (Inherited from LoggingBackend.)
Public method | OpenEphemeralContext | Gets an EphemeralLoggingContext for use in a given method. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record. (Inherited from LoggingBackend.)
Public method | OpenIteratorContext | Gets an IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | OpenSyncContext | Gets a SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Top
See Also

Reference

Log4NetLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Log4Net Namespace


Log4NetLoggingBackend.CreateRecordBuilder Method

Log4NetLoggingBackendCreateRecordBuilder Method

Creates a new LogRecordBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Log4Net
Assembly: PostSharp.Patterns.Diagnostics.Backends.Log4Net (in PostSharp.Patterns.Diagnostics.Backends.Log4Net.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override LogRecordBuilder CreateRecordBuilder()

Return Value

Type: LogRecordBuilder
A new LogRecordBuilder.
See Also

Reference

Log4NetLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Log4Net Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


Log4NetLoggingBackend.CreateTypeSource Method

Log4NetLoggingBackendCreateTypeSource Method

Creates LoggingTypeSource for the given role and type.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Log4Net
Assembly: PostSharp.Patterns.Diagnostics.Backends.Log4Net (in PostSharp.Patterns.Diagnostics.Backends.Log4Net.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override LoggingTypeSource CreateTypeSource(
    LoggingNamespaceSource parent,
    Type type
)

Parameters

parent
Type: PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
type
Type: SystemType

Return Value

Type: LoggingTypeSource
See Also

Reference

Log4NetLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Log4Net Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


Log4NetLoggingBackend.GetTextBackendOptions Method

Log4NetLoggingBackendGetTextBackendOptions Method

Gets the options.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Log4Net
Assembly: PostSharp.Patterns.Diagnostics.Backends.Log4Net (in PostSharp.Patterns.Diagnostics.Backends.Log4Net.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override TextLoggingBackendOptions GetTextBackendOptions()

Return Value

Type: TextLoggingBackendOptions
See Also

Reference

Log4NetLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Log4Net Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


Log4NetLoggingBackendOptions Class

Options for Log4NetLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingBackendOptions
PostSharp.Patterns.Diagnostics.BackendsTextLoggingBackendOptions
PostSharp.Patterns.Diagnostics.Backends.Log4NetLog4NetLoggingBackendOptions

Namespace: PostSharp.Patterns.Diagnostics.Backends.Log4Net
Assembly: PostSharp.Patterns.Diagnostics.Backends.Log4Net (in PostSharp.Patterns.Diagnostics.Backends.Log4Net.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class Log4NetLoggingBackendOptions : TextLoggingBackendOptions

The Log4NetLoggingBackendOptions type exposes the following members.

Constructors
 | Name | Description
Public method | Log4NetLoggingBackendOptions | Initializes a new instance of the Log4NetLoggingBackendOptions class
Top
Properties
 | Name | Description
Public property | ActionMaxLength | Max length of a log record. The default value is 2048. (Inherited from TextLoggingBackendOptions.)
Public property | AppendTrailingPeriod | Determines whether log messages should be ended with a trailing period. The default value is true because we really like trailing periods at PostSharp, but other opinions are valid. (Inherited from TextLoggingBackendOptions.)
Public property | ContextMaxLength | Max length of the Description property. (Inherited from LoggingBackendOptions.)
Public property | Delimiter | String used to separate different parts of the logging record. The default value is a pipe surrounded by spaces ( | ). (Inherited from TextLoggingBackendOptions.)
Public property | GetLogger | Function that returns a Log4Net ILog for a given Log4NetLoggingTypeSource. The default implementation is to call LogManager.GetLogger( backend.Repository.Name, typeSource.Role ).
Public property | IncludeExceptionDetails | Determines whether exception details (basically Exception.ToString) should be appended to the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeNamespace | Determines whether the full namespace of types should be included in the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeType | Determines whether the name of the type of the logged method should be included in the log. The default value is true. (Inherited from TextLoggingBackendOptions.)
Public property | IndentSpaces | Number of spaces for each indentation level. The default value is 2. (Inherited from TextLoggingBackendOptions.)
Public property | LogLevelIgnoredForSystemRecords | Determines whether the Level property is ignored by the current back-end for auto-generated (i.e. non-manual) logging records. Some back-ends may not support overriding the level of records. (Inherited from LoggingBackendOptions.)
Public property | ShouldLogExceptionPredicate | Gets or sets a predicate that determines whether an exception should be logged. This predicate is evaluated only when the method entry is not logged. When the method entry is logged, exceptions are always logged. (Inherited from TextLoggingBackendOptions.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Log4Net Namespace


Log4NetLoggingBackendOptions Constructor

Initializes a new instance of the Log4NetLoggingBackendOptions class

Namespace: PostSharp.Patterns.Diagnostics.Backends.Log4Net
Assembly: PostSharp.Patterns.Diagnostics.Backends.Log4Net (in PostSharp.Patterns.Diagnostics.Backends.Log4Net.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Log4NetLoggingBackendOptions()
See Also

Reference

Log4NetLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.Log4Net Namespace


Log4NetLoggingBackendOptions Properties

The Log4NetLoggingBackendOptions type exposes the following members.

Properties
 | Name | Description
Public property | ActionMaxLength | Max length of a log record. The default value is 2048. (Inherited from TextLoggingBackendOptions.)
Public property | AppendTrailingPeriod | Determines whether log messages should be ended with a trailing period. The default value is true because we really like trailing periods at PostSharp, but other opinions are valid. (Inherited from TextLoggingBackendOptions.)
Public property | ContextMaxLength | Max length of the Description property. (Inherited from LoggingBackendOptions.)
Public property | Delimiter | String used to separate different parts of the logging record. The default value is a pipe surrounded by spaces ( | ). (Inherited from TextLoggingBackendOptions.)
Public property | GetLogger | Function that returns a Log4Net ILog for a given Log4NetLoggingTypeSource. The default implementation is to call LogManager.GetLogger( backend.Repository.Name, typeSource.Role ).
Public property | IncludeExceptionDetails | Determines whether exception details (basically Exception.ToString) should be appended to the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeNamespace | Determines whether the full namespace of types should be included in the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeType | Determines whether the name of the type of the logged method should be included in the log. The default value is true. (Inherited from TextLoggingBackendOptions.)
Public property | IndentSpaces | Number of spaces for each indentation level. The default value is 2. (Inherited from TextLoggingBackendOptions.)
Public property | LogLevelIgnoredForSystemRecords | Determines whether the Level property is ignored by the current back-end for auto-generated (i.e. non-manual) logging records. Some back-ends may not support overriding the level of records. (Inherited from LoggingBackendOptions.)
Public property | ShouldLogExceptionPredicate | Gets or sets a predicate that determines whether an exception should be logged. This predicate is evaluated only when the method entry is not logged. When the method entry is logged, exceptions are always logged. (Inherited from TextLoggingBackendOptions.)
Top
See Also

Reference

Log4NetLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.Log4Net Namespace


Log4NetLoggingBackendOptions.GetLogger Property

Log4NetLoggingBackendOptionsGetLogger Property

Function that returns a Log4Net ILog for a given Log4NetLoggingTypeSource. The default implementation is to call LogManager.GetLogger( backend.Repository.Name, typeSource.Role ).

Namespace: PostSharp.Patterns.Diagnostics.Backends.Log4Net
Assembly: PostSharp.Patterns.Diagnostics.Backends.Log4Net (in PostSharp.Patterns.Diagnostics.Backends.Log4Net.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Func<Log4NetLoggingTypeSource, ILog> GetLogger { get; set; }

Property Value

Type: Func Log4NetLoggingTypeSource, ILog
See Also

Reference

Log4NetLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.Log4Net Namespace


Log4NetLoggingTypeSource Class

LoggingTypeSource for Log4NetLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
PostSharp.Patterns.DiagnosticsLoggingTypeSource
PostSharp.Patterns.Diagnostics.Backends.Log4NetLog4NetLoggingTypeSource

Namespace: PostSharp.Patterns.Diagnostics.Backends.Log4Net
Assembly: PostSharp.Patterns.Diagnostics.Backends.Log4Net (in PostSharp.Patterns.Diagnostics.Backends.Log4Net.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class Log4NetLoggingTypeSource : LoggingTypeSource

The Log4NetLoggingTypeSource type exposes the following members.

Constructors
 | Name | Description
Public method | Log4NetLoggingTypeSource | Initializes a new Log4NetLoggingTypeSource.
Top
Properties
 | Name | Description
Public property | Backend | Gets the parent LoggingBackend. (Inherited from LoggingNamespaceSource.)
Public property | DisplayFullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the DisplayFullName property does not include the arity, i.e. the full name of List<T> is System.Collections.Generic.List. (Inherited from LoggingNamespaceSource.)
Public property | DisplayName | Gets the last component of the name of the type or namespace, in the form that should be reported to the log. For generic types, the DisplayName property does not include the arity, i.e. the name of List<T> is List. (Inherited from LoggingNamespaceSource.)
Public property | FullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the FullName property includes the arity, i.e. the full name of List<T> is System.Collections.Generic.List`1. (Inherited from LoggingNamespaceSource.)
Public property | GenericParameterCount | Gets the number of generic parameters in SourceType. (Inherited from LoggingTypeSource.)
Public property | Level | Gets the minimal LogLevel for which logging is enabled for the current namespace or type. (Inherited from LoggingNamespaceSource.)
Public property | Name | Gets the last component of the name of the type or namespace. For instance, when FullName is PostSharp.Patterns.Diagnostics.LoggingBackend, Name is LoggingBackend. For generic types, the Name property includes the arity, i.e. the name of List<T> is List`1. (Inherited from LoggingNamespaceSource.)
Public property | Options | Gets the LoggingRoleConfiguration for the current role. This property is a shortcut to LoggingServices.Roles[this.Role]. (Inherited from LoggingTypeSource.)
Public property | Parent | Gets the parent LoggingNamespaceSource, or null if the current object represents the root namespace. (Inherited from LoggingNamespaceSource.)
Public property | Role | Gets the logging role for the current role. Typical values of this property are listed in the LoggingRoles class. (Inherited from LoggingNamespaceSource.)
Public property | SourceType | The type represented by the current LoggingTypeSource. (Inherited from LoggingTypeSource.)
Top
Methods
 | Name | Description
Protected method | IsBackendEnabled | Checks whether logging is enabled in the back-end for the given level. (Overrides LoggingTypeSourceIsBackendEnabled(LogLevel).)
Public method | IsEnabled | Determines whether logging is enabled for the given LogLevel. (Inherited from LoggingTypeSource.)
Public method | Refresh | Refreshes the logging level from the back-end from the current node and all children nodes. The back-end-defined logging level is cached for performance reasons. (Inherited from LoggingTypeSource.)
Public method | SetLevel | Sets the minimal LogLevel for which logging is enabled for the current namespace and type and all children namespaces and types. (Inherited from LoggingNamespaceSource.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Log4Net Namespace


Log4NetLoggingTypeSource Constructor

Initializes a new Log4NetLoggingTypeSource.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Log4Net
Assembly: PostSharp.Patterns.Diagnostics.Backends.Log4Net (in PostSharp.Patterns.Diagnostics.Backends.Log4Net.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Log4NetLoggingTypeSource(
    LoggingNamespaceSource parent,
    Type type
)

Parameters

parent
Type: PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
The parent LoggingNamespaceSource.
type
Type: SystemType
The source Type.
See Also

Reference

Log4NetLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.Log4Net Namespace


Log4NetLoggingTypeSource Properties

The Log4NetLoggingTypeSource type exposes the following members.

Properties
 | Name | Description
Public property | Backend | Gets the parent LoggingBackend. (Inherited from LoggingNamespaceSource.)
Public property | DisplayFullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the DisplayFullName property does not include the arity, i.e. the full name of List<T> is System.Collections.Generic.List. (Inherited from LoggingNamespaceSource.)
Public property | DisplayName | Gets the last component of the name of the type or namespace, in the form that should be reported to the log. For generic types, the DisplayName property does not include the arity, i.e. the name of List<T> is List. (Inherited from LoggingNamespaceSource.)
Public property | FullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the FullName property includes the arity, i.e. the full name of List<T> is System.Collections.Generic.List`1. (Inherited from LoggingNamespaceSource.)
Public property | GenericParameterCount | Gets the number of generic parameters in SourceType. (Inherited from LoggingTypeSource.)
Public property | Level | Gets the minimal LogLevel for which logging is enabled for the current namespace or type. (Inherited from LoggingNamespaceSource.)
Public property | Name | Gets the last component of the name of the type or namespace. For instance, when FullName is PostSharp.Patterns.Diagnostics.LoggingBackend, Name is LoggingBackend. For generic types, the Name property includes the arity, i.e. the name of List<T> is List`1. (Inherited from LoggingNamespaceSource.)
Public property | Options | Gets the LoggingRoleConfiguration for the current role. This property is a shortcut to LoggingServices.Roles[this.Role]. (Inherited from LoggingTypeSource.)
Public property | Parent | Gets the parent LoggingNamespaceSource, or null if the current object represents the root namespace. (Inherited from LoggingNamespaceSource.)
Public property | Role | Gets the logging role for the current role. Typical values of this property are listed in the LoggingRoles class. (Inherited from LoggingNamespaceSource.)
Public property | SourceType | The type represented by the current LoggingTypeSource. (Inherited from LoggingTypeSource.)
Top
See Also

Reference

Log4NetLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.Log4Net Namespace


Log4NetLoggingTypeSource Methods

The Log4NetLoggingTypeSource type exposes the following members.

Methods
 | Name | Description
Protected method | IsBackendEnabled | Checks whether logging is enabled in the back-end for the given level. (Overrides LoggingTypeSourceIsBackendEnabled(LogLevel).)
Public method | IsEnabled | Determines whether logging is enabled for the given LogLevel. (Inherited from LoggingTypeSource.)
Public method | Refresh | Refreshes the logging level from the back-end from the current node and all children nodes. The back-end-defined logging level is cached for performance reasons. (Inherited from LoggingTypeSource.)
Public method | SetLevel | Sets the minimal LogLevel for which logging is enabled for the current namespace and type and all children namespaces and types. (Inherited from LoggingNamespaceSource.)
Top
See Also

Reference

Log4NetLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.Log4Net Namespace


Log4NetLoggingTypeSource.IsBackendEnabled Method

Log4NetLoggingTypeSourceIsBackendEnabled Method

Checks whether logging is enabled in the back-end for the given level.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Log4Net
Assembly: PostSharp.Patterns.Diagnostics.Backends.Log4Net (in PostSharp.Patterns.Diagnostics.Backends.Log4Net.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override bool IsBackendEnabled(
    LogLevel level
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel

Return Value

Type: Boolean
Remarks

The result of this method is cached. To invalidate the cache, call the Refresh method.

See Also

Reference

Log4NetLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.Log4Net Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


Log4NetLogRecordBuilder Class

LogRecordBuilder for Log4NetLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.RecordBuildersLogRecordBuilder
PostSharp.Patterns.Diagnostics.RecordBuildersTextLogRecordBuilder
PostSharp.Patterns.Diagnostics.Backends.Log4NetLog4NetLogRecordBuilder

Namespace: PostSharp.Patterns.Diagnostics.Backends.Log4Net
Assembly: PostSharp.Patterns.Diagnostics.Backends.Log4Net (in PostSharp.Patterns.Diagnostics.Backends.Log4Net.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class Log4NetLogRecordBuilder : TextLogRecordBuilder

The Log4NetLogRecordBuilder type exposes the following members.

Constructors
 | Name | Description
Public method | Log4NetLogRecordBuilder | Initializes a new Log4NetLoggingBackend.
Top
Properties
 | Name | Description
Public property | Backend | Gets the parent back-end. (Inherited from TextLogRecordBuilder.)
Public property | BackendOptions | Shortcut for this.Backend.Options. (Inherited from TextLogRecordBuilder.)
Protected property | Context | Gets the LoggingContext to which the record belongs. (Inherited from LogRecordBuilder.)
Public property | Exception | Gets the Exception for the current record, or null if no exception is associated to the current record. (Inherited from TextLogRecordBuilder.)
Public property | IsDisposed | (Inherited from LogRecordBuilder.)
Protected property | Level | Gets the LogLevel for the current record. (Inherited from TextLogRecordBuilder.)
Public property | MemberName | Gets the name of the method, property or field for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Options | Gets the LoggingOptions for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Profile | Gets the LoggingProfile for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | RecordKind | Gets the kind of the current record (e.g. MethodEntry or MethodException). (Inherited from LogRecordBuilder.)
Public property | SourceLineInfo | Gets the SourceLineInfo for the current record. (Inherited from TextLogRecordBuilder.)
Public property | SourceType | Gets the source Type of the current record. (Inherited from TextLogRecordBuilder.)
Protected property | StringBuilder | Gets the current UnsafeStringBuilder where everything is being appended. (Inherited from TextLogRecordBuilder.)
Protected property | ThreadContext | Gets the ThreadLoggingContext to which the current LogRecordBuilder belongs. (Inherited from LogRecordBuilder.)
Protected property | TypeSource | Gets the LoggingTypeSource for the current record. (Inherited from TextLogRecordBuilder.)
Top
Methods
 | Name | Description
Protected method | AppendAsyncInfo | Appends information about the async method to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendClosingParenthesisConditional | Appends a closing parenthesis to the current StringBuilder if required. (Inherited from TextLogRecordBuilder.)
Protected method | AppendComma | (Inherited from TextLogRecordBuilder.)
Protected method | AppendCommaConditional | Appends a comma to the current StringBuilder, unless this method is invoked for the first time for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription | Appends the context Description (or the TypeSource name, if the type of the context is not equal to the source type of the record) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription(LoggingContext) | (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiter | Appends a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiterConditional | Appends a Delimiter to the current StringBuilder if the RequireDelimiter method has been called previously. (Inherited from TextLogRecordBuilder.)
Protected method | AppendEpilogue | Appends the final part of log message to StringBuilder. This includes state machine number and execution time where relevant, but does not include exception details. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExceptionDetails | Appends exception details to StringBuilder if IncludeExceptionDetails is set. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTime | Appends the execution time to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTimeThreshold | Appends the execution time threshold to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendIndentString | Appends indentation for the given to StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendMemberName | Appends name of the member for the current record (including the declaring type name, subject to the IncludeType property) to the current StringBuilder, as well as an opening parenthesis. (Inherited from TextLogRecordBuilder.)
Protected method | AppendOpeningParenthesis | Appends an opening parenthesis to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendProlog | Appends the indent string, context description, and the record kind to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendRecordKind | Appends the LogRecordKind of the current record to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameter(SemanticParameterKind, String, String, String, Int32) | Appends a parameter of String type to the current StringBuilder. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSourceLineInfo | Appends source (file, line) information to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpaces | Appends a given number of spaces to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpecialChar | Appends a special Char (which may require escaping with specific back-ends) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTrailingPeriod | Appends a trailing period (.) to the current StringBuilder, respecting the AppendTrailingPeriod property. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTypeName | Appends the name of the TypeSource to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | BeginCustomRecord | Initializes the current LogRecordBuilder to emit a custom record. (Inherited from TextLogRecordBuilder.)
Public method | BeginRecord | Initializes the current LogRecordBuilder to emit a standard (i.e. non-custom) record for a given context and method. (Inherited from TextLogRecordBuilder.)
Public method | Complete | Emits the record and resets the current LogRecordBuilder. This method invoked after all SetThisT(T), SetParameterT(Int32, String, ParameterKind, String, T) and similar methods have been called. (Inherited from LogRecordBuilder.)
Public method | Dispose | (Inherited from LogRecordBuilder.)
Protected method | EmitRecord | Emits the record. Invoked by the Complete method. (Inherited from TextLogRecordBuilder.)
Protected method | EmitRecord(Boolean) | Emits the record and specifies whether exception details should be appended to the text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescription | Ends building the context Description and starts building the action text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescriptionConditional | Switches between building the context Description and the action text. If the EndContextDescriptionConditional method has been previously invoked, subsequent calls are ignored. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescription | Obsolete. Gets the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescriptionUnsafe | Obsolete. Gets an UnsafeString representing the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextForDescription | Obsolete. Gets the LoggingContext that should be used when getting or appending the Description. (Inherited from TextLogRecordBuilder.)
Protected method | GetSourceName | Gets the name of the TypeSource for the current record, respecting the IncludeNamespace property. (Inherited from TextLogRecordBuilder.)
Protected method | HasRecordKindName | Determines whether the AppendRecordKind will append anything for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | MustBuildContextDescription | Determines whether the current Description should be appended to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | RequireComma | Makes the AppendCommaConditional to append a comma even if it's invoked for the first time. (Inherited from TextLogRecordBuilder.)
Protected method | RequireDelimiter | Causes the next call to the AppendDelimiterConditional to append a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | Reset | Resets all fields and properties of the current LogRecordBuilder to their initial value. Invoked by the Complete method. (Inherited from TextLogRecordBuilder.)
Public method | SetException | Sets the exception for the method or activity. (Inherited from TextLogRecordBuilder.)
Public method | SetExecutionTime | Sets the method or activity execution time. (Inherited from TextLogRecordBuilder.)
Public method | SetMethodGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T) | Sets the value of a given parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from TextLogRecordBuilder.)
Public method | SetRefStructParameter | (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T) | Sets a given return value (there can be several return values in C# 7.0) and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetThisT(T) | Sets the this (instance) value and uses the default formatter. This method is only invoked if the IncludeThisValue property is true. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetTypeGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Protected method | ShouldLogExceptionDetails | Determines whether exception details should be appended to the text of the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | ToString | Returns a string that represents the current object. (Inherited from TextLogRecordBuilder.)
Protected method | Write | Writes the final message to the back-end. (Overrides TextLogRecordBuilderWrite(UnsafeString).)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T) | Writes a custom parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | WriteCustomString | Write a chunk of custom string. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Log4Net Namespace


Log4NetLogRecordBuilder Constructor

Initializes a new Log4NetLoggingBackend.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Log4Net
Assembly: PostSharp.Patterns.Diagnostics.Backends.Log4Net (in PostSharp.Patterns.Diagnostics.Backends.Log4Net.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Log4NetLogRecordBuilder(
    Log4NetLoggingBackend backend
)

Parameters

backend
Type: PostSharp.Patterns.Diagnostics.Backends.Log4NetLog4NetLoggingBackend
The parent Log4NetLoggingBackend.
See Also

Reference

Log4NetLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Log4Net Namespace


Log4NetLogRecordBuilder Properties

The Log4NetLogRecordBuilder type exposes the following members.

Properties
 | Name | Description
Public property | Backend | Gets the parent back-end. (Inherited from TextLogRecordBuilder.)
Public property | BackendOptions | Shortcut for this.Backend.Options. (Inherited from TextLogRecordBuilder.)
Protected property | Context | Gets the LoggingContext to which the record belongs. (Inherited from LogRecordBuilder.)
Public property | Exception | Gets the Exception for the current record, or null if no exception is associated to the current record. (Inherited from TextLogRecordBuilder.)
Public property | IsDisposed | (Inherited from LogRecordBuilder.)
Protected property | Level | Gets the LogLevel for the current record. (Inherited from TextLogRecordBuilder.)
Public property | MemberName | Gets the name of the method, property or field for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Options | Gets the LoggingOptions for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Profile | Gets the LoggingProfile for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | RecordKind | Gets the kind of the current record (e.g. MethodEntry or MethodException). (Inherited from LogRecordBuilder.)
Public property | SourceLineInfo | Gets the SourceLineInfo for the current record. (Inherited from TextLogRecordBuilder.)
Public property | SourceType | Gets the source Type of the current record. (Inherited from TextLogRecordBuilder.)
Protected property | StringBuilder | Gets the current UnsafeStringBuilder where everything is being appended. (Inherited from TextLogRecordBuilder.)
Protected property | ThreadContext | Gets the ThreadLoggingContext to which the current LogRecordBuilder belongs. (Inherited from LogRecordBuilder.)
Protected property | TypeSource | Gets the LoggingTypeSource for the current record. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

Log4NetLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Log4Net Namespace


Log4NetLogRecordBuilder Methods

The Log4NetLogRecordBuilder type exposes the following members.

Methods
 | Name | Description
Protected method | AppendAsyncInfo | Appends information about the async method to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendClosingParenthesisConditional | Appends a closing parenthesis to the current StringBuilder if required. (Inherited from TextLogRecordBuilder.)
Protected method | AppendComma | (Inherited from TextLogRecordBuilder.)
Protected method | AppendCommaConditional | Appends a comma to the current StringBuilder, unless this method is invoked for the first time for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription | Appends the context Description (or the TypeSource name, if the type of the context is not equal to the source type of the record) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription(LoggingContext) | (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiter | Appends a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiterConditional | Appends a Delimiter to the current StringBuilder if the RequireDelimiter method has been called previously. (Inherited from TextLogRecordBuilder.)
Protected method | AppendEpilogue | Appends the final part of log message to StringBuilder. This includes state machine number and execution time where relevant, but does not include exception details. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExceptionDetails | Appends exception details to StringBuilder if IncludeExceptionDetails is set. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTime | Appends the execution time to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTimeThreshold | Appends the execution time threshold to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendIndentString | Appends indentation for the given to StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendMemberName | Appends name of the member for the current record (including the declaring type name, subject to the IncludeType property) to the current StringBuilder, as well as an opening parenthesis. (Inherited from TextLogRecordBuilder.)
Protected method | AppendOpeningParenthesis | Appends an opening parenthesis to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendProlog | Appends the indent string, context description, and the record kind to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendRecordKind | Appends the LogRecordKind of the current record to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameter(SemanticParameterKind, String, String, String, Int32) | Appends a parameter of String type to the current StringBuilder. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSourceLineInfo | Appends source (file, line) information to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpaces | Appends a given number of spaces to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpecialChar | Appends a special Char (which may require escaping with specific back-ends) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTrailingPeriod | Appends a trailing period (.) to the current StringBuilder, respecting the AppendTrailingPeriod property. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTypeName | Appends the name of the TypeSource to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | BeginCustomRecord | Initializes the current LogRecordBuilder to emit a custom record. (Inherited from TextLogRecordBuilder.)
Public method | BeginRecord | Initializes the current LogRecordBuilder to emit a standard (i.e. non-custom) record for a given context and method. (Inherited from TextLogRecordBuilder.)
Public method | Complete | Emits the record and resets the current LogRecordBuilder. This method invoked after all SetThisT(T), SetParameterT(Int32, String, ParameterKind, String, T) and similar methods have been called. (Inherited from LogRecordBuilder.)
Public method | Dispose | (Inherited from LogRecordBuilder.)
Protected method | EmitRecord | Emits the record. Invoked by the Complete method. (Inherited from TextLogRecordBuilder.)
Protected method | EmitRecord(Boolean) | Emits the record and specifies whether exception details should be appended to the text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescription | Ends building the context Description and starts building the action text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescriptionConditional | Switches between building the context Description and the action text. If the EndContextDescriptionConditional method has been previously invoked, subsequent calls are ignored. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescription | Obsolete. Gets the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescriptionUnsafe | Obsolete. Gets an UnsafeString representing the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextForDescription | Obsolete. Gets the LoggingContext that should be used when getting or appending the Description. (Inherited from TextLogRecordBuilder.)
Protected method | GetSourceName | Gets the name of the TypeSource for the current record, respecting the IncludeNamespace property. (Inherited from TextLogRecordBuilder.)
Protected method | HasRecordKindName | Determines whether the AppendRecordKind will append anything for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | MustBuildContextDescription | Determines whether the current Description should be appended to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | RequireComma | Makes the AppendCommaConditional to append a comma even if it's invoked for the first time. (Inherited from TextLogRecordBuilder.)
Protected method | RequireDelimiter | Causes the next call to the AppendDelimiterConditional to append a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | Reset | Resets all fields and properties of the current LogRecordBuilder to their initial value. Invoked by the Complete method. (Inherited from TextLogRecordBuilder.)
Public method | SetException | Sets the exception for the method or activity. (Inherited from TextLogRecordBuilder.)
Public method | SetExecutionTime | Sets the method or activity execution time. (Inherited from TextLogRecordBuilder.)
Public method | SetMethodGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T) | Sets the value of a given parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from TextLogRecordBuilder.)
Public method | SetRefStructParameter | (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T) | Sets a given return value (there can be several return values in C# 7.0) and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetThisT(T) | Sets the this (instance) value and uses the default formatter. This method is only invoked if the IncludeThisValue property is true. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetTypeGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Protected method | ShouldLogExceptionDetails | Determines whether exception details should be appended to the text of the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | ToString | Returns a string that represents the current object. (Inherited from TextLogRecordBuilder.)
Protected method | Write | Writes the final message to the back-end. (Overrides TextLogRecordBuilderWrite(UnsafeString).)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T) | Writes a custom parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | WriteCustomString | Write a chunk of custom string. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

Log4NetLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Log4Net Namespace


Log4NetLogRecordBuilder.Write Method

Log4NetLogRecordBuilderWrite Method

Writes the final message to the back-end.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Log4Net
Assembly: PostSharp.Patterns.Diagnostics.Backends.Log4Net (in PostSharp.Patterns.Diagnostics.Backends.Log4Net.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void Write(
    UnsafeString message
)

Parameters

message
Type: PostSharp.Patterns.FormattersUnsafeString
The final message.
See Also

Reference

Log4NetLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Log4Net Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


PostSharp.Patterns.Diagnostics.Backends.Loupe Namespace

Classes
 | Class | Description
Public class | LoupeLoggingBackend | Logging back-end for Loupe.
Public class | LoupeLoggingBackendOptions | Options for LoupeLoggingBackend.
Public class | LoupeLoggingTypeSource | LoggingTypeSource for LoupeLoggingBackend.
Public class | LoupeLogRecordBuilder | LogRecordBuilder for LoupeLoggingBackend.


LoupeLoggingBackend Class

Logging back-end for Loupe.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingBackend
PostSharp.Patterns.Diagnostics.BackendsTextLoggingBackend
PostSharp.Patterns.Diagnostics.Backends.LoupeLoupeLoggingBackend

Namespace: PostSharp.Patterns.Diagnostics.Backends.Loupe
Assembly: PostSharp.Patterns.Diagnostics.Backends.Loupe (in PostSharp.Patterns.Diagnostics.Backends.Loupe.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
Copy
public class LoupeLoggingBackend : TextLoggingBackend

The LoupeLoggingBackend type exposes the following members.

Constructors
 | Name | Description
Public method | LoupeLoggingBackend | Initializes a new instance of the LoupeLoggingBackend class
Top
Properties
 | Name | Description
Public property | CurrentContext | Gets the current LoggingContext. (Inherited from LoggingBackend.)
Public property | IsCorrupted | (Inherited from LoggingBackend.)
Public property | IsDisposed | Determines whether the current LoggingBackend has been disposed. (Inherited from LoggingBackend.)
Public property | IsEnabled | Determines whether the current LoggingBackend is currently enabled. This property has precedence over, and does not affect, the minimal log levels set through the SetLevel(LogLevel) method. (Inherited from LoggingBackend.)
Public property | Options |
Top
Methods
 | Name | Description
Protected method | CreateAsyncCustomActivityContext | Creates a new AsyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateAsyncMethodContext | Creates a new AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Protected method | CreateEphemeralContext | Creates a new EphemeralLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateIteratorContext | Creates a new IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | CreateRecordBuilder | Creates a new LogRecordBuilder. (Overrides LoggingBackendCreateRecordBuilder.)
Protected method | CreateSyncCustomActivityContext | Creates a new SyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateSyncMethodContext | Creates a new SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Protected method | CreateThreadContext | Creates a new ThreadLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateTypeSource | Creates LoggingTypeSource for the given role and type. (Overrides LoggingBackendCreateTypeSource(LoggingNamespaceSource, Type).)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingBackend.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from TextLoggingBackend.)
Public method | GetAsyncContextOfTask | Gets the AsyncMethodLoggingContext associated with a Task. (Inherited from LoggingBackend.)
Protected method | GetBackendOptions | Gets the formatting and rendering options for the current LoggingBackend. (Inherited from TextLoggingBackend.)
Public method | GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace. (Inherited from LoggingBackend.)
Public method | GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type. (Inherited from LoggingBackend.)
Protected method | GetTextBackendOptions | Gets the options. (Overrides TextLoggingBackendGetTextBackendOptions.)
Public method | GetThreadContext | Returns the ThreadLoggingContext for the current Thread. (Inherited from LoggingBackend.)
Public method | OpenAsyncContext | Gets an AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Public method | OpenCustomActivityContext | Gets a LoggingContext for a custom activity (opened using OpenActivity(String) or OpenAsyncActivity(String)). (Inherited from LoggingBackend.)
Public method | OpenEphemeralContext | Gets an EphemeralLoggingContext for use in a given method. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record. (Inherited from LoggingBackend.)
Public method | OpenIteratorContext | Gets an IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | OpenSyncContext | Gets a SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Loupe Namespace

Other Resources

Conceptual: Adding Detailed Logging to your Solution
Conceptual: Logging to Loupe


LoupeLoggingBackend Constructor

Initializes a new instance of the LoupeLoggingBackend class

Namespace: PostSharp.Patterns.Diagnostics.Backends.Loupe
Assembly: PostSharp.Patterns.Diagnostics.Backends.Loupe (in PostSharp.Patterns.Diagnostics.Backends.Loupe.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
Copy
public LoupeLoggingBackend()
See Also

Reference

LoupeLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Loupe Namespace


LoupeLoggingBackend Properties

The LoupeLoggingBackend type exposes the following members.

Properties
 | Name | Description
Public property | CurrentContext | Gets the current LoggingContext. (Inherited from LoggingBackend.)
Public property | IsCorrupted | (Inherited from LoggingBackend.)
Public property | IsDisposed | Determines whether the current LoggingBackend has been disposed. (Inherited from LoggingBackend.)
Public property | IsEnabled | Determines whether the current LoggingBackend is currently enabled. This property has precedence over, and does not affect, the minimal log levels set through the SetLevel(LogLevel) method. (Inherited from LoggingBackend.)
Public property | Options |
Top
See Also

Reference

LoupeLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Loupe Namespace


LoupeLoggingBackend.Options Property

LoupeLoggingBackendOptions Property

Namespace: PostSharp.Patterns.Diagnostics.Backends.Loupe
Assembly: PostSharp.Patterns.Diagnostics.Backends.Loupe (in PostSharp.Patterns.Diagnostics.Backends.Loupe.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
Copy
public LoupeLoggingBackendOptions Options { get; }

Property Value

Type: LoupeLoggingBackendOptions
See Also

Reference

LoupeLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Loupe Namespace


LoupeLoggingBackend Methods

The LoupeLoggingBackend type exposes the following members.

Methods
 | Name | Description
Protected method | CreateAsyncCustomActivityContext | Creates a new AsyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateAsyncMethodContext | Creates a new AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Protected method | CreateEphemeralContext | Creates a new EphemeralLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateIteratorContext | Creates a new IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | CreateRecordBuilder | Creates a new LogRecordBuilder. (Overrides LoggingBackendCreateRecordBuilder.)
Protected method | CreateSyncCustomActivityContext | Creates a new SyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateSyncMethodContext | Creates a new SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Protected method | CreateThreadContext | Creates a new ThreadLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateTypeSource | Creates LoggingTypeSource for the given role and type. (Overrides LoggingBackendCreateTypeSource(LoggingNamespaceSource, Type).)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingBackend.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from TextLoggingBackend.)
Public method | GetAsyncContextOfTask | Gets the AsyncMethodLoggingContext associated with a Task. (Inherited from LoggingBackend.)
Protected method | GetBackendOptions | Gets the formatting and rendering options for the current LoggingBackend. (Inherited from TextLoggingBackend.)
Public method | GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace. (Inherited from LoggingBackend.)
Public method | GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type. (Inherited from LoggingBackend.)
Protected method | GetTextBackendOptions | Gets the options. (Overrides TextLoggingBackendGetTextBackendOptions.)
Public method | GetThreadContext | Returns the ThreadLoggingContext for the current Thread. (Inherited from LoggingBackend.)
Public method | OpenAsyncContext | Gets an AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Public method | OpenCustomActivityContext | Gets a LoggingContext for a custom activity (opened using OpenActivity(String) or OpenAsyncActivity(String)). (Inherited from LoggingBackend.)
Public method | OpenEphemeralContext | Gets an EphemeralLoggingContext for use in a given method. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record. (Inherited from LoggingBackend.)
Public method | OpenIteratorContext | Gets an IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | OpenSyncContext | Gets a SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Top
See Also

Reference

LoupeLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Loupe Namespace


LoupeLoggingBackend.CreateRecordBuilder Method

LoupeLoggingBackendCreateRecordBuilder Method

Creates a new LogRecordBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Loupe
Assembly: PostSharp.Patterns.Diagnostics.Backends.Loupe (in PostSharp.Patterns.Diagnostics.Backends.Loupe.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
Copy
public override LogRecordBuilder CreateRecordBuilder()

Return Value

Type: LogRecordBuilder
A new LogRecordBuilder.
See Also

Reference

LoupeLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Loupe Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


LoupeLoggingBackend.CreateTypeSource Method

LoupeLoggingBackendCreateTypeSource Method

Creates LoggingTypeSource for the given role and type.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Loupe
Assembly: PostSharp.Patterns.Diagnostics.Backends.Loupe (in PostSharp.Patterns.Diagnostics.Backends.Loupe.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
Copy
protected override LoggingTypeSource CreateTypeSource(
    LoggingNamespaceSource parent,
    Type type
)

Parameters

parent
Type: PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
type
Type: SystemType

Return Value

Type: LoggingTypeSource
See Also

Reference

LoupeLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Loupe Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


LoupeLoggingBackend.GetTextBackendOptions Method

LoupeLoggingBackendGetTextBackendOptions Method

Gets the options.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Loupe
Assembly: PostSharp.Patterns.Diagnostics.Backends.Loupe (in PostSharp.Patterns.Diagnostics.Backends.Loupe.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
Copy
protected override TextLoggingBackendOptions GetTextBackendOptions()

Return Value

Type: TextLoggingBackendOptions
See Also

Reference

LoupeLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Loupe Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


LoupeLoggingBackendOptions Class

Options for LoupeLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingBackendOptions
PostSharp.Patterns.Diagnostics.BackendsTextLoggingBackendOptions
PostSharp.Patterns.Diagnostics.Backends.LoupeLoupeLoggingBackendOptions

Namespace: PostSharp.Patterns.Diagnostics.Backends.Loupe
Assembly: PostSharp.Patterns.Diagnostics.Backends.Loupe (in PostSharp.Patterns.Diagnostics.Backends.Loupe.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
Copy
public class LoupeLoggingBackendOptions : TextLoggingBackendOptions

The LoupeLoggingBackendOptions type exposes the following members.

Constructors
 | Name | Description
Public method | LoupeLoggingBackendOptions | Initializes a new instance of the LoupeLoggingBackendOptions class
Top
Properties
 | Name | Description
Public property | ActionMaxLength | Max length of a log record. The default value is 2048. (Inherited from TextLoggingBackendOptions.)
Public property | AppendTrailingPeriod | Determines whether log messages should be ended with a trailing period. The default value is true because we really like trailing periods at PostSharp, but other opinions are valid. (Inherited from TextLoggingBackendOptions.)
Public property | ContextMaxLength | Max length of the Description property. (Inherited from LoggingBackendOptions.)
Public property | Delimiter | String used to separate different parts of the logging record. The default value is a pipe surrounded by spaces ( | ). (Inherited from TextLoggingBackendOptions.)
Public property | IncludeExceptionDetails | Determines whether exception details (basically Exception.ToString) should be appended to the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeNamespace | Determines whether the full namespace of types should be included in the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeType | Determines whether the name of the type of the logged method should be included in the log. The default value is true. (Inherited from TextLoggingBackendOptions.)
Public property | IndentSpaces | Number of spaces for each indentation level. The default value is 2. (Inherited from TextLoggingBackendOptions.)
Public property | LogLevelIgnoredForSystemRecords | Determines whether the Level property is ignored by the current back-end for auto-generated (i.e. non-manual) logging records. Some back-ends may not support overriding the level of records. (Inherited from LoggingBackendOptions.)
Public property | ShouldLogExceptionPredicate | Gets or sets a predicate that determines whether an exception should be logged. This predicate is evaluated only when the method entry is not logged. When the method entry is logged, exceptions are always logged. (Inherited from TextLoggingBackendOptions.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Loupe Namespace


LoupeLoggingBackendOptions Constructor

Initializes a new instance of the LoupeLoggingBackendOptions class

Namespace: PostSharp.Patterns.Diagnostics.Backends.Loupe
Assembly: PostSharp.Patterns.Diagnostics.Backends.Loupe (in PostSharp.Patterns.Diagnostics.Backends.Loupe.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
Copy
public LoupeLoggingBackendOptions()
See Also

Reference

LoupeLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.Loupe Namespace


LoupeLoggingBackendOptions Properties

The LoupeLoggingBackendOptions type exposes the following members.

Properties
 | Name | Description
Public property | ActionMaxLength | Max length of a log record. The default value is 2048. (Inherited from TextLoggingBackendOptions.)
Public property | AppendTrailingPeriod | Determines whether log messages should be ended with a trailing period. The default value is true because we really like trailing periods at PostSharp, but other opinions are valid. (Inherited from TextLoggingBackendOptions.)
Public property | ContextMaxLength | Max length of the Description property. (Inherited from LoggingBackendOptions.)
Public property | Delimiter | String used to separate different parts of the logging record. The default value is a pipe surrounded by spaces ( | ). (Inherited from TextLoggingBackendOptions.)
Public property | IncludeExceptionDetails | Determines whether exception details (basically Exception.ToString) should be appended to the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeNamespace | Determines whether the full namespace of types should be included in the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeType | Determines whether the name of the type of the logged method should be included in the log. The default value is true. (Inherited from TextLoggingBackendOptions.)
Public property | IndentSpaces | Number of spaces for each indentation level. The default value is 2. (Inherited from TextLoggingBackendOptions.)
Public property | LogLevelIgnoredForSystemRecords | Determines whether the Level property is ignored by the current back-end for auto-generated (i.e. non-manual) logging records. Some back-ends may not support overriding the level of records. (Inherited from LoggingBackendOptions.)
Public property | ShouldLogExceptionPredicate | Gets or sets a predicate that determines whether an exception should be logged. This predicate is evaluated only when the method entry is not logged. When the method entry is logged, exceptions are always logged. (Inherited from TextLoggingBackendOptions.)
Top
See Also

Reference

LoupeLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.Loupe Namespace


LoupeLoggingTypeSource Class

LoggingTypeSource for LoupeLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
PostSharp.Patterns.DiagnosticsLoggingTypeSource
PostSharp.Patterns.Diagnostics.Backends.LoupeLoupeLoggingTypeSource

Namespace: PostSharp.Patterns.Diagnostics.Backends.Loupe
Assembly: PostSharp.Patterns.Diagnostics.Backends.Loupe (in PostSharp.Patterns.Diagnostics.Backends.Loupe.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
Copy
public class LoupeLoggingTypeSource : LoggingTypeSource

The LoupeLoggingTypeSource type exposes the following members.

Constructors
 | Name | Description
Public method | LoupeLoggingTypeSource | Initializes a new LoupeLoggingTypeSource.
Top
Properties
 | Name | Description
Public property | Backend | Gets the parent LoggingBackend. (Inherited from LoggingNamespaceSource.)
Public property | DisplayFullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the DisplayFullName property does not include the arity, i.e. the full name of List<T> is System.Collections.Generic.List. (Inherited from LoggingNamespaceSource.)
Public property | DisplayName | Gets the last component of the name of the type or namespace, in the form that should be reported to the log. For generic types, the DisplayName property does not include the arity, i.e. the name of List<T> is List. (Inherited from LoggingNamespaceSource.)
Public property | FullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the FullName property includes the arity, i.e. the full name of List<T> is System.Collections.Generic.List`1. (Inherited from LoggingNamespaceSource.)
Public property | GenericParameterCount | Gets the number of generic parameters in SourceType. (Inherited from LoggingTypeSource.)
Public property | Level | Gets the minimal LogLevel for which logging is enabled for the current namespace or type. (Inherited from LoggingNamespaceSource.)
Public property | Name | Gets the last component of the name of the type or namespace. For instance, when FullName is PostSharp.Patterns.Diagnostics.LoggingBackend, Name is LoggingBackend. For generic types, the Name property includes the arity, i.e. the name of List<T> is List`1. (Inherited from LoggingNamespaceSource.)
Public property | Options | Gets the LoggingRoleConfiguration for the current role. This property is a shortcut to LoggingServices.Roles[this.Role]. (Inherited from LoggingTypeSource.)
Public property | Parent | Gets the parent LoggingNamespaceSource, or null if the current object represents the root namespace. (Inherited from LoggingNamespaceSource.)
Public property | Role | Gets the logging role for the current role. Typical values of this property are listed in the LoggingRoles class. (Inherited from LoggingNamespaceSource.)
Public property | SourceType | The type represented by the current LoggingTypeSource. (Inherited from LoggingTypeSource.)
Top
Methods
 | Name | Description
Protected method | IsBackendEnabled | Checks whether logging is enabled in the back-end for the given level. (Overrides LoggingTypeSourceIsBackendEnabled(LogLevel).)
Public method | IsEnabled | Determines whether logging is enabled for the given LogLevel. (Inherited from LoggingTypeSource.)
Public method | Refresh | Refreshes the logging level from the back-end from the current node and all children nodes. The back-end-defined logging level is cached for performance reasons. (Inherited from LoggingTypeSource.)
Public method | SetLevel | Sets the minimal LogLevel for which logging is enabled for the current namespace and type and all children namespaces and types. (Inherited from LoggingNamespaceSource.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Loupe Namespace


LoupeLoggingTypeSource Constructor

Initializes a new LoupeLoggingTypeSource.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Loupe
Assembly: PostSharp.Patterns.Diagnostics.Backends.Loupe (in PostSharp.Patterns.Diagnostics.Backends.Loupe.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
Copy
public LoupeLoggingTypeSource(
    LoggingNamespaceSource parent,
    Type type
)

Parameters

parent
Type: PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
The parent LoggingNamespaceSource.
type
Type: SystemType
The source Type.
See Also

Reference

LoupeLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.Loupe Namespace


LoupeLoggingTypeSource Properties

The LoupeLoggingTypeSource type exposes the following members.

Properties
 | Name | Description
Public property | Backend | Gets the parent LoggingBackend. (Inherited from LoggingNamespaceSource.)
Public property | DisplayFullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the DisplayFullName property does not include the arity, i.e. the full name of List<T> is System.Collections.Generic.List. (Inherited from LoggingNamespaceSource.)
Public property | DisplayName | Gets the last component of the name of the type or namespace, in the form that should be reported to the log. For generic types, the DisplayName property does not include the arity, i.e. the name of List<T> is List. (Inherited from LoggingNamespaceSource.)
Public property | FullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the FullName property includes the arity, i.e. the full name of List<T> is System.Collections.Generic.List`1. (Inherited from LoggingNamespaceSource.)
Public property | GenericParameterCount | Gets the number of generic parameters in SourceType. (Inherited from LoggingTypeSource.)
Public property | Level | Gets the minimal LogLevel for which logging is enabled for the current namespace or type. (Inherited from LoggingNamespaceSource.)
Public property | Name | Gets the last component of the name of the type or namespace. For instance, when FullName is PostSharp.Patterns.Diagnostics.LoggingBackend, Name is LoggingBackend. For generic types, the Name property includes the arity, i.e. the name of List<T> is List`1. (Inherited from LoggingNamespaceSource.)
Public property | Options | Gets the LoggingRoleConfiguration for the current role. This property is a shortcut to LoggingServices.Roles[this.Role]. (Inherited from LoggingTypeSource.)
Public property | Parent | Gets the parent LoggingNamespaceSource, or null if the current object represents the root namespace. (Inherited from LoggingNamespaceSource.)
Public property | Role | Gets the logging role for the current role. Typical values of this property are listed in the LoggingRoles class. (Inherited from LoggingNamespaceSource.)
Public property | SourceType | The type represented by the current LoggingTypeSource. (Inherited from LoggingTypeSource.)
Top
See Also

Reference

LoupeLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.Loupe Namespace


LoupeLoggingTypeSource Methods

The LoupeLoggingTypeSource type exposes the following members.

Methods
 | Name | Description
Protected method | IsBackendEnabled | Checks whether logging is enabled in the back-end for the given level. (Overrides LoggingTypeSourceIsBackendEnabled(LogLevel).)
Public method | IsEnabled | Determines whether logging is enabled for the given LogLevel. (Inherited from LoggingTypeSource.)
Public method | Refresh | Refreshes the logging level from the back-end from the current node and all children nodes. The back-end-defined logging level is cached for performance reasons. (Inherited from LoggingTypeSource.)
Public method | SetLevel | Sets the minimal LogLevel for which logging is enabled for the current namespace and type and all children namespaces and types. (Inherited from LoggingNamespaceSource.)
Top
See Also

Reference

LoupeLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.Loupe Namespace


LoupeLoggingTypeSource.IsBackendEnabled Method

LoupeLoggingTypeSourceIsBackendEnabled Method

Checks whether logging is enabled in the back-end for the given level.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Loupe
Assembly: PostSharp.Patterns.Diagnostics.Backends.Loupe (in PostSharp.Patterns.Diagnostics.Backends.Loupe.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
Copy
protected override bool IsBackendEnabled(
    LogLevel level
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel

Return Value

Type: Boolean
Remarks

The result of this method is cached. To invalidate the cache, call the Refresh method.

See Also

Reference

LoupeLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.Loupe Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


LoupeLogRecordBuilder Class

LogRecordBuilder for LoupeLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.RecordBuildersLogRecordBuilder
PostSharp.Patterns.Diagnostics.RecordBuildersTextLogRecordBuilder
PostSharp.Patterns.Diagnostics.Backends.LoupeLoupeLogRecordBuilder

Namespace: PostSharp.Patterns.Diagnostics.Backends.Loupe
Assembly: PostSharp.Patterns.Diagnostics.Backends.Loupe (in PostSharp.Patterns.Diagnostics.Backends.Loupe.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
Copy
public class LoupeLogRecordBuilder : TextLogRecordBuilder,
    IMessageSourceProvider

The LoupeLogRecordBuilder type exposes the following members.

Constructors
 | Name | Description
Public method | LoupeLogRecordBuilder | Initializes a new LoupeLogRecordBuilder.
Top
Properties
 | Name | Description
Public property | Backend | Gets the parent back-end. (Inherited from TextLogRecordBuilder.)
Public property | BackendOptions | Shortcut for this.Backend.Options. (Inherited from TextLogRecordBuilder.)
Protected property | Context | Gets the LoggingContext to which the record belongs. (Inherited from LogRecordBuilder.)
Public property | Exception | Gets the Exception for the current record, or null if no exception is associated to the current record. (Inherited from TextLogRecordBuilder.)
Public property | IsDisposed | (Inherited from LogRecordBuilder.)
Protected property | Level | Gets the LogLevel for the current record. (Inherited from TextLogRecordBuilder.)
Public property | MemberName | Gets the name of the method, property or field for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Options | Gets the LoggingOptions for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Profile | Gets the LoggingProfile for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | RecordKind | Gets the kind of the current record (e.g. MethodEntry or MethodException). (Inherited from LogRecordBuilder.)
Public property | SourceLineInfo | Gets the SourceLineInfo for the current record. (Inherited from TextLogRecordBuilder.)
Public property | SourceType | Gets the source Type of the current record. (Inherited from TextLogRecordBuilder.)
Protected property | StringBuilder | Gets the current UnsafeStringBuilder where everything is being appended. (Inherited from TextLogRecordBuilder.)
Protected property | ThreadContext | Gets the ThreadLoggingContext to which the current LogRecordBuilder belongs. (Inherited from LogRecordBuilder.)
Protected property | TypeSource | Gets the LoggingTypeSource for the current record. (Inherited from TextLogRecordBuilder.)
Top
Methods
 | Name | Description
Protected method | AppendAsyncInfo | Appends information about the async method to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendClosingParenthesisConditional | Appends a closing parenthesis to the current StringBuilder if required. (Inherited from TextLogRecordBuilder.)
Protected method | AppendComma | (Inherited from TextLogRecordBuilder.)
Protected method | AppendCommaConditional | Appends a comma to the current StringBuilder, unless this method is invoked for the first time for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription | Appends the context Description (or the TypeSource name, if the type of the context is not equal to the source type of the record) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription(LoggingContext) | (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiter | Appends a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiterConditional | Appends a Delimiter to the current StringBuilder if the RequireDelimiter method has been called previously. (Inherited from TextLogRecordBuilder.)
Protected method | AppendEpilogue | Appends the final part of log message to StringBuilder. This includes state machine number and execution time where relevant, but does not include exception details. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExceptionDetails | Appends exception details to StringBuilder if IncludeExceptionDetails is set. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTime | Appends the execution time to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTimeThreshold | Appends the execution time threshold to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendIndentString | Appends indentation for the given to StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendMemberName | Appends name of the member for the current record (including the declaring type name, subject to the IncludeType property) to the current StringBuilder, as well as an opening parenthesis. (Inherited from TextLogRecordBuilder.)
Protected method | AppendOpeningParenthesis | Appends an opening parenthesis to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendProlog | Appends the indent string, context description, and the record kind to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendRecordKind | Appends the LogRecordKind of the current record to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameter(SemanticParameterKind, String, String, String, Int32) | Appends a parameter of String type to the current StringBuilder. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSourceLineInfo | Appends source (file, line) information to the current StringBuilder. (Overrides TextLogRecordBuilderAppendSourceLineInfo.)
Protected method | AppendSpaces | Appends a given number of spaces to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpecialChar | Appends a special Char (which may require escaping with specific back-ends) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTrailingPeriod | Appends a trailing period (.) to the current StringBuilder, respecting the AppendTrailingPeriod property. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTypeName | Appends the name of the TypeSource to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | BeginCustomRecord | Initializes the current LogRecordBuilder to emit a custom record. (Inherited from TextLogRecordBuilder.)
Public method | BeginRecord | Initializes the current LogRecordBuilder to emit a standard (i.e. non-custom) record for a given context and method. (Inherited from TextLogRecordBuilder.)
Public method | Complete | Emits the record and resets the current LogRecordBuilder. This method invoked after all SetThisT(T), SetParameterT(Int32, String, ParameterKind, String, T) and similar methods have been called. (Inherited from LogRecordBuilder.)
Public method | Dispose | (Inherited from LogRecordBuilder.)
Protected method | EmitRecord | Emits the record. Invoked by the Complete method. (Inherited from TextLogRecordBuilder.)
Protected method | EmitRecord(Boolean) | Emits the record and specifies whether exception details should be appended to the text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescription | Ends building the context Description and starts building the action text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescriptionConditional | Switches between building the context Description and the action text. If the EndContextDescriptionConditional method has been previously invoked, subsequent calls are ignored. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescription | Obsolete. Gets the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescriptionUnsafe | Obsolete. Gets an UnsafeString representing the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextForDescription | Obsolete. Gets the LoggingContext that should be used when getting or appending the Description. (Inherited from TextLogRecordBuilder.)
Protected method | GetSourceName | Gets the name of the TypeSource for the current record, respecting the IncludeNamespace property. (Inherited from TextLogRecordBuilder.)
Protected method | HasRecordKindName | Determines whether the AppendRecordKind will append anything for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | MustBuildContextDescription | Determines whether the current Description should be appended to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | RequireComma | Makes the AppendCommaConditional to append a comma even if it's invoked for the first time. (Inherited from TextLogRecordBuilder.)
Protected method | RequireDelimiter | Causes the next call to the AppendDelimiterConditional to append a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | Reset | Resets all fields and properties of the current LogRecordBuilder to their initial value. Invoked by the Complete method. (Inherited from TextLogRecordBuilder.)
Public method | SetException | Sets the exception for the method or activity. (Inherited from TextLogRecordBuilder.)
Public method | SetExecutionTime | Sets the method or activity execution time. (Inherited from TextLogRecordBuilder.)
Public method | SetMethodGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T) | Sets the value of a given parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from TextLogRecordBuilder.)
Public method | SetRefStructParameter | (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T) | Sets a given return value (there can be several return values in C# 7.0) and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetThisT(T) | Sets the this (instance) value and uses the default formatter. This method is only invoked if the IncludeThisValue property is true. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetTypeGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Protected method | ShouldLogExceptionDetails | Determines whether exception details should be appended to the text of the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | ToString | Returns a string that represents the current object. (Inherited from TextLogRecordBuilder.)
Protected method | Write | Writes the final message to the back-end. (Overrides TextLogRecordBuilderWrite(UnsafeString).)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T) | Writes a custom parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | WriteCustomString | Write a chunk of custom string. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Loupe Namespace


LoupeLogRecordBuilder Constructor

Initializes a new LoupeLogRecordBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Loupe
Assembly: PostSharp.Patterns.Diagnostics.Backends.Loupe (in PostSharp.Patterns.Diagnostics.Backends.Loupe.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
Copy
public LoupeLogRecordBuilder(
    LoupeLoggingBackend backend
)

Parameters

backend
Type: PostSharp.Patterns.Diagnostics.Backends.LoupeLoupeLoggingBackend
The parent LoupeLoggingBackend.
See Also

Reference

LoupeLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Loupe Namespace


LoupeLogRecordBuilder Properties

The LoupeLogRecordBuilder type exposes the following members.

Properties
 | Name | Description
Public property | Backend | Gets the parent back-end. (Inherited from TextLogRecordBuilder.)
Public property | BackendOptions | Shortcut for this.Backend.Options. (Inherited from TextLogRecordBuilder.)
Protected property | Context | Gets the LoggingContext to which the record belongs. (Inherited from LogRecordBuilder.)
Public property | Exception | Gets the Exception for the current record, or null if no exception is associated to the current record. (Inherited from TextLogRecordBuilder.)
Public property | IsDisposed | (Inherited from LogRecordBuilder.)
Protected property | Level | Gets the LogLevel for the current record. (Inherited from TextLogRecordBuilder.)
Public property | MemberName | Gets the name of the method, property or field for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Options | Gets the LoggingOptions for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Profile | Gets the LoggingProfile for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | RecordKind | Gets the kind of the current record (e.g. MethodEntry or MethodException). (Inherited from LogRecordBuilder.)
Public property | SourceLineInfo | Gets the SourceLineInfo for the current record. (Inherited from TextLogRecordBuilder.)
Public property | SourceType | Gets the source Type of the current record. (Inherited from TextLogRecordBuilder.)
Protected property | StringBuilder | Gets the current UnsafeStringBuilder where everything is being appended. (Inherited from TextLogRecordBuilder.)
Protected property | ThreadContext | Gets the ThreadLoggingContext to which the current LogRecordBuilder belongs. (Inherited from LogRecordBuilder.)
Protected property | TypeSource | Gets the LoggingTypeSource for the current record. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

LoupeLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Loupe Namespace


LoupeLogRecordBuilder Methods

The LoupeLogRecordBuilder type exposes the following members.

Methods
 | Name | Description
Protected method | AppendAsyncInfo | Appends information about the async method to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendClosingParenthesisConditional | Appends a closing parenthesis to the current StringBuilder if required. (Inherited from TextLogRecordBuilder.)
Protected method | AppendComma | (Inherited from TextLogRecordBuilder.)
Protected method | AppendCommaConditional | Appends a comma to the current StringBuilder, unless this method is invoked for the first time for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription | Appends the context Description (or the TypeSource name, if the type of the context is not equal to the source type of the record) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription(LoggingContext) | (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiter | Appends a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiterConditional | Appends a Delimiter to the current StringBuilder if the RequireDelimiter method has been called previously. (Inherited from TextLogRecordBuilder.)
Protected method | AppendEpilogue | Appends the final part of log message to StringBuilder. This includes state machine number and execution time where relevant, but does not include exception details. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExceptionDetails | Appends exception details to StringBuilder if IncludeExceptionDetails is set. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTime | Appends the execution time to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTimeThreshold | Appends the execution time threshold to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendIndentString | Appends indentation for the given to StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendMemberName | Appends name of the member for the current record (including the declaring type name, subject to the IncludeType property) to the current StringBuilder, as well as an opening parenthesis. (Inherited from TextLogRecordBuilder.)
Protected method | AppendOpeningParenthesis | Appends an opening parenthesis to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendProlog | Appends the indent string, context description, and the record kind to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendRecordKind | Appends the LogRecordKind of the current record to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameter(SemanticParameterKind, String, String, String, Int32) | Appends a parameter of String type to the current StringBuilder. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSourceLineInfo | Appends source (file, line) information to the current StringBuilder. (Overrides TextLogRecordBuilderAppendSourceLineInfo.)
Protected method | AppendSpaces | Appends a given number of spaces to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpecialChar | Appends a special Char (which may require escaping with specific back-ends) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTrailingPeriod | Appends a trailing period (.) to the current StringBuilder, respecting the AppendTrailingPeriod property. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTypeName | Appends the name of the TypeSource to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | BeginCustomRecord | Initializes the current LogRecordBuilder to emit a custom record. (Inherited from TextLogRecordBuilder.)
Public method | BeginRecord | Initializes the current LogRecordBuilder to emit a standard (i.e. non-custom) record for a given context and method. (Inherited from TextLogRecordBuilder.)
Public method | Complete | Emits the record and resets the current LogRecordBuilder. This method invoked after all SetThisT(T), SetParameterT(Int32, String, ParameterKind, String, T) and similar methods have been called. (Inherited from LogRecordBuilder.)
Public method | Dispose | (Inherited from LogRecordBuilder.)
Protected method | EmitRecord | Emits the record. Invoked by the Complete method. (Inherited from TextLogRecordBuilder.)
Protected method | EmitRecord(Boolean) | Emits the record and specifies whether exception details should be appended to the text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescription | Ends building the context Description and starts building the action text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescriptionConditional | Switches between building the context Description and the action text. If the EndContextDescriptionConditional method has been previously invoked, subsequent calls are ignored. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescription | Obsolete. Gets the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescriptionUnsafe | Obsolete. Gets an UnsafeString representing the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextForDescription | Obsolete. Gets the LoggingContext that should be used when getting or appending the Description. (Inherited from TextLogRecordBuilder.)
Protected method | GetSourceName | Gets the name of the TypeSource for the current record, respecting the IncludeNamespace property. (Inherited from TextLogRecordBuilder.)
Protected method | HasRecordKindName | Determines whether the AppendRecordKind will append anything for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | MustBuildContextDescription | Determines whether the current Description should be appended to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | RequireComma | Makes the AppendCommaConditional to append a comma even if it's invoked for the first time. (Inherited from TextLogRecordBuilder.)
Protected method | RequireDelimiter | Causes the next call to the AppendDelimiterConditional to append a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | Reset | Resets all fields and properties of the current LogRecordBuilder to their initial value. Invoked by the Complete method. (Inherited from TextLogRecordBuilder.)
Public method | SetException | Sets the exception for the method or activity. (Inherited from TextLogRecordBuilder.)
Public method | SetExecutionTime | Sets the method or activity execution time. (Inherited from TextLogRecordBuilder.)
Public method | SetMethodGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T) | Sets the value of a given parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from TextLogRecordBuilder.)
Public method | SetRefStructParameter | (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T) | Sets a given return value (there can be several return values in C# 7.0) and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetThisT(T) | Sets the this (instance) value and uses the default formatter. This method is only invoked if the IncludeThisValue property is true. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetTypeGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Protected method | ShouldLogExceptionDetails | Determines whether exception details should be appended to the text of the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | ToString | Returns a string that represents the current object. (Inherited from TextLogRecordBuilder.)
Protected method | Write | Writes the final message to the back-end. (Overrides TextLogRecordBuilderWrite(UnsafeString).)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T) | Writes a custom parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | WriteCustomString | Write a chunk of custom string. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

LoupeLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Loupe Namespace


LoupeLogRecordBuilder.AppendSourceLineInfo Method

LoupeLogRecordBuilderAppendSourceLineInfo Method

Appends source (file, line) information to the current StringBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Loupe
Assembly: PostSharp.Patterns.Diagnostics.Backends.Loupe (in PostSharp.Patterns.Diagnostics.Backends.Loupe.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
Copy
protected override void AppendSourceLineInfo()
See Also

Reference

LoupeLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Loupe Namespace


LoupeLogRecordBuilder.Write Method

LoupeLogRecordBuilderWrite Method

Writes the final message to the back-end.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Loupe
Assembly: PostSharp.Patterns.Diagnostics.Backends.Loupe (in PostSharp.Patterns.Diagnostics.Backends.Loupe.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
Copy
protected override void Write(
    UnsafeString message
)

Parameters

message
Type: PostSharp.Patterns.FormattersUnsafeString
The final message.
See Also

Reference

LoupeLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Loupe Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


PostSharp.Patterns.Diagnostics.Backends.Microsoft Namespace

Classes
 | Class | Description
Public class | MicrosoftLoggingBackend | Logging back-end for Microsoft.Extensions.Logging.
Public class | MicrosoftLoggingBackendOptions | Options for MicrosoftLoggingBackend.
Public class | MicrosoftLoggingTypeSource | LoggingTypeSource for MicrosoftLoggingBackend.
Public class | MicrosoftLogRecordBuilder | LogRecordBuilder for MicrosoftLoggingBackend.


MicrosoftLoggingBackend Class

Logging back-end for Microsoft.Extensions.Logging.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingBackend
PostSharp.Patterns.Diagnostics.BackendsTextLoggingBackend
PostSharp.Patterns.Diagnostics.Backends.MicrosoftMicrosoftLoggingBackend

Namespace: PostSharp.Patterns.Diagnostics.Backends.Microsoft
Assembly: PostSharp.Patterns.Diagnostics.Backends.Microsoft (in PostSharp.Patterns.Diagnostics.Backends.Microsoft.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class MicrosoftLoggingBackend : TextLoggingBackend

The MicrosoftLoggingBackend type exposes the following members.

Constructors
 | Name | Description
Public method | MicrosoftLoggingBackend | Creates an instance of MicrosoftLoggingBackend with the given ILoggerFactory.
Top
Properties
 | Name | Description
Public property | CurrentContext | Gets the current LoggingContext. (Inherited from LoggingBackend.)
Public property | IsCorrupted | (Inherited from LoggingBackend.)
Public property | IsDisposed | Determines whether the current LoggingBackend has been disposed. (Inherited from LoggingBackend.)
Public property | IsEnabled | Determines whether the current LoggingBackend is currently enabled. This property has precedence over, and does not affect, the minimal log levels set through the SetLevel(LogLevel) method. (Inherited from LoggingBackend.)
Public property | Options | Gets the back-end options.
Top
Methods
 | Name | Description
Protected method | CreateAsyncCustomActivityContext | Creates a new AsyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateAsyncMethodContext | Creates a new AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Protected method | CreateEphemeralContext | Creates a new EphemeralLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateIteratorContext | Creates a new IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | CreateRecordBuilder | Creates a new LogRecordBuilder. (Overrides LoggingBackendCreateRecordBuilder.)
Protected method | CreateSyncCustomActivityContext | Creates a new SyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateSyncMethodContext | Creates a new SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Protected method | CreateThreadContext | Creates a new ThreadLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateTypeSource | Creates LoggingTypeSource for the given role and type. (Overrides LoggingBackendCreateTypeSource(LoggingNamespaceSource, Type).)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingBackend.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from TextLoggingBackend.)
Public method | GetAsyncContextOfTask | Gets the AsyncMethodLoggingContext associated with a Task. (Inherited from LoggingBackend.)
Protected method | GetBackendOptions | Gets the formatting and rendering options for the current LoggingBackend. (Inherited from TextLoggingBackend.)
Public method | GetLogger | Gets an ILogger given a category name.
Public method | GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace. (Inherited from LoggingBackend.)
Public method | GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type. (Inherited from LoggingBackend.)
Protected method | GetTextBackendOptions | Gets the options. (Overrides TextLoggingBackendGetTextBackendOptions.)
Public method | GetThreadContext | Returns the ThreadLoggingContext for the current Thread. (Inherited from LoggingBackend.)
Public method | OpenAsyncContext | Gets an AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Public method | OpenCustomActivityContext | Gets a LoggingContext for a custom activity (opened using OpenActivity(String) or OpenAsyncActivity(String)). (Inherited from LoggingBackend.)
Public method | OpenEphemeralContext | Gets an EphemeralLoggingContext for use in a given method. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record. (Inherited from LoggingBackend.)
Public method | OpenIteratorContext | Gets an IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | OpenSyncContext | Gets a SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Microsoft Namespace

Other Resources

Conceptual: Adding Detailed Logging to your Solution


MicrosoftLoggingBackend Constructor

Creates an instance of MicrosoftLoggingBackend with the given ILoggerFactory.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Microsoft
Assembly: PostSharp.Patterns.Diagnostics.Backends.Microsoft (in PostSharp.Patterns.Diagnostics.Backends.Microsoft.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MicrosoftLoggingBackend(
    ILoggerFactory loggerFactory
)

Parameters

loggerFactory
Type: ILoggerFactory
See Also

Reference

MicrosoftLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Microsoft Namespace


MicrosoftLoggingBackend Properties

The MicrosoftLoggingBackend type exposes the following members.

Properties
 | Name | Description
Public property | CurrentContext | Gets the current LoggingContext. (Inherited from LoggingBackend.)
Public property | IsCorrupted | (Inherited from LoggingBackend.)
Public property | IsDisposed | Determines whether the current LoggingBackend has been disposed. (Inherited from LoggingBackend.)
Public property | IsEnabled | Determines whether the current LoggingBackend is currently enabled. This property has precedence over, and does not affect, the minimal log levels set through the SetLevel(LogLevel) method. (Inherited from LoggingBackend.)
Public property | Options | Gets the back-end options.
Top
See Also

Reference

MicrosoftLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Microsoft Namespace


MicrosoftLoggingBackend.Options Property

MicrosoftLoggingBackendOptions Property

Gets the back-end options.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Microsoft
Assembly: PostSharp.Patterns.Diagnostics.Backends.Microsoft (in PostSharp.Patterns.Diagnostics.Backends.Microsoft.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MicrosoftLoggingBackendOptions Options { get; }

Property Value

Type: MicrosoftLoggingBackendOptions
See Also

Reference

MicrosoftLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Microsoft Namespace


MicrosoftLoggingBackend Methods

The MicrosoftLoggingBackend type exposes the following members.

Methods
 | Name | Description
Protected method | CreateAsyncCustomActivityContext | Creates a new AsyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateAsyncMethodContext | Creates a new AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Protected method | CreateEphemeralContext | Creates a new EphemeralLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateIteratorContext | Creates a new IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | CreateRecordBuilder | Creates a new LogRecordBuilder. (Overrides LoggingBackendCreateRecordBuilder.)
Protected method | CreateSyncCustomActivityContext | Creates a new SyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateSyncMethodContext | Creates a new SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Protected method | CreateThreadContext | Creates a new ThreadLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateTypeSource | Creates LoggingTypeSource for the given role and type. (Overrides LoggingBackendCreateTypeSource(LoggingNamespaceSource, Type).)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingBackend.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from TextLoggingBackend.)
Public method | GetAsyncContextOfTask | Gets the AsyncMethodLoggingContext associated with a Task. (Inherited from LoggingBackend.)
Protected method | GetBackendOptions | Gets the formatting and rendering options for the current LoggingBackend. (Inherited from TextLoggingBackend.)
Public method | GetLogger | Gets an ILogger given a category name.
Public method | GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace. (Inherited from LoggingBackend.)
Public method | GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type. (Inherited from LoggingBackend.)
Protected method | GetTextBackendOptions | Gets the options. (Overrides TextLoggingBackendGetTextBackendOptions.)
Public method | GetThreadContext | Returns the ThreadLoggingContext for the current Thread. (Inherited from LoggingBackend.)
Public method | OpenAsyncContext | Gets an AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Public method | OpenCustomActivityContext | Gets a LoggingContext for a custom activity (opened using OpenActivity(String) or OpenAsyncActivity(String)). (Inherited from LoggingBackend.)
Public method | OpenEphemeralContext | Gets an EphemeralLoggingContext for use in a given method. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record. (Inherited from LoggingBackend.)
Public method | OpenIteratorContext | Gets an IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | OpenSyncContext | Gets a SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Top
See Also

Reference

MicrosoftLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Microsoft Namespace


MicrosoftLoggingBackend.CreateRecordBuilder Method

MicrosoftLoggingBackendCreateRecordBuilder Method

Creates a new LogRecordBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Microsoft
Assembly: PostSharp.Patterns.Diagnostics.Backends.Microsoft (in PostSharp.Patterns.Diagnostics.Backends.Microsoft.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override LogRecordBuilder CreateRecordBuilder()

Return Value

Type: LogRecordBuilder
A new LogRecordBuilder.
See Also

Reference

MicrosoftLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Microsoft Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


MicrosoftLoggingBackend.CreateTypeSource Method

MicrosoftLoggingBackendCreateTypeSource Method

Creates LoggingTypeSource for the given role and type.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Microsoft
Assembly: PostSharp.Patterns.Diagnostics.Backends.Microsoft (in PostSharp.Patterns.Diagnostics.Backends.Microsoft.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override LoggingTypeSource CreateTypeSource(
    LoggingNamespaceSource parent,
    Type type
)

Parameters

parent
Type: PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
type
Type: SystemType

Return Value

Type: LoggingTypeSource
See Also

Reference

MicrosoftLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Microsoft Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


MicrosoftLoggingBackend.GetLogger Method

MicrosoftLoggingBackendGetLogger Method

Gets an ILogger given a category name.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Microsoft
Assembly: PostSharp.Patterns.Diagnostics.Backends.Microsoft (in PostSharp.Patterns.Diagnostics.Backends.Microsoft.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ILogger GetLogger(
    string categoryName
)

Parameters

categoryName
Type: SystemString
The name of the category (as returned by GetLoggerName).

Return Value

Type: ILogger
An ILogger whose category name is categoryName.
See Also

Reference

MicrosoftLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Microsoft Namespace


MicrosoftLoggingBackend.GetTextBackendOptions Method

MicrosoftLoggingBackendGetTextBackendOptions Method

Gets the options.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Microsoft
Assembly: PostSharp.Patterns.Diagnostics.Backends.Microsoft (in PostSharp.Patterns.Diagnostics.Backends.Microsoft.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override TextLoggingBackendOptions GetTextBackendOptions()

Return Value

Type: TextLoggingBackendOptions
See Also

Reference

MicrosoftLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Microsoft Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


MicrosoftLoggingBackendOptions Class

Options for MicrosoftLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingBackendOptions
PostSharp.Patterns.Diagnostics.BackendsTextLoggingBackendOptions
PostSharp.Patterns.Diagnostics.Backends.MicrosoftMicrosoftLoggingBackendOptions

Namespace: PostSharp.Patterns.Diagnostics.Backends.Microsoft
Assembly: PostSharp.Patterns.Diagnostics.Backends.Microsoft (in PostSharp.Patterns.Diagnostics.Backends.Microsoft.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class MicrosoftLoggingBackendOptions : TextLoggingBackendOptions

The MicrosoftLoggingBackendOptions type exposes the following members.

Constructors
 | Name | Description
Public method | MicrosoftLoggingBackendOptions | Initializes a new instance of the MicrosoftLoggingBackendOptions class
Top
Properties
 | Name | Description
Public property | ActionMaxLength | Max length of a log record. The default value is 2048. (Inherited from TextLoggingBackendOptions.)
Public property | AppendTrailingPeriod | Determines whether log messages should be ended with a trailing period. The default value is true because we really like trailing periods at PostSharp, but other opinions are valid. (Inherited from TextLoggingBackendOptions.)
Public property | ContextMaxLength | Max length of the Description property. (Inherited from LoggingBackendOptions.)
Public property | Delimiter | String used to separate different parts of the logging record. The default value is a pipe surrounded by spaces ( | ). (Inherited from TextLoggingBackendOptions.)
Public property | GetLoggerName | Gets a function that returns a category name (used as an argument to the CreateLogger(String) method) given a MicrosoftLoggingTypeSource. The default behavior is to return the Role of the type source. If you want to get a logger as a function of the Type instead of the role, you can use the GetTypeDisplayName(Type) method.
Public property | IncludeExceptionDetails | Determines whether exception details (basically Exception.ToString) should be appended to the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeNamespace | Determines whether the full namespace of types should be included in the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeType | Determines whether the name of the type of the logged method should be included in the log. The default value is true. (Inherited from TextLoggingBackendOptions.)
Public property | IndentSpaces | Number of spaces for each indentation level. The default value is 2. (Inherited from TextLoggingBackendOptions.)
Public property | LogLevelIgnoredForSystemRecords | Determines whether the Level property is ignored by the current back-end for auto-generated (i.e. non-manual) logging records. Some back-ends may not support overriding the level of records. (Inherited from LoggingBackendOptions.)
Public property | ShouldLogExceptionPredicate | Gets or sets a predicate that determines whether an exception should be logged. This predicate is evaluated only when the method entry is not logged. When the method entry is logged, exceptions are always logged. (Inherited from TextLoggingBackendOptions.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Microsoft Namespace


MicrosoftLoggingBackendOptions Constructor

Initializes a new instance of the MicrosoftLoggingBackendOptions class

Namespace: PostSharp.Patterns.Diagnostics.Backends.Microsoft
Assembly: PostSharp.Patterns.Diagnostics.Backends.Microsoft (in PostSharp.Patterns.Diagnostics.Backends.Microsoft.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MicrosoftLoggingBackendOptions()
See Also

Reference

MicrosoftLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.Microsoft Namespace


MicrosoftLoggingBackendOptions Properties

The MicrosoftLoggingBackendOptions type exposes the following members.

Properties
 | Name | Description
Public property | ActionMaxLength | Max length of a log record. The default value is 2048. (Inherited from TextLoggingBackendOptions.)
Public property | AppendTrailingPeriod | Determines whether log messages should be ended with a trailing period. The default value is true because we really like trailing periods at PostSharp, but other opinions are valid. (Inherited from TextLoggingBackendOptions.)
Public property | ContextMaxLength | Max length of the Description property. (Inherited from LoggingBackendOptions.)
Public property | Delimiter | String used to separate different parts of the logging record. The default value is a pipe surrounded by spaces ( | ). (Inherited from TextLoggingBackendOptions.)
Public property | GetLoggerName | Gets a function that returns a category name (used as an argument to the CreateLogger(String) method) given a MicrosoftLoggingTypeSource. The default behavior is to return the Role of the type source. If you want to get a logger as a function of the Type instead of the role, you can use the GetTypeDisplayName(Type) method.
Public property | IncludeExceptionDetails | Determines whether exception details (basically Exception.ToString) should be appended to the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeNamespace | Determines whether the full namespace of types should be included in the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeType | Determines whether the name of the type of the logged method should be included in the log. The default value is true. (Inherited from TextLoggingBackendOptions.)
Public property | IndentSpaces | Number of spaces for each indentation level. The default value is 2. (Inherited from TextLoggingBackendOptions.)
Public property | LogLevelIgnoredForSystemRecords | Determines whether the Level property is ignored by the current back-end for auto-generated (i.e. non-manual) logging records. Some back-ends may not support overriding the level of records. (Inherited from LoggingBackendOptions.)
Public property | ShouldLogExceptionPredicate | Gets or sets a predicate that determines whether an exception should be logged. This predicate is evaluated only when the method entry is not logged. When the method entry is logged, exceptions are always logged. (Inherited from TextLoggingBackendOptions.)
Top
See Also

Reference

MicrosoftLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.Microsoft Namespace


MicrosoftLoggingBackendOptions.GetLoggerName Property

MicrosoftLoggingBackendOptionsGetLoggerName Property

Gets a function that returns a category name (used as an argument to the CreateLogger(String) method) given a MicrosoftLoggingTypeSource. The default behavior is to return the Role of the type source. If you want to get a logger as a function of the Type instead of the role, you can use the GetTypeDisplayName(Type) method.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Microsoft
Assembly: PostSharp.Patterns.Diagnostics.Backends.Microsoft (in PostSharp.Patterns.Diagnostics.Backends.Microsoft.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Func<MicrosoftLoggingTypeSource, string> GetLoggerName { get; set; }

Property Value

Type: Func MicrosoftLoggingTypeSource, String
See Also

Reference

MicrosoftLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.Microsoft Namespace


MicrosoftLoggingTypeSource Class

LoggingTypeSource for MicrosoftLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
PostSharp.Patterns.DiagnosticsLoggingTypeSource
PostSharp.Patterns.Diagnostics.Backends.MicrosoftMicrosoftLoggingTypeSource

Namespace: PostSharp.Patterns.Diagnostics.Backends.Microsoft
Assembly: PostSharp.Patterns.Diagnostics.Backends.Microsoft (in PostSharp.Patterns.Diagnostics.Backends.Microsoft.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class MicrosoftLoggingTypeSource : LoggingTypeSource

The MicrosoftLoggingTypeSource type exposes the following members.

Constructors
 | Name | Description
Public method | MicrosoftLoggingTypeSource | Initializes a new MicrosoftLoggingTypeSource.
Top
Properties
 | Name | Description
Public property | Backend | Gets the parent LoggingBackend. (Inherited from LoggingNamespaceSource.)
Public property | DisplayFullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the DisplayFullName property does not include the arity, i.e. the full name of List<T> is System.Collections.Generic.List. (Inherited from LoggingNamespaceSource.)
Public property | DisplayName | Gets the last component of the name of the type or namespace, in the form that should be reported to the log. For generic types, the DisplayName property does not include the arity, i.e. the name of List<T> is List. (Inherited from LoggingNamespaceSource.)
Public property | FullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the FullName property includes the arity, i.e. the full name of List<T> is System.Collections.Generic.List`1. (Inherited from LoggingNamespaceSource.)
Public property | GenericParameterCount | Gets the number of generic parameters in SourceType. (Inherited from LoggingTypeSource.)
Public property | Level | Gets the minimal LogLevel for which logging is enabled for the current namespace or type. (Inherited from LoggingNamespaceSource.)
Public property | Name | Gets the last component of the name of the type or namespace. For instance, when FullName is PostSharp.Patterns.Diagnostics.LoggingBackend, Name is LoggingBackend. For generic types, the Name property includes the arity, i.e. the name of List<T> is List`1. (Inherited from LoggingNamespaceSource.)
Public property | Options | Gets the LoggingRoleConfiguration for the current role. This property is a shortcut to LoggingServices.Roles[this.Role]. (Inherited from LoggingTypeSource.)
Public property | Parent | Gets the parent LoggingNamespaceSource, or null if the current object represents the root namespace. (Inherited from LoggingNamespaceSource.)
Public property | Role | Gets the logging role for the current role. Typical values of this property are listed in the LoggingRoles class. (Inherited from LoggingNamespaceSource.)
Public property | SourceType | The type represented by the current LoggingTypeSource. (Inherited from LoggingTypeSource.)
Top
Methods
 | Name | Description
Protected method | IsBackendEnabled | Checks whether logging is enabled in the back-end for the given level. (Overrides LoggingTypeSourceIsBackendEnabled(LogLevel).)
Public method | IsEnabled | Determines whether logging is enabled for the given LogLevel. (Inherited from LoggingTypeSource.)
Public method | Refresh | Refreshes the logging level from the back-end from the current node and all children nodes. The back-end-defined logging level is cached for performance reasons. (Inherited from LoggingTypeSource.)
Public method | SetLevel | Sets the minimal LogLevel for which logging is enabled for the current namespace and type and all children namespaces and types. (Inherited from LoggingNamespaceSource.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Microsoft Namespace


MicrosoftLoggingTypeSource Constructor

Initializes a new MicrosoftLoggingTypeSource.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Microsoft
Assembly: PostSharp.Patterns.Diagnostics.Backends.Microsoft (in PostSharp.Patterns.Diagnostics.Backends.Microsoft.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MicrosoftLoggingTypeSource(
    LoggingNamespaceSource parent,
    Type type
)

Parameters

parent
Type: PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
The parent LoggingNamespaceSource.
type
Type: SystemType
The source Type that will emit log records.
See Also

Reference

MicrosoftLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.Microsoft Namespace


MicrosoftLoggingTypeSource Properties

The MicrosoftLoggingTypeSource type exposes the following members.

Properties
 | Name | Description
Public property | Backend | Gets the parent LoggingBackend. (Inherited from LoggingNamespaceSource.)
Public property | DisplayFullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the DisplayFullName property does not include the arity, i.e. the full name of List<T> is System.Collections.Generic.List. (Inherited from LoggingNamespaceSource.)
Public property | DisplayName | Gets the last component of the name of the type or namespace, in the form that should be reported to the log. For generic types, the DisplayName property does not include the arity, i.e. the name of List<T> is List. (Inherited from LoggingNamespaceSource.)
Public property | FullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the FullName property includes the arity, i.e. the full name of List<T> is System.Collections.Generic.List`1. (Inherited from LoggingNamespaceSource.)
Public property | GenericParameterCount | Gets the number of generic parameters in SourceType. (Inherited from LoggingTypeSource.)
Public property | Level | Gets the minimal LogLevel for which logging is enabled for the current namespace or type. (Inherited from LoggingNamespaceSource.)
Public property | Name | Gets the last component of the name of the type or namespace. For instance, when FullName is PostSharp.Patterns.Diagnostics.LoggingBackend, Name is LoggingBackend. For generic types, the Name property includes the arity, i.e. the name of List<T> is List`1. (Inherited from LoggingNamespaceSource.)
Public property | Options | Gets the LoggingRoleConfiguration for the current role. This property is a shortcut to LoggingServices.Roles[this.Role]. (Inherited from LoggingTypeSource.)
Public property | Parent | Gets the parent LoggingNamespaceSource, or null if the current object represents the root namespace. (Inherited from LoggingNamespaceSource.)
Public property | Role | Gets the logging role for the current role. Typical values of this property are listed in the LoggingRoles class. (Inherited from LoggingNamespaceSource.)
Public property | SourceType | The type represented by the current LoggingTypeSource. (Inherited from LoggingTypeSource.)
Top
See Also

Reference

MicrosoftLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.Microsoft Namespace


MicrosoftLoggingTypeSource Methods

The MicrosoftLoggingTypeSource type exposes the following members.

Methods
 | Name | Description
Protected method | IsBackendEnabled | Checks whether logging is enabled in the back-end for the given level. (Overrides LoggingTypeSourceIsBackendEnabled(LogLevel).)
Public method | IsEnabled | Determines whether logging is enabled for the given LogLevel. (Inherited from LoggingTypeSource.)
Public method | Refresh | Refreshes the logging level from the back-end from the current node and all children nodes. The back-end-defined logging level is cached for performance reasons. (Inherited from LoggingTypeSource.)
Public method | SetLevel | Sets the minimal LogLevel for which logging is enabled for the current namespace and type and all children namespaces and types. (Inherited from LoggingNamespaceSource.)
Top
See Also

Reference

MicrosoftLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.Microsoft Namespace


MicrosoftLoggingTypeSource.IsBackendEnabled Method

MicrosoftLoggingTypeSourceIsBackendEnabled Method

Checks whether logging is enabled in the back-end for the given level.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Microsoft
Assembly: PostSharp.Patterns.Diagnostics.Backends.Microsoft (in PostSharp.Patterns.Diagnostics.Backends.Microsoft.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override bool IsBackendEnabled(
    LogLevel level
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel

Return Value

Type: Boolean
Remarks

The result of this method is cached. To invalidate the cache, call the Refresh method.

See Also

Reference

MicrosoftLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.Microsoft Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


MicrosoftLogRecordBuilder Class

LogRecordBuilder for MicrosoftLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.RecordBuildersLogRecordBuilder
PostSharp.Patterns.Diagnostics.RecordBuildersTextLogRecordBuilder
PostSharp.Patterns.Diagnostics.Backends.MicrosoftMicrosoftLogRecordBuilder

Namespace: PostSharp.Patterns.Diagnostics.Backends.Microsoft
Assembly: PostSharp.Patterns.Diagnostics.Backends.Microsoft (in PostSharp.Patterns.Diagnostics.Backends.Microsoft.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class MicrosoftLogRecordBuilder : TextLogRecordBuilder

The MicrosoftLogRecordBuilder type exposes the following members.

Constructors
 | Name | Description
Public method | MicrosoftLogRecordBuilder | Initializes a new MicrosoftLogRecordBuilder.
Top
Properties
 | Name | Description
Public property | Backend | Gets the parent back-end. (Inherited from TextLogRecordBuilder.)
Public property | BackendOptions | Shortcut for this.Backend.Options. (Inherited from TextLogRecordBuilder.)
Protected property | Context | Gets the LoggingContext to which the record belongs. (Inherited from LogRecordBuilder.)
Public property | Exception | Gets the Exception for the current record, or null if no exception is associated to the current record. (Inherited from TextLogRecordBuilder.)
Public property | IsDisposed | (Inherited from LogRecordBuilder.)
Protected property | Level | Gets the LogLevel for the current record. (Inherited from TextLogRecordBuilder.)
Public property | MemberName | Gets the name of the method, property or field for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Options | Gets the LoggingOptions for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Profile | Gets the LoggingProfile for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | RecordKind | Gets the kind of the current record (e.g. MethodEntry or MethodException). (Inherited from LogRecordBuilder.)
Public property | SourceLineInfo | Gets the SourceLineInfo for the current record. (Inherited from TextLogRecordBuilder.)
Public property | SourceType | Gets the source Type of the current record. (Inherited from TextLogRecordBuilder.)
Protected property | StringBuilder | Gets the current UnsafeStringBuilder where everything is being appended. (Inherited from TextLogRecordBuilder.)
Protected property | ThreadContext | Gets the ThreadLoggingContext to which the current LogRecordBuilder belongs. (Inherited from LogRecordBuilder.)
Protected property | TypeSource | Gets the LoggingTypeSource for the current record. (Inherited from TextLogRecordBuilder.)
Top
Methods
 | Name | Description
Protected method | AppendAsyncInfo | Appends information about the async method to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendClosingParenthesisConditional | Appends a closing parenthesis to the current StringBuilder if required. (Inherited from TextLogRecordBuilder.)
Protected method | AppendComma | (Inherited from TextLogRecordBuilder.)
Protected method | AppendCommaConditional | Appends a comma to the current StringBuilder, unless this method is invoked for the first time for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription | Appends the context Description (or the TypeSource name, if the type of the context is not equal to the source type of the record) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription(LoggingContext) | (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiter | Appends a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiterConditional | Appends a Delimiter to the current StringBuilder if the RequireDelimiter method has been called previously. (Inherited from TextLogRecordBuilder.)
Protected method | AppendEpilogue | Appends the final part of log message to StringBuilder. This includes state machine number and execution time where relevant, but does not include exception details. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExceptionDetails | Appends exception details to StringBuilder if IncludeExceptionDetails is set. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTime | Appends the execution time to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTimeThreshold | Appends the execution time threshold to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendIndentString | Appends indentation for the given to StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendMemberName | Appends name of the member for the current record (including the declaring type name, subject to the IncludeType property) to the current StringBuilder, as well as an opening parenthesis. (Inherited from TextLogRecordBuilder.)
Protected method | AppendOpeningParenthesis | Appends an opening parenthesis to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendProlog | Appends the indent string, context description, and the record kind to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendRecordKind | Appends the LogRecordKind of the current record to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameter(SemanticParameterKind, String, String, String, Int32) | Appends a parameter of String type to the current StringBuilder. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSourceLineInfo | Appends source (file, line) information to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpaces | Appends a given number of spaces to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpecialChar | Appends a special Char (which may require escaping with specific back-ends) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTrailingPeriod | Appends a trailing period (.) to the current StringBuilder, respecting the AppendTrailingPeriod property. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTypeName | Appends the name of the TypeSource to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | BeginCustomRecord | Initializes the current LogRecordBuilder to emit a custom record. (Inherited from TextLogRecordBuilder.)
Public method | BeginRecord | Initializes the current LogRecordBuilder to emit a standard (i.e. non-custom) record for a given context and method. (Inherited from TextLogRecordBuilder.)
Public method | Complete | Emits the record and resets the current LogRecordBuilder. This method invoked after all SetThisT(T), SetParameterT(Int32, String, ParameterKind, String, T) and similar methods have been called. (Inherited from LogRecordBuilder.)
Public method | Dispose | (Inherited from LogRecordBuilder.)
Protected method | EmitRecord | Emits the record. Invoked by the Complete method. (Overrides TextLogRecordBuilderEmitRecord.)
Protected method | EmitRecord(Boolean) | Emits the record and specifies whether exception details should be appended to the text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescription | Ends building the context Description and starts building the action text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescriptionConditional | Switches between building the context Description and the action text. If the EndContextDescriptionConditional method has been previously invoked, subsequent calls are ignored. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescription | Obsolete. Gets the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescriptionUnsafe | Obsolete. Gets an UnsafeString representing the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextForDescription | Obsolete. Gets the LoggingContext that should be used when getting or appending the Description. (Inherited from TextLogRecordBuilder.)
Protected method | GetSourceName | Gets the name of the TypeSource for the current record, respecting the IncludeNamespace property. (Inherited from TextLogRecordBuilder.)
Protected method | HasRecordKindName | Determines whether the AppendRecordKind will append anything for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | MustBuildContextDescription | Determines whether the current Description should be appended to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | RequireComma | Makes the AppendCommaConditional to append a comma even if it's invoked for the first time. (Inherited from TextLogRecordBuilder.)
Protected method | RequireDelimiter | Causes the next call to the AppendDelimiterConditional to append a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | Reset | Resets all fields and properties of the current LogRecordBuilder to their initial value. Invoked by the Complete method. (Inherited from TextLogRecordBuilder.)
Public method | SetException | Sets the exception for the method or activity. (Inherited from TextLogRecordBuilder.)
Public method | SetExecutionTime | Sets the method or activity execution time. (Inherited from TextLogRecordBuilder.)
Public method | SetMethodGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T) | Sets the value of a given parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from TextLogRecordBuilder.)
Public method | SetRefStructParameter | (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T) | Sets a given return value (there can be several return values in C# 7.0) and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetThisT(T) | Sets the this (instance) value and uses the default formatter. This method is only invoked if the IncludeThisValue property is true. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetTypeGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Protected method | ShouldLogExceptionDetails | Determines whether exception details should be appended to the text of the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | ToString | Returns a string that represents the current object. (Inherited from TextLogRecordBuilder.)
Protected method | Write | Writes the final message to the back-end. (Overrides TextLogRecordBuilderWrite(UnsafeString).)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T) | Writes a custom parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | WriteCustomString | Write a chunk of custom string. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Microsoft Namespace


MicrosoftLogRecordBuilder Constructor

Initializes a new MicrosoftLogRecordBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Microsoft
Assembly: PostSharp.Patterns.Diagnostics.Backends.Microsoft (in PostSharp.Patterns.Diagnostics.Backends.Microsoft.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MicrosoftLogRecordBuilder(
    MicrosoftLoggingBackend backend
)

Parameters

backend
Type: PostSharp.Patterns.Diagnostics.Backends.MicrosoftMicrosoftLoggingBackend
The parent MicrosoftLoggingBackend.
See Also

Reference

MicrosoftLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Microsoft Namespace


MicrosoftLogRecordBuilder Properties

The MicrosoftLogRecordBuilder type exposes the following members.

Properties
 | Name | Description
Public property | Backend | Gets the parent back-end. (Inherited from TextLogRecordBuilder.)
Public property | BackendOptions | Shortcut for this.Backend.Options. (Inherited from TextLogRecordBuilder.)
Protected property | Context | Gets the LoggingContext to which the record belongs. (Inherited from LogRecordBuilder.)
Public property | Exception | Gets the Exception for the current record, or null if no exception is associated to the current record. (Inherited from TextLogRecordBuilder.)
Public property | IsDisposed | (Inherited from LogRecordBuilder.)
Protected property | Level | Gets the LogLevel for the current record. (Inherited from TextLogRecordBuilder.)
Public property | MemberName | Gets the name of the method, property or field for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Options | Gets the LoggingOptions for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Profile | Gets the LoggingProfile for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | RecordKind | Gets the kind of the current record (e.g. MethodEntry or MethodException). (Inherited from LogRecordBuilder.)
Public property | SourceLineInfo | Gets the SourceLineInfo for the current record. (Inherited from TextLogRecordBuilder.)
Public property | SourceType | Gets the source Type of the current record. (Inherited from TextLogRecordBuilder.)
Protected property | StringBuilder | Gets the current UnsafeStringBuilder where everything is being appended. (Inherited from TextLogRecordBuilder.)
Protected property | ThreadContext | Gets the ThreadLoggingContext to which the current LogRecordBuilder belongs. (Inherited from LogRecordBuilder.)
Protected property | TypeSource | Gets the LoggingTypeSource for the current record. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

MicrosoftLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Microsoft Namespace


MicrosoftLogRecordBuilder Methods

The MicrosoftLogRecordBuilder type exposes the following members.

Methods
 | Name | Description
Protected method | AppendAsyncInfo | Appends information about the async method to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendClosingParenthesisConditional | Appends a closing parenthesis to the current StringBuilder if required. (Inherited from TextLogRecordBuilder.)
Protected method | AppendComma | (Inherited from TextLogRecordBuilder.)
Protected method | AppendCommaConditional | Appends a comma to the current StringBuilder, unless this method is invoked for the first time for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription | Appends the context Description (or the TypeSource name, if the type of the context is not equal to the source type of the record) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription(LoggingContext) | (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiter | Appends a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiterConditional | Appends a Delimiter to the current StringBuilder if the RequireDelimiter method has been called previously. (Inherited from TextLogRecordBuilder.)
Protected method | AppendEpilogue | Appends the final part of log message to StringBuilder. This includes state machine number and execution time where relevant, but does not include exception details. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExceptionDetails | Appends exception details to StringBuilder if IncludeExceptionDetails is set. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTime | Appends the execution time to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTimeThreshold | Appends the execution time threshold to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendIndentString | Appends indentation for the given to StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendMemberName | Appends name of the member for the current record (including the declaring type name, subject to the IncludeType property) to the current StringBuilder, as well as an opening parenthesis. (Inherited from TextLogRecordBuilder.)
Protected method | AppendOpeningParenthesis | Appends an opening parenthesis to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendProlog | Appends the indent string, context description, and the record kind to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendRecordKind | Appends the LogRecordKind of the current record to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameter(SemanticParameterKind, String, String, String, Int32) | Appends a parameter of String type to the current StringBuilder. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSourceLineInfo | Appends source (file, line) information to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpaces | Appends a given number of spaces to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpecialChar | Appends a special Char (which may require escaping with specific back-ends) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTrailingPeriod | Appends a trailing period (.) to the current StringBuilder, respecting the AppendTrailingPeriod property. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTypeName | Appends the name of the TypeSource to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | BeginCustomRecord | Initializes the current LogRecordBuilder to emit a custom record. (Inherited from TextLogRecordBuilder.)
Public method | BeginRecord | Initializes the current LogRecordBuilder to emit a standard (i.e. non-custom) record for a given context and method. (Inherited from TextLogRecordBuilder.)
Public method | Complete | Emits the record and resets the current LogRecordBuilder. This method invoked after all SetThisT(T), SetParameterT(Int32, String, ParameterKind, String, T) and similar methods have been called. (Inherited from LogRecordBuilder.)
Public method | Dispose | (Inherited from LogRecordBuilder.)
Protected method | EmitRecord | Emits the record. Invoked by the Complete method. (Overrides TextLogRecordBuilderEmitRecord.)
Protected method | EmitRecord(Boolean) | Emits the record and specifies whether exception details should be appended to the text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescription | Ends building the context Description and starts building the action text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescriptionConditional | Switches between building the context Description and the action text. If the EndContextDescriptionConditional method has been previously invoked, subsequent calls are ignored. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescription | Obsolete. Gets the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescriptionUnsafe | Obsolete. Gets an UnsafeString representing the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextForDescription | Obsolete. Gets the LoggingContext that should be used when getting or appending the Description. (Inherited from TextLogRecordBuilder.)
Protected method | GetSourceName | Gets the name of the TypeSource for the current record, respecting the IncludeNamespace property. (Inherited from TextLogRecordBuilder.)
Protected method | HasRecordKindName | Determines whether the AppendRecordKind will append anything for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | MustBuildContextDescription | Determines whether the current Description should be appended to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | RequireComma | Makes the AppendCommaConditional to append a comma even if it's invoked for the first time. (Inherited from TextLogRecordBuilder.)
Protected method | RequireDelimiter | Causes the next call to the AppendDelimiterConditional to append a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | Reset | Resets all fields and properties of the current LogRecordBuilder to their initial value. Invoked by the Complete method. (Inherited from TextLogRecordBuilder.)
Public method | SetException | Sets the exception for the method or activity. (Inherited from TextLogRecordBuilder.)
Public method | SetExecutionTime | Sets the method or activity execution time. (Inherited from TextLogRecordBuilder.)
Public method | SetMethodGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T) | Sets the value of a given parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from TextLogRecordBuilder.)
Public method | SetRefStructParameter | (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T) | Sets a given return value (there can be several return values in C# 7.0) and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetThisT(T) | Sets the this (instance) value and uses the default formatter. This method is only invoked if the IncludeThisValue property is true. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetTypeGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Protected method | ShouldLogExceptionDetails | Determines whether exception details should be appended to the text of the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | ToString | Returns a string that represents the current object. (Inherited from TextLogRecordBuilder.)
Protected method | Write | Writes the final message to the back-end. (Overrides TextLogRecordBuilderWrite(UnsafeString).)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T) | Writes a custom parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | WriteCustomString | Write a chunk of custom string. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

MicrosoftLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Microsoft Namespace


MicrosoftLogRecordBuilder.EmitRecord Method

MicrosoftLogRecordBuilderEmitRecord Method

Overload List
 | Name | Description
Protected method | EmitRecord | Emits the record. Invoked by the Complete method. (Overrides TextLogRecordBuilderEmitRecord.)
Protected method | EmitRecord(Boolean) | Emits the record and specifies whether exception details should be appended to the text. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

MicrosoftLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Microsoft Namespace


MicrosoftLogRecordBuilder.EmitRecord Method

MicrosoftLogRecordBuilderEmitRecord Method

Emits the record. Invoked by the Complete method.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Microsoft
Assembly: PostSharp.Patterns.Diagnostics.Backends.Microsoft (in PostSharp.Patterns.Diagnostics.Backends.Microsoft.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void EmitRecord()
See Also

Reference

MicrosoftLogRecordBuilder Class
EmitRecord Overload
PostSharp.Patterns.Diagnostics.Backends.Microsoft Namespace


MicrosoftLogRecordBuilder.Write Method

MicrosoftLogRecordBuilderWrite Method

Writes the final message to the back-end.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Microsoft
Assembly: PostSharp.Patterns.Diagnostics.Backends.Microsoft (in PostSharp.Patterns.Diagnostics.Backends.Microsoft.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void Write(
    UnsafeString message
)

Parameters

message
Type: PostSharp.Patterns.FormattersUnsafeString
The final message.
See Also

Reference

MicrosoftLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Microsoft Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


PostSharp.Patterns.Diagnostics.Backends.NLog Namespace

Classes
 | Class | Description
Public class | NLogLoggingBackend | Logging back-end for NLog.
Public class | NLogLoggingBackendOptions | Options for NLogLoggingBackend.
Public class | NLogLoggingTypeSource | The LoggingTypeSource for NLogLoggingBackend.
Public class | NLogLogRecordBuilder | LogRecordBuilder for NLogLoggingBackend.


NLogLoggingBackend Class

Logging back-end for NLog.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingBackend
PostSharp.Patterns.Diagnostics.BackendsTextLoggingBackend
PostSharp.Patterns.Diagnostics.Backends.NLogNLogLoggingBackend

Namespace: PostSharp.Patterns.Diagnostics.Backends.NLog
Assembly: PostSharp.Patterns.Diagnostics.Backends.NLog (in PostSharp.Patterns.Diagnostics.Backends.NLog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class NLogLoggingBackend : TextLoggingBackend

The NLogLoggingBackend type exposes the following members.

Constructors
 | Name | Description
Public method | NLogLoggingBackend | Initializes a new NLogLoggingBackend.
Public method | NLogLoggingBackend(LogFactory) | Initializes a new NLogLoggingBackend and specifies the target LogFactory.
Top
Properties
 | Name | Description
Public property | CurrentContext | Gets the current LoggingContext. (Inherited from LoggingBackend.)
Public property | IsCorrupted | (Inherited from LoggingBackend.)
Public property | IsDisposed | Determines whether the current LoggingBackend has been disposed. (Inherited from LoggingBackend.)
Public property | IsEnabled | Determines whether the current LoggingBackend is currently enabled. This property has precedence over, and does not affect, the minimal log levels set through the SetLevel(LogLevel) method. (Inherited from LoggingBackend.)
Public property | LogFactory | Gets the LogFactory passed to the constructor of the current NLogLoggingBackend, or null if no logger was passed during the instantiation of the current NLogLoggingBackend.
Public property | Options | Gets the back-end options.
Top
Methods
 | Name | Description
Protected method | CreateAsyncCustomActivityContext | Creates a new AsyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateAsyncMethodContext | Creates a new AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Protected method | CreateEphemeralContext | Creates a new EphemeralLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateIteratorContext | Creates a new IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | CreateRecordBuilder | Creates a new LogRecordBuilder. (Overrides LoggingBackendCreateRecordBuilder.)
Protected method | CreateSyncCustomActivityContext | Creates a new SyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateSyncMethodContext | Creates a new SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Protected method | CreateThreadContext | Creates a new ThreadLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateTypeSource | Creates LoggingTypeSource for the given role and type. (Overrides LoggingBackendCreateTypeSource(LoggingNamespaceSource, Type).)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingBackend.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from TextLoggingBackend.)
Public method | GetAsyncContextOfTask | Gets the AsyncMethodLoggingContext associated with a Task. (Inherited from LoggingBackend.)
Protected method | GetBackendOptions | Gets the formatting and rendering options for the current LoggingBackend. (Inherited from TextLoggingBackend.)
Public method | GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace. (Inherited from LoggingBackend.)
Public method | GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type. (Inherited from LoggingBackend.)
Protected method | GetTextBackendOptions | Gets the options. (Overrides TextLoggingBackendGetTextBackendOptions.)
Public method | GetThreadContext | Returns the ThreadLoggingContext for the current Thread. (Inherited from LoggingBackend.)
Public method | OpenAsyncContext | Gets an AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Public method | OpenCustomActivityContext | Gets a LoggingContext for a custom activity (opened using OpenActivity(String) or OpenAsyncActivity(String)). (Inherited from LoggingBackend.)
Public method | OpenEphemeralContext | Gets an EphemeralLoggingContext for use in a given method. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record. (Inherited from LoggingBackend.)
Public method | OpenIteratorContext | Gets an IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | OpenSyncContext | Gets a SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.NLog Namespace

Other Resources

Conceptual: Adding Detailed Logging to your Solution
Conceptual: Logging to NLog


NLogLoggingBackend Constructor

Overload List
 | Name | Description
Public method | NLogLoggingBackend | Initializes a new NLogLoggingBackend.
Public method | NLogLoggingBackend(LogFactory) | Initializes a new NLogLoggingBackend and specifies the target LogFactory.
Top
See Also

Reference

NLogLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.NLog Namespace


NLogLoggingBackend Constructor

Initializes a new NLogLoggingBackend.

Namespace: PostSharp.Patterns.Diagnostics.Backends.NLog
Assembly: PostSharp.Patterns.Diagnostics.Backends.NLog (in PostSharp.Patterns.Diagnostics.Backends.NLog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public NLogLoggingBackend()
See Also

Reference

NLogLoggingBackend Class
NLogLoggingBackend Overload
PostSharp.Patterns.Diagnostics.Backends.NLog Namespace


NLogLoggingBackend Constructor (LogFactory)

Initializes a new NLogLoggingBackend and specifies the target LogFactory.

Namespace: PostSharp.Patterns.Diagnostics.Backends.NLog
Assembly: PostSharp.Patterns.Diagnostics.Backends.NLog (in PostSharp.Patterns.Diagnostics.Backends.NLog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public NLogLoggingBackend(
    LogFactory logFactory
)

Parameters

logFactory
Type: LogFactory
The LogFactory that should be used to create the target loggers, or null to use the globally-shared logger.
See Also

Reference

NLogLoggingBackend Class
NLogLoggingBackend Overload
PostSharp.Patterns.Diagnostics.Backends.NLog Namespace


NLogLoggingBackend Properties

The NLogLoggingBackend type exposes the following members.

Properties
 | Name | Description
Public property | CurrentContext | Gets the current LoggingContext. (Inherited from LoggingBackend.)
Public property | IsCorrupted | (Inherited from LoggingBackend.)
Public property | IsDisposed | Determines whether the current LoggingBackend has been disposed. (Inherited from LoggingBackend.)
Public property | IsEnabled | Determines whether the current LoggingBackend is currently enabled. This property has precedence over, and does not affect, the minimal log levels set through the SetLevel(LogLevel) method. (Inherited from LoggingBackend.)
Public property | LogFactory | Gets the LogFactory passed to the constructor of the current NLogLoggingBackend, or null if no logger was passed during the instantiation of the current NLogLoggingBackend.
Public property | Options | Gets the back-end options.
Top
See Also

Reference

NLogLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.NLog Namespace


NLogLoggingBackend.LogFactory Property

NLogLoggingBackendLogFactory Property

Gets the LogFactory passed to the constructor of the current NLogLoggingBackend, or null if no logger was passed during the instantiation of the current NLogLoggingBackend.

Namespace: PostSharp.Patterns.Diagnostics.Backends.NLog
Assembly: PostSharp.Patterns.Diagnostics.Backends.NLog (in PostSharp.Patterns.Diagnostics.Backends.NLog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogFactory LogFactory { get; }

Property Value

Type: LogFactory
See Also

Reference

NLogLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.NLog Namespace


NLogLoggingBackend.Options Property

NLogLoggingBackendOptions Property

Gets the back-end options.

Namespace: PostSharp.Patterns.Diagnostics.Backends.NLog
Assembly: PostSharp.Patterns.Diagnostics.Backends.NLog (in PostSharp.Patterns.Diagnostics.Backends.NLog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public NLogLoggingBackendOptions Options { get; }

Property Value

Type: NLogLoggingBackendOptions
See Also

Reference

NLogLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.NLog Namespace


NLogLoggingBackend Methods

The NLogLoggingBackend type exposes the following members.

Methods
 | Name | Description
Protected method | CreateAsyncCustomActivityContext | Creates a new AsyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateAsyncMethodContext | Creates a new AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Protected method | CreateEphemeralContext | Creates a new EphemeralLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateIteratorContext | Creates a new IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | CreateRecordBuilder | Creates a new LogRecordBuilder. (Overrides LoggingBackendCreateRecordBuilder.)
Protected method | CreateSyncCustomActivityContext | Creates a new SyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateSyncMethodContext | Creates a new SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Protected method | CreateThreadContext | Creates a new ThreadLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateTypeSource | Creates LoggingTypeSource for the given role and type. (Overrides LoggingBackendCreateTypeSource(LoggingNamespaceSource, Type).)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingBackend.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from TextLoggingBackend.)
Public method | GetAsyncContextOfTask | Gets the AsyncMethodLoggingContext associated with a Task. (Inherited from LoggingBackend.)
Protected method | GetBackendOptions | Gets the formatting and rendering options for the current LoggingBackend. (Inherited from TextLoggingBackend.)
Public method | GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace. (Inherited from LoggingBackend.)
Public method | GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type. (Inherited from LoggingBackend.)
Protected method | GetTextBackendOptions | Gets the options. (Overrides TextLoggingBackendGetTextBackendOptions.)
Public method | GetThreadContext | Returns the ThreadLoggingContext for the current Thread. (Inherited from LoggingBackend.)
Public method | OpenAsyncContext | Gets an AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Public method | OpenCustomActivityContext | Gets a LoggingContext for a custom activity (opened using OpenActivity(String) or OpenAsyncActivity(String)). (Inherited from LoggingBackend.)
Public method | OpenEphemeralContext | Gets an EphemeralLoggingContext for use in a given method. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record. (Inherited from LoggingBackend.)
Public method | OpenIteratorContext | Gets an IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | OpenSyncContext | Gets a SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Top
See Also

Reference

NLogLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.NLog Namespace


NLogLoggingBackend.CreateRecordBuilder Method

NLogLoggingBackendCreateRecordBuilder Method

Creates a new LogRecordBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Backends.NLog
Assembly: PostSharp.Patterns.Diagnostics.Backends.NLog (in PostSharp.Patterns.Diagnostics.Backends.NLog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override LogRecordBuilder CreateRecordBuilder()

Return Value

Type: LogRecordBuilder
A new LogRecordBuilder.
See Also

Reference

NLogLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.NLog Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


NLogLoggingBackend.CreateTypeSource Method

NLogLoggingBackendCreateTypeSource Method

Creates LoggingTypeSource for the given role and type.

Namespace: PostSharp.Patterns.Diagnostics.Backends.NLog
Assembly: PostSharp.Patterns.Diagnostics.Backends.NLog (in PostSharp.Patterns.Diagnostics.Backends.NLog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override LoggingTypeSource CreateTypeSource(
    LoggingNamespaceSource parent,
    Type type
)

Parameters

parent
Type: PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
type
Type: SystemType

Return Value

Type: LoggingTypeSource
See Also

Reference

NLogLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.NLog Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


NLogLoggingBackend.GetTextBackendOptions Method

NLogLoggingBackendGetTextBackendOptions Method

Gets the options.

Namespace: PostSharp.Patterns.Diagnostics.Backends.NLog
Assembly: PostSharp.Patterns.Diagnostics.Backends.NLog (in PostSharp.Patterns.Diagnostics.Backends.NLog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override TextLoggingBackendOptions GetTextBackendOptions()

Return Value

Type: TextLoggingBackendOptions
See Also

Reference

NLogLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.NLog Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


NLogLoggingBackendOptions Class

Options for NLogLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingBackendOptions
PostSharp.Patterns.Diagnostics.BackendsTextLoggingBackendOptions
PostSharp.Patterns.Diagnostics.Backends.NLogNLogLoggingBackendOptions

Namespace: PostSharp.Patterns.Diagnostics.Backends.NLog
Assembly: PostSharp.Patterns.Diagnostics.Backends.NLog (in PostSharp.Patterns.Diagnostics.Backends.NLog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class NLogLoggingBackendOptions : TextLoggingBackendOptions

The NLogLoggingBackendOptions type exposes the following members.

Constructors
 | Name | Description
Public method | NLogLoggingBackendOptions | Initializes a new NLogLoggingBackendOptions.
Top
Properties
 | Name | Description
Public property | ActionMaxLength | Max length of a log record. The default value is 2048. (Inherited from TextLoggingBackendOptions.)
Public property | AppendTrailingPeriod | Determines whether log messages should be ended with a trailing period. The default value is true because we really like trailing periods at PostSharp, but other opinions are valid. (Inherited from TextLoggingBackendOptions.)
Public property | ContextMaxLength | Max length of the Description property. (Inherited from LoggingBackendOptions.)
Public property | Delimiter | String used to separate different parts of the logging record. The default value is a pipe surrounded by spaces ( | ). (Inherited from TextLoggingBackendOptions.)
Public property | GetLogger | Function mapping an NLogLoggingTypeSource to an NLog Logger. The default behavior is to call typeSource.Backend.LogFactory?.GetLogger( typeSource.Role ) ?? LogManager.GetLogger( typeSource.Role ).
Public property | IncludeExceptionDetails | Determines whether exception details (basically Exception.ToString) should be appended to the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeNamespace | Determines whether the full namespace of types should be included in the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeType | Determines whether the name of the type of the logged method should be included in the log. The default value is true. (Inherited from TextLoggingBackendOptions.)
Public property | IndentSpaces | Number of spaces for each indentation level. The default value is 2. (Inherited from TextLoggingBackendOptions.)
Public property | LogLevelIgnoredForSystemRecords | Determines whether the Level property is ignored by the current back-end for auto-generated (i.e. non-manual) logging records. Some back-ends may not support overriding the level of records. (Inherited from LoggingBackendOptions.)
Public property | ShouldLogExceptionPredicate | Gets or sets a predicate that determines whether an exception should be logged. This predicate is evaluated only when the method entry is not logged. When the method entry is logged, exceptions are always logged. (Inherited from TextLoggingBackendOptions.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.NLog Namespace


NLogLoggingBackendOptions Constructor

Initializes a new NLogLoggingBackendOptions.

Namespace: PostSharp.Patterns.Diagnostics.Backends.NLog
Assembly: PostSharp.Patterns.Diagnostics.Backends.NLog (in PostSharp.Patterns.Diagnostics.Backends.NLog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public NLogLoggingBackendOptions()
See Also

Reference

NLogLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.NLog Namespace


NLogLoggingBackendOptions Properties

The NLogLoggingBackendOptions type exposes the following members.

Properties
 | Name | Description
Public property | ActionMaxLength | Max length of a log record. The default value is 2048. (Inherited from TextLoggingBackendOptions.)
Public property | AppendTrailingPeriod | Determines whether log messages should be ended with a trailing period. The default value is true because we really like trailing periods at PostSharp, but other opinions are valid. (Inherited from TextLoggingBackendOptions.)
Public property | ContextMaxLength | Max length of the Description property. (Inherited from LoggingBackendOptions.)
Public property | Delimiter | String used to separate different parts of the logging record. The default value is a pipe surrounded by spaces ( | ). (Inherited from TextLoggingBackendOptions.)
Public property | GetLogger | Function mapping an NLogLoggingTypeSource to an NLog Logger. The default behavior is to call typeSource.Backend.LogFactory?.GetLogger( typeSource.Role ) ?? LogManager.GetLogger( typeSource.Role ).
Public property | IncludeExceptionDetails | Determines whether exception details (basically Exception.ToString) should be appended to the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeNamespace | Determines whether the full namespace of types should be included in the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeType | Determines whether the name of the type of the logged method should be included in the log. The default value is true. (Inherited from TextLoggingBackendOptions.)
Public property | IndentSpaces | Number of spaces for each indentation level. The default value is 2. (Inherited from TextLoggingBackendOptions.)
Public property | LogLevelIgnoredForSystemRecords | Determines whether the Level property is ignored by the current back-end for auto-generated (i.e. non-manual) logging records. Some back-ends may not support overriding the level of records. (Inherited from LoggingBackendOptions.)
Public property | ShouldLogExceptionPredicate | Gets or sets a predicate that determines whether an exception should be logged. This predicate is evaluated only when the method entry is not logged. When the method entry is logged, exceptions are always logged. (Inherited from TextLoggingBackendOptions.)
Top
See Also

Reference

NLogLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.NLog Namespace


NLogLoggingBackendOptions.GetLogger Property

NLogLoggingBackendOptionsGetLogger Property

Function mapping an NLogLoggingTypeSource to an NLog Logger. The default behavior is to call typeSource.Backend.LogFactory?.GetLogger( typeSource.Role ) ?? LogManager.GetLogger( typeSource.Role ).

Namespace: PostSharp.Patterns.Diagnostics.Backends.NLog
Assembly: PostSharp.Patterns.Diagnostics.Backends.NLog (in PostSharp.Patterns.Diagnostics.Backends.NLog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Func<NLogLoggingTypeSource, Logger> GetLogger { get; set; }

Property Value

Type: Func NLogLoggingTypeSource, Logger
See Also

Reference

NLogLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.NLog Namespace


NLogLoggingTypeSource Class

The LoggingTypeSource for NLogLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
PostSharp.Patterns.DiagnosticsLoggingTypeSource
PostSharp.Patterns.Diagnostics.Backends.NLogNLogLoggingTypeSource

Namespace: PostSharp.Patterns.Diagnostics.Backends.NLog
Assembly: PostSharp.Patterns.Diagnostics.Backends.NLog (in PostSharp.Patterns.Diagnostics.Backends.NLog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class NLogLoggingTypeSource : LoggingTypeSource

The NLogLoggingTypeSource type exposes the following members.

Constructors
 | Name | Description
Public method | NLogLoggingTypeSource | Initializes a new NLogLoggingTypeSource.
Top
Properties
 | Name | Description
Public property | Backend | Gets the parent NLogLoggingBackend.
Public property | DisplayFullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the DisplayFullName property does not include the arity, i.e. the full name of List<T> is System.Collections.Generic.List. (Inherited from LoggingNamespaceSource.)
Public property | DisplayName | Gets the last component of the name of the type or namespace, in the form that should be reported to the log. For generic types, the DisplayName property does not include the arity, i.e. the name of List<T> is List. (Inherited from LoggingNamespaceSource.)
Public property | FullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the FullName property includes the arity, i.e. the full name of List<T> is System.Collections.Generic.List`1. (Inherited from LoggingNamespaceSource.)
Public property | GenericParameterCount | Gets the number of generic parameters in SourceType. (Inherited from LoggingTypeSource.)
Public property | Level | Gets the minimal LogLevel for which logging is enabled for the current namespace or type. (Inherited from LoggingNamespaceSource.)
Public property | Logger | Gets the Logger associated to the current NLogLoggingTypeSource.
Public property | Name | Gets the last component of the name of the type or namespace. For instance, when FullName is PostSharp.Patterns.Diagnostics.LoggingBackend, Name is LoggingBackend. For generic types, the Name property includes the arity, i.e. the name of List<T> is List`1. (Inherited from LoggingNamespaceSource.)
Public property | Options | Gets the LoggingRoleConfiguration for the current role. This property is a shortcut to LoggingServices.Roles[this.Role]. (Inherited from LoggingTypeSource.)
Public property | Parent | Gets the parent LoggingNamespaceSource, or null if the current object represents the root namespace. (Inherited from LoggingNamespaceSource.)
Public property | Role | Gets the logging role for the current role. Typical values of this property are listed in the LoggingRoles class. (Inherited from LoggingNamespaceSource.)
Public property | SourceType | The type represented by the current LoggingTypeSource. (Inherited from LoggingTypeSource.)
Top
Methods
 | Name | Description
Protected method | IsBackendEnabled | Checks whether logging is enabled in the back-end for the given level. (Overrides LoggingTypeSourceIsBackendEnabled(LogLevel).)
Public method | IsEnabled | Determines whether logging is enabled for the given LogLevel. (Inherited from LoggingTypeSource.)
Public method | Refresh | Refreshes the logging level from the back-end from the current node and all children nodes. The back-end-defined logging level is cached for performance reasons. (Inherited from LoggingTypeSource.)
Public method | SetLevel | Sets the minimal LogLevel for which logging is enabled for the current namespace and type and all children namespaces and types. (Inherited from LoggingNamespaceSource.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.NLog Namespace


NLogLoggingTypeSource Constructor

Initializes a new NLogLoggingTypeSource.

Namespace: PostSharp.Patterns.Diagnostics.Backends.NLog
Assembly: PostSharp.Patterns.Diagnostics.Backends.NLog (in PostSharp.Patterns.Diagnostics.Backends.NLog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public NLogLoggingTypeSource(
    LoggingNamespaceSource parent,
    Type type
)

Parameters

parent
Type: PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
The parent LoggingNamespaceSource.
type
Type: SystemType
The Type being logged.
See Also

Reference

NLogLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.NLog Namespace


NLogLoggingTypeSource Properties

The NLogLoggingTypeSource type exposes the following members.

Properties
 | Name | Description
Public property | Backend | Gets the parent NLogLoggingBackend.
Public property | DisplayFullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the DisplayFullName property does not include the arity, i.e. the full name of List<T> is System.Collections.Generic.List. (Inherited from LoggingNamespaceSource.)
Public property | DisplayName | Gets the last component of the name of the type or namespace, in the form that should be reported to the log. For generic types, the DisplayName property does not include the arity, i.e. the name of List<T> is List. (Inherited from LoggingNamespaceSource.)
Public property | FullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the FullName property includes the arity, i.e. the full name of List<T> is System.Collections.Generic.List`1. (Inherited from LoggingNamespaceSource.)
Public property | GenericParameterCount | Gets the number of generic parameters in SourceType. (Inherited from LoggingTypeSource.)
Public property | Level | Gets the minimal LogLevel for which logging is enabled for the current namespace or type. (Inherited from LoggingNamespaceSource.)
Public property | Logger | Gets the Logger associated to the current NLogLoggingTypeSource.
Public property | Name | Gets the last component of the name of the type or namespace. For instance, when FullName is PostSharp.Patterns.Diagnostics.LoggingBackend, Name is LoggingBackend. For generic types, the Name property includes the arity, i.e. the name of List<T> is List`1. (Inherited from LoggingNamespaceSource.)
Public property | Options | Gets the LoggingRoleConfiguration for the current role. This property is a shortcut to LoggingServices.Roles[this.Role]. (Inherited from LoggingTypeSource.)
Public property | Parent | Gets the parent LoggingNamespaceSource, or null if the current object represents the root namespace. (Inherited from LoggingNamespaceSource.)
Public property | Role | Gets the logging role for the current role. Typical values of this property are listed in the LoggingRoles class. (Inherited from LoggingNamespaceSource.)
Public property | SourceType | The type represented by the current LoggingTypeSource. (Inherited from LoggingTypeSource.)
Top
See Also

Reference

NLogLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.NLog Namespace


NLogLoggingTypeSource.Backend Property

NLogLoggingTypeSourceBackend Property

Gets the parent NLogLoggingBackend.

Namespace: PostSharp.Patterns.Diagnostics.Backends.NLog
Assembly: PostSharp.Patterns.Diagnostics.Backends.NLog (in PostSharp.Patterns.Diagnostics.Backends.NLog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public NLogLoggingBackend Backend { get; }

Property Value

Type: NLogLoggingBackend
See Also

Reference

NLogLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.NLog Namespace


NLogLoggingTypeSource.Logger Property

NLogLoggingTypeSourceLogger Property

Gets the Logger associated to the current NLogLoggingTypeSource.

Namespace: PostSharp.Patterns.Diagnostics.Backends.NLog
Assembly: PostSharp.Patterns.Diagnostics.Backends.NLog (in PostSharp.Patterns.Diagnostics.Backends.NLog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Logger Logger { get; }

Property Value

Type: Logger
See Also

Reference

NLogLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.NLog Namespace


NLogLoggingTypeSource Methods

The NLogLoggingTypeSource type exposes the following members.

Methods
 | Name | Description
Protected method | IsBackendEnabled | Checks whether logging is enabled in the back-end for the given level. (Overrides LoggingTypeSourceIsBackendEnabled(LogLevel).)
Public method | IsEnabled | Determines whether logging is enabled for the given LogLevel. (Inherited from LoggingTypeSource.)
Public method | Refresh | Refreshes the logging level from the back-end from the current node and all children nodes. The back-end-defined logging level is cached for performance reasons. (Inherited from LoggingTypeSource.)
Public method | SetLevel | Sets the minimal LogLevel for which logging is enabled for the current namespace and type and all children namespaces and types. (Inherited from LoggingNamespaceSource.)
Top
See Also

Reference

NLogLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.NLog Namespace


NLogLoggingTypeSource.IsBackendEnabled Method

NLogLoggingTypeSourceIsBackendEnabled Method

Checks whether logging is enabled in the back-end for the given level.

Namespace: PostSharp.Patterns.Diagnostics.Backends.NLog
Assembly: PostSharp.Patterns.Diagnostics.Backends.NLog (in PostSharp.Patterns.Diagnostics.Backends.NLog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override bool IsBackendEnabled(
    LogLevel level
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel

Return Value

Type: Boolean
Remarks

The result of this method is cached. To invalidate the cache, call the Refresh method.

See Also

Reference

NLogLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.NLog Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


NLogLogRecordBuilder Class

LogRecordBuilder for NLogLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.RecordBuildersLogRecordBuilder
PostSharp.Patterns.Diagnostics.RecordBuildersTextLogRecordBuilder
PostSharp.Patterns.Diagnostics.Backends.NLogNLogLogRecordBuilder

Namespace: PostSharp.Patterns.Diagnostics.Backends.NLog
Assembly: PostSharp.Patterns.Diagnostics.Backends.NLog (in PostSharp.Patterns.Diagnostics.Backends.NLog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class NLogLogRecordBuilder : TextLogRecordBuilder

The NLogLogRecordBuilder type exposes the following members.

Constructors
 | Name | Description
Public method | NLogLogRecordBuilder | Initializes a new NLogLogRecordBuilder.
Top
Properties
 | Name | Description
Public property | Backend | Gets the parent back-end. (Inherited from TextLogRecordBuilder.)
Public property | BackendOptions | Shortcut for this.Backend.Options. (Inherited from TextLogRecordBuilder.)
Protected property | Context | Gets the LoggingContext to which the record belongs. (Inherited from LogRecordBuilder.)
Public property | Exception | Gets the Exception for the current record, or null if no exception is associated to the current record. (Inherited from TextLogRecordBuilder.)
Public property | IsDisposed | (Inherited from LogRecordBuilder.)
Protected property | Level | Gets the LogLevel for the current record. (Inherited from TextLogRecordBuilder.)
Public property | MemberName | Gets the name of the method, property or field for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Options | Gets the LoggingOptions for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Profile | Gets the LoggingProfile for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | RecordKind | Gets the kind of the current record (e.g. MethodEntry or MethodException). (Inherited from LogRecordBuilder.)
Public property | SourceLineInfo | Gets the SourceLineInfo for the current record. (Inherited from TextLogRecordBuilder.)
Public property | SourceType | Gets the source Type of the current record. (Inherited from TextLogRecordBuilder.)
Protected property | StringBuilder | Gets the current UnsafeStringBuilder where everything is being appended. (Inherited from TextLogRecordBuilder.)
Protected property | ThreadContext | Gets the ThreadLoggingContext to which the current LogRecordBuilder belongs. (Inherited from LogRecordBuilder.)
Protected property | TypeSource | Gets the LoggingTypeSource for the current record. (Inherited from TextLogRecordBuilder.)
Top
Methods
 | Name | Description
Protected method | AppendAsyncInfo | Appends information about the async method to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendClosingParenthesisConditional | Appends a closing parenthesis to the current StringBuilder if required. (Inherited from TextLogRecordBuilder.)
Protected method | AppendComma | (Inherited from TextLogRecordBuilder.)
Protected method | AppendCommaConditional | Appends a comma to the current StringBuilder, unless this method is invoked for the first time for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription | Appends the context Description (or the TypeSource name, if the type of the context is not equal to the source type of the record) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription(LoggingContext) | (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiter | Appends a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiterConditional | Appends a Delimiter to the current StringBuilder if the RequireDelimiter method has been called previously. (Inherited from TextLogRecordBuilder.)
Protected method | AppendEpilogue | Appends the final part of log message to StringBuilder. This includes state machine number and execution time where relevant, but does not include exception details. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExceptionDetails | Appends exception details to StringBuilder if IncludeExceptionDetails is set. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTime | Appends the execution time to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTimeThreshold | Appends the execution time threshold to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendIndentString | Appends indentation for the given to StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendMemberName | Appends name of the member for the current record (including the declaring type name, subject to the IncludeType property) to the current StringBuilder, as well as an opening parenthesis. (Inherited from TextLogRecordBuilder.)
Protected method | AppendOpeningParenthesis | Appends an opening parenthesis to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendProlog | Appends the indent string, context description, and the record kind to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendRecordKind | Appends the LogRecordKind of the current record to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameter(SemanticParameterKind, String, String, String, Int32) | Appends a parameter of String type to the current StringBuilder. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSourceLineInfo | Appends source (file, line) information to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpaces | Appends a given number of spaces to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpecialChar | Appends a special Char (which may require escaping with specific back-ends) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTrailingPeriod | Appends a trailing period (.) to the current StringBuilder, respecting the AppendTrailingPeriod property. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTypeName | Appends the name of the TypeSource to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | BeginCustomRecord | Initializes the current LogRecordBuilder to emit a custom record. (Inherited from TextLogRecordBuilder.)
Public method | BeginRecord | Initializes the current LogRecordBuilder to emit a standard (i.e. non-custom) record for a given context and method. (Inherited from TextLogRecordBuilder.)
Public method | Complete | Emits the record and resets the current LogRecordBuilder. This method invoked after all SetThisT(T), SetParameterT(Int32, String, ParameterKind, String, T) and similar methods have been called. (Inherited from LogRecordBuilder.)
Public method | Dispose | (Inherited from LogRecordBuilder.)
Protected method | EmitRecord | Emits the record. Invoked by the Complete method. (Overrides TextLogRecordBuilderEmitRecord.)
Protected method | EmitRecord(Boolean) | Emits the record and specifies whether exception details should be appended to the text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescription | Ends building the context Description and starts building the action text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescriptionConditional | Switches between building the context Description and the action text. If the EndContextDescriptionConditional method has been previously invoked, subsequent calls are ignored. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescription | Obsolete. Gets the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescriptionUnsafe | Obsolete. Gets an UnsafeString representing the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextForDescription | Obsolete. Gets the LoggingContext that should be used when getting or appending the Description. (Inherited from TextLogRecordBuilder.)
Protected method | GetSourceName | Gets the name of the TypeSource for the current record, respecting the IncludeNamespace property. (Inherited from TextLogRecordBuilder.)
Protected method | HasRecordKindName | Determines whether the AppendRecordKind will append anything for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | MustBuildContextDescription | Determines whether the current Description should be appended to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | RequireComma | Makes the AppendCommaConditional to append a comma even if it's invoked for the first time. (Inherited from TextLogRecordBuilder.)
Protected method | RequireDelimiter | Causes the next call to the AppendDelimiterConditional to append a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | Reset | Resets all fields and properties of the current LogRecordBuilder to their initial value. Invoked by the Complete method. (Inherited from TextLogRecordBuilder.)
Public method | SetException | Sets the exception for the method or activity. (Inherited from TextLogRecordBuilder.)
Public method | SetExecutionTime | Sets the method or activity execution time. (Inherited from TextLogRecordBuilder.)
Public method | SetMethodGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T) | Sets the value of a given parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from TextLogRecordBuilder.)
Public method | SetRefStructParameter | (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T) | Sets a given return value (there can be several return values in C# 7.0) and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetThisT(T) | Sets the this (instance) value and uses the default formatter. This method is only invoked if the IncludeThisValue property is true. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetTypeGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Protected method | ShouldLogExceptionDetails | Determines whether exception details should be appended to the text of the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | ToString | Returns a string that represents the current object. (Inherited from TextLogRecordBuilder.)
Protected method | Write | Writes the final message to the back-end. (Overrides TextLogRecordBuilderWrite(UnsafeString).)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T) | Writes a custom parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | WriteCustomString | Write a chunk of custom string. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.NLog Namespace


NLogLogRecordBuilder Constructor

Initializes a new NLogLogRecordBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Backends.NLog
Assembly: PostSharp.Patterns.Diagnostics.Backends.NLog (in PostSharp.Patterns.Diagnostics.Backends.NLog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public NLogLogRecordBuilder(
    NLogLoggingBackend backend
)

Parameters

backend
Type: PostSharp.Patterns.Diagnostics.Backends.NLogNLogLoggingBackend
See Also

Reference

NLogLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.NLog Namespace


NLogLogRecordBuilder Properties

The NLogLogRecordBuilder type exposes the following members.

Properties
 | Name | Description
Public property | Backend | Gets the parent back-end. (Inherited from TextLogRecordBuilder.)
Public property | BackendOptions | Shortcut for this.Backend.Options. (Inherited from TextLogRecordBuilder.)
Protected property | Context | Gets the LoggingContext to which the record belongs. (Inherited from LogRecordBuilder.)
Public property | Exception | Gets the Exception for the current record, or null if no exception is associated to the current record. (Inherited from TextLogRecordBuilder.)
Public property | IsDisposed | (Inherited from LogRecordBuilder.)
Protected property | Level | Gets the LogLevel for the current record. (Inherited from TextLogRecordBuilder.)
Public property | MemberName | Gets the name of the method, property or field for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Options | Gets the LoggingOptions for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Profile | Gets the LoggingProfile for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | RecordKind | Gets the kind of the current record (e.g. MethodEntry or MethodException). (Inherited from LogRecordBuilder.)
Public property | SourceLineInfo | Gets the SourceLineInfo for the current record. (Inherited from TextLogRecordBuilder.)
Public property | SourceType | Gets the source Type of the current record. (Inherited from TextLogRecordBuilder.)
Protected property | StringBuilder | Gets the current UnsafeStringBuilder where everything is being appended. (Inherited from TextLogRecordBuilder.)
Protected property | ThreadContext | Gets the ThreadLoggingContext to which the current LogRecordBuilder belongs. (Inherited from LogRecordBuilder.)
Protected property | TypeSource | Gets the LoggingTypeSource for the current record. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

NLogLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.NLog Namespace


NLogLogRecordBuilder Methods

The NLogLogRecordBuilder type exposes the following members.

Methods
 | Name | Description
Protected method | AppendAsyncInfo | Appends information about the async method to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendClosingParenthesisConditional | Appends a closing parenthesis to the current StringBuilder if required. (Inherited from TextLogRecordBuilder.)
Protected method | AppendComma | (Inherited from TextLogRecordBuilder.)
Protected method | AppendCommaConditional | Appends a comma to the current StringBuilder, unless this method is invoked for the first time for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription | Appends the context Description (or the TypeSource name, if the type of the context is not equal to the source type of the record) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription(LoggingContext) | (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiter | Appends a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiterConditional | Appends a Delimiter to the current StringBuilder if the RequireDelimiter method has been called previously. (Inherited from TextLogRecordBuilder.)
Protected method | AppendEpilogue | Appends the final part of log message to StringBuilder. This includes state machine number and execution time where relevant, but does not include exception details. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExceptionDetails | Appends exception details to StringBuilder if IncludeExceptionDetails is set. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTime | Appends the execution time to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTimeThreshold | Appends the execution time threshold to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendIndentString | Appends indentation for the given to StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendMemberName | Appends name of the member for the current record (including the declaring type name, subject to the IncludeType property) to the current StringBuilder, as well as an opening parenthesis. (Inherited from TextLogRecordBuilder.)
Protected method | AppendOpeningParenthesis | Appends an opening parenthesis to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendProlog | Appends the indent string, context description, and the record kind to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendRecordKind | Appends the LogRecordKind of the current record to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameter(SemanticParameterKind, String, String, String, Int32) | Appends a parameter of String type to the current StringBuilder. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSourceLineInfo | Appends source (file, line) information to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpaces | Appends a given number of spaces to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpecialChar | Appends a special Char (which may require escaping with specific back-ends) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTrailingPeriod | Appends a trailing period (.) to the current StringBuilder, respecting the AppendTrailingPeriod property. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTypeName | Appends the name of the TypeSource to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | BeginCustomRecord | Initializes the current LogRecordBuilder to emit a custom record. (Inherited from TextLogRecordBuilder.)
Public method | BeginRecord | Initializes the current LogRecordBuilder to emit a standard (i.e. non-custom) record for a given context and method. (Inherited from TextLogRecordBuilder.)
Public method | Complete | Emits the record and resets the current LogRecordBuilder. This method invoked after all SetThisT(T), SetParameterT(Int32, String, ParameterKind, String, T) and similar methods have been called. (Inherited from LogRecordBuilder.)
Public method | Dispose | (Inherited from LogRecordBuilder.)
Protected method | EmitRecord | Emits the record. Invoked by the Complete method. (Overrides TextLogRecordBuilderEmitRecord.)
Protected method | EmitRecord(Boolean) | Emits the record and specifies whether exception details should be appended to the text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescription | Ends building the context Description and starts building the action text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescriptionConditional | Switches between building the context Description and the action text. If the EndContextDescriptionConditional method has been previously invoked, subsequent calls are ignored. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescription | Obsolete. Gets the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescriptionUnsafe | Obsolete. Gets an UnsafeString representing the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextForDescription | Obsolete. Gets the LoggingContext that should be used when getting or appending the Description. (Inherited from TextLogRecordBuilder.)
Protected method | GetSourceName | Gets the name of the TypeSource for the current record, respecting the IncludeNamespace property. (Inherited from TextLogRecordBuilder.)
Protected method | HasRecordKindName | Determines whether the AppendRecordKind will append anything for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | MustBuildContextDescription | Determines whether the current Description should be appended to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | RequireComma | Makes the AppendCommaConditional to append a comma even if it's invoked for the first time. (Inherited from TextLogRecordBuilder.)
Protected method | RequireDelimiter | Causes the next call to the AppendDelimiterConditional to append a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | Reset | Resets all fields and properties of the current LogRecordBuilder to their initial value. Invoked by the Complete method. (Inherited from TextLogRecordBuilder.)
Public method | SetException | Sets the exception for the method or activity. (Inherited from TextLogRecordBuilder.)
Public method | SetExecutionTime | Sets the method or activity execution time. (Inherited from TextLogRecordBuilder.)
Public method | SetMethodGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T) | Sets the value of a given parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from TextLogRecordBuilder.)
Public method | SetRefStructParameter | (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T) | Sets a given return value (there can be several return values in C# 7.0) and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetThisT(T) | Sets the this (instance) value and uses the default formatter. This method is only invoked if the IncludeThisValue property is true. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetTypeGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Protected method | ShouldLogExceptionDetails | Determines whether exception details should be appended to the text of the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | ToString | Returns a string that represents the current object. (Inherited from TextLogRecordBuilder.)
Protected method | Write | Writes the final message to the back-end. (Overrides TextLogRecordBuilderWrite(UnsafeString).)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T) | Writes a custom parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | WriteCustomString | Write a chunk of custom string. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

NLogLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.NLog Namespace


NLogLogRecordBuilder.EmitRecord Method

NLogLogRecordBuilderEmitRecord Method

Overload List
 | Name | Description
Protected method | EmitRecord | Emits the record. Invoked by the Complete method. (Overrides TextLogRecordBuilderEmitRecord.)
Protected method | EmitRecord(Boolean) | Emits the record and specifies whether exception details should be appended to the text. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

NLogLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.NLog Namespace


NLogLogRecordBuilder.EmitRecord Method

NLogLogRecordBuilderEmitRecord Method

Emits the record. Invoked by the Complete method.

Namespace: PostSharp.Patterns.Diagnostics.Backends.NLog
Assembly: PostSharp.Patterns.Diagnostics.Backends.NLog (in PostSharp.Patterns.Diagnostics.Backends.NLog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void EmitRecord()
See Also

Reference

NLogLogRecordBuilder Class
EmitRecord Overload
PostSharp.Patterns.Diagnostics.Backends.NLog Namespace


NLogLogRecordBuilder.Write Method

NLogLogRecordBuilderWrite Method

Writes the final message to the back-end.

Namespace: PostSharp.Patterns.Diagnostics.Backends.NLog
Assembly: PostSharp.Patterns.Diagnostics.Backends.NLog (in PostSharp.Patterns.Diagnostics.Backends.NLog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void Write(
    UnsafeString message
)

Parameters

message
Type: PostSharp.Patterns.FormattersUnsafeString
The final message.
See Also

Reference

NLogLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.NLog Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


PostSharp.Patterns.Diagnostics.Backends.Null Namespace

Classes
 | Class | Description
Public class | NullLoggingBackend | Logging back-end that does not do anything.


NullLoggingBackend Class

Logging back-end that does not do anything.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingBackend
PostSharp.Patterns.Diagnostics.Backends.NullNullLoggingBackend

Namespace: PostSharp.Patterns.Diagnostics.Backends.Null
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class NullLoggingBackend : LoggingBackend

The NullLoggingBackend type exposes the following members.

Properties
 | Name | Description
Public property | CurrentContext | Gets the current LoggingContext. (Inherited from LoggingBackend.)
 | Instance | Gets the singleton instance of NullLoggingBackend.
Public property | IsCorrupted | (Inherited from LoggingBackend.)
Public property | IsDisposed | Determines whether the current LoggingBackend has been disposed. (Inherited from LoggingBackend.)
Public property | IsEnabled | Determines whether the current LoggingBackend is currently enabled. This property has precedence over, and does not affect, the minimal log levels set through the SetLevel(LogLevel) method. (Inherited from LoggingBackend.)
Public property | Options | Gets the formatting and rendering options for the current LoggingBackend. (Inherited from LoggingBackend.)
Top
Methods
 | Name | Description
Public method | CreateRecordBuilder | Creates a new LogRecordBuilder. (Overrides LoggingBackendCreateRecordBuilder.)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingBackend.)
Public method | GetAsyncContextOfTask | Gets the AsyncMethodLoggingContext associated with a Task. (Inherited from LoggingBackend.)
Public method | GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace. (Inherited from LoggingBackend.)
Public method | GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type. (Inherited from LoggingBackend.)
Public method | GetThreadContext | Returns the ThreadLoggingContext for the current Thread. (Inherited from LoggingBackend.)
Public method | OpenAsyncContext | Gets an AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Public method | OpenCustomActivityContext | Gets a LoggingContext for a custom activity (opened using OpenActivity(String) or OpenAsyncActivity(String)). (Inherited from LoggingBackend.)
Public method | OpenEphemeralContext | Gets an EphemeralLoggingContext for use in a given method. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record. (Inherited from LoggingBackend.)
Public method | OpenIteratorContext | Gets an IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | OpenSyncContext | Gets a SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Null Namespace


NullLoggingBackend Properties

The NullLoggingBackend type exposes the following members.

Properties
 | Name | Description
Public property | CurrentContext | Gets the current LoggingContext. (Inherited from LoggingBackend.)
 | Instance | Gets the singleton instance of NullLoggingBackend.
Public property | IsCorrupted | (Inherited from LoggingBackend.)
Public property | IsDisposed | Determines whether the current LoggingBackend has been disposed. (Inherited from LoggingBackend.)
Public property | IsEnabled | Determines whether the current LoggingBackend is currently enabled. This property has precedence over, and does not affect, the minimal log levels set through the SetLevel(LogLevel) method. (Inherited from LoggingBackend.)
Public property | Options | Gets the formatting and rendering options for the current LoggingBackend. (Inherited from LoggingBackend.)
Top
See Also

Reference

NullLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Null Namespace


NullLoggingBackend.Instance Property

NullLoggingBackendInstance Property

Gets the singleton instance of NullLoggingBackend.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Null
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static NullLoggingBackend Instance { get; }

Property Value

Type: NullLoggingBackend
See Also

Reference

NullLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Null Namespace


NullLoggingBackend Methods

The NullLoggingBackend type exposes the following members.

Methods
 | Name | Description
Public method | CreateRecordBuilder | Creates a new LogRecordBuilder. (Overrides LoggingBackendCreateRecordBuilder.)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingBackend.)
Public method | GetAsyncContextOfTask | Gets the AsyncMethodLoggingContext associated with a Task. (Inherited from LoggingBackend.)
Public method | GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace. (Inherited from LoggingBackend.)
Public method | GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type. (Inherited from LoggingBackend.)
Public method | GetThreadContext | Returns the ThreadLoggingContext for the current Thread. (Inherited from LoggingBackend.)
Public method | OpenAsyncContext | Gets an AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Public method | OpenCustomActivityContext | Gets a LoggingContext for a custom activity (opened using OpenActivity(String) or OpenAsyncActivity(String)). (Inherited from LoggingBackend.)
Public method | OpenEphemeralContext | Gets an EphemeralLoggingContext for use in a given method. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record. (Inherited from LoggingBackend.)
Public method | OpenIteratorContext | Gets an IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | OpenSyncContext | Gets a SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Top
See Also

Reference

NullLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Null Namespace


NullLoggingBackend.CreateRecordBuilder Method

NullLoggingBackendCreateRecordBuilder Method

Creates a new LogRecordBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Null
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override LogRecordBuilder CreateRecordBuilder()

Return Value

Type: LogRecordBuilder
A new LogRecordBuilder.
See Also

Reference

NullLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Null Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace

Classes
 | Class | Description
Public class | SerilogAsyncCustomActivityContext | The AsyncCustomActivityLoggingContext for SerilogLoggingBackend.
Public class | SerilogAsyncMethodLoggingContext | The AsyncMethodLoggingContext for SerilogLoggingBackend.
Public class | SerilogEphemeralLoggingContext |
Public class | SerilogIteratorLoggingContext | The IteratorLoggingContext for SerilogLoggingBackend.
Public class | SerilogLoggingBackend | Logging back-end for Serilog.
Public class | SerilogLoggingBackendOptions | Options for SerilogLoggingBackend.
Public class | SerilogLoggingTypeSource | The LoggingTypeSource for SerilogLoggingBackend.
Public class | SerilogLogRecordBuilder | The LogRecordBuilder for SerilogLoggingBackend.
Public class | SerilogSemanticParameterCollection | Exposes the options (SerilogSemanticParameterOptions) for individual kinds of Serilog semantic parameters through an indexer. This class can be enumerated.
Public class | SerilogSemanticParameterOptions | Define options for a specific kind of semantic parameter.
Public class | SerilogSyncCustomActivityContext | The SyncCustomActivityLoggingContext for SerilogLoggingBackend.
Public class | SerilogSyncMethodLoggingContext | The SyncMethodLoggingContext.


SerilogAsyncCustomActivityContext Class

The AsyncCustomActivityLoggingContext for SerilogLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.ContextsLoggingContext
PostSharp.Patterns.Diagnostics.ContextsSuspendableLoggingContext
PostSharp.Patterns.Diagnostics.ContextsAsyncLoggingContext
PostSharp.Patterns.Diagnostics.ContextsAsyncCustomActivityLoggingContext
PostSharp.Patterns.Diagnostics.Backends.SerilogSerilogAsyncCustomActivityContext

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class SerilogAsyncCustomActivityContext : AsyncCustomActivityLoggingContext

The SerilogAsyncCustomActivityContext type exposes the following members.

Constructors
 | Name | Description
Public method | SerilogAsyncCustomActivityContext | Initializes a new SerilogAsyncCustomActivityContext.
Top
Properties
 | Name | Description
Public property | ActivationContext | Gets the LoggingContext in which the current context was activated. If the current context has been resumed, ActivationContext refers to the context in which the context was resumed. (Inherited from LoggingContext.)
Public property | Backend | Gets the parent LoggingBackend of the current context. (Inherited from LoggingContext.)
Public property | CustomActivityKind | Gets the kind of LogActivity of the current context. (Inherited from AsyncCustomActivityLoggingContext.)
Public property | Description | Gets the description of the current context. The description is typically set by the LogRecordBuilder when building the opening record of a context. (Inherited from LoggingContext.)
Public property | Id | Gets or set the identifier of the current context. This property should be used for debugging only. Its value is lazily created. (Inherited from LoggingContext.)
Public property | IndentLevel | Gets or sets the indentation level for the current context. (Inherited from LoggingContext.)
Public property | IsAsync | Determines whether the current LoggingContext represents an async method or an asynchronous custom activity. (Inherited from LoggingContext.)
Public property | IsDisposed | Determines whether the current context has been disposed. (Inherited from LoggingContext.)
Public property | IsSharable | Determines whether the current LoggingContext can be accessed outside of its nominal lifetype (for instance after the method has completed or a custom activity has beeen closed). Since contexts can be pooled and reused, consumers must call the MakeSharable method if they want to keep a reference to the LoggingContext and access it after its nominal lifetime has completed. (Inherited from LoggingContext.)
Public property | IsSuspended | Determines whether the current context is currently suspended (between a Suspend and a Resume). (Inherited from SuspendableLoggingContext.)
Public property | Kind | Gets the kind of the current context. (Inherited from LoggingContext.)
Public property | MemberName | Gets the name of the method or property related to the current context. (Inherited from LoggingContext.)
Public property | ParentContext | Gets the LoggingContext that created (initiated) the current context. This is the logical parent. (Inherited from LoggingContext.)
Public property | Source | Gets the LoggingTypeSource corresponding, typically, to the declaring type of the member associated to the current context. (Inherited from LoggingContext.)
Public property | ThreadContext | Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed. (Inherited from SuspendableLoggingContext.)
Top
Methods
 | Name | Description
Public method | CreateCorrelationCookie | Creates a cookie that can be used to correlate, using the SetCorrelation(CorrelationCookie) method, another context to the current context. (Inherited from LoggingContext.)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from SuspendableLoggingContext.)
Public method | GetCustomRecordBuilder | Gets a LogRecordBuilder for the current context to build a custom record. (Inherited from LoggingContext.)
Public method | GetRecordBuilder | Gets a LogRecordBuilder for the current context to build a standard record for a given method. (Inherited from LoggingContext.)
Public method | MakeSharable | Allows the current context to be shared beyond its normal lifecycle by preventing it from being returned to the pool. (Inherited from LoggingContext.)
Public method | Open | Opens the current context. (Inherited from AsyncCustomActivityLoggingContext.)
Protected method | Reset | Resets the current context to its initial, uninitialized state. This method is called by the Dispose method. (Inherited from LoggingContext.)
Public method | Resume | Resumes the current context. Typically called when the state machine resumes execution, when the wait dependency is satisfied (in case of async methods) or when the MoveNext method is called (in case of iterators). (Inherited from SuspendableLoggingContext.)
Public method | ResumeConditional | Resume the current context, but only if it is currently suspended. (Inherited from SuspendableLoggingContext.)
Public method | SetCorrelation | Associates the current context with another context. (Inherited from LoggingContext.)
Public method | SetWaitDependency | Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts. (Inherited from AsyncCustomActivityLoggingContext.)
Public method | Suspend | Suspends the current context. Typically called when starting to wait for a wait dependency (the operand of the await operator in case of async methods), or after the MoveNext method (in case of iterators). (Inherited from SuspendableLoggingContext.)
Public method | ToString | Returns a string that represents the current object. (Inherited from LoggingContext.)
Protected method | ToString(StringBuilder) | Formats a description of the current LoggingContext into a given StringBuilder. (Inherited from SuspendableLoggingContext.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogAsyncCustomActivityContext Constructor

Initializes a new SerilogAsyncCustomActivityContext.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SerilogAsyncCustomActivityContext(
    SerilogLoggingBackend backend
)

Parameters

backend
Type: PostSharp.Patterns.Diagnostics.Backends.SerilogSerilogLoggingBackend
The parent SerilogLoggingBackend.
See Also

Reference

SerilogAsyncCustomActivityContext Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogAsyncCustomActivityContext Properties

The SerilogAsyncCustomActivityContext type exposes the following members.

Properties
 | Name | Description
Public property | ActivationContext | Gets the LoggingContext in which the current context was activated. If the current context has been resumed, ActivationContext refers to the context in which the context was resumed. (Inherited from LoggingContext.)
Public property | Backend | Gets the parent LoggingBackend of the current context. (Inherited from LoggingContext.)
Public property | CustomActivityKind | Gets the kind of LogActivity of the current context. (Inherited from AsyncCustomActivityLoggingContext.)
Public property | Description | Gets the description of the current context. The description is typically set by the LogRecordBuilder when building the opening record of a context. (Inherited from LoggingContext.)
Public property | Id | Gets or set the identifier of the current context. This property should be used for debugging only. Its value is lazily created. (Inherited from LoggingContext.)
Public property | IndentLevel | Gets or sets the indentation level for the current context. (Inherited from LoggingContext.)
Public property | IsAsync | Determines whether the current LoggingContext represents an async method or an asynchronous custom activity. (Inherited from LoggingContext.)
Public property | IsDisposed | Determines whether the current context has been disposed. (Inherited from LoggingContext.)
Public property | IsSharable | Determines whether the current LoggingContext can be accessed outside of its nominal lifetype (for instance after the method has completed or a custom activity has beeen closed). Since contexts can be pooled and reused, consumers must call the MakeSharable method if they want to keep a reference to the LoggingContext and access it after its nominal lifetime has completed. (Inherited from LoggingContext.)
Public property | IsSuspended | Determines whether the current context is currently suspended (between a Suspend and a Resume). (Inherited from SuspendableLoggingContext.)
Public property | Kind | Gets the kind of the current context. (Inherited from LoggingContext.)
Public property | MemberName | Gets the name of the method or property related to the current context. (Inherited from LoggingContext.)
Public property | ParentContext | Gets the LoggingContext that created (initiated) the current context. This is the logical parent. (Inherited from LoggingContext.)
Public property | Source | Gets the LoggingTypeSource corresponding, typically, to the declaring type of the member associated to the current context. (Inherited from LoggingContext.)
Public property | ThreadContext | Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed. (Inherited from SuspendableLoggingContext.)
Top
See Also

Reference

SerilogAsyncCustomActivityContext Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogAsyncCustomActivityContext Methods

The SerilogAsyncCustomActivityContext type exposes the following members.

Methods
 | Name | Description
Public method | CreateCorrelationCookie | Creates a cookie that can be used to correlate, using the SetCorrelation(CorrelationCookie) method, another context to the current context. (Inherited from LoggingContext.)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from SuspendableLoggingContext.)
Public method | GetCustomRecordBuilder | Gets a LogRecordBuilder for the current context to build a custom record. (Inherited from LoggingContext.)
Public method | GetRecordBuilder | Gets a LogRecordBuilder for the current context to build a standard record for a given method. (Inherited from LoggingContext.)
Public method | MakeSharable | Allows the current context to be shared beyond its normal lifecycle by preventing it from being returned to the pool. (Inherited from LoggingContext.)
Public method | Open | Opens the current context. (Inherited from AsyncCustomActivityLoggingContext.)
Protected method | Reset | Resets the current context to its initial, uninitialized state. This method is called by the Dispose method. (Inherited from LoggingContext.)
Public method | Resume | Resumes the current context. Typically called when the state machine resumes execution, when the wait dependency is satisfied (in case of async methods) or when the MoveNext method is called (in case of iterators). (Inherited from SuspendableLoggingContext.)
Public method | ResumeConditional | Resume the current context, but only if it is currently suspended. (Inherited from SuspendableLoggingContext.)
Public method | SetCorrelation | Associates the current context with another context. (Inherited from LoggingContext.)
Public method | SetWaitDependency | Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts. (Inherited from AsyncCustomActivityLoggingContext.)
Public method | Suspend | Suspends the current context. Typically called when starting to wait for a wait dependency (the operand of the await operator in case of async methods), or after the MoveNext method (in case of iterators). (Inherited from SuspendableLoggingContext.)
Public method | ToString | Returns a string that represents the current object. (Inherited from LoggingContext.)
Protected method | ToString(StringBuilder) | Formats a description of the current LoggingContext into a given StringBuilder. (Inherited from SuspendableLoggingContext.)
Top
See Also

Reference

SerilogAsyncCustomActivityContext Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogAsyncMethodLoggingContext Class

The AsyncMethodLoggingContext for SerilogLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.ContextsLoggingContext
PostSharp.Patterns.Diagnostics.ContextsSuspendableLoggingContext
PostSharp.Patterns.Diagnostics.ContextsAsyncLoggingContext
PostSharp.Patterns.Diagnostics.ContextsAsyncMethodLoggingContext
PostSharp.Patterns.Diagnostics.Backends.SerilogSerilogAsyncMethodLoggingContext

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class SerilogAsyncMethodLoggingContext : AsyncMethodLoggingContext

The SerilogAsyncMethodLoggingContext type exposes the following members.

Constructors
 | Name | Description
Public method | SerilogAsyncMethodLoggingContext | Initializes a new SerilogAsyncCustomActivityContext.
Top
Properties
 | Name | Description
Public property | ActivationContext | Gets the LoggingContext in which the current context was activated. If the current context has been resumed, ActivationContext refers to the context in which the context was resumed. (Inherited from LoggingContext.)
Public property | AsyncCallId | Gets the unique identifier of the asynchronous call represented by the current AsyncMethodLoggingContext. (Inherited from AsyncMethodLoggingContext.)
Public property | AwaitedMethod | Gets the awaited method (i.e. the operand of the await operator), or null if it could not be determined or if the IncludeAwaitedTask profile property is set to false. (Inherited from AsyncMethodLoggingContext.)
Public property | AwaitedTask | Gets the awaited Task (i.e. the operand of the await operator), or null if it could not be determined or if the IncludeAwaitedTask profile property is set to false. (Inherited from AsyncMethodLoggingContext.)
Public property | Backend | Gets the parent LoggingBackend of the current context. (Inherited from LoggingContext.)
Public property | Description | Gets the description of the current context. The description is typically set by the LogRecordBuilder when building the opening record of a context. (Inherited from LoggingContext.)
Public property | Id | Gets or set the identifier of the current context. This property should be used for debugging only. Its value is lazily created. (Inherited from LoggingContext.)
Public property | IndentLevel | Gets or sets the indentation level for the current context. (Inherited from LoggingContext.)
Public property | IsAsync | Determines whether the current LoggingContext represents an async method or an asynchronous custom activity. (Inherited from LoggingContext.)
Public property | IsDisposed | Determines whether the current context has been disposed. (Inherited from LoggingContext.)
Public property | IsSharable | Determines whether the current LoggingContext can be accessed outside of its nominal lifetype (for instance after the method has completed or a custom activity has beeen closed). Since contexts can be pooled and reused, consumers must call the MakeSharable method if they want to keep a reference to the LoggingContext and access it after its nominal lifetime has completed. (Inherited from LoggingContext.)
Public property | IsSuspended | Determines whether the current context is currently suspended (between a Suspend and a Resume). (Inherited from SuspendableLoggingContext.)
Public property | Kind | Gets the kind of the current context. (Inherited from LoggingContext.)
Public property | MemberName | Gets the name of the method or property related to the current context. (Inherited from LoggingContext.)
Public property | ParentContext | Gets the LoggingContext that created (initiated) the current context. This is the logical parent. (Inherited from LoggingContext.)
Public property | Source | Gets the LoggingTypeSource corresponding, typically, to the declaring type of the member associated to the current context. (Inherited from LoggingContext.)
Public property | Task | Gets the Task that is currently associated to the current async method invocation. An async method invocation may be associated to several different tasks during its lifetime. (Inherited from AsyncMethodLoggingContext.)
Public property | ThreadContext | Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed. (Inherited from SuspendableLoggingContext.)
Top
Methods
 | Name | Description
Public method | CreateCorrelationCookie | Creates a cookie that can be used to correlate, using the SetCorrelation(CorrelationCookie) method, another context to the current context. (Inherited from LoggingContext.)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from SuspendableLoggingContext.)
Public method | GetCustomRecordBuilder | Gets a LogRecordBuilder for the current context to build a custom record. (Inherited from LoggingContext.)
Public method | GetRecordBuilder | Gets a LogRecordBuilder for the current context to build a standard record for a given method. (Inherited from LoggingContext.)
Public method | MakeSharable | Allows the current context to be shared beyond its normal lifecycle by preventing it from being returned to the pool. (Inherited from LoggingContext.)
Public method | Open | Opens the context. (Inherited from AsyncMethodLoggingContext.)
Protected method | Reset | Resets the current context to its initial, uninitialized state. This method is called by the Dispose method. (Inherited from LoggingContext.)
Public method | Resume | Resumes the current context. Typically called when the state machine resumes execution, when the wait dependency is satisfied (in case of async methods) or when the MoveNext method is called (in case of iterators). (Inherited from SuspendableLoggingContext.)
Public method | ResumeConditional | Resume the current context, but only if it is currently suspended. (Inherited from SuspendableLoggingContext.)
Public method | SetAwaitedTask | Sets the awaited Task and/or MethodBase (i.e. the operand of the await operator). (Inherited from AsyncMethodLoggingContext.)
Public method | SetCorrelation | Associates the current context with another context. (Inherited from LoggingContext.)
Public method | SetWaitDependency | Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts. (Inherited from LoggingContext.)
Public method | Suspend | Suspends the current context. Typically called when starting to wait for a wait dependency (the operand of the await operator in case of async methods), or after the MoveNext method (in case of iterators). (Inherited from SuspendableLoggingContext.)
Public method | ToString | Returns a string that represents the current object. (Inherited from LoggingContext.)
Protected method | ToString(StringBuilder) | Formats a description of the current LoggingContext into a given StringBuilder. (Inherited from SuspendableLoggingContext.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogAsyncMethodLoggingContext Constructor

Initializes a new SerilogAsyncCustomActivityContext.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SerilogAsyncMethodLoggingContext(
    SerilogLoggingBackend backend
)

Parameters

backend
Type: PostSharp.Patterns.Diagnostics.Backends.SerilogSerilogLoggingBackend
See Also

Reference

SerilogAsyncMethodLoggingContext Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogAsyncMethodLoggingContext Properties

The SerilogAsyncMethodLoggingContext type exposes the following members.

Properties
 | Name | Description
Public property | ActivationContext | Gets the LoggingContext in which the current context was activated. If the current context has been resumed, ActivationContext refers to the context in which the context was resumed. (Inherited from LoggingContext.)
Public property | AsyncCallId | Gets the unique identifier of the asynchronous call represented by the current AsyncMethodLoggingContext. (Inherited from AsyncMethodLoggingContext.)
Public property | AwaitedMethod | Gets the awaited method (i.e. the operand of the await operator), or null if it could not be determined or if the IncludeAwaitedTask profile property is set to false. (Inherited from AsyncMethodLoggingContext.)
Public property | AwaitedTask | Gets the awaited Task (i.e. the operand of the await operator), or null if it could not be determined or if the IncludeAwaitedTask profile property is set to false. (Inherited from AsyncMethodLoggingContext.)
Public property | Backend | Gets the parent LoggingBackend of the current context. (Inherited from LoggingContext.)
Public property | Description | Gets the description of the current context. The description is typically set by the LogRecordBuilder when building the opening record of a context. (Inherited from LoggingContext.)
Public property | Id | Gets or set the identifier of the current context. This property should be used for debugging only. Its value is lazily created. (Inherited from LoggingContext.)
Public property | IndentLevel | Gets or sets the indentation level for the current context. (Inherited from LoggingContext.)
Public property | IsAsync | Determines whether the current LoggingContext represents an async method or an asynchronous custom activity. (Inherited from LoggingContext.)
Public property | IsDisposed | Determines whether the current context has been disposed. (Inherited from LoggingContext.)
Public property | IsSharable | Determines whether the current LoggingContext can be accessed outside of its nominal lifetype (for instance after the method has completed or a custom activity has beeen closed). Since contexts can be pooled and reused, consumers must call the MakeSharable method if they want to keep a reference to the LoggingContext and access it after its nominal lifetime has completed. (Inherited from LoggingContext.)
Public property | IsSuspended | Determines whether the current context is currently suspended (between a Suspend and a Resume). (Inherited from SuspendableLoggingContext.)
Public property | Kind | Gets the kind of the current context. (Inherited from LoggingContext.)
Public property | MemberName | Gets the name of the method or property related to the current context. (Inherited from LoggingContext.)
Public property | ParentContext | Gets the LoggingContext that created (initiated) the current context. This is the logical parent. (Inherited from LoggingContext.)
Public property | Source | Gets the LoggingTypeSource corresponding, typically, to the declaring type of the member associated to the current context. (Inherited from LoggingContext.)
Public property | Task | Gets the Task that is currently associated to the current async method invocation. An async method invocation may be associated to several different tasks during its lifetime. (Inherited from AsyncMethodLoggingContext.)
Public property | ThreadContext | Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed. (Inherited from SuspendableLoggingContext.)
Top
See Also

Reference

SerilogAsyncMethodLoggingContext Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogAsyncMethodLoggingContext Methods

The SerilogAsyncMethodLoggingContext type exposes the following members.

Methods
 | Name | Description
Public method | CreateCorrelationCookie | Creates a cookie that can be used to correlate, using the SetCorrelation(CorrelationCookie) method, another context to the current context. (Inherited from LoggingContext.)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from SuspendableLoggingContext.)
Public method | GetCustomRecordBuilder | Gets a LogRecordBuilder for the current context to build a custom record. (Inherited from LoggingContext.)
Public method | GetRecordBuilder | Gets a LogRecordBuilder for the current context to build a standard record for a given method. (Inherited from LoggingContext.)
Public method | MakeSharable | Allows the current context to be shared beyond its normal lifecycle by preventing it from being returned to the pool. (Inherited from LoggingContext.)
Public method | Open | Opens the context. (Inherited from AsyncMethodLoggingContext.)
Protected method | Reset | Resets the current context to its initial, uninitialized state. This method is called by the Dispose method. (Inherited from LoggingContext.)
Public method | Resume | Resumes the current context. Typically called when the state machine resumes execution, when the wait dependency is satisfied (in case of async methods) or when the MoveNext method is called (in case of iterators). (Inherited from SuspendableLoggingContext.)
Public method | ResumeConditional | Resume the current context, but only if it is currently suspended. (Inherited from SuspendableLoggingContext.)
Public method | SetAwaitedTask | Sets the awaited Task and/or MethodBase (i.e. the operand of the await operator). (Inherited from AsyncMethodLoggingContext.)
Public method | SetCorrelation | Associates the current context with another context. (Inherited from LoggingContext.)
Public method | SetWaitDependency | Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts. (Inherited from LoggingContext.)
Public method | Suspend | Suspends the current context. Typically called when starting to wait for a wait dependency (the operand of the await operator in case of async methods), or after the MoveNext method (in case of iterators). (Inherited from SuspendableLoggingContext.)
Public method | ToString | Returns a string that represents the current object. (Inherited from LoggingContext.)
Protected method | ToString(StringBuilder) | Formats a description of the current LoggingContext into a given StringBuilder. (Inherited from SuspendableLoggingContext.)
Top
See Also

Reference

SerilogAsyncMethodLoggingContext Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogEphemeralLoggingContext Class

Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.ContextsLoggingContext
PostSharp.Patterns.Diagnostics.ContextsEphemeralLoggingContext
PostSharp.Patterns.Diagnostics.Backends.SerilogSerilogEphemeralLoggingContext

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class SerilogEphemeralLoggingContext : EphemeralLoggingContext

The SerilogEphemeralLoggingContext type exposes the following members.

Constructors
 | Name | Description
Public method | SerilogEphemeralLoggingContext | Initializes a new SerilogEphemeralLoggingContext.
Top
Properties
 | Name | Description
Public property | ActivationContext | Gets the LoggingContext in which the current context was activated. If the current context has been resumed, ActivationContext refers to the context in which the context was resumed. (Inherited from EphemeralLoggingContext.)
Public property | Backend | Gets the parent LoggingBackend of the current context. (Inherited from LoggingContext.)
Public property | Description | Gets the description of the current context. The description is typically set by the LogRecordBuilder when building the opening record of a context. (Inherited from LoggingContext.)
Public property | Id | Gets or set the identifier of the current context. This property should be used for debugging only. Its value is lazily created. (Inherited from LoggingContext.)
Public property | IndentLevel | Gets or sets the indentation level for the current context. (Inherited from LoggingContext.)
Public property | IsAsync | Determines whether the current LoggingContext represents an async method or an asynchronous custom activity. (Inherited from LoggingContext.)
Public property | IsDisposed | Determines whether the current context has been disposed. (Inherited from LoggingContext.)
Public property | IsSharable | Determines whether the current LoggingContext can be accessed outside of its nominal lifetype (for instance after the method has completed or a custom activity has beeen closed). Since contexts can be pooled and reused, consumers must call the MakeSharable method if they want to keep a reference to the LoggingContext and access it after its nominal lifetime has completed. (Inherited from LoggingContext.)
Public property | Kind | Gets the kind of the current context. (Inherited from LoggingContext.)
Public property | MemberName | Gets the name of the method or property related to the current context. (Inherited from LoggingContext.)
Public property | ParentContext | Gets the LoggingContext that created (initiated) the current context. This is the logical parent. (Inherited from EphemeralLoggingContext.)
Public property | Source | Gets the LoggingTypeSource corresponding, typically, to the declaring type of the member associated to the current context. (Inherited from LoggingContext.)
Public property | ThreadContext | Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed. (Inherited from EphemeralLoggingContext.)
Top
Methods
 | Name | Description
Public method | CreateCorrelationCookie | Creates a cookie that can be used to correlate, using the SetCorrelation(CorrelationCookie) method, another context to the current context. (Inherited from LoggingContext.)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from EphemeralLoggingContext.)
Public method | GetCustomRecordBuilder | Gets a LogRecordBuilder for the current context to build a custom record. (Inherited from LoggingContext.)
Public method | GetRecordBuilder | Gets a LogRecordBuilder for the current context to build a standard record for a given method. (Inherited from LoggingContext.)
Public method | MakeSharable | Allows the current context to be shared beyond its normal lifecycle by preventing it from being returned to the pool. (Inherited from LoggingContext.)
Public method | Open | Opens the context. (Inherited from EphemeralLoggingContext.)
Protected method | Reset | Resets the current context to its initial, uninitialized state. This method is called by the Dispose method. (Inherited from LoggingContext.)
Public method | SetCorrelation | Associates the current context with another context. (Inherited from LoggingContext.)
Public method | SetWaitDependency | Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts. (Inherited from LoggingContext.)
Public method | ToString | Returns a string that represents the current object. (Inherited from LoggingContext.)
Protected method | ToString(StringBuilder) | Formats a description of the current LoggingContext into a given StringBuilder. (Inherited from LoggingContext.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogEphemeralLoggingContext Constructor

Initializes a new SerilogEphemeralLoggingContext.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SerilogEphemeralLoggingContext(
    SerilogLoggingBackend backend,
    ThreadLoggingContext threadContext
)

Parameters

backend
Type: PostSharp.Patterns.Diagnostics.Backends.SerilogSerilogLoggingBackend
The parent LoggingBackend.
threadContext
Type: PostSharp.Patterns.Diagnostics.ContextsThreadLoggingContext
The ThreadLoggingContext in which the new SerilogEphemeralLoggingContext will be used.
See Also

Reference

SerilogEphemeralLoggingContext Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogEphemeralLoggingContext Properties

The SerilogEphemeralLoggingContext type exposes the following members.

Properties
 | Name | Description
Public property | ActivationContext | Gets the LoggingContext in which the current context was activated. If the current context has been resumed, ActivationContext refers to the context in which the context was resumed. (Inherited from EphemeralLoggingContext.)
Public property | Backend | Gets the parent LoggingBackend of the current context. (Inherited from LoggingContext.)
Public property | Description | Gets the description of the current context. The description is typically set by the LogRecordBuilder when building the opening record of a context. (Inherited from LoggingContext.)
Public property | Id | Gets or set the identifier of the current context. This property should be used for debugging only. Its value is lazily created. (Inherited from LoggingContext.)
Public property | IndentLevel | Gets or sets the indentation level for the current context. (Inherited from LoggingContext.)
Public property | IsAsync | Determines whether the current LoggingContext represents an async method or an asynchronous custom activity. (Inherited from LoggingContext.)
Public property | IsDisposed | Determines whether the current context has been disposed. (Inherited from LoggingContext.)
Public property | IsSharable | Determines whether the current LoggingContext can be accessed outside of its nominal lifetype (for instance after the method has completed or a custom activity has beeen closed). Since contexts can be pooled and reused, consumers must call the MakeSharable method if they want to keep a reference to the LoggingContext and access it after its nominal lifetime has completed. (Inherited from LoggingContext.)
Public property | Kind | Gets the kind of the current context. (Inherited from LoggingContext.)
Public property | MemberName | Gets the name of the method or property related to the current context. (Inherited from LoggingContext.)
Public property | ParentContext | Gets the LoggingContext that created (initiated) the current context. This is the logical parent. (Inherited from EphemeralLoggingContext.)
Public property | Source | Gets the LoggingTypeSource corresponding, typically, to the declaring type of the member associated to the current context. (Inherited from LoggingContext.)
Public property | ThreadContext | Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed. (Inherited from EphemeralLoggingContext.)
Top
See Also

Reference

SerilogEphemeralLoggingContext Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogEphemeralLoggingContext Methods

The SerilogEphemeralLoggingContext type exposes the following members.

Methods
 | Name | Description
Public method | CreateCorrelationCookie | Creates a cookie that can be used to correlate, using the SetCorrelation(CorrelationCookie) method, another context to the current context. (Inherited from LoggingContext.)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from EphemeralLoggingContext.)
Public method | GetCustomRecordBuilder | Gets a LogRecordBuilder for the current context to build a custom record. (Inherited from LoggingContext.)
Public method | GetRecordBuilder | Gets a LogRecordBuilder for the current context to build a standard record for a given method. (Inherited from LoggingContext.)
Public method | MakeSharable | Allows the current context to be shared beyond its normal lifecycle by preventing it from being returned to the pool. (Inherited from LoggingContext.)
Public method | Open | Opens the context. (Inherited from EphemeralLoggingContext.)
Protected method | Reset | Resets the current context to its initial, uninitialized state. This method is called by the Dispose method. (Inherited from LoggingContext.)
Public method | SetCorrelation | Associates the current context with another context. (Inherited from LoggingContext.)
Public method | SetWaitDependency | Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts. (Inherited from LoggingContext.)
Public method | ToString | Returns a string that represents the current object. (Inherited from LoggingContext.)
Protected method | ToString(StringBuilder) | Formats a description of the current LoggingContext into a given StringBuilder. (Inherited from LoggingContext.)
Top
See Also

Reference

SerilogEphemeralLoggingContext Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogIteratorLoggingContext Class

The IteratorLoggingContext for SerilogLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.ContextsLoggingContext
PostSharp.Patterns.Diagnostics.ContextsSuspendableLoggingContext
PostSharp.Patterns.Diagnostics.ContextsIteratorLoggingContext
PostSharp.Patterns.Diagnostics.Backends.SerilogSerilogIteratorLoggingContext

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class SerilogIteratorLoggingContext : IteratorLoggingContext

The SerilogIteratorLoggingContext type exposes the following members.

Constructors
 | Name | Description
Public method | SerilogIteratorLoggingContext | Initializes a new SerilogIteratorLoggingContext.
Top
Properties
 | Name | Description
Public property | ActivationContext | Gets the LoggingContext in which the current context was activated. If the current context has been resumed, ActivationContext refers to the context in which the context was resumed. (Inherited from LoggingContext.)
Public property | Backend | Gets the parent LoggingBackend of the current context. (Inherited from LoggingContext.)
Public property | Description | Gets the description of the current context. The description is typically set by the LogRecordBuilder when building the opening record of a context. (Inherited from LoggingContext.)
Public property | Id | Gets or set the identifier of the current context. This property should be used for debugging only. Its value is lazily created. (Inherited from LoggingContext.)
Public property | IndentLevel | Gets or sets the indentation level for the current context. (Inherited from LoggingContext.)
Public property | IsAsync | Determines whether the current LoggingContext represents an async method or an asynchronous custom activity. (Inherited from LoggingContext.)
Public property | IsDisposed | Determines whether the current context has been disposed. (Inherited from LoggingContext.)
Public property | IsSharable | Determines whether the current LoggingContext can be accessed outside of its nominal lifetype (for instance after the method has completed or a custom activity has beeen closed). Since contexts can be pooled and reused, consumers must call the MakeSharable method if they want to keep a reference to the LoggingContext and access it after its nominal lifetime has completed. (Inherited from LoggingContext.)
Public property | IsSuspended | Determines whether the current context is currently suspended (between a Suspend and a Resume). (Inherited from SuspendableLoggingContext.)
Public property | Iterator | Gets the iterator object. (Inherited from IteratorLoggingContext.)
Public property | Kind | Gets the kind of the current context. (Inherited from LoggingContext.)
Public property | MemberName | Gets the name of the method or property related to the current context. (Inherited from LoggingContext.)
Public property | ParentContext | Gets the LoggingContext that created (initiated) the current context. This is the logical parent. (Inherited from LoggingContext.)
Public property | Source | Gets the LoggingTypeSource corresponding, typically, to the declaring type of the member associated to the current context. (Inherited from LoggingContext.)
Public property | ThreadContext | Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed. (Inherited from SuspendableLoggingContext.)
Top
Methods
 | Name | Description
Public method | CreateCorrelationCookie | Creates a cookie that can be used to correlate, using the SetCorrelation(CorrelationCookie) method, another context to the current context. (Inherited from LoggingContext.)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from SuspendableLoggingContext.)
Public method | GetCustomRecordBuilder | Gets a LogRecordBuilder for the current context to build a custom record. (Inherited from LoggingContext.)
Public method | GetRecordBuilder | Gets a LogRecordBuilder for the current context to build a standard record for a given method. (Inherited from LoggingContext.)
Public method | MakeSharable | Allows the current context to be shared beyond its normal lifecycle by preventing it from being returned to the pool. (Inherited from LoggingContext.)
Public method | Open | Opens a new IteratorLoggingContext. (Inherited from IteratorLoggingContext.)
Protected method | Reset | Resets the current context to its initial, uninitialized state. This method is called by the Dispose method. (Inherited from LoggingContext.)
Public method | Resume | Resumes the current context. Typically called when the state machine resumes execution, when the wait dependency is satisfied (in case of async methods) or when the MoveNext method is called (in case of iterators). (Inherited from SuspendableLoggingContext.)
Public method | ResumeConditional | Resume the current context, but only if it is currently suspended. (Inherited from SuspendableLoggingContext.)
Public method | SetCorrelation | Associates the current context with another context. (Inherited from LoggingContext.)
Public method | SetWaitDependency | Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts. (Inherited from LoggingContext.)
Public method | Suspend | Suspends the current context. Typically called when starting to wait for a wait dependency (the operand of the await operator in case of async methods), or after the MoveNext method (in case of iterators). (Inherited from SuspendableLoggingContext.)
Public method | ToString | Returns a string that represents the current object. (Inherited from LoggingContext.)
Protected method | ToString(StringBuilder) | Formats a description of the current LoggingContext into a given StringBuilder. (Inherited from SuspendableLoggingContext.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogIteratorLoggingContext Constructor

Initializes a new SerilogIteratorLoggingContext.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SerilogIteratorLoggingContext(
    LoggingBackend backend
)

Parameters

backend
Type: PostSharp.Patterns.DiagnosticsLoggingBackend
See Also

Reference

SerilogIteratorLoggingContext Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogIteratorLoggingContext Properties

The SerilogIteratorLoggingContext type exposes the following members.

Properties
 | Name | Description
Public property | ActivationContext | Gets the LoggingContext in which the current context was activated. If the current context has been resumed, ActivationContext refers to the context in which the context was resumed. (Inherited from LoggingContext.)
Public property | Backend | Gets the parent LoggingBackend of the current context. (Inherited from LoggingContext.)
Public property | Description | Gets the description of the current context. The description is typically set by the LogRecordBuilder when building the opening record of a context. (Inherited from LoggingContext.)
Public property | Id | Gets or set the identifier of the current context. This property should be used for debugging only. Its value is lazily created. (Inherited from LoggingContext.)
Public property | IndentLevel | Gets or sets the indentation level for the current context. (Inherited from LoggingContext.)
Public property | IsAsync | Determines whether the current LoggingContext represents an async method or an asynchronous custom activity. (Inherited from LoggingContext.)
Public property | IsDisposed | Determines whether the current context has been disposed. (Inherited from LoggingContext.)
Public property | IsSharable | Determines whether the current LoggingContext can be accessed outside of its nominal lifetype (for instance after the method has completed or a custom activity has beeen closed). Since contexts can be pooled and reused, consumers must call the MakeSharable method if they want to keep a reference to the LoggingContext and access it after its nominal lifetime has completed. (Inherited from LoggingContext.)
Public property | IsSuspended | Determines whether the current context is currently suspended (between a Suspend and a Resume). (Inherited from SuspendableLoggingContext.)
Public property | Iterator | Gets the iterator object. (Inherited from IteratorLoggingContext.)
Public property | Kind | Gets the kind of the current context. (Inherited from LoggingContext.)
Public property | MemberName | Gets the name of the method or property related to the current context. (Inherited from LoggingContext.)
Public property | ParentContext | Gets the LoggingContext that created (initiated) the current context. This is the logical parent. (Inherited from LoggingContext.)
Public property | Source | Gets the LoggingTypeSource corresponding, typically, to the declaring type of the member associated to the current context. (Inherited from LoggingContext.)
Public property | ThreadContext | Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed. (Inherited from SuspendableLoggingContext.)
Top
See Also

Reference

SerilogIteratorLoggingContext Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogIteratorLoggingContext Methods

The SerilogIteratorLoggingContext type exposes the following members.

Methods
 | Name | Description
Public method | CreateCorrelationCookie | Creates a cookie that can be used to correlate, using the SetCorrelation(CorrelationCookie) method, another context to the current context. (Inherited from LoggingContext.)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from SuspendableLoggingContext.)
Public method | GetCustomRecordBuilder | Gets a LogRecordBuilder for the current context to build a custom record. (Inherited from LoggingContext.)
Public method | GetRecordBuilder | Gets a LogRecordBuilder for the current context to build a standard record for a given method. (Inherited from LoggingContext.)
Public method | MakeSharable | Allows the current context to be shared beyond its normal lifecycle by preventing it from being returned to the pool. (Inherited from LoggingContext.)
Public method | Open | Opens a new IteratorLoggingContext. (Inherited from IteratorLoggingContext.)
Protected method | Reset | Resets the current context to its initial, uninitialized state. This method is called by the Dispose method. (Inherited from LoggingContext.)
Public method | Resume | Resumes the current context. Typically called when the state machine resumes execution, when the wait dependency is satisfied (in case of async methods) or when the MoveNext method is called (in case of iterators). (Inherited from SuspendableLoggingContext.)
Public method | ResumeConditional | Resume the current context, but only if it is currently suspended. (Inherited from SuspendableLoggingContext.)
Public method | SetCorrelation | Associates the current context with another context. (Inherited from LoggingContext.)
Public method | SetWaitDependency | Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts. (Inherited from LoggingContext.)
Public method | Suspend | Suspends the current context. Typically called when starting to wait for a wait dependency (the operand of the await operator in case of async methods), or after the MoveNext method (in case of iterators). (Inherited from SuspendableLoggingContext.)
Public method | ToString | Returns a string that represents the current object. (Inherited from LoggingContext.)
Protected method | ToString(StringBuilder) | Formats a description of the current LoggingContext into a given StringBuilder. (Inherited from SuspendableLoggingContext.)
Top
See Also

Reference

SerilogIteratorLoggingContext Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLoggingBackend Class

Logging back-end for Serilog.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingBackend
PostSharp.Patterns.Diagnostics.BackendsTextLoggingBackend
PostSharp.Patterns.Diagnostics.Backends.SerilogSerilogLoggingBackend

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class SerilogLoggingBackend : TextLoggingBackend

The SerilogLoggingBackend type exposes the following members.

Constructors
 | Name | Description
Public method | SerilogLoggingBackend | Initializes a new SerilogLoggingBackend and uses the globally-shared ILogger.
Public method | SerilogLoggingBackend(ILogger) | Initializes a new SerilogLoggingBackend and specifies the target ILogger.
Top
Properties
 | Name | Description
Public property | CurrentContext | Gets the current LoggingContext. (Inherited from LoggingBackend.)
Public property | IsCorrupted | (Inherited from LoggingBackend.)
Public property | IsDisposed | Determines whether the current LoggingBackend has been disposed. (Inherited from LoggingBackend.)
Public property | IsEnabled | Determines whether the current LoggingBackend is currently enabled. This property has precedence over, and does not affect, the minimal log levels set through the SetLevel(LogLevel) method. (Inherited from LoggingBackend.)
Public property | Logger | Gets the ILogger passed to the constructor of the current SerilogLoggingBackend, or the globally-shared ILogger if no logger was passed during the instantiation of the current SerilogLoggingBackend.
Public property | MessageTemplateCacheSize | Gets the number of items in the message template cache.
Public property | Options | Gets the back-end options.
Top
Methods
 | Name | Description
Public method | ClearMessageTemplateCache | Clears the message template cache.
Protected method | CreateAsyncCustomActivityContext | Creates a new AsyncCustomActivityLoggingContext. (Overrides LoggingBackendCreateAsyncCustomActivityContext.)
Protected method | CreateAsyncMethodContext | Creates a new AsyncMethodLoggingContext for a given async method. (Overrides LoggingBackendCreateAsyncMethodContext.)
Protected method | CreateEphemeralContext | (Overrides LoggingBackendCreateEphemeralContext(ThreadLoggingContext).)
Protected method | CreateIteratorContext | Creates a new IteratorLoggingContext for a given iterator method. (Overrides LoggingBackendCreateIteratorContext.)
Public method | CreateRecordBuilder | Creates a new LogRecordBuilder. (Overrides LoggingBackendCreateRecordBuilder.)
Protected method | CreateSyncCustomActivityContext | Creates a new SyncCustomActivityLoggingContext. (Overrides LoggingBackendCreateSyncCustomActivityContext(ThreadLoggingContext).)
Protected method | CreateSyncMethodContext | Creates a new SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Overrides LoggingBackendCreateSyncMethodContext(ThreadLoggingContext).)
Protected method | CreateThreadContext | Creates a new ThreadLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateTypeSource | Creates LoggingTypeSource for the given role and type. (Overrides LoggingBackendCreateTypeSource(LoggingNamespaceSource, Type).)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingBackend.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from TextLoggingBackend.)
Public method | GetAsyncContextOfTask | Gets the AsyncMethodLoggingContext associated with a Task. (Inherited from LoggingBackend.)
Protected method | GetBackendOptions | Gets the formatting and rendering options for the current LoggingBackend. (Inherited from TextLoggingBackend.)
Public method | GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace. (Inherited from LoggingBackend.)
Public method | GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type. (Inherited from LoggingBackend.)
Protected method | GetTextBackendOptions | Gets the options. (Overrides TextLoggingBackendGetTextBackendOptions.)
Public method | GetThreadContext | Returns the ThreadLoggingContext for the current Thread. (Inherited from LoggingBackend.)
Public method | OpenAsyncContext | Gets an AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Public method | OpenCustomActivityContext | Gets a LoggingContext for a custom activity (opened using OpenActivity(String) or OpenAsyncActivity(String)). (Inherited from LoggingBackend.)
Public method | OpenEphemeralContext | Gets an EphemeralLoggingContext for use in a given method. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record. (Inherited from LoggingBackend.)
Public method | OpenIteratorContext | Gets an IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | OpenSyncContext | Gets a SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace

Other Resources

Conceptual: Adding Detailed Logging to your Solution


SerilogLoggingBackend Constructor

Overload List
 | Name | Description
Public method | SerilogLoggingBackend | Initializes a new SerilogLoggingBackend and uses the globally-shared ILogger.
Public method | SerilogLoggingBackend(ILogger) | Initializes a new SerilogLoggingBackend and specifies the target ILogger.
Top
See Also

Reference

SerilogLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLoggingBackend Constructor

Initializes a new SerilogLoggingBackend and uses the globally-shared ILogger.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SerilogLoggingBackend()
See Also

Reference

SerilogLoggingBackend Class
SerilogLoggingBackend Overload
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLoggingBackend Constructor (ILogger)

Initializes a new SerilogLoggingBackend and specifies the target ILogger.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SerilogLoggingBackend(
    ILogger logger
)

Parameters

logger
Type: ILogger
The ILogger to which log records should be written, or null to use the globally-shared logger.
See Also

Reference

SerilogLoggingBackend Class
SerilogLoggingBackend Overload
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLoggingBackend Properties

The SerilogLoggingBackend type exposes the following members.

Properties
 | Name | Description
Public property | CurrentContext | Gets the current LoggingContext. (Inherited from LoggingBackend.)
Public property | IsCorrupted | (Inherited from LoggingBackend.)
Public property | IsDisposed | Determines whether the current LoggingBackend has been disposed. (Inherited from LoggingBackend.)
Public property | IsEnabled | Determines whether the current LoggingBackend is currently enabled. This property has precedence over, and does not affect, the minimal log levels set through the SetLevel(LogLevel) method. (Inherited from LoggingBackend.)
Public property | Logger | Gets the ILogger passed to the constructor of the current SerilogLoggingBackend, or the globally-shared ILogger if no logger was passed during the instantiation of the current SerilogLoggingBackend.
Public property | MessageTemplateCacheSize | Gets the number of items in the message template cache.
Public property | Options | Gets the back-end options.
Top
See Also

Reference

SerilogLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLoggingBackend.Logger Property

SerilogLoggingBackendLogger Property

Gets the ILogger passed to the constructor of the current SerilogLoggingBackend, or the globally-shared ILogger if no logger was passed during the instantiation of the current SerilogLoggingBackend.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ILogger Logger { get; }

Property Value

Type: ILogger
See Also

Reference

SerilogLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLoggingBackend.MessageTemplateCacheSize Property

SerilogLoggingBackendMessageTemplateCacheSize Property

Gets the number of items in the message template cache.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int MessageTemplateCacheSize { get; }

Property Value

Type: Int32
See Also

Reference

SerilogLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLoggingBackend.Options Property

SerilogLoggingBackendOptions Property

Gets the back-end options.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SerilogLoggingBackendOptions Options { get; }

Property Value

Type: SerilogLoggingBackendOptions
See Also

Reference

SerilogLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLoggingBackend Methods

The SerilogLoggingBackend type exposes the following members.

Methods
 | Name | Description
Public method | ClearMessageTemplateCache | Clears the message template cache.
Protected method | CreateAsyncCustomActivityContext | Creates a new AsyncCustomActivityLoggingContext. (Overrides LoggingBackendCreateAsyncCustomActivityContext.)
Protected method | CreateAsyncMethodContext | Creates a new AsyncMethodLoggingContext for a given async method. (Overrides LoggingBackendCreateAsyncMethodContext.)
Protected method | CreateEphemeralContext | (Overrides LoggingBackendCreateEphemeralContext(ThreadLoggingContext).)
Protected method | CreateIteratorContext | Creates a new IteratorLoggingContext for a given iterator method. (Overrides LoggingBackendCreateIteratorContext.)
Public method | CreateRecordBuilder | Creates a new LogRecordBuilder. (Overrides LoggingBackendCreateRecordBuilder.)
Protected method | CreateSyncCustomActivityContext | Creates a new SyncCustomActivityLoggingContext. (Overrides LoggingBackendCreateSyncCustomActivityContext(ThreadLoggingContext).)
Protected method | CreateSyncMethodContext | Creates a new SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Overrides LoggingBackendCreateSyncMethodContext(ThreadLoggingContext).)
Protected method | CreateThreadContext | Creates a new ThreadLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateTypeSource | Creates LoggingTypeSource for the given role and type. (Overrides LoggingBackendCreateTypeSource(LoggingNamespaceSource, Type).)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingBackend.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from TextLoggingBackend.)
Public method | GetAsyncContextOfTask | Gets the AsyncMethodLoggingContext associated with a Task. (Inherited from LoggingBackend.)
Protected method | GetBackendOptions | Gets the formatting and rendering options for the current LoggingBackend. (Inherited from TextLoggingBackend.)
Public method | GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace. (Inherited from LoggingBackend.)
Public method | GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type. (Inherited from LoggingBackend.)
Protected method | GetTextBackendOptions | Gets the options. (Overrides TextLoggingBackendGetTextBackendOptions.)
Public method | GetThreadContext | Returns the ThreadLoggingContext for the current Thread. (Inherited from LoggingBackend.)
Public method | OpenAsyncContext | Gets an AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Public method | OpenCustomActivityContext | Gets a LoggingContext for a custom activity (opened using OpenActivity(String) or OpenAsyncActivity(String)). (Inherited from LoggingBackend.)
Public method | OpenEphemeralContext | Gets an EphemeralLoggingContext for use in a given method. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record. (Inherited from LoggingBackend.)
Public method | OpenIteratorContext | Gets an IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | OpenSyncContext | Gets a SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Top
See Also

Reference

SerilogLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLoggingBackend.ClearMessageTemplateCache Method

SerilogLoggingBackendClearMessageTemplateCache Method

Clears the message template cache.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void ClearMessageTemplateCache()
See Also

Reference

SerilogLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLoggingBackend.CreateAsyncCustomActivityContext Method

SerilogLoggingBackendCreateAsyncCustomActivityContext Method

Creates a new AsyncCustomActivityLoggingContext.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override AsyncCustomActivityLoggingContext CreateAsyncCustomActivityContext()

Return Value

Type: AsyncCustomActivityLoggingContext
A new AsyncCustomActivityLoggingContext.
See Also

Reference

SerilogLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


SerilogLoggingBackend.CreateAsyncMethodContext Method

SerilogLoggingBackendCreateAsyncMethodContext Method

Creates a new AsyncMethodLoggingContext for a given async method.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override AsyncMethodLoggingContext CreateAsyncMethodContext()

Return Value

Type: AsyncMethodLoggingContext
A new AsyncMethodLoggingContext.
See Also

Reference

SerilogLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


SerilogLoggingBackend.CreateEphemeralContext Method

SerilogLoggingBackendCreateEphemeralContext Method

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override EphemeralLoggingContext CreateEphemeralContext(
    ThreadLoggingContext threadContext
)

Parameters

threadContext
Type: PostSharp.Patterns.Diagnostics.ContextsThreadLoggingContext

Return Value

Type: EphemeralLoggingContext
See Also

Reference

SerilogLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLoggingBackend.CreateIteratorContext Method

SerilogLoggingBackendCreateIteratorContext Method

Creates a new IteratorLoggingContext for a given iterator method.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override IteratorLoggingContext CreateIteratorContext()

Return Value

Type: IteratorLoggingContext
See Also

Reference

SerilogLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


SerilogLoggingBackend.CreateRecordBuilder Method

SerilogLoggingBackendCreateRecordBuilder Method

Creates a new LogRecordBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override LogRecordBuilder CreateRecordBuilder()

Return Value

Type: LogRecordBuilder
A new LogRecordBuilder.
See Also

Reference

SerilogLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


SerilogLoggingBackend.CreateSyncCustomActivityContext Method

SerilogLoggingBackendCreateSyncCustomActivityContext Method

Creates a new SyncCustomActivityLoggingContext.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override SyncCustomActivityLoggingContext CreateSyncCustomActivityContext(
    ThreadLoggingContext threadContext
)

Parameters

threadContext
Type: PostSharp.Patterns.Diagnostics.ContextsThreadLoggingContext
The ThreadLoggingContext in which the SyncCustomActivityLoggingContext will be used.

Return Value

Type: SyncCustomActivityLoggingContext
A new SyncCustomActivityLoggingContext to be used only in the thread of threadContext.
See Also

Reference

SerilogLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


SerilogLoggingBackend.CreateSyncMethodContext Method

SerilogLoggingBackendCreateSyncMethodContext Method

Creates a new SyncMethodLoggingContext for a given normal (non-async, non-iterator) method.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override SyncMethodLoggingContext CreateSyncMethodContext(
    ThreadLoggingContext threadContext
)

Parameters

threadContext
Type: PostSharp.Patterns.Diagnostics.ContextsThreadLoggingContext
The ThreadLoggingContext in which the method is executed.

Return Value

Type: SyncMethodLoggingContext
A new SyncMethodLoggingContext to be used only in the thread of threadContext.
See Also

Reference

SerilogLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


SerilogLoggingBackend.CreateTypeSource Method

SerilogLoggingBackendCreateTypeSource Method

Creates LoggingTypeSource for the given role and type.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override LoggingTypeSource CreateTypeSource(
    LoggingNamespaceSource parent,
    Type type
)

Parameters

parent
Type: PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
type
Type: SystemType

Return Value

Type: LoggingTypeSource
See Also

Reference

SerilogLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


SerilogLoggingBackend.GetTextBackendOptions Method

SerilogLoggingBackendGetTextBackendOptions Method

Gets the options.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override TextLoggingBackendOptions GetTextBackendOptions()

Return Value

Type: TextLoggingBackendOptions
See Also

Reference

SerilogLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


SerilogLoggingBackendOptions Class

Options for SerilogLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingBackendOptions
PostSharp.Patterns.Diagnostics.BackendsTextLoggingBackendOptions
PostSharp.Patterns.Diagnostics.Backends.SerilogSerilogLoggingBackendOptions

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class SerilogLoggingBackendOptions : TextLoggingBackendOptions

The SerilogLoggingBackendOptions type exposes the following members.

Constructors
 | Name | Description
Public method | SerilogLoggingBackendOptions | Initializes a new SerilogLoggingBackendOptions.
Top
Properties
 | Name | Description
Public property | ActionMaxLength | Max length of a log record. The default value is 2048. (Inherited from TextLoggingBackendOptions.)
Public property | AppendTrailingPeriod | Determines whether log messages should be ended with a trailing period. The default value is true because we really like trailing periods at PostSharp, but other opinions are valid. (Inherited from TextLoggingBackendOptions.)
Public property | ContextMaxLength | Max length of the Description property. (Inherited from LoggingBackendOptions.)
Public property | Delimiter | String used to separate different parts of the logging record. The default value is a pipe surrounded by spaces ( | ). (Inherited from TextLoggingBackendOptions.)
Public property | GetLogger | Function mapping an SerilogLoggingTypeSource to a Serilog ILogger. The default behavior is to call typeSource.Backend.Logger.ForContext( typeSource.SourceType ).
Public property | IncludeExceptionDetails | Determines whether exception details (basically Exception.ToString) should be appended to the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeNamespace | Determines whether the full namespace of types should be included in the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeType | Determines whether the name of the type of the logged method should be included in the log. The default value is true. (Inherited from TextLoggingBackendOptions.)
Public property | IndentSpaces | Number of spaces for each indentation level. The default value is 2. (Inherited from TextLoggingBackendOptions.)
Public property | LogLevelIgnoredForSystemRecords | Determines whether the Level property is ignored by the current back-end for auto-generated (i.e. non-manual) logging records. Some back-ends may not support overriding the level of records. (Inherited from LoggingBackendOptions.)
Public property | SemanticParametersTreatedSemantically | Gets or sets the kinds of semantic parameters that must be mapped to Serilog semantic parameters.
Public property | ShouldLogExceptionPredicate | Gets or sets a predicate that determines whether an exception should be logged. This predicate is evaluated only when the method entry is not logged. When the method entry is logged, exceptions are always logged. (Inherited from TextLoggingBackendOptions.)
Public property | UseSerilogFormatters | Determines whether Serilog formatters should be used instead of PostSharp formatters. The default value is false.
Top
Fields
Name | Description
SemanticParametersRequiredTreatedSemantically | Kinds of semantic parameters that are required to be mapped to Serilog parameters. This is the default value of the SemanticParametersTreatedSemantically property. This constant is set to ParameterValue | Exception | ReturnValue | ReturnItemValue | Duration | This.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLoggingBackendOptions Constructor

Initializes a new SerilogLoggingBackendOptions.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SerilogLoggingBackendOptions()
See Also

Reference

SerilogLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLoggingBackendOptions Properties

The SerilogLoggingBackendOptions type exposes the following members.

Properties
 | Name | Description
Public property | ActionMaxLength | Max length of a log record. The default value is 2048. (Inherited from TextLoggingBackendOptions.)
Public property | AppendTrailingPeriod | Determines whether log messages should be ended with a trailing period. The default value is true because we really like trailing periods at PostSharp, but other opinions are valid. (Inherited from TextLoggingBackendOptions.)
Public property | ContextMaxLength | Max length of the Description property. (Inherited from LoggingBackendOptions.)
Public property | Delimiter | String used to separate different parts of the logging record. The default value is a pipe surrounded by spaces ( | ). (Inherited from TextLoggingBackendOptions.)
Public property | GetLogger | Function mapping an SerilogLoggingTypeSource to a Serilog ILogger. The default behavior is to call typeSource.Backend.Logger.ForContext( typeSource.SourceType ).
Public property | IncludeExceptionDetails | Determines whether exception details (basically Exception.ToString) should be appended to the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeNamespace | Determines whether the full namespace of types should be included in the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeType | Determines whether the name of the type of the logged method should be included in the log. The default value is true. (Inherited from TextLoggingBackendOptions.)
Public property | IndentSpaces | Number of spaces for each indentation level. The default value is 2. (Inherited from TextLoggingBackendOptions.)
Public property | LogLevelIgnoredForSystemRecords | Determines whether the Level property is ignored by the current back-end for auto-generated (i.e. non-manual) logging records. Some back-ends may not support overriding the level of records. (Inherited from LoggingBackendOptions.)
Public property | SemanticParametersTreatedSemantically | Gets or sets the kinds of semantic parameters that must be mapped to Serilog semantic parameters.
Public property | ShouldLogExceptionPredicate | Gets or sets a predicate that determines whether an exception should be logged. This predicate is evaluated only when the method entry is not logged. When the method entry is logged, exceptions are always logged. (Inherited from TextLoggingBackendOptions.)
Public property | UseSerilogFormatters | Determines whether Serilog formatters should be used instead of PostSharp formatters. The default value is false.
Top
See Also

Reference

SerilogLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLoggingBackendOptions.GetLogger Property

SerilogLoggingBackendOptionsGetLogger Property

Function mapping an SerilogLoggingTypeSource to a Serilog ILogger. The default behavior is to call typeSource.Backend.Logger.ForContext( typeSource.SourceType ).

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Func<SerilogLoggingTypeSource, ILogger> GetLogger { get; set; }

Property Value

Type: Func SerilogLoggingTypeSource, ILogger
See Also

Reference

SerilogLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLoggingBackendOptions.SemanticParametersTreatedSemantically Property

SerilogLoggingBackendOptionsSemanticParametersTreatedSemantically Property

Gets or sets the kinds of semantic parameters that must be mapped to Serilog semantic parameters.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SemanticParameterKind SemanticParametersTreatedSemantically { get; set; }

Property Value

Type: SemanticParameterKind
Remarks

The value of this property it a bis mask. When a bit (i.e. a value of the SemanticParameterKind) is set to 1, a Serilog parameter will be used. Otherwise, the parameter will be expanded into plain text.

Serilog semantic parameters come at a significant cost, so they must be used with care.

The default value of this property is equal to the SemanticParametersRequiredTreatedSemantically constant.

See Also

Reference

SerilogLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace

Other Resources

Conceptual: Logging to Serilog


SerilogLoggingBackendOptions.UseSerilogFormatters Property

SerilogLoggingBackendOptionsUseSerilogFormatters Property

Determines whether Serilog formatters should be used instead of PostSharp formatters. The default value is false.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool UseSerilogFormatters { get; set; }

Property Value

Type: Boolean
See Also

Reference

SerilogLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace

Other Resources

Conceptual: Logging to Serilog


SerilogLoggingBackendOptions Fields

The SerilogLoggingBackendOptions type exposes the following members.

Fields
Name | Description
SemanticParametersRequiredTreatedSemantically | Kinds of semantic parameters that are required to be mapped to Serilog parameters. This is the default value of the SemanticParametersTreatedSemantically property. This constant is set to ParameterValue | Exception | ReturnValue | ReturnItemValue | Duration | This.
Top
See Also

Reference

SerilogLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLoggingBackendOptions.SemanticParametersRequiredTreatedSemantically Field

SerilogLoggingBackendOptionsSemanticParametersRequiredTreatedSemantically Field

Kinds of semantic parameters that are required to be mapped to Serilog parameters. This is the default value of the SemanticParametersTreatedSemantically property. This constant is set to ParameterValue | Exception | ReturnValue | ReturnItemValue | Duration | This.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const SemanticParameterKind SemanticParametersRequiredTreatedSemantically = SemanticParameterKind.This|SemanticParameterKind.Exception|SemanticParameterKind.ParameterValue|SemanticParameterKind.ReturnItemValue|SemanticParameterKind.ReturnValue|SemanticParameterKind.Duration

Field Value

Type: SemanticParameterKind
See Also

Reference

SerilogLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLoggingTypeSource Class

The LoggingTypeSource for SerilogLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
PostSharp.Patterns.DiagnosticsLoggingTypeSource
PostSharp.Patterns.Diagnostics.Backends.SerilogSerilogLoggingTypeSource

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class SerilogLoggingTypeSource : LoggingTypeSource

The SerilogLoggingTypeSource type exposes the following members.

Constructors
 | Name | Description
Public method | SerilogLoggingTypeSource | Initializes a new SerilogLoggingTypeSource.
Top
Properties
 | Name | Description
Public property | Backend | Gets the parent SerilogLoggingBackend.
Public property | DisplayFullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the DisplayFullName property does not include the arity, i.e. the full name of List<T> is System.Collections.Generic.List. (Inherited from LoggingNamespaceSource.)
Public property | DisplayName | Gets the last component of the name of the type or namespace, in the form that should be reported to the log. For generic types, the DisplayName property does not include the arity, i.e. the name of List<T> is List. (Inherited from LoggingNamespaceSource.)
Public property | FullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the FullName property includes the arity, i.e. the full name of List<T> is System.Collections.Generic.List`1. (Inherited from LoggingNamespaceSource.)
Public property | GenericParameterCount | Gets the number of generic parameters in SourceType. (Inherited from LoggingTypeSource.)
Public property | Level | Gets the minimal LogLevel for which logging is enabled for the current namespace or type. (Inherited from LoggingNamespaceSource.)
Public property | Logger | Gets the ILogger associated with the current SerilogLoggingTypeSource.
Public property | Name | Gets the last component of the name of the type or namespace. For instance, when FullName is PostSharp.Patterns.Diagnostics.LoggingBackend, Name is LoggingBackend. For generic types, the Name property includes the arity, i.e. the name of List<T> is List`1. (Inherited from LoggingNamespaceSource.)
Public property | Options | Gets the LoggingRoleConfiguration for the current role. This property is a shortcut to LoggingServices.Roles[this.Role]. (Inherited from LoggingTypeSource.)
Public property | Parent | Gets the parent LoggingNamespaceSource, or null if the current object represents the root namespace. (Inherited from LoggingNamespaceSource.)
Public property | Role | Gets the logging role for the current role. Typical values of this property are listed in the LoggingRoles class. (Inherited from LoggingNamespaceSource.)
Public property | SourceType | The type represented by the current LoggingTypeSource. (Inherited from LoggingTypeSource.)
Top
Methods
 | Name | Description
Protected method | IsBackendEnabled | Checks whether logging is enabled in the back-end for the given level. (Overrides LoggingTypeSourceIsBackendEnabled(LogLevel).)
Public method | IsEnabled | Determines whether logging is enabled for the given LogLevel. (Inherited from LoggingTypeSource.)
Public method | Refresh | Refreshes the logging level from the back-end from the current node and all children nodes. The back-end-defined logging level is cached for performance reasons. (Inherited from LoggingTypeSource.)
Public method | SetLevel | Sets the minimal LogLevel for which logging is enabled for the current namespace and type and all children namespaces and types. (Inherited from LoggingNamespaceSource.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLoggingTypeSource Constructor

Initializes a new SerilogLoggingTypeSource.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SerilogLoggingTypeSource(
    LoggingNamespaceSource parent,
    Type type
)

Parameters

parent
Type: PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
The parent LoggingNamespaceSource.
type
Type: SystemType
The Type being logged.
See Also

Reference

SerilogLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLoggingTypeSource Properties

The SerilogLoggingTypeSource type exposes the following members.

Properties
 | Name | Description
Public property | Backend | Gets the parent SerilogLoggingBackend.
Public property | DisplayFullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the DisplayFullName property does not include the arity, i.e. the full name of List<T> is System.Collections.Generic.List. (Inherited from LoggingNamespaceSource.)
Public property | DisplayName | Gets the last component of the name of the type or namespace, in the form that should be reported to the log. For generic types, the DisplayName property does not include the arity, i.e. the name of List<T> is List. (Inherited from LoggingNamespaceSource.)
Public property | FullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the FullName property includes the arity, i.e. the full name of List<T> is System.Collections.Generic.List`1. (Inherited from LoggingNamespaceSource.)
Public property | GenericParameterCount | Gets the number of generic parameters in SourceType. (Inherited from LoggingTypeSource.)
Public property | Level | Gets the minimal LogLevel for which logging is enabled for the current namespace or type. (Inherited from LoggingNamespaceSource.)
Public property | Logger | Gets the ILogger associated with the current SerilogLoggingTypeSource.
Public property | Name | Gets the last component of the name of the type or namespace. For instance, when FullName is PostSharp.Patterns.Diagnostics.LoggingBackend, Name is LoggingBackend. For generic types, the Name property includes the arity, i.e. the name of List<T> is List`1. (Inherited from LoggingNamespaceSource.)
Public property | Options | Gets the LoggingRoleConfiguration for the current role. This property is a shortcut to LoggingServices.Roles[this.Role]. (Inherited from LoggingTypeSource.)
Public property | Parent | Gets the parent LoggingNamespaceSource, or null if the current object represents the root namespace. (Inherited from LoggingNamespaceSource.)
Public property | Role | Gets the logging role for the current role. Typical values of this property are listed in the LoggingRoles class. (Inherited from LoggingNamespaceSource.)
Public property | SourceType | The type represented by the current LoggingTypeSource. (Inherited from LoggingTypeSource.)
Top
See Also

Reference

SerilogLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLoggingTypeSource.Backend Property

SerilogLoggingTypeSourceBackend Property

Gets the parent SerilogLoggingBackend.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SerilogLoggingBackend Backend { get; }

Property Value

Type: SerilogLoggingBackend
See Also

Reference

SerilogLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLoggingTypeSource.Logger Property

SerilogLoggingTypeSourceLogger Property

Gets the ILogger associated with the current SerilogLoggingTypeSource.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ILogger Logger { get; }

Property Value

Type: ILogger
See Also

Reference

SerilogLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLoggingTypeSource Methods

The SerilogLoggingTypeSource type exposes the following members.

Methods
 | Name | Description
Protected method | IsBackendEnabled | Checks whether logging is enabled in the back-end for the given level. (Overrides LoggingTypeSourceIsBackendEnabled(LogLevel).)
Public method | IsEnabled | Determines whether logging is enabled for the given LogLevel. (Inherited from LoggingTypeSource.)
Public method | Refresh | Refreshes the logging level from the back-end from the current node and all children nodes. The back-end-defined logging level is cached for performance reasons. (Inherited from LoggingTypeSource.)
Public method | SetLevel | Sets the minimal LogLevel for which logging is enabled for the current namespace and type and all children namespaces and types. (Inherited from LoggingNamespaceSource.)
Top
See Also

Reference

SerilogLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLoggingTypeSource.IsBackendEnabled Method

SerilogLoggingTypeSourceIsBackendEnabled Method

Checks whether logging is enabled in the back-end for the given level.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override bool IsBackendEnabled(
    LogLevel level
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel

Return Value

Type: Boolean
Remarks

The result of this method is cached. To invalidate the cache, call the Refresh method.

See Also

Reference

SerilogLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


SerilogLogRecordBuilder Class

The LogRecordBuilder for SerilogLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.RecordBuildersLogRecordBuilder
PostSharp.Patterns.Diagnostics.RecordBuildersTextLogRecordBuilder
PostSharp.Patterns.Diagnostics.Backends.SerilogSerilogLogRecordBuilder

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class SerilogLogRecordBuilder : TextLogRecordBuilder

The SerilogLogRecordBuilder type exposes the following members.

Constructors
 | Name | Description
Public method | SerilogLogRecordBuilder | Creates an instance of SerilogLogRecordBuilder.
Top
Properties
 | Name | Description
Public property | Backend | Gets the parent back-end. (Inherited from TextLogRecordBuilder.)
Public property | BackendOptions | Shortcut for this.Backend.Options. (Inherited from TextLogRecordBuilder.)
Protected property | Context | Gets the LoggingContext to which the record belongs. (Inherited from LogRecordBuilder.)
Public property | Exception | Gets the Exception for the current record, or null if no exception is associated to the current record. (Inherited from TextLogRecordBuilder.)
Public property | IsDisposed | (Inherited from LogRecordBuilder.)
Protected property | Level | Gets the LogLevel for the current record. (Inherited from TextLogRecordBuilder.)
Public property | MemberName | Gets the name of the method, property or field for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | MessageTemplateTokens | Gets the list of MessageTemplateToken for the current log record.
Protected property | Options | Gets the LoggingOptions for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Profile | Gets the LoggingProfile for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Properties | Gets the list of properties for the current log record.
Protected property | RecordKind | Gets the kind of the current record (e.g. MethodEntry or MethodException). (Inherited from LogRecordBuilder.)
Public property | SourceLineInfo | Gets the SourceLineInfo for the current record. (Inherited from TextLogRecordBuilder.)
Public property | SourceType | Gets the source Type of the current record. (Inherited from TextLogRecordBuilder.)
Protected property | StringBuilder | Gets the current UnsafeStringBuilder where everything is being appended. (Inherited from TextLogRecordBuilder.)
Protected property | ThreadContext | Gets the ThreadLoggingContext to which the current LogRecordBuilder belongs. (Inherited from LogRecordBuilder.)
Protected property | TypeSource | Gets the LoggingTypeSource for the current record. (Inherited from TextLogRecordBuilder.)
Top
Methods
 | Name | Description
Protected method | AppendAsyncInfo | Appends information about the async method to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendClosingParenthesisConditional | Appends a closing parenthesis to the current StringBuilder if required. (Inherited from TextLogRecordBuilder.)
Protected method | AppendComma | (Inherited from TextLogRecordBuilder.)
Protected method | AppendCommaConditional | Appends a comma to the current StringBuilder, unless this method is invoked for the first time for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription | Appends the context Description (or the TypeSource name, if the type of the context is not equal to the source type of the record) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription(LoggingContext) | (Overrides TextLogRecordBuilderAppendContextDescription(LoggingContext).)
Protected method | AppendDelimiter | Appends a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiterConditional | Appends a Delimiter to the current StringBuilder if the RequireDelimiter method has been called previously. (Inherited from TextLogRecordBuilder.)
Protected method | AppendEpilogue | Appends the final part of log message to StringBuilder. This includes state machine number and execution time where relevant, but does not include exception details. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExceptionDetails | Appends exception details to StringBuilder if IncludeExceptionDetails is set. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTime | Appends the execution time to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTimeThreshold | Appends the execution time threshold to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendIndentString | Appends indentation for the given to StringBuilder. (Overrides TextLogRecordBuilderAppendIndentString(Int32).)
Protected method | AppendMemberName | Appends name of the member for the current record (including the declaring type name, subject to the IncludeType property) to the current StringBuilder, as well as an opening parenthesis. (Inherited from TextLogRecordBuilder.)
Protected method | AppendOpeningParenthesis | Appends an opening parenthesis to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendProlog | Appends the indent string, context description, and the record kind to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendRecordKind | Appends the LogRecordKind of the current record to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameter(SemanticParameterKind, String, String, String, Int32) | Appends a parameter of String type to the current StringBuilder. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Overrides TextLogRecordBuilderAppendSemanticParameter(SemanticParameterKind, String, String, String, Int32).)
Protected method | AppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Overrides TextLogRecordBuilderAppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32).)
Protected method | AppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Overrides TextLogRecordBuilderAppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32).)
Protected method | AppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSourceLineInfo | Appends source (file, line) information to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpaces | Appends a given number of spaces to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpecialChar | Appends a special Char (which may require escaping with specific back-ends) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTrailingPeriod | Appends a trailing period (.) to the current StringBuilder, respecting the AppendTrailingPeriod property. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTypeName | Appends the name of the TypeSource to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | BeginCustomRecord | Initializes the current LogRecordBuilder to emit a custom record. (Inherited from TextLogRecordBuilder.)
Public method | BeginRecord | Initializes the current LogRecordBuilder to emit a standard (i.e. non-custom) record for a given context and method. (Overrides TextLogRecordBuilderBeginRecord(LoggingContext, LogRecordInfo, LogMemberInfo).)
Public method | Complete | Emits the record and resets the current LogRecordBuilder. This method invoked after all SetThisT(T), SetParameterT(Int32, String, ParameterKind, String, T) and similar methods have been called. (Inherited from LogRecordBuilder.)
Public method | Dispose | (Inherited from LogRecordBuilder.)
Protected method | EmitRecord | Emits the record. Invoked by the Complete method. (Overrides TextLogRecordBuilderEmitRecord.)
Protected method | EmitRecord(Boolean) | Emits the record and specifies whether exception details should be appended to the text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescription | Ends building the context Description and starts building the action text. (Overrides TextLogRecordBuilderEndContextDescription.)
Protected method | EndContextDescriptionConditional | Switches between building the context Description and the action text. If the EndContextDescriptionConditional method has been previously invoked, subsequent calls are ignored. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescription | Obsolete. Gets the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescriptionUnsafe | Obsolete. Gets an UnsafeString representing the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextForDescription | Obsolete. Gets the LoggingContext that should be used when getting or appending the Description. (Inherited from TextLogRecordBuilder.)
Protected method | GetSourceName | Gets the name of the TypeSource for the current record, respecting the IncludeNamespace property. (Inherited from TextLogRecordBuilder.)
Protected method | HasRecordKindName | Determines whether the AppendRecordKind will append anything for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | MustBuildContextDescription | Determines whether the current Description should be appended to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | RequireComma | Makes the AppendCommaConditional to append a comma even if it's invoked for the first time. (Inherited from TextLogRecordBuilder.)
Protected method | RequireDelimiter | Causes the next call to the AppendDelimiterConditional to append a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | Reset | Resets all fields and properties of the current LogRecordBuilder to their initial value. Invoked by the Complete method. (Overrides TextLogRecordBuilderReset.)
Public method | SetException | Sets the exception for the method or activity. (Inherited from TextLogRecordBuilder.)
Public method | SetExecutionTime | Sets the method or activity execution time. (Inherited from TextLogRecordBuilder.)
Public method | SetMethodGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T) | Sets the value of a given parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from TextLogRecordBuilder.)
Public method | SetRefStructParameter | (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T) | Sets a given return value (there can be several return values in C# 7.0) and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetThisT(T) | Sets the this (instance) value and uses the default formatter. This method is only invoked if the IncludeThisValue property is true. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetTypeGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Protected method | ShouldLogExceptionDetails | Determines whether exception details should be appended to the text of the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | ToString | Returns a string that represents the current object. (Inherited from TextLogRecordBuilder.)
Protected method | Write | Writes the final message to the back-end. (Overrides TextLogRecordBuilderWrite(UnsafeString).)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T) | Writes a custom parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | WriteCustomString | Write a chunk of custom string. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLogRecordBuilder Constructor

Creates an instance of SerilogLogRecordBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SerilogLogRecordBuilder(
    SerilogLoggingBackend backend
)

Parameters

backend
Type: PostSharp.Patterns.Diagnostics.Backends.SerilogSerilogLoggingBackend
See Also

Reference

SerilogLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLogRecordBuilder Properties

The SerilogLogRecordBuilder type exposes the following members.

Properties
 | Name | Description
Public property | Backend | Gets the parent back-end. (Inherited from TextLogRecordBuilder.)
Public property | BackendOptions | Shortcut for this.Backend.Options. (Inherited from TextLogRecordBuilder.)
Protected property | Context | Gets the LoggingContext to which the record belongs. (Inherited from LogRecordBuilder.)
Public property | Exception | Gets the Exception for the current record, or null if no exception is associated to the current record. (Inherited from TextLogRecordBuilder.)
Public property | IsDisposed | (Inherited from LogRecordBuilder.)
Protected property | Level | Gets the LogLevel for the current record. (Inherited from TextLogRecordBuilder.)
Public property | MemberName | Gets the name of the method, property or field for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | MessageTemplateTokens | Gets the list of MessageTemplateToken for the current log record.
Protected property | Options | Gets the LoggingOptions for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Profile | Gets the LoggingProfile for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Properties | Gets the list of properties for the current log record.
Protected property | RecordKind | Gets the kind of the current record (e.g. MethodEntry or MethodException). (Inherited from LogRecordBuilder.)
Public property | SourceLineInfo | Gets the SourceLineInfo for the current record. (Inherited from TextLogRecordBuilder.)
Public property | SourceType | Gets the source Type of the current record. (Inherited from TextLogRecordBuilder.)
Protected property | StringBuilder | Gets the current UnsafeStringBuilder where everything is being appended. (Inherited from TextLogRecordBuilder.)
Protected property | ThreadContext | Gets the ThreadLoggingContext to which the current LogRecordBuilder belongs. (Inherited from LogRecordBuilder.)
Protected property | TypeSource | Gets the LoggingTypeSource for the current record. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

SerilogLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLogRecordBuilder.MessageTemplateTokens Property

SerilogLogRecordBuilderMessageTemplateTokens Property

Gets the list of MessageTemplateToken for the current log record.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected List<MessageTemplateToken> MessageTemplateTokens { get; }

Property Value

Type: List MessageTemplateToken
See Also

Reference

SerilogLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLogRecordBuilder.Properties Property

SerilogLogRecordBuilderProperties Property

Gets the list of properties for the current log record.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected List<LogEventProperty> Properties { get; }

Property Value

Type: List LogEventProperty
See Also

Reference

SerilogLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLogRecordBuilder Methods

The SerilogLogRecordBuilder type exposes the following members.

Methods
 | Name | Description
Protected method | AppendAsyncInfo | Appends information about the async method to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendClosingParenthesisConditional | Appends a closing parenthesis to the current StringBuilder if required. (Inherited from TextLogRecordBuilder.)
Protected method | AppendComma | (Inherited from TextLogRecordBuilder.)
Protected method | AppendCommaConditional | Appends a comma to the current StringBuilder, unless this method is invoked for the first time for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription | Appends the context Description (or the TypeSource name, if the type of the context is not equal to the source type of the record) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription(LoggingContext) | (Overrides TextLogRecordBuilderAppendContextDescription(LoggingContext).)
Protected method | AppendDelimiter | Appends a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiterConditional | Appends a Delimiter to the current StringBuilder if the RequireDelimiter method has been called previously. (Inherited from TextLogRecordBuilder.)
Protected method | AppendEpilogue | Appends the final part of log message to StringBuilder. This includes state machine number and execution time where relevant, but does not include exception details. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExceptionDetails | Appends exception details to StringBuilder if IncludeExceptionDetails is set. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTime | Appends the execution time to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTimeThreshold | Appends the execution time threshold to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendIndentString | Appends indentation for the given to StringBuilder. (Overrides TextLogRecordBuilderAppendIndentString(Int32).)
Protected method | AppendMemberName | Appends name of the member for the current record (including the declaring type name, subject to the IncludeType property) to the current StringBuilder, as well as an opening parenthesis. (Inherited from TextLogRecordBuilder.)
Protected method | AppendOpeningParenthesis | Appends an opening parenthesis to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendProlog | Appends the indent string, context description, and the record kind to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendRecordKind | Appends the LogRecordKind of the current record to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameter(SemanticParameterKind, String, String, String, Int32) | Appends a parameter of String type to the current StringBuilder. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Overrides TextLogRecordBuilderAppendSemanticParameter(SemanticParameterKind, String, String, String, Int32).)
Protected method | AppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Overrides TextLogRecordBuilderAppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32).)
Protected method | AppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Overrides TextLogRecordBuilderAppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32).)
Protected method | AppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSourceLineInfo | Appends source (file, line) information to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpaces | Appends a given number of spaces to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpecialChar | Appends a special Char (which may require escaping with specific back-ends) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTrailingPeriod | Appends a trailing period (.) to the current StringBuilder, respecting the AppendTrailingPeriod property. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTypeName | Appends the name of the TypeSource to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | BeginCustomRecord | Initializes the current LogRecordBuilder to emit a custom record. (Inherited from TextLogRecordBuilder.)
Public method | BeginRecord | Initializes the current LogRecordBuilder to emit a standard (i.e. non-custom) record for a given context and method. (Overrides TextLogRecordBuilderBeginRecord(LoggingContext, LogRecordInfo, LogMemberInfo).)
Public method | Complete | Emits the record and resets the current LogRecordBuilder. This method invoked after all SetThisT(T), SetParameterT(Int32, String, ParameterKind, String, T) and similar methods have been called. (Inherited from LogRecordBuilder.)
Public method | Dispose | (Inherited from LogRecordBuilder.)
Protected method | EmitRecord | Emits the record. Invoked by the Complete method. (Overrides TextLogRecordBuilderEmitRecord.)
Protected method | EmitRecord(Boolean) | Emits the record and specifies whether exception details should be appended to the text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescription | Ends building the context Description and starts building the action text. (Overrides TextLogRecordBuilderEndContextDescription.)
Protected method | EndContextDescriptionConditional | Switches between building the context Description and the action text. If the EndContextDescriptionConditional method has been previously invoked, subsequent calls are ignored. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescription | Obsolete. Gets the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescriptionUnsafe | Obsolete. Gets an UnsafeString representing the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextForDescription | Obsolete. Gets the LoggingContext that should be used when getting or appending the Description. (Inherited from TextLogRecordBuilder.)
Protected method | GetSourceName | Gets the name of the TypeSource for the current record, respecting the IncludeNamespace property. (Inherited from TextLogRecordBuilder.)
Protected method | HasRecordKindName | Determines whether the AppendRecordKind will append anything for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | MustBuildContextDescription | Determines whether the current Description should be appended to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | RequireComma | Makes the AppendCommaConditional to append a comma even if it's invoked for the first time. (Inherited from TextLogRecordBuilder.)
Protected method | RequireDelimiter | Causes the next call to the AppendDelimiterConditional to append a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | Reset | Resets all fields and properties of the current LogRecordBuilder to their initial value. Invoked by the Complete method. (Overrides TextLogRecordBuilderReset.)
Public method | SetException | Sets the exception for the method or activity. (Inherited from TextLogRecordBuilder.)
Public method | SetExecutionTime | Sets the method or activity execution time. (Inherited from TextLogRecordBuilder.)
Public method | SetMethodGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T) | Sets the value of a given parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from TextLogRecordBuilder.)
Public method | SetRefStructParameter | (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T) | Sets a given return value (there can be several return values in C# 7.0) and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetThisT(T) | Sets the this (instance) value and uses the default formatter. This method is only invoked if the IncludeThisValue property is true. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetTypeGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Protected method | ShouldLogExceptionDetails | Determines whether exception details should be appended to the text of the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | ToString | Returns a string that represents the current object. (Inherited from TextLogRecordBuilder.)
Protected method | Write | Writes the final message to the back-end. (Overrides TextLogRecordBuilderWrite(UnsafeString).)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T) | Writes a custom parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | WriteCustomString | Write a chunk of custom string. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

SerilogLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLogRecordBuilder.AppendContextDescription Method

SerilogLogRecordBuilderAppendContextDescription Method

Overload List
 | Name | Description
Protected method | AppendContextDescription | Appends the context Description (or the TypeSource name, if the type of the context is not equal to the source type of the record) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription(LoggingContext) | (Overrides TextLogRecordBuilderAppendContextDescription(LoggingContext).)
Top
See Also

Reference

SerilogLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLogRecordBuilder.AppendContextDescription Method (LoggingContext)

SerilogLogRecordBuilderAppendContextDescription Method (LoggingContext)

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void AppendContextDescription(
    LoggingContext context
)

Parameters

context
Type: PostSharp.Patterns.Diagnostics.ContextsLoggingContext
See Also

Reference

SerilogLogRecordBuilder Class
AppendContextDescription Overload
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLogRecordBuilder.AppendIndentString Method

SerilogLogRecordBuilderAppendIndentString Method

Appends indentation for the given to StringBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void AppendIndentString(
    int additionalIndent = 0
)

Parameters

additionalIndent (Optional)
Type: SystemInt32
See Also

Reference

SerilogLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLogRecordBuilder.AppendSemanticParameter Method

SerilogLogRecordBuilderAppendSemanticParameter Method

Overload List
 | Name | Description
Protected method | AppendSemanticParameter(SemanticParameterKind, String, String, String, Int32) | Appends a parameter of String type to the current StringBuilder. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Overrides TextLogRecordBuilderAppendSemanticParameter(SemanticParameterKind, String, String, String, Int32).)
Protected method | AppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Overrides TextLogRecordBuilderAppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32).)
Protected method | AppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Overrides TextLogRecordBuilderAppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32).)
Protected method | AppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

SerilogLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLogRecordBuilder.AppendSemanticParameter Method (SemanticParameterKind, String, String, String, Int32)

SerilogLogRecordBuilderAppendSemanticParameter Method (SemanticParameterKind, String, String, String, Int32)

Appends a parameter of String type to the current StringBuilder. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void AppendSemanticParameter(
    SemanticParameterKind kind,
    string name,
    string value,
    string prefix,
    int index
)

Parameters

kind
Type: PostSharp.Patterns.Diagnostics.RecordBuildersSemanticParameterKind
Kind of semantic parameter.
name
Type: SystemString
Parameter name. The name parameter itself is not guaranteed to be unique in a given record. However, in combination with prefix and index, it is guaranteed to be unique.
value
Type: SystemString
Parameter value.
prefix
Type: SystemString
Prefix to be prepended to name, or null if there is no prefix.
index
Type: SystemInt32
Index of the parameter value, if there are several values for the same parameter name, or -1 if there is a single parameter value for this parameter name.
See Also

Reference

SerilogLogRecordBuilder Class
AppendSemanticParameter Overload
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLogRecordBuilder.AppendSemanticParameter(T) Method (SemanticParameterKind, ArraySegment(Char), T, IFormatter(T), String, Int32)

SerilogLogRecordBuilderAppendSemanticParameterT Method (SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32)

Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void AppendSemanticParameter<T>(
    SemanticParameterKind kind,
    ArraySegment<char> name,
    T value,
    IFormatter<T> formatter,
    string prefix,
    int index = -1
)

Parameters

kind
Type: PostSharp.Patterns.Diagnostics.RecordBuildersSemanticParameterKind
Kind of semantic parameter.
name
Type: SystemArraySegment Char
Parameter name. The name parameter itself is not guaranteed to be unique in a given record. However, in combination with prefix and index, it is guaranteed to be unique.
value
Type: T
Parameter value.
formatter
Type: PostSharp.Patterns.FormattersIFormatter T
The formatter to be used to format value.
prefix
Type: SystemString
Prefix to be prepended to name, or null if there is no prefix.
index (Optional)
Type: SystemInt32
Index of the parameter value, if there are several values for the same parameter name, or -1 if there is a single parameter value for this parameter name.

Type Parameters

T
See Also

Reference

SerilogLogRecordBuilder Class
AppendSemanticParameter Overload
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLogRecordBuilder.AppendSemanticParameter(T) Method (SemanticParameterKind, String, T, IFormatter(T), String, Int32)

SerilogLogRecordBuilderAppendSemanticParameterT Method (SemanticParameterKind, String, T, IFormatterT, String, Int32)

Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void AppendSemanticParameter<T>(
    SemanticParameterKind kind,
    string name,
    T value,
    IFormatter<T> formatter,
    string prefix,
    int index
)

Parameters

kind
Type: PostSharp.Patterns.Diagnostics.RecordBuildersSemanticParameterKind
Kind of semantic parameter.
name
Type: SystemString
Parameter name. The name parameter itself is not guaranteed to be unique in a given record. However, in combination with prefix and index, it is guaranteed to be unique.
value
Type: T
Parameter value.
formatter
Type: PostSharp.Patterns.FormattersIFormatter T
The formatter to be used to format value.
prefix
Type: SystemString
Prefix to be prepended to name, or null if there is no prefix.
index
Type: SystemInt32
Index of the parameter value, if there are several values for the same parameter name, or -1 if there is a single parameter value for this parameter name.

Type Parameters

T
See Also

Reference

SerilogLogRecordBuilder Class
AppendSemanticParameter Overload
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLogRecordBuilder.BeginRecord Method

SerilogLogRecordBuilderBeginRecord Method

Initializes the current LogRecordBuilder to emit a standard (i.e. non-custom) record for a given context and method.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void BeginRecord(
    LoggingContext context,
    ref LogRecordInfo recordInfo,
    ref LogMemberInfo memberInfo
)

Parameters

context
Type: PostSharp.Patterns.Diagnostics.ContextsLoggingContext
The parent LoggingContext of the record.
recordInfo
Type: PostSharp.Patterns.Diagnostics.ContextsLogRecordInfo
Information about the record.
memberInfo
Type: PostSharp.Patterns.Diagnostics.ContextsLogMemberInfo
Information about the method, property, or field.
See Also

Reference

SerilogLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLogRecordBuilder.EmitRecord Method

SerilogLogRecordBuilderEmitRecord Method

Overload List
 | Name | Description
Protected method | EmitRecord | Emits the record. Invoked by the Complete method. (Overrides TextLogRecordBuilderEmitRecord.)
Protected method | EmitRecord(Boolean) | Emits the record and specifies whether exception details should be appended to the text. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

SerilogLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLogRecordBuilder.EmitRecord Method

SerilogLogRecordBuilderEmitRecord Method

Emits the record. Invoked by the Complete method.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void EmitRecord()
See Also

Reference

SerilogLogRecordBuilder Class
EmitRecord Overload
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLogRecordBuilder.EndContextDescription Method

SerilogLogRecordBuilderEndContextDescription Method

Ends building the context Description and starts building the action text.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void EndContextDescription()
See Also

Reference

SerilogLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLogRecordBuilder.Reset Method

SerilogLogRecordBuilderReset Method

Resets all fields and properties of the current LogRecordBuilder to their initial value. Invoked by the Complete method.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void Reset()
See Also

Reference

SerilogLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogLogRecordBuilder.Write Method

SerilogLogRecordBuilderWrite Method

Writes the final message to the back-end.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void Write(
    UnsafeString message
)

Parameters

message
Type: PostSharp.Patterns.FormattersUnsafeString
The final message.
See Also

Reference

SerilogLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


SerilogSemanticParameterCollection Class

Exposes the options (SerilogSemanticParameterOptions) for individual kinds of Serilog semantic parameters through an indexer. This class can be enumerated.
Inheritance Hierarchy
SystemObject
System.Collections.ObjectModelReadOnlyCollection SerilogSemanticParameterOptions
PostSharp.Patterns.Diagnostics.Backends.SerilogSerilogSemanticParameterCollection

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class SerilogSemanticParameterCollection : ReadOnlyCollection<SerilogSemanticParameterOptions>

The SerilogSemanticParameterCollection type exposes the following members.

Properties
 | Name | Description
Public property | Item | Gets the options for a given semantic.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogSemanticParameterCollection Properties

The SerilogSemanticParameterCollection type exposes the following members.

Properties
 | Name | Description
Public property | Item | Gets the options for a given semantic.
Top
See Also

Reference

SerilogSemanticParameterCollection Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogSemanticParameterCollection.Item Property

SerilogSemanticParameterCollectionItem Property

Gets the options for a given semantic.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SerilogSemanticParameterOptions this[
    SemanticParameterKind semantic
] { get; }

Parameters

semantic
Type: PostSharp.Patterns.Diagnostics.RecordBuildersSemanticParameterKind

Return Value

Type: SerilogSemanticParameterOptions
See Also

Reference

SerilogSemanticParameterCollection Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogSemanticParameterOptions Class

Define options for a specific kind of semantic parameter.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.Backends.SerilogSerilogSemanticParameterOptions

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class SerilogSemanticParameterOptions

The SerilogSemanticParameterOptions type exposes the following members.

Properties
 | Name | Description
Public property | Semantic | Gets the semantic whose the current object represents the options.
Public property | TreatAsSemanticParameter | Determines whether the PostSharp semantic parameter should be passed to Serilog as a semantic parameter. If false, the value of the semantic parameter passed by PostSharp is simply appended to the message formatting string, without defining a Serilog semantic parameter.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogSemanticParameterOptions Properties

The SerilogSemanticParameterOptions type exposes the following members.

Properties
 | Name | Description
Public property | Semantic | Gets the semantic whose the current object represents the options.
Public property | TreatAsSemanticParameter | Determines whether the PostSharp semantic parameter should be passed to Serilog as a semantic parameter. If false, the value of the semantic parameter passed by PostSharp is simply appended to the message formatting string, without defining a Serilog semantic parameter.
Top
See Also

Reference

SerilogSemanticParameterOptions Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogSemanticParameterOptions.Semantic Property

SerilogSemanticParameterOptionsSemantic Property

Gets the semantic whose the current object represents the options.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SemanticParameterKind Semantic { get; }

Property Value

Type: SemanticParameterKind
See Also

Reference

SerilogSemanticParameterOptions Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogSemanticParameterOptions.TreatAsSemanticParameter Property

SerilogSemanticParameterOptionsTreatAsSemanticParameter Property

Determines whether the PostSharp semantic parameter should be passed to Serilog as a semantic parameter. If false, the value of the semantic parameter passed by PostSharp is simply appended to the message formatting string, without defining a Serilog semantic parameter.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool TreatAsSemanticParameter { get; set; }

Property Value

Type: Boolean
Remarks
The default value is false except for ParameterValue, Exception, ReturnValue, ReturnItemValue, Duration and This. Each Serilog semantic parameters increases the performance cost of logging, therefore they should be kept the minimal practical set.
See Also

Reference

SerilogSemanticParameterOptions Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogSyncCustomActivityContext Class

The SyncCustomActivityLoggingContext for SerilogLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.ContextsLoggingContext
PostSharp.Patterns.Diagnostics.ContextsSyncLoggingContext
PostSharp.Patterns.Diagnostics.ContextsSyncCustomActivityLoggingContext
PostSharp.Patterns.Diagnostics.Backends.SerilogSerilogSyncCustomActivityContext

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class SerilogSyncCustomActivityContext : SyncCustomActivityLoggingContext

The SerilogSyncCustomActivityContext type exposes the following members.

Constructors
 | Name | Description
Public method | SerilogSyncCustomActivityContext | Initializes a new SerilogSyncCustomActivityContext.
Top
Properties
 | Name | Description
Public property | ActivationContext | Gets the LoggingContext in which the current context was activated. If the current context has been resumed, ActivationContext refers to the context in which the context was resumed. (Inherited from LoggingContext.)
Public property | Backend | Gets the parent LoggingBackend of the current context. (Inherited from LoggingContext.)
Public property | CustomActivityKind | Gets the kind of LogActivity represented by the current context. (Inherited from SyncCustomActivityLoggingContext.)
Public property | Description | Gets the description of the current context. The description is typically set by the LogRecordBuilder when building the opening record of a context. (Inherited from LoggingContext.)
Public property | Id | Gets or set the identifier of the current context. This property should be used for debugging only. Its value is lazily created. (Inherited from LoggingContext.)
Public property | IndentLevel | Gets or sets the indentation level for the current context. (Inherited from LoggingContext.)
Public property | IsAsync | Determines whether the current LoggingContext represents an async method or an asynchronous custom activity. (Inherited from LoggingContext.)
Public property | IsDisposed | Determines whether the current context has been disposed. (Inherited from LoggingContext.)
Public property | IsSharable | Determines whether the current LoggingContext can be accessed outside of its nominal lifetype (for instance after the method has completed or a custom activity has beeen closed). Since contexts can be pooled and reused, consumers must call the MakeSharable method if they want to keep a reference to the LoggingContext and access it after its nominal lifetime has completed. (Inherited from LoggingContext.)
Public property | Kind | Gets the kind of the current context. (Inherited from LoggingContext.)
Public property | MemberName | Gets the name of the method or property related to the current context. (Inherited from LoggingContext.)
Public property | ParentContext | Gets the LoggingContext that created (initiated) the current context. This is the logical parent. (Inherited from LoggingContext.)
Public property | Source | Gets the LoggingTypeSource corresponding, typically, to the declaring type of the member associated to the current context. (Inherited from LoggingContext.)
Public property | ThreadContext | Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed. (Inherited from SyncLoggingContext.)
Top
Methods
 | Name | Description
Public method | CreateCorrelationCookie | Creates a cookie that can be used to correlate, using the SetCorrelation(CorrelationCookie) method, another context to the current context. (Inherited from LoggingContext.)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from SyncLoggingContext.)
Public method | GetCustomRecordBuilder | Gets a LogRecordBuilder for the current context to build a custom record. (Inherited from LoggingContext.)
Public method | GetRecordBuilder | Gets a LogRecordBuilder for the current context to build a standard record for a given method. (Inherited from LoggingContext.)
Public method | MakeSharable | Allows the current context to be shared beyond its normal lifecycle by preventing it from being returned to the pool. (Inherited from LoggingContext.)
Public method | Open | Opens the current context. (Inherited from SyncCustomActivityLoggingContext.)
Protected method | Reset | Resets the current context to its initial, uninitialized state. This method is called by the Dispose method. (Inherited from LoggingContext.)
Protected method | ReturnToPool | Returns the current instance to the pool to which it belongs. This method is invoked by the Dispose(Boolean) method. (Inherited from SyncCustomActivityLoggingContext.)
Public method | SetCorrelation | Associates the current context with another context. (Inherited from LoggingContext.)
Public method | SetWaitDependency | Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts. (Inherited from SyncCustomActivityLoggingContext.)
Public method | ToString | Returns a string that represents the current object. (Inherited from LoggingContext.)
Protected method | ToString(StringBuilder) | Formats a description of the current LoggingContext into a given StringBuilder. (Inherited from LoggingContext.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogSyncCustomActivityContext Constructor

Initializes a new SerilogSyncCustomActivityContext.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SerilogSyncCustomActivityContext(
    ThreadLoggingContext threadContext
)

Parameters

threadContext
Type: PostSharp.Patterns.Diagnostics.ContextsThreadLoggingContext
The ThreadLoggingContext to which the context shall belong.
See Also

Reference

SerilogSyncCustomActivityContext Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogSyncCustomActivityContext Properties

The SerilogSyncCustomActivityContext type exposes the following members.

Properties
 | Name | Description
Public property | ActivationContext | Gets the LoggingContext in which the current context was activated. If the current context has been resumed, ActivationContext refers to the context in which the context was resumed. (Inherited from LoggingContext.)
Public property | Backend | Gets the parent LoggingBackend of the current context. (Inherited from LoggingContext.)
Public property | CustomActivityKind | Gets the kind of LogActivity represented by the current context. (Inherited from SyncCustomActivityLoggingContext.)
Public property | Description | Gets the description of the current context. The description is typically set by the LogRecordBuilder when building the opening record of a context. (Inherited from LoggingContext.)
Public property | Id | Gets or set the identifier of the current context. This property should be used for debugging only. Its value is lazily created. (Inherited from LoggingContext.)
Public property | IndentLevel | Gets or sets the indentation level for the current context. (Inherited from LoggingContext.)
Public property | IsAsync | Determines whether the current LoggingContext represents an async method or an asynchronous custom activity. (Inherited from LoggingContext.)
Public property | IsDisposed | Determines whether the current context has been disposed. (Inherited from LoggingContext.)
Public property | IsSharable | Determines whether the current LoggingContext can be accessed outside of its nominal lifetype (for instance after the method has completed or a custom activity has beeen closed). Since contexts can be pooled and reused, consumers must call the MakeSharable method if they want to keep a reference to the LoggingContext and access it after its nominal lifetime has completed. (Inherited from LoggingContext.)
Public property | Kind | Gets the kind of the current context. (Inherited from LoggingContext.)
Public property | MemberName | Gets the name of the method or property related to the current context. (Inherited from LoggingContext.)
Public property | ParentContext | Gets the LoggingContext that created (initiated) the current context. This is the logical parent. (Inherited from LoggingContext.)
Public property | Source | Gets the LoggingTypeSource corresponding, typically, to the declaring type of the member associated to the current context. (Inherited from LoggingContext.)
Public property | ThreadContext | Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed. (Inherited from SyncLoggingContext.)
Top
See Also

Reference

SerilogSyncCustomActivityContext Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogSyncCustomActivityContext Methods

The SerilogSyncCustomActivityContext type exposes the following members.

Methods
 | Name | Description
Public method | CreateCorrelationCookie | Creates a cookie that can be used to correlate, using the SetCorrelation(CorrelationCookie) method, another context to the current context. (Inherited from LoggingContext.)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from SyncLoggingContext.)
Public method | GetCustomRecordBuilder | Gets a LogRecordBuilder for the current context to build a custom record. (Inherited from LoggingContext.)
Public method | GetRecordBuilder | Gets a LogRecordBuilder for the current context to build a standard record for a given method. (Inherited from LoggingContext.)
Public method | MakeSharable | Allows the current context to be shared beyond its normal lifecycle by preventing it from being returned to the pool. (Inherited from LoggingContext.)
Public method | Open | Opens the current context. (Inherited from SyncCustomActivityLoggingContext.)
Protected method | Reset | Resets the current context to its initial, uninitialized state. This method is called by the Dispose method. (Inherited from LoggingContext.)
Protected method | ReturnToPool | Returns the current instance to the pool to which it belongs. This method is invoked by the Dispose(Boolean) method. (Inherited from SyncCustomActivityLoggingContext.)
Public method | SetCorrelation | Associates the current context with another context. (Inherited from LoggingContext.)
Public method | SetWaitDependency | Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts. (Inherited from SyncCustomActivityLoggingContext.)
Public method | ToString | Returns a string that represents the current object. (Inherited from LoggingContext.)
Protected method | ToString(StringBuilder) | Formats a description of the current LoggingContext into a given StringBuilder. (Inherited from LoggingContext.)
Top
See Also

Reference

SerilogSyncCustomActivityContext Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogSyncMethodLoggingContext Class

The SyncMethodLoggingContext.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.ContextsLoggingContext
PostSharp.Patterns.Diagnostics.ContextsSyncLoggingContext
PostSharp.Patterns.Diagnostics.ContextsSyncMethodLoggingContext
PostSharp.Patterns.Diagnostics.Backends.SerilogSerilogSyncMethodLoggingContext

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class SerilogSyncMethodLoggingContext : SyncMethodLoggingContext

The SerilogSyncMethodLoggingContext type exposes the following members.

Constructors
 | Name | Description
Public method | SerilogSyncMethodLoggingContext | Initializes a new SerilogSyncMethodLoggingContext.
Top
Properties
 | Name | Description
Public property | ActivationContext | Gets the LoggingContext in which the current context was activated. If the current context has been resumed, ActivationContext refers to the context in which the context was resumed. (Inherited from LoggingContext.)
Public property | Backend | Gets the parent LoggingBackend of the current context. (Inherited from LoggingContext.)
Public property | Description | Gets the description of the current context. The description is typically set by the LogRecordBuilder when building the opening record of a context. (Inherited from LoggingContext.)
Public property | Id | Gets or set the identifier of the current context. This property should be used for debugging only. Its value is lazily created. (Inherited from LoggingContext.)
Public property | IndentLevel | Gets or sets the indentation level for the current context. (Inherited from LoggingContext.)
Public property | IsAsync | Determines whether the current LoggingContext represents an async method or an asynchronous custom activity. (Inherited from LoggingContext.)
Public property | IsDisposed | Determines whether the current context has been disposed. (Inherited from LoggingContext.)
Public property | IsSharable | Determines whether the current LoggingContext can be accessed outside of its nominal lifetype (for instance after the method has completed or a custom activity has beeen closed). Since contexts can be pooled and reused, consumers must call the MakeSharable method if they want to keep a reference to the LoggingContext and access it after its nominal lifetime has completed. (Inherited from LoggingContext.)
Public property | Kind | Gets the kind of the current context. (Inherited from LoggingContext.)
Public property | MemberName | Gets the name of the method or property related to the current context. (Inherited from LoggingContext.)
Public property | ParentContext | Gets the LoggingContext that created (initiated) the current context. This is the logical parent. (Inherited from LoggingContext.)
Public property | Source | Gets the LoggingTypeSource corresponding, typically, to the declaring type of the member associated to the current context. (Inherited from LoggingContext.)
Public property | ThreadContext | Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed. (Inherited from SyncLoggingContext.)
Top
Methods
 | Name | Description
Public method | CreateCorrelationCookie | Creates a cookie that can be used to correlate, using the SetCorrelation(CorrelationCookie) method, another context to the current context. (Inherited from LoggingContext.)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.)
Protected method | Dispose(Boolean) | Disposes the current object. (Overrides SyncLoggingContextDispose(Boolean).)
Public method | GetCustomRecordBuilder | Gets a LogRecordBuilder for the current context to build a custom record. (Inherited from LoggingContext.)
Public method | GetRecordBuilder | Gets a LogRecordBuilder for the current context to build a standard record for a given method. (Inherited from LoggingContext.)
Public method | MakeSharable | Allows the current context to be shared beyond its normal lifecycle by preventing it from being returned to the pool. (Inherited from LoggingContext.)
Public method | Open | Opens the current context for a given member. (Inherited from SyncMethodLoggingContext.)
Protected method | Reset | Resets the current context to its initial, uninitialized state. This method is called by the Dispose method. (Inherited from LoggingContext.)
Protected method | ReturnToPool | Returns the current instance to the pool to which it belongs. This method is invoked by the Dispose(Boolean) method. (Inherited from SyncMethodLoggingContext.)
Public method | SetCorrelation | Associates the current context with another context. (Inherited from LoggingContext.)
Public method | SetWaitDependency | Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts. (Inherited from LoggingContext.)
Public method | ToString | Returns a string that represents the current object. (Inherited from LoggingContext.)
Protected method | ToString(StringBuilder) | Formats a description of the current LoggingContext into a given StringBuilder. (Inherited from LoggingContext.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogSyncMethodLoggingContext Constructor

Initializes a new SerilogSyncMethodLoggingContext.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SerilogSyncMethodLoggingContext(
    ThreadLoggingContext threadContext
)

Parameters

threadContext
Type: PostSharp.Patterns.Diagnostics.ContextsThreadLoggingContext
The ThreadLoggingContext to which the new context shall belong.
See Also

Reference

SerilogSyncMethodLoggingContext Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogSyncMethodLoggingContext Properties

The SerilogSyncMethodLoggingContext type exposes the following members.

Properties
 | Name | Description
Public property | ActivationContext | Gets the LoggingContext in which the current context was activated. If the current context has been resumed, ActivationContext refers to the context in which the context was resumed. (Inherited from LoggingContext.)
Public property | Backend | Gets the parent LoggingBackend of the current context. (Inherited from LoggingContext.)
Public property | Description | Gets the description of the current context. The description is typically set by the LogRecordBuilder when building the opening record of a context. (Inherited from LoggingContext.)
Public property | Id | Gets or set the identifier of the current context. This property should be used for debugging only. Its value is lazily created. (Inherited from LoggingContext.)
Public property | IndentLevel | Gets or sets the indentation level for the current context. (Inherited from LoggingContext.)
Public property | IsAsync | Determines whether the current LoggingContext represents an async method or an asynchronous custom activity. (Inherited from LoggingContext.)
Public property | IsDisposed | Determines whether the current context has been disposed. (Inherited from LoggingContext.)
Public property | IsSharable | Determines whether the current LoggingContext can be accessed outside of its nominal lifetype (for instance after the method has completed or a custom activity has beeen closed). Since contexts can be pooled and reused, consumers must call the MakeSharable method if they want to keep a reference to the LoggingContext and access it after its nominal lifetime has completed. (Inherited from LoggingContext.)
Public property | Kind | Gets the kind of the current context. (Inherited from LoggingContext.)
Public property | MemberName | Gets the name of the method or property related to the current context. (Inherited from LoggingContext.)
Public property | ParentContext | Gets the LoggingContext that created (initiated) the current context. This is the logical parent. (Inherited from LoggingContext.)
Public property | Source | Gets the LoggingTypeSource corresponding, typically, to the declaring type of the member associated to the current context. (Inherited from LoggingContext.)
Public property | ThreadContext | Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed. (Inherited from SyncLoggingContext.)
Top
See Also

Reference

SerilogSyncMethodLoggingContext Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogSyncMethodLoggingContext Methods

The SerilogSyncMethodLoggingContext type exposes the following members.

Methods
 | Name | Description
Public method | CreateCorrelationCookie | Creates a cookie that can be used to correlate, using the SetCorrelation(CorrelationCookie) method, another context to the current context. (Inherited from LoggingContext.)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.)
Protected method | Dispose(Boolean) | Disposes the current object. (Overrides SyncLoggingContextDispose(Boolean).)
Public method | GetCustomRecordBuilder | Gets a LogRecordBuilder for the current context to build a custom record. (Inherited from LoggingContext.)
Public method | GetRecordBuilder | Gets a LogRecordBuilder for the current context to build a standard record for a given method. (Inherited from LoggingContext.)
Public method | MakeSharable | Allows the current context to be shared beyond its normal lifecycle by preventing it from being returned to the pool. (Inherited from LoggingContext.)
Public method | Open | Opens the current context for a given member. (Inherited from SyncMethodLoggingContext.)
Protected method | Reset | Resets the current context to its initial, uninitialized state. This method is called by the Dispose method. (Inherited from LoggingContext.)
Protected method | ReturnToPool | Returns the current instance to the pool to which it belongs. This method is invoked by the Dispose(Boolean) method. (Inherited from SyncMethodLoggingContext.)
Public method | SetCorrelation | Associates the current context with another context. (Inherited from LoggingContext.)
Public method | SetWaitDependency | Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts. (Inherited from LoggingContext.)
Public method | ToString | Returns a string that represents the current object. (Inherited from LoggingContext.)
Protected method | ToString(StringBuilder) | Formats a description of the current LoggingContext into a given StringBuilder. (Inherited from LoggingContext.)
Top
See Also

Reference

SerilogSyncMethodLoggingContext Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogSyncMethodLoggingContext.Dispose Method

SerilogSyncMethodLoggingContextDispose Method

Overload List
 | Name | Description
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.)
Protected method | Dispose(Boolean) | Disposes the current object. (Overrides SyncLoggingContextDispose(Boolean).)
Top
See Also

Reference

SerilogSyncMethodLoggingContext Class
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


SerilogSyncMethodLoggingContext.Dispose Method (Boolean)

SerilogSyncMethodLoggingContextDispose Method (Boolean)

Disposes the current object.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Serilog
Assembly: PostSharp.Patterns.Diagnostics.Backends.Serilog (in PostSharp.Patterns.Diagnostics.Backends.Serilog.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void Dispose(
    bool disposing
)

Parameters

disposing
Type: SystemBoolean
true if the Dispose method is called explicitly, false is the object is being finalized.
See Also

Reference

SerilogSyncMethodLoggingContext Class
Dispose Overload
PostSharp.Patterns.Diagnostics.Backends.Serilog Namespace


PostSharp.Patterns.Diagnostics.Backends.Trace Namespace

Classes
 | Class | Description
Public class | TraceLoggingBackend | Logging back-end that logs using Trace.
Public class | TraceLoggingBackendOptions | Initializes a new TraceLoggingBackendOptions.
Public class | TraceLoggingTypeSource | The LoggingTypeSource for TraceLoggingBackend.
Public class | TraceLogRecordBuilder | The LogRecordBuilder for TraceLoggingBackend.


TraceLoggingBackend Class

Logging back-end that logs using Trace.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingBackend
PostSharp.Patterns.Diagnostics.BackendsTextLoggingBackend
PostSharp.Patterns.Diagnostics.Backends.TraceTraceLoggingBackend

Namespace: PostSharp.Patterns.Diagnostics.Backends.Trace
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class TraceLoggingBackend : TextLoggingBackend

The TraceLoggingBackend type exposes the following members.

Constructors
 | Name | Description
Public method | TraceLoggingBackend | Initializes a new TraceLoggingBackend.
Top
Properties
 | Name | Description
Public property | CurrentContext | Gets the current LoggingContext. (Inherited from LoggingBackend.)
Public property | IsCorrupted | (Inherited from LoggingBackend.)
Public property | IsDisposed | Determines whether the current LoggingBackend has been disposed. (Inherited from LoggingBackend.)
Public property | IsEnabled | Determines whether the current LoggingBackend is currently enabled. This property has precedence over, and does not affect, the minimal log levels set through the SetLevel(LogLevel) method. (Inherited from LoggingBackend.)
Public property | Options | Gets the back-end options.
Top
Methods
 | Name | Description
Protected method | CreateAsyncCustomActivityContext | Creates a new AsyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateAsyncMethodContext | Creates a new AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Protected method | CreateEphemeralContext | Creates a new EphemeralLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateIteratorContext | Creates a new IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | CreateRecordBuilder | Creates a new LogRecordBuilder. (Overrides LoggingBackendCreateRecordBuilder.)
Protected method | CreateSyncCustomActivityContext | Creates a new SyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateSyncMethodContext | Creates a new SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Protected method | CreateThreadContext | Creates a new ThreadLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateTypeSource | Creates LoggingTypeSource for the given role and type. (Overrides LoggingBackendCreateTypeSource(LoggingNamespaceSource, Type).)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingBackend.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from TextLoggingBackend.)
Public method | GetAsyncContextOfTask | Gets the AsyncMethodLoggingContext associated with a Task. (Inherited from LoggingBackend.)
Protected method | GetBackendOptions | Gets the formatting and rendering options for the current LoggingBackend. (Inherited from TextLoggingBackend.)
Public method | GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace. (Inherited from LoggingBackend.)
Public method | GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type. (Inherited from LoggingBackend.)
Protected method | GetTextBackendOptions | Gets the options. (Overrides TextLoggingBackendGetTextBackendOptions.)
Public method | GetThreadContext | Returns the ThreadLoggingContext for the current Thread. (Inherited from LoggingBackend.)
Public method | OpenAsyncContext | Gets an AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Public method | OpenCustomActivityContext | Gets a LoggingContext for a custom activity (opened using OpenActivity(String) or OpenAsyncActivity(String)). (Inherited from LoggingBackend.)
Public method | OpenEphemeralContext | Gets an EphemeralLoggingContext for use in a given method. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record. (Inherited from LoggingBackend.)
Public method | OpenIteratorContext | Gets an IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | OpenSyncContext | Gets a SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Trace Namespace

Other Resources

Conceptual: Adding Detailed Logging to your Solution


TraceLoggingBackend Constructor

Initializes a new TraceLoggingBackend.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Trace
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TraceLoggingBackend()
See Also

Reference

TraceLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Trace Namespace


TraceLoggingBackend Properties

The TraceLoggingBackend type exposes the following members.

Properties
 | Name | Description
Public property | CurrentContext | Gets the current LoggingContext. (Inherited from LoggingBackend.)
Public property | IsCorrupted | (Inherited from LoggingBackend.)
Public property | IsDisposed | Determines whether the current LoggingBackend has been disposed. (Inherited from LoggingBackend.)
Public property | IsEnabled | Determines whether the current LoggingBackend is currently enabled. This property has precedence over, and does not affect, the minimal log levels set through the SetLevel(LogLevel) method. (Inherited from LoggingBackend.)
Public property | Options | Gets the back-end options.
Top
See Also

Reference

TraceLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Trace Namespace


TraceLoggingBackend.Options Property

TraceLoggingBackendOptions Property

Gets the back-end options.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Trace
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TraceLoggingBackendOptions Options { get; }

Property Value

Type: TraceLoggingBackendOptions
See Also

Reference

TraceLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Trace Namespace


TraceLoggingBackend Methods

The TraceLoggingBackend type exposes the following members.

Methods
 | Name | Description
Protected method | CreateAsyncCustomActivityContext | Creates a new AsyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateAsyncMethodContext | Creates a new AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Protected method | CreateEphemeralContext | Creates a new EphemeralLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateIteratorContext | Creates a new IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | CreateRecordBuilder | Creates a new LogRecordBuilder. (Overrides LoggingBackendCreateRecordBuilder.)
Protected method | CreateSyncCustomActivityContext | Creates a new SyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateSyncMethodContext | Creates a new SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Protected method | CreateThreadContext | Creates a new ThreadLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateTypeSource | Creates LoggingTypeSource for the given role and type. (Overrides LoggingBackendCreateTypeSource(LoggingNamespaceSource, Type).)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingBackend.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from TextLoggingBackend.)
Public method | GetAsyncContextOfTask | Gets the AsyncMethodLoggingContext associated with a Task. (Inherited from LoggingBackend.)
Protected method | GetBackendOptions | Gets the formatting and rendering options for the current LoggingBackend. (Inherited from TextLoggingBackend.)
Public method | GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace. (Inherited from LoggingBackend.)
Public method | GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type. (Inherited from LoggingBackend.)
Protected method | GetTextBackendOptions | Gets the options. (Overrides TextLoggingBackendGetTextBackendOptions.)
Public method | GetThreadContext | Returns the ThreadLoggingContext for the current Thread. (Inherited from LoggingBackend.)
Public method | OpenAsyncContext | Gets an AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Public method | OpenCustomActivityContext | Gets a LoggingContext for a custom activity (opened using OpenActivity(String) or OpenAsyncActivity(String)). (Inherited from LoggingBackend.)
Public method | OpenEphemeralContext | Gets an EphemeralLoggingContext for use in a given method. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record. (Inherited from LoggingBackend.)
Public method | OpenIteratorContext | Gets an IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | OpenSyncContext | Gets a SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Top
See Also

Reference

TraceLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Trace Namespace


TraceLoggingBackend.CreateRecordBuilder Method

TraceLoggingBackendCreateRecordBuilder Method

Creates a new LogRecordBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Trace
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override LogRecordBuilder CreateRecordBuilder()

Return Value

Type: LogRecordBuilder
A new LogRecordBuilder.
See Also

Reference

TraceLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Trace Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


TraceLoggingBackend.CreateTypeSource Method

TraceLoggingBackendCreateTypeSource Method

Creates LoggingTypeSource for the given role and type.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Trace
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override LoggingTypeSource CreateTypeSource(
    LoggingNamespaceSource parent,
    Type type
)

Parameters

parent
Type: PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
type
Type: SystemType

Return Value

Type: LoggingTypeSource
See Also

Reference

TraceLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Trace Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


TraceLoggingBackend.GetTextBackendOptions Method

TraceLoggingBackendGetTextBackendOptions Method

Gets the options.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Trace
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override TextLoggingBackendOptions GetTextBackendOptions()

Return Value

Type: TextLoggingBackendOptions
See Also

Reference

TraceLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.Trace Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


TraceLoggingBackendOptions Class

Initializes a new TraceLoggingBackendOptions.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingBackendOptions
PostSharp.Patterns.Diagnostics.BackendsTextLoggingBackendOptions
PostSharp.Patterns.Diagnostics.Backends.TraceTraceLoggingBackendOptions

Namespace: PostSharp.Patterns.Diagnostics.Backends.Trace
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class TraceLoggingBackendOptions : TextLoggingBackendOptions

The TraceLoggingBackendOptions type exposes the following members.

Constructors
 | Name | Description
Public method | TraceLoggingBackendOptions | Initializes a new TraceLoggingBackendOptions.
Top
Properties
 | Name | Description
Public property | ActionMaxLength | Max length of a log record. The default value is 2048. (Inherited from TextLoggingBackendOptions.)
Public property | AppendTrailingPeriod | Determines whether log messages should be ended with a trailing period. The default value is true because we really like trailing periods at PostSharp, but other opinions are valid. (Inherited from TextLoggingBackendOptions.)
Public property | ContextMaxLength | Max length of the Description property. (Inherited from LoggingBackendOptions.)
Public property | Delimiter | String used to separate different parts of the logging record. The default value is a pipe surrounded by spaces ( | ). (Inherited from TextLoggingBackendOptions.)
Public property | IncludeExceptionDetails | Determines whether exception details (basically Exception.ToString) should be appended to the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeNamespace | Determines whether the full namespace of types should be included in the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeType | Determines whether the name of the type of the logged method should be included in the log. The default value is true. (Inherited from TextLoggingBackendOptions.)
Public property | IndentSpaces | Number of spaces for each indentation level. The default value is 2. (Inherited from TextLoggingBackendOptions.)
Public property | LogLevelIgnoredForSystemRecords | Determines whether the Level property is ignored by the current back-end for auto-generated (i.e. non-manual) logging records. Some back-ends may not support overriding the level of records. (Inherited from LoggingBackendOptions.)
Public property | ShouldLogExceptionPredicate | Gets or sets a predicate that determines whether an exception should be logged. This predicate is evaluated only when the method entry is not logged. When the method entry is logged, exceptions are always logged. (Inherited from TextLoggingBackendOptions.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Trace Namespace


TraceLoggingBackendOptions Constructor

Initializes a new TraceLoggingBackendOptions.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Trace
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TraceLoggingBackendOptions()
See Also

Reference

TraceLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.Trace Namespace


TraceLoggingBackendOptions Properties

The TraceLoggingBackendOptions type exposes the following members.

Properties
 | Name | Description
Public property | ActionMaxLength | Max length of a log record. The default value is 2048. (Inherited from TextLoggingBackendOptions.)
Public property | AppendTrailingPeriod | Determines whether log messages should be ended with a trailing period. The default value is true because we really like trailing periods at PostSharp, but other opinions are valid. (Inherited from TextLoggingBackendOptions.)
Public property | ContextMaxLength | Max length of the Description property. (Inherited from LoggingBackendOptions.)
Public property | Delimiter | String used to separate different parts of the logging record. The default value is a pipe surrounded by spaces ( | ). (Inherited from TextLoggingBackendOptions.)
Public property | IncludeExceptionDetails | Determines whether exception details (basically Exception.ToString) should be appended to the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeNamespace | Determines whether the full namespace of types should be included in the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeType | Determines whether the name of the type of the logged method should be included in the log. The default value is true. (Inherited from TextLoggingBackendOptions.)
Public property | IndentSpaces | Number of spaces for each indentation level. The default value is 2. (Inherited from TextLoggingBackendOptions.)
Public property | LogLevelIgnoredForSystemRecords | Determines whether the Level property is ignored by the current back-end for auto-generated (i.e. non-manual) logging records. Some back-ends may not support overriding the level of records. (Inherited from LoggingBackendOptions.)
Public property | ShouldLogExceptionPredicate | Gets or sets a predicate that determines whether an exception should be logged. This predicate is evaluated only when the method entry is not logged. When the method entry is logged, exceptions are always logged. (Inherited from TextLoggingBackendOptions.)
Top
See Also

Reference

TraceLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.Trace Namespace


TraceLoggingTypeSource Class

The LoggingTypeSource for TraceLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
PostSharp.Patterns.DiagnosticsLoggingTypeSource
PostSharp.Patterns.Diagnostics.Backends.TraceTraceLoggingTypeSource

Namespace: PostSharp.Patterns.Diagnostics.Backends.Trace
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class TraceLoggingTypeSource : LoggingTypeSource

The TraceLoggingTypeSource type exposes the following members.

Constructors
 | Name | Description
Public method | TraceLoggingTypeSource | Initializes a new TraceLoggingTypeSource.
Top
Properties
 | Name | Description
Public property | Backend | Gets the parent LoggingBackend. (Inherited from LoggingNamespaceSource.)
Public property | DisplayFullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the DisplayFullName property does not include the arity, i.e. the full name of List<T> is System.Collections.Generic.List. (Inherited from LoggingNamespaceSource.)
Public property | DisplayName | Gets the last component of the name of the type or namespace, in the form that should be reported to the log. For generic types, the DisplayName property does not include the arity, i.e. the name of List<T> is List. (Inherited from LoggingNamespaceSource.)
Public property | FullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the FullName property includes the arity, i.e. the full name of List<T> is System.Collections.Generic.List`1. (Inherited from LoggingNamespaceSource.)
Public property | GenericParameterCount | Gets the number of generic parameters in SourceType. (Inherited from LoggingTypeSource.)
Public property | Level | Gets the minimal LogLevel for which logging is enabled for the current namespace or type. (Inherited from LoggingNamespaceSource.)
Public property | Name | Gets the last component of the name of the type or namespace. For instance, when FullName is PostSharp.Patterns.Diagnostics.LoggingBackend, Name is LoggingBackend. For generic types, the Name property includes the arity, i.e. the name of List<T> is List`1. (Inherited from LoggingNamespaceSource.)
Public property | Options | Gets the LoggingRoleConfiguration for the current role. This property is a shortcut to LoggingServices.Roles[this.Role]. (Inherited from LoggingTypeSource.)
Public property | Parent | Gets the parent LoggingNamespaceSource, or null if the current object represents the root namespace. (Inherited from LoggingNamespaceSource.)
Public property | Role | Gets the logging role for the current role. Typical values of this property are listed in the LoggingRoles class. (Inherited from LoggingNamespaceSource.)
Public property | SourceType | The type represented by the current LoggingTypeSource. (Inherited from LoggingTypeSource.)
Top
Methods
 | Name | Description
Protected method | IsBackendEnabled | Checks whether logging is enabled in the back-end for the given level. (Overrides LoggingTypeSourceIsBackendEnabled(LogLevel).)
Public method | IsEnabled | Determines whether logging is enabled for the given LogLevel. (Inherited from LoggingTypeSource.)
Public method | Refresh | Refreshes the logging level from the back-end from the current node and all children nodes. The back-end-defined logging level is cached for performance reasons. (Inherited from LoggingTypeSource.)
Public method | SetLevel | Sets the minimal LogLevel for which logging is enabled for the current namespace and type and all children namespaces and types. (Inherited from LoggingNamespaceSource.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Trace Namespace


TraceLoggingTypeSource Constructor

Initializes a new TraceLoggingTypeSource.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Trace
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TraceLoggingTypeSource(
    LoggingNamespaceSource parent,
    Type type
)

Parameters

parent
Type: PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
The parent LoggingNamespaceSource.
type
Type: SystemType
The Type being logged.
See Also

Reference

TraceLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.Trace Namespace


TraceLoggingTypeSource Properties

The TraceLoggingTypeSource type exposes the following members.

Properties
 | Name | Description
Public property | Backend | Gets the parent LoggingBackend. (Inherited from LoggingNamespaceSource.)
Public property | DisplayFullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the DisplayFullName property does not include the arity, i.e. the full name of List<T> is System.Collections.Generic.List. (Inherited from LoggingNamespaceSource.)
Public property | DisplayName | Gets the last component of the name of the type or namespace, in the form that should be reported to the log. For generic types, the DisplayName property does not include the arity, i.e. the name of List<T> is List. (Inherited from LoggingNamespaceSource.)
Public property | FullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the FullName property includes the arity, i.e. the full name of List<T> is System.Collections.Generic.List`1. (Inherited from LoggingNamespaceSource.)
Public property | GenericParameterCount | Gets the number of generic parameters in SourceType. (Inherited from LoggingTypeSource.)
Public property | Level | Gets the minimal LogLevel for which logging is enabled for the current namespace or type. (Inherited from LoggingNamespaceSource.)
Public property | Name | Gets the last component of the name of the type or namespace. For instance, when FullName is PostSharp.Patterns.Diagnostics.LoggingBackend, Name is LoggingBackend. For generic types, the Name property includes the arity, i.e. the name of List<T> is List`1. (Inherited from LoggingNamespaceSource.)
Public property | Options | Gets the LoggingRoleConfiguration for the current role. This property is a shortcut to LoggingServices.Roles[this.Role]. (Inherited from LoggingTypeSource.)
Public property | Parent | Gets the parent LoggingNamespaceSource, or null if the current object represents the root namespace. (Inherited from LoggingNamespaceSource.)
Public property | Role | Gets the logging role for the current role. Typical values of this property are listed in the LoggingRoles class. (Inherited from LoggingNamespaceSource.)
Public property | SourceType | The type represented by the current LoggingTypeSource. (Inherited from LoggingTypeSource.)
Top
See Also

Reference

TraceLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.Trace Namespace


TraceLoggingTypeSource Methods

The TraceLoggingTypeSource type exposes the following members.

Methods
 | Name | Description
Protected method | IsBackendEnabled | Checks whether logging is enabled in the back-end for the given level. (Overrides LoggingTypeSourceIsBackendEnabled(LogLevel).)
Public method | IsEnabled | Determines whether logging is enabled for the given LogLevel. (Inherited from LoggingTypeSource.)
Public method | Refresh | Refreshes the logging level from the back-end from the current node and all children nodes. The back-end-defined logging level is cached for performance reasons. (Inherited from LoggingTypeSource.)
Public method | SetLevel | Sets the minimal LogLevel for which logging is enabled for the current namespace and type and all children namespaces and types. (Inherited from LoggingNamespaceSource.)
Top
See Also

Reference

TraceLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.Trace Namespace


TraceLoggingTypeSource.IsBackendEnabled Method

TraceLoggingTypeSourceIsBackendEnabled Method

Checks whether logging is enabled in the back-end for the given level.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Trace
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override bool IsBackendEnabled(
    LogLevel level
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel

Return Value

Type: Boolean
Remarks

The result of this method is cached. To invalidate the cache, call the Refresh method.

See Also

Reference

TraceLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.Trace Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


TraceLogRecordBuilder Class

The LogRecordBuilder for TraceLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.RecordBuildersLogRecordBuilder
PostSharp.Patterns.Diagnostics.RecordBuildersTextLogRecordBuilder
PostSharp.Patterns.Diagnostics.Backends.TraceTraceLogRecordBuilder

Namespace: PostSharp.Patterns.Diagnostics.Backends.Trace
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class TraceLogRecordBuilder : TextLogRecordBuilder

The TraceLogRecordBuilder type exposes the following members.

Constructors
 | Name | Description
Public method | TraceLogRecordBuilder | Initializes a new TraceLogRecordBuilder.
Top
Properties
 | Name | Description
Public property | Backend | Gets the parent back-end. (Inherited from TextLogRecordBuilder.)
Public property | BackendOptions | Shortcut for this.Backend.Options. (Inherited from TextLogRecordBuilder.)
Protected property | Context | Gets the LoggingContext to which the record belongs. (Inherited from LogRecordBuilder.)
Public property | Exception | Gets the Exception for the current record, or null if no exception is associated to the current record. (Inherited from TextLogRecordBuilder.)
Public property | IsDisposed | (Inherited from LogRecordBuilder.)
Protected property | Level | Gets the LogLevel for the current record. (Inherited from TextLogRecordBuilder.)
Public property | MemberName | Gets the name of the method, property or field for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Options | Gets the LoggingOptions for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Profile | Gets the LoggingProfile for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | RecordKind | Gets the kind of the current record (e.g. MethodEntry or MethodException). (Inherited from LogRecordBuilder.)
Public property | SourceLineInfo | Gets the SourceLineInfo for the current record. (Inherited from TextLogRecordBuilder.)
Public property | SourceType | Gets the source Type of the current record. (Inherited from TextLogRecordBuilder.)
Protected property | StringBuilder | Gets the current UnsafeStringBuilder where everything is being appended. (Inherited from TextLogRecordBuilder.)
Protected property | ThreadContext | Gets the ThreadLoggingContext to which the current LogRecordBuilder belongs. (Inherited from LogRecordBuilder.)
Protected property | TypeSource | Gets the LoggingTypeSource for the current record. (Inherited from TextLogRecordBuilder.)
Top
Methods
 | Name | Description
Protected method | AppendAsyncInfo | Appends information about the async method to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendClosingParenthesisConditional | Appends a closing parenthesis to the current StringBuilder if required. (Inherited from TextLogRecordBuilder.)
Protected method | AppendComma | (Inherited from TextLogRecordBuilder.)
Protected method | AppendCommaConditional | Appends a comma to the current StringBuilder, unless this method is invoked for the first time for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription | Appends the context Description (or the TypeSource name, if the type of the context is not equal to the source type of the record) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription(LoggingContext) | (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiter | Appends a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiterConditional | Appends a Delimiter to the current StringBuilder if the RequireDelimiter method has been called previously. (Inherited from TextLogRecordBuilder.)
Protected method | AppendEpilogue | Appends the final part of log message to StringBuilder. This includes state machine number and execution time where relevant, but does not include exception details. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExceptionDetails | Appends exception details to StringBuilder if IncludeExceptionDetails is set. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTime | Appends the execution time to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTimeThreshold | Appends the execution time threshold to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendIndentString | Appends indentation for the given to StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendMemberName | Appends name of the member for the current record (including the declaring type name, subject to the IncludeType property) to the current StringBuilder, as well as an opening parenthesis. (Inherited from TextLogRecordBuilder.)
Protected method | AppendOpeningParenthesis | Appends an opening parenthesis to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendProlog | Appends the indent string, context description, and the record kind to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendRecordKind | Appends the LogRecordKind of the current record to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameter(SemanticParameterKind, String, String, String, Int32) | Appends a parameter of String type to the current StringBuilder. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSourceLineInfo | Appends source (file, line) information to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpaces | Appends a given number of spaces to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpecialChar | Appends a special Char (which may require escaping with specific back-ends) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTrailingPeriod | Appends a trailing period (.) to the current StringBuilder, respecting the AppendTrailingPeriod property. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTypeName | Appends the name of the TypeSource to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | BeginCustomRecord | Initializes the current LogRecordBuilder to emit a custom record. (Inherited from TextLogRecordBuilder.)
Public method | BeginRecord | Initializes the current LogRecordBuilder to emit a standard (i.e. non-custom) record for a given context and method. (Inherited from TextLogRecordBuilder.)
Public method | Complete | Emits the record and resets the current LogRecordBuilder. This method invoked after all SetThisT(T), SetParameterT(Int32, String, ParameterKind, String, T) and similar methods have been called. (Inherited from LogRecordBuilder.)
Public method | Dispose | (Inherited from LogRecordBuilder.)
Protected method | EmitRecord | Emits the record. Invoked by the Complete method. (Overrides TextLogRecordBuilderEmitRecord.)
Protected method | EmitRecord(Boolean) | Emits the record and specifies whether exception details should be appended to the text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescription | Ends building the context Description and starts building the action text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescriptionConditional | Switches between building the context Description and the action text. If the EndContextDescriptionConditional method has been previously invoked, subsequent calls are ignored. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescription | Obsolete. Gets the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescriptionUnsafe | Obsolete. Gets an UnsafeString representing the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextForDescription | Obsolete. Gets the LoggingContext that should be used when getting or appending the Description. (Inherited from TextLogRecordBuilder.)
Protected method | GetSourceName | Gets the name of the TypeSource for the current record, respecting the IncludeNamespace property. (Inherited from TextLogRecordBuilder.)
Protected method | HasRecordKindName | Determines whether the AppendRecordKind will append anything for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | MustBuildContextDescription | Determines whether the current Description should be appended to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | RequireComma | Makes the AppendCommaConditional to append a comma even if it's invoked for the first time. (Inherited from TextLogRecordBuilder.)
Protected method | RequireDelimiter | Causes the next call to the AppendDelimiterConditional to append a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | Reset | Resets all fields and properties of the current LogRecordBuilder to their initial value. Invoked by the Complete method. (Inherited from TextLogRecordBuilder.)
Public method | SetException | Sets the exception for the method or activity. (Inherited from TextLogRecordBuilder.)
Public method | SetExecutionTime | Sets the method or activity execution time. (Inherited from TextLogRecordBuilder.)
Public method | SetMethodGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T) | Sets the value of a given parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from TextLogRecordBuilder.)
Public method | SetRefStructParameter | (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T) | Sets a given return value (there can be several return values in C# 7.0) and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetThisT(T) | Sets the this (instance) value and uses the default formatter. This method is only invoked if the IncludeThisValue property is true. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetTypeGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Protected method | ShouldLogExceptionDetails | Determines whether exception details should be appended to the text of the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | ToString | Returns a string that represents the current object. (Inherited from TextLogRecordBuilder.)
Protected method | Write | Writes the final message to the back-end. (Overrides TextLogRecordBuilderWrite(UnsafeString).)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T) | Writes a custom parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | WriteCustomString | Write a chunk of custom string. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.Trace Namespace


TraceLogRecordBuilder Constructor

Initializes a new TraceLogRecordBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Trace
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TraceLogRecordBuilder(
    TraceLoggingBackend backend
)

Parameters

backend
Type: PostSharp.Patterns.Diagnostics.Backends.TraceTraceLoggingBackend
The parent TraceLoggingBackend.
See Also

Reference

TraceLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Trace Namespace


TraceLogRecordBuilder Properties

The TraceLogRecordBuilder type exposes the following members.

Properties
 | Name | Description
Public property | Backend | Gets the parent back-end. (Inherited from TextLogRecordBuilder.)
Public property | BackendOptions | Shortcut for this.Backend.Options. (Inherited from TextLogRecordBuilder.)
Protected property | Context | Gets the LoggingContext to which the record belongs. (Inherited from LogRecordBuilder.)
Public property | Exception | Gets the Exception for the current record, or null if no exception is associated to the current record. (Inherited from TextLogRecordBuilder.)
Public property | IsDisposed | (Inherited from LogRecordBuilder.)
Protected property | Level | Gets the LogLevel for the current record. (Inherited from TextLogRecordBuilder.)
Public property | MemberName | Gets the name of the method, property or field for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Options | Gets the LoggingOptions for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Profile | Gets the LoggingProfile for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | RecordKind | Gets the kind of the current record (e.g. MethodEntry or MethodException). (Inherited from LogRecordBuilder.)
Public property | SourceLineInfo | Gets the SourceLineInfo for the current record. (Inherited from TextLogRecordBuilder.)
Public property | SourceType | Gets the source Type of the current record. (Inherited from TextLogRecordBuilder.)
Protected property | StringBuilder | Gets the current UnsafeStringBuilder where everything is being appended. (Inherited from TextLogRecordBuilder.)
Protected property | ThreadContext | Gets the ThreadLoggingContext to which the current LogRecordBuilder belongs. (Inherited from LogRecordBuilder.)
Protected property | TypeSource | Gets the LoggingTypeSource for the current record. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

TraceLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Trace Namespace


TraceLogRecordBuilder Methods

The TraceLogRecordBuilder type exposes the following members.

Methods
 | Name | Description
Protected method | AppendAsyncInfo | Appends information about the async method to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendClosingParenthesisConditional | Appends a closing parenthesis to the current StringBuilder if required. (Inherited from TextLogRecordBuilder.)
Protected method | AppendComma | (Inherited from TextLogRecordBuilder.)
Protected method | AppendCommaConditional | Appends a comma to the current StringBuilder, unless this method is invoked for the first time for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription | Appends the context Description (or the TypeSource name, if the type of the context is not equal to the source type of the record) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription(LoggingContext) | (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiter | Appends a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiterConditional | Appends a Delimiter to the current StringBuilder if the RequireDelimiter method has been called previously. (Inherited from TextLogRecordBuilder.)
Protected method | AppendEpilogue | Appends the final part of log message to StringBuilder. This includes state machine number and execution time where relevant, but does not include exception details. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExceptionDetails | Appends exception details to StringBuilder if IncludeExceptionDetails is set. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTime | Appends the execution time to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTimeThreshold | Appends the execution time threshold to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendIndentString | Appends indentation for the given to StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendMemberName | Appends name of the member for the current record (including the declaring type name, subject to the IncludeType property) to the current StringBuilder, as well as an opening parenthesis. (Inherited from TextLogRecordBuilder.)
Protected method | AppendOpeningParenthesis | Appends an opening parenthesis to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendProlog | Appends the indent string, context description, and the record kind to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendRecordKind | Appends the LogRecordKind of the current record to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameter(SemanticParameterKind, String, String, String, Int32) | Appends a parameter of String type to the current StringBuilder. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSourceLineInfo | Appends source (file, line) information to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpaces | Appends a given number of spaces to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpecialChar | Appends a special Char (which may require escaping with specific back-ends) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTrailingPeriod | Appends a trailing period (.) to the current StringBuilder, respecting the AppendTrailingPeriod property. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTypeName | Appends the name of the TypeSource to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | BeginCustomRecord | Initializes the current LogRecordBuilder to emit a custom record. (Inherited from TextLogRecordBuilder.)
Public method | BeginRecord | Initializes the current LogRecordBuilder to emit a standard (i.e. non-custom) record for a given context and method. (Inherited from TextLogRecordBuilder.)
Public method | Complete | Emits the record and resets the current LogRecordBuilder. This method invoked after all SetThisT(T), SetParameterT(Int32, String, ParameterKind, String, T) and similar methods have been called. (Inherited from LogRecordBuilder.)
Public method | Dispose | (Inherited from LogRecordBuilder.)
Protected method | EmitRecord | Emits the record. Invoked by the Complete method. (Overrides TextLogRecordBuilderEmitRecord.)
Protected method | EmitRecord(Boolean) | Emits the record and specifies whether exception details should be appended to the text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescription | Ends building the context Description and starts building the action text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescriptionConditional | Switches between building the context Description and the action text. If the EndContextDescriptionConditional method has been previously invoked, subsequent calls are ignored. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescription | Obsolete. Gets the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescriptionUnsafe | Obsolete. Gets an UnsafeString representing the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextForDescription | Obsolete. Gets the LoggingContext that should be used when getting or appending the Description. (Inherited from TextLogRecordBuilder.)
Protected method | GetSourceName | Gets the name of the TypeSource for the current record, respecting the IncludeNamespace property. (Inherited from TextLogRecordBuilder.)
Protected method | HasRecordKindName | Determines whether the AppendRecordKind will append anything for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | MustBuildContextDescription | Determines whether the current Description should be appended to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | RequireComma | Makes the AppendCommaConditional to append a comma even if it's invoked for the first time. (Inherited from TextLogRecordBuilder.)
Protected method | RequireDelimiter | Causes the next call to the AppendDelimiterConditional to append a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | Reset | Resets all fields and properties of the current LogRecordBuilder to their initial value. Invoked by the Complete method. (Inherited from TextLogRecordBuilder.)
Public method | SetException | Sets the exception for the method or activity. (Inherited from TextLogRecordBuilder.)
Public method | SetExecutionTime | Sets the method or activity execution time. (Inherited from TextLogRecordBuilder.)
Public method | SetMethodGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T) | Sets the value of a given parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from TextLogRecordBuilder.)
Public method | SetRefStructParameter | (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T) | Sets a given return value (there can be several return values in C# 7.0) and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetThisT(T) | Sets the this (instance) value and uses the default formatter. This method is only invoked if the IncludeThisValue property is true. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetTypeGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Protected method | ShouldLogExceptionDetails | Determines whether exception details should be appended to the text of the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | ToString | Returns a string that represents the current object. (Inherited from TextLogRecordBuilder.)
Protected method | Write | Writes the final message to the back-end. (Overrides TextLogRecordBuilderWrite(UnsafeString).)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T) | Writes a custom parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | WriteCustomString | Write a chunk of custom string. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

TraceLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Trace Namespace


TraceLogRecordBuilder.EmitRecord Method

TraceLogRecordBuilderEmitRecord Method

Overload List
 | Name | Description
Protected method | EmitRecord | Emits the record. Invoked by the Complete method. (Overrides TextLogRecordBuilderEmitRecord.)
Protected method | EmitRecord(Boolean) | Emits the record and specifies whether exception details should be appended to the text. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

TraceLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Trace Namespace


TraceLogRecordBuilder.EmitRecord Method

TraceLogRecordBuilderEmitRecord Method

Emits the record. Invoked by the Complete method.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Trace
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void EmitRecord()
See Also

Reference

TraceLogRecordBuilder Class
EmitRecord Overload
PostSharp.Patterns.Diagnostics.Backends.Trace Namespace


TraceLogRecordBuilder.Write Method

TraceLogRecordBuilderWrite Method

Writes the final message to the back-end.

Namespace: PostSharp.Patterns.Diagnostics.Backends.Trace
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void Write(
    UnsafeString message
)

Parameters

message
Type: PostSharp.Patterns.FormattersUnsafeString
The final message.
See Also

Reference

TraceLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.Trace Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


PostSharp.Patterns.Diagnostics.Backends.TraceSource Namespace

Classes
 | Class | Description
Public class | TraceSourceLoggingBackend | Logging back-end that logs using PostSharp.Patterns.Diagnostics.Backends.TraceSource.
Public class | TraceSourceLoggingBackendOptions | Options for TraceSourceLoggingBackend.
Public class | TraceSourceLoggingTypeSource | The LoggingTypeSource for TraceSourceLoggingBackend.
Public class | TraceSourceLogRecordBuilder | LogRecordBuilder for TraceSourceLoggingBackend.


TraceSourceLoggingBackend Class

Logging back-end that logs using PostSharp.Patterns.Diagnostics.Backends.TraceSource.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingBackend
PostSharp.Patterns.Diagnostics.BackendsTextLoggingBackend
PostSharp.Patterns.Diagnostics.Backends.TraceSourceTraceSourceLoggingBackend

Namespace: PostSharp.Patterns.Diagnostics.Backends.TraceSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class TraceSourceLoggingBackend : TextLoggingBackend

The TraceSourceLoggingBackend type exposes the following members.

Constructors
 | Name | Description
Public method | TraceSourceLoggingBackend | Initializes a new TraceSourceLoggingBackend.
Top
Properties
 | Name | Description
Public property | CurrentContext | Gets the current LoggingContext. (Inherited from LoggingBackend.)
Public property | IsCorrupted | (Inherited from LoggingBackend.)
Public property | IsDisposed | Determines whether the current LoggingBackend has been disposed. (Inherited from LoggingBackend.)
Public property | IsEnabled | Determines whether the current LoggingBackend is currently enabled. This property has precedence over, and does not affect, the minimal log levels set through the SetLevel(LogLevel) method. (Inherited from LoggingBackend.)
Public property | Options | Gets the back-end options.
Top
Methods
 | Name | Description
Protected method | CreateAsyncCustomActivityContext | Creates a new AsyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateAsyncMethodContext | Creates a new AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Protected method | CreateEphemeralContext | Creates a new EphemeralLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateIteratorContext | Creates a new IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | CreateRecordBuilder | Creates a new LogRecordBuilder. (Overrides LoggingBackendCreateRecordBuilder.)
Protected method | CreateSyncCustomActivityContext | Creates a new SyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateSyncMethodContext | Creates a new SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Protected method | CreateThreadContext | Creates a new ThreadLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateTypeSource | Creates LoggingTypeSource for the given role and type. (Overrides LoggingBackendCreateTypeSource(LoggingNamespaceSource, Type).)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingBackend.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from TextLoggingBackend.)
Public method | GetAsyncContextOfTask | Gets the AsyncMethodLoggingContext associated with a Task. (Inherited from LoggingBackend.)
Protected method | GetBackendOptions | Gets the formatting and rendering options for the current LoggingBackend. (Inherited from TextLoggingBackend.)
Public method | GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace. (Inherited from LoggingBackend.)
Public method | GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type. (Inherited from LoggingBackend.)
Protected method | GetTextBackendOptions | Gets the options. (Overrides TextLoggingBackendGetTextBackendOptions.)
Public method | GetThreadContext | Returns the ThreadLoggingContext for the current Thread. (Inherited from LoggingBackend.)
 | GetTraceSource | Gets a TraceSource of a given name.
Public method | OpenAsyncContext | Gets an AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Public method | OpenCustomActivityContext | Gets a LoggingContext for a custom activity (opened using OpenActivity(String) or OpenAsyncActivity(String)). (Inherited from LoggingBackend.)
Public method | OpenEphemeralContext | Gets an EphemeralLoggingContext for use in a given method. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record. (Inherited from LoggingBackend.)
Public method | OpenIteratorContext | Gets an IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | OpenSyncContext | Gets a SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.TraceSource Namespace

Other Resources

Conceptual: Adding Detailed Logging to your Solution


TraceSourceLoggingBackend Constructor

Initializes a new TraceSourceLoggingBackend.

Namespace: PostSharp.Patterns.Diagnostics.Backends.TraceSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TraceSourceLoggingBackend()
See Also

Reference

TraceSourceLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.TraceSource Namespace


TraceSourceLoggingBackend Properties

The TraceSourceLoggingBackend type exposes the following members.

Properties
 | Name | Description
Public property | CurrentContext | Gets the current LoggingContext. (Inherited from LoggingBackend.)
Public property | IsCorrupted | (Inherited from LoggingBackend.)
Public property | IsDisposed | Determines whether the current LoggingBackend has been disposed. (Inherited from LoggingBackend.)
Public property | IsEnabled | Determines whether the current LoggingBackend is currently enabled. This property has precedence over, and does not affect, the minimal log levels set through the SetLevel(LogLevel) method. (Inherited from LoggingBackend.)
Public property | Options | Gets the back-end options.
Top
See Also

Reference

TraceSourceLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.TraceSource Namespace


TraceSourceLoggingBackend.Options Property

TraceSourceLoggingBackendOptions Property

Gets the back-end options.

Namespace: PostSharp.Patterns.Diagnostics.Backends.TraceSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TraceSourceLoggingBackendOptions Options { get; }

Property Value

Type: TraceSourceLoggingBackendOptions
See Also

Reference

TraceSourceLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.TraceSource Namespace


TraceSourceLoggingBackend Methods

The TraceSourceLoggingBackend type exposes the following members.

Methods
 | Name | Description
Protected method | CreateAsyncCustomActivityContext | Creates a new AsyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateAsyncMethodContext | Creates a new AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Protected method | CreateEphemeralContext | Creates a new EphemeralLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateIteratorContext | Creates a new IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | CreateRecordBuilder | Creates a new LogRecordBuilder. (Overrides LoggingBackendCreateRecordBuilder.)
Protected method | CreateSyncCustomActivityContext | Creates a new SyncCustomActivityLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateSyncMethodContext | Creates a new SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Protected method | CreateThreadContext | Creates a new ThreadLoggingContext. (Inherited from LoggingBackend.)
Protected method | CreateTypeSource | Creates LoggingTypeSource for the given role and type. (Overrides LoggingBackendCreateTypeSource(LoggingNamespaceSource, Type).)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingBackend.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from TextLoggingBackend.)
Public method | GetAsyncContextOfTask | Gets the AsyncMethodLoggingContext associated with a Task. (Inherited from LoggingBackend.)
Protected method | GetBackendOptions | Gets the formatting and rendering options for the current LoggingBackend. (Inherited from TextLoggingBackend.)
Public method | GetSource(String, String) | Returns a LoggingNamespaceSource for the given role and, optionally, namespace. (Inherited from LoggingBackend.)
Public method | GetSource(String, Type) | Returns a LoggingTypeSource for the given role and type. (Inherited from LoggingBackend.)
Protected method | GetTextBackendOptions | Gets the options. (Overrides TextLoggingBackendGetTextBackendOptions.)
Public method | GetThreadContext | Returns the ThreadLoggingContext for the current Thread. (Inherited from LoggingBackend.)
 | GetTraceSource | Gets a TraceSource of a given name.
Public method | OpenAsyncContext | Gets an AsyncMethodLoggingContext for a given async method. (Inherited from LoggingBackend.)
Public method | OpenCustomActivityContext | Gets a LoggingContext for a custom activity (opened using OpenActivity(String) or OpenAsyncActivity(String)). (Inherited from LoggingBackend.)
Public method | OpenEphemeralContext | Gets an EphemeralLoggingContext for use in a given method. An EphemeralLoggingContext is a degenerated kind of context, used to emit a single record. (Inherited from LoggingBackend.)
Public method | OpenIteratorContext | Gets an IteratorLoggingContext for a given iterator method. (Inherited from LoggingBackend.)
Public method | OpenSyncContext | Gets a SyncMethodLoggingContext for a given normal (non-async, non-iterator) method. (Inherited from LoggingBackend.)
Top
See Also

Reference

TraceSourceLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.TraceSource Namespace


TraceSourceLoggingBackend.CreateRecordBuilder Method

TraceSourceLoggingBackendCreateRecordBuilder Method

Creates a new LogRecordBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Backends.TraceSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override LogRecordBuilder CreateRecordBuilder()

Return Value

Type: LogRecordBuilder
A new LogRecordBuilder.
See Also

Reference

TraceSourceLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.TraceSource Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


TraceSourceLoggingBackend.CreateTypeSource Method

TraceSourceLoggingBackendCreateTypeSource Method

Creates LoggingTypeSource for the given role and type.

Namespace: PostSharp.Patterns.Diagnostics.Backends.TraceSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override LoggingTypeSource CreateTypeSource(
    LoggingNamespaceSource parent,
    Type type
)

Parameters

parent
Type: PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
type
Type: SystemType

Return Value

Type: LoggingTypeSource
See Also

Reference

TraceSourceLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.TraceSource Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


TraceSourceLoggingBackend.GetTextBackendOptions Method

TraceSourceLoggingBackendGetTextBackendOptions Method

Gets the options.

Namespace: PostSharp.Patterns.Diagnostics.Backends.TraceSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override TextLoggingBackendOptions GetTextBackendOptions()

Return Value

Type: TextLoggingBackendOptions
See Also

Reference

TraceSourceLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.TraceSource Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


TraceSourceLoggingBackend.GetTraceSource Method

TraceSourceLoggingBackendGetTraceSource Method

Gets a TraceSource of a given name.

Namespace: PostSharp.Patterns.Diagnostics.Backends.TraceSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static TraceSource GetTraceSource(
    string name
)

Parameters

name
Type: SystemString
The name of the TraceSource.

Return Value

Type: TraceSource
A TraceSource named name. Two calls of this methods are guaranteed to return the same instance, unless the previous instance has been garbage collected in the meantime.
See Also

Reference

TraceSourceLoggingBackend Class
PostSharp.Patterns.Diagnostics.Backends.TraceSource Namespace


TraceSourceLoggingBackendOptions Class

Options for TraceSourceLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingBackendOptions
PostSharp.Patterns.Diagnostics.BackendsTextLoggingBackendOptions
PostSharp.Patterns.Diagnostics.Backends.TraceSourceTraceSourceLoggingBackendOptions

Namespace: PostSharp.Patterns.Diagnostics.Backends.TraceSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class TraceSourceLoggingBackendOptions : TextLoggingBackendOptions

The TraceSourceLoggingBackendOptions type exposes the following members.

Constructors
 | Name | Description
Public method | TraceSourceLoggingBackendOptions | Initializes a new instance of the TraceSourceLoggingBackendOptions class
Top
Properties
 | Name | Description
Public property | ActionMaxLength | Max length of a log record. The default value is 2048. (Inherited from TextLoggingBackendOptions.)
Public property | AppendTrailingPeriod | Determines whether log messages should be ended with a trailing period. The default value is true because we really like trailing periods at PostSharp, but other opinions are valid. (Inherited from TextLoggingBackendOptions.)
Public property | ContextMaxLength | Max length of the Description property. (Inherited from LoggingBackendOptions.)
Public property | Delimiter | String used to separate different parts of the logging record. The default value is a pipe surrounded by spaces ( | ). (Inherited from TextLoggingBackendOptions.)
Public property | GetTraceSourceName | Function mapping an TraceSourceLoggingBackendOptions to the name of a TraceSource. The default behavior is to return typeSource.Role.
Public property | IncludeExceptionDetails | Determines whether exception details (basically Exception.ToString) should be appended to the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeNamespace | Determines whether the full namespace of types should be included in the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeType | Determines whether the name of the type of the logged method should be included in the log. The default value is true. (Inherited from TextLoggingBackendOptions.)
Public property | IndentSpaces | Number of spaces for each indentation level. The default value is 2. (Inherited from TextLoggingBackendOptions.)
Public property | LogLevelIgnoredForSystemRecords | Determines whether the Level property is ignored by the current back-end for auto-generated (i.e. non-manual) logging records. Some back-ends may not support overriding the level of records. (Inherited from LoggingBackendOptions.)
Public property | ShouldLogExceptionPredicate | Gets or sets a predicate that determines whether an exception should be logged. This predicate is evaluated only when the method entry is not logged. When the method entry is logged, exceptions are always logged. (Inherited from TextLoggingBackendOptions.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.TraceSource Namespace


TraceSourceLoggingBackendOptions Constructor

Initializes a new instance of the TraceSourceLoggingBackendOptions class

Namespace: PostSharp.Patterns.Diagnostics.Backends.TraceSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TraceSourceLoggingBackendOptions()
See Also

Reference

TraceSourceLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.TraceSource Namespace


TraceSourceLoggingBackendOptions Properties

The TraceSourceLoggingBackendOptions type exposes the following members.

Properties
 | Name | Description
Public property | ActionMaxLength | Max length of a log record. The default value is 2048. (Inherited from TextLoggingBackendOptions.)
Public property | AppendTrailingPeriod | Determines whether log messages should be ended with a trailing period. The default value is true because we really like trailing periods at PostSharp, but other opinions are valid. (Inherited from TextLoggingBackendOptions.)
Public property | ContextMaxLength | Max length of the Description property. (Inherited from LoggingBackendOptions.)
Public property | Delimiter | String used to separate different parts of the logging record. The default value is a pipe surrounded by spaces ( | ). (Inherited from TextLoggingBackendOptions.)
Public property | GetTraceSourceName | Function mapping an TraceSourceLoggingBackendOptions to the name of a TraceSource. The default behavior is to return typeSource.Role.
Public property | IncludeExceptionDetails | Determines whether exception details (basically Exception.ToString) should be appended to the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeNamespace | Determines whether the full namespace of types should be included in the log. The default value is false. (Inherited from TextLoggingBackendOptions.)
Public property | IncludeType | Determines whether the name of the type of the logged method should be included in the log. The default value is true. (Inherited from TextLoggingBackendOptions.)
Public property | IndentSpaces | Number of spaces for each indentation level. The default value is 2. (Inherited from TextLoggingBackendOptions.)
Public property | LogLevelIgnoredForSystemRecords | Determines whether the Level property is ignored by the current back-end for auto-generated (i.e. non-manual) logging records. Some back-ends may not support overriding the level of records. (Inherited from LoggingBackendOptions.)
Public property | ShouldLogExceptionPredicate | Gets or sets a predicate that determines whether an exception should be logged. This predicate is evaluated only when the method entry is not logged. When the method entry is logged, exceptions are always logged. (Inherited from TextLoggingBackendOptions.)
Top
See Also

Reference

TraceSourceLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.TraceSource Namespace


TraceSourceLoggingBackendOptions.GetTraceSourceName Property

TraceSourceLoggingBackendOptionsGetTraceSourceName Property

Function mapping an TraceSourceLoggingBackendOptions to the name of a TraceSource. The default behavior is to return typeSource.Role.

Namespace: PostSharp.Patterns.Diagnostics.Backends.TraceSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Func<TraceSourceLoggingTypeSource, string> GetTraceSourceName { get; set; }

Property Value

Type: Func TraceSourceLoggingTypeSource, String
See Also

Reference

TraceSourceLoggingBackendOptions Class
PostSharp.Patterns.Diagnostics.Backends.TraceSource Namespace


TraceSourceLoggingTypeSource Class

The LoggingTypeSource for TraceSourceLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
PostSharp.Patterns.DiagnosticsLoggingTypeSource
PostSharp.Patterns.Diagnostics.Backends.TraceSourceTraceSourceLoggingTypeSource

Namespace: PostSharp.Patterns.Diagnostics.Backends.TraceSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class TraceSourceLoggingTypeSource : LoggingTypeSource

The TraceSourceLoggingTypeSource type exposes the following members.

Constructors
 | Name | Description
Public method | TraceSourceLoggingTypeSource | Initializes a new TraceSourceLoggingTypeSource.
Top
Properties
 | Name | Description
Public property | Backend | Gets the parent LoggingBackend. (Inherited from LoggingNamespaceSource.)
Public property | DisplayFullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the DisplayFullName property does not include the arity, i.e. the full name of List<T> is System.Collections.Generic.List. (Inherited from LoggingNamespaceSource.)
Public property | DisplayName | Gets the last component of the name of the type or namespace, in the form that should be reported to the log. For generic types, the DisplayName property does not include the arity, i.e. the name of List<T> is List. (Inherited from LoggingNamespaceSource.)
Public property | FullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the FullName property includes the arity, i.e. the full name of List<T> is System.Collections.Generic.List`1. (Inherited from LoggingNamespaceSource.)
Public property | GenericParameterCount | Gets the number of generic parameters in SourceType. (Inherited from LoggingTypeSource.)
Public property | Level | Gets the minimal LogLevel for which logging is enabled for the current namespace or type. (Inherited from LoggingNamespaceSource.)
Public property | Name | Gets the last component of the name of the type or namespace. For instance, when FullName is PostSharp.Patterns.Diagnostics.LoggingBackend, Name is LoggingBackend. For generic types, the Name property includes the arity, i.e. the name of List<T> is List`1. (Inherited from LoggingNamespaceSource.)
Public property | Options | Gets the LoggingRoleConfiguration for the current role. This property is a shortcut to LoggingServices.Roles[this.Role]. (Inherited from LoggingTypeSource.)
Public property | Parent | Gets the parent LoggingNamespaceSource, or null if the current object represents the root namespace. (Inherited from LoggingNamespaceSource.)
Public property | Role | Gets the logging role for the current role. Typical values of this property are listed in the LoggingRoles class. (Inherited from LoggingNamespaceSource.)
Public property | SourceType | The type represented by the current LoggingTypeSource. (Inherited from LoggingTypeSource.)
Top
Methods
 | Name | Description
Protected method | IsBackendEnabled | Checks whether logging is enabled in the back-end for the given level. (Overrides LoggingTypeSourceIsBackendEnabled(LogLevel).)
Public method | IsEnabled | Determines whether logging is enabled for the given LogLevel. (Inherited from LoggingTypeSource.)
Public method | Refresh | Refreshes the logging level from the back-end from the current node and all children nodes. The back-end-defined logging level is cached for performance reasons. (Inherited from LoggingTypeSource.)
Public method | SetLevel | Sets the minimal LogLevel for which logging is enabled for the current namespace and type and all children namespaces and types. (Inherited from LoggingNamespaceSource.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.TraceSource Namespace


TraceSourceLoggingTypeSource Constructor

Initializes a new TraceSourceLoggingTypeSource.

Namespace: PostSharp.Patterns.Diagnostics.Backends.TraceSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TraceSourceLoggingTypeSource(
    LoggingNamespaceSource parent,
    Type type
)

Parameters

parent
Type: PostSharp.Patterns.DiagnosticsLoggingNamespaceSource
The parent LoggingNamespaceSource.
type
Type: SystemType
The Type being logged.
See Also

Reference

TraceSourceLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.TraceSource Namespace


TraceSourceLoggingTypeSource Properties

The TraceSourceLoggingTypeSource type exposes the following members.

Properties
 | Name | Description
Public property | Backend | Gets the parent LoggingBackend. (Inherited from LoggingNamespaceSource.)
Public property | DisplayFullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the DisplayFullName property does not include the arity, i.e. the full name of List<T> is System.Collections.Generic.List. (Inherited from LoggingNamespaceSource.)
Public property | DisplayName | Gets the last component of the name of the type or namespace, in the form that should be reported to the log. For generic types, the DisplayName property does not include the arity, i.e. the name of List<T> is List. (Inherited from LoggingNamespaceSource.)
Public property | FullName | Gets the full name of the current type or namespace (including the parent namespace). For generic types, the FullName property includes the arity, i.e. the full name of List<T> is System.Collections.Generic.List`1. (Inherited from LoggingNamespaceSource.)
Public property | GenericParameterCount | Gets the number of generic parameters in SourceType. (Inherited from LoggingTypeSource.)
Public property | Level | Gets the minimal LogLevel for which logging is enabled for the current namespace or type. (Inherited from LoggingNamespaceSource.)
Public property | Name | Gets the last component of the name of the type or namespace. For instance, when FullName is PostSharp.Patterns.Diagnostics.LoggingBackend, Name is LoggingBackend. For generic types, the Name property includes the arity, i.e. the name of List<T> is List`1. (Inherited from LoggingNamespaceSource.)
Public property | Options | Gets the LoggingRoleConfiguration for the current role. This property is a shortcut to LoggingServices.Roles[this.Role]. (Inherited from LoggingTypeSource.)
Public property | Parent | Gets the parent LoggingNamespaceSource, or null if the current object represents the root namespace. (Inherited from LoggingNamespaceSource.)
Public property | Role | Gets the logging role for the current role. Typical values of this property are listed in the LoggingRoles class. (Inherited from LoggingNamespaceSource.)
Public property | SourceType | The type represented by the current LoggingTypeSource. (Inherited from LoggingTypeSource.)
Top
See Also

Reference

TraceSourceLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.TraceSource Namespace


TraceSourceLoggingTypeSource Methods

The TraceSourceLoggingTypeSource type exposes the following members.

Methods
 | Name | Description
Protected method | IsBackendEnabled | Checks whether logging is enabled in the back-end for the given level. (Overrides LoggingTypeSourceIsBackendEnabled(LogLevel).)
Public method | IsEnabled | Determines whether logging is enabled for the given LogLevel. (Inherited from LoggingTypeSource.)
Public method | Refresh | Refreshes the logging level from the back-end from the current node and all children nodes. The back-end-defined logging level is cached for performance reasons. (Inherited from LoggingTypeSource.)
Public method | SetLevel | Sets the minimal LogLevel for which logging is enabled for the current namespace and type and all children namespaces and types. (Inherited from LoggingNamespaceSource.)
Top
See Also

Reference

TraceSourceLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.TraceSource Namespace


TraceSourceLoggingTypeSource.IsBackendEnabled Method

TraceSourceLoggingTypeSourceIsBackendEnabled Method

Checks whether logging is enabled in the back-end for the given level.

Namespace: PostSharp.Patterns.Diagnostics.Backends.TraceSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override bool IsBackendEnabled(
    LogLevel level
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel

Return Value

Type: Boolean
Remarks

The result of this method is cached. To invalidate the cache, call the Refresh method.

See Also

Reference

TraceSourceLoggingTypeSource Class
PostSharp.Patterns.Diagnostics.Backends.TraceSource Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


TraceSourceLogRecordBuilder Class

LogRecordBuilder for TraceSourceLoggingBackend.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.RecordBuildersLogRecordBuilder
PostSharp.Patterns.Diagnostics.RecordBuildersTextLogRecordBuilder
PostSharp.Patterns.Diagnostics.Backends.TraceSourceTraceSourceLogRecordBuilder

Namespace: PostSharp.Patterns.Diagnostics.Backends.TraceSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class TraceSourceLogRecordBuilder : TextLogRecordBuilder

The TraceSourceLogRecordBuilder type exposes the following members.

Constructors
 | Name | Description
Public method | TraceSourceLogRecordBuilder | Initializes a new TraceSourceLogRecordBuilder.
Top
Properties
 | Name | Description
Public property | Backend | Gets the parent back-end. (Inherited from TextLogRecordBuilder.)
Public property | BackendOptions | Shortcut for this.Backend.Options. (Inherited from TextLogRecordBuilder.)
Protected property | Context | Gets the LoggingContext to which the record belongs. (Inherited from LogRecordBuilder.)
Public property | Exception | Gets the Exception for the current record, or null if no exception is associated to the current record. (Inherited from TextLogRecordBuilder.)
Public property | IsDisposed | (Inherited from LogRecordBuilder.)
Protected property | Level | Gets the LogLevel for the current record. (Inherited from TextLogRecordBuilder.)
Public property | MemberName | Gets the name of the method, property or field for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Options | Gets the LoggingOptions for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Profile | Gets the LoggingProfile for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | RecordKind | Gets the kind of the current record (e.g. MethodEntry or MethodException). (Inherited from LogRecordBuilder.)
Public property | SourceLineInfo | Gets the SourceLineInfo for the current record. (Inherited from TextLogRecordBuilder.)
Public property | SourceType | Gets the source Type of the current record. (Inherited from TextLogRecordBuilder.)
Protected property | StringBuilder | Gets the current UnsafeStringBuilder where everything is being appended. (Inherited from TextLogRecordBuilder.)
Protected property | ThreadContext | Gets the ThreadLoggingContext to which the current LogRecordBuilder belongs. (Inherited from LogRecordBuilder.)
Protected property | TypeSource | Gets the LoggingTypeSource for the current record. (Inherited from TextLogRecordBuilder.)
Top
Methods
 | Name | Description
Protected method | AppendAsyncInfo | Appends information about the async method to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendClosingParenthesisConditional | Appends a closing parenthesis to the current StringBuilder if required. (Inherited from TextLogRecordBuilder.)
Protected method | AppendComma | (Inherited from TextLogRecordBuilder.)
Protected method | AppendCommaConditional | Appends a comma to the current StringBuilder, unless this method is invoked for the first time for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription | Appends the context Description (or the TypeSource name, if the type of the context is not equal to the source type of the record) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription(LoggingContext) | (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiter | Appends a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiterConditional | Appends a Delimiter to the current StringBuilder if the RequireDelimiter method has been called previously. (Inherited from TextLogRecordBuilder.)
Protected method | AppendEpilogue | Appends the final part of log message to StringBuilder. This includes state machine number and execution time where relevant, but does not include exception details. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExceptionDetails | Appends exception details to StringBuilder if IncludeExceptionDetails is set. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTime | Appends the execution time to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTimeThreshold | Appends the execution time threshold to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendIndentString | Appends indentation for the given to StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendMemberName | Appends name of the member for the current record (including the declaring type name, subject to the IncludeType property) to the current StringBuilder, as well as an opening parenthesis. (Inherited from TextLogRecordBuilder.)
Protected method | AppendOpeningParenthesis | Appends an opening parenthesis to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendProlog | Appends the indent string, context description, and the record kind to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendRecordKind | Appends the LogRecordKind of the current record to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameter(SemanticParameterKind, String, String, String, Int32) | Appends a parameter of String type to the current StringBuilder. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSourceLineInfo | Appends source (file, line) information to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpaces | Appends a given number of spaces to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpecialChar | Appends a special Char (which may require escaping with specific back-ends) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTrailingPeriod | Appends a trailing period (.) to the current StringBuilder, respecting the AppendTrailingPeriod property. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTypeName | Appends the name of the TypeSource to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | BeginCustomRecord | Initializes the current LogRecordBuilder to emit a custom record. (Inherited from TextLogRecordBuilder.)
Public method | BeginRecord | Initializes the current LogRecordBuilder to emit a standard (i.e. non-custom) record for a given context and method. (Inherited from TextLogRecordBuilder.)
Public method | Complete | Emits the record and resets the current LogRecordBuilder. This method invoked after all SetThisT(T), SetParameterT(Int32, String, ParameterKind, String, T) and similar methods have been called. (Inherited from LogRecordBuilder.)
Public method | Dispose | (Inherited from LogRecordBuilder.)
Protected method | EmitRecord | Emits the record. Invoked by the Complete method. (Overrides TextLogRecordBuilderEmitRecord.)
Protected method | EmitRecord(Boolean) | Emits the record and specifies whether exception details should be appended to the text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescription | Ends building the context Description and starts building the action text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescriptionConditional | Switches between building the context Description and the action text. If the EndContextDescriptionConditional method has been previously invoked, subsequent calls are ignored. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescription | Obsolete. Gets the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescriptionUnsafe | Obsolete. Gets an UnsafeString representing the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextForDescription | Obsolete. Gets the LoggingContext that should be used when getting or appending the Description. (Inherited from TextLogRecordBuilder.)
Protected method | GetSourceName | Gets the name of the TypeSource for the current record, respecting the IncludeNamespace property. (Inherited from TextLogRecordBuilder.)
Protected method | HasRecordKindName | Determines whether the AppendRecordKind will append anything for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | MustBuildContextDescription | Determines whether the current Description should be appended to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | RequireComma | Makes the AppendCommaConditional to append a comma even if it's invoked for the first time. (Inherited from TextLogRecordBuilder.)
Protected method | RequireDelimiter | Causes the next call to the AppendDelimiterConditional to append a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | Reset | Resets all fields and properties of the current LogRecordBuilder to their initial value. Invoked by the Complete method. (Inherited from TextLogRecordBuilder.)
Public method | SetException | Sets the exception for the method or activity. (Inherited from TextLogRecordBuilder.)
Public method | SetExecutionTime | Sets the method or activity execution time. (Inherited from TextLogRecordBuilder.)
Public method | SetMethodGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T) | Sets the value of a given parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from TextLogRecordBuilder.)
Public method | SetRefStructParameter | (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T) | Sets a given return value (there can be several return values in C# 7.0) and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetThisT(T) | Sets the this (instance) value and uses the default formatter. This method is only invoked if the IncludeThisValue property is true. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetTypeGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Protected method | ShouldLogExceptionDetails | Determines whether exception details should be appended to the text of the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | ToString | Returns a string that represents the current object. (Inherited from TextLogRecordBuilder.)
Protected method | Write | Writes the final message to the back-end. (Overrides TextLogRecordBuilderWrite(UnsafeString).)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T) | Writes a custom parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | WriteCustomString | Write a chunk of custom string. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Backends.TraceSource Namespace


TraceSourceLogRecordBuilder Constructor

Initializes a new TraceSourceLogRecordBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Backends.TraceSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TraceSourceLogRecordBuilder(
    TraceSourceLoggingBackend backend
)

Parameters

backend
Type: PostSharp.Patterns.Diagnostics.Backends.TraceSourceTraceSourceLoggingBackend
The parent TraceSourceLoggingBackend.
See Also

Reference

TraceSourceLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.TraceSource Namespace


TraceSourceLogRecordBuilder Properties

The TraceSourceLogRecordBuilder type exposes the following members.

Properties
 | Name | Description
Public property | Backend | Gets the parent back-end. (Inherited from TextLogRecordBuilder.)
Public property | BackendOptions | Shortcut for this.Backend.Options. (Inherited from TextLogRecordBuilder.)
Protected property | Context | Gets the LoggingContext to which the record belongs. (Inherited from LogRecordBuilder.)
Public property | Exception | Gets the Exception for the current record, or null if no exception is associated to the current record. (Inherited from TextLogRecordBuilder.)
Public property | IsDisposed | (Inherited from LogRecordBuilder.)
Protected property | Level | Gets the LogLevel for the current record. (Inherited from TextLogRecordBuilder.)
Public property | MemberName | Gets the name of the method, property or field for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Options | Gets the LoggingOptions for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | Profile | Gets the LoggingProfile for the current record. (Inherited from TextLogRecordBuilder.)
Protected property | RecordKind | Gets the kind of the current record (e.g. MethodEntry or MethodException). (Inherited from LogRecordBuilder.)
Public property | SourceLineInfo | Gets the SourceLineInfo for the current record. (Inherited from TextLogRecordBuilder.)
Public property | SourceType | Gets the source Type of the current record. (Inherited from TextLogRecordBuilder.)
Protected property | StringBuilder | Gets the current UnsafeStringBuilder where everything is being appended. (Inherited from TextLogRecordBuilder.)
Protected property | ThreadContext | Gets the ThreadLoggingContext to which the current LogRecordBuilder belongs. (Inherited from LogRecordBuilder.)
Protected property | TypeSource | Gets the LoggingTypeSource for the current record. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

TraceSourceLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.TraceSource Namespace


TraceSourceLogRecordBuilder Methods

The TraceSourceLogRecordBuilder type exposes the following members.

Methods
 | Name | Description
Protected method | AppendAsyncInfo | Appends information about the async method to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendClosingParenthesisConditional | Appends a closing parenthesis to the current StringBuilder if required. (Inherited from TextLogRecordBuilder.)
Protected method | AppendComma | (Inherited from TextLogRecordBuilder.)
Protected method | AppendCommaConditional | Appends a comma to the current StringBuilder, unless this method is invoked for the first time for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription | Appends the context Description (or the TypeSource name, if the type of the context is not equal to the source type of the record) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendContextDescription(LoggingContext) | (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiter | Appends a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendDelimiterConditional | Appends a Delimiter to the current StringBuilder if the RequireDelimiter method has been called previously. (Inherited from TextLogRecordBuilder.)
Protected method | AppendEpilogue | Appends the final part of log message to StringBuilder. This includes state machine number and execution time where relevant, but does not include exception details. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExceptionDetails | Appends exception details to StringBuilder if IncludeExceptionDetails is set. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTime | Appends the execution time to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendExecutionTimeThreshold | Appends the execution time threshold to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendIndentString | Appends indentation for the given to StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendMemberName | Appends name of the member for the current record (including the declaring type name, subject to the IncludeType property) to the current StringBuilder, as well as an opening parenthesis. (Inherited from TextLogRecordBuilder.)
Protected method | AppendOpeningParenthesis | Appends an opening parenthesis to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendProlog | Appends the indent string, context description, and the record kind to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendRecordKind | Appends the LogRecordKind of the current record to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameter(SemanticParameterKind, String, String, String, Int32) | Appends a parameter of String type to the current StringBuilder. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSourceLineInfo | Appends source (file, line) information to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpaces | Appends a given number of spaces to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendSpecialChar | Appends a special Char (which may require escaping with specific back-ends) to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTrailingPeriod | Appends a trailing period (.) to the current StringBuilder, respecting the AppendTrailingPeriod property. (Inherited from TextLogRecordBuilder.)
Protected method | AppendTypeName | Appends the name of the TypeSource to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | BeginCustomRecord | Initializes the current LogRecordBuilder to emit a custom record. (Inherited from TextLogRecordBuilder.)
Public method | BeginRecord | Initializes the current LogRecordBuilder to emit a standard (i.e. non-custom) record for a given context and method. (Inherited from TextLogRecordBuilder.)
Public method | Complete | Emits the record and resets the current LogRecordBuilder. This method invoked after all SetThisT(T), SetParameterT(Int32, String, ParameterKind, String, T) and similar methods have been called. (Inherited from LogRecordBuilder.)
Public method | Dispose | (Inherited from LogRecordBuilder.)
Protected method | EmitRecord | Emits the record. Invoked by the Complete method. (Overrides TextLogRecordBuilderEmitRecord.)
Protected method | EmitRecord(Boolean) | Emits the record and specifies whether exception details should be appended to the text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescription | Ends building the context Description and starts building the action text. (Inherited from TextLogRecordBuilder.)
Protected method | EndContextDescriptionConditional | Switches between building the context Description and the action text. If the EndContextDescriptionConditional method has been previously invoked, subsequent calls are ignored. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescription | Obsolete. Gets the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextDescriptionUnsafe | Obsolete. Gets an UnsafeString representing the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record. (Inherited from TextLogRecordBuilder.)
Protected method | GetContextForDescription | Obsolete. Gets the LoggingContext that should be used when getting or appending the Description. (Inherited from TextLogRecordBuilder.)
Protected method | GetSourceName | Gets the name of the TypeSource for the current record, respecting the IncludeNamespace property. (Inherited from TextLogRecordBuilder.)
Protected method | HasRecordKindName | Determines whether the AppendRecordKind will append anything for the current record. (Inherited from TextLogRecordBuilder.)
Protected method | MustBuildContextDescription | Determines whether the current Description should be appended to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | RequireComma | Makes the AppendCommaConditional to append a comma even if it's invoked for the first time. (Inherited from TextLogRecordBuilder.)
Protected method | RequireDelimiter | Causes the next call to the AppendDelimiterConditional to append a Delimiter to the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Protected method | Reset | Resets all fields and properties of the current LogRecordBuilder to their initial value. Invoked by the Complete method. (Inherited from TextLogRecordBuilder.)
Public method | SetException | Sets the exception for the method or activity. (Inherited from TextLogRecordBuilder.)
Public method | SetExecutionTime | Sets the method or activity execution time. (Inherited from TextLogRecordBuilder.)
Public method | SetMethodGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T) | Sets the value of a given parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from TextLogRecordBuilder.)
Public method | SetRefStructParameter | (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T) | Sets a given return value (there can be several return values in C# 7.0) and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetThisT(T) | Sets the this (instance) value and uses the default formatter. This method is only invoked if the IncludeThisValue property is true. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | SetTypeGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Protected method | ShouldLogExceptionDetails | Determines whether exception details should be appended to the text of the current StringBuilder. (Inherited from TextLogRecordBuilder.)
Public method | ToString | Returns a string that represents the current object. (Inherited from TextLogRecordBuilder.)
Protected method | Write | Writes the final message to the back-end. (Overrides TextLogRecordBuilderWrite(UnsafeString).)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T) | Writes a custom parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from TextLogRecordBuilder.)
Public method | WriteCustomString | Write a chunk of custom string. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

TraceSourceLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.TraceSource Namespace


TraceSourceLogRecordBuilder.EmitRecord Method

TraceSourceLogRecordBuilderEmitRecord Method

Overload List
 | Name | Description
Protected method | EmitRecord | Emits the record. Invoked by the Complete method. (Overrides TextLogRecordBuilderEmitRecord.)
Protected method | EmitRecord(Boolean) | Emits the record and specifies whether exception details should be appended to the text. (Inherited from TextLogRecordBuilder.)
Top
See Also

Reference

TraceSourceLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.TraceSource Namespace


TraceSourceLogRecordBuilder.EmitRecord Method

TraceSourceLogRecordBuilderEmitRecord Method

Emits the record. Invoked by the Complete method.

Namespace: PostSharp.Patterns.Diagnostics.Backends.TraceSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void EmitRecord()
See Also

Reference

TraceSourceLogRecordBuilder Class
EmitRecord Overload
PostSharp.Patterns.Diagnostics.Backends.TraceSource Namespace


TraceSourceLogRecordBuilder.Write Method

TraceSourceLogRecordBuilderWrite Method

Writes the final message to the back-end.

Namespace: PostSharp.Patterns.Diagnostics.Backends.TraceSource
Assembly: PostSharp.Patterns.Diagnostics.Backends.Tracing (in PostSharp.Patterns.Diagnostics.Backends.Tracing.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void Write(
    UnsafeString message
)

Parameters

message
Type: PostSharp.Patterns.FormattersUnsafeString
The final message.
See Also

Reference

TraceSourceLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.Backends.TraceSource Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


PostSharp.Patterns.Diagnostics.Contexts Namespace

Classes
 | Class | Description
Public class | AsyncCustomActivityLoggingContext | A LoggingContext that represents an asynchronous custom activity, i.e. an activity opened using OpenAsyncActivity(String).
Public class | AsyncLoggingContext | A LoggingContext that can represent an async method execution or an async custom activity.
Public class | AsyncMethodLoggingContext | A LoggingContext that represents an asynchronous method.
Public class | EphemeralLoggingContext | A degenerated kind of LoggingContext that is used to emit standalone records.
Public class | IteratorLoggingContext | A LoggingContext that represents an iterator.
Public class | LoggingContext | Represents an execution context, typically a method or a user activity.
Public class | SuspendableLoggingContext | A LoggingContext that represents a method or activity that can be suspended and resume (possibly on a different thread), such as an async method or an iterator.
Public class | SyncCustomActivityLoggingContext | A LoggingContext that represents a synchronous custom activity, opened by the OpenActivity(String) method.
Public class | SyncLoggingContext | A LoggingContext that represents a synchronous context (i.e. a context that executes as a single block, without being suspended).
Public class | SyncMethodLoggingContext | A LoggingContext that represents a synchronous method (not an async method, not an iterator).
Public class | ThreadLoggingContext | A LoggingContext that represents the current thread. The ThreadLoggingContext has two usages. First, it is used to store all thread-local variables and objects. Then, it is used as the root object for all other contexts.
Structures
 | Structure | Description
Public structure | CallerInfo | Represents information about the caller of the Logger class.
Public structure | CorrelationCookie | Represents a correlation between two LoggingContext. This type is created by the CreateCorrelationCookie method.
Public structure | CustomLogRecordInfo | Stores information regarding a custom record, i.e. a record emitted by the Logger class.
Public structure | LogMemberInfo | Stores information regarding the method, field or property being logged.
Public structure | LogRecordInfo | Contains information about a log record.
Public structure | SourceLineInfo | Represents a position in a file of source code.
Interfaces
 | Interface | Description
Public interface | ICustomActivityLoggingContext | An ILoggingContext that represents a custom activity (LogActivity).
Public interface | ILoggingContext | Defines the minimal semantics of a logging context required by the Logger class.
Enumerations
 | Enumeration | Description
Public enumeration | LoggingContextKind | Kinds of logging contexts.


AsyncCustomActivityLoggingContext Class

A LoggingContext that represents an asynchronous custom activity, i.e. an activity opened using OpenAsyncActivity(String).
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.ContextsLoggingContext
PostSharp.Patterns.Diagnostics.ContextsSuspendableLoggingContext
PostSharp.Patterns.Diagnostics.ContextsAsyncLoggingContext
PostSharp.Patterns.Diagnostics.ContextsAsyncCustomActivityLoggingContext
PostSharp.Patterns.Diagnostics.Backends.SerilogSerilogAsyncCustomActivityContext

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class AsyncCustomActivityLoggingContext : AsyncLoggingContext,
    ICustomActivityLoggingContext, ILoggingContext, IDisposable

The AsyncCustomActivityLoggingContext type exposes the following members.

Constructors
 | Name | Description
Public method | AsyncCustomActivityLoggingContext | Initializes a new AsyncCustomActivityLoggingContext.
Top
Properties
 | Name | Description
Public property | ActivationContext | Gets the LoggingContext in which the current context was activated. If the current context has been resumed, ActivationContext refers to the context in which the context was resumed. (Inherited from LoggingContext.)
Public property | Backend | Gets the parent LoggingBackend of the current context. (Inherited from LoggingContext.)
Public property | CustomActivityKind | Gets the kind of LogActivity of the current context.
Public property | Description | Gets the description of the current context. The description is typically set by the LogRecordBuilder when building the opening record of a context. (Inherited from LoggingContext.)
Public property | Id | Gets or set the identifier of the current context. This property should be used for debugging only. Its value is lazily created. (Inherited from LoggingContext.)
Public property | IndentLevel | Gets or sets the indentation level for the current context. (Inherited from LoggingContext.)
Public property | IsAsync | Determines whether the current LoggingContext represents an async method or an asynchronous custom activity. (Inherited from LoggingContext.)
Public property | IsDisposed | Determines whether the current context has been disposed. (Inherited from LoggingContext.)
Public property | IsSharable | Determines whether the current LoggingContext can be accessed outside of its nominal lifetype (for instance after the method has completed or a custom activity has beeen closed). Since contexts can be pooled and reused, consumers must call the MakeSharable method if they want to keep a reference to the LoggingContext and access it after its nominal lifetime has completed. (Inherited from LoggingContext.)
Public property | IsSuspended | Determines whether the current context is currently suspended (between a Suspend and a Resume). (Inherited from SuspendableLoggingContext.)
Public property | Kind | Gets the kind of the current context. (Inherited from LoggingContext.)
Public property | MemberName | Gets the name of the method or property related to the current context. (Inherited from LoggingContext.)
Public property | ParentContext | Gets the LoggingContext that created (initiated) the current context. This is the logical parent. (Inherited from LoggingContext.)
Public property | Source | Gets the LoggingTypeSource corresponding, typically, to the declaring type of the member associated to the current context. (Inherited from LoggingContext.)
Public property | ThreadContext | Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed. (Inherited from SuspendableLoggingContext.)
Top
Methods
 | Name | Description
Public method | CreateCorrelationCookie | Creates a cookie that can be used to correlate, using the SetCorrelation(CorrelationCookie) method, another context to the current context. (Inherited from LoggingContext.)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from SuspendableLoggingContext.)
Public method | GetCustomRecordBuilder | Gets a LogRecordBuilder for the current context to build a custom record. (Inherited from LoggingContext.)
Public method | GetRecordBuilder | Gets a LogRecordBuilder for the current context to build a standard record for a given method. (Inherited from LoggingContext.)
Public method | MakeSharable | Allows the current context to be shared beyond its normal lifecycle by preventing it from being returned to the pool. (Inherited from LoggingContext.)
Public method | Open | Opens the current context.
Protected method | Reset | Resets the current context to its initial, uninitialized state. This method is called by the Dispose method. (Inherited from LoggingContext.)
Public method | Resume | Resumes the current context. Typically called when the state machine resumes execution, when the wait dependency is satisfied (in case of async methods) or when the MoveNext method is called (in case of iterators). (Inherited from SuspendableLoggingContext.)
Public method | ResumeConditional | Resume the current context, but only if it is currently suspended. (Inherited from SuspendableLoggingContext.)
Public method | SetCorrelation | Associates the current context with another context. (Inherited from LoggingContext.)
Public method | SetWaitDependency | Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts. (Overrides LoggingContextSetWaitDependency(Object).)
Public method | Suspend | Suspends the current context. Typically called when starting to wait for a wait dependency (the operand of the await operator in case of async methods), or after the MoveNext method (in case of iterators). (Inherited from SuspendableLoggingContext.)
Public method | ToString | Returns a string that represents the current object. (Inherited from LoggingContext.)
Protected method | ToString(StringBuilder) | Formats a description of the current LoggingContext into a given StringBuilder. (Inherited from SuspendableLoggingContext.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Contexts Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


AsyncCustomActivityLoggingContext Constructor

Initializes a new AsyncCustomActivityLoggingContext.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AsyncCustomActivityLoggingContext(
    LoggingBackend backend
)

Parameters

backend
Type: PostSharp.Patterns.DiagnosticsLoggingBackend
The parent context.
See Also

Reference

AsyncCustomActivityLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


AsyncCustomActivityLoggingContext Properties

The AsyncCustomActivityLoggingContext type exposes the following members.

Properties
 | Name | Description
Public property | ActivationContext | Gets the LoggingContext in which the current context was activated. If the current context has been resumed, ActivationContext refers to the context in which the context was resumed. (Inherited from LoggingContext.)
Public property | Backend | Gets the parent LoggingBackend of the current context. (Inherited from LoggingContext.)
Public property | CustomActivityKind | Gets the kind of LogActivity of the current context.
Public property | Description | Gets the description of the current context. The description is typically set by the LogRecordBuilder when building the opening record of a context. (Inherited from LoggingContext.)
Public property | Id | Gets or set the identifier of the current context. This property should be used for debugging only. Its value is lazily created. (Inherited from LoggingContext.)
Public property | IndentLevel | Gets or sets the indentation level for the current context. (Inherited from LoggingContext.)
Public property | IsAsync | Determines whether the current LoggingContext represents an async method or an asynchronous custom activity. (Inherited from LoggingContext.)
Public property | IsDisposed | Determines whether the current context has been disposed. (Inherited from LoggingContext.)
Public property | IsSharable | Determines whether the current LoggingContext can be accessed outside of its nominal lifetype (for instance after the method has completed or a custom activity has beeen closed). Since contexts can be pooled and reused, consumers must call the MakeSharable method if they want to keep a reference to the LoggingContext and access it after its nominal lifetime has completed. (Inherited from LoggingContext.)
Public property | IsSuspended | Determines whether the current context is currently suspended (between a Suspend and a Resume). (Inherited from SuspendableLoggingContext.)
Public property | Kind | Gets the kind of the current context. (Inherited from LoggingContext.)
Public property | MemberName | Gets the name of the method or property related to the current context. (Inherited from LoggingContext.)
Public property | ParentContext | Gets the LoggingContext that created (initiated) the current context. This is the logical parent. (Inherited from LoggingContext.)
Public property | Source | Gets the LoggingTypeSource corresponding, typically, to the declaring type of the member associated to the current context. (Inherited from LoggingContext.)
Public property | ThreadContext | Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed. (Inherited from SuspendableLoggingContext.)
Top
See Also

Reference

AsyncCustomActivityLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


AsyncCustomActivityLoggingContext.CustomActivityKind Property

AsyncCustomActivityLoggingContextCustomActivityKind Property

Gets the kind of LogActivity of the current context.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivityKind CustomActivityKind { get; }

Property Value

Type: LogActivityKind

Implements

ICustomActivityLoggingContextCustomActivityKind
See Also

Reference

AsyncCustomActivityLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


AsyncCustomActivityLoggingContext Methods

The AsyncCustomActivityLoggingContext type exposes the following members.

Methods
 | Name | Description
Public method | CreateCorrelationCookie | Creates a cookie that can be used to correlate, using the SetCorrelation(CorrelationCookie) method, another context to the current context. (Inherited from LoggingContext.)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from SuspendableLoggingContext.)
Public method | GetCustomRecordBuilder | Gets a LogRecordBuilder for the current context to build a custom record. (Inherited from LoggingContext.)
Public method | GetRecordBuilder | Gets a LogRecordBuilder for the current context to build a standard record for a given method. (Inherited from LoggingContext.)
Public method | MakeSharable | Allows the current context to be shared beyond its normal lifecycle by preventing it from being returned to the pool. (Inherited from LoggingContext.)
Public method | Open | Opens the current context.
Protected method | Reset | Resets the current context to its initial, uninitialized state. This method is called by the Dispose method. (Inherited from LoggingContext.)
Public method | Resume | Resumes the current context. Typically called when the state machine resumes execution, when the wait dependency is satisfied (in case of async methods) or when the MoveNext method is called (in case of iterators). (Inherited from SuspendableLoggingContext.)
Public method | ResumeConditional | Resume the current context, but only if it is currently suspended. (Inherited from SuspendableLoggingContext.)
Public method | SetCorrelation | Associates the current context with another context. (Inherited from LoggingContext.)
Public method | SetWaitDependency | Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts. (Overrides LoggingContextSetWaitDependency(Object).)
Public method | Suspend | Suspends the current context. Typically called when starting to wait for a wait dependency (the operand of the await operator in case of async methods), or after the MoveNext method (in case of iterators). (Inherited from SuspendableLoggingContext.)
Public method | ToString | Returns a string that represents the current object. (Inherited from LoggingContext.)
Protected method | ToString(StringBuilder) | Formats a description of the current LoggingContext into a given StringBuilder. (Inherited from SuspendableLoggingContext.)
Top
See Also

Reference

AsyncCustomActivityLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


AsyncCustomActivityLoggingContext.Open Method

AsyncCustomActivityLoggingContextOpen Method

Opens the current context.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void Open(
    LoggingTypeSource typeSource,
    LogActivityOptions options
)

Parameters

typeSource
Type: PostSharp.Patterns.DiagnosticsLoggingTypeSource
The LoggingTypeSource for the declaring type of the context.
options
Type: PostSharp.Patterns.DiagnosticsLogActivityOptions
Options of the new context.
See Also

Reference

AsyncCustomActivityLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


AsyncCustomActivityLoggingContext.SetWaitDependency Method

AsyncCustomActivityLoggingContextSetWaitDependency Method

Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void SetWaitDependency(
    Object waited
)

Parameters

waited
Type: SystemObject
The "thing" being waited for (for instance a [!:Task] or a [!:TaskInfo]).
See Also

Reference

AsyncCustomActivityLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


AsyncLoggingContext Class

A LoggingContext that can represent an async method execution or an async custom activity.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.ContextsLoggingContext
PostSharp.Patterns.Diagnostics.ContextsSuspendableLoggingContext
PostSharp.Patterns.Diagnostics.ContextsAsyncLoggingContext
PostSharp.Patterns.Diagnostics.ContextsAsyncCustomActivityLoggingContext
PostSharp.Patterns.Diagnostics.ContextsAsyncMethodLoggingContext

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class AsyncLoggingContext : SuspendableLoggingContext

The AsyncLoggingContext type exposes the following members.

Constructors
 | Name | Description
Protected method | AsyncLoggingContext | Initializes a new AsyncLoggingContext.
Top
Properties
 | Name | Description
Public property | ActivationContext | Gets the LoggingContext in which the current context was activated. If the current context has been resumed, ActivationContext refers to the context in which the context was resumed. (Inherited from LoggingContext.)
Public property | Backend | Gets the parent LoggingBackend of the current context. (Inherited from LoggingContext.)
Public property | Description | Gets the description of the current context. The description is typically set by the LogRecordBuilder when building the opening record of a context. (Inherited from LoggingContext.)
Public property | Id | Gets or set the identifier of the current context. This property should be used for debugging only. Its value is lazily created. (Inherited from LoggingContext.)
Public property | IndentLevel | Gets or sets the indentation level for the current context. (Inherited from LoggingContext.)
Public property | IsAsync | Determines whether the current LoggingContext represents an async method or an asynchronous custom activity. (Inherited from LoggingContext.)
Public property | IsDisposed | Determines whether the current context has been disposed. (Inherited from LoggingContext.)
Public property | IsSharable | Determines whether the current LoggingContext can be accessed outside of its nominal lifetype (for instance after the method has completed or a custom activity has beeen closed). Since contexts can be pooled and reused, consumers must call the MakeSharable method if they want to keep a reference to the LoggingContext and access it after its nominal lifetime has completed. (Inherited from LoggingContext.)
Public property | IsSuspended | Determines whether the current context is currently suspended (between a Suspend and a Resume). (Inherited from SuspendableLoggingContext.)
Public property | Kind | Gets the kind of the current context. (Inherited from LoggingContext.)
Public property | MemberName | Gets the name of the method or property related to the current context. (Inherited from LoggingContext.)
Public property | ParentContext | Gets the LoggingContext that created (initiated) the current context. This is the logical parent. (Inherited from LoggingContext.)
Public property | Source | Gets the LoggingTypeSource corresponding, typically, to the declaring type of the member associated to the current context. (Inherited from LoggingContext.)
Public property | ThreadContext | Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed. (Inherited from SuspendableLoggingContext.)
Top
Methods
 | Name | Description
Public method | CreateCorrelationCookie | Creates a cookie that can be used to correlate, using the SetCorrelation(CorrelationCookie) method, another context to the current context. (Inherited from LoggingContext.)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from SuspendableLoggingContext.)
Public method | GetCustomRecordBuilder | Gets a LogRecordBuilder for the current context to build a custom record. (Inherited from LoggingContext.)
Public method | GetRecordBuilder | Gets a LogRecordBuilder for the current context to build a standard record for a given method. (Inherited from LoggingContext.)
Public method | MakeSharable | Allows the current context to be shared beyond its normal lifecycle by preventing it from being returned to the pool. (Inherited from LoggingContext.)
Protected method | Reset | Resets the current context to its initial, uninitialized state. This method is called by the Dispose method. (Inherited from LoggingContext.)
Public method | Resume | Resumes the current context. Typically called when the state machine resumes execution, when the wait dependency is satisfied (in case of async methods) or when the MoveNext method is called (in case of iterators). (Inherited from SuspendableLoggingContext.)
Public method | ResumeConditional | Resume the current context, but only if it is currently suspended. (Inherited from SuspendableLoggingContext.)
Public method | SetCorrelation | Associates the current context with another context. (Inherited from LoggingContext.)
Public method | SetWaitDependency | Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts. (Inherited from LoggingContext.)
Public method | Suspend | Suspends the current context. Typically called when starting to wait for a wait dependency (the operand of the await operator in case of async methods), or after the MoveNext method (in case of iterators). (Inherited from SuspendableLoggingContext.)
Public method | ToString | Returns a string that represents the current object. (Inherited from LoggingContext.)
Protected method | ToString(StringBuilder) | Formats a description of the current LoggingContext into a given StringBuilder. (Inherited from SuspendableLoggingContext.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Contexts Namespace


AsyncLoggingContext Constructor

Initializes a new AsyncLoggingContext.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected AsyncLoggingContext(
    LoggingBackend backend,
    LoggingContextKind kind,
    bool isAsync
)

Parameters

backend
Type: PostSharp.Patterns.DiagnosticsLoggingBackend
kind
Type: PostSharp.Patterns.Diagnostics.ContextsLoggingContextKind
isAsync
Type: SystemBoolean
See Also

Reference

AsyncLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


AsyncLoggingContext Properties

The AsyncLoggingContext type exposes the following members.

Properties
 | Name | Description
Public property | ActivationContext | Gets the LoggingContext in which the current context was activated. If the current context has been resumed, ActivationContext refers to the context in which the context was resumed. (Inherited from LoggingContext.)
Public property | Backend | Gets the parent LoggingBackend of the current context. (Inherited from LoggingContext.)
Public property | Description | Gets the description of the current context. The description is typically set by the LogRecordBuilder when building the opening record of a context. (Inherited from LoggingContext.)
Public property | Id | Gets or set the identifier of the current context. This property should be used for debugging only. Its value is lazily created. (Inherited from LoggingContext.)
Public property | IndentLevel | Gets or sets the indentation level for the current context. (Inherited from LoggingContext.)
Public property | IsAsync | Determines whether the current LoggingContext represents an async method or an asynchronous custom activity. (Inherited from LoggingContext.)
Public property | IsDisposed | Determines whether the current context has been disposed. (Inherited from LoggingContext.)
Public property | IsSharable | Determines whether the current LoggingContext can be accessed outside of its nominal lifetype (for instance after the method has completed or a custom activity has beeen closed). Since contexts can be pooled and reused, consumers must call the MakeSharable method if they want to keep a reference to the LoggingContext and access it after its nominal lifetime has completed. (Inherited from LoggingContext.)
Public property | IsSuspended | Determines whether the current context is currently suspended (between a Suspend and a Resume). (Inherited from SuspendableLoggingContext.)
Public property | Kind | Gets the kind of the current context. (Inherited from LoggingContext.)
Public property | MemberName | Gets the name of the method or property related to the current context. (Inherited from LoggingContext.)
Public property | ParentContext | Gets the LoggingContext that created (initiated) the current context. This is the logical parent. (Inherited from LoggingContext.)
Public property | Source | Gets the LoggingTypeSource corresponding, typically, to the declaring type of the member associated to the current context. (Inherited from LoggingContext.)
Public property | ThreadContext | Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed. (Inherited from SuspendableLoggingContext.)
Top
See Also

Reference

AsyncLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


AsyncLoggingContext Methods

The AsyncLoggingContext type exposes the following members.

Methods
 | Name | Description
Public method | CreateCorrelationCookie | Creates a cookie that can be used to correlate, using the SetCorrelation(CorrelationCookie) method, another context to the current context. (Inherited from LoggingContext.)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from SuspendableLoggingContext.)
Public method | GetCustomRecordBuilder | Gets a LogRecordBuilder for the current context to build a custom record. (Inherited from LoggingContext.)
Public method | GetRecordBuilder | Gets a LogRecordBuilder for the current context to build a standard record for a given method. (Inherited from LoggingContext.)
Public method | MakeSharable | Allows the current context to be shared beyond its normal lifecycle by preventing it from being returned to the pool. (Inherited from LoggingContext.)
Protected method | Reset | Resets the current context to its initial, uninitialized state. This method is called by the Dispose method. (Inherited from LoggingContext.)
Public method | Resume | Resumes the current context. Typically called when the state machine resumes execution, when the wait dependency is satisfied (in case of async methods) or when the MoveNext method is called (in case of iterators). (Inherited from SuspendableLoggingContext.)
Public method | ResumeConditional | Resume the current context, but only if it is currently suspended. (Inherited from SuspendableLoggingContext.)
Public method | SetCorrelation | Associates the current context with another context. (Inherited from LoggingContext.)
Public method | SetWaitDependency | Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts. (Inherited from LoggingContext.)
Public method | Suspend | Suspends the current context. Typically called when starting to wait for a wait dependency (the operand of the await operator in case of async methods), or after the MoveNext method (in case of iterators). (Inherited from SuspendableLoggingContext.)
Public method | ToString | Returns a string that represents the current object. (Inherited from LoggingContext.)
Protected method | ToString(StringBuilder) | Formats a description of the current LoggingContext into a given StringBuilder. (Inherited from SuspendableLoggingContext.)
Top
See Also

Reference

AsyncLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


AsyncMethodLoggingContext Class

A LoggingContext that represents an asynchronous method.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.ContextsLoggingContext
PostSharp.Patterns.Diagnostics.ContextsSuspendableLoggingContext
PostSharp.Patterns.Diagnostics.ContextsAsyncLoggingContext
PostSharp.Patterns.Diagnostics.ContextsAsyncMethodLoggingContext
PostSharp.Patterns.Diagnostics.Backends.SerilogSerilogAsyncMethodLoggingContext

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class AsyncMethodLoggingContext : AsyncLoggingContext

The AsyncMethodLoggingContext type exposes the following members.

Constructors
 | Name | Description
Public method | AsyncMethodLoggingContext | Creates an instance of AsyncMethodLoggingContext.
Top
Properties
 | Name | Description
Public property | ActivationContext | Gets the LoggingContext in which the current context was activated. If the current context has been resumed, ActivationContext refers to the context in which the context was resumed. (Inherited from LoggingContext.)
Public property | AsyncCallId | Gets the unique identifier of the asynchronous call represented by the current AsyncMethodLoggingContext.
Public property | AwaitedMethod | Gets the awaited method (i.e. the operand of the await operator), or null if it could not be determined or if the IncludeAwaitedTask profile property is set to false.
Public property | AwaitedTask | Gets the awaited Task (i.e. the operand of the await operator), or null if it could not be determined or if the IncludeAwaitedTask profile property is set to false.
Public property | Backend | Gets the parent LoggingBackend of the current context. (Inherited from LoggingContext.)
Public property | Description | Gets the description of the current context. The description is typically set by the LogRecordBuilder when building the opening record of a context. (Inherited from LoggingContext.)
Public property | Id | Gets or set the identifier of the current context. This property should be used for debugging only. Its value is lazily created. (Inherited from LoggingContext.)
Public property | IndentLevel | Gets or sets the indentation level for the current context. (Inherited from LoggingContext.)
Public property | IsAsync | Determines whether the current LoggingContext represents an async method or an asynchronous custom activity. (Inherited from LoggingContext.)
Public property | IsDisposed | Determines whether the current context has been disposed. (Inherited from LoggingContext.)
Public property | IsSharable | Determines whether the current LoggingContext can be accessed outside of its nominal lifetype (for instance after the method has completed or a custom activity has beeen closed). Since contexts can be pooled and reused, consumers must call the MakeSharable method if they want to keep a reference to the LoggingContext and access it after its nominal lifetime has completed. (Inherited from LoggingContext.)
Public property | IsSuspended | Determines whether the current context is currently suspended (between a Suspend and a Resume). (Inherited from SuspendableLoggingContext.)
Public property | Kind | Gets the kind of the current context. (Inherited from LoggingContext.)
Public property | MemberName | Gets the name of the method or property related to the current context. (Inherited from LoggingContext.)
Public property | ParentContext | Gets the LoggingContext that created (initiated) the current context. This is the logical parent. (Inherited from LoggingContext.)
Public property | Source | Gets the LoggingTypeSource corresponding, typically, to the declaring type of the member associated to the current context. (Inherited from LoggingContext.)
Public property | Task | Gets the Task that is currently associated to the current async method invocation. An async method invocation may be associated to several different tasks during its lifetime.
Public property | ThreadContext | Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed. (Inherited from SuspendableLoggingContext.)
Top
Methods
 | Name | Description
Public method | CreateCorrelationCookie | Creates a cookie that can be used to correlate, using the SetCorrelation(CorrelationCookie) method, another context to the current context. (Inherited from LoggingContext.)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from SuspendableLoggingContext.)
Public method | GetCustomRecordBuilder | Gets a LogRecordBuilder for the current context to build a custom record. (Inherited from LoggingContext.)
Public method | GetRecordBuilder | Gets a LogRecordBuilder for the current context to build a standard record for a given method. (Inherited from LoggingContext.)
Public method | MakeSharable | Allows the current context to be shared beyond its normal lifecycle by preventing it from being returned to the pool. (Inherited from LoggingContext.)
Public method | Open | Opens the context.
Protected method | Reset | Resets the current context to its initial, uninitialized state. This method is called by the Dispose method. (Inherited from LoggingContext.)
Public method | Resume | Resumes the current context. Typically called when the state machine resumes execution, when the wait dependency is satisfied (in case of async methods) or when the MoveNext method is called (in case of iterators). (Inherited from SuspendableLoggingContext.)
Public method | ResumeConditional | Resume the current context, but only if it is currently suspended. (Inherited from SuspendableLoggingContext.)
Public method | SetAwaitedTask | Sets the awaited Task and/or MethodBase (i.e. the operand of the await operator).
Public method | SetCorrelation | Associates the current context with another context. (Inherited from LoggingContext.)
Public method | SetWaitDependency | Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts. (Inherited from LoggingContext.)
Public method | Suspend | Suspends the current context. Typically called when starting to wait for a wait dependency (the operand of the await operator in case of async methods), or after the MoveNext method (in case of iterators). (Inherited from SuspendableLoggingContext.)
Public method | ToString | Returns a string that represents the current object. (Inherited from LoggingContext.)
Protected method | ToString(StringBuilder) | Formats a description of the current LoggingContext into a given StringBuilder. (Inherited from SuspendableLoggingContext.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Contexts Namespace


AsyncMethodLoggingContext Constructor

Creates an instance of AsyncMethodLoggingContext.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AsyncMethodLoggingContext(
    LoggingBackend backend
)

Parameters

backend
Type: PostSharp.Patterns.DiagnosticsLoggingBackend
The parent LoggingBackend.
See Also

Reference

AsyncMethodLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


AsyncMethodLoggingContext Properties

The AsyncMethodLoggingContext type exposes the following members.

Properties
 | Name | Description
Public property | ActivationContext | Gets the LoggingContext in which the current context was activated. If the current context has been resumed, ActivationContext refers to the context in which the context was resumed. (Inherited from LoggingContext.)
Public property | AsyncCallId | Gets the unique identifier of the asynchronous call represented by the current AsyncMethodLoggingContext.
Public property | AwaitedMethod | Gets the awaited method (i.e. the operand of the await operator), or null if it could not be determined or if the IncludeAwaitedTask profile property is set to false.
Public property | AwaitedTask | Gets the awaited Task (i.e. the operand of the await operator), or null if it could not be determined or if the IncludeAwaitedTask profile property is set to false.
Public property | Backend | Gets the parent LoggingBackend of the current context. (Inherited from LoggingContext.)
Public property | Description | Gets the description of the current context. The description is typically set by the LogRecordBuilder when building the opening record of a context. (Inherited from LoggingContext.)
Public property | Id | Gets or set the identifier of the current context. This property should be used for debugging only. Its value is lazily created. (Inherited from LoggingContext.)
Public property | IndentLevel | Gets or sets the indentation level for the current context. (Inherited from LoggingContext.)
Public property | IsAsync | Determines whether the current LoggingContext represents an async method or an asynchronous custom activity. (Inherited from LoggingContext.)
Public property | IsDisposed | Determines whether the current context has been disposed. (Inherited from LoggingContext.)
Public property | IsSharable | Determines whether the current LoggingContext can be accessed outside of its nominal lifetype (for instance after the method has completed or a custom activity has beeen closed). Since contexts can be pooled and reused, consumers must call the MakeSharable method if they want to keep a reference to the LoggingContext and access it after its nominal lifetime has completed. (Inherited from LoggingContext.)
Public property | IsSuspended | Determines whether the current context is currently suspended (between a Suspend and a Resume). (Inherited from SuspendableLoggingContext.)
Public property | Kind | Gets the kind of the current context. (Inherited from LoggingContext.)
Public property | MemberName | Gets the name of the method or property related to the current context. (Inherited from LoggingContext.)
Public property | ParentContext | Gets the LoggingContext that created (initiated) the current context. This is the logical parent. (Inherited from LoggingContext.)
Public property | Source | Gets the LoggingTypeSource corresponding, typically, to the declaring type of the member associated to the current context. (Inherited from LoggingContext.)
Public property | Task | Gets the Task that is currently associated to the current async method invocation. An async method invocation may be associated to several different tasks during its lifetime.
Public property | ThreadContext | Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed. (Inherited from SuspendableLoggingContext.)
Top
See Also

Reference

AsyncMethodLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


AsyncMethodLoggingContext.AsyncCallId Property

AsyncMethodLoggingContextAsyncCallId Property

Gets the unique identifier of the asynchronous call represented by the current AsyncMethodLoggingContext.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AsyncCallId AsyncCallId { get; }

Property Value

Type: AsyncCallId
See Also

Reference

AsyncMethodLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


AsyncMethodLoggingContext.AwaitedMethod Property

AsyncMethodLoggingContextAwaitedMethod Property

Gets the awaited method (i.e. the operand of the await operator), or null if it could not be determined or if the IncludeAwaitedTask profile property is set to false.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MethodBase AwaitedMethod { get; }

Property Value

Type: MethodBase
See Also

Reference

AsyncMethodLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


AsyncMethodLoggingContext.AwaitedTask Property

AsyncMethodLoggingContextAwaitedTask Property

Gets the awaited Task (i.e. the operand of the await operator), or null if it could not be determined or if the IncludeAwaitedTask profile property is set to false.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Task AwaitedTask { get; }

Property Value

Type: Task
See Also

Reference

AsyncMethodLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


AsyncMethodLoggingContext.Task Property

AsyncMethodLoggingContextTask Property

Gets the Task that is currently associated to the current async method invocation. An async method invocation may be associated to several different tasks during its lifetime.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Task Task { get; set; }

Property Value

Type: Task
See Also

Reference

AsyncMethodLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


AsyncMethodLoggingContext Methods

The AsyncMethodLoggingContext type exposes the following members.

Methods
 | Name | Description
Public method | CreateCorrelationCookie | Creates a cookie that can be used to correlate, using the SetCorrelation(CorrelationCookie) method, another context to the current context. (Inherited from LoggingContext.)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from SuspendableLoggingContext.)
Public method | GetCustomRecordBuilder | Gets a LogRecordBuilder for the current context to build a custom record. (Inherited from LoggingContext.)
Public method | GetRecordBuilder | Gets a LogRecordBuilder for the current context to build a standard record for a given method. (Inherited from LoggingContext.)
Public method | MakeSharable | Allows the current context to be shared beyond its normal lifecycle by preventing it from being returned to the pool. (Inherited from LoggingContext.)
Public method | Open | Opens the context.
Protected method | Reset | Resets the current context to its initial, uninitialized state. This method is called by the Dispose method. (Inherited from LoggingContext.)
Public method | Resume | Resumes the current context. Typically called when the state machine resumes execution, when the wait dependency is satisfied (in case of async methods) or when the MoveNext method is called (in case of iterators). (Inherited from SuspendableLoggingContext.)
Public method | ResumeConditional | Resume the current context, but only if it is currently suspended. (Inherited from SuspendableLoggingContext.)
Public method | SetAwaitedTask | Sets the awaited Task and/or MethodBase (i.e. the operand of the await operator).
Public method | SetCorrelation | Associates the current context with another context. (Inherited from LoggingContext.)
Public method | SetWaitDependency | Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts. (Inherited from LoggingContext.)
Public method | Suspend | Suspends the current context. Typically called when starting to wait for a wait dependency (the operand of the await operator in case of async methods), or after the MoveNext method (in case of iterators). (Inherited from SuspendableLoggingContext.)
Public method | ToString | Returns a string that represents the current object. (Inherited from LoggingContext.)
Protected method | ToString(StringBuilder) | Formats a description of the current LoggingContext into a given StringBuilder. (Inherited from SuspendableLoggingContext.)
Top
See Also

Reference

AsyncMethodLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


AsyncMethodLoggingContext.Open Method

AsyncMethodLoggingContextOpen Method

Opens the context.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void Open(
    AsyncCallId asyncCallId,
    ref LogMemberInfo memberInfo
)

Parameters

asyncCallId
Type: PostSharp.AspectsAsyncCallId
The Task associated with the async method.
memberInfo
Type: PostSharp.Patterns.Diagnostics.ContextsLogMemberInfo
Information about the async method.
See Also

Reference

AsyncMethodLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


AsyncMethodLoggingContext.SetAwaitedTask Method

AsyncMethodLoggingContextSetAwaitedTask Method

Sets the awaited Task and/or MethodBase (i.e. the operand of the await operator).

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void SetAwaitedTask(
    Task awaitedTask,
    MethodBase awaitedMethod
)

Parameters

awaitedTask
Type: System.Threading.TasksTask
The awaited Task, or null if the Task cannot be determined.
awaitedMethod
Type: System.ReflectionMethodBase
The awaited MethodBase.
See Also

Reference

AsyncMethodLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


CallerInfo Structure

Represents information about the caller of the Logger class.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public struct CallerInfo

The CallerInfo type exposes the following members.

Constructors
 | Name | Description
Public method | CallerInfo(RuntimeTypeHandle, String, String, Int32, Int32) | Initializes a new CallerInfo, and uses as a RuntimeTypeHandle to specify the source type.
Public method | CallerInfo(Type, String, String, Int32, Int32) | Initializes a new CallerInfo, and uses as a Type to specify the source type.
Top
Properties
 | Name | Description
Public property | IsNull | Determines whether the current CallerInfo is null.
Public property | MethodName | Gets the name of the caller method.
Public property | SourceLineInfo | Gets the SourceLineInfo of the caller.
Public property | SourceType | Gets the source Type.
Public property | SourceTypeToken | Gets the RuntimeTypeHandle of the caller Type.
Top
Methods
 | Name | Description
Public method | ToString | Returns the fully qualified type name of this instance. (Overrides ValueTypeToString.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Contexts Namespace


CallerInfo Constructor

Overload List
 | Name | Description
Public method | CallerInfo(RuntimeTypeHandle, String, String, Int32, Int32) | Initializes a new CallerInfo, and uses as a RuntimeTypeHandle to specify the source type.
Public method | CallerInfo(Type, String, String, Int32, Int32) | Initializes a new CallerInfo, and uses as a Type to specify the source type.
Top
See Also

Reference

CallerInfo Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


CallerInfo Constructor (RuntimeTypeHandle, String, String, Int32, Int32)

Initializes a new CallerInfo, and uses as a RuntimeTypeHandle to specify the source type.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CallerInfo(
    RuntimeTypeHandle sourceTypeToken,
    string methodName,
    string file,
    int line,
    int column
)

Parameters

sourceTypeToken
Type: SystemRuntimeTypeHandle
RuntimeTypeHandle of the calling type.
methodName
Type: SystemString
Name of the calling method.
file
Type: SystemString
Path of the source code of the calling code.
line
Type: SystemInt32
Line in file of the caller.
column
Type: SystemInt32
Column in file of the caller.
See Also

Reference

CallerInfo Structure
CallerInfo Overload
PostSharp.Patterns.Diagnostics.Contexts Namespace


CallerInfo Constructor (Type, String, String, Int32, Int32)

Initializes a new CallerInfo, and uses as a Type to specify the source type.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CallerInfo(
    Type sourceType,
    string methodName,
    string file,
    int line,
    int column
)

Parameters

sourceType
Type: SystemType
Type of the calling type.
methodName
Type: SystemString
Name of the calling method.
file
Type: SystemString
Path of the source code of the calling code.
line
Type: SystemInt32
Line in file of the caller.
column
Type: SystemInt32
Column in file of the caller.
See Also

Reference

CallerInfo Structure
CallerInfo Overload
PostSharp.Patterns.Diagnostics.Contexts Namespace


CallerInfo Properties

The CallerInfo type exposes the following members.

Properties
 | Name | Description
Public property | IsNull | Determines whether the current CallerInfo is null.
Public property | MethodName | Gets the name of the caller method.
Public property | SourceLineInfo | Gets the SourceLineInfo of the caller.
Public property | SourceType | Gets the source Type.
Public property | SourceTypeToken | Gets the RuntimeTypeHandle of the caller Type.
Top
See Also

Reference

CallerInfo Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


CallerInfo.IsNull Property

CallerInfoIsNull Property

Determines whether the current CallerInfo is null.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsNull { get; }

Property Value

Type: Boolean
See Also

Reference

CallerInfo Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


CallerInfo.MethodName Property

CallerInfoMethodName Property

Gets the name of the caller method.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string MethodName { get; }

Property Value

Type: String
See Also

Reference

CallerInfo Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


CallerInfo.SourceLineInfo Property

CallerInfoSourceLineInfo Property

Gets the SourceLineInfo of the caller.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SourceLineInfo SourceLineInfo { get; }

Property Value

Type: SourceLineInfo
See Also

Reference

CallerInfo Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


CallerInfo.SourceType Property

CallerInfoSourceType Property

Gets the source Type.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Type SourceType { get; }

Property Value

Type: Type
See Also

Reference

CallerInfo Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


CallerInfo.SourceTypeToken Property

CallerInfoSourceTypeToken Property

Gets the RuntimeTypeHandle of the caller Type.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public RuntimeTypeHandle SourceTypeToken { get; }

Property Value

Type: RuntimeTypeHandle
See Also

Reference

CallerInfo Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


CallerInfo Methods

The CallerInfo type exposes the following members.

Methods
 | Name | Description
Public method | ToString | Returns the fully qualified type name of this instance. (Overrides ValueTypeToString.)
Top
See Also

Reference

CallerInfo Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


CallerInfo.ToString Method

CallerInfoToString Method

Returns the fully qualified type name of this instance.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override string ToString()

Return Value

Type: String
A String containing a fully qualified type name.
See Also

Reference

CallerInfo Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


CorrelationCookie Structure

Represents a correlation between two LoggingContext. This type is created by the CreateCorrelationCookie method.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public struct CorrelationCookie

The CorrelationCookie type exposes the following members.

Constructors
 | Name | Description
Public method | CorrelationCookie | Initializes a new CorrelationCookie.
Top
Properties
 | Name | Description
 | Null | Gets a default instance of the CorrelationCookie type.
Public property | ParentContext | Gets the parent context (the one of the CreateCorrelationCookie method).
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Contexts Namespace


CorrelationCookie Constructor

Initializes a new CorrelationCookie.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CorrelationCookie(
    ILoggingContext parentContext
)

Parameters

parentContext
Type: PostSharp.Patterns.Diagnostics.ContextsILoggingContext
The parent context (the one of the CreateCorrelationCookie method).
See Also

Reference

CorrelationCookie Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


CorrelationCookie Properties

The CorrelationCookie type exposes the following members.

Properties
 | Name | Description
 | Null | Gets a default instance of the CorrelationCookie type.
Public property | ParentContext | Gets the parent context (the one of the CreateCorrelationCookie method).
Top
See Also

Reference

CorrelationCookie Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


CorrelationCookie.Null Property

CorrelationCookieNull Property

Gets a default instance of the CorrelationCookie type.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static CorrelationCookie Null { get; }

Property Value

Type: CorrelationCookie
See Also

Reference

CorrelationCookie Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


CorrelationCookie.ParentContext Property

CorrelationCookieParentContext Property

Gets the parent context (the one of the CreateCorrelationCookie method).

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ILoggingContext ParentContext { get; }

Property Value

Type: ILoggingContext
See Also

Reference

CorrelationCookie Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


CustomLogRecordInfo Structure

Stores information regarding a custom record, i.e. a record emitted by the Logger class.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public struct CustomLogRecordInfo

The CustomLogRecordInfo type exposes the following members.

Constructors
 | Name | Description
Public method | CustomLogRecordInfo | Initializes a new CustomLogRecordInfo.
Top
Properties
 | Name | Description
Public property | CallerInfo | Gets information about the code invoking the Logger class.
Public property | Level | Gets the record level.
Public property | ParameterCount | Gets the number of parameters in the record text.
Public property | RecordKind | Gets the record kind.
Public property | Source | Gets the source type.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Contexts Namespace


CustomLogRecordInfo Constructor

Initializes a new CustomLogRecordInfo.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CustomLogRecordInfo(
    LoggingTypeSource source,
    LogLevel level,
    int parameterCount,
    LogRecordKind recordKind,
    CallerInfo callerInfo
)

Parameters

source
Type: PostSharp.Patterns.DiagnosticsLoggingTypeSource
Source type.
level
Type: PostSharp.Patterns.DiagnosticsLogLevel
Log level
parameterCount
Type: SystemInt32
Number of parameters in the record text.
recordKind
Type: PostSharp.Patterns.DiagnosticsLogRecordKind
Kind of record.
callerInfo
Type: PostSharp.Patterns.Diagnostics.ContextsCallerInfo
Information about the code invoking the Logger class.
See Also

Reference

CustomLogRecordInfo Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


CustomLogRecordInfo Properties

The CustomLogRecordInfo type exposes the following members.

Properties
 | Name | Description
Public property | CallerInfo | Gets information about the code invoking the Logger class.
Public property | Level | Gets the record level.
Public property | ParameterCount | Gets the number of parameters in the record text.
Public property | RecordKind | Gets the record kind.
Public property | Source | Gets the source type.
Top
See Also

Reference

CustomLogRecordInfo Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


CustomLogRecordInfo.CallerInfo Property

CustomLogRecordInfoCallerInfo Property

Gets information about the code invoking the Logger class.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CallerInfo CallerInfo { get; }

Property Value

Type: CallerInfo
See Also

Reference

CustomLogRecordInfo Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


CustomLogRecordInfo.Level Property

CustomLogRecordInfoLevel Property

Gets the record level.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogLevel Level { get; }

Property Value

Type: LogLevel
See Also

Reference

CustomLogRecordInfo Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


CustomLogRecordInfo.ParameterCount Property

CustomLogRecordInfoParameterCount Property

Gets the number of parameters in the record text.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int ParameterCount { get; }

Property Value

Type: Int32
See Also

Reference

CustomLogRecordInfo Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


CustomLogRecordInfo.RecordKind Property

CustomLogRecordInfoRecordKind Property

Gets the record kind.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogRecordKind RecordKind { get; }

Property Value

Type: LogRecordKind
See Also

Reference

CustomLogRecordInfo Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


CustomLogRecordInfo.Source Property

CustomLogRecordInfoSource Property

Gets the source type.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingTypeSource Source { get; }

Property Value

Type: LoggingTypeSource
See Also

Reference

CustomLogRecordInfo Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


EphemeralLoggingContext Class

A degenerated kind of LoggingContext that is used to emit standalone records.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.ContextsLoggingContext
PostSharp.Patterns.Diagnostics.ContextsEphemeralLoggingContext
PostSharp.Patterns.Diagnostics.Backends.SerilogSerilogEphemeralLoggingContext

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class EphemeralLoggingContext : LoggingContext

The EphemeralLoggingContext type exposes the following members.

Constructors
 | Name | Description
Public method | EphemeralLoggingContext | Initializes a new EphemeralLoggingContext.
Top
Properties
 | Name | Description
Public property | ActivationContext | Gets the LoggingContext in which the current context was activated. If the current context has been resumed, ActivationContext refers to the context in which the context was resumed. (Overrides LoggingContextActivationContext.)
Public property | Backend | Gets the parent LoggingBackend of the current context. (Inherited from LoggingContext.)
Public property | Description | Gets the description of the current context. The description is typically set by the LogRecordBuilder when building the opening record of a context. (Inherited from LoggingContext.)
Public property | Id | Gets or set the identifier of the current context. This property should be used for debugging only. Its value is lazily created. (Inherited from LoggingContext.)
Public property | IndentLevel | Gets or sets the indentation level for the current context. (Inherited from LoggingContext.)
Public property | IsAsync | Determines whether the current LoggingContext represents an async method or an asynchronous custom activity. (Inherited from LoggingContext.)
Public property | IsDisposed | Determines whether the current context has been disposed. (Inherited from LoggingContext.)
Public property | IsSharable | Determines whether the current LoggingContext can be accessed outside of its nominal lifetype (for instance after the method has completed or a custom activity has beeen closed). Since contexts can be pooled and reused, consumers must call the MakeSharable method if they want to keep a reference to the LoggingContext and access it after its nominal lifetime has completed. (Inherited from LoggingContext.)
Public property | Kind | Gets the kind of the current context. (Inherited from LoggingContext.)
Public property | MemberName | Gets the name of the method or property related to the current context. (Inherited from LoggingContext.)
Public property | ParentContext | Gets the LoggingContext that created (initiated) the current context. This is the logical parent. (Overrides LoggingContextParentContext.)
Public property | Source | Gets the LoggingTypeSource corresponding, typically, to the declaring type of the member associated to the current context. (Inherited from LoggingContext.)
Public property | ThreadContext | Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed. (Overrides LoggingContextThreadContext.)
Top
Methods
 | Name | Description
Public method | CreateCorrelationCookie | Creates a cookie that can be used to correlate, using the SetCorrelation(CorrelationCookie) method, another context to the current context. (Inherited from LoggingContext.)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.)
Protected method | Dispose(Boolean) | Disposes the current object. (Overrides LoggingContextDispose(Boolean).)
Public method | GetCustomRecordBuilder | Gets a LogRecordBuilder for the current context to build a custom record. (Inherited from LoggingContext.)
Public method | GetRecordBuilder | Gets a LogRecordBuilder for the current context to build a standard record for a given method. (Inherited from LoggingContext.)
Public method | MakeSharable | Allows the current context to be shared beyond its normal lifecycle by preventing it from being returned to the pool. (Inherited from LoggingContext.)
Public method | Open | Opens the context.
Protected method | Reset | Resets the current context to its initial, uninitialized state. This method is called by the Dispose method. (Inherited from LoggingContext.)
Public method | SetCorrelation | Associates the current context with another context. (Inherited from LoggingContext.)
Public method | SetWaitDependency | Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts. (Inherited from LoggingContext.)
Public method | ToString | Returns a string that represents the current object. (Inherited from LoggingContext.)
Protected method | ToString(StringBuilder) | Formats a description of the current LoggingContext into a given StringBuilder. (Inherited from LoggingContext.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Contexts Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


EphemeralLoggingContext Constructor

Initializes a new EphemeralLoggingContext.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public EphemeralLoggingContext(
    LoggingBackend backend,
    ThreadLoggingContext threadContext
)

Parameters

backend
Type: PostSharp.Patterns.DiagnosticsLoggingBackend
The parent LoggingBackend.
threadContext
Type: PostSharp.Patterns.Diagnostics.ContextsThreadLoggingContext
The ThreadLoggingContext in which the new EphemeralLoggingContext will be used.
See Also

Reference

EphemeralLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


EphemeralLoggingContext Properties

The EphemeralLoggingContext type exposes the following members.

Properties
 | Name | Description
Public property | ActivationContext | Gets the LoggingContext in which the current context was activated. If the current context has been resumed, ActivationContext refers to the context in which the context was resumed. (Overrides LoggingContextActivationContext.)
Public property | Backend | Gets the parent LoggingBackend of the current context. (Inherited from LoggingContext.)
Public property | Description | Gets the description of the current context. The description is typically set by the LogRecordBuilder when building the opening record of a context. (Inherited from LoggingContext.)
Public property | Id | Gets or set the identifier of the current context. This property should be used for debugging only. Its value is lazily created. (Inherited from LoggingContext.)
Public property | IndentLevel | Gets or sets the indentation level for the current context. (Inherited from LoggingContext.)
Public property | IsAsync | Determines whether the current LoggingContext represents an async method or an asynchronous custom activity. (Inherited from LoggingContext.)
Public property | IsDisposed | Determines whether the current context has been disposed. (Inherited from LoggingContext.)
Public property | IsSharable | Determines whether the current LoggingContext can be accessed outside of its nominal lifetype (for instance after the method has completed or a custom activity has beeen closed). Since contexts can be pooled and reused, consumers must call the MakeSharable method if they want to keep a reference to the LoggingContext and access it after its nominal lifetime has completed. (Inherited from LoggingContext.)
Public property | Kind | Gets the kind of the current context. (Inherited from LoggingContext.)
Public property | MemberName | Gets the name of the method or property related to the current context. (Inherited from LoggingContext.)
Public property | ParentContext | Gets the LoggingContext that created (initiated) the current context. This is the logical parent. (Overrides LoggingContextParentContext.)
Public property | Source | Gets the LoggingTypeSource corresponding, typically, to the declaring type of the member associated to the current context. (Inherited from LoggingContext.)
Public property | ThreadContext | Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed. (Overrides LoggingContextThreadContext.)
Top
See Also

Reference

EphemeralLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


EphemeralLoggingContext.ActivationContext Property

EphemeralLoggingContextActivationContext Property

Gets the LoggingContext in which the current context was activated. If the current context has been resumed, ActivationContext refers to the context in which the context was resumed.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override LoggingContext ActivationContext { get; }

Property Value

Type: LoggingContext
See Also

Reference

EphemeralLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


EphemeralLoggingContext.ParentContext Property

EphemeralLoggingContextParentContext Property

Gets the LoggingContext that created (initiated) the current context. This is the logical parent.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override LoggingContext ParentContext { get; }

Property Value

Type: LoggingContext
See Also

Reference

EphemeralLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


EphemeralLoggingContext.ThreadContext Property

EphemeralLoggingContextThreadContext Property

Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override ThreadLoggingContext ThreadContext { get; }

Property Value

Type: ThreadLoggingContext
See Also

Reference

EphemeralLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


EphemeralLoggingContext Methods

The EphemeralLoggingContext type exposes the following members.

Methods
 | Name | Description
Public method | CreateCorrelationCookie | Creates a cookie that can be used to correlate, using the SetCorrelation(CorrelationCookie) method, another context to the current context. (Inherited from LoggingContext.)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.)
Protected method | Dispose(Boolean) | Disposes the current object. (Overrides LoggingContextDispose(Boolean).)
Public method | GetCustomRecordBuilder | Gets a LogRecordBuilder for the current context to build a custom record. (Inherited from LoggingContext.)
Public method | GetRecordBuilder | Gets a LogRecordBuilder for the current context to build a standard record for a given method. (Inherited from LoggingContext.)
Public method | MakeSharable | Allows the current context to be shared beyond its normal lifecycle by preventing it from being returned to the pool. (Inherited from LoggingContext.)
Public method | Open | Opens the context.
Protected method | Reset | Resets the current context to its initial, uninitialized state. This method is called by the Dispose method. (Inherited from LoggingContext.)
Public method | SetCorrelation | Associates the current context with another context. (Inherited from LoggingContext.)
Public method | SetWaitDependency | Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts. (Inherited from LoggingContext.)
Public method | ToString | Returns a string that represents the current object. (Inherited from LoggingContext.)
Protected method | ToString(StringBuilder) | Formats a description of the current LoggingContext into a given StringBuilder. (Inherited from LoggingContext.)
Top
See Also

Reference

EphemeralLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


EphemeralLoggingContext.Dispose Method

EphemeralLoggingContextDispose Method

Overload List
 | Name | Description
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.)
Protected method | Dispose(Boolean) | Disposes the current object. (Overrides LoggingContextDispose(Boolean).)
Top
See Also

Reference

EphemeralLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


EphemeralLoggingContext.Dispose Method (Boolean)

EphemeralLoggingContextDispose Method (Boolean)

Disposes the current object.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void Dispose(
    bool disposing
)

Parameters

disposing
Type: SystemBoolean
true if the Dispose method is called explicitly, false is the object is being finalized.
See Also

Reference

EphemeralLoggingContext Class
Dispose Overload
PostSharp.Patterns.Diagnostics.Contexts Namespace


EphemeralLoggingContext.Open Method

EphemeralLoggingContextOpen Method

Opens the context.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void Open(
    LoggingContext parent,
    LoggingTypeSource typeSource
)

Parameters

parent
Type: PostSharp.Patterns.Diagnostics.ContextsLoggingContext
The parent context.
typeSource
Type: PostSharp.Patterns.DiagnosticsLoggingTypeSource
The type emitting the record.
See Also

Reference

EphemeralLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


ICustomActivityLoggingContext Interface

An ILoggingContext that represents a custom activity (LogActivity).

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ICustomActivityLoggingContext : ILoggingContext,
    IDisposable

The ICustomActivityLoggingContext type exposes the following members.

Properties
 | Name | Description
Public property | CustomActivityKind | Gets the kind of LogActivity represented by the current context.
Public property | IsAsync | (Inherited from ILoggingContext.)
Public property | IsDisposed | Determines whether the context is currently disposed (contexts can be recycled, therefore the disposed state is not the final state). (Inherited from ILoggingContext.)
Public property | RecycleId | Gets an integer that is incremented every time the current instance is being recycled. (Inherited from ILoggingContext.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Contexts Namespace


ICustomActivityLoggingContext Properties

The ICustomActivityLoggingContext type exposes the following members.

Properties
 | Name | Description
Public property | CustomActivityKind | Gets the kind of LogActivity represented by the current context.
Public property | IsAsync | (Inherited from ILoggingContext.)
Public property | IsDisposed | Determines whether the context is currently disposed (contexts can be recycled, therefore the disposed state is not the final state). (Inherited from ILoggingContext.)
Public property | RecycleId | Gets an integer that is incremented every time the current instance is being recycled. (Inherited from ILoggingContext.)
Top
See Also

Reference

ICustomActivityLoggingContext Interface
PostSharp.Patterns.Diagnostics.Contexts Namespace


ICustomActivityLoggingContext.CustomActivityKind Property

ICustomActivityLoggingContextCustomActivityKind Property

Gets the kind of LogActivity represented by the current context.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
LogActivityKind CustomActivityKind { get; }

Property Value

Type: LogActivityKind
See Also

Reference

ICustomActivityLoggingContext Interface
PostSharp.Patterns.Diagnostics.Contexts Namespace


ILoggingContext Interface

Defines the minimal semantics of a logging context required by the Logger class.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ILoggingContext : IDisposable

The ILoggingContext type exposes the following members.

Properties
 | Name | Description
Public property | IsAsync |
Public property | IsDisposed | Determines whether the context is currently disposed (contexts can be recycled, therefore the disposed state is not the final state).
Public property | RecycleId | Gets an integer that is incremented every time the current instance is being recycled.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Contexts Namespace


ILoggingContext Properties

The ILoggingContext type exposes the following members.

Properties
 | Name | Description
Public property | IsAsync |
Public property | IsDisposed | Determines whether the context is currently disposed (contexts can be recycled, therefore the disposed state is not the final state).
Public property | RecycleId | Gets an integer that is incremented every time the current instance is being recycled.
Top
See Also

Reference

ILoggingContext Interface
PostSharp.Patterns.Diagnostics.Contexts Namespace


ILoggingContext.IsAsync Property

ILoggingContextIsAsync Property

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
bool IsAsync { get; }

Property Value

Type: Boolean
See Also

Reference

ILoggingContext Interface
PostSharp.Patterns.Diagnostics.Contexts Namespace


ILoggingContext.IsDisposed Property

ILoggingContextIsDisposed Property

Determines whether the context is currently disposed (contexts can be recycled, therefore the disposed state is not the final state).

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
bool IsDisposed { get; }

Property Value

Type: Boolean
See Also

Reference

ILoggingContext Interface
PostSharp.Patterns.Diagnostics.Contexts Namespace


ILoggingContext.RecycleId Property

ILoggingContextRecycleId Property

Gets an integer that is incremented every time the current instance is being recycled.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
int RecycleId { get; }

Property Value

Type: Int32
See Also

Reference

ILoggingContext Interface
PostSharp.Patterns.Diagnostics.Contexts Namespace


IteratorLoggingContext Class

A LoggingContext that represents an iterator.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.ContextsLoggingContext
PostSharp.Patterns.Diagnostics.ContextsSuspendableLoggingContext
PostSharp.Patterns.Diagnostics.ContextsIteratorLoggingContext
PostSharp.Patterns.Diagnostics.Backends.SerilogSerilogIteratorLoggingContext

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class IteratorLoggingContext : SuspendableLoggingContext

The IteratorLoggingContext type exposes the following members.

Constructors
 | Name | Description
Public method | IteratorLoggingContext | Initializes a new IteratorLoggingContext.
Top
Properties
 | Name | Description
Public property | ActivationContext | Gets the LoggingContext in which the current context was activated. If the current context has been resumed, ActivationContext refers to the context in which the context was resumed. (Inherited from LoggingContext.)
Public property | Backend | Gets the parent LoggingBackend of the current context. (Inherited from LoggingContext.)
Public property | Description | Gets the description of the current context. The description is typically set by the LogRecordBuilder when building the opening record of a context. (Inherited from LoggingContext.)
Public property | Id | Gets or set the identifier of the current context. This property should be used for debugging only. Its value is lazily created. (Inherited from LoggingContext.)
Public property | IndentLevel | Gets or sets the indentation level for the current context. (Inherited from LoggingContext.)
Public property | IsAsync | Determines whether the current LoggingContext represents an async method or an asynchronous custom activity. (Inherited from LoggingContext.)
Public property | IsDisposed | Determines whether the current context has been disposed. (Inherited from LoggingContext.)
Public property | IsSharable | Determines whether the current LoggingContext can be accessed outside of its nominal lifetype (for instance after the method has completed or a custom activity has beeen closed). Since contexts can be pooled and reused, consumers must call the MakeSharable method if they want to keep a reference to the LoggingContext and access it after its nominal lifetime has completed. (Inherited from LoggingContext.)
Public property | IsSuspended | Determines whether the current context is currently suspended (between a Suspend and a Resume). (Inherited from SuspendableLoggingContext.)
Public property | Iterator | Gets the iterator object.
Public property | Kind | Gets the kind of the current context. (Inherited from LoggingContext.)
Public property | MemberName | Gets the name of the method or property related to the current context. (Inherited from LoggingContext.)
Public property | ParentContext | Gets the LoggingContext that created (initiated) the current context. This is the logical parent. (Inherited from LoggingContext.)
Public property | Source | Gets the LoggingTypeSource corresponding, typically, to the declaring type of the member associated to the current context. (Inherited from LoggingContext.)
Public property | ThreadContext | Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed. (Inherited from SuspendableLoggingContext.)
Top
Methods
 | Name | Description
Public method | CreateCorrelationCookie | Creates a cookie that can be used to correlate, using the SetCorrelation(CorrelationCookie) method, another context to the current context. (Inherited from LoggingContext.)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from SuspendableLoggingContext.)
Public method | GetCustomRecordBuilder | Gets a LogRecordBuilder for the current context to build a custom record. (Inherited from LoggingContext.)
Public method | GetRecordBuilder | Gets a LogRecordBuilder for the current context to build a standard record for a given method. (Inherited from LoggingContext.)
Public method | MakeSharable | Allows the current context to be shared beyond its normal lifecycle by preventing it from being returned to the pool. (Inherited from LoggingContext.)
Public method | Open | Opens a new IteratorLoggingContext.
Protected method | Reset | Resets the current context to its initial, uninitialized state. This method is called by the Dispose method. (Inherited from LoggingContext.)
Public method | Resume | Resumes the current context. Typically called when the state machine resumes execution, when the wait dependency is satisfied (in case of async methods) or when the MoveNext method is called (in case of iterators). (Inherited from SuspendableLoggingContext.)
Public method | ResumeConditional | Resume the current context, but only if it is currently suspended. (Inherited from SuspendableLoggingContext.)
Public method | SetCorrelation | Associates the current context with another context. (Inherited from LoggingContext.)
Public method | SetWaitDependency | Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts. (Inherited from LoggingContext.)
Public method | Suspend | Suspends the current context. Typically called when starting to wait for a wait dependency (the operand of the await operator in case of async methods), or after the MoveNext method (in case of iterators). (Inherited from SuspendableLoggingContext.)
Public method | ToString | Returns a string that represents the current object. (Inherited from LoggingContext.)
Protected method | ToString(StringBuilder) | Formats a description of the current LoggingContext into a given StringBuilder. (Inherited from SuspendableLoggingContext.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Contexts Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


IteratorLoggingContext Constructor

Initializes a new IteratorLoggingContext.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IteratorLoggingContext(
    LoggingBackend backend
)

Parameters

backend
Type: PostSharp.Patterns.DiagnosticsLoggingBackend
The parent LoggingBackend.
See Also

Reference

IteratorLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


IteratorLoggingContext Properties

The IteratorLoggingContext type exposes the following members.

Properties
 | Name | Description
Public property | ActivationContext | Gets the LoggingContext in which the current context was activated. If the current context has been resumed, ActivationContext refers to the context in which the context was resumed. (Inherited from LoggingContext.)
Public property | Backend | Gets the parent LoggingBackend of the current context. (Inherited from LoggingContext.)
Public property | Description | Gets the description of the current context. The description is typically set by the LogRecordBuilder when building the opening record of a context. (Inherited from LoggingContext.)
Public property | Id | Gets or set the identifier of the current context. This property should be used for debugging only. Its value is lazily created. (Inherited from LoggingContext.)
Public property | IndentLevel | Gets or sets the indentation level for the current context. (Inherited from LoggingContext.)
Public property | IsAsync | Determines whether the current LoggingContext represents an async method or an asynchronous custom activity. (Inherited from LoggingContext.)
Public property | IsDisposed | Determines whether the current context has been disposed. (Inherited from LoggingContext.)
Public property | IsSharable | Determines whether the current LoggingContext can be accessed outside of its nominal lifetype (for instance after the method has completed or a custom activity has beeen closed). Since contexts can be pooled and reused, consumers must call the MakeSharable method if they want to keep a reference to the LoggingContext and access it after its nominal lifetime has completed. (Inherited from LoggingContext.)
Public property | IsSuspended | Determines whether the current context is currently suspended (between a Suspend and a Resume). (Inherited from SuspendableLoggingContext.)
Public property | Iterator | Gets the iterator object.
Public property | Kind | Gets the kind of the current context. (Inherited from LoggingContext.)
Public property | MemberName | Gets the name of the method or property related to the current context. (Inherited from LoggingContext.)
Public property | ParentContext | Gets the LoggingContext that created (initiated) the current context. This is the logical parent. (Inherited from LoggingContext.)
Public property | Source | Gets the LoggingTypeSource corresponding, typically, to the declaring type of the member associated to the current context. (Inherited from LoggingContext.)
Public property | ThreadContext | Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed. (Inherited from SuspendableLoggingContext.)
Top
See Also

Reference

IteratorLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


IteratorLoggingContext.Iterator Property

IteratorLoggingContextIterator Property

Gets the iterator object.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IEnumerator Iterator { get; }

Property Value

Type: IEnumerator
See Also

Reference

IteratorLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


IteratorLoggingContext Methods

The IteratorLoggingContext type exposes the following members.

Methods
 | Name | Description
Public method | CreateCorrelationCookie | Creates a cookie that can be used to correlate, using the SetCorrelation(CorrelationCookie) method, another context to the current context. (Inherited from LoggingContext.)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from SuspendableLoggingContext.)
Public method | GetCustomRecordBuilder | Gets a LogRecordBuilder for the current context to build a custom record. (Inherited from LoggingContext.)
Public method | GetRecordBuilder | Gets a LogRecordBuilder for the current context to build a standard record for a given method. (Inherited from LoggingContext.)
Public method | MakeSharable | Allows the current context to be shared beyond its normal lifecycle by preventing it from being returned to the pool. (Inherited from LoggingContext.)
Public method | Open | Opens a new IteratorLoggingContext.
Protected method | Reset | Resets the current context to its initial, uninitialized state. This method is called by the Dispose method. (Inherited from LoggingContext.)
Public method | Resume | Resumes the current context. Typically called when the state machine resumes execution, when the wait dependency is satisfied (in case of async methods) or when the MoveNext method is called (in case of iterators). (Inherited from SuspendableLoggingContext.)
Public method | ResumeConditional | Resume the current context, but only if it is currently suspended. (Inherited from SuspendableLoggingContext.)
Public method | SetCorrelation | Associates the current context with another context. (Inherited from LoggingContext.)
Public method | SetWaitDependency | Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts. (Inherited from LoggingContext.)
Public method | Suspend | Suspends the current context. Typically called when starting to wait for a wait dependency (the operand of the await operator in case of async methods), or after the MoveNext method (in case of iterators). (Inherited from SuspendableLoggingContext.)
Public method | ToString | Returns a string that represents the current object. (Inherited from LoggingContext.)
Protected method | ToString(StringBuilder) | Formats a description of the current LoggingContext into a given StringBuilder. (Inherited from SuspendableLoggingContext.)
Top
See Also

Reference

IteratorLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


IteratorLoggingContext.Open Method

IteratorLoggingContextOpen Method

Opens a new IteratorLoggingContext.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void Open(
    IEnumerator iterator,
    ref LogMemberInfo memberInfo
)

Parameters

iterator
Type: System.CollectionsIEnumerator
Iterator object associated with the current context.
memberInfo
Type: PostSharp.Patterns.Diagnostics.ContextsLogMemberInfo
Information about the iterator method.
See Also

Reference

IteratorLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


LoggingContext Class

Represents an execution context, typically a method or a user activity.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.ContextsLoggingContext
PostSharp.Patterns.Diagnostics.ContextsEphemeralLoggingContext
PostSharp.Patterns.Diagnostics.ContextsSuspendableLoggingContext
PostSharp.Patterns.Diagnostics.ContextsSyncLoggingContext
PostSharp.Patterns.Diagnostics.ContextsThreadLoggingContext

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class LoggingContext : ILoggingContext,
    IDisposable

The LoggingContext type exposes the following members.

Properties
 | Name | Description
Public property | ActivationContext | Gets the LoggingContext in which the current context was activated. If the current context has been resumed, ActivationContext refers to the context in which the context was resumed.
Public property | Backend | Gets the parent LoggingBackend of the current context.
Public property | Description | Gets the description of the current context. The description is typically set by the LogRecordBuilder when building the opening record of a context.
Public property | Id | Gets or set the identifier of the current context. This property should be used for debugging only. Its value is lazily created.
Public property | IndentLevel | Gets or sets the indentation level for the current context.
Public property | IsAsync | Determines whether the current LoggingContext represents an async method or an asynchronous custom activity.
Public property | IsDisposed | Determines whether the current context has been disposed.
Public property | IsSharable | Determines whether the current LoggingContext can be accessed outside of its nominal lifetype (for instance after the method has completed or a custom activity has beeen closed). Since contexts can be pooled and reused, consumers must call the MakeSharable method if they want to keep a reference to the LoggingContext and access it after its nominal lifetime has completed.
Public property | Kind | Gets the kind of the current context.
Public property | MemberName | Gets the name of the method or property related to the current context.
Public property | ParentContext | Gets the LoggingContext that created (initiated) the current context. This is the logical parent.
Public property | Source | Gets the LoggingTypeSource corresponding, typically, to the declaring type of the member associated to the current context.
Public property | ThreadContext | Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed.
Top
Methods
 | Name | Description
Public method | CreateCorrelationCookie | Creates a cookie that can be used to correlate, using the SetCorrelation(CorrelationCookie) method, another context to the current context.
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Protected method | Dispose(Boolean) | Disposes the current object.
Public method | GetCustomRecordBuilder | Gets a LogRecordBuilder for the current context to build a custom record.
Public method | GetRecordBuilder | Gets a LogRecordBuilder for the current context to build a standard record for a given method.
Public method | MakeSharable | Allows the current context to be shared beyond its normal lifecycle by preventing it from being returned to the pool.
Protected method | Reset | Resets the current context to its initial, uninitialized state. This method is called by the Dispose method.
Public method | SetCorrelation | Associates the current context with another context.
Public method | SetWaitDependency | Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts.
Public method | ToString | Returns a string that represents the current object. (Overrides ObjectToString.)
Protected method | ToString(StringBuilder) | Formats a description of the current LoggingContext into a given StringBuilder.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Contexts Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


LoggingContext Properties

The LoggingContext type exposes the following members.

Properties
 | Name | Description
Public property | ActivationContext | Gets the LoggingContext in which the current context was activated. If the current context has been resumed, ActivationContext refers to the context in which the context was resumed.
Public property | Backend | Gets the parent LoggingBackend of the current context.
Public property | Description | Gets the description of the current context. The description is typically set by the LogRecordBuilder when building the opening record of a context.
Public property | Id | Gets or set the identifier of the current context. This property should be used for debugging only. Its value is lazily created.
Public property | IndentLevel | Gets or sets the indentation level for the current context.
Public property | IsAsync | Determines whether the current LoggingContext represents an async method or an asynchronous custom activity.
Public property | IsDisposed | Determines whether the current context has been disposed.
Public property | IsSharable | Determines whether the current LoggingContext can be accessed outside of its nominal lifetype (for instance after the method has completed or a custom activity has beeen closed). Since contexts can be pooled and reused, consumers must call the MakeSharable method if they want to keep a reference to the LoggingContext and access it after its nominal lifetime has completed.
Public property | Kind | Gets the kind of the current context.
Public property | MemberName | Gets the name of the method or property related to the current context.
Public property | ParentContext | Gets the LoggingContext that created (initiated) the current context. This is the logical parent.
Public property | Source | Gets the LoggingTypeSource corresponding, typically, to the declaring type of the member associated to the current context.
Public property | ThreadContext | Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed.
Top
See Also

Reference

LoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


LoggingContext.ActivationContext Property

LoggingContextActivationContext Property

Gets the LoggingContext in which the current context was activated. If the current context has been resumed, ActivationContext refers to the context in which the context was resumed.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual LoggingContext ActivationContext { get; }

Property Value

Type: LoggingContext
See Also

Reference

LoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


LoggingContext.Backend Property

LoggingContextBackend Property

Gets the parent LoggingBackend of the current context.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingBackend Backend { get; }

Property Value

Type: LoggingBackend
See Also

Reference

LoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


LoggingContext.Description Property

LoggingContextDescription Property

Gets the description of the current context. The description is typically set by the LogRecordBuilder when building the opening record of a context.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public UnsafeString Description { get; }

Property Value

Type: UnsafeString
See Also

Reference

LoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


LoggingContext.Id Property

LoggingContextId Property

Gets or set the identifier of the current context. This property should be used for debugging only. Its value is lazily created.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public long Id { get; }

Property Value

Type: Int64
See Also

Reference

LoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


LoggingContext.IndentLevel Property

LoggingContextIndentLevel Property

Gets or sets the indentation level for the current context.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int IndentLevel { get; protected set; }

Property Value

Type: Int32
See Also

Reference

LoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


LoggingContext.IsAsync Property

LoggingContextIsAsync Property

Determines whether the current LoggingContext represents an async method or an asynchronous custom activity.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsAsync { get; }

Property Value

Type: Boolean

Implements

ILoggingContextIsAsync
See Also

Reference

LoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


LoggingContext.IsDisposed Property

LoggingContextIsDisposed Property

Determines whether the current context has been disposed.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsDisposed { get; }

Property Value

Type: Boolean

Implements

ILoggingContextIsDisposed
See Also

Reference

LoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


LoggingContext.IsSharable Property

LoggingContextIsSharable Property

Determines whether the current LoggingContext can be accessed outside of its nominal lifetype (for instance after the method has completed or a custom activity has beeen closed). Since contexts can be pooled and reused, consumers must call the MakeSharable method if they want to keep a reference to the LoggingContext and access it after its nominal lifetime has completed.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsSharable { get; }

Property Value

Type: Boolean
See Also

Reference

LoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


LoggingContext.Kind Property

LoggingContextKind Property

Gets the kind of the current context.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingContextKind Kind { get; }

Property Value

Type: LoggingContextKind
See Also

Reference

LoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


LoggingContext.MemberName Property

LoggingContextMemberName Property

Gets the name of the method or property related to the current context.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string MemberName { get; protected set; }

Property Value

Type: String
See Also

Reference

LoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


LoggingContext.ParentContext Property

LoggingContextParentContext Property

Gets the LoggingContext that created (initiated) the current context. This is the logical parent.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual LoggingContext ParentContext { get; }

Property Value

Type: LoggingContext
See Also

Reference

LoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


LoggingContext.Source Property

LoggingContextSource Property

Gets the LoggingTypeSource corresponding, typically, to the declaring type of the member associated to the current context.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingTypeSource Source { get; protected set; }

Property Value

Type: LoggingTypeSource
See Also

Reference

LoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


LoggingContext.ThreadContext Property

LoggingContextThreadContext Property

Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract ThreadLoggingContext ThreadContext { get; }

Property Value

Type: ThreadLoggingContext
See Also

Reference

LoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


LoggingContext Methods

The LoggingContext type exposes the following members.

Methods
 | Name | Description
Public method | CreateCorrelationCookie | Creates a cookie that can be used to correlate, using the SetCorrelation(CorrelationCookie) method, another context to the current context.
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Protected method | Dispose(Boolean) | Disposes the current object.
Public method | GetCustomRecordBuilder | Gets a LogRecordBuilder for the current context to build a custom record.
Public method | GetRecordBuilder | Gets a LogRecordBuilder for the current context to build a standard record for a given method.
Public method | MakeSharable | Allows the current context to be shared beyond its normal lifecycle by preventing it from being returned to the pool.
Protected method | Reset | Resets the current context to its initial, uninitialized state. This method is called by the Dispose method.
Public method | SetCorrelation | Associates the current context with another context.
Public method | SetWaitDependency | Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts.
Public method | ToString | Returns a string that represents the current object. (Overrides ObjectToString.)
Protected method | ToString(StringBuilder) | Formats a description of the current LoggingContext into a given StringBuilder.
Top
See Also

Reference

LoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


LoggingContext.CreateCorrelationCookie Method

LoggingContextCreateCorrelationCookie Method

Creates a cookie that can be used to correlate, using the SetCorrelation(CorrelationCookie) method, another context to the current context.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual CorrelationCookie CreateCorrelationCookie()

Return Value

Type: CorrelationCookie
A CorrelationCookie, or Null if the current context (and the current back-end) does not support correlations.
See Also

Reference

LoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


LoggingContext.Dispose Method

LoggingContextDispose Method

Overload List
 | Name | Description
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Protected method | Dispose(Boolean) | Disposes the current object.
Top
See Also

Reference

LoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


LoggingContext.Dispose Method

LoggingContextDispose Method

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Dispose()

Implements

IDisposableDispose
See Also

Reference

LoggingContext Class
Dispose Overload
PostSharp.Patterns.Diagnostics.Contexts Namespace


LoggingContext.Dispose Method (Boolean)

LoggingContextDispose Method (Boolean)

Disposes the current object.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void Dispose(
    bool disposing
)

Parameters

disposing
Type: SystemBoolean
true if the Dispose method is called explicitly, false is the object is being finalized.
See Also

Reference

LoggingContext Class
Dispose Overload
PostSharp.Patterns.Diagnostics.Contexts Namespace


LoggingContext.GetCustomRecordBuilder Method

LoggingContextGetCustomRecordBuilder Method

Gets a LogRecordBuilder for the current context to build a custom record.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogRecordBuilder GetCustomRecordBuilder(
    ref CustomLogRecordInfo recordInfo
)

Parameters

recordInfo
Type: PostSharp.Patterns.Diagnostics.ContextsCustomLogRecordInfo
Information about the record.

Return Value

Type: LogRecordBuilder
A LogRecordBuilder.
See Also

Reference

LoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


LoggingContext.GetRecordBuilder Method

LoggingContextGetRecordBuilder Method

Gets a LogRecordBuilder for the current context to build a standard record for a given method.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogRecordBuilder GetRecordBuilder(
    ref LogRecordInfo logRecordInfo,
    ref LogMemberInfo logMemberInfo
)

Parameters

logRecordInfo
Type: PostSharp.Patterns.Diagnostics.ContextsLogRecordInfo
Information about the record.
logMemberInfo
Type: PostSharp.Patterns.Diagnostics.ContextsLogMemberInfo
Information about the member.

Return Value

Type: LogRecordBuilder
A LogRecordBuilder.
See Also

Reference

LoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


LoggingContext.MakeSharable Method

LoggingContextMakeSharable Method

Allows the current context to be shared beyond its normal lifecycle by preventing it from being returned to the pool.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void MakeSharable()
See Also

Reference

LoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


LoggingContext.Reset Method

LoggingContextReset Method

Resets the current context to its initial, uninitialized state. This method is called by the Dispose method.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected void Reset()
See Also

Reference

LoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


LoggingContext.SetCorrelation Method

LoggingContextSetCorrelation Method

Associates the current context with another context.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void SetCorrelation(
    CorrelationCookie correlationCookie
)

Parameters

correlationCookie
Type: PostSharp.Patterns.Diagnostics.ContextsCorrelationCookie
A CorrelationCookie created by the CreateCorrelationCookie method of another context.
See Also

Reference

LoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


LoggingContext.SetWaitDependency Method

LoggingContextSetWaitDependency Method

Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void SetWaitDependency(
    Object waited
)

Parameters

waited
Type: SystemObject
The "thing" being waited for (for instance a [!:Task] or a [!:TaskInfo]).
See Also

Reference

LoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


LoggingContext.ToString Method

LoggingContextToString Method

Overload List
 | Name | Description
Public method | ToString | Returns a string that represents the current object. (Overrides ObjectToString.)
Protected method | ToString(StringBuilder) | Formats a description of the current LoggingContext into a given StringBuilder.
Top
See Also

Reference

LoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


LoggingContext.ToString Method

LoggingContextToString Method

Returns a string that represents the current object.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override sealed string ToString()

Return Value

Type: String
A string that represents the current object.
See Also

Reference

LoggingContext Class
ToString Overload
PostSharp.Patterns.Diagnostics.Contexts Namespace


LoggingContext.ToString Method (StringBuilder)

LoggingContextToString Method (StringBuilder)

Formats a description of the current LoggingContext into a given StringBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void ToString(
    StringBuilder stringBuilder
)

Parameters

stringBuilder
Type: System.TextStringBuilder
See Also

Reference

LoggingContext Class
ToString Overload
PostSharp.Patterns.Diagnostics.Contexts Namespace


LoggingContextKind Enumeration

Kinds of logging contexts.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum LoggingContextKind
Members
Member name | Value | Description
Thread | 0 | Thread.
AsyncMethod | 1 | Async method.
SyncMethod | 2 | Normal method (not async, not iterator).
SyncCustomActivity | 3 | Synchronous custom activity.
AsyncCustomActivity | 4 | Asynchronous custom activity.
Ephemeral | 5 | Ephemeral (one-use context).
Iterator | 6 | Iterator.
See Also

Reference

PostSharp.Patterns.Diagnostics.Contexts Namespace


LogMemberInfo Structure

Stores information regarding the method, field or property being logged.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public struct LogMemberInfo

The LogMemberInfo type exposes the following members.

Constructors
 | Name | Description
Public method | LogMemberInfo(LoggingProfile, LoggingTypeSource, String, Int32, Int32, Int32) | Initializes a new LogMemberInfo.
Public method | LogMemberInfo(LoggingProfile, LoggingTypeSource, String, Int32, Int32, Int32, String, Int32, Int32) | Initializes a new LogMemberInfo and specifies file-line information.
Top
Properties
 | Name | Description
Public property | GenericParameterCount | Gets the number of generic parameters of the method.
Public property | MemberName | Gets the name of the method, property, or field.
Public property | ParameterCount | Gets the number of parameters of the method.
Public property | Profile | Gets the LoggingProfile with which the method is being logged.
Public property | ReturnValueCount | Gets the number of return values of the method.
Public property | Source | Gets information about the source type.
Public property | SourceLineInfo | Gets information about the source code location of the method, property, or field.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Contexts Namespace


LogMemberInfo Constructor

Overload List
 | Name | Description
Public method | LogMemberInfo(LoggingProfile, LoggingTypeSource, String, Int32, Int32, Int32) | Initializes a new LogMemberInfo.
Public method | LogMemberInfo(LoggingProfile, LoggingTypeSource, String, Int32, Int32, Int32, String, Int32, Int32) | Initializes a new LogMemberInfo and specifies file-line information.
Top
See Also

Reference

LogMemberInfo Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


LogMemberInfo Constructor (LoggingProfile, LoggingTypeSource, String, Int32, Int32, Int32)

Initializes a new LogMemberInfo.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogMemberInfo(
    LoggingProfile profile,
    LoggingTypeSource source,
    string memberName,
    int parameterCount,
    int returnValueCount,
    int genericParameterCount
)

Parameters

profile
Type: PostSharp.Patterns.DiagnosticsLoggingProfile
The parent LoggingProfile.
source
Type: PostSharp.Patterns.DiagnosticsLoggingTypeSource
Information about the source type.
memberName
Type: SystemString
Name of the method, property, or field.
parameterCount
Type: SystemInt32
Number of parameters in the method.
returnValueCount
Type: SystemInt32
Number of return values.
genericParameterCount
Type: SystemInt32
Number of generic method parameters.
See Also

Reference

LogMemberInfo Structure
LogMemberInfo Overload
PostSharp.Patterns.Diagnostics.Contexts Namespace


LogMemberInfo Constructor (LoggingProfile, LoggingTypeSource, String, Int32, Int32, Int32, String, Int32, Int32)

Initializes a new LogMemberInfo and specifies file-line information.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogMemberInfo(
    LoggingProfile profile,
    LoggingTypeSource source,
    string memberName,
    int parameterCount,
    int returnValueCount,
    int genericParameterCount,
    string file,
    int line,
    int column
)

Parameters

profile
Type: PostSharp.Patterns.DiagnosticsLoggingProfile
The parent LoggingProfile.
source
Type: PostSharp.Patterns.DiagnosticsLoggingTypeSource
Information about the source type.
memberName
Type: SystemString
Name of the method, property, or field.
parameterCount
Type: SystemInt32
Number of parameters in the method.
returnValueCount
Type: SystemInt32
Number of return values.
genericParameterCount
Type: SystemInt32
Number of generic method parameters.
file
Type: SystemString
Path of the file containing the source code of the logged method.
line
Type: SystemInt32
Line of the source code of the logged method in file.
column
Type: SystemInt32
Column of the source code of the logged method in file.
See Also

Reference

LogMemberInfo Structure
LogMemberInfo Overload
PostSharp.Patterns.Diagnostics.Contexts Namespace


LogMemberInfo Properties

The LogMemberInfo type exposes the following members.

Properties
 | Name | Description
Public property | GenericParameterCount | Gets the number of generic parameters of the method.
Public property | MemberName | Gets the name of the method, property, or field.
Public property | ParameterCount | Gets the number of parameters of the method.
Public property | Profile | Gets the LoggingProfile with which the method is being logged.
Public property | ReturnValueCount | Gets the number of return values of the method.
Public property | Source | Gets information about the source type.
Public property | SourceLineInfo | Gets information about the source code location of the method, property, or field.
Top
See Also

Reference

LogMemberInfo Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


LogMemberInfo.GenericParameterCount Property

LogMemberInfoGenericParameterCount Property

Gets the number of generic parameters of the method.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int GenericParameterCount { get; }

Property Value

Type: Int32
See Also

Reference

LogMemberInfo Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


LogMemberInfo.MemberName Property

LogMemberInfoMemberName Property

Gets the name of the method, property, or field.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string MemberName { get; }

Property Value

Type: String
See Also

Reference

LogMemberInfo Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


LogMemberInfo.ParameterCount Property

LogMemberInfoParameterCount Property

Gets the number of parameters of the method.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int ParameterCount { get; }

Property Value

Type: Int32
See Also

Reference

LogMemberInfo Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


LogMemberInfo.Profile Property

LogMemberInfoProfile Property

Gets the LoggingProfile with which the method is being logged.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingProfile Profile { get; }

Property Value

Type: LoggingProfile
See Also

Reference

LogMemberInfo Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


LogMemberInfo.ReturnValueCount Property

LogMemberInfoReturnValueCount Property

Gets the number of return values of the method.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int ReturnValueCount { get; }

Property Value

Type: Int32
See Also

Reference

LogMemberInfo Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


LogMemberInfo.Source Property

LogMemberInfoSource Property

Gets information about the source type.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingTypeSource Source { get; }

Property Value

Type: LoggingTypeSource
See Also

Reference

LogMemberInfo Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


LogMemberInfo.SourceLineInfo Property

LogMemberInfoSourceLineInfo Property

Gets information about the source code location of the method, property, or field.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SourceLineInfo SourceLineInfo { get; }

Property Value

Type: SourceLineInfo
See Also

Reference

LogMemberInfo Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


LogRecordInfo Structure

Contains information about a log record.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public struct LogRecordInfo

The LogRecordInfo type exposes the following members.

Constructors
 | Name | Description
Public method | LogRecordInfo | Initializes a LogRecordInfo.
Top
Properties
 | Name | Description
Public property | Id | Unique identifier of the static parts of the record, which can be used for caching the message template.
Public property | Options | Gets the LoggingOptions that apply to this record.
Public property | RecordKind | The kind of this record (e.g. MethodEntry or MethodException).
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Contexts Namespace


LogRecordInfo Constructor

Initializes a LogRecordInfo.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogRecordInfo(
    LogRecordKind recordKind,
    LoggingOptions options,
    long id
)

Parameters

recordKind
Type: PostSharp.Patterns.DiagnosticsLogRecordKind
Record kind.
options
Type: PostSharp.Patterns.DiagnosticsLoggingOptions
Options.
id
Type: SystemInt64
Unique id of the record, used for caching.
See Also

Reference

LogRecordInfo Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


LogRecordInfo Properties

The LogRecordInfo type exposes the following members.

Properties
 | Name | Description
Public property | Id | Unique identifier of the static parts of the record, which can be used for caching the message template.
Public property | Options | Gets the LoggingOptions that apply to this record.
Public property | RecordKind | The kind of this record (e.g. MethodEntry or MethodException).
Top
See Also

Reference

LogRecordInfo Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


LogRecordInfo.Id Property

LogRecordInfoId Property

Unique identifier of the static parts of the record, which can be used for caching the message template.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public long Id { get; }

Property Value

Type: Int64
See Also

Reference

LogRecordInfo Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


LogRecordInfo.Options Property

LogRecordInfoOptions Property

Gets the LoggingOptions that apply to this record.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingOptions Options { get; }

Property Value

Type: LoggingOptions
See Also

Reference

LogRecordInfo Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


LogRecordInfo.RecordKind Property

LogRecordInfoRecordKind Property

The kind of this record (e.g. MethodEntry or MethodException).

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogRecordKind RecordKind { get; }

Property Value

Type: LogRecordKind
See Also

Reference

LogRecordInfo Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


SourceLineInfo Structure

Represents a position in a file of source code.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public struct SourceLineInfo

The SourceLineInfo type exposes the following members.

Constructors
 | Name | Description
Public method | SourceLineInfo | Initializes a new SourceLineInfo.
Top
Properties
 | Name | Description
Public property | Column | Gets the column in File.
Public property | File | Gets the path to the source code file.
Public property | IsNull | Determines whether the current SourceLineInfo is null.
Public property | Line | Gets the line in File.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Contexts Namespace


SourceLineInfo Constructor

Initializes a new SourceLineInfo.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SourceLineInfo(
    string file,
    int line,
    int column
)

Parameters

file
Type: SystemString
Path to the source code file.
line
Type: SystemInt32
Line in file.
column
Type: SystemInt32
Column in file.
See Also

Reference

SourceLineInfo Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


SourceLineInfo Properties

The SourceLineInfo type exposes the following members.

Properties
 | Name | Description
Public property | Column | Gets the column in File.
Public property | File | Gets the path to the source code file.
Public property | IsNull | Determines whether the current SourceLineInfo is null.
Public property | Line | Gets the line in File.
Top
See Also

Reference

SourceLineInfo Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


SourceLineInfo.Column Property

SourceLineInfoColumn Property

Gets the column in File.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int Column { get; }

Property Value

Type: Int32
See Also

Reference

SourceLineInfo Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


SourceLineInfo.File Property

SourceLineInfoFile Property

Gets the path to the source code file.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string File { get; }

Property Value

Type: String
See Also

Reference

SourceLineInfo Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


SourceLineInfo.IsNull Property

SourceLineInfoIsNull Property

Determines whether the current SourceLineInfo is null.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsNull { get; }

Property Value

Type: Boolean
See Also

Reference

SourceLineInfo Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


SourceLineInfo.Line Property

SourceLineInfoLine Property

Gets the line in File.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int Line { get; }

Property Value

Type: Int32
See Also

Reference

SourceLineInfo Structure
PostSharp.Patterns.Diagnostics.Contexts Namespace


SuspendableLoggingContext Class

A LoggingContext that represents a method or activity that can be suspended and resume (possibly on a different thread), such as an async method or an iterator.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.ContextsLoggingContext
PostSharp.Patterns.Diagnostics.ContextsSuspendableLoggingContext
PostSharp.Patterns.Diagnostics.ContextsAsyncLoggingContext
PostSharp.Patterns.Diagnostics.ContextsIteratorLoggingContext

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class SuspendableLoggingContext : LoggingContext

The SuspendableLoggingContext type exposes the following members.

Properties
 | Name | Description
Public property | ActivationContext | Gets the LoggingContext in which the current context was activated. If the current context has been resumed, ActivationContext refers to the context in which the context was resumed. (Inherited from LoggingContext.)
Public property | Backend | Gets the parent LoggingBackend of the current context. (Inherited from LoggingContext.)
Public property | Description | Gets the description of the current context. The description is typically set by the LogRecordBuilder when building the opening record of a context. (Inherited from LoggingContext.)
Public property | Id | Gets or set the identifier of the current context. This property should be used for debugging only. Its value is lazily created. (Inherited from LoggingContext.)
Public property | IndentLevel | Gets or sets the indentation level for the current context. (Inherited from LoggingContext.)
Public property | IsAsync | Determines whether the current LoggingContext represents an async method or an asynchronous custom activity. (Inherited from LoggingContext.)
Public property | IsDisposed | Determines whether the current context has been disposed. (Inherited from LoggingContext.)
Public property | IsSharable | Determines whether the current LoggingContext can be accessed outside of its nominal lifetype (for instance after the method has completed or a custom activity has beeen closed). Since contexts can be pooled and reused, consumers must call the MakeSharable method if they want to keep a reference to the LoggingContext and access it after its nominal lifetime has completed. (Inherited from LoggingContext.)
Public property | IsSuspended | Determines whether the current context is currently suspended (between a Suspend and a Resume).
Public property | Kind | Gets the kind of the current context. (Inherited from LoggingContext.)
Public property | MemberName | Gets the name of the method or property related to the current context. (Inherited from LoggingContext.)
Public property | ParentContext | Gets the LoggingContext that created (initiated) the current context. This is the logical parent. (Inherited from LoggingContext.)
Public property | Source | Gets the LoggingTypeSource corresponding, typically, to the declaring type of the member associated to the current context. (Inherited from LoggingContext.)
Public property | ThreadContext | Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed. (Overrides LoggingContextThreadContext.)
Top
Methods
 | Name | Description
Public method | CreateCorrelationCookie | Creates a cookie that can be used to correlate, using the SetCorrelation(CorrelationCookie) method, another context to the current context. (Inherited from LoggingContext.)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.)
Protected method | Dispose(Boolean) | Disposes the current object. (Overrides LoggingContextDispose(Boolean).)
Public method | GetCustomRecordBuilder | Gets a LogRecordBuilder for the current context to build a custom record. (Inherited from LoggingContext.)
Public method | GetRecordBuilder | Gets a LogRecordBuilder for the current context to build a standard record for a given method. (Inherited from LoggingContext.)
Public method | MakeSharable | Allows the current context to be shared beyond its normal lifecycle by preventing it from being returned to the pool. (Inherited from LoggingContext.)
Protected method | Reset | Resets the current context to its initial, uninitialized state. This method is called by the Dispose method. (Inherited from LoggingContext.)
Public method | Resume | Resumes the current context. Typically called when the state machine resumes execution, when the wait dependency is satisfied (in case of async methods) or when the MoveNext method is called (in case of iterators).
Public method | ResumeConditional | Resume the current context, but only if it is currently suspended.
Public method | SetCorrelation | Associates the current context with another context. (Inherited from LoggingContext.)
Public method | SetWaitDependency | Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts. (Inherited from LoggingContext.)
Public method | Suspend | Suspends the current context. Typically called when starting to wait for a wait dependency (the operand of the await operator in case of async methods), or after the MoveNext method (in case of iterators).
Public method | ToString | Returns a string that represents the current object. (Inherited from LoggingContext.)
Protected method | ToString(StringBuilder) | Formats a description of the current LoggingContext into a given StringBuilder. (Overrides LoggingContextToString(StringBuilder).)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Contexts Namespace


SuspendableLoggingContext Properties

The SuspendableLoggingContext type exposes the following members.

Properties
 | Name | Description
Public property | ActivationContext | Gets the LoggingContext in which the current context was activated. If the current context has been resumed, ActivationContext refers to the context in which the context was resumed. (Inherited from LoggingContext.)
Public property | Backend | Gets the parent LoggingBackend of the current context. (Inherited from LoggingContext.)
Public property | Description | Gets the description of the current context. The description is typically set by the LogRecordBuilder when building the opening record of a context. (Inherited from LoggingContext.)
Public property | Id | Gets or set the identifier of the current context. This property should be used for debugging only. Its value is lazily created. (Inherited from LoggingContext.)
Public property | IndentLevel | Gets or sets the indentation level for the current context. (Inherited from LoggingContext.)
Public property | IsAsync | Determines whether the current LoggingContext represents an async method or an asynchronous custom activity. (Inherited from LoggingContext.)
Public property | IsDisposed | Determines whether the current context has been disposed. (Inherited from LoggingContext.)
Public property | IsSharable | Determines whether the current LoggingContext can be accessed outside of its nominal lifetype (for instance after the method has completed or a custom activity has beeen closed). Since contexts can be pooled and reused, consumers must call the MakeSharable method if they want to keep a reference to the LoggingContext and access it after its nominal lifetime has completed. (Inherited from LoggingContext.)
Public property | IsSuspended | Determines whether the current context is currently suspended (between a Suspend and a Resume).
Public property | Kind | Gets the kind of the current context. (Inherited from LoggingContext.)
Public property | MemberName | Gets the name of the method or property related to the current context. (Inherited from LoggingContext.)
Public property | ParentContext | Gets the LoggingContext that created (initiated) the current context. This is the logical parent. (Inherited from LoggingContext.)
Public property | Source | Gets the LoggingTypeSource corresponding, typically, to the declaring type of the member associated to the current context. (Inherited from LoggingContext.)
Public property | ThreadContext | Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed. (Overrides LoggingContextThreadContext.)
Top
See Also

Reference

SuspendableLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


SuspendableLoggingContext.IsSuspended Property

SuspendableLoggingContextIsSuspended Property

Determines whether the current context is currently suspended (between a Suspend and a Resume).

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsSuspended { get; }

Property Value

Type: Boolean
See Also

Reference

SuspendableLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


SuspendableLoggingContext.ThreadContext Property

SuspendableLoggingContextThreadContext Property

Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override ThreadLoggingContext ThreadContext { get; }

Property Value

Type: ThreadLoggingContext
See Also

Reference

SuspendableLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


SuspendableLoggingContext Methods

The SuspendableLoggingContext type exposes the following members.

Methods
 | Name | Description
Public method | CreateCorrelationCookie | Creates a cookie that can be used to correlate, using the SetCorrelation(CorrelationCookie) method, another context to the current context. (Inherited from LoggingContext.)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.)
Protected method | Dispose(Boolean) | Disposes the current object. (Overrides LoggingContextDispose(Boolean).)
Public method | GetCustomRecordBuilder | Gets a LogRecordBuilder for the current context to build a custom record. (Inherited from LoggingContext.)
Public method | GetRecordBuilder | Gets a LogRecordBuilder for the current context to build a standard record for a given method. (Inherited from LoggingContext.)
Public method | MakeSharable | Allows the current context to be shared beyond its normal lifecycle by preventing it from being returned to the pool. (Inherited from LoggingContext.)
Protected method | Reset | Resets the current context to its initial, uninitialized state. This method is called by the Dispose method. (Inherited from LoggingContext.)
Public method | Resume | Resumes the current context. Typically called when the state machine resumes execution, when the wait dependency is satisfied (in case of async methods) or when the MoveNext method is called (in case of iterators).
Public method | ResumeConditional | Resume the current context, but only if it is currently suspended.
Public method | SetCorrelation | Associates the current context with another context. (Inherited from LoggingContext.)
Public method | SetWaitDependency | Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts. (Inherited from LoggingContext.)
Public method | Suspend | Suspends the current context. Typically called when starting to wait for a wait dependency (the operand of the await operator in case of async methods), or after the MoveNext method (in case of iterators).
Public method | ToString | Returns a string that represents the current object. (Inherited from LoggingContext.)
Protected method | ToString(StringBuilder) | Formats a description of the current LoggingContext into a given StringBuilder. (Overrides LoggingContextToString(StringBuilder).)
Top
See Also

Reference

SuspendableLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


SuspendableLoggingContext.Dispose Method

SuspendableLoggingContextDispose Method

Overload List
 | Name | Description
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.)
Protected method | Dispose(Boolean) | Disposes the current object. (Overrides LoggingContextDispose(Boolean).)
Top
See Also

Reference

SuspendableLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


SuspendableLoggingContext.Dispose Method (Boolean)

SuspendableLoggingContextDispose Method (Boolean)

Disposes the current object.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void Dispose(
    bool disposing
)

Parameters

disposing
Type: SystemBoolean
true if the Dispose method is called explicitly, false is the object is being finalized.
See Also

Reference

SuspendableLoggingContext Class
Dispose Overload
PostSharp.Patterns.Diagnostics.Contexts Namespace


SuspendableLoggingContext.Resume Method

SuspendableLoggingContextResume Method

Resumes the current context. Typically called when the state machine resumes execution, when the wait dependency is satisfied (in case of async methods) or when the MoveNext method is called (in case of iterators).

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void Resume()
See Also

Reference

SuspendableLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


SuspendableLoggingContext.ResumeConditional Method

SuspendableLoggingContextResumeConditional Method

Resume the current context, but only if it is currently suspended.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void ResumeConditional()
See Also

Reference

SuspendableLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


SuspendableLoggingContext.Suspend Method

SuspendableLoggingContextSuspend Method

Suspends the current context. Typically called when starting to wait for a wait dependency (the operand of the await operator in case of async methods), or after the MoveNext method (in case of iterators).

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void Suspend()
Remarks

In case of iterators, the Suspend method is only invoked when MoveNext returns true. Otherwise, the Dispose(Boolean) method is invoked.

See Also

Reference

SuspendableLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


SuspendableLoggingContext.ToString Method

SuspendableLoggingContextToString Method

Overload List
 | Name | Description
Public method | ToString | Returns a string that represents the current object. (Inherited from LoggingContext.)
Protected method | ToString(StringBuilder) | Formats a description of the current LoggingContext into a given StringBuilder. (Overrides LoggingContextToString(StringBuilder).)
Top
See Also

Reference

SuspendableLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


SuspendableLoggingContext.ToString Method (StringBuilder)

SuspendableLoggingContextToString Method (StringBuilder)

Formats a description of the current LoggingContext into a given StringBuilder.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void ToString(
    StringBuilder stringBuilder
)

Parameters

stringBuilder
Type: System.TextStringBuilder
See Also

Reference

SuspendableLoggingContext Class
ToString Overload
PostSharp.Patterns.Diagnostics.Contexts Namespace


SyncCustomActivityLoggingContext Class

A LoggingContext that represents a synchronous custom activity, opened by the OpenActivity(String) method.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.ContextsLoggingContext
PostSharp.Patterns.Diagnostics.ContextsSyncLoggingContext
PostSharp.Patterns.Diagnostics.ContextsSyncCustomActivityLoggingContext
PostSharp.Patterns.Diagnostics.Backends.SerilogSerilogSyncCustomActivityContext

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class SyncCustomActivityLoggingContext : SyncLoggingContext,
    ICustomActivityLoggingContext, ILoggingContext, IDisposable

The SyncCustomActivityLoggingContext type exposes the following members.

Constructors
 | Name | Description
Public method | SyncCustomActivityLoggingContext | Initializes a new SyncCustomActivityLoggingContext.
Top
Properties
 | Name | Description
Public property | ActivationContext | Gets the LoggingContext in which the current context was activated. If the current context has been resumed, ActivationContext refers to the context in which the context was resumed. (Inherited from LoggingContext.)
Public property | Backend | Gets the parent LoggingBackend of the current context. (Inherited from LoggingContext.)
Public property | CustomActivityKind | Gets the kind of LogActivity represented by the current context.
Public property | Description | Gets the description of the current context. The description is typically set by the LogRecordBuilder when building the opening record of a context. (Inherited from LoggingContext.)
Public property | Id | Gets or set the identifier of the current context. This property should be used for debugging only. Its value is lazily created. (Inherited from LoggingContext.)
Public property | IndentLevel | Gets or sets the indentation level for the current context. (Inherited from LoggingContext.)
Public property | IsAsync | Determines whether the current LoggingContext represents an async method or an asynchronous custom activity. (Inherited from LoggingContext.)
Public property | IsDisposed | Determines whether the current context has been disposed. (Inherited from LoggingContext.)
Public property | IsSharable | Determines whether the current LoggingContext can be accessed outside of its nominal lifetype (for instance after the method has completed or a custom activity has beeen closed). Since contexts can be pooled and reused, consumers must call the MakeSharable method if they want to keep a reference to the LoggingContext and access it after its nominal lifetime has completed. (Inherited from LoggingContext.)
Public property | Kind | Gets the kind of the current context. (Inherited from LoggingContext.)
Public property | MemberName | Gets the name of the method or property related to the current context. (Inherited from LoggingContext.)
Public property | ParentContext | Gets the LoggingContext that created (initiated) the current context. This is the logical parent. (Inherited from LoggingContext.)
Public property | Source | Gets the LoggingTypeSource corresponding, typically, to the declaring type of the member associated to the current context. (Inherited from LoggingContext.)
Public property | ThreadContext | Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed. (Inherited from SyncLoggingContext.)
Top
Methods
 | Name | Description
Public method | CreateCorrelationCookie | Creates a cookie that can be used to correlate, using the SetCorrelation(CorrelationCookie) method, another context to the current context. (Inherited from LoggingContext.)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from SyncLoggingContext.)
Public method | GetCustomRecordBuilder | Gets a LogRecordBuilder for the current context to build a custom record. (Inherited from LoggingContext.)
Public method | GetRecordBuilder | Gets a LogRecordBuilder for the current context to build a standard record for a given method. (Inherited from LoggingContext.)
Public method | MakeSharable | Allows the current context to be shared beyond its normal lifecycle by preventing it from being returned to the pool. (Inherited from LoggingContext.)
Public method | Open | Opens the current context.
Protected method | Reset | Resets the current context to its initial, uninitialized state. This method is called by the Dispose method. (Inherited from LoggingContext.)
Protected method | ReturnToPool | Returns the current instance to the pool to which it belongs. This method is invoked by the Dispose(Boolean) method. (Overrides SyncLoggingContextReturnToPool.)
Public method | SetCorrelation | Associates the current context with another context. (Inherited from LoggingContext.)
Public method | SetWaitDependency | Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts. (Overrides LoggingContextSetWaitDependency(Object).)
Public method | ToString | Returns a string that represents the current object. (Inherited from LoggingContext.)
Protected method | ToString(StringBuilder) | Formats a description of the current LoggingContext into a given StringBuilder. (Inherited from LoggingContext.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Contexts Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


SyncCustomActivityLoggingContext Constructor

Initializes a new SyncCustomActivityLoggingContext.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SyncCustomActivityLoggingContext(
    ThreadLoggingContext threadContext
)

Parameters

threadContext
Type: PostSharp.Patterns.Diagnostics.ContextsThreadLoggingContext
The SyncCustomActivityLoggingContext in which the activity is executed.
See Also

Reference

SyncCustomActivityLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


SyncCustomActivityLoggingContext Properties

The SyncCustomActivityLoggingContext type exposes the following members.

Properties
 | Name | Description
Public property | ActivationContext | Gets the LoggingContext in which the current context was activated. If the current context has been resumed, ActivationContext refers to the context in which the context was resumed. (Inherited from LoggingContext.)
Public property | Backend | Gets the parent LoggingBackend of the current context. (Inherited from LoggingContext.)
Public property | CustomActivityKind | Gets the kind of LogActivity represented by the current context.
Public property | Description | Gets the description of the current context. The description is typically set by the LogRecordBuilder when building the opening record of a context. (Inherited from LoggingContext.)
Public property | Id | Gets or set the identifier of the current context. This property should be used for debugging only. Its value is lazily created. (Inherited from LoggingContext.)
Public property | IndentLevel | Gets or sets the indentation level for the current context. (Inherited from LoggingContext.)
Public property | IsAsync | Determines whether the current LoggingContext represents an async method or an asynchronous custom activity. (Inherited from LoggingContext.)
Public property | IsDisposed | Determines whether the current context has been disposed. (Inherited from LoggingContext.)
Public property | IsSharable | Determines whether the current LoggingContext can be accessed outside of its nominal lifetype (for instance after the method has completed or a custom activity has beeen closed). Since contexts can be pooled and reused, consumers must call the MakeSharable method if they want to keep a reference to the LoggingContext and access it after its nominal lifetime has completed. (Inherited from LoggingContext.)
Public property | Kind | Gets the kind of the current context. (Inherited from LoggingContext.)
Public property | MemberName | Gets the name of the method or property related to the current context. (Inherited from LoggingContext.)
Public property | ParentContext | Gets the LoggingContext that created (initiated) the current context. This is the logical parent. (Inherited from LoggingContext.)
Public property | Source | Gets the LoggingTypeSource corresponding, typically, to the declaring type of the member associated to the current context. (Inherited from LoggingContext.)
Public property | ThreadContext | Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed. (Inherited from SyncLoggingContext.)
Top
See Also

Reference

SyncCustomActivityLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


SyncCustomActivityLoggingContext.CustomActivityKind Property

SyncCustomActivityLoggingContextCustomActivityKind Property

Gets the kind of LogActivity represented by the current context.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogActivityKind CustomActivityKind { get; }

Property Value

Type: LogActivityKind

Implements

ICustomActivityLoggingContextCustomActivityKind
See Also

Reference

SyncCustomActivityLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


SyncCustomActivityLoggingContext Methods

The SyncCustomActivityLoggingContext type exposes the following members.

Methods
 | Name | Description
Public method | CreateCorrelationCookie | Creates a cookie that can be used to correlate, using the SetCorrelation(CorrelationCookie) method, another context to the current context. (Inherited from LoggingContext.)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from SyncLoggingContext.)
Public method | GetCustomRecordBuilder | Gets a LogRecordBuilder for the current context to build a custom record. (Inherited from LoggingContext.)
Public method | GetRecordBuilder | Gets a LogRecordBuilder for the current context to build a standard record for a given method. (Inherited from LoggingContext.)
Public method | MakeSharable | Allows the current context to be shared beyond its normal lifecycle by preventing it from being returned to the pool. (Inherited from LoggingContext.)
Public method | Open | Opens the current context.
Protected method | Reset | Resets the current context to its initial, uninitialized state. This method is called by the Dispose method. (Inherited from LoggingContext.)
Protected method | ReturnToPool | Returns the current instance to the pool to which it belongs. This method is invoked by the Dispose(Boolean) method. (Overrides SyncLoggingContextReturnToPool.)
Public method | SetCorrelation | Associates the current context with another context. (Inherited from LoggingContext.)
Public method | SetWaitDependency | Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts. (Overrides LoggingContextSetWaitDependency(Object).)
Public method | ToString | Returns a string that represents the current object. (Inherited from LoggingContext.)
Protected method | ToString(StringBuilder) | Formats a description of the current LoggingContext into a given StringBuilder. (Inherited from LoggingContext.)
Top
See Also

Reference

SyncCustomActivityLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


SyncCustomActivityLoggingContext.Open Method

SyncCustomActivityLoggingContextOpen Method

Opens the current context.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void Open(
    LoggingTypeSource typeSource,
    LogActivityOptions options
)

Parameters

typeSource
Type: PostSharp.Patterns.DiagnosticsLoggingTypeSource
The LoggingTypeSource for the declaring type of the context.
options
Type: PostSharp.Patterns.DiagnosticsLogActivityOptions
Options of the opened custom context.
See Also

Reference

SyncCustomActivityLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


SyncCustomActivityLoggingContext.ReturnToPool Method

SyncCustomActivityLoggingContextReturnToPool Method

Returns the current instance to the pool to which it belongs. This method is invoked by the Dispose(Boolean) method.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void ReturnToPool()
See Also

Reference

SyncCustomActivityLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


SyncCustomActivityLoggingContext.SetWaitDependency Method

SyncCustomActivityLoggingContextSetWaitDependency Method

Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void SetWaitDependency(
    Object waited
)

Parameters

waited
Type: SystemObject
The "thing" being waited for (for instance a [!:Task] or a [!:TaskInfo]).
See Also

Reference

SyncCustomActivityLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


SyncLoggingContext Class

A LoggingContext that represents a synchronous context (i.e. a context that executes as a single block, without being suspended).
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.ContextsLoggingContext
PostSharp.Patterns.Diagnostics.ContextsSyncLoggingContext
PostSharp.Patterns.Diagnostics.ContextsSyncCustomActivityLoggingContext
PostSharp.Patterns.Diagnostics.ContextsSyncMethodLoggingContext

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class SyncLoggingContext : LoggingContext

The SyncLoggingContext type exposes the following members.

Properties
 | Name | Description
Public property | ActivationContext | Gets the LoggingContext in which the current context was activated. If the current context has been resumed, ActivationContext refers to the context in which the context was resumed. (Inherited from LoggingContext.)
Public property | Backend | Gets the parent LoggingBackend of the current context. (Inherited from LoggingContext.)
Public property | Description | Gets the description of the current context. The description is typically set by the LogRecordBuilder when building the opening record of a context. (Inherited from LoggingContext.)
Public property | Id | Gets or set the identifier of the current context. This property should be used for debugging only. Its value is lazily created. (Inherited from LoggingContext.)
Public property | IndentLevel | Gets or sets the indentation level for the current context. (Inherited from LoggingContext.)
Public property | IsAsync | Determines whether the current LoggingContext represents an async method or an asynchronous custom activity. (Inherited from LoggingContext.)
Public property | IsDisposed | Determines whether the current context has been disposed. (Inherited from LoggingContext.)
Public property | IsSharable | Determines whether the current LoggingContext can be accessed outside of its nominal lifetype (for instance after the method has completed or a custom activity has beeen closed). Since contexts can be pooled and reused, consumers must call the MakeSharable method if they want to keep a reference to the LoggingContext and access it after its nominal lifetime has completed. (Inherited from LoggingContext.)
Public property | Kind | Gets the kind of the current context. (Inherited from LoggingContext.)
Public property | MemberName | Gets the name of the method or property related to the current context. (Inherited from LoggingContext.)
Public property | ParentContext | Gets the LoggingContext that created (initiated) the current context. This is the logical parent. (Inherited from LoggingContext.)
Public property | Source | Gets the LoggingTypeSource corresponding, typically, to the declaring type of the member associated to the current context. (Inherited from LoggingContext.)
Public property | ThreadContext | Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed. (Overrides LoggingContextThreadContext.)
Top
Methods
 | Name | Description
Public method | CreateCorrelationCookie | Creates a cookie that can be used to correlate, using the SetCorrelation(CorrelationCookie) method, another context to the current context. (Inherited from LoggingContext.)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.)
Protected method | Dispose(Boolean) | Disposes the current object. (Overrides LoggingContextDispose(Boolean).)
Public method | GetCustomRecordBuilder | Gets a LogRecordBuilder for the current context to build a custom record. (Inherited from LoggingContext.)
Public method | GetRecordBuilder | Gets a LogRecordBuilder for the current context to build a standard record for a given method. (Inherited from LoggingContext.)
Public method | MakeSharable | Allows the current context to be shared beyond its normal lifecycle by preventing it from being returned to the pool. (Inherited from LoggingContext.)
Protected method | Reset | Resets the current context to its initial, uninitialized state. This method is called by the Dispose method. (Inherited from LoggingContext.)
Protected method | ReturnToPool | Returns the current instance to the pool to which it belongs. This method is invoked by the Dispose(Boolean) method.
Public method | SetCorrelation | Associates the current context with another context. (Inherited from LoggingContext.)
Public method | SetWaitDependency | Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts. (Inherited from LoggingContext.)
Public method | ToString | Returns a string that represents the current object. (Inherited from LoggingContext.)
Protected method | ToString(StringBuilder) | Formats a description of the current LoggingContext into a given StringBuilder. (Inherited from LoggingContext.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Contexts Namespace


SyncLoggingContext Properties

The SyncLoggingContext type exposes the following members.

Properties
 | Name | Description
Public property | ActivationContext | Gets the LoggingContext in which the current context was activated. If the current context has been resumed, ActivationContext refers to the context in which the context was resumed. (Inherited from LoggingContext.)
Public property | Backend | Gets the parent LoggingBackend of the current context. (Inherited from LoggingContext.)
Public property | Description | Gets the description of the current context. The description is typically set by the LogRecordBuilder when building the opening record of a context. (Inherited from LoggingContext.)
Public property | Id | Gets or set the identifier of the current context. This property should be used for debugging only. Its value is lazily created. (Inherited from LoggingContext.)
Public property | IndentLevel | Gets or sets the indentation level for the current context. (Inherited from LoggingContext.)
Public property | IsAsync | Determines whether the current LoggingContext represents an async method or an asynchronous custom activity. (Inherited from LoggingContext.)
Public property | IsDisposed | Determines whether the current context has been disposed. (Inherited from LoggingContext.)
Public property | IsSharable | Determines whether the current LoggingContext can be accessed outside of its nominal lifetype (for instance after the method has completed or a custom activity has beeen closed). Since contexts can be pooled and reused, consumers must call the MakeSharable method if they want to keep a reference to the LoggingContext and access it after its nominal lifetime has completed. (Inherited from LoggingContext.)
Public property | Kind | Gets the kind of the current context. (Inherited from LoggingContext.)
Public property | MemberName | Gets the name of the method or property related to the current context. (Inherited from LoggingContext.)
Public property | ParentContext | Gets the LoggingContext that created (initiated) the current context. This is the logical parent. (Inherited from LoggingContext.)
Public property | Source | Gets the LoggingTypeSource corresponding, typically, to the declaring type of the member associated to the current context. (Inherited from LoggingContext.)
Public property | ThreadContext | Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed. (Overrides LoggingContextThreadContext.)
Top
See Also

Reference

SyncLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


SyncLoggingContext.ThreadContext Property

SyncLoggingContextThreadContext Property

Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override sealed ThreadLoggingContext ThreadContext { get; }

Property Value

Type: ThreadLoggingContext
See Also

Reference

SyncLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


SyncLoggingContext Methods

The SyncLoggingContext type exposes the following members.

Methods
 | Name | Description
Public method | CreateCorrelationCookie | Creates a cookie that can be used to correlate, using the SetCorrelation(CorrelationCookie) method, another context to the current context. (Inherited from LoggingContext.)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.)
Protected method | Dispose(Boolean) | Disposes the current object. (Overrides LoggingContextDispose(Boolean).)
Public method | GetCustomRecordBuilder | Gets a LogRecordBuilder for the current context to build a custom record. (Inherited from LoggingContext.)
Public method | GetRecordBuilder | Gets a LogRecordBuilder for the current context to build a standard record for a given method. (Inherited from LoggingContext.)
Public method | MakeSharable | Allows the current context to be shared beyond its normal lifecycle by preventing it from being returned to the pool. (Inherited from LoggingContext.)
Protected method | Reset | Resets the current context to its initial, uninitialized state. This method is called by the Dispose method. (Inherited from LoggingContext.)
Protected method | ReturnToPool | Returns the current instance to the pool to which it belongs. This method is invoked by the Dispose(Boolean) method.
Public method | SetCorrelation | Associates the current context with another context. (Inherited from LoggingContext.)
Public method | SetWaitDependency | Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts. (Inherited from LoggingContext.)
Public method | ToString | Returns a string that represents the current object. (Inherited from LoggingContext.)
Protected method | ToString(StringBuilder) | Formats a description of the current LoggingContext into a given StringBuilder. (Inherited from LoggingContext.)
Top
See Also

Reference

SyncLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


SyncLoggingContext.Dispose Method

SyncLoggingContextDispose Method

Overload List
 | Name | Description
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.)
Protected method | Dispose(Boolean) | Disposes the current object. (Overrides LoggingContextDispose(Boolean).)
Top
See Also

Reference

SyncLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


SyncLoggingContext.Dispose Method (Boolean)

SyncLoggingContextDispose Method (Boolean)

Disposes the current object.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void Dispose(
    bool disposing
)

Parameters

disposing
Type: SystemBoolean
true if the Dispose method is called explicitly, false is the object is being finalized.
See Also

Reference

SyncLoggingContext Class
Dispose Overload
PostSharp.Patterns.Diagnostics.Contexts Namespace


SyncLoggingContext.ReturnToPool Method

SyncLoggingContextReturnToPool Method

Returns the current instance to the pool to which it belongs. This method is invoked by the Dispose(Boolean) method.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected abstract void ReturnToPool()
See Also

Reference

SyncLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


SyncMethodLoggingContext Class

A LoggingContext that represents a synchronous method (not an async method, not an iterator).
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.ContextsLoggingContext
PostSharp.Patterns.Diagnostics.ContextsSyncLoggingContext
PostSharp.Patterns.Diagnostics.ContextsSyncMethodLoggingContext
PostSharp.Patterns.Diagnostics.Backends.SerilogSerilogSyncMethodLoggingContext

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class SyncMethodLoggingContext : SyncLoggingContext

The SyncMethodLoggingContext type exposes the following members.

Constructors
 | Name | Description
Public method | SyncMethodLoggingContext | Initializes a new SyncMethodLoggingContext.
Top
Properties
 | Name | Description
Public property | ActivationContext | Gets the LoggingContext in which the current context was activated. If the current context has been resumed, ActivationContext refers to the context in which the context was resumed. (Inherited from LoggingContext.)
Public property | Backend | Gets the parent LoggingBackend of the current context. (Inherited from LoggingContext.)
Public property | Description | Gets the description of the current context. The description is typically set by the LogRecordBuilder when building the opening record of a context. (Inherited from LoggingContext.)
Public property | Id | Gets or set the identifier of the current context. This property should be used for debugging only. Its value is lazily created. (Inherited from LoggingContext.)
Public property | IndentLevel | Gets or sets the indentation level for the current context. (Inherited from LoggingContext.)
Public property | IsAsync | Determines whether the current LoggingContext represents an async method or an asynchronous custom activity. (Inherited from LoggingContext.)
Public property | IsDisposed | Determines whether the current context has been disposed. (Inherited from LoggingContext.)
Public property | IsSharable | Determines whether the current LoggingContext can be accessed outside of its nominal lifetype (for instance after the method has completed or a custom activity has beeen closed). Since contexts can be pooled and reused, consumers must call the MakeSharable method if they want to keep a reference to the LoggingContext and access it after its nominal lifetime has completed. (Inherited from LoggingContext.)
Public property | Kind | Gets the kind of the current context. (Inherited from LoggingContext.)
Public property | MemberName | Gets the name of the method or property related to the current context. (Inherited from LoggingContext.)
Public property | ParentContext | Gets the LoggingContext that created (initiated) the current context. This is the logical parent. (Inherited from LoggingContext.)
Public property | Source | Gets the LoggingTypeSource corresponding, typically, to the declaring type of the member associated to the current context. (Inherited from LoggingContext.)
Public property | ThreadContext | Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed. (Inherited from SyncLoggingContext.)
Top
Methods
 | Name | Description
Public method | CreateCorrelationCookie | Creates a cookie that can be used to correlate, using the SetCorrelation(CorrelationCookie) method, another context to the current context. (Inherited from LoggingContext.)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from SyncLoggingContext.)
Public method | GetCustomRecordBuilder | Gets a LogRecordBuilder for the current context to build a custom record. (Inherited from LoggingContext.)
Public method | GetRecordBuilder | Gets a LogRecordBuilder for the current context to build a standard record for a given method. (Inherited from LoggingContext.)
Public method | MakeSharable | Allows the current context to be shared beyond its normal lifecycle by preventing it from being returned to the pool. (Inherited from LoggingContext.)
Public method | Open | Opens the current context for a given member.
Protected method | Reset | Resets the current context to its initial, uninitialized state. This method is called by the Dispose method. (Inherited from LoggingContext.)
Protected method | ReturnToPool | Returns the current instance to the pool to which it belongs. This method is invoked by the Dispose(Boolean) method. (Overrides SyncLoggingContextReturnToPool.)
Public method | SetCorrelation | Associates the current context with another context. (Inherited from LoggingContext.)
Public method | SetWaitDependency | Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts. (Inherited from LoggingContext.)
Public method | ToString | Returns a string that represents the current object. (Inherited from LoggingContext.)
Protected method | ToString(StringBuilder) | Formats a description of the current LoggingContext into a given StringBuilder. (Inherited from LoggingContext.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Contexts Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


SyncMethodLoggingContext Constructor

Initializes a new SyncMethodLoggingContext.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SyncMethodLoggingContext(
    ThreadLoggingContext threadContext
)

Parameters

threadContext
Type: PostSharp.Patterns.Diagnostics.ContextsThreadLoggingContext
Information about the thread to which the new SyncMethodLoggingContext shall belong.
See Also

Reference

SyncMethodLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


SyncMethodLoggingContext Properties

The SyncMethodLoggingContext type exposes the following members.

Properties
 | Name | Description
Public property | ActivationContext | Gets the LoggingContext in which the current context was activated. If the current context has been resumed, ActivationContext refers to the context in which the context was resumed. (Inherited from LoggingContext.)
Public property | Backend | Gets the parent LoggingBackend of the current context. (Inherited from LoggingContext.)
Public property | Description | Gets the description of the current context. The description is typically set by the LogRecordBuilder when building the opening record of a context. (Inherited from LoggingContext.)
Public property | Id | Gets or set the identifier of the current context. This property should be used for debugging only. Its value is lazily created. (Inherited from LoggingContext.)
Public property | IndentLevel | Gets or sets the indentation level for the current context. (Inherited from LoggingContext.)
Public property | IsAsync | Determines whether the current LoggingContext represents an async method or an asynchronous custom activity. (Inherited from LoggingContext.)
Public property | IsDisposed | Determines whether the current context has been disposed. (Inherited from LoggingContext.)
Public property | IsSharable | Determines whether the current LoggingContext can be accessed outside of its nominal lifetype (for instance after the method has completed or a custom activity has beeen closed). Since contexts can be pooled and reused, consumers must call the MakeSharable method if they want to keep a reference to the LoggingContext and access it after its nominal lifetime has completed. (Inherited from LoggingContext.)
Public property | Kind | Gets the kind of the current context. (Inherited from LoggingContext.)
Public property | MemberName | Gets the name of the method or property related to the current context. (Inherited from LoggingContext.)
Public property | ParentContext | Gets the LoggingContext that created (initiated) the current context. This is the logical parent. (Inherited from LoggingContext.)
Public property | Source | Gets the LoggingTypeSource corresponding, typically, to the declaring type of the member associated to the current context. (Inherited from LoggingContext.)
Public property | ThreadContext | Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed. (Inherited from SyncLoggingContext.)
Top
See Also

Reference

SyncMethodLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


SyncMethodLoggingContext Methods

The SyncMethodLoggingContext type exposes the following members.

Methods
 | Name | Description
Public method | CreateCorrelationCookie | Creates a cookie that can be used to correlate, using the SetCorrelation(CorrelationCookie) method, another context to the current context. (Inherited from LoggingContext.)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.)
Protected method | Dispose(Boolean) | Disposes the current object. (Inherited from SyncLoggingContext.)
Public method | GetCustomRecordBuilder | Gets a LogRecordBuilder for the current context to build a custom record. (Inherited from LoggingContext.)
Public method | GetRecordBuilder | Gets a LogRecordBuilder for the current context to build a standard record for a given method. (Inherited from LoggingContext.)
Public method | MakeSharable | Allows the current context to be shared beyond its normal lifecycle by preventing it from being returned to the pool. (Inherited from LoggingContext.)
Public method | Open | Opens the current context for a given member.
Protected method | Reset | Resets the current context to its initial, uninitialized state. This method is called by the Dispose method. (Inherited from LoggingContext.)
Protected method | ReturnToPool | Returns the current instance to the pool to which it belongs. This method is invoked by the Dispose(Boolean) method. (Overrides SyncLoggingContextReturnToPool.)
Public method | SetCorrelation | Associates the current context with another context. (Inherited from LoggingContext.)
Public method | SetWaitDependency | Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts. (Inherited from LoggingContext.)
Public method | ToString | Returns a string that represents the current object. (Inherited from LoggingContext.)
Protected method | ToString(StringBuilder) | Formats a description of the current LoggingContext into a given StringBuilder. (Inherited from LoggingContext.)
Top
See Also

Reference

SyncMethodLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


SyncMethodLoggingContext.Open Method

SyncMethodLoggingContextOpen Method

Opens the current context for a given member.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void Open(
    ref LogMemberInfo memberInfo
)

Parameters

memberInfo
Type: PostSharp.Patterns.Diagnostics.ContextsLogMemberInfo
Information about the method, property or field being logged.
See Also

Reference

SyncMethodLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


SyncMethodLoggingContext.ReturnToPool Method

SyncMethodLoggingContextReturnToPool Method

Returns the current instance to the pool to which it belongs. This method is invoked by the Dispose(Boolean) method.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void ReturnToPool()
See Also

Reference

SyncMethodLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


ThreadLoggingContext Class

A LoggingContext that represents the current thread. The ThreadLoggingContext has two usages. First, it is used to store all thread-local variables and objects. Then, it is used as the root object for all other contexts.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.ContextsLoggingContext
PostSharp.Patterns.Diagnostics.ContextsThreadLoggingContext

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class ThreadLoggingContext : LoggingContext

The ThreadLoggingContext type exposes the following members.

Constructors
 | Name | Description
Public method | ThreadLoggingContext | Initializes a new ThreadLoggingContext.
Top
Properties
 | Name | Description
Public property | ActivationContext | Gets the LoggingContext in which the current context was activated. If the current context has been resumed, ActivationContext refers to the context in which the context was resumed. (Inherited from LoggingContext.)
Public property | Backend | Gets the parent LoggingBackend of the current context. (Inherited from LoggingContext.)
Public property | Description | Gets the description of the current context. The description is typically set by the LogRecordBuilder when building the opening record of a context. (Inherited from LoggingContext.)
Public property | Id | Gets or set the identifier of the current context. This property should be used for debugging only. Its value is lazily created. (Inherited from LoggingContext.)
Public property | IndentLevel | Gets or sets the indentation level for the current context. (Inherited from LoggingContext.)
Public property | IsAsync | Determines whether the current LoggingContext represents an async method or an asynchronous custom activity. (Inherited from LoggingContext.)
Public property | IsDisposed | Determines whether the current context has been disposed. (Inherited from LoggingContext.)
Public property | IsLogging |
Public property | IsSharable | Determines whether the current LoggingContext can be accessed outside of its nominal lifetype (for instance after the method has completed or a custom activity has beeen closed). Since contexts can be pooled and reused, consumers must call the MakeSharable method if they want to keep a reference to the LoggingContext and access it after its nominal lifetime has completed. (Inherited from LoggingContext.)
Public property | Kind | Gets the kind of the current context. (Inherited from LoggingContext.)
Public property | MemberName | Gets the name of the method or property related to the current context. (Inherited from LoggingContext.)
Public property | ParentContext | Gets the LoggingContext that created (initiated) the current context. This is the logical parent. (Overrides LoggingContextParentContext.)
Public property | Source | Gets the LoggingTypeSource corresponding, typically, to the declaring type of the member associated to the current context. (Inherited from LoggingContext.)
Public property | ThreadContext | Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed. (Overrides LoggingContextThreadContext.)
Top
Methods
 | Name | Description
Public method | CreateCorrelationCookie | Creates a cookie that can be used to correlate, using the SetCorrelation(CorrelationCookie) method, another context to the current context. (Inherited from LoggingContext.)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.)
Protected method | Dispose(Boolean) | Disposes the current object. (Overrides LoggingContextDispose(Boolean).)
Public method | GetCustomRecordBuilder(CustomLogRecordInfo) | Gets a LogRecordBuilder for the current context to build a custom record. (Inherited from LoggingContext.)
Public method | GetCustomRecordBuilder(LoggingContext, CustomLogRecordInfo) | Gets a LogRecordBuilder and initializes it to emit a custom record.
Public method | GetRecordBuilder(LogRecordInfo, LogMemberInfo) | Gets a LogRecordBuilder for the current context to build a standard record for a given method. (Inherited from LoggingContext.)
Public method | GetRecordBuilder(LoggingContext, LogRecordInfo, LogMemberInfo) | Gets a LogRecordBuilder and initializes it for a given context, member, and record.
Public method | MakeSharable | Allows the current context to be shared beyond its normal lifecycle by preventing it from being returned to the pool. (Inherited from LoggingContext.)
Protected method | Reset | Resets the current context to its initial, uninitialized state. This method is called by the Dispose method. (Inherited from LoggingContext.)
Public method | SetCorrelation | Associates the current context with another context. (Inherited from LoggingContext.)
Public method | SetWaitDependency | Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts. (Inherited from LoggingContext.)
Public method | ToString | Returns a string that represents the current object. (Inherited from LoggingContext.)
Protected method | ToString(StringBuilder) | Formats a description of the current LoggingContext into a given StringBuilder. (Inherited from LoggingContext.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Contexts Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


ThreadLoggingContext Constructor

Initializes a new ThreadLoggingContext.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ThreadLoggingContext(
    LoggingBackend backend,
    LogRecordBuilder recordBuilder
)

Parameters

backend
Type: PostSharp.Patterns.DiagnosticsLoggingBackend
The parent LoggingBackend.
recordBuilder
Type: PostSharp.Patterns.Diagnostics.RecordBuildersLogRecordBuilder
The thread-local LogRecordBuilder.
See Also

Reference

ThreadLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


ThreadLoggingContext Properties

The ThreadLoggingContext type exposes the following members.

Properties
 | Name | Description
Public property | ActivationContext | Gets the LoggingContext in which the current context was activated. If the current context has been resumed, ActivationContext refers to the context in which the context was resumed. (Inherited from LoggingContext.)
Public property | Backend | Gets the parent LoggingBackend of the current context. (Inherited from LoggingContext.)
Public property | Description | Gets the description of the current context. The description is typically set by the LogRecordBuilder when building the opening record of a context. (Inherited from LoggingContext.)
Public property | Id | Gets or set the identifier of the current context. This property should be used for debugging only. Its value is lazily created. (Inherited from LoggingContext.)
Public property | IndentLevel | Gets or sets the indentation level for the current context. (Inherited from LoggingContext.)
Public property | IsAsync | Determines whether the current LoggingContext represents an async method or an asynchronous custom activity. (Inherited from LoggingContext.)
Public property | IsDisposed | Determines whether the current context has been disposed. (Inherited from LoggingContext.)
Public property | IsLogging |
Public property | IsSharable | Determines whether the current LoggingContext can be accessed outside of its nominal lifetype (for instance after the method has completed or a custom activity has beeen closed). Since contexts can be pooled and reused, consumers must call the MakeSharable method if they want to keep a reference to the LoggingContext and access it after its nominal lifetime has completed. (Inherited from LoggingContext.)
Public property | Kind | Gets the kind of the current context. (Inherited from LoggingContext.)
Public property | MemberName | Gets the name of the method or property related to the current context. (Inherited from LoggingContext.)
Public property | ParentContext | Gets the LoggingContext that created (initiated) the current context. This is the logical parent. (Overrides LoggingContextParentContext.)
Public property | Source | Gets the LoggingTypeSource corresponding, typically, to the declaring type of the member associated to the current context. (Inherited from LoggingContext.)
Public property | ThreadContext | Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed. (Overrides LoggingContextThreadContext.)
Top
See Also

Reference

ThreadLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


ThreadLoggingContext.IsLogging Property

ThreadLoggingContextIsLogging Property

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsLogging { get; }

Property Value

Type: Boolean
See Also

Reference

ThreadLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


ThreadLoggingContext.ParentContext Property

ThreadLoggingContextParentContext Property

Gets the LoggingContext that created (initiated) the current context. This is the logical parent.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override LoggingContext ParentContext { get; }

Property Value

Type: LoggingContext
See Also

Reference

ThreadLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


ThreadLoggingContext.ThreadContext Property

ThreadLoggingContextThreadContext Property

Gets the ThreadLoggingContext for the thread in which the current LoggingContext is currently executed.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override ThreadLoggingContext ThreadContext { get; }

Property Value

Type: ThreadLoggingContext
See Also

Reference

ThreadLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


ThreadLoggingContext Methods

The ThreadLoggingContext type exposes the following members.

Methods
 | Name | Description
Public method | CreateCorrelationCookie | Creates a cookie that can be used to correlate, using the SetCorrelation(CorrelationCookie) method, another context to the current context. (Inherited from LoggingContext.)
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.)
Protected method | Dispose(Boolean) | Disposes the current object. (Overrides LoggingContextDispose(Boolean).)
Public method | GetCustomRecordBuilder(CustomLogRecordInfo) | Gets a LogRecordBuilder for the current context to build a custom record. (Inherited from LoggingContext.)
Public method | GetCustomRecordBuilder(LoggingContext, CustomLogRecordInfo) | Gets a LogRecordBuilder and initializes it to emit a custom record.
Public method | GetRecordBuilder(LogRecordInfo, LogMemberInfo) | Gets a LogRecordBuilder for the current context to build a standard record for a given method. (Inherited from LoggingContext.)
Public method | GetRecordBuilder(LoggingContext, LogRecordInfo, LogMemberInfo) | Gets a LogRecordBuilder and initializes it for a given context, member, and record.
Public method | MakeSharable | Allows the current context to be shared beyond its normal lifecycle by preventing it from being returned to the pool. (Inherited from LoggingContext.)
Protected method | Reset | Resets the current context to its initial, uninitialized state. This method is called by the Dispose method. (Inherited from LoggingContext.)
Public method | SetCorrelation | Associates the current context with another context. (Inherited from LoggingContext.)
Public method | SetWaitDependency | Sets the wait dependency for the current context, i.e. sets a representation of what the current context is waiting for. This operation is available only in custom contexts. (Inherited from LoggingContext.)
Public method | ToString | Returns a string that represents the current object. (Inherited from LoggingContext.)
Protected method | ToString(StringBuilder) | Formats a description of the current LoggingContext into a given StringBuilder. (Inherited from LoggingContext.)
Top
See Also

Reference

ThreadLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


ThreadLoggingContext.Dispose Method

ThreadLoggingContextDispose Method

Overload List
 | Name | Description
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from LoggingContext.)
Protected method | Dispose(Boolean) | Disposes the current object. (Overrides LoggingContextDispose(Boolean).)
Top
See Also

Reference

ThreadLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


ThreadLoggingContext.Dispose Method (Boolean)

ThreadLoggingContextDispose Method (Boolean)

Disposes the current object.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void Dispose(
    bool disposing
)

Parameters

disposing
Type: SystemBoolean
true if the Dispose method is called explicitly, false is the object is being finalized.
See Also

Reference

ThreadLoggingContext Class
Dispose Overload
PostSharp.Patterns.Diagnostics.Contexts Namespace


ThreadLoggingContext.GetCustomRecordBuilder Method

ThreadLoggingContextGetCustomRecordBuilder Method

Overload List
 | Name | Description
Public method | GetCustomRecordBuilder(CustomLogRecordInfo) | Gets a LogRecordBuilder for the current context to build a custom record. (Inherited from LoggingContext.)
Public method | GetCustomRecordBuilder(LoggingContext, CustomLogRecordInfo) | Gets a LogRecordBuilder and initializes it to emit a custom record.
Top
See Also

Reference

ThreadLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


ThreadLoggingContext.GetCustomRecordBuilder Method (LoggingContext, CustomLogRecordInfo)

ThreadLoggingContextGetCustomRecordBuilder Method (LoggingContext, CustomLogRecordInfo)

Gets a LogRecordBuilder and initializes it to emit a custom record.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogRecordBuilder GetCustomRecordBuilder(
    LoggingContext context,
    ref CustomLogRecordInfo recordInfo
)

Parameters

context
Type: PostSharp.Patterns.Diagnostics.ContextsLoggingContext
The LoggingContext to which the record relates.
recordInfo
Type: PostSharp.Patterns.Diagnostics.ContextsCustomLogRecordInfo
Information about the custom record.

Return Value

Type: LogRecordBuilder
A LogRecordBuilder properly initialized by calling the BeginCustomRecord(LoggingContext, CustomLogRecordInfo) method.
See Also

Reference

ThreadLoggingContext Class
GetCustomRecordBuilder Overload
PostSharp.Patterns.Diagnostics.Contexts Namespace


ThreadLoggingContext.GetRecordBuilder Method

ThreadLoggingContextGetRecordBuilder Method

Overload List
 | Name | Description
Public method | GetRecordBuilder(LogRecordInfo, LogMemberInfo) | Gets a LogRecordBuilder for the current context to build a standard record for a given method. (Inherited from LoggingContext.)
Public method | GetRecordBuilder(LoggingContext, LogRecordInfo, LogMemberInfo) | Gets a LogRecordBuilder and initializes it for a given context, member, and record.
Top
See Also

Reference

ThreadLoggingContext Class
PostSharp.Patterns.Diagnostics.Contexts Namespace


ThreadLoggingContext.GetRecordBuilder Method (LoggingContext, LogRecordInfo, LogMemberInfo)

ThreadLoggingContextGetRecordBuilder Method (LoggingContext, LogRecordInfo, LogMemberInfo)

Gets a LogRecordBuilder and initializes it for a given context, member, and record.

Namespace: PostSharp.Patterns.Diagnostics.Contexts
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LogRecordBuilder GetRecordBuilder(
    LoggingContext context,
    ref LogRecordInfo logRecordInfo,
    ref LogMemberInfo logMemberInfo
)

Parameters

context
Type: PostSharp.Patterns.Diagnostics.ContextsLoggingContext
The LoggingContext to which the record relates.
logRecordInfo
Type: PostSharp.Patterns.Diagnostics.ContextsLogRecordInfo
Information about the log record.
logMemberInfo
Type: PostSharp.Patterns.Diagnostics.ContextsLogMemberInfo
Information about the method, property, or field.

Return Value

Type: LogRecordBuilder
A LogRecordBuilder properly initialized by calling the BeginRecord(LoggingContext, LogRecordInfo, LogMemberInfo) method.
See Also

Reference

ThreadLoggingContext Class
GetRecordBuilder Overload
PostSharp.Patterns.Diagnostics.Contexts Namespace


PostSharp.Patterns.Diagnostics.Custom Namespace

Classes
 | Class | Description
Public class | InvalidFormattingStringException | Exception thrown by the FormattingStringParser and by the Logger class when user code provides an invalid formatting string.
Structures
 | Structure | Description
Public structure | FormattingStringParser | Parses the formatting string for custom messages of the Logger and LogActivity classes.
Interfaces
 | Interface | Description
Public interface | ILogActivityOptions |
Public interface | ILogger | Abstraction of the Logging facility, through which other components emit their log records. This interfaces abstracts other PostSharp components from the PostSharp.Patterns.Diagnostics component.
Public interface | ILoggerExceptionHandler | Defines methods called in case of exception in the Logger class. This interface can be implemented by any class implementing the ILogger interface. When an ILogger does not implement this interface, logging exceptions are simply silently ignored.
Public interface | ILoggerFactory | Creates instances of the ILogger interface. An instance of this interface must be registered into the ServiceLocator.


FormattingStringParser Structure

Parses the formatting string for custom messages of the Logger and LogActivity classes.

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public struct FormattingStringParser

The FormattingStringParser type exposes the following members.

Constructors
 | Name | Description
Public method | FormattingStringParser | Initializes a new FormattingStringParser.
Top
Methods
 | Name | Description
Public method | GetNextParameter | Gets the next parameter name.
Public method | GetNextSubstring | Gets the next substring (until the next parameter or the end of the string).
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Custom Namespace


FormattingStringParser Constructor

Initializes a new FormattingStringParser.

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public FormattingStringParser(
    string formattingString
)

Parameters

formattingString
Type: SystemString
The formatting string.
See Also

Reference

FormattingStringParser Structure
PostSharp.Patterns.Diagnostics.Custom Namespace


FormattingStringParser Methods

The FormattingStringParser type exposes the following members.

Methods
 | Name | Description
Public method | GetNextParameter | Gets the next parameter name.
Public method | GetNextSubstring | Gets the next substring (until the next parameter or the end of the string).
Top
See Also

Reference

FormattingStringParser Structure
PostSharp.Patterns.Diagnostics.Custom Namespace


FormattingStringParser.GetNextParameter Method

FormattingStringParserGetNextParameter Method

Gets the next parameter name.

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ArraySegment<char> GetNextParameter()

Return Value

Type: ArraySegment Char
The name of the next parameter, or the default (null) value if there is no next parameter.
See Also

Reference

FormattingStringParser Structure
PostSharp.Patterns.Diagnostics.Custom Namespace


FormattingStringParser.GetNextSubstring Method

FormattingStringParserGetNextSubstring Method

Gets the next substring (until the next parameter or the end of the string).

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ArraySegment<char> GetNextSubstring()

Return Value

Type: ArraySegment Char
The next substring.
See Also

Reference

FormattingStringParser Structure
PostSharp.Patterns.Diagnostics.Custom Namespace


ILogActivityOptions Interface

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ILogActivityOptions

The ILogActivityOptions type exposes the following members.

Properties
 | Name | Description
Public property | ActivityLevel | Gets or sets the LogLevel from which the OpenActivity(String) does something meaningful. Under the specified LogLevel, OpenActivity(String) returns a null LogActivity that does not do anything. Even calls to SetFailure or SetException(Exception) are ignored in this case.
Public property | ExceptionLevel | Gets or sets the LogLevel for failures of custom activities (defined by the SetException(Exception) method).
Public property | FailureLevel | Gets or sets the LogLevel for failures of custom activities (defined by the SetFailure(String) method).
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Custom Namespace


ILogActivityOptions Properties

The ILogActivityOptions type exposes the following members.

Properties
 | Name | Description
Public property | ActivityLevel | Gets or sets the LogLevel from which the OpenActivity(String) does something meaningful. Under the specified LogLevel, OpenActivity(String) returns a null LogActivity that does not do anything. Even calls to SetFailure or SetException(Exception) are ignored in this case.
Public property | ExceptionLevel | Gets or sets the LogLevel for failures of custom activities (defined by the SetException(Exception) method).
Public property | FailureLevel | Gets or sets the LogLevel for failures of custom activities (defined by the SetFailure(String) method).
Top
See Also

Reference

ILogActivityOptions Interface
PostSharp.Patterns.Diagnostics.Custom Namespace


ILogActivityOptions.ActivityLevel Property

ILogActivityOptionsActivityLevel Property

Gets or sets the LogLevel from which the OpenActivity(String) does something meaningful. Under the specified LogLevel, OpenActivity(String) returns a null LogActivity that does not do anything. Even calls to SetFailure or SetException(Exception) are ignored in this case.

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
LogLevel ActivityLevel { get; }

Property Value

Type: LogLevel
See Also

Reference

ILogActivityOptions Interface
PostSharp.Patterns.Diagnostics.Custom Namespace


ILogActivityOptions.ExceptionLevel Property

ILogActivityOptionsExceptionLevel Property

Gets or sets the LogLevel for failures of custom activities (defined by the SetException(Exception) method).

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
LogLevel ExceptionLevel { get; }

Property Value

Type: LogLevel
See Also

Reference

ILogActivityOptions Interface
PostSharp.Patterns.Diagnostics.Custom Namespace


ILogActivityOptions.FailureLevel Property

ILogActivityOptionsFailureLevel Property

Gets or sets the LogLevel for failures of custom activities (defined by the SetFailure(String) method).

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
LogLevel FailureLevel { get; }

Property Value

Type: LogLevel
See Also

Reference

ILogActivityOptions Interface
PostSharp.Patterns.Diagnostics.Custom Namespace


ILogger Interface

Abstraction of the Logging facility, through which other components emit their log records. This interfaces abstracts other PostSharp components from the PostSharp.Patterns.Diagnostics component.

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ILogger

The ILogger type exposes the following members.

Properties
 | Name | Description
Public property | ActivityOptions |
Public property | RequiresSuspendResume | Determines whether calls of SuspendActivity(ILoggingContext, CallerInfo) and ResumeActivity(ILoggingContext, CallerInfo) is required for asynchronous custom activities in the current context.
Public property | Role | Gets the role of records created by this ILogger. A list of standard roles is available in the LoggingRoles class.
Public property | Type | Gets the source Type for which this ILogger was created.
Top
Methods
 | Name | Description
Public method | IsEnabled | Determines whether logging is enabled for a given LogLevel.
Public method | OpenActivity | Opens an activity.
Public method | ResumeActivity | Resumes an asynchronous activity suspended by the SuspendActivity(ILoggingContext, CallerInfo) method.
Public method | SetWaitDependency | Sets the wait dependency for a given context, i.e. give information about what the given context is waiting (or awaiting) for.
Public method | SuspendActivity | Suspends an asynchronous activity, which can then be resumed by the ResumeActivity(ILoggingContext, CallerInfo) method.
Public method | Write(ILoggingContext, LogLevel, LogRecordKind, String, Exception, CallerInfo) | Writes a custom log record with a description without parameters.
Public method | Write(ILoggingContext, LogLevel, LogRecordKind, String, Object, Exception, CallerInfo) | Writes a custom log record with a description with an array of parameters.
Public method | WriteT1(ILoggingContext, LogLevel, LogRecordKind, String, T1, Exception, CallerInfo) | Writes a custom log record with 1 parameter.
Public method | WriteT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, Exception, CallerInfo) | Writes a custom log record with 10 parameters.
Public method | WriteT1, T2(ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, Exception, CallerInfo) | Writes a custom log record with 2 parameters.
Public method | WriteT1, T2, T3(ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, Exception, CallerInfo) | Writes a custom log record with 3 parameters.
Public method | WriteT1, T2, T3, T4(ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, T4, Exception, CallerInfo) | Writes a custom log record with 4 parameters.
Public method | WriteT1, T2, T3, T4, T5(ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, T4, T5, Exception, CallerInfo) | Writes a custom log record with 5 parameters.
Public method | WriteT1, T2, T3, T4, T5, T6(ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, T4, T5, T6, Exception, CallerInfo) | Writes a custom log record with 6 parameters.
Public method | WriteT1, T2, T3, T4, T5, T6, T7(ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, T4, T5, T6, T7, Exception, CallerInfo) | Writes a custom log record with 7 parameters.
Public method | WriteT1, T2, T3, T4, T5, T6, T7, T8(ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, T4, T5, T6, T7, T8, Exception, CallerInfo) | Writes a custom log record with 8 parameters.
Public method | WriteT1, T2, T3, T4, T5, T6, T7, T8, T9(ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, Exception, CallerInfo) | Writes a custom log record with 9 parameters.
Top
Remarks

If you want to implement this interface, you should also implement the ILoggerFactory interface and register it to the ServiceLocator.

See Also

Reference

PostSharp.Patterns.Diagnostics.Custom Namespace


ILogger Properties

The ILogger type exposes the following members.

Properties
 | Name | Description
Public property | ActivityOptions |
Public property | RequiresSuspendResume | Determines whether calls of SuspendActivity(ILoggingContext, CallerInfo) and ResumeActivity(ILoggingContext, CallerInfo) is required for asynchronous custom activities in the current context.
Public property | Role | Gets the role of records created by this ILogger. A list of standard roles is available in the LoggingRoles class.
Public property | Type | Gets the source Type for which this ILogger was created.
Top
See Also

Reference

ILogger Interface
PostSharp.Patterns.Diagnostics.Custom Namespace


ILogger.ActivityOptions Property

ILoggerActivityOptions Property

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
ILogActivityOptions ActivityOptions { get; }

Property Value

Type: ILogActivityOptions
See Also

Reference

ILogger Interface
PostSharp.Patterns.Diagnostics.Custom Namespace


ILogger.RequiresSuspendResume Property

ILoggerRequiresSuspendResume Property

Determines whether calls of SuspendActivity(ILoggingContext, CallerInfo) and ResumeActivity(ILoggingContext, CallerInfo) is required for asynchronous custom activities in the current context.

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
bool RequiresSuspendResume { get; }

Property Value

Type: Boolean
See Also

Reference

ILogger Interface
PostSharp.Patterns.Diagnostics.Custom Namespace


ILogger.Role Property

ILoggerRole Property

Gets the role of records created by this ILogger. A list of standard roles is available in the LoggingRoles class.

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
string Role { get; }

Property Value

Type: String
See Also

Reference

ILogger Interface
PostSharp.Patterns.Diagnostics.Custom Namespace


ILogger.Type Property

ILoggerType Property

Gets the source Type for which this ILogger was created.

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Type Type { get; }

Property Value

Type: Type
See Also

Reference

ILogger Interface
PostSharp.Patterns.Diagnostics.Custom Namespace


ILogger Methods

The ILogger type exposes the following members.

Methods
 | Name | Description
Public method | IsEnabled | Determines whether logging is enabled for a given LogLevel.
Public method | OpenActivity | Opens an activity.
Public method | ResumeActivity | Resumes an asynchronous activity suspended by the SuspendActivity(ILoggingContext, CallerInfo) method.
Public method | SetWaitDependency | Sets the wait dependency for a given context, i.e. give information about what the given context is waiting (or awaiting) for.
Public method | SuspendActivity | Suspends an asynchronous activity, which can then be resumed by the ResumeActivity(ILoggingContext, CallerInfo) method.
Public method | Write(ILoggingContext, LogLevel, LogRecordKind, String, Exception, CallerInfo) | Writes a custom log record with a description without parameters.
Public method | Write(ILoggingContext, LogLevel, LogRecordKind, String, Object, Exception, CallerInfo) | Writes a custom log record with a description with an array of parameters.
Public method | WriteT1(ILoggingContext, LogLevel, LogRecordKind, String, T1, Exception, CallerInfo) | Writes a custom log record with 1 parameter.
Public method | WriteT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, Exception, CallerInfo) | Writes a custom log record with 10 parameters.
Public method | WriteT1, T2(ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, Exception, CallerInfo) | Writes a custom log record with 2 parameters.
Public method | WriteT1, T2, T3(ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, Exception, CallerInfo) | Writes a custom log record with 3 parameters.
Public method | WriteT1, T2, T3, T4(ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, T4, Exception, CallerInfo) | Writes a custom log record with 4 parameters.
Public method | WriteT1, T2, T3, T4, T5(ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, T4, T5, Exception, CallerInfo) | Writes a custom log record with 5 parameters.
Public method | WriteT1, T2, T3, T4, T5, T6(ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, T4, T5, T6, Exception, CallerInfo) | Writes a custom log record with 6 parameters.
Public method | WriteT1, T2, T3, T4, T5, T6, T7(ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, T4, T5, T6, T7, Exception, CallerInfo) | Writes a custom log record with 7 parameters.
Public method | WriteT1, T2, T3, T4, T5, T6, T7, T8(ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, T4, T5, T6, T7, T8, Exception, CallerInfo) | Writes a custom log record with 8 parameters.
Public method | WriteT1, T2, T3, T4, T5, T6, T7, T8, T9(ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, Exception, CallerInfo) | Writes a custom log record with 9 parameters.
Top
See Also

Reference

ILogger Interface
PostSharp.Patterns.Diagnostics.Custom Namespace


ILogger.IsEnabled Method

ILoggerIsEnabled Method

Determines whether logging is enabled for a given LogLevel.

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
bool IsEnabled(
    LogLevel level
)

Parameters

level
Type: PostSharp.Patterns.DiagnosticsLogLevel
A record level (or severity).

Return Value

Type: Boolean
true if logging is enabled for level, otherwise false.
See Also

Reference

ILogger Interface
PostSharp.Patterns.Diagnostics.Custom Namespace


ILogger.OpenActivity Method

ILoggerOpenActivity Method

Opens an activity.

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
ILoggingContext OpenActivity(
    LogActivityOptions options,
    ref CallerInfo callerInfo
)

Parameters

options
Type: PostSharp.Patterns.DiagnosticsLogActivityOptions
callerInfo
Type: PostSharp.Patterns.Diagnostics.ContextsCallerInfo

Return Value

Type: ILoggingContext
An ILoggingContext representing the new activity.
See Also

Reference

ILogger Interface
PostSharp.Patterns.Diagnostics.Custom Namespace


ILogger.ResumeActivity Method

ILoggerResumeActivity Method

Resumes an asynchronous activity suspended by the SuspendActivity(ILoggingContext, CallerInfo) method.

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void ResumeActivity(
    ILoggingContext context,
    ref CallerInfo callerInfo
)

Parameters

context
Type: PostSharp.Patterns.Diagnostics.ContextsILoggingContext
A context representing an asynchronous custom activity, created by OpenActivity(LogActivityOptions, CallerInfo) and suspended by SuspendActivity(ILoggingContext, CallerInfo).
callerInfo
Type: PostSharp.Patterns.Diagnostics.ContextsCallerInfo
See Also

Reference

ILogger Interface
PostSharp.Patterns.Diagnostics.Custom Namespace


ILogger.SetWaitDependency Method

ILoggerSetWaitDependency Method

Sets the wait dependency for a given context, i.e. give information about what the given context is waiting (or awaiting) for.

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void SetWaitDependency(
    ILoggingContext context,
    Object waited
)

Parameters

context
Type: PostSharp.Patterns.Diagnostics.ContextsILoggingContext
The waiting context.
waited
Type: SystemObject
The "thing" that is awaited for. Typically a Task, or TaskInfo, or another context.
See Also

Reference

ILogger Interface
PostSharp.Patterns.Diagnostics.Custom Namespace


ILogger.SuspendActivity Method

ILoggerSuspendActivity Method

Suspends an asynchronous activity, which can then be resumed by the ResumeActivity(ILoggingContext, CallerInfo) method.

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void SuspendActivity(
    ILoggingContext context,
    ref CallerInfo callerInfo
)

Parameters

context
Type: PostSharp.Patterns.Diagnostics.ContextsILoggingContext
A context representing an asynchronous custom activity, created by OpenActivity(LogActivityOptions, CallerInfo).
callerInfo
Type: PostSharp.Patterns.Diagnostics.ContextsCallerInfo
See Also

Reference

ILogger Interface
PostSharp.Patterns.Diagnostics.Custom Namespace


ILogger.Write Method

ILoggerWrite Method

Overload List
 | Name | Description
Public method | Write(ILoggingContext, LogLevel, LogRecordKind, String, Exception, CallerInfo) | Writes a custom log record with a description without parameters.
Public method | Write(ILoggingContext, LogLevel, LogRecordKind, String, Object, Exception, CallerInfo) | Writes a custom log record with a description with an array of parameters.
Public method | WriteT1(ILoggingContext, LogLevel, LogRecordKind, String, T1, Exception, CallerInfo) | Writes a custom log record with 1 parameter.
Public method | WriteT1, T2(ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, Exception, CallerInfo) | Writes a custom log record with 2 parameters.
Public method | WriteT1, T2, T3(ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, Exception, CallerInfo) | Writes a custom log record with 3 parameters.
Public method | WriteT1, T2, T3, T4(ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, T4, Exception, CallerInfo) | Writes a custom log record with 4 parameters.
Public method | WriteT1, T2, T3, T4, T5(ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, T4, T5, Exception, CallerInfo) | Writes a custom log record with 5 parameters.
Public method | WriteT1, T2, T3, T4, T5, T6(ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, T4, T5, T6, Exception, CallerInfo) | Writes a custom log record with 6 parameters.
Public method | WriteT1, T2, T3, T4, T5, T6, T7(ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, T4, T5, T6, T7, Exception, CallerInfo) | Writes a custom log record with 7 parameters.
Public method | WriteT1, T2, T3, T4, T5, T6, T7, T8(ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, T4, T5, T6, T7, T8, Exception, CallerInfo) | Writes a custom log record with 8 parameters.
Public method | WriteT1, T2, T3, T4, T5, T6, T7, T8, T9(ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, Exception, CallerInfo) | Writes a custom log record with 9 parameters.
Public method | WriteT1, T2, T3, T4, T5, T6, T7, T8, T9, T10(ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, Exception, CallerInfo) | Writes a custom log record with 10 parameters.
Top
See Also

Reference

ILogger Interface
PostSharp.Patterns.Diagnostics.Custom Namespace


ILogger.Write Method (ILoggingContext, LogLevel, LogRecordKind, String, Exception, CallerInfo)

ILoggerWrite Method (ILoggingContext, LogLevel, LogRecordKind, String, Exception, CallerInfo)

Writes a custom log record with a description without parameters.

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void Write(
    ILoggingContext context,
    LogLevel level,
    LogRecordKind recordKind,
    string text,
    Exception exception,
    ref CallerInfo recordInfo
)

Parameters

context
Type: PostSharp.Patterns.Diagnostics.ContextsILoggingContext
level
Type: PostSharp.Patterns.DiagnosticsLogLevel
LogLevel of the record.
recordKind
Type: PostSharp.Patterns.DiagnosticsLogRecordKind
Kind of record.
text
Type: SystemString
Text of the record.
exception
Type: SystemException
The Exception associated with the record, or null.
recordInfo
Type: PostSharp.Patterns.Diagnostics.ContextsCallerInfo
Information about the caller source code.
See Also

Reference

ILogger Interface
Write Overload
PostSharp.Patterns.Diagnostics.Custom Namespace


ILogger.Write Method (ILoggingContext, LogLevel, LogRecordKind, String, Object[], Exception, CallerInfo)

ILoggerWrite Method (ILoggingContext, LogLevel, LogRecordKind, String, Object, Exception, CallerInfo)

Writes a custom log record with a description with an array of parameters.

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void Write(
    ILoggingContext context,
    LogLevel level,
    LogRecordKind recordKind,
    string text,
    Object[] args,
    Exception exception,
    ref CallerInfo recordInfo
)

Parameters

context
Type: PostSharp.Patterns.Diagnostics.ContextsILoggingContext
level
Type: PostSharp.Patterns.DiagnosticsLogLevel
LogLevel of the record.
recordKind
Type: PostSharp.Patterns.DiagnosticsLogRecordKind
Kind of record.
text
Type: SystemString
Text of the record.
args
Type: SystemObject
An array of parameters.
exception
Type: SystemException
The Exception associated with the record, or null.
recordInfo
Type: PostSharp.Patterns.Diagnostics.ContextsCallerInfo
Information about the caller source code.
See Also

Reference

ILogger Interface
Write Overload
PostSharp.Patterns.Diagnostics.Custom Namespace


ILogger.Write(T1) Method (ILoggingContext, LogLevel, LogRecordKind, String, T1, Exception, CallerInfo)

ILoggerWriteT1 Method (ILoggingContext, LogLevel, LogRecordKind, String, T1, Exception, CallerInfo)

Writes a custom log record with 1 parameter.

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void Write<T1>(
    ILoggingContext context,
    LogLevel level,
    LogRecordKind recordKind,
    string text,
    T1 arg1,
    Exception exception,
    ref CallerInfo recordInfo
)

Parameters

context
Type: PostSharp.Patterns.Diagnostics.ContextsILoggingContext
level
Type: PostSharp.Patterns.DiagnosticsLogLevel
The severity of the record (e.g. Info or Warning).
recordKind
Type: PostSharp.Patterns.DiagnosticsLogRecordKind
Kind of record.
text
Type: SystemString
The text of the log record, including parameters (e.g. Opening {Path} file {ShareMode} sharing mode).
arg1
Type: T1
Value of the 1-th parameter.
exception
Type: SystemException
The Exception associated with the record, or null.
recordInfo
Type: PostSharp.Patterns.Diagnostics.ContextsCallerInfo
Information about the caller source code.

Type Parameters

T1
Type of the 1-th parameter.
See Also

Reference

ILogger Interface
Write Overload
PostSharp.Patterns.Diagnostics.Custom Namespace


ILogger.Write(T1, T2) Method (ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, Exception, CallerInfo)

ILoggerWriteT1, T2 Method (ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, Exception, CallerInfo)

Writes a custom log record with 2 parameters.

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void Write<T1, T2>(
    ILoggingContext context,
    LogLevel level,
    LogRecordKind recordKind,
    string text,
    T1 arg1,
    T2 arg2,
    Exception exception,
    ref CallerInfo recordInfo
)

Parameters

context
Type: PostSharp.Patterns.Diagnostics.ContextsILoggingContext
level
Type: PostSharp.Patterns.DiagnosticsLogLevel
The severity of the record (e.g. Info or Warning).
recordKind
Type: PostSharp.Patterns.DiagnosticsLogRecordKind
Kind of record.
text
Type: SystemString
The text of the log record, including parameters (e.g. Opening {Path} file {ShareMode} sharing mode).
arg1
Type: T1
Value of the 1-th parameter.
arg2
Type: T2
Value of the 2-th parameter.
exception
Type: SystemException
The Exception associated with the record, or null.
recordInfo
Type: PostSharp.Patterns.Diagnostics.ContextsCallerInfo
Information about the caller source code.

Type Parameters

T1
Type of the 1-th parameter.
T2
Type of the 2-th parameter.
See Also

Reference

ILogger Interface
Write Overload
PostSharp.Patterns.Diagnostics.Custom Namespace


ILogger.Write(T1, T2, T3) Method (ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, Exception, CallerInfo)

ILoggerWriteT1, T2, T3 Method (ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, Exception, CallerInfo)

Writes a custom log record with 3 parameters.

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void Write<T1, T2, T3>(
    ILoggingContext context,
    LogLevel level,
    LogRecordKind recordKind,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    Exception exception,
    ref CallerInfo recordInfo
)

Parameters

context
Type: PostSharp.Patterns.Diagnostics.ContextsILoggingContext
level
Type: PostSharp.Patterns.DiagnosticsLogLevel
The severity of the record (e.g. Info or Warning).
recordKind
Type: PostSharp.Patterns.DiagnosticsLogRecordKind
Kind of record.
text
Type: SystemString
The text of the log record, including parameters (e.g. Opening {Path} file {ShareMode} sharing mode).
arg1
Type: T1
Value of the 1-th parameter.
arg2
Type: T2
Value of the 2-th parameter.
arg3
Type: T3
Value of the 3-th parameter.
exception
Type: SystemException
The Exception associated with the record, or null.
recordInfo
Type: PostSharp.Patterns.Diagnostics.ContextsCallerInfo
Information about the caller source code.

Type Parameters

T1
Type of the 1-th parameter.
T2
Type of the 2-th parameter.
T3
Type of the 3-th parameter.
See Also

Reference

ILogger Interface
Write Overload
PostSharp.Patterns.Diagnostics.Custom Namespace


ILogger.Write(T1, T2, T3, T4) Method (ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, T4, Exception, CallerInfo)

ILoggerWriteT1, T2, T3, T4 Method (ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, T4, Exception, CallerInfo)

Writes a custom log record with 4 parameters.

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void Write<T1, T2, T3, T4>(
    ILoggingContext context,
    LogLevel level,
    LogRecordKind recordKind,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    Exception exception,
    ref CallerInfo recordInfo
)

Parameters

context
Type: PostSharp.Patterns.Diagnostics.ContextsILoggingContext
level
Type: PostSharp.Patterns.DiagnosticsLogLevel
The severity of the record (e.g. Info or Warning).
recordKind
Type: PostSharp.Patterns.DiagnosticsLogRecordKind
Kind of record.
text
Type: SystemString
The text of the log record, including parameters (e.g. Opening {Path} file {ShareMode} sharing mode).
arg1
Type: T1
Value of the 1-th parameter.
arg2
Type: T2
Value of the 2-th parameter.
arg3
Type: T3
Value of the 3-th parameter.
arg4
Type: T4
Value of the 4-th parameter.
exception
Type: SystemException
The Exception associated with the record, or null.
recordInfo
Type: PostSharp.Patterns.Diagnostics.ContextsCallerInfo
Information about the caller source code.

Type Parameters

T1
Type of the 1-th parameter.
T2
Type of the 2-th parameter.
T3
Type of the 3-th parameter.
T4
Type of the 4-th parameter.
See Also

Reference

ILogger Interface
Write Overload
PostSharp.Patterns.Diagnostics.Custom Namespace


ILogger.Write(T1, T2, T3, T4, T5) Method (ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, T4, T5, Exception, CallerInfo)

ILoggerWriteT1, T2, T3, T4, T5 Method (ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, T4, T5, Exception, CallerInfo)

Writes a custom log record with 5 parameters.

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void Write<T1, T2, T3, T4, T5>(
    ILoggingContext context,
    LogLevel level,
    LogRecordKind recordKind,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    Exception exception,
    ref CallerInfo recordInfo
)

Parameters

context
Type: PostSharp.Patterns.Diagnostics.ContextsILoggingContext
level
Type: PostSharp.Patterns.DiagnosticsLogLevel
The severity of the record (e.g. Info or Warning).
recordKind
Type: PostSharp.Patterns.DiagnosticsLogRecordKind
Kind of record.
text
Type: SystemString
The text of the log record, including parameters (e.g. Opening {Path} file {ShareMode} sharing mode).
arg1
Type: T1
Value of the 1-th parameter.
arg2
Type: T2
Value of the 2-th parameter.
arg3
Type: T3
Value of the 3-th parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
exception
Type: SystemException
The Exception associated with the record, or null.
recordInfo
Type: PostSharp.Patterns.Diagnostics.ContextsCallerInfo
Information about the caller source code.

Type Parameters

T1
Type of the 1-th parameter.
T2
Type of the 2-th parameter.
T3
Type of the 3-th parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
See Also

Reference

ILogger Interface
Write Overload
PostSharp.Patterns.Diagnostics.Custom Namespace


ILogger.Write(T1, T2, T3, T4, T5, T6) Method (ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, T4, T5, T6, Exception, CallerInfo)

ILoggerWriteT1, T2, T3, T4, T5, T6 Method (ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, T4, T5, T6, Exception, CallerInfo)

Writes a custom log record with 6 parameters.

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void Write<T1, T2, T3, T4, T5, T6>(
    ILoggingContext context,
    LogLevel level,
    LogRecordKind recordKind,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    Exception exception,
    ref CallerInfo recordInfo
)

Parameters

context
Type: PostSharp.Patterns.Diagnostics.ContextsILoggingContext
level
Type: PostSharp.Patterns.DiagnosticsLogLevel
The severity of the record (e.g. Info or Warning).
recordKind
Type: PostSharp.Patterns.DiagnosticsLogRecordKind
Kind of record.
text
Type: SystemString
The text of the log record, including parameters (e.g. Opening {Path} file {ShareMode} sharing mode).
arg1
Type: T1
Value of the 1-th parameter.
arg2
Type: T2
Value of the 2-th parameter.
arg3
Type: T3
Value of the 3-th parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
exception
Type: SystemException
The Exception associated with the record, or null.
recordInfo
Type: PostSharp.Patterns.Diagnostics.ContextsCallerInfo
Information about the caller source code.

Type Parameters

T1
Type of the 1-th parameter.
T2
Type of the 2-th parameter.
T3
Type of the 3-th parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
See Also

Reference

ILogger Interface
Write Overload
PostSharp.Patterns.Diagnostics.Custom Namespace


ILogger.Write(T1, T2, T3, T4, T5, T6, T7) Method (ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, T4, T5, T6, T7, Exception, CallerInfo)

ILoggerWriteT1, T2, T3, T4, T5, T6, T7 Method (ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, T4, T5, T6, T7, Exception, CallerInfo)

Writes a custom log record with 7 parameters.

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void Write<T1, T2, T3, T4, T5, T6, T7>(
    ILoggingContext context,
    LogLevel level,
    LogRecordKind recordKind,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7,
    Exception exception,
    ref CallerInfo recordInfo
)

Parameters

context
Type: PostSharp.Patterns.Diagnostics.ContextsILoggingContext
level
Type: PostSharp.Patterns.DiagnosticsLogLevel
The severity of the record (e.g. Info or Warning).
recordKind
Type: PostSharp.Patterns.DiagnosticsLogRecordKind
Kind of record.
text
Type: SystemString
The text of the log record, including parameters (e.g. Opening {Path} file {ShareMode} sharing mode).
arg1
Type: T1
Value of the 1-th parameter.
arg2
Type: T2
Value of the 2-th parameter.
arg3
Type: T3
Value of the 3-th parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.
exception
Type: SystemException
The Exception associated with the record, or null.
recordInfo
Type: PostSharp.Patterns.Diagnostics.ContextsCallerInfo
Information about the caller source code.

Type Parameters

T1
Type of the 1-th parameter.
T2
Type of the 2-th parameter.
T3
Type of the 3-th parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.
See Also

Reference

ILogger Interface
Write Overload
PostSharp.Patterns.Diagnostics.Custom Namespace


ILogger.Write(T1, T2, T3, T4, T5, T6, T7, T8) Method (ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, T4, T5, T6, T7, T8, Exception, CallerInfo)

ILoggerWriteT1, T2, T3, T4, T5, T6, T7, T8 Method (ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, T4, T5, T6, T7, T8, Exception, CallerInfo)

Writes a custom log record with 8 parameters.

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void Write<T1, T2, T3, T4, T5, T6, T7, T8>(
    ILoggingContext context,
    LogLevel level,
    LogRecordKind recordKind,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7,
    T8 arg8,
    Exception exception,
    ref CallerInfo recordInfo
)

Parameters

context
Type: PostSharp.Patterns.Diagnostics.ContextsILoggingContext
level
Type: PostSharp.Patterns.DiagnosticsLogLevel
The severity of the record (e.g. Info or Warning).
recordKind
Type: PostSharp.Patterns.DiagnosticsLogRecordKind
Kind of record.
text
Type: SystemString
The text of the log record, including parameters (e.g. Opening {Path} file {ShareMode} sharing mode).
arg1
Type: T1
Value of the 1-th parameter.
arg2
Type: T2
Value of the 2-th parameter.
arg3
Type: T3
Value of the 3-th parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.
arg8
Type: T8
Value of the 8-th parameter.
exception
Type: SystemException
The Exception associated with the record, or null.
recordInfo
Type: PostSharp.Patterns.Diagnostics.ContextsCallerInfo
Information about the caller source code.

Type Parameters

T1
Type of the 1-th parameter.
T2
Type of the 2-th parameter.
T3
Type of the 3-th parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.
T8
Type of the 8-th parameter.
See Also

Reference

ILogger Interface
Write Overload
PostSharp.Patterns.Diagnostics.Custom Namespace


ILogger.Write(T1, T2, T3, T4, T5, T6, T7, T8, T9) Method (ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, Exception, CallerInfo)

ILoggerWriteT1, T2, T3, T4, T5, T6, T7, T8, T9 Method (ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, Exception, CallerInfo)

Writes a custom log record with 9 parameters.

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void Write<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
    ILoggingContext context,
    LogLevel level,
    LogRecordKind recordKind,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7,
    T8 arg8,
    T9 arg9,
    Exception exception,
    ref CallerInfo recordInfo
)

Parameters

context
Type: PostSharp.Patterns.Diagnostics.ContextsILoggingContext
level
Type: PostSharp.Patterns.DiagnosticsLogLevel
The severity of the record (e.g. Info or Warning).
recordKind
Type: PostSharp.Patterns.DiagnosticsLogRecordKind
Kind of record.
text
Type: SystemString
The text of the log record, including parameters (e.g. Opening {Path} file {ShareMode} sharing mode).
arg1
Type: T1
Value of the 1-th parameter.
arg2
Type: T2
Value of the 2-th parameter.
arg3
Type: T3
Value of the 3-th parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.
arg8
Type: T8
Value of the 8-th parameter.
arg9
Type: T9
Value of the 9-th parameter.
exception
Type: SystemException
The Exception associated with the record, or null.
recordInfo
Type: PostSharp.Patterns.Diagnostics.ContextsCallerInfo
Information about the caller source code.

Type Parameters

T1
Type of the 1-th parameter.
T2
Type of the 2-th parameter.
T3
Type of the 3-th parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.
T8
Type of the 8-th parameter.
T9
Type of the 9-th parameter.
See Also

Reference

ILogger Interface
Write Overload
PostSharp.Patterns.Diagnostics.Custom Namespace


ILogger.Write(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) Method (ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, Exception, CallerInfo)

ILoggerWriteT1, T2, T3, T4, T5, T6, T7, T8, T9, T10 Method (ILoggingContext, LogLevel, LogRecordKind, String, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, Exception, CallerInfo)

Writes a custom log record with 10 parameters.

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void Write<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
    ILoggingContext context,
    LogLevel level,
    LogRecordKind recordKind,
    string text,
    T1 arg1,
    T2 arg2,
    T3 arg3,
    T4 arg4,
    T5 arg5,
    T6 arg6,
    T7 arg7,
    T8 arg8,
    T9 arg9,
    T10 arg10,
    Exception exception,
    ref CallerInfo recordInfo
)

Parameters

context
Type: PostSharp.Patterns.Diagnostics.ContextsILoggingContext
level
Type: PostSharp.Patterns.DiagnosticsLogLevel
The severity of the record (e.g. Info or Warning).
recordKind
Type: PostSharp.Patterns.DiagnosticsLogRecordKind
Kind of record.
text
Type: SystemString
The text of the log record, including parameters (e.g. Opening {Path} file {ShareMode} sharing mode).
arg1
Type: T1
Value of the 1-th parameter.
arg2
Type: T2
Value of the 2-th parameter.
arg3
Type: T3
Value of the 3-th parameter.
arg4
Type: T4
Value of the 4-th parameter.
arg5
Type: T5
Value of the 5-th parameter.
arg6
Type: T6
Value of the 6-th parameter.
arg7
Type: T7
Value of the 7-th parameter.
arg8
Type: T8
Value of the 8-th parameter.
arg9
Type: T9
Value of the 9-th parameter.
arg10
Type: T10
Value of the 10-th parameter.
exception
Type: SystemException
The Exception associated with the record, or null.
recordInfo
Type: PostSharp.Patterns.Diagnostics.ContextsCallerInfo
Information about the caller source code.

Type Parameters

T1
Type of the 1-th parameter.
T2
Type of the 2-th parameter.
T3
Type of the 3-th parameter.
T4
Type of the 4-th parameter.
T5
Type of the 5-th parameter.
T6
Type of the 6-th parameter.
T7
Type of the 7-th parameter.
T8
Type of the 8-th parameter.
T9
Type of the 9-th parameter.
T10
Type of the 10-th parameter.
See Also

Reference

ILogger Interface
Write Overload
PostSharp.Patterns.Diagnostics.Custom Namespace


ILoggerExceptionHandler Interface

Defines methods called in case of exception in the Logger class. This interface can be implemented by any class implementing the ILogger interface. When an ILogger does not implement this interface, logging exceptions are simply silently ignored.

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ILoggerExceptionHandler

The ILoggerExceptionHandler type exposes the following members.

Methods
 | Name | Description
Public method | OnInternalException | Method invoked when an exception is thrown in logging code.
Public method | OnInvalidUserCode | Method invoked when the user code calling Logger or LogActivity is invalid, e.g. when the formatting string is incorrect or does not match the arguments.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Custom Namespace


ILoggerExceptionHandler Methods

The ILoggerExceptionHandler type exposes the following members.

Methods
 | Name | Description
Public method | OnInternalException | Method invoked when an exception is thrown in logging code.
Public method | OnInvalidUserCode | Method invoked when the user code calling Logger or LogActivity is invalid, e.g. when the formatting string is incorrect or does not match the arguments.
Top
See Also

Reference

ILoggerExceptionHandler Interface
PostSharp.Patterns.Diagnostics.Custom Namespace


ILoggerExceptionHandler.OnInternalException Method

ILoggerExceptionHandlerOnInternalException Method

Method invoked when an exception is thrown in logging code.

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void OnInternalException(
    Exception exception
)

Parameters

exception
Type: SystemException
The Exception.
See Also

Reference

ILoggerExceptionHandler Interface
PostSharp.Patterns.Diagnostics.Custom Namespace


ILoggerExceptionHandler.OnInvalidUserCode Method

ILoggerExceptionHandlerOnInvalidUserCode Method

Method invoked when the user code calling Logger or LogActivity is invalid, e.g. when the formatting string is incorrect or does not match the arguments.

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void OnInvalidUserCode(
    ref CallerInfo callerInfo,
    string format,
    params Object[] args
)

Parameters

callerInfo
Type: PostSharp.Patterns.Diagnostics.ContextsCallerInfo
Information about the line of code causing the error.
format
Type: SystemString
Formatting string of the error message.
args
Type: SystemObject
Arguments.
See Also

Reference

ILoggerExceptionHandler Interface
PostSharp.Patterns.Diagnostics.Custom Namespace


ILoggerFactory Interface

Creates instances of the ILogger interface. An instance of this interface must be registered into the ServiceLocator.

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ILoggerFactory

The ILoggerFactory type exposes the following members.

Methods
 | Name | Description
Public method | GetLogger | Gets an instance of the ILogger interface for a given role and Type.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Custom Namespace


ILoggerFactory Methods

The ILoggerFactory type exposes the following members.

Methods
 | Name | Description
Public method | GetLogger | Gets an instance of the ILogger interface for a given role and Type.
Top
See Also

Reference

ILoggerFactory Interface
PostSharp.Patterns.Diagnostics.Custom Namespace


ILoggerFactory.GetLogger Method

ILoggerFactoryGetLogger Method

Gets an instance of the ILogger interface for a given role and Type.

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
ILogger GetLogger(
    string role,
    Type type
)

Parameters

role
Type: SystemString
The role for which the logger is requested.
type
Type: SystemType
The type of the source code that will emit the records.

Return Value

Type: ILogger
An instance of the ILogger interface for role and type.
See Also

Reference

ILoggerFactory Interface
PostSharp.Patterns.Diagnostics.Custom Namespace


InvalidFormattingStringException Class

Exception thrown by the FormattingStringParser and by the Logger class when user code provides an invalid formatting string.
Inheritance Hierarchy
SystemObject
SystemException
SystemSystemException
SystemFormatException
PostSharp.Patterns.Diagnostics.CustomInvalidFormattingStringException

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public class InvalidFormattingStringException : FormatException
Constructors
 | Name | Description
Public method | InvalidFormattingStringException | Initializes a new InvalidFormattingStringException with the default error message.
Public method | InvalidFormattingStringException(String) | Initializes a new InvalidFormattingStringException and specifies the error message.
Protected method | InvalidFormattingStringException(SerializationInfo, StreamingContext) | Deserialization constructor.
Public method | InvalidFormattingStringException(String, Exception) | Initializes a new InvalidFormattingStringException and specifies the error message and the inner Exception.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Custom Namespace


InvalidFormattingStringException Constructor

Overload List
 | Name | Description
Public method | InvalidFormattingStringException | Initializes a new InvalidFormattingStringException with the default error message.
Public method | InvalidFormattingStringException(String) | Initializes a new InvalidFormattingStringException and specifies the error message.
Protected method | InvalidFormattingStringException(SerializationInfo, StreamingContext) | Deserialization constructor.
Public method | InvalidFormattingStringException(String, Exception) | Initializes a new InvalidFormattingStringException and specifies the error message and the inner Exception.
Top
See Also

Reference

InvalidFormattingStringException Class
PostSharp.Patterns.Diagnostics.Custom Namespace


InvalidFormattingStringException Constructor

Initializes a new InvalidFormattingStringException with the default error message.

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public InvalidFormattingStringException()
See Also

Reference

InvalidFormattingStringException Class
InvalidFormattingStringException Overload
PostSharp.Patterns.Diagnostics.Custom Namespace


InvalidFormattingStringException Constructor (String)

Initializes a new InvalidFormattingStringException and specifies the error message.

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public InvalidFormattingStringException(
    string message
)

Parameters

message
Type: SystemString
The error message.
See Also

Reference

InvalidFormattingStringException Class
InvalidFormattingStringException Overload
PostSharp.Patterns.Diagnostics.Custom Namespace


InvalidFormattingStringException Constructor (SerializationInfo, StreamingContext)

Deserialization constructor.

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected InvalidFormattingStringException(
    SerializationInfo info,
    StreamingContext context
)

Parameters

info
Type: System.Runtime.SerializationSerializationInfo
context
Type: System.Runtime.SerializationStreamingContext
See Also

Reference

InvalidFormattingStringException Class
InvalidFormattingStringException Overload
PostSharp.Patterns.Diagnostics.Custom Namespace


InvalidFormattingStringException Constructor (String, Exception)

Initializes a new InvalidFormattingStringException and specifies the error message and the inner Exception.

Namespace: PostSharp.Patterns.Diagnostics.Custom
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public InvalidFormattingStringException(
    string message,
    Exception inner
)

Parameters

message
Type: SystemString
inner
Type: SystemException
See Also

Reference

InvalidFormattingStringException Class
InvalidFormattingStringException Overload
PostSharp.Patterns.Diagnostics.Custom Namespace


PostSharp.Patterns.Diagnostics.Formatters Namespace

Classes
 | Class | Description
Public class | CollectionFormatterTKind, T | Formatter for any type that implements IEnumerableT.
Public class | HiddenFormatterT | Formatters that always writes ******* to the output.
Public class | LazyFormatterTKind, T | Formatter for LazyT.
Public class | LoggingFormattingRole | The FormattingRole for the Logging component.
Public class | OutFormatterT | Always writes <out> to the output. Used to render the input value of out parameters.
Structures
 | Structure | Description
Public structure | RefStructSurrogate | Struct that is passed to SetParameterT(Int32, String, ParameterKind, String, T) when the parameter is of a ref struct type. This struct wraps the return value of the ToString method of the ref struct.
Interfaces
 | Interface | Description
Public interface | IOverrideFormatter | Marker interface that indicates that this is a special FormatterT that should be used even in back-ends which don't normally use formatters.


CollectionFormatter(TKind, T) Class

CollectionFormatterTKind, T Class

Formatter for any type that implements IEnumerableT.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.FormattersFormatter IEnumerable T
PostSharp.Patterns.Diagnostics.FormattersCollectionFormatterTKind, T

Namespace: PostSharp.Patterns.Diagnostics.Formatters
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class CollectionFormatter<TKind, T> : Formatter<IEnumerable<T>>
where TKind : new(), FormattingRole

Type Parameters

TKind
T

The CollectionFormatterTKind, T type exposes the following members.

Constructors
 | Name | Description
Public method | CollectionFormatterTKind, T | Initializes a new instance of the CollectionFormatterTKind, T class
Top
Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from FormatterT.)
Top
Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, IEnumerableT) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Formatters Namespace


CollectionFormatter(TKind, T) Constructor

CollectionFormatterTKind, T Constructor

Initializes a new instance of the CollectionFormatterTKind, T class

Namespace: PostSharp.Patterns.Diagnostics.Formatters
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CollectionFormatter()
See Also

Reference

CollectionFormatterTKind, T Class
PostSharp.Patterns.Diagnostics.Formatters Namespace


CollectionFormatter(TKind, T) Properties

CollectionFormatterTKind, T Properties

The CollectionFormatterTKind, T generic type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from FormatterT.)
Top
See Also

Reference

CollectionFormatterTKind, T Class
PostSharp.Patterns.Diagnostics.Formatters Namespace


CollectionFormatter(TKind, T) Methods

CollectionFormatterTKind, T Methods

Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, IEnumerableT) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Top
See Also

Reference

CollectionFormatterTKind, T Class
PostSharp.Patterns.Diagnostics.Formatters Namespace


CollectionFormatter(TKind, T).Write Method

CollectionFormatterTKind, TWrite Method

Overload List
 | Name | Description
Public method | Write(UnsafeStringBuilder, IEnumerableT) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Top
See Also

Reference

CollectionFormatterTKind, T Class
PostSharp.Patterns.Diagnostics.Formatters Namespace


CollectionFormatter(TKind, T).Write Method (UnsafeStringBuilder, IEnumerable(T))

CollectionFormatterTKind, TWrite Method (UnsafeStringBuilder, IEnumerableT)

Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant).

Namespace: PostSharp.Patterns.Diagnostics.Formatters
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void Write(
    UnsafeStringBuilder stringBuilder,
    IEnumerable<T> value
)

Parameters

stringBuilder
Type: PostSharp.Patterns.FormattersUnsafeStringBuilder
The target UnsafeStringBuilder.
value
Type: System.Collections.GenericIEnumerable T
The value to be formatted.

Implements

IFormatterTWrite(UnsafeStringBuilder, T)
See Also

Reference

CollectionFormatterTKind, T Class
Write Overload
PostSharp.Patterns.Diagnostics.Formatters Namespace

Other Resources

Conceptual: Implementing a Custom Formatter


HiddenFormatter(T) Class

HiddenFormatterT Class

Formatters that always writes ******* to the output.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.FormattersFormatter T
PostSharp.Patterns.Diagnostics.FormattersHiddenFormatterT

Namespace: PostSharp.Patterns.Diagnostics.Formatters
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class HiddenFormatter<T> : Formatter<T>,
    IOverrideFormatter

Type Parameters

T

The HiddenFormatterT type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from FormatterT.)
 | Instance | Gets the singleton instance of HiddenFormatterT.
Top
Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, T) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, Object).)
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Formatters Namespace


HiddenFormatter(T) Properties

HiddenFormatterT Properties

The HiddenFormatterT generic type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from FormatterT.)
 | Instance | Gets the singleton instance of HiddenFormatterT.
Top
See Also

Reference

HiddenFormatterT Class
PostSharp.Patterns.Diagnostics.Formatters Namespace


HiddenFormatter(T).Instance Property

HiddenFormatterTInstance Property

Gets the singleton instance of HiddenFormatterT.

Namespace: PostSharp.Patterns.Diagnostics.Formatters
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static HiddenFormatter<T> Instance { get; }

Property Value

Type: HiddenFormatter T
See Also

Reference

HiddenFormatterT Class
PostSharp.Patterns.Diagnostics.Formatters Namespace


HiddenFormatter(T) Methods

HiddenFormatterT Methods

Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, T) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, Object).)
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Top
See Also

Reference

HiddenFormatterT Class
PostSharp.Patterns.Diagnostics.Formatters Namespace


HiddenFormatter(T).Write Method

HiddenFormatterTWrite Method

Overload List
 | Name | Description
Public method | Write(UnsafeStringBuilder, T) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, Object).)
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Top
See Also

Reference

HiddenFormatterT Class
PostSharp.Patterns.Diagnostics.Formatters Namespace


HiddenFormatter(T).Write Method (UnsafeStringBuilder, T)

HiddenFormatterTWrite Method (UnsafeStringBuilder, T)

Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant).

Namespace: PostSharp.Patterns.Diagnostics.Formatters
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void Write(
    UnsafeStringBuilder stringBuilder,
    T value
)

Parameters

stringBuilder
Type: PostSharp.Patterns.FormattersUnsafeStringBuilder
The target UnsafeStringBuilder.
value
Type: T
The value to be formatted.

Implements

IFormatterTWrite(UnsafeStringBuilder, T)
See Also

Reference

HiddenFormatterT Class
Write Overload
PostSharp.Patterns.Diagnostics.Formatters Namespace


IOverrideFormatter Interface

Marker interface that indicates that this is a special FormatterT that should be used even in back-ends which don't normally use formatters.

Namespace: PostSharp.Patterns.Diagnostics.Formatters
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IOverrideFormatter
See Also

Reference

PostSharp.Patterns.Diagnostics.Formatters Namespace


LazyFormatter(TKind, T) Class

LazyFormatterTKind, T Class

Formatter for LazyT.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.FormattersFormatter Lazy T
PostSharp.Patterns.Diagnostics.FormattersLazyFormatterTKind, T

Namespace: PostSharp.Patterns.Diagnostics.Formatters
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class LazyFormatter<TKind, T> : Formatter<Lazy<T>>
where TKind : new(), FormattingRole

Type Parameters

TKind
T

The LazyFormatterTKind, T type exposes the following members.

Constructors
 | Name | Description
Public method | LazyFormatterTKind, T | Initializes a new instance of the LazyFormatterTKind, T class
Top
Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from FormatterT.)
Top
Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, LazyT) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Formatters Namespace


LazyFormatter(TKind, T) Constructor

LazyFormatterTKind, T Constructor

Initializes a new instance of the LazyFormatterTKind, T class

Namespace: PostSharp.Patterns.Diagnostics.Formatters
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LazyFormatter()
See Also

Reference

LazyFormatterTKind, T Class
PostSharp.Patterns.Diagnostics.Formatters Namespace


LazyFormatter(TKind, T) Properties

LazyFormatterTKind, T Properties

The LazyFormatterTKind, T generic type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from FormatterT.)
Top
See Also

Reference

LazyFormatterTKind, T Class
PostSharp.Patterns.Diagnostics.Formatters Namespace


LazyFormatter(TKind, T) Methods

LazyFormatterTKind, T Methods

Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, LazyT) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Top
See Also

Reference

LazyFormatterTKind, T Class
PostSharp.Patterns.Diagnostics.Formatters Namespace


LazyFormatter(TKind, T).Write Method

LazyFormatterTKind, TWrite Method

Overload List
 | Name | Description
Public method | Write(UnsafeStringBuilder, LazyT) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Top
See Also

Reference

LazyFormatterTKind, T Class
PostSharp.Patterns.Diagnostics.Formatters Namespace


LazyFormatter(TKind, T).Write Method (UnsafeStringBuilder, Lazy(T))

LazyFormatterTKind, TWrite Method (UnsafeStringBuilder, LazyT)

Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant).

Namespace: PostSharp.Patterns.Diagnostics.Formatters
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void Write(
    UnsafeStringBuilder stringBuilder,
    Lazy<T> value
)

Parameters

stringBuilder
Type: PostSharp.Patterns.FormattersUnsafeStringBuilder
The target UnsafeStringBuilder.
value
Type: SystemLazy T
The value to be formatted.

Implements

IFormatterTWrite(UnsafeStringBuilder, T)
See Also

Reference

LazyFormatterTKind, T Class
Write Overload
PostSharp.Patterns.Diagnostics.Formatters Namespace

Other Resources

Conceptual: Implementing a Custom Formatter


LoggingFormattingRole Class

The FormattingRole for the Logging component.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.FormattersFormattingRole
PostSharp.Patterns.Diagnostics.FormattersLoggingFormattingRole

Namespace: PostSharp.Patterns.Diagnostics.Formatters
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class LoggingFormattingRole : FormattingRole

The LoggingFormattingRole type exposes the following members.

Constructors
 | Name | Description
Public method | LoggingFormattingRole | Initializes a new LoggingFormattingRole.
Top
Properties
 | Name | Description
Public property | LoggingRole | Gets the logging role name (see LoggingRoles). (Overrides FormattingRoleLoggingRole.)
Public property | Name | Gets the name of the FormattingRole. (Overrides FormattingRoleName.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Formatters Namespace


LoggingFormattingRole Constructor

Initializes a new LoggingFormattingRole.

Namespace: PostSharp.Patterns.Diagnostics.Formatters
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LoggingFormattingRole()
See Also

Reference

LoggingFormattingRole Class
PostSharp.Patterns.Diagnostics.Formatters Namespace


LoggingFormattingRole Properties

The LoggingFormattingRole type exposes the following members.

Properties
 | Name | Description
Public property | LoggingRole | Gets the logging role name (see LoggingRoles). (Overrides FormattingRoleLoggingRole.)
Public property | Name | Gets the name of the FormattingRole. (Overrides FormattingRoleName.)
Top
See Also

Reference

LoggingFormattingRole Class
PostSharp.Patterns.Diagnostics.Formatters Namespace


LoggingFormattingRole.LoggingRole Property

LoggingFormattingRoleLoggingRole Property

Gets the logging role name (see LoggingRoles).

Namespace: PostSharp.Patterns.Diagnostics.Formatters
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override string LoggingRole { get; }

Property Value

Type: String
See Also

Reference

LoggingFormattingRole Class
PostSharp.Patterns.Diagnostics.Formatters Namespace


LoggingFormattingRole.Name Property

LoggingFormattingRoleName Property

Gets the name of the FormattingRole.

Namespace: PostSharp.Patterns.Diagnostics.Formatters
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override string Name { get; }

Property Value

Type: String
See Also

Reference

LoggingFormattingRole Class
PostSharp.Patterns.Diagnostics.Formatters Namespace


OutFormatter(T) Class

OutFormatterT Class

Always writes <out> to the output. Used to render the input value of out parameters.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.FormattersFormatter T
PostSharp.Patterns.Diagnostics.FormattersOutFormatterT

Namespace: PostSharp.Patterns.Diagnostics.Formatters
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class OutFormatter<T> : Formatter<T>,
    IOverrideFormatter

Type Parameters

T

The OutFormatterT type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from FormatterT.)
 | Instance | The singleton instance of OutFormatterT.
Top
Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, T) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, Object).)
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Formatters Namespace


OutFormatter(T) Properties

OutFormatterT Properties

The OutFormatterT generic type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from FormatterT.)
 | Instance | The singleton instance of OutFormatterT.
Top
See Also

Reference

OutFormatterT Class
PostSharp.Patterns.Diagnostics.Formatters Namespace


OutFormatter(T).Instance Property

OutFormatterTInstance Property

The singleton instance of OutFormatterT.

Namespace: PostSharp.Patterns.Diagnostics.Formatters
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static OutFormatter<T> Instance { get; }

Property Value

Type: OutFormatter T
See Also

Reference

OutFormatterT Class
PostSharp.Patterns.Diagnostics.Formatters Namespace


OutFormatter(T) Methods

OutFormatterT Methods

Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, T) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, Object).)
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Top
See Also

Reference

OutFormatterT Class
PostSharp.Patterns.Diagnostics.Formatters Namespace


OutFormatter(T).Write Method

OutFormatterTWrite Method

Overload List
 | Name | Description
Public method | Write(UnsafeStringBuilder, T) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, Object).)
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Top
See Also

Reference

OutFormatterT Class
PostSharp.Patterns.Diagnostics.Formatters Namespace


OutFormatter(T).Write Method (UnsafeStringBuilder, T)

OutFormatterTWrite Method (UnsafeStringBuilder, T)

Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant).

Namespace: PostSharp.Patterns.Diagnostics.Formatters
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void Write(
    UnsafeStringBuilder stringBuilder,
    T value
)

Parameters

stringBuilder
Type: PostSharp.Patterns.FormattersUnsafeStringBuilder
The target UnsafeStringBuilder.
value
Type: T
The value to be formatted.

Implements

IFormatterTWrite(UnsafeStringBuilder, T)
See Also

Reference

OutFormatterT Class
Write Overload
PostSharp.Patterns.Diagnostics.Formatters Namespace


RefStructSurrogate Structure

Struct that is passed to SetParameterT(Int32, String, ParameterKind, String, T) when the parameter is of a ref struct type. This struct wraps the return value of the ToString method of the ref struct.

Namespace: PostSharp.Patterns.Diagnostics.Formatters
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public struct RefStructSurrogate : IFormattable

The RefStructSurrogate type exposes the following members.

Constructors
 | Name | Description
Public method | RefStructSurrogate | Initializes a new instance of the RefStructSurrogate class
Top
Methods
 | Name | Description
Public method | Format |
Public method | ToString | (Overrides ValueTypeToString.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.Formatters Namespace


RefStructSurrogate Constructor

Initializes a new instance of the RefStructSurrogate class

Namespace: PostSharp.Patterns.Diagnostics.Formatters
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public RefStructSurrogate(
    string toStringValue
)

Parameters

toStringValue
Type: SystemString
See Also

Reference

RefStructSurrogate Structure
PostSharp.Patterns.Diagnostics.Formatters Namespace


RefStructSurrogate Methods

The RefStructSurrogate type exposes the following members.

Methods
 | Name | Description
Public method | Format |
Public method | ToString | (Overrides ValueTypeToString.)
Top
See Also

Reference

RefStructSurrogate Structure
PostSharp.Patterns.Diagnostics.Formatters Namespace


RefStructSurrogate.Format Method

RefStructSurrogateFormat Method

Namespace: PostSharp.Patterns.Diagnostics.Formatters
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Format(
    UnsafeStringBuilder stringBuilder,
    FormattingRole role
)

Parameters

stringBuilder
Type: PostSharp.Patterns.FormattersUnsafeStringBuilder
role
Type: PostSharp.Patterns.FormattersFormattingRole

Implements

IFormattableFormat(UnsafeStringBuilder, FormattingRole)
See Also

Reference

RefStructSurrogate Structure
PostSharp.Patterns.Diagnostics.Formatters Namespace


RefStructSurrogate.ToString Method

RefStructSurrogateToString Method

Namespace: PostSharp.Patterns.Diagnostics.Formatters
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override string ToString()

Return Value

Type: String
See Also

Reference

RefStructSurrogate Structure
PostSharp.Patterns.Diagnostics.Formatters Namespace


PostSharp.Patterns.Diagnostics.RecordBuilders Namespace

Classes
 | Class | Description
Public class | LogRecordBuilder | Builds log record (typically, but not necessarily a string) for an action. You can think of the LogRecordBuilder as a semantic StringBuilder. PostSharp emits code that invoke methods such as SetParameterT(Int32, String, ParameterKind, String, T) or SetReturnValueT(Int32, String, String, T, IFormatterT), and the responsibility of the LogRecordBuilder is to format a record and emit it to the back-end.
Public class | TextLogRecordBuilder | An implementation of LogRecordBuilder that builds text-based log records. This class is the base class for most back-ends.
Enumerations
 | Enumeration | Description
Public enumeration | SemanticParameterKind | Enumerates the kinds of semantic parameters passed to the AppendSemanticParameter(SemanticParameterKind, String, String, String, Int32) method. The enumeration is a bit mask. Values can be combined with the | operator.


LogRecordBuilder Class

Builds log record (typically, but not necessarily a string) for an action. You can think of the LogRecordBuilder as a semantic StringBuilder. PostSharp emits code that invoke methods such as SetParameterT(Int32, String, ParameterKind, String, T) or SetReturnValueT(Int32, String, String, T, IFormatterT), and the responsibility of the LogRecordBuilder is to format a record and emit it to the back-end.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.RecordBuildersLogRecordBuilder
PostSharp.Patterns.Diagnostics.RecordBuildersTextLogRecordBuilder

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class LogRecordBuilder : IDisposable

The LogRecordBuilder type exposes the following members.

Constructors
 | Name | Description
Protected method | LogRecordBuilder | Initializes a new instance of the LogRecordBuilder class
Top
Properties
 | Name | Description
Protected property | Context | Gets the LoggingContext to which the record belongs.
Public property | IsDisposed |
Protected property | RecordKind | Gets the kind of the current record (e.g. MethodEntry or MethodException).
Protected property | ThreadContext | Gets the ThreadLoggingContext to which the current LogRecordBuilder belongs.
Top
Methods
 | Name | Description
Public method | BeginCustomRecord | Initializes the current LogRecordBuilder to emit a custom record.
Public method | BeginRecord | Initializes the current LogRecordBuilder to emit a standard (i.e. non-custom) record for a given context and method.
Public method | Complete | Emits the record and resets the current LogRecordBuilder. This method invoked after all SetThisT(T), SetParameterT(Int32, String, ParameterKind, String, T) and similar methods have been called.
Public method | Dispose | Releases all resources used by the LogRecordBuilder
Protected method | EmitRecord | Emits the record. Invoked by the Complete method.
Protected method | Reset | Resets all fields and properties of the current LogRecordBuilder to their initial value. Invoked by the Complete method.
Public method | SetException | Sets the exception for the method or activity.
Public method | SetExecutionTime | Sets the method or activity execution time.
Public method | SetMethodGenericParameterT | Not implemented.
Public method | SetParameterT(Int32, String, ParameterKind, String, T) | Sets the value of a given parameter and uses the default formatter.
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT.
Public method | SetRefStructParameter |
Public method | SetReturnValueT(Int32, String, String, T) | Sets a given return value (there can be several return values in C# 7.0) and uses the default formatter.
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter.
Public method | SetThisT(T) | Sets the this (instance) value and uses the default formatter. This method is only invoked if the IncludeThisValue property is true.
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter.
Public method | SetTypeGenericParameterT | Not implemented.
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T) | Writes a custom parameter and uses the default formatter.
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter.
Public method | WriteCustomString | Write a chunk of custom string.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


LogRecordBuilder Constructor

Initializes a new instance of the LogRecordBuilder class

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected LogRecordBuilder()
See Also

Reference

LogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


LogRecordBuilder Properties

The LogRecordBuilder type exposes the following members.

Properties
 | Name | Description
Protected property | Context | Gets the LoggingContext to which the record belongs.
Public property | IsDisposed |
Protected property | RecordKind | Gets the kind of the current record (e.g. MethodEntry or MethodException).
Protected property | ThreadContext | Gets the ThreadLoggingContext to which the current LogRecordBuilder belongs.
Top
See Also

Reference

LogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


LogRecordBuilder.Context Property

LogRecordBuilderContext Property

Gets the LoggingContext to which the record belongs.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected LoggingContext Context { get; }

Property Value

Type: LoggingContext
See Also

Reference

LogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


LogRecordBuilder.IsDisposed Property

LogRecordBuilderIsDisposed Property

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsDisposed { get; }

Property Value

Type: Boolean
See Also

Reference

LogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


LogRecordBuilder.RecordKind Property

LogRecordBuilderRecordKind Property

Gets the kind of the current record (e.g. MethodEntry or MethodException).

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected LogRecordKind RecordKind { get; }

Property Value

Type: LogRecordKind
See Also

Reference

LogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


LogRecordBuilder.ThreadContext Property

LogRecordBuilderThreadContext Property

Gets the ThreadLoggingContext to which the current LogRecordBuilder belongs.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected ThreadLoggingContext ThreadContext { get; }

Property Value

Type: ThreadLoggingContext
See Also

Reference

LogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


LogRecordBuilder Methods

The LogRecordBuilder type exposes the following members.

Methods
 | Name | Description
Public method | BeginCustomRecord | Initializes the current LogRecordBuilder to emit a custom record.
Public method | BeginRecord | Initializes the current LogRecordBuilder to emit a standard (i.e. non-custom) record for a given context and method.
Public method | Complete | Emits the record and resets the current LogRecordBuilder. This method invoked after all SetThisT(T), SetParameterT(Int32, String, ParameterKind, String, T) and similar methods have been called.
Public method | Dispose |
Protected method | EmitRecord | Emits the record. Invoked by the Complete method.
Protected method | Reset | Resets all fields and properties of the current LogRecordBuilder to their initial value. Invoked by the Complete method.
Public method | SetException | Sets the exception for the method or activity.
Public method | SetExecutionTime | Sets the method or activity execution time.
Public method | SetMethodGenericParameterT | Not implemented.
Public method | SetParameterT(Int32, String, ParameterKind, String, T) | Sets the value of a given parameter and uses the default formatter.
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT.
Public method | SetRefStructParameter |
Public method | SetReturnValueT(Int32, String, String, T) | Sets a given return value (there can be several return values in C# 7.0) and uses the default formatter.
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter.
Public method | SetThisT(T) | Sets the this (instance) value and uses the default formatter. This method is only invoked if the IncludeThisValue property is true.
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter.
Public method | SetTypeGenericParameterT | Not implemented.
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T) | Writes a custom parameter and uses the default formatter.
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter.
Public method | WriteCustomString | Write a chunk of custom string.
Top
See Also

Reference

LogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


LogRecordBuilder.BeginCustomRecord Method

LogRecordBuilderBeginCustomRecord Method

Initializes the current LogRecordBuilder to emit a custom record.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void BeginCustomRecord(
    LoggingContext context,
    ref CustomLogRecordInfo recordInfo
)

Parameters

context
Type: PostSharp.Patterns.Diagnostics.ContextsLoggingContext
The parent LoggingContext of the record.
recordInfo
Type: PostSharp.Patterns.Diagnostics.ContextsCustomLogRecordInfo
Information about the record.
See Also

Reference

LogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


LogRecordBuilder.BeginRecord Method

LogRecordBuilderBeginRecord Method

Initializes the current LogRecordBuilder to emit a standard (i.e. non-custom) record for a given context and method.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void BeginRecord(
    LoggingContext context,
    ref LogRecordInfo recordInfo,
    ref LogMemberInfo memberInfo
)

Parameters

context
Type: PostSharp.Patterns.Diagnostics.ContextsLoggingContext
The parent LoggingContext of the record.
recordInfo
Type: PostSharp.Patterns.Diagnostics.ContextsLogRecordInfo
Information about the record.
memberInfo
Type: PostSharp.Patterns.Diagnostics.ContextsLogMemberInfo
Information about the method, property, or field.
See Also

Reference

LogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


LogRecordBuilder.Complete Method

LogRecordBuilderComplete Method

Emits the record and resets the current LogRecordBuilder. This method invoked after all SetThisT(T), SetParameterT(Int32, String, ParameterKind, String, T) and similar methods have been called.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Complete()
See Also

Reference

LogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


LogRecordBuilder.Dispose Method

LogRecordBuilderDispose Method

Releases all resources used by the LogRecordBuilder

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Dispose()

Implements

IDisposableDispose
See Also

Reference

LogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


LogRecordBuilder.EmitRecord Method

LogRecordBuilderEmitRecord Method

Emits the record. Invoked by the Complete method.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected abstract void EmitRecord()
See Also

Reference

LogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


LogRecordBuilder.Reset Method

LogRecordBuilderReset Method

Resets all fields and properties of the current LogRecordBuilder to their initial value. Invoked by the Complete method.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void Reset()
See Also

Reference

LogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


LogRecordBuilder.SetException Method

LogRecordBuilderSetException Method

Sets the exception for the method or activity.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void SetException(
    Exception exception
)

Parameters

exception
Type: SystemException
An Exception.
See Also

Reference

LogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


LogRecordBuilder.SetExecutionTime Method

LogRecordBuilderSetExecutionTime Method

Sets the method or activity execution time.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void SetExecutionTime(
    double executionTime,
    bool isOvertime
)

Parameters

executionTime
Type: SystemDouble
The execution time, in milliseconds.
isOvertime
Type: SystemBoolean
true if executionTime is over the threshold set in ExecutionTimeThreshold, otherwise false.
See Also

Reference

LogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


LogRecordBuilder.SetMethodGenericParameter(T) Method

LogRecordBuilderSetMethodGenericParameterT Method

Not implemented.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void SetMethodGenericParameter<T>(
    int index
)

Parameters

index
Type: SystemInt32

Type Parameters

T
See Also

Reference

LogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


LogRecordBuilder.SetParameter Method

LogRecordBuilderSetParameter Method

Overload List
 | Name | Description
Public method | SetParameterT(Int32, String, ParameterKind, String, T) | Sets the value of a given parameter and uses the default formatter.
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT.
Top
See Also

Reference

LogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


LogRecordBuilder.SetParameter(T) Method (Int32, String, ParameterKind, String, T)

LogRecordBuilderSetParameterT Method (Int32, String, ParameterKind, String, T)

Sets the value of a given parameter and uses the default formatter.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void SetParameter<T>(
    int index,
    string parameterName,
    ParameterKind parameterKind,
    string typeName,
    T value
)

Parameters

index
Type: SystemInt32
Index of the parameter in the list of method parameters.
parameterName
Type: SystemString
Name of the parameter (only included if the IncludeParameterName property is true).
parameterKind
Type: PostSharp.ReflectionParameterKind
The kind of the parameter (whether the parameter is by ref or by value, input or output).
typeName
Type: SystemString
Formatted name of the type T (only included if the IncludeParameterType property is true).
value
Type: T
Value of the parameter (only included if the IncludeParameterValue property is true).

Type Parameters

T
Type of the parameter.
Remarks
The return value is set by the method SetReturnValueT(Int32, String, String, T). Thus the value of the parameterKind is never ReturnValue or ReturnRef.
See Also

Reference

LogRecordBuilder Class
SetParameter Overload
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


LogRecordBuilder.SetParameter(T) Method (Int32, String, ParameterKind, String, T, IFormatter(T))

LogRecordBuilderSetParameterT Method (Int32, String, ParameterKind, String, T, IFormatterT)

Sets the value of a given parameter and specifies the FormatterT.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void SetParameter<T>(
    int index,
    string parameterName,
    ParameterKind parameterKind,
    string typeName,
    T value,
    IFormatter<T> formatter
)

Parameters

index
Type: SystemInt32
Index of the parameter in the list of method parameters.
parameterName
Type: SystemString
Name of the parameter (only included if the IncludeParameterName property is true).
parameterKind
Type: PostSharp.ReflectionParameterKind
The kind of the parameter (whether the parameter is by ref or by value, input or output).
typeName
Type: SystemString
Formatted name of the type T (only included if the IncludeParameterType property is true).
value
Type: T
Value of the parameter (only included if the IncludeParameterValue property is true).
formatter
Type: PostSharp.Patterns.FormattersIFormatter T
Formatter to be used to format value.

Type Parameters

T
Type of the parameter.
Remarks
The return value is set by the method SetReturnValueT(Int32, String, String, T, IFormatterT). Thus the value of the parameterKind is never ReturnValue or ReturnRef.
See Also

Reference

LogRecordBuilder Class
SetParameter Overload
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


LogRecordBuilder.SetRefStructParameter Method

LogRecordBuilderSetRefStructParameter Method

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void SetRefStructParameter(
    int index,
    string parameterName,
    ParameterKind parameterKind,
    string typeName,
    Type type,
    string toStringValue
)

Parameters

index
Type: SystemInt32
parameterName
Type: SystemString
parameterKind
Type: PostSharp.ReflectionParameterKind
typeName
Type: SystemString
type
Type: SystemType
toStringValue
Type: SystemString
See Also

Reference

LogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


LogRecordBuilder.SetReturnValue Method

LogRecordBuilderSetReturnValue Method

Overload List
 | Name | Description
Public method | SetReturnValueT(Int32, String, String, T) | Sets a given return value (there can be several return values in C# 7.0) and uses the default formatter.
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter.
Top
See Also

Reference

LogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


LogRecordBuilder.SetReturnValue(T) Method (Int32, String, String, T)

LogRecordBuilderSetReturnValueT Method (Int32, String, String, T)

Sets a given return value (there can be several return values in C# 7.0) and uses the default formatter.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void SetReturnValue<T>(
    int index,
    string returnValueName,
    string typeName,
    T value
)

Parameters

index
Type: SystemInt32
Index of the return value.
returnValueName
Type: SystemString
Name of the return value, or null if there is only one return value in the method.
typeName
Type: SystemString
Formatted name of the type T.
value
Type: T
Return value.

Type Parameters

T
Type of the return value.
See Also

Reference

LogRecordBuilder Class
SetReturnValue Overload
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


LogRecordBuilder.SetReturnValue(T) Method (Int32, String, String, T, IFormatter(T))

LogRecordBuilderSetReturnValueT Method (Int32, String, String, T, IFormatterT)

Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void SetReturnValue<T>(
    int index,
    string returnValueName,
    string typeName,
    T value,
    IFormatter<T> formatter
)

Parameters

index
Type: SystemInt32
Index of the return value.
returnValueName
Type: SystemString
Name of the return value, or null if there is only one return value in the method.
typeName
Type: SystemString
Formatted name of the type T.
value
Type: T
Return value.
formatter
Type: PostSharp.Patterns.FormattersIFormatter T
The formatter to be used to format T.

Type Parameters

T
Type of the return value.
See Also

Reference

LogRecordBuilder Class
SetReturnValue Overload
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


LogRecordBuilder.SetThis Method

LogRecordBuilderSetThis Method

Overload List
 | Name | Description
Public method | SetThisT(T) | Sets the this (instance) value and uses the default formatter. This method is only invoked if the IncludeThisValue property is true.
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter.
Top
See Also

Reference

LogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


LogRecordBuilder.SetThis(T) Method (T)

LogRecordBuilderSetThisT Method (T)

Sets the this (instance) value and uses the default formatter. This method is only invoked if the IncludeThisValue property is true.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void SetThis<T>(
    T value
)

Parameters

value
Type: T
The value of the this instance.

Type Parameters

T
Type of the class being logged.
See Also

Reference

LogRecordBuilder Class
SetThis Overload
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


LogRecordBuilder.SetThis(T) Method (T, IFormatter(T))

LogRecordBuilderSetThisT Method (T, IFormatterT)

Sets the this (instance) value and uses a given formatter.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void SetThis<T>(
    T value,
    IFormatter<T> formatter
)

Parameters

value
Type: T
The value of the this instance.
formatter
Type: PostSharp.Patterns.FormattersIFormatter T
The formatter to be used.

Type Parameters

T
Type of the class being logged.
See Also

Reference

LogRecordBuilder Class
SetThis Overload
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


LogRecordBuilder.SetTypeGenericParameter(T) Method

LogRecordBuilderSetTypeGenericParameterT Method

Not implemented.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void SetTypeGenericParameter<T>(
    int index
)

Parameters

index
Type: SystemInt32

Type Parameters

T
See Also

Reference

LogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


LogRecordBuilder.WriteCustomParameter Method

LogRecordBuilderWriteCustomParameter Method

Overload List
 | Name | Description
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T) | Writes a custom parameter and uses the default formatter.
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter.
Top
See Also

Reference

LogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


LogRecordBuilder.WriteCustomParameter(T) Method (Int32, ArraySegment(Char), T)

LogRecordBuilderWriteCustomParameterT Method (Int32, ArraySegmentChar, T)

Writes a custom parameter and uses the default formatter.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void WriteCustomParameter<T>(
    int index,
    ArraySegment<char> parameterName,
    T value
)

Parameters

index
Type: SystemInt32
Index of the custom parameter in the formatting string.
parameterName
Type: SystemArraySegment Char
Name of the custom parameter.
value
Type: T
Value of the custom parameter.

Type Parameters

T
Type of the custom parameter.
See Also

Reference

LogRecordBuilder Class
WriteCustomParameter Overload
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


LogRecordBuilder.WriteCustomParameter(T) Method (Int32, ArraySegment(Char), T, IFormatter(T))

LogRecordBuilderWriteCustomParameterT Method (Int32, ArraySegmentChar, T, IFormatterT)

Writes a custom parameter and uses a given formatter.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract void WriteCustomParameter<T>(
    int index,
    ArraySegment<char> parameterName,
    T value,
    IFormatter<T> formatter
)

Parameters

index
Type: SystemInt32
Index of the custom parameter in the formatting string.
parameterName
Type: SystemArraySegment Char
Name of the custom parameter.
value
Type: T
Value of the custom parameter.
formatter
Type: PostSharp.Patterns.FormattersIFormatter T
The formatter to be used to format value.

Type Parameters

T
Type of the custom parameter.
See Also

Reference

LogRecordBuilder Class
WriteCustomParameter Overload
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


LogRecordBuilder.WriteCustomString Method

LogRecordBuilderWriteCustomString Method

Write a chunk of custom string.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract void WriteCustomString(
    ArraySegment<char> str
)

Parameters

str
Type: SystemArraySegment Char
The string to be written.
Remarks
A custom string never contains formatting parameters.It is the responsibility of of the caller to parse a formatting string and invoke WriteCustomString(ArraySegmentChar) and WriteCustomParameterT(Int32, ArraySegmentChar, T) in alternance.
See Also

Reference

LogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


SemanticParameterKind Enumeration

Enumerates the kinds of semantic parameters passed to the AppendSemanticParameter(SemanticParameterKind, String, String, String, Int32) method. The enumeration is a bit mask. Values can be combined with the | operator.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[FlagsAttribute]
public enum SemanticParameterKind
Members
Member name | Value | Description
None | 0 | None.
RecordKind | 1 | Record kind.
MemberName | 2 | Member name.
TypeName | 4 | Type name.
This | 8 | Value of the this parameter.
Exception | 16 | Exception.
ParameterType | 32 | Parameter type.
ParameterName | 64 | Parameter name.
ParameterValue | 128 | Parameter value.
ReturnItemName | 256 | Name of the return value (if there are multiple return values).
ReturnItemValue | 1024 | Return value (if there are multiple return values).
ReturnValue | 512 | Return value (if there is a single return value).
CustomParameter | 2048 | Custom parameter (set by the WriteCustomParameterT(Int32, ArraySegmentChar, T).
SourceFile | 4096 | Source file.
SourceLine | 8192 | Source line.
Duration | 16384 | Duration of the method execution.
AwaitedContextId | 32768 | Id of the awaited context.
AwaitedType | 65536 | Type of the right value of the await operator.
AwaitedMethod | 131072 | Method of the right of the await operator.
ContextId | 262144 | Id of the current context.
DurationThreshold | 524288 | Threshold for the duration of the method execution.
All | 1048575 | All flags.
See Also

Reference

PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder Class

An implementation of LogRecordBuilder that builds text-based log records. This class is the base class for most back-ends.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.RecordBuildersLogRecordBuilder
PostSharp.Patterns.Diagnostics.RecordBuildersTextLogRecordBuilder
More...

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class TextLogRecordBuilder : LogRecordBuilder

The TextLogRecordBuilder type exposes the following members.

Constructors
 | Name | Description
Protected method | TextLogRecordBuilder | Initializes a new TextLogRecordBuilder.
Top
Properties
 | Name | Description
Public property | Backend | Gets the parent back-end.
Public property | BackendOptions | Shortcut for this.Backend.Options.
Protected property | Context | Gets the LoggingContext to which the record belongs. (Inherited from LogRecordBuilder.)
Public property | Exception | Gets the Exception for the current record, or null if no exception is associated to the current record.
Public property | IsDisposed | (Inherited from LogRecordBuilder.)
Protected property | Level | Gets the LogLevel for the current record.
Public property | MemberName | Gets the name of the method, property or field for the current record.
Protected property | Options | Gets the LoggingOptions for the current record.
Protected property | Profile | Gets the LoggingProfile for the current record.
Protected property | RecordKind | Gets the kind of the current record (e.g. MethodEntry or MethodException). (Inherited from LogRecordBuilder.)
Public property | SourceLineInfo | Gets the SourceLineInfo for the current record.
Public property | SourceType | Gets the source Type of the current record.
Protected property | StringBuilder | Gets the current UnsafeStringBuilder where everything is being appended.
Protected property | ThreadContext | Gets the ThreadLoggingContext to which the current LogRecordBuilder belongs. (Inherited from LogRecordBuilder.)
Protected property | TypeSource | Gets the LoggingTypeSource for the current record.
Top
Methods
 | Name | Description
Protected method | AppendAsyncInfo | Appends information about the async method to the current StringBuilder.
Protected method | AppendClosingParenthesisConditional | Appends a closing parenthesis to the current StringBuilder if required.
Protected method | AppendComma |
Protected method | AppendCommaConditional | Appends a comma to the current StringBuilder, unless this method is invoked for the first time for the current record.
Protected method | AppendContextDescription | Appends the context Description (or the TypeSource name, if the type of the context is not equal to the source type of the record) to the current StringBuilder.
Protected method | AppendContextDescription(LoggingContext) |
Protected method | AppendDelimiter | Appends a Delimiter to the current StringBuilder.
Protected method | AppendDelimiterConditional | Appends a Delimiter to the current StringBuilder if the RequireDelimiter method has been called previously.
Protected method | AppendEpilogue | Appends the final part of log message to StringBuilder. This includes state machine number and execution time where relevant, but does not include exception details.
Protected method | AppendExceptionDetails | Appends exception details to StringBuilder if IncludeExceptionDetails is set.
Protected method | AppendExecutionTime | Appends the execution time to the current StringBuilder.
Protected method | AppendExecutionTimeThreshold | Appends the execution time threshold to the current StringBuilder.
Protected method | AppendIndentString | Appends indentation for the given to StringBuilder.
Protected method | AppendMemberName | Appends name of the member for the current record (including the declaring type name, subject to the IncludeType property) to the current StringBuilder, as well as an opening parenthesis.
Protected method | AppendOpeningParenthesis | Appends an opening parenthesis to the current StringBuilder.
Protected method | AppendProlog | Appends the indent string, context description, and the record kind to the current StringBuilder.
Protected method | AppendRecordKind | Appends the LogRecordKind of the current record to the current StringBuilder.
Protected method | AppendSemanticParameter(SemanticParameterKind, String, String, String, Int32) | Appends a parameter of String type to the current StringBuilder. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder.
Protected method | AppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder.
Protected method | AppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder.
Protected method | AppendSourceLineInfo | Appends source (file, line) information to the current StringBuilder.
Protected method | AppendSpaces | Appends a given number of spaces to the current StringBuilder.
Protected method | AppendSpecialChar | Appends a special Char (which may require escaping with specific back-ends) to the current StringBuilder.
Protected method | AppendTrailingPeriod | Appends a trailing period (.) to the current StringBuilder, respecting the AppendTrailingPeriod property.
Protected method | AppendTypeName | Appends the name of the TypeSource to the current StringBuilder.
Public method | BeginCustomRecord | Initializes the current LogRecordBuilder to emit a custom record. (Overrides LogRecordBuilderBeginCustomRecord(LoggingContext, CustomLogRecordInfo).)
Public method | BeginRecord | Initializes the current LogRecordBuilder to emit a standard (i.e. non-custom) record for a given context and method. (Overrides LogRecordBuilderBeginRecord(LoggingContext, LogRecordInfo, LogMemberInfo).)
Public method | Complete | Emits the record and resets the current LogRecordBuilder. This method invoked after all SetThisT(T), SetParameterT(Int32, String, ParameterKind, String, T) and similar methods have been called. (Inherited from LogRecordBuilder.)
Public method | Dispose | (Inherited from LogRecordBuilder.)
Protected method | EmitRecord | Emits the record. Invoked by the Complete method. (Overrides LogRecordBuilderEmitRecord.)
Protected method | EmitRecord(Boolean) | Emits the record and specifies whether exception details should be appended to the text.
Protected method | EndContextDescription | Ends building the context Description and starts building the action text.
Protected method | EndContextDescriptionConditional | Switches between building the context Description and the action text. If the EndContextDescriptionConditional method has been previously invoked, subsequent calls are ignored.
Protected method | GetContextDescription | Obsolete. Gets the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record.
Protected method | GetContextDescriptionUnsafe | Obsolete. Gets an UnsafeString representing the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record.
Protected method | GetContextForDescription | Obsolete. Gets the LoggingContext that should be used when getting or appending the Description.
Protected method | GetSourceName | Gets the name of the TypeSource for the current record, respecting the IncludeNamespace property.
Protected method | HasRecordKindName | Determines whether the AppendRecordKind will append anything for the current record.
Protected method | MustBuildContextDescription | Determines whether the current Description should be appended to the current StringBuilder.
Protected method | RequireComma | Makes the AppendCommaConditional to append a comma even if it's invoked for the first time.
Protected method | RequireDelimiter | Causes the next call to the AppendDelimiterConditional to append a Delimiter to the current StringBuilder.
Protected method | Reset | Resets all fields and properties of the current LogRecordBuilder to their initial value. Invoked by the Complete method. (Overrides LogRecordBuilderReset.)
Public method | SetException | Sets the exception for the method or activity. (Overrides LogRecordBuilderSetException(Exception).)
Public method | SetExecutionTime | Sets the method or activity execution time. (Overrides LogRecordBuilderSetExecutionTime(Double, Boolean).)
Public method | SetMethodGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T) | Sets the value of a given parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Overrides LogRecordBuilderSetParameterT(Int32, String, ParameterKind, String, T, IFormatterT).)
Public method | SetRefStructParameter | (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T) | Sets a given return value (there can be several return values in C# 7.0) and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Overrides LogRecordBuilderSetReturnValueT(Int32, String, String, T, IFormatterT).)
Public method | SetThisT(T) | Sets the this (instance) value and uses the default formatter. This method is only invoked if the IncludeThisValue property is true. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Overrides LogRecordBuilderSetThisT(T, IFormatterT).)
Public method | SetTypeGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Protected method | ShouldLogExceptionDetails | Determines whether exception details should be appended to the text of the current StringBuilder.
Public method | ToString | Returns a string that represents the current object. (Overrides ObjectToString.)
Protected method | Write | Writes the final message to the back-end.
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T) | Writes a custom parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Overrides LogRecordBuilderWriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT).)
Public method | WriteCustomString | Write a chunk of custom string. (Overrides LogRecordBuilderWriteCustomString(ArraySegmentChar).)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.RecordBuilders Namespace
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.RecordBuildersLogRecordBuilder
PostSharp.Patterns.Diagnostics.RecordBuildersTextLogRecordBuilder
PostSharp.Patterns.Diagnostics.Backends.ApplicationInsightsApplicationInsightsLogRecordBuilder
PostSharp.Patterns.Diagnostics.Backends.AuditAuditRecordBuilder
PostSharp.Patterns.Diagnostics.Backends.CommonLoggingCommonLoggingRecordBuilder
PostSharp.Patterns.Diagnostics.Backends.ConsoleConsoleLogRecordBuilder
PostSharp.Patterns.Diagnostics.Backends.EnterpriseLibraryEnterpriseLibraryLogRecordBuilder
PostSharp.Patterns.Diagnostics.Backends.EventSourceEventSourceLogRecordBuilder
PostSharp.Patterns.Diagnostics.Backends.Log4NetLog4NetLogRecordBuilder
PostSharp.Patterns.Diagnostics.Backends.LoupeLoupeLogRecordBuilder
PostSharp.Patterns.Diagnostics.Backends.MicrosoftMicrosoftLogRecordBuilder
PostSharp.Patterns.Diagnostics.Backends.NLogNLogLogRecordBuilder
PostSharp.Patterns.Diagnostics.Backends.SerilogSerilogLogRecordBuilder
PostSharp.Patterns.Diagnostics.Backends.TraceTraceLogRecordBuilder
PostSharp.Patterns.Diagnostics.Backends.TraceSourceTraceSourceLogRecordBuilder


TextLogRecordBuilder Constructor

Initializes a new TextLogRecordBuilder.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected TextLogRecordBuilder(
    TextLoggingBackend backend
)

Parameters

backend
Type: PostSharp.Patterns.Diagnostics.BackendsTextLoggingBackend
The parent back-end.
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder Properties

The TextLogRecordBuilder type exposes the following members.

Properties
 | Name | Description
Public property | Backend | Gets the parent back-end.
Public property | BackendOptions | Shortcut for this.Backend.Options.
Protected property | Context | Gets the LoggingContext to which the record belongs. (Inherited from LogRecordBuilder.)
Public property | Exception | Gets the Exception for the current record, or null if no exception is associated to the current record.
Public property | IsDisposed | (Inherited from LogRecordBuilder.)
Protected property | Level | Gets the LogLevel for the current record.
Public property | MemberName | Gets the name of the method, property or field for the current record.
Protected property | Options | Gets the LoggingOptions for the current record.
Protected property | Profile | Gets the LoggingProfile for the current record.
Protected property | RecordKind | Gets the kind of the current record (e.g. MethodEntry or MethodException). (Inherited from LogRecordBuilder.)
Public property | SourceLineInfo | Gets the SourceLineInfo for the current record.
Public property | SourceType | Gets the source Type of the current record.
Protected property | StringBuilder | Gets the current UnsafeStringBuilder where everything is being appended.
Protected property | ThreadContext | Gets the ThreadLoggingContext to which the current LogRecordBuilder belongs. (Inherited from LogRecordBuilder.)
Protected property | TypeSource | Gets the LoggingTypeSource for the current record.
Top
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.Backend Property

TextLogRecordBuilderBackend Property

Gets the parent back-end.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TextLoggingBackend Backend { get; }

Property Value

Type: TextLoggingBackend
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.BackendOptions Property

TextLogRecordBuilderBackendOptions Property

Shortcut for this.Backend.Options.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TextLoggingBackendOptions BackendOptions { get; }

Property Value

Type: TextLoggingBackendOptions
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.Exception Property

TextLogRecordBuilderException Property

Gets the Exception for the current record, or null if no exception is associated to the current record.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Exception Exception { get; }

Property Value

Type: Exception
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.Level Property

TextLogRecordBuilderLevel Property

Gets the LogLevel for the current record.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected LogLevel Level { get; }

Property Value

Type: LogLevel
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.MemberName Property

TextLogRecordBuilderMemberName Property

Gets the name of the method, property or field for the current record.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string MemberName { get; }

Property Value

Type: String
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.Options Property

TextLogRecordBuilderOptions Property

Gets the LoggingOptions for the current record.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected LoggingOptions Options { get; }

Property Value

Type: LoggingOptions
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.Profile Property

TextLogRecordBuilderProfile Property

Gets the LoggingProfile for the current record.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected LoggingProfile Profile { get; }

Property Value

Type: LoggingProfile
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.SourceLineInfo Property

TextLogRecordBuilderSourceLineInfo Property

Gets the SourceLineInfo for the current record.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SourceLineInfo SourceLineInfo { get; }

Property Value

Type: SourceLineInfo
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.SourceType Property

TextLogRecordBuilderSourceType Property

Gets the source Type of the current record.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Type SourceType { get; }

Property Value

Type: Type
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.StringBuilder Property

TextLogRecordBuilderStringBuilder Property

Gets the current UnsafeStringBuilder where everything is being appended.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected UnsafeStringBuilder StringBuilder { get; }

Property Value

Type: UnsafeStringBuilder
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.TypeSource Property

TextLogRecordBuilderTypeSource Property

Gets the LoggingTypeSource for the current record.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected LoggingTypeSource TypeSource { get; }

Property Value

Type: LoggingTypeSource
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder Methods

The TextLogRecordBuilder type exposes the following members.

Methods
 | Name | Description
Protected method | AppendAsyncInfo | Appends information about the async method to the current StringBuilder.
Protected method | AppendClosingParenthesisConditional | Appends a closing parenthesis to the current StringBuilder if required.
Protected method | AppendComma |
Protected method | AppendCommaConditional | Appends a comma to the current StringBuilder, unless this method is invoked for the first time for the current record.
Protected method | AppendContextDescription | Appends the context Description (or the TypeSource name, if the type of the context is not equal to the source type of the record) to the current StringBuilder.
Protected method | AppendContextDescription(LoggingContext) |
Protected method | AppendDelimiter | Appends a Delimiter to the current StringBuilder.
Protected method | AppendDelimiterConditional | Appends a Delimiter to the current StringBuilder if the RequireDelimiter method has been called previously.
Protected method | AppendEpilogue | Appends the final part of log message to StringBuilder. This includes state machine number and execution time where relevant, but does not include exception details.
Protected method | AppendExceptionDetails | Appends exception details to StringBuilder if IncludeExceptionDetails is set.
Protected method | AppendExecutionTime | Appends the execution time to the current StringBuilder.
Protected method | AppendExecutionTimeThreshold | Appends the execution time threshold to the current StringBuilder.
Protected method | AppendIndentString | Appends indentation for the given to StringBuilder.
Protected method | AppendMemberName | Appends name of the member for the current record (including the declaring type name, subject to the IncludeType property) to the current StringBuilder, as well as an opening parenthesis.
Protected method | AppendOpeningParenthesis | Appends an opening parenthesis to the current StringBuilder.
Protected method | AppendProlog | Appends the indent string, context description, and the record kind to the current StringBuilder.
Protected method | AppendRecordKind | Appends the LogRecordKind of the current record to the current StringBuilder.
Protected method | AppendSemanticParameter(SemanticParameterKind, String, String, String, Int32) | Appends a parameter of String type to the current StringBuilder. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder.
Protected method | AppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder.
Protected method | AppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder.
Protected method | AppendSourceLineInfo | Appends source (file, line) information to the current StringBuilder.
Protected method | AppendSpaces | Appends a given number of spaces to the current StringBuilder.
Protected method | AppendSpecialChar | Appends a special Char (which may require escaping with specific back-ends) to the current StringBuilder.
Protected method | AppendTrailingPeriod | Appends a trailing period (.) to the current StringBuilder, respecting the AppendTrailingPeriod property.
Protected method | AppendTypeName | Appends the name of the TypeSource to the current StringBuilder.
Public method | BeginCustomRecord | Initializes the current LogRecordBuilder to emit a custom record. (Overrides LogRecordBuilderBeginCustomRecord(LoggingContext, CustomLogRecordInfo).)
Public method | BeginRecord | Initializes the current LogRecordBuilder to emit a standard (i.e. non-custom) record for a given context and method. (Overrides LogRecordBuilderBeginRecord(LoggingContext, LogRecordInfo, LogMemberInfo).)
Public method | Complete | Emits the record and resets the current LogRecordBuilder. This method invoked after all SetThisT(T), SetParameterT(Int32, String, ParameterKind, String, T) and similar methods have been called. (Inherited from LogRecordBuilder.)
Public method | Dispose | (Inherited from LogRecordBuilder.)
Protected method | EmitRecord | Emits the record. Invoked by the Complete method. (Overrides LogRecordBuilderEmitRecord.)
Protected method | EmitRecord(Boolean) | Emits the record and specifies whether exception details should be appended to the text.
Protected method | EndContextDescription | Ends building the context Description and starts building the action text.
Protected method | EndContextDescriptionConditional | Switches between building the context Description and the action text. If the EndContextDescriptionConditional method has been previously invoked, subsequent calls are ignored.
Protected method | GetContextDescription | Obsolete. Gets the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record.
Protected method | GetContextDescriptionUnsafe | Obsolete. Gets an UnsafeString representing the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record.
Protected method | GetContextForDescription | Obsolete. Gets the LoggingContext that should be used when getting or appending the Description.
Protected method | GetSourceName | Gets the name of the TypeSource for the current record, respecting the IncludeNamespace property.
Protected method | HasRecordKindName | Determines whether the AppendRecordKind will append anything for the current record.
Protected method | MustBuildContextDescription | Determines whether the current Description should be appended to the current StringBuilder.
Protected method | RequireComma | Makes the AppendCommaConditional to append a comma even if it's invoked for the first time.
Protected method | RequireDelimiter | Causes the next call to the AppendDelimiterConditional to append a Delimiter to the current StringBuilder.
Protected method | Reset | Resets all fields and properties of the current LogRecordBuilder to their initial value. Invoked by the Complete method. (Overrides LogRecordBuilderReset.)
Public method | SetException | Sets the exception for the method or activity. (Overrides LogRecordBuilderSetException(Exception).)
Public method | SetExecutionTime | Sets the method or activity execution time. (Overrides LogRecordBuilderSetExecutionTime(Double, Boolean).)
Public method | SetMethodGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T) | Sets the value of a given parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Overrides LogRecordBuilderSetParameterT(Int32, String, ParameterKind, String, T, IFormatterT).)
Public method | SetRefStructParameter | (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T) | Sets a given return value (there can be several return values in C# 7.0) and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Overrides LogRecordBuilderSetReturnValueT(Int32, String, String, T, IFormatterT).)
Public method | SetThisT(T) | Sets the this (instance) value and uses the default formatter. This method is only invoked if the IncludeThisValue property is true. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Overrides LogRecordBuilderSetThisT(T, IFormatterT).)
Public method | SetTypeGenericParameterT | Not implemented. (Inherited from LogRecordBuilder.)
Protected method | ShouldLogExceptionDetails | Determines whether exception details should be appended to the text of the current StringBuilder.
Public method | ToString | Returns a string that represents the current object. (Overrides ObjectToString.)
Protected method | Write | Writes the final message to the back-end.
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T) | Writes a custom parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Overrides LogRecordBuilderWriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT).)
Public method | WriteCustomString | Write a chunk of custom string. (Overrides LogRecordBuilderWriteCustomString(ArraySegmentChar).)
Top
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.AppendAsyncInfo Method

TextLogRecordBuilderAppendAsyncInfo Method

Appends information about the async method to the current StringBuilder.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected void AppendAsyncInfo()
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.AppendClosingParenthesisConditional Method

TextLogRecordBuilderAppendClosingParenthesisConditional Method

Appends a closing parenthesis to the current StringBuilder if required.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected void AppendClosingParenthesisConditional()
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.AppendComma Method

TextLogRecordBuilderAppendComma Method

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected void AppendComma()
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.AppendCommaConditional Method

TextLogRecordBuilderAppendCommaConditional Method

Appends a comma to the current StringBuilder, unless this method is invoked for the first time for the current record.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected void AppendCommaConditional()
Remarks
Call RequireComma to append the comma even if this method is invoked for the first time.
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.AppendContextDescription Method

TextLogRecordBuilderAppendContextDescription Method

Overload List
 | Name | Description
Protected method | AppendContextDescription | Appends the context Description (or the TypeSource name, if the type of the context is not equal to the source type of the record) to the current StringBuilder.
Protected method | AppendContextDescription(LoggingContext) |
Top
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.AppendContextDescription Method

TextLogRecordBuilderAppendContextDescription Method

Appends the context Description (or the TypeSource name, if the type of the context is not equal to the source type of the record) to the current StringBuilder.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected void AppendContextDescription()

Return Value

Type:
true if the context description was non-empty, false if it was empty.
See Also

Reference

TextLogRecordBuilder Class
AppendContextDescription Overload
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.AppendContextDescription Method (LoggingContext)

TextLogRecordBuilderAppendContextDescription Method (LoggingContext)

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void AppendContextDescription(
    LoggingContext context
)

Parameters

context
Type: PostSharp.Patterns.Diagnostics.ContextsLoggingContext
See Also

Reference

TextLogRecordBuilder Class
AppendContextDescription Overload
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.AppendDelimiter Method

TextLogRecordBuilderAppendDelimiter Method

Appends a Delimiter to the current StringBuilder.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void AppendDelimiter()
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.AppendDelimiterConditional Method

TextLogRecordBuilderAppendDelimiterConditional Method

Appends a Delimiter to the current StringBuilder if the RequireDelimiter method has been called previously.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected bool AppendDelimiterConditional()

Return Value

Type: Boolean
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.AppendEpilogue Method

TextLogRecordBuilderAppendEpilogue Method

Appends the final part of log message to StringBuilder. This includes state machine number and execution time where relevant, but does not include exception details.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected void AppendEpilogue()
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.AppendExceptionDetails Method

TextLogRecordBuilderAppendExceptionDetails Method

Appends exception details to StringBuilder if IncludeExceptionDetails is set.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected void AppendExceptionDetails()
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.AppendExecutionTime Method

TextLogRecordBuilderAppendExecutionTime Method

Appends the execution time to the current StringBuilder.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void AppendExecutionTime()
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.AppendExecutionTimeThreshold Method

TextLogRecordBuilderAppendExecutionTimeThreshold Method

Appends the execution time threshold to the current StringBuilder.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void AppendExecutionTimeThreshold()
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.AppendIndentString Method

TextLogRecordBuilderAppendIndentString Method

Appends indentation for the given to StringBuilder.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void AppendIndentString(
    int additionalIndent = 0
)

Parameters

additionalIndent (Optional)
Type: SystemInt32
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.AppendMemberName Method

TextLogRecordBuilderAppendMemberName Method

Appends name of the member for the current record (including the declaring type name, subject to the IncludeType property) to the current StringBuilder, as well as an opening parenthesis.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected void AppendMemberName()
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.AppendOpeningParenthesis Method

TextLogRecordBuilderAppendOpeningParenthesis Method

Appends an opening parenthesis to the current StringBuilder.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected void AppendOpeningParenthesis()
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.AppendProlog Method

TextLogRecordBuilderAppendProlog Method

Appends the indent string, context description, and the record kind to the current StringBuilder.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void AppendProlog()
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.AppendRecordKind Method

TextLogRecordBuilderAppendRecordKind Method

Appends the LogRecordKind of the current record to the current StringBuilder.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected bool AppendRecordKind()

Return Value

Type: Boolean
true if the method appended something, otherwise false.
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.AppendSemanticParameter Method

TextLogRecordBuilderAppendSemanticParameter Method

Overload List
 | Name | Description
Protected method | AppendSemanticParameter(SemanticParameterKind, String, String, String, Int32) | Appends a parameter of String type to the current StringBuilder. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder.
Protected method | AppendSemanticParameterT(SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder.
Protected method | AppendSemanticParameterT(SemanticParameterKind, String, T, IFormatterT, String, Int32) | Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder.
Top
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.AppendSemanticParameter Method (SemanticParameterKind, String, String, String, Int32)

TextLogRecordBuilderAppendSemanticParameter Method (SemanticParameterKind, String, String, String, Int32)

Appends a parameter of String type to the current StringBuilder. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void AppendSemanticParameter(
    SemanticParameterKind kind,
    string name,
    string value,
    string prefix = null,
    int index = -1
)

Parameters

kind
Type: PostSharp.Patterns.Diagnostics.RecordBuildersSemanticParameterKind
Kind of semantic parameter.
name
Type: SystemString
Parameter name. The name parameter itself is not guaranteed to be unique in a given record. However, in combination with prefix and index, it is guaranteed to be unique.
value
Type: SystemString
Parameter value.
prefix (Optional)
Type: SystemString
Prefix to be prepended to name, or null if there is no prefix.
index (Optional)
Type: SystemInt32
Index of the parameter value, if there are several values for the same parameter name, or -1 if there is a single parameter value for this parameter name.
See Also

Reference

TextLogRecordBuilder Class
AppendSemanticParameter Overload
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.AppendSemanticParameter(T) Method (SemanticParameterKind, ArraySegment(Char), T, IFormatter(T), String, Int32)

TextLogRecordBuilderAppendSemanticParameterT Method (SemanticParameterKind, ArraySegmentChar, T, IFormatterT, String, Int32)

Appends a parameter to the current StringBuilder, where the name is given as a ArraySegmentT, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void AppendSemanticParameter<T>(
    SemanticParameterKind kind,
    ArraySegment<char> name,
    T value,
    IFormatter<T> formatter,
    string prefix = null,
    int index = -1
)

Parameters

kind
Type: PostSharp.Patterns.Diagnostics.RecordBuildersSemanticParameterKind
Kind of semantic parameter.
name
Type: SystemArraySegment Char
Parameter name. The name parameter itself is not guaranteed to be unique in a given record. However, in combination with prefix and index, it is guaranteed to be unique.
value
Type: T
Parameter value.
formatter
Type: PostSharp.Patterns.FormattersIFormatter T
The formatter to be used to format value.
prefix (Optional)
Type: SystemString
Prefix to be prepended to name, or null if there is no prefix.
index (Optional)
Type: SystemInt32
Index of the parameter value, if there are several values for the same parameter name, or -1 if there is a single parameter value for this parameter name.

Type Parameters

T
See Also

Reference

TextLogRecordBuilder Class
AppendSemanticParameter Overload
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.AppendSemanticParameter(T) Method (SemanticParameterKind, String, T, IFormatter(T), String, Int32)

TextLogRecordBuilderAppendSemanticParameterT Method (SemanticParameterKind, String, T, IFormatterT, String, Int32)

Appends a parameter to the current StringBuilder, where the name is given as a String, and uses a specific formatter. Back-ends that support semantic logging may store the parameter value semantically instead of appending it to the StringBuilder.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void AppendSemanticParameter<T>(
    SemanticParameterKind kind,
    string name,
    T value,
    IFormatter<T> formatter,
    string prefix = null,
    int index = -1
)

Parameters

kind
Type: PostSharp.Patterns.Diagnostics.RecordBuildersSemanticParameterKind
Kind of semantic parameter.
name
Type: SystemString
Parameter name. The name parameter itself is not guaranteed to be unique in a given record. However, in combination with prefix and index, it is guaranteed to be unique.
value
Type: T
Parameter value.
formatter
Type: PostSharp.Patterns.FormattersIFormatter T
The formatter to be used to format value.
prefix (Optional)
Type: SystemString
Prefix to be prepended to name, or null if there is no prefix.
index (Optional)
Type: SystemInt32
Index of the parameter value, if there are several values for the same parameter name, or -1 if there is a single parameter value for this parameter name.

Type Parameters

T
See Also

Reference

TextLogRecordBuilder Class
AppendSemanticParameter Overload
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.AppendSourceLineInfo Method

TextLogRecordBuilderAppendSourceLineInfo Method

Appends source (file, line) information to the current StringBuilder.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void AppendSourceLineInfo()
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.AppendSpaces Method

TextLogRecordBuilderAppendSpaces Method

Appends a given number of spaces to the current StringBuilder.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected void AppendSpaces(
    int count
)

Parameters

count
Type: SystemInt32
The number of spaces to be appended.
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.AppendSpecialChar Method

TextLogRecordBuilderAppendSpecialChar Method

Appends a special Char (which may require escaping with specific back-ends) to the current StringBuilder.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void AppendSpecialChar(
    char c
)

Parameters

c
Type: SystemChar
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.AppendTrailingPeriod Method

TextLogRecordBuilderAppendTrailingPeriod Method

Appends a trailing period (.) to the current StringBuilder, respecting the AppendTrailingPeriod property.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected void AppendTrailingPeriod()
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.AppendTypeName Method

TextLogRecordBuilderAppendTypeName Method

Appends the name of the TypeSource to the current StringBuilder.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected void AppendTypeName()
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.BeginCustomRecord Method

TextLogRecordBuilderBeginCustomRecord Method

Initializes the current LogRecordBuilder to emit a custom record.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void BeginCustomRecord(
    LoggingContext context,
    ref CustomLogRecordInfo recordInfo
)

Parameters

context
Type: PostSharp.Patterns.Diagnostics.ContextsLoggingContext
The parent LoggingContext of the record.
recordInfo
Type: PostSharp.Patterns.Diagnostics.ContextsCustomLogRecordInfo
Information about the record.
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.BeginRecord Method

TextLogRecordBuilderBeginRecord Method

Initializes the current LogRecordBuilder to emit a standard (i.e. non-custom) record for a given context and method.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void BeginRecord(
    LoggingContext context,
    ref LogRecordInfo recordInfo,
    ref LogMemberInfo memberInfo
)

Parameters

context
Type: PostSharp.Patterns.Diagnostics.ContextsLoggingContext
The parent LoggingContext of the record.
recordInfo
Type: PostSharp.Patterns.Diagnostics.ContextsLogRecordInfo
Information about the record.
memberInfo
Type: PostSharp.Patterns.Diagnostics.ContextsLogMemberInfo
Information about the method, property, or field.
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.EmitRecord Method

TextLogRecordBuilderEmitRecord Method

Overload List
 | Name | Description
Protected method | EmitRecord | Emits the record. Invoked by the Complete method. (Overrides LogRecordBuilderEmitRecord.)
Protected method | EmitRecord(Boolean) | Emits the record and specifies whether exception details should be appended to the text.
Top
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.EmitRecord Method

TextLogRecordBuilderEmitRecord Method

Emits the record. Invoked by the Complete method.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void EmitRecord()
See Also

Reference

TextLogRecordBuilder Class
EmitRecord Overload
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.EmitRecord Method (Boolean)

TextLogRecordBuilderEmitRecord Method (Boolean)

Emits the record and specifies whether exception details should be appended to the text.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected void EmitRecord(
    bool includeExceptionDetails
)

Parameters

includeExceptionDetails
Type: SystemBoolean
true if exception details should be appended, otherwise false.
See Also

Reference

TextLogRecordBuilder Class
EmitRecord Overload
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.EndContextDescription Method

TextLogRecordBuilderEndContextDescription Method

Ends building the context Description and starts building the action text.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void EndContextDescription()
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.EndContextDescriptionConditional Method

TextLogRecordBuilderEndContextDescriptionConditional Method

Switches between building the context Description and the action text. If the EndContextDescriptionConditional method has been previously invoked, subsequent calls are ignored.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected void EndContextDescriptionConditional()
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.GetContextDescription Method

TextLogRecordBuilderGetContextDescription Method

Note: This API is now obsolete.

Gets the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[ObsoleteAttribute("Use Context.Description.")]
protected string GetContextDescription()

Return Value

Type: String
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.GetContextDescriptionUnsafe Method

TextLogRecordBuilderGetContextDescriptionUnsafe Method

Note: This API is now obsolete.

Gets an UnsafeString representing the context Description or the TypeSource name, if the type of the context is not equal to the source type of the record.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[ObsoleteAttribute("Use Context.Description.")]
protected UnsafeString GetContextDescriptionUnsafe()

Return Value

Type: UnsafeString
An UnsafeString.
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.GetContextForDescription Method

TextLogRecordBuilderGetContextForDescription Method

Note: This API is now obsolete.

Gets the LoggingContext that should be used when getting or appending the Description.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[ObsoleteAttribute("Use the Context property.")]
protected LoggingContext GetContextForDescription()

Return Value

Type: LoggingContext
The current Context or the ParentContext
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.GetSourceName Method

TextLogRecordBuilderGetSourceName Method

Gets the name of the TypeSource for the current record, respecting the IncludeNamespace property.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected string GetSourceName()

Return Value

Type: String
The display name of TypeSource.
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.HasRecordKindName Method

TextLogRecordBuilderHasRecordKindName Method

Determines whether the AppendRecordKind will append anything for the current record.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected bool HasRecordKindName()

Return Value

Type: Boolean
true if AppendRecordKind will append something, otherwise false.
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.MustBuildContextDescription Method

TextLogRecordBuilderMustBuildContextDescription Method

Determines whether the current Description should be appended to the current StringBuilder.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected bool MustBuildContextDescription()

Return Value

Type: Boolean
true if the current Description should be appended to the current StringBuilder, otherwise false.
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.RequireComma Method

TextLogRecordBuilderRequireComma Method

Makes the AppendCommaConditional to append a comma even if it's invoked for the first time.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected void RequireComma()
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.RequireDelimiter Method

TextLogRecordBuilderRequireDelimiter Method

Causes the next call to the AppendDelimiterConditional to append a Delimiter to the current StringBuilder.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected void RequireDelimiter()
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.Reset Method

TextLogRecordBuilderReset Method

Resets all fields and properties of the current LogRecordBuilder to their initial value. Invoked by the Complete method.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void Reset()
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.SetException Method

TextLogRecordBuilderSetException Method

Sets the exception for the method or activity.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void SetException(
    Exception exception
)

Parameters

exception
Type: SystemException
An Exception.
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.SetExecutionTime Method

TextLogRecordBuilderSetExecutionTime Method

Sets the method or activity execution time.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void SetExecutionTime(
    double executionTime,
    bool isOvertime
)

Parameters

executionTime
Type: SystemDouble
The execution time, in milliseconds.
isOvertime
Type: SystemBoolean
true if executionTime is over the threshold set in ExecutionTimeThreshold, otherwise false.
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.SetParameter Method

TextLogRecordBuilderSetParameter Method

Overload List
 | Name | Description
Public method | SetParameterT(Int32, String, ParameterKind, String, T) | Sets the value of a given parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Inherited from LogRecordBuilder.)
Public method | SetParameterT(Int32, String, ParameterKind, String, T, IFormatterT) | Sets the value of a given parameter and specifies the FormatterT. (Overrides LogRecordBuilderSetParameterT(Int32, String, ParameterKind, String, T, IFormatterT).)
Top
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.SetParameter(T) Method (Int32, String, ParameterKind, String, T, IFormatter(T))

TextLogRecordBuilderSetParameterT Method (Int32, String, ParameterKind, String, T, IFormatterT)

Sets the value of a given parameter and specifies the FormatterT.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void SetParameter<T>(
    int index,
    string parameterName,
    ParameterKind parameterKind,
    string typeName,
    T value,
    IFormatter<T> formatter
)

Parameters

index
Type: SystemInt32
Index of the parameter in the list of method parameters.
parameterName
Type: SystemString
Name of the parameter (only included if the IncludeParameterName property is true).
parameterKind
Type: PostSharp.ReflectionParameterKind
The kind of the parameter (whether the parameter is by ref or by value, input or output).
typeName
Type: SystemString
Formatted name of the type T (only included if the IncludeParameterType property is true).
value
Type: T
Value of the parameter (only included if the IncludeParameterValue property is true).
formatter
Type: PostSharp.Patterns.FormattersIFormatter T
Formatter to be used to format value.

Type Parameters

T
Type of the parameter.
Remarks
The return value is set by the method SetReturnValueT(Int32, String, String, T, IFormatterT). Thus the value of the parameterKind is never ReturnValue or ReturnRef.
See Also

Reference

TextLogRecordBuilder Class
SetParameter Overload
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.SetReturnValue Method

TextLogRecordBuilderSetReturnValue Method

Overload List
 | Name | Description
Public method | SetReturnValueT(Int32, String, String, T) | Sets a given return value (there can be several return values in C# 7.0) and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetReturnValueT(Int32, String, String, T, IFormatterT) | Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter. (Overrides LogRecordBuilderSetReturnValueT(Int32, String, String, T, IFormatterT).)
Top
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.SetReturnValue(T) Method (Int32, String, String, T, IFormatter(T))

TextLogRecordBuilderSetReturnValueT Method (Int32, String, String, T, IFormatterT)

Sets a given return value (there can be several return values in C# 7.0) and uses a given formatter.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void SetReturnValue<T>(
    int index,
    string returnValueName,
    string typeName,
    T value,
    IFormatter<T> formatter
)

Parameters

index
Type: SystemInt32
Index of the return value.
returnValueName
Type: SystemString
Name of the return value, or null if there is only one return value in the method.
typeName
Type: SystemString
Formatted name of the type T.
value
Type: T
Return value.
formatter
Type: PostSharp.Patterns.FormattersIFormatter T
The formatter to be used to format T.

Type Parameters

T
Type of the return value.
See Also

Reference

TextLogRecordBuilder Class
SetReturnValue Overload
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.SetThis Method

TextLogRecordBuilderSetThis Method

Overload List
 | Name | Description
Public method | SetThisT(T) | Sets the this (instance) value and uses the default formatter. This method is only invoked if the IncludeThisValue property is true. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | SetThisT(T, IFormatterT) | Sets the this (instance) value and uses a given formatter. (Overrides LogRecordBuilderSetThisT(T, IFormatterT).)
Top
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.SetThis(T) Method (T, IFormatter(T))

TextLogRecordBuilderSetThisT Method (T, IFormatterT)

Sets the this (instance) value and uses a given formatter.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void SetThis<T>(
    T value,
    IFormatter<T> formatter
)

Parameters

value
Type: T
The value of the this instance.
formatter
Type: PostSharp.Patterns.FormattersIFormatter T
The formatter to be used.

Type Parameters

T
Type of the class being logged.
See Also

Reference

TextLogRecordBuilder Class
SetThis Overload
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.ShouldLogExceptionDetails Method

TextLogRecordBuilderShouldLogExceptionDetails Method

Determines whether exception details should be appended to the text of the current StringBuilder.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected bool ShouldLogExceptionDetails()

Return Value

Type: Boolean
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.ToString Method

TextLogRecordBuilderToString Method

Returns a string that represents the current object.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override string ToString()

Return Value

Type: String
A string that represents the current object.
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.Write Method

TextLogRecordBuilderWrite Method

Writes the final message to the back-end.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected abstract void Write(
    UnsafeString message
)

Parameters

message
Type: PostSharp.Patterns.FormattersUnsafeString
The final message.
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace

Other Resources

Conceptual: Implementing an Adapter to a Custom Logging Framework


TextLogRecordBuilder.WriteCustomParameter Method

TextLogRecordBuilderWriteCustomParameter Method

Overload List
 | Name | Description
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T) | Writes a custom parameter and uses the default formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Inherited from LogRecordBuilder.)
Public method | WriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT) | Writes a custom parameter and uses a given formatter. (Overrides LogRecordBuilderWriteCustomParameterT(Int32, ArraySegmentChar, T, IFormatterT).)
Top
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.WriteCustomParameter(T) Method (Int32, ArraySegment(Char), T, IFormatter(T))

TextLogRecordBuilderWriteCustomParameterT Method (Int32, ArraySegmentChar, T, IFormatterT)

Writes a custom parameter and uses a given formatter.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void WriteCustomParameter<T>(
    int index,
    ArraySegment<char> parameterName,
    T value,
    IFormatter<T> formatter
)

Parameters

index
Type: SystemInt32
Index of the custom parameter in the formatting string.
parameterName
Type: SystemArraySegment Char
Name of the custom parameter.
value
Type: T
Value of the custom parameter.
formatter
Type: PostSharp.Patterns.FormattersIFormatter T
The formatter to be used to format value.

Type Parameters

T
Type of the custom parameter.
See Also

Reference

TextLogRecordBuilder Class
WriteCustomParameter Overload
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


TextLogRecordBuilder.WriteCustomString Method

TextLogRecordBuilderWriteCustomString Method

Write a chunk of custom string.

Namespace: PostSharp.Patterns.Diagnostics.RecordBuilders
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void WriteCustomString(
    ArraySegment<char> str
)

Parameters

str
Type: SystemArraySegment Char
The string to be written.
Remarks
A custom string never contains formatting parameters.It is the responsibility of of the caller to parse a formatting string and invoke WriteCustomString(ArraySegmentChar) and WriteCustomParameterT(Int32, ArraySegmentChar, T) in alternance.
See Also

Reference

TextLogRecordBuilder Class
PostSharp.Patterns.Diagnostics.RecordBuilders Namespace


PostSharp.Patterns.Diagnostics.ThreadingInstrumentation Namespace

Classes
 | Class | Description
Public class | TaskInfo | Extended information about a Task. Exposed by the TaskInfoRegistry class.
Public class | TaskInfoRegistry | Stores additional information about instances of the Task class. This class is populated by the ThreadingInstrumentationPolicy and consumed by the Logging component.
Public class | ThreadingInstrumentationPolicy | Policy (assembly-level aspect) that instruments the System.Threading and System.Threading.Tasks APIes to enable for semantic logging of multi-threaded or multi-tasked programs.
Enumerations
 | Enumeration | Description
Public enumeration | TaskInfoKind | Kinds of TaskInfo.


TaskInfo Class

Extended information about a Task. Exposed by the TaskInfoRegistry class.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.ThreadingInstrumentationTaskInfo

Namespace: PostSharp.Patterns.Diagnostics.ThreadingInstrumentation
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class TaskInfo

The TaskInfo type exposes the following members.

Properties
 | Name | Description
Public property | CallerInfo | Gets information about the line of code that instantiated the Task.
Public property | Context | Gets the context (for CorrelatedContext).
Public property | Kind | Gets the kind of TaskInfo.
Public property | Method | Gets the awaited method (for Method).
Public property | Tasks | Gets the list of tasks (for WhenAll and WhenAny).
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.ThreadingInstrumentation Namespace


TaskInfo Properties

The TaskInfo type exposes the following members.

Properties
 | Name | Description
Public property | CallerInfo | Gets information about the line of code that instantiated the Task.
Public property | Context | Gets the context (for CorrelatedContext).
Public property | Kind | Gets the kind of TaskInfo.
Public property | Method | Gets the awaited method (for Method).
Public property | Tasks | Gets the list of tasks (for WhenAll and WhenAny).
Top
See Also

Reference

TaskInfo Class
PostSharp.Patterns.Diagnostics.ThreadingInstrumentation Namespace


TaskInfo.CallerInfo Property

TaskInfoCallerInfo Property

Gets information about the line of code that instantiated the Task.

Namespace: PostSharp.Patterns.Diagnostics.ThreadingInstrumentation
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CallerInfo CallerInfo { get; }

Property Value

Type: CallerInfo
See Also

Reference

TaskInfo Class
PostSharp.Patterns.Diagnostics.ThreadingInstrumentation Namespace


TaskInfo.Context Property

TaskInfoContext Property

Gets the context (for CorrelatedContext).

Namespace: PostSharp.Patterns.Diagnostics.ThreadingInstrumentation
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Object Context { get; }

Property Value

Type: Object
See Also

Reference

TaskInfo Class
PostSharp.Patterns.Diagnostics.ThreadingInstrumentation Namespace


TaskInfo.Kind Property

TaskInfoKind Property

Gets the kind of TaskInfo.

Namespace: PostSharp.Patterns.Diagnostics.ThreadingInstrumentation
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public TaskInfoKind Kind { get; }

Property Value

Type: TaskInfoKind
See Also

Reference

TaskInfo Class
PostSharp.Patterns.Diagnostics.ThreadingInstrumentation Namespace


TaskInfo.Method Property

TaskInfoMethod Property

Gets the awaited method (for Method).

Namespace: PostSharp.Patterns.Diagnostics.ThreadingInstrumentation
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MethodInfo Method { get; }

Property Value

Type: MethodInfo
See Also

Reference

TaskInfo Class
PostSharp.Patterns.Diagnostics.ThreadingInstrumentation Namespace


TaskInfo.Tasks Property

TaskInfoTasks Property

Gets the list of tasks (for WhenAll and WhenAny).

Namespace: PostSharp.Patterns.Diagnostics.ThreadingInstrumentation
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IList<Task> Tasks { get; }

Property Value

Type: IList Task
See Also

Reference

TaskInfo Class
PostSharp.Patterns.Diagnostics.ThreadingInstrumentation Namespace


TaskInfoKind Enumeration

Kinds of TaskInfo.

Namespace: PostSharp.Patterns.Diagnostics.ThreadingInstrumentation
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum TaskInfoKind
Members
Member name | Value | Description
Method | 0 | A method (Method is set).
CorrelatedContext | 1 | A correlated logging context (Context is set).
WhenAny | 2 | WhenAny(Task)
WhenAll | 3 | WhenAll(Task)
See Also

Reference

PostSharp.Patterns.Diagnostics.ThreadingInstrumentation Namespace


TaskInfoRegistry Class

Stores additional information about instances of the Task class. This class is populated by the ThreadingInstrumentationPolicy and consumed by the Logging component.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Diagnostics.ThreadingInstrumentationTaskInfoRegistry

Namespace: PostSharp.Patterns.Diagnostics.ThreadingInstrumentation
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static class TaskInfoRegistry

The TaskInfoRegistry type exposes the following members.

Methods
Name | Description
GetTaskInfo | Gets a TaskInfo for a specific Task.
RegisterMethod | Associates a Task with the MethodInfo that created it.
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.ThreadingInstrumentation Namespace


TaskInfoRegistry Methods

The TaskInfoRegistry type exposes the following members.

Methods
Name | Description
GetTaskInfo | Gets a TaskInfo for a specific Task.
RegisterMethod | Associates a Task with the MethodInfo that created it.
Top
See Also

Reference

TaskInfoRegistry Class
PostSharp.Patterns.Diagnostics.ThreadingInstrumentation Namespace


TaskInfoRegistry.GetTaskInfo Method

TaskInfoRegistryGetTaskInfo Method

Gets a TaskInfo for a specific Task.

Namespace: PostSharp.Patterns.Diagnostics.ThreadingInstrumentation
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static TaskInfo GetTaskInfo(
    Task task
)

Parameters

task
Type: System.Threading.TasksTask
A Task.

Return Value

Type: TaskInfo
The TaskInfo associated with task, or null if no TaskInfo is associated with task.
See Also

Reference

TaskInfoRegistry Class
PostSharp.Patterns.Diagnostics.ThreadingInstrumentation Namespace


TaskInfoRegistry.RegisterMethod Method

TaskInfoRegistryRegisterMethod Method

Associates a Task with the MethodInfo that created it.

Namespace: PostSharp.Patterns.Diagnostics.ThreadingInstrumentation
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void RegisterMethod(
    Task task,
    MethodInfo method,
    CallerInfo callerInfo
)

Parameters

task
Type: System.Threading.TasksTask
The Task returned by method.
method
Type: System.ReflectionMethodInfo
The method that returned task.
callerInfo
Type: PostSharp.Patterns.Diagnostics.ContextsCallerInfo
Information about the code calling the method.
See Also

Reference

TaskInfoRegistry Class
PostSharp.Patterns.Diagnostics.ThreadingInstrumentation Namespace


ThreadingInstrumentationPolicy Class

Policy (assembly-level aspect) that instruments the System.Threading and System.Threading.Tasks APIes to enable for semantic logging of multi-threaded or multi-tasked programs.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsAssemblyLevelAspect
PostSharp.Patterns.Diagnostics.ThreadingInstrumentationThreadingInstrumentationPolicy

Namespace: PostSharp.Patterns.Diagnostics.ThreadingInstrumentation
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ThreadingInstrumentationPolicy : AssemblyLevelAspect,
    IAspectProvider, IAspect, IService

The ThreadingInstrumentationPolicy type exposes the following members.

Constructors
 | Name | Description
Public method | ThreadingInstrumentationPolicy | Initializes a new instance of the ThreadingInstrumentationPolicy class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from AssemblyLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from AssemblyLevelAspect.)
Public method | CompileTimeValidate(Assembly) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from AssemblyLevelAspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Top
See Also

Reference

PostSharp.Patterns.Diagnostics.ThreadingInstrumentation Namespace


ThreadingInstrumentationPolicy Constructor

Initializes a new instance of the ThreadingInstrumentationPolicy class

Namespace: PostSharp.Patterns.Diagnostics.ThreadingInstrumentation
Assembly: PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ThreadingInstrumentationPolicy()
See Also

Reference

ThreadingInstrumentationPolicy Class
PostSharp.Patterns.Diagnostics.ThreadingInstrumentation Namespace


ThreadingInstrumentationPolicy Properties

The ThreadingInstrumentationPolicy type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

ThreadingInstrumentationPolicy Class
PostSharp.Patterns.Diagnostics.ThreadingInstrumentation Namespace


ThreadingInstrumentationPolicy Methods

The ThreadingInstrumentationPolicy type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from AssemblyLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from AssemblyLevelAspect.)
Public method | CompileTimeValidate(Assembly) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from AssemblyLevelAspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Top
See Also

Reference

ThreadingInstrumentationPolicy Class
PostSharp.Patterns.Diagnostics.ThreadingInstrumentation Namespace


PostSharp.Patterns.DynamicAdvising Namespace

Classes
 | Class | Description
Public class | DynamicAdvice | A base implementation of the IDynamicAdvice interface.
Public class | DynamicAdviceOrder | Order of dynamic advices.
Public class | DynamicAdvisingServices | Provides methods to help with the use of dynamic advices.
Public class | DynamicallyAdvisableObject | Base class for objects into which advices can be dynamically injected.
Structures
 | Structure | Description
Public structure | AdviceEnumeratorT | An immutable iterators of dynamic advices IDynamicAdvice. The GetNext method returns a new enumerator instance.
Interfaces
 | Interface | Description
Public interface | IActionTResult | Exposes an Execute method.
Public interface | IDynamicAdvice | Represents an advice that can be injected dynamically into a dynamically-advisable object.
Public interface | IDynamicallyAdvisable | Defines the semantics of an object that accepts dynamic advices.
Public interface | IDynamicInterfaceImplementation | Interface that must be implemented by objects implementing dynamic interfaces, which can be queried using QueryInterfaceT. The IDynamicInterfaceImplementation interface provides a mean to get a reference back to the principal object.
Public interface | IExecuteActionDynamicAdvice | A dynamic advice around the execution of an action.
Public interface | IQueryInterface | Interface implemented by objects that can implement interface dynamically by composition, without implementing the interface directly at MSIL level. The QueryInterfaceT method must then be used instead of a normal cast.


AdviceEnumerator(T) Structure

AdviceEnumeratorT Structure

An immutable iterators of dynamic advices IDynamicAdvice. The GetNext method returns a new enumerator instance.

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public struct AdviceEnumerator<T>
where T : class, IDynamicAdvice

Type Parameters

T
The advice interface.

The AdviceEnumeratorT type exposes the following members.

Properties
 | Name | Description
Public property | Current | Gets the current value.
Public property | HasValue | Determines whether the current enumerator has a Current value.
Top
Methods
 | Name | Description
Public method | GetNext | Gets a new instance of AdviceEnumeratorT that points to the next item.
Top
See Also

Reference

PostSharp.Patterns.DynamicAdvising Namespace


AdviceEnumerator(T) Properties

AdviceEnumeratorT Properties

The AdviceEnumeratorT generic type exposes the following members.

Properties
 | Name | Description
Public property | Current | Gets the current value.
Public property | HasValue | Determines whether the current enumerator has a Current value.
Top
See Also

Reference

AdviceEnumeratorT Structure
PostSharp.Patterns.DynamicAdvising Namespace


AdviceEnumerator(T).Current Property

AdviceEnumeratorTCurrent Property

Gets the current value.

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public T Current { get; }

Property Value

Type: T
See Also

Reference

AdviceEnumeratorT Structure
PostSharp.Patterns.DynamicAdvising Namespace


AdviceEnumerator(T).HasValue Property

AdviceEnumeratorTHasValue Property

Determines whether the current enumerator has a Current value.

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool HasValue { get; }

Property Value

Type: Boolean
See Also

Reference

AdviceEnumeratorT Structure
PostSharp.Patterns.DynamicAdvising Namespace


AdviceEnumerator(T) Methods

AdviceEnumeratorT Methods

The AdviceEnumeratorT generic type exposes the following members.

Methods
 | Name | Description
Public method | GetNext | Gets a new instance of AdviceEnumeratorT that points to the next item.
Top
See Also

Reference

AdviceEnumeratorT Structure
PostSharp.Patterns.DynamicAdvising Namespace


AdviceEnumerator(T).GetNext Method

AdviceEnumeratorTGetNext Method

Gets a new instance of AdviceEnumeratorT that points to the next item.

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AdviceEnumerator<T> GetNext()

Return Value

Type: AdviceEnumerator T
See Also

Reference

AdviceEnumeratorT Structure
PostSharp.Patterns.DynamicAdvising Namespace


DynamicAdvice Class

A base implementation of the IDynamicAdvice interface.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DynamicAdvisingDynamicAdvice
PostSharp.Patterns.Collections.AdvicesCollectionDynamicAdviceT
PostSharp.Patterns.Collections.AdvicesDictionaryDynamicAdviceTKey, TValue
PostSharp.Patterns.Collections.AdvicesHashSetDynamicAdviceT

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class DynamicAdvice : IDynamicAdvice,
    IDynamicInterfaceImplementation

The DynamicAdvice type exposes the following members.

Constructors
 | Name | Description
Protected method | DynamicAdvice | Initializes a new DynamicAdvice.
Top
Properties
 | Name | Description
Protected property | AdvisedObject | Gets the advised object.
Public property | Identity | Gets the type identity of the advice, which should correspond to the first parameter of the Advise(Type, FuncIQueryInterface, IDynamicAdvice) method. This is typically the generic type definition of the advice
Public property | Order | Gets the execution order of the dynamic advice. See DynamicAdviceOrder.
Top
Methods
 | Name | Description
Public method | Dispose | Disposes the current advice. // We don't use IDisposable so that advises are not be cast to IDisposable by default.
Public method | Initialize | Initializes the current advice.
Public method | QueryInterfaceTInterface |
Top
See Also

Reference

PostSharp.Patterns.DynamicAdvising Namespace


DynamicAdvice Constructor

Initializes a new DynamicAdvice.

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected DynamicAdvice(
    IQueryInterface parent
)

Parameters

parent
Type: PostSharp.Patterns.DynamicAdvisingIQueryInterface
The advised object.
See Also

Reference

DynamicAdvice Class
PostSharp.Patterns.DynamicAdvising Namespace


DynamicAdvice Properties

The DynamicAdvice type exposes the following members.

Properties
 | Name | Description
Protected property | AdvisedObject | Gets the advised object.
Public property | Identity | Gets the type identity of the advice, which should correspond to the first parameter of the Advise(Type, FuncIQueryInterface, IDynamicAdvice) method. This is typically the generic type definition of the advice
Public property | Order | Gets the execution order of the dynamic advice. See DynamicAdviceOrder.
Top
See Also

Reference

DynamicAdvice Class
PostSharp.Patterns.DynamicAdvising Namespace


DynamicAdvice.AdvisedObject Property

DynamicAdviceAdvisedObject Property

Gets the advised object.

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected IQueryInterface AdvisedObject { get; }

Property Value

Type: IQueryInterface
See Also

Reference

DynamicAdvice Class
PostSharp.Patterns.DynamicAdvising Namespace


DynamicAdvice.Identity Property

DynamicAdviceIdentity Property

Gets the type identity of the advice, which should correspond to the first parameter of the Advise(Type, FuncIQueryInterface, IDynamicAdvice) method. This is typically the generic type definition of the advice

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual Type Identity { get; }

Property Value

Type: Type

Implements

IDynamicAdviceIdentity
See Also

Reference

DynamicAdvice Class
PostSharp.Patterns.DynamicAdvising Namespace


DynamicAdvice.Order Property

DynamicAdviceOrder Property

Gets the execution order of the dynamic advice. See DynamicAdviceOrder.

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract int Order { get; }

Property Value

Type: Int32

Implements

IDynamicAdviceOrder
See Also

Reference

DynamicAdvice Class
PostSharp.Patterns.DynamicAdvising Namespace


DynamicAdvice Methods

The DynamicAdvice type exposes the following members.

Methods
 | Name | Description
Public method | Dispose | Disposes the current advice. // We don't use IDisposable so that advises are not be cast to IDisposable by default.
Public method | Initialize | Initializes the current advice.
Public method | QueryInterfaceTInterface |
Top
See Also

Reference

DynamicAdvice Class
PostSharp.Patterns.DynamicAdvising Namespace


DynamicAdvice.Dispose Method

DynamicAdviceDispose Method

Disposes the current advice. // We don't use IDisposable so that advises are not be cast to IDisposable by default.

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void Dispose()

Implements

IDynamicAdviceDispose
See Also

Reference

DynamicAdvice Class
PostSharp.Patterns.DynamicAdvising Namespace


DynamicAdvice.Initialize Method

DynamicAdviceInitialize Method

Initializes the current advice.

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void Initialize(
    IQueryInterface parent,
    AdviceEnumerator<IDynamicAdvice> nextAdvice
)

Parameters

parent
Type: PostSharp.Patterns.DynamicAdvisingIQueryInterface
The parent, dynamically-advisable object.
nextAdvice
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator IDynamicAdvice
The next advice in the chain.

Implements

IDynamicAdviceInitialize(IQueryInterface, AdviceEnumeratorIDynamicAdvice)
See Also

Reference

DynamicAdvice Class
PostSharp.Patterns.DynamicAdvising Namespace


DynamicAdvice.QueryInterface(TInterface) Method

DynamicAdviceQueryInterfaceTInterface Method

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual TInterface QueryInterface<TInterface>()
where TInterface : class

Type Parameters

TInterface

Return Value

Type: TInterface
See Also

Reference

DynamicAdvice Class
PostSharp.Patterns.DynamicAdvising Namespace


DynamicAdviceOrder Class

Order of dynamic advices.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DynamicAdvisingDynamicAdviceOrder

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static class DynamicAdviceOrder

The DynamicAdviceOrder type exposes the following members.

Fields
Name | Description
Aggregatable | Aggregatable.
Disposable | Disposable.
Recordable | Change tracking (recordable).
Threading | Threading models.
Top
See Also

Reference

PostSharp.Patterns.DynamicAdvising Namespace


DynamicAdviceOrder Fields

The DynamicAdviceOrder type exposes the following members.

Fields
Name | Description
Aggregatable | Aggregatable.
Disposable | Disposable.
Recordable | Change tracking (recordable).
Threading | Threading models.
Top
See Also

Reference

DynamicAdviceOrder Class
PostSharp.Patterns.DynamicAdvising Namespace


DynamicAdviceOrder.Aggregatable Field

DynamicAdviceOrderAggregatable Field

Aggregatable.

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const int Aggregatable = 10

Field Value

Type: Int32
See Also

Reference

DynamicAdviceOrder Class
PostSharp.Patterns.DynamicAdvising Namespace


DynamicAdviceOrder.Disposable Field

DynamicAdviceOrderDisposable Field

Disposable.

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const int Disposable = 20

Field Value

Type: Int32
See Also

Reference

DynamicAdviceOrder Class
PostSharp.Patterns.DynamicAdvising Namespace


DynamicAdviceOrder.Recordable Field

DynamicAdviceOrderRecordable Field

Change tracking (recordable).

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const int Recordable = -10

Field Value

Type: Int32
See Also

Reference

DynamicAdviceOrder Class
PostSharp.Patterns.DynamicAdvising Namespace


DynamicAdviceOrder.Threading Field

DynamicAdviceOrderThreading Field

Threading models.

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const int Threading = 30

Field Value

Type: Int32
See Also

Reference

DynamicAdviceOrder Class
PostSharp.Patterns.DynamicAdvising Namespace


DynamicAdvisingServices Class

Provides methods to help with the use of dynamic advices.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DynamicAdvisingDynamicAdvisingServices

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static class DynamicAdvisingServices

The DynamicAdvisingServices type exposes the following members.

Methods
Name | Description
QueryInterfaceT | Gets the implementation of a specified interface for the specified object.
QueryObject | Gets the principal object of an advice.
Top
See Also

Reference

PostSharp.Patterns.DynamicAdvising Namespace
PostSharp.Patterns.DynamicAdvisingIQueryInterface


DynamicAdvisingServices Methods

The DynamicAdvisingServices type exposes the following members.

Methods
Name | Description
QueryInterfaceT | Gets the implementation of a specified interface for the specified object.
QueryObject | Gets the principal object of an advice.
Top
See Also

Reference

DynamicAdvisingServices Class
PostSharp.Patterns.DynamicAdvising Namespace


DynamicAdvisingServices.QueryInterface(T) Method

DynamicAdvisingServicesQueryInterfaceT Method

Gets the implementation of a specified interface for the specified object.

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static T QueryInterface<T>(
    Object obj,
    bool throwing = true
)
where T : class

Parameters

obj
Type: SystemObject
The object for which the interface should be queried.
throwing (Optional)
Type: SystemBoolean
true if the method should throw a InvalidCastException if obj does not implement the T interface, false if null be returned instead. The default value is true.

Type Parameters

T
The type of the required interface.

Return Value

Type: T
An object implementing the T interface on behalf of obj, or null if obj does not implement T and throwing is true.
Remarks

This method shall return obj if the type of obj statically implements the interface. Otherwise, the method shall return another object that implements T on behalf of obj. In this case, the returned object shall implement the IDynamicInterfaceImplementation interface, which allows to navigate back to obj.

See Also

Reference

DynamicAdvisingServices Class
PostSharp.Patterns.DynamicAdvising Namespace

Other Resources

Conceptual: Breaking Changes in PostSharp 6.0


DynamicAdvisingServices.QueryObject Method

DynamicAdvisingServicesQueryObject Method

Gets the principal object of an advice.

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Object QueryObject(
    Object obj
)

Parameters

obj
Type: SystemObject
An object or a dynamic advice.

Return Value

Type: Object
The AdvisedObject is obj is a dynamic advice, otherwise obj itself.
See Also

Reference

DynamicAdvisingServices Class
PostSharp.Patterns.DynamicAdvising Namespace


DynamicallyAdvisableObject Class

Base class for objects into which advices can be dynamically injected.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.DynamicAdvisingDynamicallyAdvisableObject
PostSharp.Patterns.CollectionsAdvisableCollectionT
PostSharp.Patterns.CollectionsAdvisableDictionaryTKey, TValue
PostSharp.Patterns.CollectionsAdvisableHashSetT

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public abstract class DynamicallyAdvisableObject : IDynamicallyAdvisable,
    IQueryInterface, ISerializable, IDeserializationCallback

The DynamicallyAdvisableObject type exposes the following members.

Methods
 | Name | Description
Protected method | ExecuteWithAdvicesTResult, TAction | Executes an action wrapped by all custom advices added to the current object.
Public method | GetAdviceEnumeratorT | Gets an AdviceEnumeratorT for all advices implementing a given interface on the current object.
Public method | GetObjectData | Populates a SerializationInfo with the data needed to serialize the target object.
Protected method | InitializeAdvices | Initializes the list of dynamic advices.
Public method | OnDeserialization | Runs when the entire object graph has been deserialized.
Top
See Also

Reference

PostSharp.Patterns.DynamicAdvising Namespace


DynamicallyAdvisableObject Methods

The DynamicallyAdvisableObject type exposes the following members.

Methods
 | Name | Description
Protected method | ExecuteWithAdvicesTResult, TAction | Executes an action wrapped by all custom advices added to the current object.
Public method | GetAdviceEnumeratorT | Gets an AdviceEnumeratorT for all advices implementing a given interface on the current object.
Public method | GetObjectData | Populates a SerializationInfo with the data needed to serialize the target object.
Protected method | InitializeAdvices | Initializes the list of dynamic advices.
Public method | OnDeserialization | Runs when the entire object graph has been deserialized.
Top
See Also

Reference

DynamicallyAdvisableObject Class
PostSharp.Patterns.DynamicAdvising Namespace


DynamicallyAdvisableObject.ExecuteWithAdvices(TResult, TAction) Method

DynamicallyAdvisableObjectExecuteWithAdvicesTResult, TAction Method

Executes an action wrapped by all custom advices added to the current object.

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected TResult ExecuteWithAdvices<TResult, TAction>(
    ObjectAccessLevel objectAccessLevel,
    ref TAction action
)
where TAction : struct, new(), IAction<TResult>

Parameters

objectAccessLevel
Type: PostSharp.Patterns.ModelObjectAccessLevel
Required access level when executing action.
action
Type: TAction
The action to be executed.

Type Parameters

TResult
Type of return value.
TAction
Action type.

Return Value

Type: TResult
The return value of action.
See Also

Reference

DynamicallyAdvisableObject Class
PostSharp.Patterns.DynamicAdvising Namespace


DynamicallyAdvisableObject.GetAdviceEnumerator(T) Method

DynamicallyAdvisableObjectGetAdviceEnumeratorT Method

Gets an AdviceEnumeratorT for all advices implementing a given interface on the current object.

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AdviceEnumerator<T> GetAdviceEnumerator<T>()
where T : class, IDynamicAdvice

Type Parameters

T
Interface to be implemented by the advice

Return Value

Type: AdviceEnumerator T
An AdviceEnumeratorT that enumerates all advices of type T on the current object.
See Also

Reference

DynamicallyAdvisableObject Class
PostSharp.Patterns.DynamicAdvising Namespace


DynamicallyAdvisableObject.GetObjectData Method

DynamicallyAdvisableObjectGetObjectData Method

Populates a SerializationInfo with the data needed to serialize the target object.

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void GetObjectData(
    SerializationInfo info,
    StreamingContext context
)

Parameters

info
Type: System.Runtime.SerializationSerializationInfo
The SerializationInfo to populate with data.
context
Type: System.Runtime.SerializationStreamingContext
The destination (see StreamingContext) for this serialization.

Implements

ISerializableGetObjectData(SerializationInfo, StreamingContext)
Exceptions
Exception | Condition
SecurityException | The caller does not have the required permission.
See Also

Reference

DynamicallyAdvisableObject Class
PostSharp.Patterns.DynamicAdvising Namespace


DynamicallyAdvisableObject.InitializeAdvices Method

DynamicallyAdvisableObjectInitializeAdvices Method

Initializes the list of dynamic advices.

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected void InitializeAdvices(
    IExecuteActionDynamicAdvice advice
)

Parameters

advice
Type: PostSharp.Patterns.DynamicAdvisingIExecuteActionDynamicAdvice
The last advice in the chain of responsibility, which does the actual work.
See Also

Reference

DynamicallyAdvisableObject Class
PostSharp.Patterns.DynamicAdvising Namespace


DynamicallyAdvisableObject.OnDeserialization Method

DynamicallyAdvisableObjectOnDeserialization Method

Runs when the entire object graph has been deserialized.

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void OnDeserialization(
    Object sender
)

Parameters

sender
Type: SystemObject
The object that initiated the callback. The functionality for this parameter is not currently implemented.

Implements

IDeserializationCallbackOnDeserialization(Object)
See Also

Reference

DynamicallyAdvisableObject Class
PostSharp.Patterns.DynamicAdvising Namespace


IAction(TResult) Interface

IActionTResult Interface

Exposes an Execute method.

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IAction<TResult>

Type Parameters

TResult
Return type of the Execute method.

The IActionTResult type exposes the following members.

Methods
 | Name | Description
Public method | Execute | Executes the action.
Top
See Also

Reference

PostSharp.Patterns.DynamicAdvising Namespace


IAction(TResult) Methods

IActionTResult Methods

The IActionTResult generic type exposes the following members.

Methods
 | Name | Description
Public method | Execute | Executes the action.
Top
See Also

Reference

IActionTResult Interface
PostSharp.Patterns.DynamicAdvising Namespace


IAction(TResult).Execute Method

IActionTResultExecute Method

Executes the action.

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
TResult Execute()

Return Value

Type: TResult
Anything.
See Also

Reference

IActionTResult Interface
PostSharp.Patterns.DynamicAdvising Namespace


IDynamicAdvice Interface

Represents an advice that can be injected dynamically into a dynamically-advisable object.

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IDynamicAdvice : IDynamicInterfaceImplementation

The IDynamicAdvice type exposes the following members.

Properties
 | Name | Description
Public property | AdvisedObject | Gets the principal object for which the current object is an indirect interface implementation. (Inherited from IDynamicInterfaceImplementation.)
Public property | Identity | Gets the type identity of the advice, which should correspond to the first parameter of the Advise(Type, FuncIQueryInterface, IDynamicAdvice) method. This is typically the generic type definition of the advice
Public property | Order | Gets the execution order of the dynamic advice. See DynamicAdviceOrder.
Top
Methods
 | Name | Description
Public method | Dispose | Disposes the current advice. // We don't use IDisposable so that advises are not be cast to IDisposable by default.
Public method | Initialize | Initializes the current advice.
Public method | QueryInterfaceT | Gets the implementation of an interface.
Top
Remarks

Dynamic advices form a chain of responsibility. Specific interfaces derived from IDynamicAdvice (e.g. ICollectionDynamicAdviceT or IDictionaryDynamicAdviceTKey, TValue) define the semantics of the corresponding specific advised type (e.g. AdvisableCollectionT or AdvisableDictionaryTKey, TValue. The last node in the chain of implementation is the actual collection implementation.

See Also

Reference

PostSharp.Patterns.DynamicAdvising Namespace


IDynamicAdvice Properties

The IDynamicAdvice type exposes the following members.

Properties
 | Name | Description
Public property | AdvisedObject | Gets the principal object for which the current object is an indirect interface implementation. (Inherited from IDynamicInterfaceImplementation.)
Public property | Identity | Gets the type identity of the advice, which should correspond to the first parameter of the Advise(Type, FuncIQueryInterface, IDynamicAdvice) method. This is typically the generic type definition of the advice
Public property | Order | Gets the execution order of the dynamic advice. See DynamicAdviceOrder.
Top
See Also

Reference

IDynamicAdvice Interface
PostSharp.Patterns.DynamicAdvising Namespace


IDynamicAdvice.Identity Property

IDynamicAdviceIdentity Property

Gets the type identity of the advice, which should correspond to the first parameter of the Advise(Type, FuncIQueryInterface, IDynamicAdvice) method. This is typically the generic type definition of the advice

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Type Identity { get; }

Property Value

Type: Type
See Also

Reference

IDynamicAdvice Interface
PostSharp.Patterns.DynamicAdvising Namespace


IDynamicAdvice.Order Property

IDynamicAdviceOrder Property

Gets the execution order of the dynamic advice. See DynamicAdviceOrder.

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
int Order { get; }

Property Value

Type: Int32
See Also

Reference

IDynamicAdvice Interface
PostSharp.Patterns.DynamicAdvising Namespace


IDynamicAdvice Methods

The IDynamicAdvice type exposes the following members.

Methods
 | Name | Description
Public method | Dispose | Disposes the current advice. // We don't use IDisposable so that advises are not be cast to IDisposable by default.
Public method | Initialize | Initializes the current advice.
Public method | QueryInterfaceT | Gets the implementation of an interface.
Top
See Also

Reference

IDynamicAdvice Interface
PostSharp.Patterns.DynamicAdvising Namespace


IDynamicAdvice.Dispose Method

IDynamicAdviceDispose Method

Disposes the current advice. // We don't use IDisposable so that advises are not be cast to IDisposable by default.

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void Dispose()
See Also

Reference

IDynamicAdvice Interface
PostSharp.Patterns.DynamicAdvising Namespace


IDynamicAdvice.Initialize Method

IDynamicAdviceInitialize Method

Initializes the current advice.

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void Initialize(
    IQueryInterface parent,
    AdviceEnumerator<IDynamicAdvice> nextAdvice
)

Parameters

parent
Type: PostSharp.Patterns.DynamicAdvisingIQueryInterface
The parent, dynamically-advisable object.
nextAdvice
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator IDynamicAdvice
The next advice in the chain.
See Also

Reference

IDynamicAdvice Interface
PostSharp.Patterns.DynamicAdvising Namespace


IDynamicAdvice.QueryInterface(T) Method

IDynamicAdviceQueryInterfaceT Method

Gets the implementation of an interface.

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
T QueryInterface<T>()
where T : class

Type Parameters

T
Interface type.

Return Value

Type: T
The implementation of interface T, or null if the advice does not implement this interface.
See Also

Reference

IDynamicAdvice Interface
PostSharp.Patterns.DynamicAdvising Namespace


IDynamicallyAdvisable Interface

Defines the semantics of an object that accepts dynamic advices.

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IDynamicallyAdvisable : IQueryInterface

The IDynamicallyAdvisable type exposes the following members.

Methods
 | Name | Description
Public method | Advise | Adds an advice to the object.
Public method | QueryAdviceT | Queries an interface implemented by a dynamic advice.
Public method | QueryInterfaceT | Gets the implementation of a specified interface for the current object. (Inherited from IQueryInterface.)
Public method | Unadvise | Removes an advice from the object.
Top
See Also

Reference

PostSharp.Patterns.DynamicAdvising Namespace


IDynamicallyAdvisable Methods

The IDynamicallyAdvisable type exposes the following members.

Methods
 | Name | Description
Public method | Advise | Adds an advice to the object.
Public method | QueryAdviceT | Queries an interface implemented by a dynamic advice.
Public method | QueryInterfaceT | Gets the implementation of a specified interface for the current object. (Inherited from IQueryInterface.)
Public method | Unadvise | Removes an advice from the object.
Top
See Also

Reference

IDynamicallyAdvisable Interface
PostSharp.Patterns.DynamicAdvising Namespace


IDynamicallyAdvisable.Advise Method

IDynamicallyAdvisableAdvise Method

Adds an advice to the object.

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
bool Advise(
    Type type,
    Func<IQueryInterface, IDynamicAdvice> createAdvice
)

Parameters

type
Type: SystemType
The advice type identity.
createAdvice
Type: SystemFunc IQueryInterface, IDynamicAdvice
A delegate that instantiates the advice if it has not yet been added to the object.

Return Value

Type: Boolean
true if the advice was added, false if it was already added.
See Also

Reference

IDynamicallyAdvisable Interface
PostSharp.Patterns.DynamicAdvising Namespace


IDynamicallyAdvisable.QueryAdvice(T) Method

IDynamicallyAdvisableQueryAdviceT Method

Queries an interface implemented by a dynamic advice.

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
T QueryAdvice<T>()
where T : class

Type Parameters

T
The interface type.

Return Value

Type: T
The interface implementation, or null if the object does not have an advice implementing T.
See Also

Reference

IDynamicallyAdvisable Interface
PostSharp.Patterns.DynamicAdvising Namespace


IDynamicallyAdvisable.Unadvise Method

IDynamicallyAdvisableUnadvise Method

Removes an advice from the object.

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
bool Unadvise(
    Type type
)

Parameters

type
Type: SystemType
The advice type identity.

Return Value

Type: Boolean
true if the advice was removed, false if it was not present.
See Also

Reference

IDynamicallyAdvisable Interface
PostSharp.Patterns.DynamicAdvising Namespace


IDynamicInterfaceImplementation Interface

Interface that must be implemented by objects implementing dynamic interfaces, which can be queried using QueryInterfaceT. The IDynamicInterfaceImplementation interface provides a mean to get a reference back to the principal object.

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IDynamicInterfaceImplementation

The IDynamicInterfaceImplementation type exposes the following members.

Properties
 | Name | Description
Public property | AdvisedObject | Gets the principal object for which the current object is an indirect interface implementation.
Top
See Also

Reference

PostSharp.Patterns.DynamicAdvising Namespace


IDynamicInterfaceImplementation Properties

The IDynamicInterfaceImplementation type exposes the following members.

Properties
 | Name | Description
Public property | AdvisedObject | Gets the principal object for which the current object is an indirect interface implementation.
Top
See Also

Reference

IDynamicInterfaceImplementation Interface
PostSharp.Patterns.DynamicAdvising Namespace


IDynamicInterfaceImplementation.AdvisedObject Property

IDynamicInterfaceImplementationAdvisedObject Property

Gets the principal object for which the current object is an indirect interface implementation.

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Object AdvisedObject { get; }

Property Value

Type: Object
See Also

Reference

IDynamicInterfaceImplementation Interface
PostSharp.Patterns.DynamicAdvising Namespace


IExecuteActionDynamicAdvice Interface

A dynamic advice around the execution of an action.

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IExecuteActionDynamicAdvice : IDynamicAdvice,
    IDynamicInterfaceImplementation

The IExecuteActionDynamicAdvice type exposes the following members.

Properties
 | Name | Description
Public property | AdvisedObject | Gets the principal object for which the current object is an indirect interface implementation. (Inherited from IDynamicInterfaceImplementation.)
Public property | Identity | Gets the type identity of the advice, which should correspond to the first parameter of the Advise(Type, FuncIQueryInterface, IDynamicAdvice) method. This is typically the generic type definition of the advice (Inherited from IDynamicAdvice.)
Public property | Order | Gets the execution order of the dynamic advice. See DynamicAdviceOrder. (Inherited from IDynamicAdvice.)
Top
Methods
 | Name | Description
Public method | Dispose | Disposes the current advice. // We don't use IDisposable so that advises are not be cast to IDisposable by default. (Inherited from IDynamicAdvice.)
Public method | Initialize | Initializes the current advice. (Inherited from IDynamicAdvice.)
Public method | InvokeTResult, TAction | Invokes the advice or the underlying method.
Public method | QueryInterfaceT | Gets the implementation of an interface. (Inherited from IDynamicAdvice.)
Top
See Also

Reference

PostSharp.Patterns.DynamicAdvising Namespace


IExecuteActionDynamicAdvice Properties

The IExecuteActionDynamicAdvice type exposes the following members.

Properties
 | Name | Description
Public property | AdvisedObject | Gets the principal object for which the current object is an indirect interface implementation. (Inherited from IDynamicInterfaceImplementation.)
Public property | Identity | Gets the type identity of the advice, which should correspond to the first parameter of the Advise(Type, FuncIQueryInterface, IDynamicAdvice) method. This is typically the generic type definition of the advice (Inherited from IDynamicAdvice.)
Public property | Order | Gets the execution order of the dynamic advice. See DynamicAdviceOrder. (Inherited from IDynamicAdvice.)
Top
See Also

Reference

IExecuteActionDynamicAdvice Interface
PostSharp.Patterns.DynamicAdvising Namespace


IExecuteActionDynamicAdvice Methods

The IExecuteActionDynamicAdvice type exposes the following members.

Methods
 | Name | Description
Public method | Dispose | Disposes the current advice. // We don't use IDisposable so that advises are not be cast to IDisposable by default. (Inherited from IDynamicAdvice.)
Public method | Initialize | Initializes the current advice. (Inherited from IDynamicAdvice.)
Public method | InvokeTResult, TAction | Invokes the advice or the underlying method.
Public method | QueryInterfaceT | Gets the implementation of an interface. (Inherited from IDynamicAdvice.)
Top
See Also

Reference

IExecuteActionDynamicAdvice Interface
PostSharp.Patterns.DynamicAdvising Namespace


IExecuteActionDynamicAdvice.Invoke(TResult, TAction) Method

IExecuteActionDynamicAdviceInvokeTResult, TAction Method

Invokes the advice or the underlying method.

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
TResult Invoke<TResult, TAction>(
    ObjectAccessLevel objectAccessLevel,
    AdviceEnumerator<IExecuteActionDynamicAdvice> nextAdvice,
    ref TAction action
)
where TAction : struct, new(), IAction<TResult>

Parameters

objectAccessLevel
Type: PostSharp.Patterns.ModelObjectAccessLevel
The ObjectAccessLevel required by the action.
nextAdvice
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator IExecuteActionDynamicAdvice
Next advice.
action
Type: TAction
The action to be executed.

Type Parameters

TResult
Type of the method result.
TAction
Type of the action.

Return Value

Type: TResult
The result of the underlying advice.
See Also

Reference

IExecuteActionDynamicAdvice Interface
PostSharp.Patterns.DynamicAdvising Namespace


IQueryInterface Interface

Interface implemented by objects that can implement interface dynamically by composition, without implementing the interface directly at MSIL level. The QueryInterfaceT method must then be used instead of a normal cast.

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IQueryInterface

The IQueryInterface type exposes the following members.

Methods
 | Name | Description
Public method | QueryInterfaceT | Gets the implementation of a specified interface for the current object.
Top
See Also

Reference

PostSharp.Patterns.DynamicAdvising Namespace
PostSharp.Patterns.DynamicAdvisingIDynamicInterfaceImplementation
QueryInterfaceExtensions


IQueryInterface Methods

The IQueryInterface type exposes the following members.

Methods
 | Name | Description
Public method | QueryInterfaceT | Gets the implementation of a specified interface for the current object.
Top
See Also

Reference

IQueryInterface Interface
PostSharp.Patterns.DynamicAdvising Namespace


IQueryInterface.QueryInterface(T) Method

IQueryInterfaceQueryInterfaceT Method

Gets the implementation of a specified interface for the current object.

Namespace: PostSharp.Patterns.DynamicAdvising
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
T QueryInterface<T>()
where T : class

Type Parameters

T
The type of the required interface.

Return Value

Type: T
An object implementing the T interface on behalf of the current object, or null if the current object does not implement the T interface.
Remarks

This method shall return the current object if the type of the current object statically implements the interface. Otherwise, the method shall return another object that implements T on behalf of the current object. In this case, the returned object shall implement the IDynamicInterfaceImplementation interface, which allows to navigate back to the current object.

User code typically uses the QueryInterface``1(Object, Boolean) extension method.

See Also

Reference

IQueryInterface Interface
PostSharp.Patterns.DynamicAdvising Namespace


PostSharp.Patterns.Formatters Namespace

Classes
 | Class | Description
Public class | BooleanFormatter | A formatter for Boolean values.
Public class | ByteFormatter | A formatter for Byte values.
Public class | CharFormatter | A formatter for Char values.
Public class | DefaultFormatterTRole, TValue | The default formatter that formats objects by calling ToString.
Public class | EnumFormatter | Efficient formatter for enums.
Public class | EnumFormatterT | Efficient formatter for enums.
Public class | FormatterT | Base implementation of the IFormatterT interface.
Public class | FormatterRepositoryTRole | Allows to get and register formatters for a specific type.
Public class | FormattingRole | Base for kind marker types for FormatterRepositoryTRole.
Public class | Int16Formatter | Efficient formatter for Int16.
Public class | Int32Formatter | Efficient formatter for Int32.
Public class | Int64Formatter | Efficient formatter for Int64.
Public class | MethodFormatter | A formatter for MethodBase values.
Public class | SByteFormatter | Efficient formatter for SByte.
Public class | StringFormatter | A formatter for String values.
Public class | TypeFormatter | A FormatterT for Type values.
Public class | UInt16Formatter | A formatter for UInt16 values.
Public class | UInt32Formatter | A formatter for UInt32 values.
Public class | UInt64Formatter | A formatter for UInt64 values.
Public class | UnsafeString | A generalized representation of a string that can be either backed by a system String, a char[], or an UnsafeStringBuilder. Conversions between these types happen transparently and are cached.
Public class | UnsafeStringBuilder | A class similar to StringBuilder, but implemented using unsafe C#.
Public class | UnsafeStringBuilderPool | A thread-safe pool of UnsafeStringBuilder.
Interfaces
 | Interface | Description
Public interface | IFormattable | Exposes a Format(UnsafeStringBuilder, FormattingRole) method, which allows an object to format itself into an UnsafeStringBuilder. Logging and caching components rely on the IFormattable interface.
Public interface | IFormatter | Appends the description of an object into an UnsafeStringBuilder. Weakly-typed variant of IFormatterT.
Public interface | IFormatterT | Appends the description of an object into an UnsafeStringBuilder. Strongly-typed variant of IFormatter.
Enumerations
 | Enumeration | Description
Public enumeration | FormatterAttributes | Attributes of an IFormatter.


BooleanFormatter Class

A formatter for Boolean values.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.FormattersFormatter Boolean
PostSharp.Patterns.FormattersBooleanFormatter

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class BooleanFormatter : Formatter<bool>

The BooleanFormatter type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from FormatterT.)
Top
Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, Boolean) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Top
Fields
Name | Description
Instance | The singleton instance of BooleanFormatter.
Top
See Also

Reference

PostSharp.Patterns.Formatters Namespace


BooleanFormatter Properties

The BooleanFormatter type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from FormatterT.)
Top
See Also

Reference

BooleanFormatter Class
PostSharp.Patterns.Formatters Namespace


BooleanFormatter Methods

Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, Boolean) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Top
See Also

Reference

BooleanFormatter Class
PostSharp.Patterns.Formatters Namespace


BooleanFormatter.Write Method

BooleanFormatterWrite Method

Overload List
 | Name | Description
Public method | Write(UnsafeStringBuilder, Boolean) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Top
See Also

Reference

BooleanFormatter Class
PostSharp.Patterns.Formatters Namespace


BooleanFormatter.Write Method (UnsafeStringBuilder, Boolean)

BooleanFormatterWrite Method (UnsafeStringBuilder, Boolean)

Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant).

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void Write(
    UnsafeStringBuilder stringBuilder,
    bool value
)

Parameters

stringBuilder
Type: PostSharp.Patterns.FormattersUnsafeStringBuilder
The target UnsafeStringBuilder.
value
Type: SystemBoolean
The value to be formatted.

Implements

IFormatterTWrite(UnsafeStringBuilder, T)
See Also

Reference

BooleanFormatter Class
Write Overload
PostSharp.Patterns.Formatters Namespace

Other Resources

Conceptual: Implementing a Custom Formatter


BooleanFormatter Fields

The BooleanFormatter type exposes the following members.

Fields
Name | Description
Instance | The singleton instance of BooleanFormatter.
Top
See Also

Reference

BooleanFormatter Class
PostSharp.Patterns.Formatters Namespace


BooleanFormatter.Instance Field

BooleanFormatterInstance Field

The singleton instance of BooleanFormatter.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static readonly BooleanFormatter Instance

Field Value

Type: BooleanFormatter
See Also

Reference

BooleanFormatter Class
PostSharp.Patterns.Formatters Namespace


ByteFormatter Class

A formatter for Byte values.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.FormattersFormatter Byte
PostSharp.Patterns.FormattersByteFormatter

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ByteFormatter : Formatter<byte>

The ByteFormatter type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from FormatterT.)
Top
Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, Byte) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Top
Fields
Name | Description
Instance | The singleton instance of ByteFormatter.
Top
See Also

Reference

PostSharp.Patterns.Formatters Namespace


ByteFormatter Properties

The ByteFormatter type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from FormatterT.)
Top
See Also

Reference

ByteFormatter Class
PostSharp.Patterns.Formatters Namespace


ByteFormatter Methods

Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, Byte) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Top
See Also

Reference

ByteFormatter Class
PostSharp.Patterns.Formatters Namespace


ByteFormatter.Write Method

ByteFormatterWrite Method

Overload List
 | Name | Description
Public method | Write(UnsafeStringBuilder, Byte) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Top
See Also

Reference

ByteFormatter Class
PostSharp.Patterns.Formatters Namespace


ByteFormatter.Write Method (UnsafeStringBuilder, Byte)

ByteFormatterWrite Method (UnsafeStringBuilder, Byte)

Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant).

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void Write(
    UnsafeStringBuilder stringBuilder,
    byte value
)

Parameters

stringBuilder
Type: PostSharp.Patterns.FormattersUnsafeStringBuilder
The target UnsafeStringBuilder.
value
Type: SystemByte
The value to be formatted.

Implements

IFormatterTWrite(UnsafeStringBuilder, T)
See Also

Reference

ByteFormatter Class
Write Overload
PostSharp.Patterns.Formatters Namespace

Other Resources

Conceptual: Implementing a Custom Formatter


ByteFormatter Fields

The ByteFormatter type exposes the following members.

Fields
Name | Description
Instance | The singleton instance of ByteFormatter.
Top
See Also

Reference

ByteFormatter Class
PostSharp.Patterns.Formatters Namespace


ByteFormatter.Instance Field

ByteFormatterInstance Field

The singleton instance of ByteFormatter.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static readonly ByteFormatter Instance

Field Value

Type: ByteFormatter
See Also

Reference

ByteFormatter Class
PostSharp.Patterns.Formatters Namespace


CharFormatter Class

A formatter for Char values.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.FormattersFormatter Char
PostSharp.Patterns.FormattersCharFormatter

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class CharFormatter : Formatter<char>

The CharFormatter type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from FormatterT.)
Top
Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, Char) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Top
Fields
Name | Description
Instance | The singleton instance of CharFormatter.
Top
See Also

Reference

PostSharp.Patterns.Formatters Namespace


CharFormatter Properties

The CharFormatter type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from FormatterT.)
Top
See Also

Reference

CharFormatter Class
PostSharp.Patterns.Formatters Namespace


CharFormatter Methods

Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, Char) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Top
See Also

Reference

CharFormatter Class
PostSharp.Patterns.Formatters Namespace


CharFormatter.Write Method

CharFormatterWrite Method

Overload List
 | Name | Description
Public method | Write(UnsafeStringBuilder, Char) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Top
See Also

Reference

CharFormatter Class
PostSharp.Patterns.Formatters Namespace


CharFormatter.Write Method (UnsafeStringBuilder, Char)

CharFormatterWrite Method (UnsafeStringBuilder, Char)

Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant).

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void Write(
    UnsafeStringBuilder stringBuilder,
    char value
)

Parameters

stringBuilder
Type: PostSharp.Patterns.FormattersUnsafeStringBuilder
The target UnsafeStringBuilder.
value
Type: SystemChar
The value to be formatted.

Implements

IFormatterTWrite(UnsafeStringBuilder, T)
See Also

Reference

CharFormatter Class
Write Overload
PostSharp.Patterns.Formatters Namespace

Other Resources

Conceptual: Implementing a Custom Formatter


CharFormatter Fields

The CharFormatter type exposes the following members.

Fields
Name | Description
Instance | The singleton instance of CharFormatter.
Top
See Also

Reference

CharFormatter Class
PostSharp.Patterns.Formatters Namespace


CharFormatter.Instance Field

CharFormatterInstance Field

The singleton instance of CharFormatter.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static readonly CharFormatter Instance

Field Value

Type: CharFormatter
See Also

Reference

CharFormatter Class
PostSharp.Patterns.Formatters Namespace


DefaultFormatter(TRole, TValue) Class

DefaultFormatterTRole, TValue Class

The default formatter that formats objects by calling ToString.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.FormattersFormatter TValue
PostSharp.Patterns.FormattersDefaultFormatterTRole, TValue

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class DefaultFormatter<TRole, TValue> : Formatter<TValue>
where TRole : new(), FormattingRole

Type Parameters

TRole
TValue

The DefaultFormatterTRole, TValue type exposes the following members.

Constructors
 | Name | Description
Public method | DefaultFormatterTRole, TValue | Initializes a new DefaultFormatterTRole, TValue.
Top
Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Overrides FormatterTAttributes.)
Top
Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, TValue) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, Object).)
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Top
See Also

Reference

PostSharp.Patterns.Formatters Namespace


DefaultFormatter(TRole, TValue) Constructor

DefaultFormatterTRole, TValue Constructor

Initializes a new DefaultFormatterTRole, TValue.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public DefaultFormatter()
See Also

Reference

DefaultFormatterTRole, TValue Class
PostSharp.Patterns.Formatters Namespace


DefaultFormatter(TRole, TValue) Properties

DefaultFormatterTRole, TValue Properties

The DefaultFormatterTRole, TValue generic type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Overrides FormatterTAttributes.)
Top
See Also

Reference

DefaultFormatterTRole, TValue Class
PostSharp.Patterns.Formatters Namespace


DefaultFormatter(TRole, TValue).Attributes Property

DefaultFormatterTRole, TValueAttributes Property

Gets the formatter attributes.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override FormatterAttributes Attributes { get; }

Property Value

Type: FormatterAttributes

Implements

IFormatterAttributes
See Also

Reference

DefaultFormatterTRole, TValue Class
PostSharp.Patterns.Formatters Namespace


DefaultFormatter(TRole, TValue) Methods

DefaultFormatterTRole, TValue Methods

Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, TValue) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, Object).)
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Top
See Also

Reference

DefaultFormatterTRole, TValue Class
PostSharp.Patterns.Formatters Namespace


DefaultFormatter(TRole, TValue).Write Method

DefaultFormatterTRole, TValueWrite Method

Overload List
 | Name | Description
Public method | Write(UnsafeStringBuilder, TValue) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, Object).)
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Top
See Also

Reference

DefaultFormatterTRole, TValue Class
PostSharp.Patterns.Formatters Namespace


DefaultFormatter(TRole, TValue).Write Method (UnsafeStringBuilder, TValue)

DefaultFormatterTRole, TValueWrite Method (UnsafeStringBuilder, TValue)

Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant).

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void Write(
    UnsafeStringBuilder stringBuilder,
    TValue value
)

Parameters

stringBuilder
Type: PostSharp.Patterns.FormattersUnsafeStringBuilder
The target UnsafeStringBuilder.
value
Type: TValue
The value to be formatted.

Implements

IFormatterTWrite(UnsafeStringBuilder, T)
See Also

Reference

DefaultFormatterTRole, TValue Class
Write Overload
PostSharp.Patterns.Formatters Namespace


EnumFormatter Class

Efficient formatter for enums.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.FormattersEnumFormatter

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static class EnumFormatter

The EnumFormatter type exposes the following members.

Methods
Name | Description
GetStringT | Returns the string value of the given enum value.
Top
See Also

Reference

PostSharp.Patterns.Formatters Namespace


EnumFormatter Methods

The EnumFormatter type exposes the following members.

Methods
Name | Description
GetStringT | Returns the string value of the given enum value.
Top
See Also

Reference

EnumFormatter Class
PostSharp.Patterns.Formatters Namespace


EnumFormatter.GetString(T) Method

EnumFormatterGetStringT Method

Returns the string value of the given enum value.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static string GetString<T>(
    T value
)

Parameters

value
Type: T

Type Parameters

T

Return Value

Type: String
See Also

Reference

EnumFormatter Class
PostSharp.Patterns.Formatters Namespace


EnumFormatter(T) Class

EnumFormatterT Class

Efficient formatter for enums.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.FormattersFormatter T
PostSharp.Patterns.FormattersEnumFormatterT

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class EnumFormatter<T> : Formatter<T>

Type Parameters

T

The EnumFormatterT type exposes the following members.

Constructors
 | Name | Description
Public method | EnumFormatterT | Initializes a new instance of the EnumFormatterT class
Top
Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from FormatterT.)
Top
Methods
 | Name | Description
 | GetString | Returns the string value of the given enum value.
Public method | Write(UnsafeStringBuilder, T) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, Object).)
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Top
Fields
Name | Description
Instance | The singleton instance of EnumFormatterT.
Top
See Also

Reference

PostSharp.Patterns.Formatters Namespace


EnumFormatter(T) Constructor

EnumFormatterT Constructor

Initializes a new instance of the EnumFormatterT class

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public EnumFormatter()
See Also

Reference

EnumFormatterT Class
PostSharp.Patterns.Formatters Namespace


EnumFormatter(T) Properties

EnumFormatterT Properties

The EnumFormatterT generic type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from FormatterT.)
Top
See Also

Reference

EnumFormatterT Class
PostSharp.Patterns.Formatters Namespace


EnumFormatter(T) Methods

EnumFormatterT Methods

The EnumFormatterT generic type exposes the following members.

Methods
 | Name | Description
 | GetString | Returns the string value of the given enum value.
Public method | Write(UnsafeStringBuilder, T) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, Object).)
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Top
See Also

Reference

EnumFormatterT Class
PostSharp.Patterns.Formatters Namespace


EnumFormatter(T).GetString Method

EnumFormatterTGetString Method

Returns the string value of the given enum value.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static string GetString(
    T value
)

Parameters

value
Type: T

Return Value

Type: String
See Also

Reference

EnumFormatterT Class
PostSharp.Patterns.Formatters Namespace


EnumFormatter(T).Write Method

EnumFormatterTWrite Method

Overload List
 | Name | Description
Public method | Write(UnsafeStringBuilder, T) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, Object).)
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Top
See Also

Reference

EnumFormatterT Class
PostSharp.Patterns.Formatters Namespace


EnumFormatter(T).Write Method (UnsafeStringBuilder, T)

EnumFormatterTWrite Method (UnsafeStringBuilder, T)

Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant).

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void Write(
    UnsafeStringBuilder stringBuilder,
    T value
)

Parameters

stringBuilder
Type: PostSharp.Patterns.FormattersUnsafeStringBuilder
The target UnsafeStringBuilder.
value
Type: T
The value to be formatted.

Implements

IFormatterTWrite(UnsafeStringBuilder, T)
See Also

Reference

EnumFormatterT Class
Write Overload
PostSharp.Patterns.Formatters Namespace


EnumFormatter(T) Fields

EnumFormatterT Fields

The EnumFormatterT generic type exposes the following members.

Fields
Name | Description
Instance | The singleton instance of EnumFormatterT.
Top
See Also

Reference

EnumFormatterT Class
PostSharp.Patterns.Formatters Namespace


EnumFormatter(T).Instance Field

EnumFormatterTInstance Field

The singleton instance of EnumFormatterT.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static readonly EnumFormatter<T> Instance

Field Value

Type: EnumFormatter T
See Also

Reference

EnumFormatterT Class
PostSharp.Patterns.Formatters Namespace


Formatter(T) Class

FormatterT Class

Base implementation of the IFormatterT interface.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.FormattersFormatterT
More...

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class Formatter<T> : IFormatter<T>,
    IFormatter

Type Parameters

T

The FormatterT type exposes the following members.

Constructors
 | Name | Description
Protected method | FormatterT | Initializes a new instance of the FormatterT class
Top
Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes.
Top
Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant).
Public method | Write(UnsafeStringBuilder, T) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant).
Top
See Also

Reference

PostSharp.Patterns.Formatters Namespace

Other Resources

Conceptual: Customizing Cache Keys
Conceptual: Implementing a Custom Formatter
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.FormattersFormatterT
PostSharp.Patterns.Diagnostics.FormattersCollectionFormatterTKind, T
PostSharp.Patterns.Diagnostics.FormattersHiddenFormatterT
PostSharp.Patterns.Diagnostics.FormattersLazyFormatterTKind, T
PostSharp.Patterns.Diagnostics.FormattersOutFormatterT
PostSharp.Patterns.FormattersBooleanFormatter
PostSharp.Patterns.FormattersByteFormatter
PostSharp.Patterns.FormattersCharFormatter
PostSharp.Patterns.FormattersDefaultFormatterTRole, TValue
PostSharp.Patterns.FormattersEnumFormatterT
PostSharp.Patterns.FormattersInt16Formatter
PostSharp.Patterns.FormattersInt32Formatter
PostSharp.Patterns.FormattersInt64Formatter
PostSharp.Patterns.FormattersMethodFormatter
PostSharp.Patterns.FormattersSByteFormatter
PostSharp.Patterns.FormattersStringFormatter
PostSharp.Patterns.FormattersTypeFormatter
PostSharp.Patterns.FormattersUInt16Formatter
PostSharp.Patterns.FormattersUInt32Formatter
PostSharp.Patterns.FormattersUInt64Formatter


Formatter(T) Constructor

FormatterT Constructor

Initializes a new instance of the FormatterT class

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected Formatter()
See Also

Reference

FormatterT Class
PostSharp.Patterns.Formatters Namespace


Formatter(T) Properties

FormatterT Properties

The FormatterT generic type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes.
Top
See Also

Reference

FormatterT Class
PostSharp.Patterns.Formatters Namespace


Formatter(T).Attributes Property

FormatterTAttributes Property

Gets the formatter attributes.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual FormatterAttributes Attributes { get; }

Property Value

Type: FormatterAttributes

Implements

IFormatterAttributes
See Also

Reference

FormatterT Class
PostSharp.Patterns.Formatters Namespace


Formatter(T) Methods

FormatterT Methods

Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant).
Public method | Write(UnsafeStringBuilder, T) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant).
Top
See Also

Reference

FormatterT Class
PostSharp.Patterns.Formatters Namespace


Formatter(T).Write Method

FormatterTWrite Method

Overload List
 | Name | Description
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant).
Public method | Write(UnsafeStringBuilder, T) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant).
Top
See Also

Reference

FormatterT Class
PostSharp.Patterns.Formatters Namespace


Formatter(T).Write Method (UnsafeStringBuilder, Object)

FormatterTWrite Method (UnsafeStringBuilder, Object)

Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant).

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Write(
    UnsafeStringBuilder stringBuilder,
    Object value
)

Parameters

stringBuilder
Type: PostSharp.Patterns.FormattersUnsafeStringBuilder
The target UnsafeStringBuilder.
value
Type: SystemObject
The value to be formatted.

Implements

IFormatterWrite(UnsafeStringBuilder, Object)
See Also

Reference

FormatterT Class
Write Overload
PostSharp.Patterns.Formatters Namespace


Formatter(T).Write Method (UnsafeStringBuilder, T)

FormatterTWrite Method (UnsafeStringBuilder, T)

Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant).

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract void Write(
    UnsafeStringBuilder stringBuilder,
    T value
)

Parameters

stringBuilder
Type: PostSharp.Patterns.FormattersUnsafeStringBuilder
The target UnsafeStringBuilder.
value
Type: T
The value to be formatted.

Implements

IFormatterTWrite(UnsafeStringBuilder, T)
See Also

Reference

FormatterT Class
Write Overload
PostSharp.Patterns.Formatters Namespace

Other Resources

Conceptual: Implementing a Custom Formatter


FormatterAttributes Enumeration

Attributes of an IFormatter.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[FlagsAttribute]
public enum FormatterAttributes
Members
Member name | Value | Description
None | 0 | Default.
Normal | 1 | A normal (custom) formatter.
Dynamic | 2 | A dynamic formatter, which resolves to another formatter according to the type of the value, not the type of the location.
Converter | 4 | A converter.
Default | 8 | A default formatter, using ToString.
See Also

Reference

PostSharp.Patterns.Formatters Namespace


FormatterRepository(TRole) Class

FormatterRepositoryTRole Class

Allows to get and register formatters for a specific type.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.FormattersFormatterRepositoryTRole
PostSharp.Patterns.CachingCachingServicesFormatters
PostSharp.Patterns.DiagnosticsLoggingServicesFormatters

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class FormatterRepository<TRole>
where TRole : new(), FormattingRole

Type Parameters

TRole
Marker type used to differentiate FormattingServices for different purposes (e.g. caching or logging).

The FormatterRepositoryTRole type exposes the following members.

Constructors
 | Name | Description
Protected method | FormatterRepositoryTRole | Initializes a new FormatterRepositoryTRole.
Top
Methods
Name | Description
Get(Type) | Returns a formatter for a specific object. This overload should be used when the type of the object is not known at build time because the type is non-sealed.
GetT | Returns the formatter for the type T.
Register(Type, IFormatter) | Registers the given formatter for the given targetType.
Register(Type, Type) | Registers the given formatterType for the given targetType.
RegisterT(IFormatterT) | Registers the given formatter for the type T.
Reset | Clears formatters, but doesn't reset registrations.
SetDynamicT | Requests that formatters for parameters of a given type will be resolved according to the type of the parameter value, not to the type of the parameter itself.
Top
See Also

Reference

PostSharp.Patterns.Formatters Namespace


FormatterRepository(TRole) Constructor

FormatterRepositoryTRole Constructor

Initializes a new FormatterRepositoryTRole.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected FormatterRepository()
See Also

Reference

FormatterRepositoryTRole Class
PostSharp.Patterns.Formatters Namespace


FormatterRepository(TRole) Methods

FormatterRepositoryTRole Methods

The FormatterRepositoryTRole generic type exposes the following members.

Methods
Name | Description
Get(Type) | Returns a formatter for a specific object. This overload should be used when the type of the object is not known at build time because the type is non-sealed.
GetT | Returns the formatter for the type T.
Register(Type, IFormatter) | Registers the given formatter for the given targetType.
Register(Type, Type) | Registers the given formatterType for the given targetType.
RegisterT(IFormatterT) | Registers the given formatter for the type T.
Reset | Clears formatters, but doesn't reset registrations.
SetDynamicT | Requests that formatters for parameters of a given type will be resolved according to the type of the parameter value, not to the type of the parameter itself.
Top
See Also

Reference

FormatterRepositoryTRole Class
PostSharp.Patterns.Formatters Namespace


FormatterRepository(TRole).Get Method

FormatterRepositoryTRoleGet Method

Overload List
Name | Description
GetT | Returns the formatter for the type T.
Get(Type) | Returns a formatter for a specific object. This overload should be used when the type of the object is not known at build time because the type is non-sealed.
Top
See Also

Reference

FormatterRepositoryTRole Class
PostSharp.Patterns.Formatters Namespace


FormatterRepository(TRole).Get(T) Method

FormatterRepositoryTRoleGetT Method

Returns the formatter for the type T.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static IFormatter<T> Get<T>()

Type Parameters

T

Return Value

Type: IFormatter T
See Also

Reference

FormatterRepositoryTRole Class
Get Overload
PostSharp.Patterns.Formatters Namespace


FormatterRepository(TRole).Get Method (Type)

FormatterRepositoryTRoleGet Method (Type)

Returns a formatter for a specific object. This overload should be used when the type of the object is not known at build time because the type is non-sealed.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static IFormatter Get(
    Type objectType
)

Parameters

objectType
Type: SystemType
Object type.

Return Value

Type: IFormatter
The formatter the object objectType.
See Also

Reference

FormatterRepositoryTRole Class
Get Overload
PostSharp.Patterns.Formatters Namespace


FormatterRepository(TRole).Register Method

FormatterRepositoryTRoleRegister Method

Overload List
Name | Description
RegisterT(IFormatterT) | Registers the given formatter for the type T.
Register(Type, IFormatter) | Registers the given formatter for the given targetType.
Register(Type, Type) | Registers the given formatterType for the given targetType.
Top
See Also

Reference

FormatterRepositoryTRole Class
PostSharp.Patterns.Formatters Namespace


FormatterRepository(TRole).Register(T) Method (IFormatter(T))

FormatterRepositoryTRoleRegisterT Method (IFormatterT)

Registers the given formatter for the type T.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void Register<T>(
    IFormatter<T> formatter
)

Parameters

formatter
Type: PostSharp.Patterns.FormattersIFormatter T

Type Parameters

T
See Also

Reference

FormatterRepositoryTRole Class
Register Overload
PostSharp.Patterns.Formatters Namespace


FormatterRepository(TRole).Register Method (Type, IFormatter)

FormatterRepositoryTRoleRegister Method (Type, IFormatter)

Registers the given formatter for the given targetType.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void Register(
    Type targetType,
    IFormatter formatter
)

Parameters

targetType
Type: SystemType
formatter
Type: PostSharp.Patterns.FormattersIFormatter
Remarks
The formatter will work for the given target type, and also for any type that inherits/implements the target type.
See Also

Reference

FormatterRepositoryTRole Class
Register Overload
PostSharp.Patterns.Formatters Namespace


FormatterRepository(TRole).Register Method (Type, Type)

FormatterRepositoryTRoleRegister Method (Type, Type)

Registers the given formatterType for the given targetType.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void Register(
    Type targetType,
    Type formatterType
)

Parameters

targetType
Type: SystemType
formatterType
Type: SystemType
Remarks

Instances of formatterType are going to be created using a parameterless constructor.

When targetType is generic, the registration applies to its generic instantiations (and types that inherit/implement them).

Examples
If you register a formatter as FormattingServices.RegisterFormatter(typeof(IDictionary<,>), typeof(MyDictionaryFormatter<,>) and then log a parameter of type Dictionary<int, string>, the formatter for that parameter will be created by calling new MyDictionaryFormatter<int, string>.
See Also

Reference

FormatterRepositoryTRole Class
Register Overload
PostSharp.Patterns.Formatters Namespace


FormatterRepository(TRole).Reset Method

FormatterRepositoryTRoleReset Method

Clears formatters, but doesn't reset registrations.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void Reset()
Remarks
Used by unit tests to clear standard formatters.
See Also

Reference

FormatterRepositoryTRole Class
PostSharp.Patterns.Formatters Namespace


FormatterRepository(TRole).SetDynamic(T) Method

FormatterRepositoryTRoleSetDynamicT Method

Requests that formatters for parameters of a given type will be resolved according to the type of the parameter value, not to the type of the parameter itself.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void SetDynamic<T>()
where T : class

Type Parameters

T
Type of the parameter.
See Also

Reference

FormatterRepositoryTRole Class
PostSharp.Patterns.Formatters Namespace


FormattingRole Class

Base for kind marker types for FormatterRepositoryTRole.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.FormattersFormattingRole
PostSharp.Patterns.Caching.FormattersCachingFormattingRole
PostSharp.Patterns.Diagnostics.FormattersLoggingFormattingRole

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class FormattingRole

The FormattingRole type exposes the following members.

Constructors
 | Name | Description
Protected method | FormattingRole | Initializes a new FormattingRole.
Top
Properties
 | Name | Description
Public property | LoggingRole | Gets the logging role name (see LoggingRoles).
Public property | Name | Gets the name of the FormattingRole.
Top
Remarks
Types derived from this type are not meant to have members or instances, they're used only as markers.
See Also

Reference

PostSharp.Patterns.Formatters Namespace


FormattingRole Constructor

Initializes a new FormattingRole.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected FormattingRole()
See Also

Reference

FormattingRole Class
PostSharp.Patterns.Formatters Namespace


FormattingRole Properties

The FormattingRole type exposes the following members.

Properties
 | Name | Description
Public property | LoggingRole | Gets the logging role name (see LoggingRoles).
Public property | Name | Gets the name of the FormattingRole.
Top
See Also

Reference

FormattingRole Class
PostSharp.Patterns.Formatters Namespace


FormattingRole.LoggingRole Property

FormattingRoleLoggingRole Property

Gets the logging role name (see LoggingRoles).

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract string LoggingRole { get; }

Property Value

Type: String
See Also

Reference

FormattingRole Class
PostSharp.Patterns.Formatters Namespace


FormattingRole.Name Property

FormattingRoleName Property

Gets the name of the FormattingRole.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract string Name { get; }

Property Value

Type: String
See Also

Reference

FormattingRole Class
PostSharp.Patterns.Formatters Namespace


IFormattable Interface

Exposes a Format(UnsafeStringBuilder, FormattingRole) method, which allows an object to format itself into an UnsafeStringBuilder. Logging and caching components rely on the IFormattable interface.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IFormattable

The IFormattable type exposes the following members.

Methods
 | Name | Description
Public method | Format | Appends a description of the current object to a given UnsafeStringBuilder.
Top
See Also

Reference

PostSharp.Patterns.Formatters Namespace

Other Resources

Conceptual: Customizing Cache Keys
Conceptual: Implementing a Custom Formatter


IFormattable Methods

The IFormattable type exposes the following members.

Methods
 | Name | Description
Public method | Format | Appends a description of the current object to a given UnsafeStringBuilder.
Top
See Also

Reference

IFormattable Interface
PostSharp.Patterns.Formatters Namespace


IFormattable.Format Method

IFormattableFormat Method

Appends a description of the current object to a given UnsafeStringBuilder.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void Format(
    UnsafeStringBuilder stringBuilder,
    FormattingRole role
)

Parameters

stringBuilder
Type: PostSharp.Patterns.FormattersUnsafeStringBuilder
The UnsafeStringBuilder to which the object description should be written.
role
Type: PostSharp.Patterns.FormattersFormattingRole
An object describing in which context the object is being formatted (e.g. caching or logging).
See Also

Reference

IFormattable Interface
PostSharp.Patterns.Formatters Namespace

Other Resources

Conceptual: Implementing a Custom Formatter


IFormatter Interface

Appends the description of an object into an UnsafeStringBuilder. Weakly-typed variant of IFormatterT.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IFormatter

The IFormatter type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes.
Top
Methods
 | Name | Description
Public method | Write | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant).
Top
See Also

Reference

PostSharp.Patterns.Formatters Namespace


IFormatter Properties

The IFormatter type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes.
Top
See Also

Reference

IFormatter Interface
PostSharp.Patterns.Formatters Namespace


IFormatter.Attributes Property

IFormatterAttributes Property

Gets the formatter attributes.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
FormatterAttributes Attributes { get; }

Property Value

Type: FormatterAttributes
See Also

Reference

IFormatter Interface
PostSharp.Patterns.Formatters Namespace


IFormatter Methods

The IFormatter type exposes the following members.

Methods
 | Name | Description
Public method | Write | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant).
Top
See Also

Reference

IFormatter Interface
PostSharp.Patterns.Formatters Namespace


IFormatter.Write Method

IFormatterWrite Method

Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant).

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void Write(
    UnsafeStringBuilder stringBuilder,
    Object value
)

Parameters

stringBuilder
Type: PostSharp.Patterns.FormattersUnsafeStringBuilder
The target UnsafeStringBuilder.
value
Type: SystemObject
The value to be formatted.
See Also

Reference

IFormatter Interface
PostSharp.Patterns.Formatters Namespace


IFormatter(T) Interface

IFormatterT Interface

Appends the description of an object into an UnsafeStringBuilder. Strongly-typed variant of IFormatter.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IFormatter<in T> : IFormatter

Type Parameters

T
Type of values that can be formatted.

The IFormatterT type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from IFormatter.)
Top
Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from IFormatter.)
Public method | Write(UnsafeStringBuilder, T) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant).
Top
See Also

Reference

PostSharp.Patterns.Formatters Namespace


IFormatter(T) Properties

IFormatterT Properties

The IFormatterT generic type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from IFormatter.)
Top
See Also

Reference

IFormatterT Interface
PostSharp.Patterns.Formatters Namespace


IFormatter(T) Methods

IFormatterT Methods

Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from IFormatter.)
Public method | Write(UnsafeStringBuilder, T) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant).
Top
See Also

Reference

IFormatterT Interface
PostSharp.Patterns.Formatters Namespace


IFormatter(T).Write Method

IFormatterTWrite Method

Overload List
 | Name | Description
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from IFormatter.)
Public method | Write(UnsafeStringBuilder, T) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant).
Top
See Also

Reference

IFormatterT Interface
PostSharp.Patterns.Formatters Namespace


IFormatter(T).Write Method (UnsafeStringBuilder, T)

IFormatterTWrite Method (UnsafeStringBuilder, T)

Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant).

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void Write(
    UnsafeStringBuilder stringBuilder,
    T value
)

Parameters

stringBuilder
Type: PostSharp.Patterns.FormattersUnsafeStringBuilder
The target UnsafeStringBuilder.
value
Type: T
The value to be formatted.
See Also

Reference

IFormatterT Interface
Write Overload
PostSharp.Patterns.Formatters Namespace


Int16Formatter Class

Efficient formatter for Int16.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.FormattersFormatter Int16
PostSharp.Patterns.FormattersInt16Formatter

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class Int16Formatter : Formatter<short>

The Int16Formatter type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from FormatterT.)
Top
Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Public method | Write(UnsafeStringBuilder, Int16) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Top
Fields
Name | Description
Instance | The singleton instance of Int16Formatter.
Top
See Also

Reference

PostSharp.Patterns.Formatters Namespace


Int16Formatter Properties

The Int16Formatter type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from FormatterT.)
Top
See Also

Reference

Int16Formatter Class
PostSharp.Patterns.Formatters Namespace


Int16Formatter Methods

Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Public method | Write(UnsafeStringBuilder, Int16) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Top
See Also

Reference

Int16Formatter Class
PostSharp.Patterns.Formatters Namespace


Int16Formatter.Write Method

Int16FormatterWrite Method

Overload List
 | Name | Description
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Public method | Write(UnsafeStringBuilder, Int16) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Top
See Also

Reference

Int16Formatter Class
PostSharp.Patterns.Formatters Namespace


Int16Formatter.Write Method (UnsafeStringBuilder, Int16)

Int16FormatterWrite Method (UnsafeStringBuilder, Int16)

Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant).

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void Write(
    UnsafeStringBuilder stringBuilder,
    short value
)

Parameters

stringBuilder
Type: PostSharp.Patterns.FormattersUnsafeStringBuilder
The target UnsafeStringBuilder.
value
Type: SystemInt16
The value to be formatted.

Implements

IFormatterTWrite(UnsafeStringBuilder, T)
See Also

Reference

Int16Formatter Class
Write Overload
PostSharp.Patterns.Formatters Namespace

Other Resources

Conceptual: Implementing a Custom Formatter


Int16Formatter Fields

The Int16Formatter type exposes the following members.

Fields
Name | Description
Instance | The singleton instance of Int16Formatter.
Top
See Also

Reference

Int16Formatter Class
PostSharp.Patterns.Formatters Namespace


Int16Formatter.Instance Field

Int16FormatterInstance Field

The singleton instance of Int16Formatter.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static readonly Int16Formatter Instance

Field Value

Type: Int16Formatter
See Also

Reference

Int16Formatter Class
PostSharp.Patterns.Formatters Namespace


Int32Formatter Class

Efficient formatter for Int32.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.FormattersFormatter Int32
PostSharp.Patterns.FormattersInt32Formatter

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class Int32Formatter : Formatter<int>

The Int32Formatter type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from FormatterT.)
Top
Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Public method | Write(UnsafeStringBuilder, Int32) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Top
Fields
Name | Description
Instance | The singleton instance of Int32Formatter.
Top
See Also

Reference

PostSharp.Patterns.Formatters Namespace


Int32Formatter Properties

The Int32Formatter type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from FormatterT.)
Top
See Also

Reference

Int32Formatter Class
PostSharp.Patterns.Formatters Namespace


Int32Formatter Methods

Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Public method | Write(UnsafeStringBuilder, Int32) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Top
See Also

Reference

Int32Formatter Class
PostSharp.Patterns.Formatters Namespace


Int32Formatter.Write Method

Int32FormatterWrite Method

Overload List
 | Name | Description
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Public method | Write(UnsafeStringBuilder, Int32) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Top
See Also

Reference

Int32Formatter Class
PostSharp.Patterns.Formatters Namespace


Int32Formatter.Write Method (UnsafeStringBuilder, Int32)

Int32FormatterWrite Method (UnsafeStringBuilder, Int32)

Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant).

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void Write(
    UnsafeStringBuilder stringBuilder,
    int value
)

Parameters

stringBuilder
Type: PostSharp.Patterns.FormattersUnsafeStringBuilder
The target UnsafeStringBuilder.
value
Type: SystemInt32
The value to be formatted.

Implements

IFormatterTWrite(UnsafeStringBuilder, T)
See Also

Reference

Int32Formatter Class
Write Overload
PostSharp.Patterns.Formatters Namespace

Other Resources

Conceptual: Implementing a Custom Formatter


Int32Formatter Fields

The Int32Formatter type exposes the following members.

Fields
Name | Description
Instance | The singleton instance of Int32Formatter.
Top
See Also

Reference

Int32Formatter Class
PostSharp.Patterns.Formatters Namespace


Int32Formatter.Instance Field

Int32FormatterInstance Field

The singleton instance of Int32Formatter.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static readonly Int32Formatter Instance

Field Value

Type: Int32Formatter
See Also

Reference

Int32Formatter Class
PostSharp.Patterns.Formatters Namespace


Int64Formatter Class

Efficient formatter for Int64.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.FormattersFormatter Int64
PostSharp.Patterns.FormattersInt64Formatter

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class Int64Formatter : Formatter<long>

The Int64Formatter type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from FormatterT.)
Top
Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Public method | Write(UnsafeStringBuilder, Int64) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Top
Fields
Name | Description
Instance | The singleton instance of Int64Formatter.
Top
See Also

Reference

PostSharp.Patterns.Formatters Namespace


Int64Formatter Properties

The Int64Formatter type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from FormatterT.)
Top
See Also

Reference

Int64Formatter Class
PostSharp.Patterns.Formatters Namespace


Int64Formatter Methods

Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Public method | Write(UnsafeStringBuilder, Int64) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Top
See Also

Reference

Int64Formatter Class
PostSharp.Patterns.Formatters Namespace


Int64Formatter.Write Method

Int64FormatterWrite Method

Overload List
 | Name | Description
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Public method | Write(UnsafeStringBuilder, Int64) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Top
See Also

Reference

Int64Formatter Class
PostSharp.Patterns.Formatters Namespace


Int64Formatter.Write Method (UnsafeStringBuilder, Int64)

Int64FormatterWrite Method (UnsafeStringBuilder, Int64)

Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant).

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void Write(
    UnsafeStringBuilder stringBuilder,
    long value
)

Parameters

stringBuilder
Type: PostSharp.Patterns.FormattersUnsafeStringBuilder
The target UnsafeStringBuilder.
value
Type: SystemInt64
The value to be formatted.

Implements

IFormatterTWrite(UnsafeStringBuilder, T)
See Also

Reference

Int64Formatter Class
Write Overload
PostSharp.Patterns.Formatters Namespace

Other Resources

Conceptual: Implementing a Custom Formatter


Int64Formatter Fields

The Int64Formatter type exposes the following members.

Fields
Name | Description
Instance | The singleton instance of Int64Formatter.
Top
See Also

Reference

Int64Formatter Class
PostSharp.Patterns.Formatters Namespace


Int64Formatter.Instance Field

Int64FormatterInstance Field

The singleton instance of Int64Formatter.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static readonly Int64Formatter Instance

Field Value

Type: Int64Formatter
See Also

Reference

Int64Formatter Class
PostSharp.Patterns.Formatters Namespace


MethodFormatter Class

A formatter for MethodBase values.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.FormattersFormatter MethodBase
PostSharp.Patterns.FormattersMethodFormatter

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class MethodFormatter : Formatter<MethodBase>

The MethodFormatter type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from FormatterT.)
Top
Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Public method | Write(UnsafeStringBuilder, MethodBase) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Top
Fields
Name | Description
Instance | The singleton instance of MethodFormatter.
Top
See Also

Reference

PostSharp.Patterns.Formatters Namespace


MethodFormatter Properties

The MethodFormatter type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from FormatterT.)
Top
See Also

Reference

MethodFormatter Class
PostSharp.Patterns.Formatters Namespace


MethodFormatter Methods

Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Public method | Write(UnsafeStringBuilder, MethodBase) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Top
See Also

Reference

MethodFormatter Class
PostSharp.Patterns.Formatters Namespace


MethodFormatter.Write Method

MethodFormatterWrite Method

Overload List
 | Name | Description
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Public method | Write(UnsafeStringBuilder, MethodBase) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Top
See Also

Reference

MethodFormatter Class
PostSharp.Patterns.Formatters Namespace


MethodFormatter.Write Method (UnsafeStringBuilder, MethodBase)

MethodFormatterWrite Method (UnsafeStringBuilder, MethodBase)

Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant).

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void Write(
    UnsafeStringBuilder stringBuilder,
    MethodBase value
)

Parameters

stringBuilder
Type: PostSharp.Patterns.FormattersUnsafeStringBuilder
The target UnsafeStringBuilder.
value
Type: System.ReflectionMethodBase
The value to be formatted.

Implements

IFormatterTWrite(UnsafeStringBuilder, T)
See Also

Reference

MethodFormatter Class
Write Overload
PostSharp.Patterns.Formatters Namespace

Other Resources

Conceptual: Implementing a Custom Formatter


MethodFormatter Fields

The MethodFormatter type exposes the following members.

Fields
Name | Description
Instance | The singleton instance of MethodFormatter.
Top
See Also

Reference

MethodFormatter Class
PostSharp.Patterns.Formatters Namespace


MethodFormatter.Instance Field

MethodFormatterInstance Field

The singleton instance of MethodFormatter.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static readonly MethodFormatter Instance

Field Value

Type: MethodFormatter
See Also

Reference

MethodFormatter Class
PostSharp.Patterns.Formatters Namespace


SByteFormatter Class

Efficient formatter for SByte.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.FormattersFormatter SByte
PostSharp.Patterns.FormattersSByteFormatter

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class SByteFormatter : Formatter<sbyte>

The SByteFormatter type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from FormatterT.)
Top
Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Public method | Write(UnsafeStringBuilder, SByte) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Top
Fields
Name | Description
Instance | The singleton instance of SByteFormatter.
Top
See Also

Reference

PostSharp.Patterns.Formatters Namespace


SByteFormatter Properties

The SByteFormatter type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from FormatterT.)
Top
See Also

Reference

SByteFormatter Class
PostSharp.Patterns.Formatters Namespace


SByteFormatter Methods

Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Public method | Write(UnsafeStringBuilder, SByte) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Top
See Also

Reference

SByteFormatter Class
PostSharp.Patterns.Formatters Namespace


SByteFormatter.Write Method

SByteFormatterWrite Method

Overload List
 | Name | Description
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Public method | Write(UnsafeStringBuilder, SByte) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Top
See Also

Reference

SByteFormatter Class
PostSharp.Patterns.Formatters Namespace


SByteFormatter.Write Method (UnsafeStringBuilder, SByte)

SByteFormatterWrite Method (UnsafeStringBuilder, SByte)

Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant).

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void Write(
    UnsafeStringBuilder stringBuilder,
    sbyte value
)

Parameters

stringBuilder
Type: PostSharp.Patterns.FormattersUnsafeStringBuilder
The target UnsafeStringBuilder.
value
Type: SystemSByte
The value to be formatted.

Implements

IFormatterTWrite(UnsafeStringBuilder, T)
See Also

Reference

SByteFormatter Class
Write Overload
PostSharp.Patterns.Formatters Namespace

Other Resources

Conceptual: Implementing a Custom Formatter


SByteFormatter Fields

The SByteFormatter type exposes the following members.

Fields
Name | Description
Instance | The singleton instance of SByteFormatter.
Top
See Also

Reference

SByteFormatter Class
PostSharp.Patterns.Formatters Namespace


SByteFormatter.Instance Field

SByteFormatterInstance Field

The singleton instance of SByteFormatter.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static readonly SByteFormatter Instance

Field Value

Type: SByteFormatter
See Also

Reference

SByteFormatter Class
PostSharp.Patterns.Formatters Namespace


StringFormatter Class

A formatter for String values.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.FormattersFormatter String
PostSharp.Patterns.FormattersStringFormatter

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class StringFormatter : Formatter<string>

The StringFormatter type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from FormatterT.)
Top
Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Public method | Write(UnsafeStringBuilder, String) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Top
Fields
Name | Description
Instance | The singleton instance of StringFormatter.
Top
See Also

Reference

PostSharp.Patterns.Formatters Namespace


StringFormatter Properties

The StringFormatter type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from FormatterT.)
Top
See Also

Reference

StringFormatter Class
PostSharp.Patterns.Formatters Namespace


StringFormatter Methods

Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Public method | Write(UnsafeStringBuilder, String) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Top
See Also

Reference

StringFormatter Class
PostSharp.Patterns.Formatters Namespace


StringFormatter.Write Method

StringFormatterWrite Method

Overload List
 | Name | Description
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Public method | Write(UnsafeStringBuilder, String) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Top
See Also

Reference

StringFormatter Class
PostSharp.Patterns.Formatters Namespace


StringFormatter.Write Method (UnsafeStringBuilder, String)

StringFormatterWrite Method (UnsafeStringBuilder, String)

Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant).

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void Write(
    UnsafeStringBuilder stringBuilder,
    string value
)

Parameters

stringBuilder
Type: PostSharp.Patterns.FormattersUnsafeStringBuilder
The target UnsafeStringBuilder.
value
Type: SystemString
The value to be formatted.

Implements

IFormatterTWrite(UnsafeStringBuilder, T)
See Also

Reference

StringFormatter Class
Write Overload
PostSharp.Patterns.Formatters Namespace

Other Resources

Conceptual: Implementing a Custom Formatter


StringFormatter Fields

The StringFormatter type exposes the following members.

Fields
Name | Description
Instance | The singleton instance of StringFormatter.
Top
See Also

Reference

StringFormatter Class
PostSharp.Patterns.Formatters Namespace


StringFormatter.Instance Field

StringFormatterInstance Field

The singleton instance of StringFormatter.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static readonly StringFormatter Instance

Field Value

Type: StringFormatter
See Also

Reference

StringFormatter Class
PostSharp.Patterns.Formatters Namespace


TypeFormatter Class

A FormatterT for Type values.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.FormattersFormatter Type
PostSharp.Patterns.FormattersTypeFormatter

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class TypeFormatter : Formatter<Type>

The TypeFormatter type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from FormatterT.)
Top
Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Public method | Write(UnsafeStringBuilder, Type) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Top
Fields
Name | Description
Instance | The singleton instance of TypeFormatter.
Top
See Also

Reference

PostSharp.Patterns.Formatters Namespace


TypeFormatter Properties

The TypeFormatter type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from FormatterT.)
Top
See Also

Reference

TypeFormatter Class
PostSharp.Patterns.Formatters Namespace


TypeFormatter Methods

Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Public method | Write(UnsafeStringBuilder, Type) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Top
See Also

Reference

TypeFormatter Class
PostSharp.Patterns.Formatters Namespace


TypeFormatter.Write Method

TypeFormatterWrite Method

Overload List
 | Name | Description
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Public method | Write(UnsafeStringBuilder, Type) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Top
See Also

Reference

TypeFormatter Class
PostSharp.Patterns.Formatters Namespace


TypeFormatter.Write Method (UnsafeStringBuilder, Type)

TypeFormatterWrite Method (UnsafeStringBuilder, Type)

Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant).

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void Write(
    UnsafeStringBuilder stringBuilder,
    Type value
)

Parameters

stringBuilder
Type: PostSharp.Patterns.FormattersUnsafeStringBuilder
The target UnsafeStringBuilder.
value
Type: SystemType
The value to be formatted.

Implements

IFormatterTWrite(UnsafeStringBuilder, T)
See Also

Reference

TypeFormatter Class
Write Overload
PostSharp.Patterns.Formatters Namespace

Other Resources

Conceptual: Implementing a Custom Formatter


TypeFormatter Fields

The TypeFormatter type exposes the following members.

Fields
Name | Description
Instance | The singleton instance of TypeFormatter.
Top
See Also

Reference

TypeFormatter Class
PostSharp.Patterns.Formatters Namespace


TypeFormatter.Instance Field

TypeFormatterInstance Field

The singleton instance of TypeFormatter.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static readonly TypeFormatter Instance

Field Value

Type: TypeFormatter
See Also

Reference

TypeFormatter Class
PostSharp.Patterns.Formatters Namespace


UInt16Formatter Class

A formatter for UInt16 values.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.FormattersFormatter UInt16
PostSharp.Patterns.FormattersUInt16Formatter

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class UInt16Formatter : Formatter<ushort>

The UInt16Formatter type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from FormatterT.)
Top
Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Public method | Write(UnsafeStringBuilder, UInt16) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Top
Fields
Name | Description
Instance | The singleton instance of UInt16Formatter.
Top
See Also

Reference

PostSharp.Patterns.Formatters Namespace


UInt16Formatter Properties

The UInt16Formatter type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from FormatterT.)
Top
See Also

Reference

UInt16Formatter Class
PostSharp.Patterns.Formatters Namespace


UInt16Formatter Methods

Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Public method | Write(UnsafeStringBuilder, UInt16) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Top
See Also

Reference

UInt16Formatter Class
PostSharp.Patterns.Formatters Namespace


UInt16Formatter.Write Method

UInt16FormatterWrite Method

Overload List
 | Name | Description
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Public method | Write(UnsafeStringBuilder, UInt16) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Top
See Also

Reference

UInt16Formatter Class
PostSharp.Patterns.Formatters Namespace


UInt16Formatter.Write Method (UnsafeStringBuilder, UInt16)

UInt16FormatterWrite Method (UnsafeStringBuilder, UInt16)

Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant).

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void Write(
    UnsafeStringBuilder stringBuilder,
    ushort value
)

Parameters

stringBuilder
Type: PostSharp.Patterns.FormattersUnsafeStringBuilder
The target UnsafeStringBuilder.
value
Type: SystemUInt16
The value to be formatted.

Implements

IFormatterTWrite(UnsafeStringBuilder, T)
See Also

Reference

UInt16Formatter Class
Write Overload
PostSharp.Patterns.Formatters Namespace

Other Resources

Conceptual: Implementing a Custom Formatter


UInt16Formatter Fields

The UInt16Formatter type exposes the following members.

Fields
Name | Description
Instance | The singleton instance of UInt16Formatter.
Top
See Also

Reference

UInt16Formatter Class
PostSharp.Patterns.Formatters Namespace


UInt16Formatter.Instance Field

UInt16FormatterInstance Field

The singleton instance of UInt16Formatter.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static readonly UInt16Formatter Instance

Field Value

Type: UInt16Formatter
See Also

Reference

UInt16Formatter Class
PostSharp.Patterns.Formatters Namespace


UInt32Formatter Class

A formatter for UInt32 values.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.FormattersFormatter UInt32
PostSharp.Patterns.FormattersUInt32Formatter

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class UInt32Formatter : Formatter<uint>

The UInt32Formatter type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from FormatterT.)
Top
Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Public method | Write(UnsafeStringBuilder, UInt32) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Top
Fields
Name | Description
Instance | The singleton instance of UInt32Formatter.
Top
See Also

Reference

PostSharp.Patterns.Formatters Namespace


UInt32Formatter Properties

The UInt32Formatter type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from FormatterT.)
Top
See Also

Reference

UInt32Formatter Class
PostSharp.Patterns.Formatters Namespace


UInt32Formatter Methods

Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Public method | Write(UnsafeStringBuilder, UInt32) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Top
See Also

Reference

UInt32Formatter Class
PostSharp.Patterns.Formatters Namespace


UInt32Formatter.Write Method

UInt32FormatterWrite Method

Overload List
 | Name | Description
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Public method | Write(UnsafeStringBuilder, UInt32) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Top
See Also

Reference

UInt32Formatter Class
PostSharp.Patterns.Formatters Namespace


UInt32Formatter.Write Method (UnsafeStringBuilder, UInt32)

UInt32FormatterWrite Method (UnsafeStringBuilder, UInt32)

Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant).

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void Write(
    UnsafeStringBuilder stringBuilder,
    uint value
)

Parameters

stringBuilder
Type: PostSharp.Patterns.FormattersUnsafeStringBuilder
The target UnsafeStringBuilder.
value
Type: SystemUInt32
The value to be formatted.

Implements

IFormatterTWrite(UnsafeStringBuilder, T)
See Also

Reference

UInt32Formatter Class
Write Overload
PostSharp.Patterns.Formatters Namespace

Other Resources

Conceptual: Implementing a Custom Formatter


UInt32Formatter Fields

The UInt32Formatter type exposes the following members.

Fields
Name | Description
Instance | The singleton instance of UInt32Formatter.
Top
See Also

Reference

UInt32Formatter Class
PostSharp.Patterns.Formatters Namespace


UInt32Formatter.Instance Field

UInt32FormatterInstance Field

The singleton instance of UInt32Formatter.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static readonly UInt32Formatter Instance

Field Value

Type: UInt32Formatter
See Also

Reference

UInt32Formatter Class
PostSharp.Patterns.Formatters Namespace


UInt64Formatter Class

A formatter for UInt64 values.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.FormattersFormatter UInt64
PostSharp.Patterns.FormattersUInt64Formatter

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class UInt64Formatter : Formatter<ulong>

The UInt64Formatter type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from FormatterT.)
Top
Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Public method | Write(UnsafeStringBuilder, UInt64) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Top
Fields
Name | Description
Instance | The singleton instance of UInt64Formatter.
Top
See Also

Reference

PostSharp.Patterns.Formatters Namespace


UInt64Formatter Properties

The UInt64Formatter type exposes the following members.

Properties
 | Name | Description
Public property | Attributes | Gets the formatter attributes. (Inherited from FormatterT.)
Top
See Also

Reference

UInt64Formatter Class
PostSharp.Patterns.Formatters Namespace


UInt64Formatter Methods

Methods
 | Name | Description
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Public method | Write(UnsafeStringBuilder, UInt64) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Top
See Also

Reference

UInt64Formatter Class
PostSharp.Patterns.Formatters Namespace


UInt64Formatter.Write Method

UInt64FormatterWrite Method

Overload List
 | Name | Description
Public method | Write(UnsafeStringBuilder, Object) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Inherited from FormatterT.)
Public method | Write(UnsafeStringBuilder, UInt64) | Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant). (Overrides FormatterTWrite(UnsafeStringBuilder, T).)
Top
See Also

Reference

UInt64Formatter Class
PostSharp.Patterns.Formatters Namespace


UInt64Formatter.Write Method (UnsafeStringBuilder, UInt64)

UInt64FormatterWrite Method (UnsafeStringBuilder, UInt64)

Appends the description of an object into given UnsafeStringBuilder (weakly-typed variant).

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void Write(
    UnsafeStringBuilder stringBuilder,
    ulong value
)

Parameters

stringBuilder
Type: PostSharp.Patterns.FormattersUnsafeStringBuilder
The target UnsafeStringBuilder.
value
Type: SystemUInt64
The value to be formatted.

Implements

IFormatterTWrite(UnsafeStringBuilder, T)
See Also

Reference

UInt64Formatter Class
Write Overload
PostSharp.Patterns.Formatters Namespace

Other Resources

Conceptual: Implementing a Custom Formatter


UInt64Formatter Fields

The UInt64Formatter type exposes the following members.

Fields
Name | Description
Instance | The singleton instance of UInt64Formatter.
Top
See Also

Reference

UInt64Formatter Class
PostSharp.Patterns.Formatters Namespace


UInt64Formatter.Instance Field

UInt64FormatterInstance Field

The singleton instance of UInt64Formatter.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static readonly UInt64Formatter Instance

Field Value

Type: UInt64Formatter
See Also

Reference

UInt64Formatter Class
PostSharp.Patterns.Formatters Namespace


UnsafeString Class

A generalized representation of a string that can be either backed by a system String, a char[], or an UnsafeStringBuilder. Conversions between these types happen transparently and are cached.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.FormattersUnsafeString

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class UnsafeString

The UnsafeString type exposes the following members.

Constructors
 | Name | Description
Public method | UnsafeString(Char) | Initializes a new UnsafeString backed by an array of Char.
Public method | UnsafeString(String) | Initializes a new UnsafeString backed by a String.
Top
Properties
 | Name | Description
Public property | Buffer | Gets an unmanaged pointer to the string.
Public property | IsImmutable | Determines whether the current UnsafeString is immutable or, when the value of this property is false, if still bound to a mutable. Call the MakeImmutable method to make the UnsafeString immutable.
Public property | Length | Gets the number of characters in the string.
Top
Methods
 | Name | Description
Public method | MakeImmutable | If the current UnsafeString is bound to its origin UnsafeStringBuilder, evaluates the UnsafeStringBuilder and breaks the binding, so that later changes in the UnsafeStringBuilder do not cause changes in the current UnsafeString. This method also prevents the UnsafeString form being recycled.
Public method | ToCharArray | Gets an ArraySegmentT representing the current UnsafeString.
Public method | ToString | Returns a string that represents the current object. (Overrides ObjectToString.)
Top
Remarks

Because an UnsafeString can be backed by a UnsafeStringBuilder, which is a mutable type, and is generally pooled and reused for different purposes, it is generally not safe to evaluate an UnsafeString at a different moment than the one designed by the API that exposes the UnsafeString. To make it safe to evaluate the UnsafeString at any moment, call the MakeImmutable method, which unbounds the UnsafeString from its parent UnsafeStringBuilder.

See Also

Reference

PostSharp.Patterns.Formatters Namespace


UnsafeString Constructor

Overload List
 | Name | Description
Public method | UnsafeString(Char) | Initializes a new UnsafeString backed by an array of Char.
Public method | UnsafeString(String) | Initializes a new UnsafeString backed by a String.
Top
See Also

Reference

UnsafeString Class
PostSharp.Patterns.Formatters Namespace


UnsafeString Constructor (Char[])

UnsafeString Constructor (Char)

Initializes a new UnsafeString backed by an array of Char.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public UnsafeString(
    char[] array
)

Parameters

array
Type: SystemChar
A non-null array of Char.
See Also

Reference

UnsafeString Class
UnsafeString Overload
PostSharp.Patterns.Formatters Namespace


UnsafeString Constructor (String)

Initializes a new UnsafeString backed by a String.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public UnsafeString(
    string str
)

Parameters

str
Type: SystemString
A non-null String.
See Also

Reference

UnsafeString Class
UnsafeString Overload
PostSharp.Patterns.Formatters Namespace


UnsafeString Properties

The UnsafeString type exposes the following members.

Properties
 | Name | Description
Public property | Buffer | Gets an unmanaged pointer to the string.
Public property | IsImmutable | Determines whether the current UnsafeString is immutable or, when the value of this property is false, if still bound to a mutable. Call the MakeImmutable method to make the UnsafeString immutable.
Public property | Length | Gets the number of characters in the string.
Top
See Also

Reference

UnsafeString Class
PostSharp.Patterns.Formatters Namespace


UnsafeString.Buffer Property

UnsafeStringBuffer Property

Gets an unmanaged pointer to the string.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IntPtr Buffer { get; }

Property Value

Type: IntPtr
See Also

Reference

UnsafeString Class
PostSharp.Patterns.Formatters Namespace


UnsafeString.IsImmutable Property

UnsafeStringIsImmutable Property

Determines whether the current UnsafeString is immutable or, when the value of this property is false, if still bound to a mutable. Call the MakeImmutable method to make the UnsafeString immutable.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsImmutable { get; }

Property Value

Type: Boolean
See Also

Reference

UnsafeString Class
PostSharp.Patterns.Formatters Namespace


UnsafeString.Length Property

UnsafeStringLength Property

Gets the number of characters in the string.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int Length { get; }

Property Value

Type: Int32
See Also

Reference

UnsafeString Class
PostSharp.Patterns.Formatters Namespace


UnsafeString Methods

The UnsafeString type exposes the following members.

Methods
 | Name | Description
Public method | MakeImmutable | If the current UnsafeString is bound to its origin UnsafeStringBuilder, evaluates the UnsafeStringBuilder and breaks the binding, so that later changes in the UnsafeStringBuilder do not cause changes in the current UnsafeString. This method also prevents the UnsafeString form being recycled.
Public method | ToCharArray | Gets an ArraySegmentT representing the current UnsafeString.
Public method | ToString | Returns a string that represents the current object. (Overrides ObjectToString.)
Top
See Also

Reference

UnsafeString Class
PostSharp.Patterns.Formatters Namespace


UnsafeString.MakeImmutable Method

UnsafeStringMakeImmutable Method

If the current UnsafeString is bound to its origin UnsafeStringBuilder, evaluates the UnsafeStringBuilder and breaks the binding, so that later changes in the UnsafeStringBuilder do not cause changes in the current UnsafeString. This method also prevents the UnsafeString form being recycled.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void MakeImmutable()
See Also

Reference

UnsafeString Class
PostSharp.Patterns.Formatters Namespace


UnsafeString.ToCharArray Method

UnsafeStringToCharArray Method

Gets an ArraySegmentT representing the current UnsafeString.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ArraySegment<char> ToCharArray()

Return Value

Type: ArraySegment Char
An ArraySegmentT representing the current UnsafeString.
See Also

Reference

UnsafeString Class
PostSharp.Patterns.Formatters Namespace


UnsafeString.ToString Method

UnsafeStringToString Method

Returns a string that represents the current object.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override string ToString()

Return Value

Type: String
A string that represents the current object.
See Also

Reference

UnsafeString Class
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder Class

A class similar to StringBuilder, but implemented using unsafe C#.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.FormattersUnsafeStringBuilder

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class UnsafeStringBuilder : IDisposable

The UnsafeStringBuilder type exposes the following members.

Constructors
 | Name | Description
Public method | UnsafeStringBuilder(Int32, Boolean) | Initializes a new UnsafeStringBuilder and allocates a new buffer.
Public method | UnsafeStringBuilder(Char*, Int32, Boolean) | Initializes a new UnsafeStringBuilder with a pre-allocated buffer/
Top
Properties
 | Name | Description
Public property | Buffer | Gets a pointer to the unmanaged buffer of the current UnsafeStringBuilder.
Public property | Capacity | Gets the capacity (number of char) of the current UnsafeStringBuilder.
Public property | IsDisposed | Determines whether the current UnsafeStringBuilder has been disposed.
Public property | Item | Gets the char at a given position in the current UnsafeStringBuilder.
Public property | Length | Gets the current number of characters in the current UnsafeStringBuilder.
Public property | ThrowOnOverflow | true if an OverflowException should be thrown when the buffer capacity is insufficient, false if the Append method should return false without exception.
Public property | Version | Gets the version of the current UnsafeStringBuilder. This property is incremented every time the current object is reused, more specifically, when the Clear method is called.
Top
Methods
 | Name | Description
Public method | Append(Boolean) | Appends a Boolean (true or false, litterally) to the current UnsafeStringBuilder.
Public method | Append(Byte) | Appends a Byte (with decimal formatting) to the current UnsafeStringBuilder.
Public method | Append(Char) | Appends one char to the current UnsafeStringBuilder.
Public method | Append(Char) | Appends an array of char to the current UnsafeStringBuilder.
Public method | Append(Int16) | Appends a Int16 (with decimal formatting) to the current UnsafeStringBuilder.
Public method | Append(Int32) | Appends a Int32 (with decimal formatting) to the current UnsafeStringBuilder.
Public method | Append(Int64) | Appends a Int64 (with decimal formatting) to the current UnsafeStringBuilder.
Public method | Append(SByte) | Appends an SByte (with decimal formatting) to the current UnsafeStringBuilder.
Public method | Append(String) | Appends a String to the current UnsafeStringBuilder.
Public method | Append(UInt16) | Appends a UInt16 (with decimal formatting) to the current UnsafeStringBuilder.
Public method | Append(UInt32) | Appends a UInt32 (with decimal formatting) to the current UnsafeStringBuilder.
Public method | Append(UInt64) | Appends a UInt64 (with decimal formatting) to the current UnsafeStringBuilder.
Public method | Append(UnsafeString) | Appends an UnsafeString to the current UnsafeStringBuilder.
Public method | Append(UnsafeStringBuilder) | Appends the current value of a UnsafeStringBuilder to the current UnsafeStringBuilder.
Public method | Append(Char*, Int32) | Appends an unmanaged array of char to the current UnsafeStringBuilder.
Public method | Append(Char, Char) | Appends two char to the current UnsafeStringBuilder.
Public method | Append(Char, Int32) | Appends several times the same char to the current UnsafeStringBuilder.
Public method | Append(Char, Char, Char) | Appends three char to the current UnsafeStringBuilder.
Public method | Append(Char, Int32, Int32) | Appends an array segment of char to the current UnsafeStringBuilder.
Public method | Append(Char, Char, Char, Char) | Appends four char to the current UnsafeStringBuilder.
Public method | Append(Char, Char, Char, Char, Char) | Appends five char to the current UnsafeStringBuilder.
Public method | Clear | Clears the current UnsafeStringBuilder so it can be reused to build a new string.
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Protected method | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Overrides ObjectFinalize.)
Public method | SetNullTermination | Appends a null character at the end of the current string, without affecting the string length. In case of overflow, if ThrowOnOverflow is false, the last character of the string is removed and the string lenght is decreased by 1.
Public method | Substring(Int32) | Returns the substring starting at a given index and ending at the end of the current string.
Public method | Substring(Int32, Int32) | Returns the substring starting at a given index and having a specified length.
Public method | ToString | Returns a string that represents the current object. (Overrides ObjectToString.)
Public method | ToUnsafeString | Gets an UnsafeString that provides read-only access to the current UnsafeStringBuilder.
Top
See Also

Reference

PostSharp.Patterns.Formatters Namespace

Other Resources

Conceptual: Implementing a Custom Formatter


UnsafeStringBuilder Constructor

Overload List
 | Name | Description
Public method | UnsafeStringBuilder(Int32, Boolean) | Initializes a new UnsafeStringBuilder and allocates a new buffer.
Public method | UnsafeStringBuilder(Char*, Int32, Boolean) | Initializes a new UnsafeStringBuilder with a pre-allocated buffer/
Top
See Also

Reference

UnsafeStringBuilder Class
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder Constructor (Int32, Boolean)

Initializes a new UnsafeStringBuilder and allocates a new buffer.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public UnsafeStringBuilder(
    int capacity = 2048,
    bool throwOnOverflow = true
)

Parameters

capacity (Optional)
Type: SystemInt32
The capacity of the new UnsafeStringBuilder.
throwOnOverflow (Optional)
Type: SystemBoolean
true if an OverflowException should be thrown when the buffer capacity is insufficient, false if the Append method should return false without exception.
See Also

Reference

UnsafeStringBuilder Class
UnsafeStringBuilder Overload
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder Constructor (Char*, Int32, Boolean)

UnsafeStringBuilder Constructor (Char, Int32, Boolean)

Initializes a new UnsafeStringBuilder with a pre-allocated buffer/

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public UnsafeStringBuilder(
    char* buffer,
    int size,
    bool throwOnOverflow = true
)

Parameters

buffer
Type: SystemChar*
Pointer to the buffer.
size
Type: SystemInt32
Number of char in the buffer.
throwOnOverflow (Optional)
Type: SystemBoolean
true if an OverflowException should be thrown when the buffer capacity is insufficient, false if the Append method should return false without exception.
See Also

Reference

UnsafeStringBuilder Class
UnsafeStringBuilder Overload
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder Properties

The UnsafeStringBuilder type exposes the following members.

Properties
 | Name | Description
Public property | Buffer | Gets a pointer to the unmanaged buffer of the current UnsafeStringBuilder.
Public property | Capacity | Gets the capacity (number of char) of the current UnsafeStringBuilder.
Public property | IsDisposed | Determines whether the current UnsafeStringBuilder has been disposed.
Public property | Item | Gets the char at a given position in the current UnsafeStringBuilder.
Public property | Length | Gets the current number of characters in the current UnsafeStringBuilder.
Public property | ThrowOnOverflow | true if an OverflowException should be thrown when the buffer capacity is insufficient, false if the Append method should return false without exception.
Public property | Version | Gets the version of the current UnsafeStringBuilder. This property is incremented every time the current object is reused, more specifically, when the Clear method is called.
Top
See Also

Reference

UnsafeStringBuilder Class
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.Buffer Property

UnsafeStringBuilderBuffer Property

Gets a pointer to the unmanaged buffer of the current UnsafeStringBuilder.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IntPtr Buffer { get; }

Property Value

Type: IntPtr
See Also

Reference

UnsafeStringBuilder Class
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.Capacity Property

UnsafeStringBuilderCapacity Property

Gets the capacity (number of char) of the current UnsafeStringBuilder.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int Capacity { get; }

Property Value

Type: Int32
See Also

Reference

UnsafeStringBuilder Class
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.IsDisposed Property

UnsafeStringBuilderIsDisposed Property

Determines whether the current UnsafeStringBuilder has been disposed.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsDisposed { get; }

Property Value

Type: Boolean
See Also

Reference

UnsafeStringBuilder Class
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.Item Property

UnsafeStringBuilderItem Property

Gets the char at a given position in the current UnsafeStringBuilder.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public char this[
    int index
] { get; set; }

Parameters

index
Type: SystemInt32
Index of the char in the buffer.

Return Value

Type: Char
The char at position index.
See Also

Reference

UnsafeStringBuilder Class
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.Length Property

UnsafeStringBuilderLength Property

Gets the current number of characters in the current UnsafeStringBuilder.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int Length { get; }

Property Value

Type: Int32
See Also

Reference

UnsafeStringBuilder Class
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.ThrowOnOverflow Property

UnsafeStringBuilderThrowOnOverflow Property

true if an OverflowException should be thrown when the buffer capacity is insufficient, false if the Append method should return false without exception.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool ThrowOnOverflow { get; }

Property Value

Type: Boolean
See Also

Reference

UnsafeStringBuilder Class
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.Version Property

UnsafeStringBuilderVersion Property

Gets the version of the current UnsafeStringBuilder. This property is incremented every time the current object is reused, more specifically, when the Clear method is called.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int Version { get; }

Property Value

Type: Int32
See Also

Reference

UnsafeStringBuilder Class
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder Methods

The UnsafeStringBuilder type exposes the following members.

Methods
 | Name | Description
Public method | Append(Boolean) | Appends a Boolean (true or false, litterally) to the current UnsafeStringBuilder.
Public method | Append(Byte) | Appends a Byte (with decimal formatting) to the current UnsafeStringBuilder.
Public method | Append(Char) | Appends one char to the current UnsafeStringBuilder.
Public method | Append(Char) | Appends an array of char to the current UnsafeStringBuilder.
Public method | Append(Int16) | Appends a Int16 (with decimal formatting) to the current UnsafeStringBuilder.
Public method | Append(Int32) | Appends a Int32 (with decimal formatting) to the current UnsafeStringBuilder.
Public method | Append(Int64) | Appends a Int64 (with decimal formatting) to the current UnsafeStringBuilder.
Public method | Append(SByte) | Appends an SByte (with decimal formatting) to the current UnsafeStringBuilder.
Public method | Append(String) | Appends a String to the current UnsafeStringBuilder.
Public method | Append(UInt16) | Appends a UInt16 (with decimal formatting) to the current UnsafeStringBuilder.
Public method | Append(UInt32) | Appends a UInt32 (with decimal formatting) to the current UnsafeStringBuilder.
Public method | Append(UInt64) | Appends a UInt64 (with decimal formatting) to the current UnsafeStringBuilder.
Public method | Append(UnsafeString) | Appends an UnsafeString to the current UnsafeStringBuilder.
Public method | Append(UnsafeStringBuilder) | Appends the current value of a UnsafeStringBuilder to the current UnsafeStringBuilder.
Public method | Append(Char*, Int32) | Appends an unmanaged array of char to the current UnsafeStringBuilder.
Public method | Append(Char, Char) | Appends two char to the current UnsafeStringBuilder.
Public method | Append(Char, Int32) | Appends several times the same char to the current UnsafeStringBuilder.
Public method | Append(Char, Char, Char) | Appends three char to the current UnsafeStringBuilder.
Public method | Append(Char, Int32, Int32) | Appends an array segment of char to the current UnsafeStringBuilder.
Public method | Append(Char, Char, Char, Char) | Appends four char to the current UnsafeStringBuilder.
Public method | Append(Char, Char, Char, Char, Char) | Appends five char to the current UnsafeStringBuilder.
Public method | Clear | Clears the current UnsafeStringBuilder so it can be reused to build a new string.
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Protected method | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Overrides ObjectFinalize.)
Public method | SetNullTermination | Appends a null character at the end of the current string, without affecting the string length. In case of overflow, if ThrowOnOverflow is false, the last character of the string is removed and the string lenght is decreased by 1.
Public method | Substring(Int32) | Returns the substring starting at a given index and ending at the end of the current string.
Public method | Substring(Int32, Int32) | Returns the substring starting at a given index and having a specified length.
Public method | ToString | Returns a string that represents the current object. (Overrides ObjectToString.)
Public method | ToUnsafeString | Gets an UnsafeString that provides read-only access to the current UnsafeStringBuilder.
Top
See Also

Reference

UnsafeStringBuilder Class
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.Append Method

UnsafeStringBuilderAppend Method

Overload List
 | Name | Description
Public method | Append(Boolean) | Appends a Boolean (true or false, litterally) to the current UnsafeStringBuilder.
Public method | Append(Byte) | Appends a Byte (with decimal formatting) to the current UnsafeStringBuilder.
Public method | Append(Char) | Appends one char to the current UnsafeStringBuilder.
Public method | Append(Char) | Appends an array of char to the current UnsafeStringBuilder.
Public method | Append(Int16) | Appends a Int16 (with decimal formatting) to the current UnsafeStringBuilder.
Public method | Append(Int32) | Appends a Int32 (with decimal formatting) to the current UnsafeStringBuilder.
Public method | Append(Int64) | Appends a Int64 (with decimal formatting) to the current UnsafeStringBuilder.
Public method | Append(SByte) | Appends an SByte (with decimal formatting) to the current UnsafeStringBuilder.
Public method | Append(String) | Appends a String to the current UnsafeStringBuilder.
Public method | Append(UInt16) | Appends a UInt16 (with decimal formatting) to the current UnsafeStringBuilder.
Public method | Append(UInt32) | Appends a UInt32 (with decimal formatting) to the current UnsafeStringBuilder.
Public method | Append(UInt64) | Appends a UInt64 (with decimal formatting) to the current UnsafeStringBuilder.
Public method | Append(UnsafeString) | Appends an UnsafeString to the current UnsafeStringBuilder.
Public method | Append(UnsafeStringBuilder) | Appends the current value of a UnsafeStringBuilder to the current UnsafeStringBuilder.
Public method | Append(Char*, Int32) | Appends an unmanaged array of char to the current UnsafeStringBuilder.
Public method | Append(Char, Char) | Appends two char to the current UnsafeStringBuilder.
Public method | Append(Char, Int32) | Appends several times the same char to the current UnsafeStringBuilder.
Public method | Append(Char, Char, Char) | Appends three char to the current UnsafeStringBuilder.
Public method | Append(Char, Int32, Int32) | Appends an array segment of char to the current UnsafeStringBuilder.
Public method | Append(Char, Char, Char, Char) | Appends four char to the current UnsafeStringBuilder.
Public method | Append(Char, Char, Char, Char, Char) | Appends five char to the current UnsafeStringBuilder.
Top
See Also

Reference

UnsafeStringBuilder Class
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.Append Method (Boolean)

UnsafeStringBuilderAppend Method (Boolean)

Appends a Boolean (true or false, litterally) to the current UnsafeStringBuilder.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Append(
    bool value
)

Parameters

value
Type: SystemBoolean
The value to be appended.

Return Value

Type: Boolean
true in case of success, false in case of buffer overflow.
See Also

Reference

UnsafeStringBuilder Class
Append Overload
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.Append Method (Byte)

UnsafeStringBuilderAppend Method (Byte)

Appends a Byte (with decimal formatting) to the current UnsafeStringBuilder.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Append(
    byte value
)

Parameters

value
Type: SystemByte
The value to be appended.

Return Value

Type: Boolean
true in case of success, false in case of buffer overflow.
See Also

Reference

UnsafeStringBuilder Class
Append Overload
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.Append Method (Char)

UnsafeStringBuilderAppend Method (Char)

Appends one char to the current UnsafeStringBuilder.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Append(
    char c
)

Parameters

c
Type: SystemChar
A char.

Return Value

Type: Boolean
true in case of success, false in case of buffer overflow.
See Also

Reference

UnsafeStringBuilder Class
Append Overload
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.Append Method (Char[])

UnsafeStringBuilderAppend Method (Char)

Appends an array of char to the current UnsafeStringBuilder.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Append(
    char[] c
)

Parameters

c
Type: SystemChar
A non-null array of char.

Return Value

Type: Boolean
true in case of success, false in case of buffer overflow.
See Also

Reference

UnsafeStringBuilder Class
Append Overload
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.Append Method (Int16)

UnsafeStringBuilderAppend Method (Int16)

Appends a Int16 (with decimal formatting) to the current UnsafeStringBuilder.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Append(
    short value
)

Parameters

value
Type: SystemInt16
The value to be appended.

Return Value

Type: Boolean
true in case of success, false in case of buffer overflow.
See Also

Reference

UnsafeStringBuilder Class
Append Overload
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.Append Method (Int32)

UnsafeStringBuilderAppend Method (Int32)

Appends a Int32 (with decimal formatting) to the current UnsafeStringBuilder.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Append(
    int value
)

Parameters

value
Type: SystemInt32
The value to be appended.

Return Value

Type: Boolean
true in case of success, false in case of buffer overflow.
See Also

Reference

UnsafeStringBuilder Class
Append Overload
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.Append Method (Int64)

UnsafeStringBuilderAppend Method (Int64)

Appends a Int64 (with decimal formatting) to the current UnsafeStringBuilder.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Append(
    long value
)

Parameters

value
Type: SystemInt64
The value to be appended.

Return Value

Type: Boolean
true in case of success, false in case of buffer overflow.
See Also

Reference

UnsafeStringBuilder Class
Append Overload
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.Append Method (SByte)

UnsafeStringBuilderAppend Method (SByte)

Appends an SByte (with decimal formatting) to the current UnsafeStringBuilder.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Append(
    sbyte value
)

Parameters

value
Type: SystemSByte
The value to be appended.

Return Value

Type: Boolean
true in case of success, false in case of buffer overflow.
See Also

Reference

UnsafeStringBuilder Class
Append Overload
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.Append Method (String)

UnsafeStringBuilderAppend Method (String)

Appends a String to the current UnsafeStringBuilder.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Append(
    string s
)

Parameters

s
Type: SystemString
A non-null String.

Return Value

Type: Boolean
true in case of success, false in case of buffer overflow.
See Also

Reference

UnsafeStringBuilder Class
Append Overload
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.Append Method (UInt16)

UnsafeStringBuilderAppend Method (UInt16)

Appends a UInt16 (with decimal formatting) to the current UnsafeStringBuilder.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Append(
    ushort value
)

Parameters

value
Type: SystemUInt16
The value to be appended.

Return Value

Type: Boolean
true in case of success, false in case of buffer overflow.
See Also

Reference

UnsafeStringBuilder Class
Append Overload
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.Append Method (UInt32)

UnsafeStringBuilderAppend Method (UInt32)

Appends a UInt32 (with decimal formatting) to the current UnsafeStringBuilder.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Append(
    uint value
)

Parameters

value
Type: SystemUInt32
The value to be appended.

Return Value

Type: Boolean
true in case of success, false in case of buffer overflow.
See Also

Reference

UnsafeStringBuilder Class
Append Overload
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.Append Method (UInt64)

UnsafeStringBuilderAppend Method (UInt64)

Appends a UInt64 (with decimal formatting) to the current UnsafeStringBuilder.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Append(
    ulong value
)

Parameters

value
Type: SystemUInt64
The value to be appended.

Return Value

Type: Boolean
true in case of success, false in case of buffer overflow.
See Also

Reference

UnsafeStringBuilder Class
Append Overload
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.Append Method (UnsafeString)

UnsafeStringBuilderAppend Method (UnsafeString)

Appends an UnsafeString to the current UnsafeStringBuilder.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Append(
    UnsafeString s
)

Parameters

s
Type: PostSharp.Patterns.FormattersUnsafeString
A non-null UnsafeString.

Return Value

Type: Boolean
true in case of success, false in case of buffer overflow.
See Also

Reference

UnsafeStringBuilder Class
Append Overload
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.Append Method (UnsafeStringBuilder)

UnsafeStringBuilderAppend Method (UnsafeStringBuilder)

Appends the current value of a UnsafeStringBuilder to the current UnsafeStringBuilder.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Append(
    UnsafeStringBuilder stringBuilder
)

Parameters

stringBuilder
Type: PostSharp.Patterns.FormattersUnsafeStringBuilder
A UnsafeStringBuilder.

Return Value

Type: Boolean
true in case of success, false in case of buffer overflow.
See Also

Reference

UnsafeStringBuilder Class
Append Overload
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.Append Method (Char*, Int32)

UnsafeStringBuilderAppend Method (Char, Int32)

Appends an unmanaged array of char to the current UnsafeStringBuilder.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Append(
    char* c,
    int count
)

Parameters

c
Type: SystemChar*
A non-null pointer to an unmanaged array of char.
count
Type: SystemInt32
Number of char to be appended.

Return Value

Type: Boolean
true in case of success, false in case of buffer overflow.
See Also

Reference

UnsafeStringBuilder Class
Append Overload
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.Append Method (Char, Char)

UnsafeStringBuilderAppend Method (Char, Char)

Appends two char to the current UnsafeStringBuilder.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Append(
    char c1,
    char c2
)

Parameters

c1
Type: SystemChar
A char.
c2
Type: SystemChar
A char.

Return Value

Type: Boolean
true in case of success, false in case of buffer overflow.
See Also

Reference

UnsafeStringBuilder Class
Append Overload
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.Append Method (Char, Int32)

UnsafeStringBuilderAppend Method (Char, Int32)

Appends several times the same char to the current UnsafeStringBuilder.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Append(
    char c,
    int count
)

Parameters

c
Type: SystemChar
A char.
count
Type: SystemInt32
The number of times c has to be appended.

Return Value

Type: Boolean
true in case of success, false in case of buffer overflow.
See Also

Reference

UnsafeStringBuilder Class
Append Overload
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.Append Method (Char, Char, Char)

UnsafeStringBuilderAppend Method (Char, Char, Char)

Appends three char to the current UnsafeStringBuilder.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Append(
    char c1,
    char c2,
    char c3
)

Parameters

c1
Type: SystemChar
A char.
c2
Type: SystemChar
A char.
c3
Type: SystemChar
A char.

Return Value

Type: Boolean
true in case of success, false in case of buffer overflow.
See Also

Reference

UnsafeStringBuilder Class
Append Overload
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.Append Method (Char[], Int32, Int32)

UnsafeStringBuilderAppend Method (Char, Int32, Int32)

Appends an array segment of char to the current UnsafeStringBuilder.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Append(
    char[] c,
    int offset,
    int count
)

Parameters

c
Type: SystemChar
A non-null array of char.
offset
Type: SystemInt32
Index of the first char to be appended.
count
Type: SystemInt32
Number of char to be appended.

Return Value

Type: Boolean
true in case of success, false in case of buffer overflow.
See Also

Reference

UnsafeStringBuilder Class
Append Overload
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.Append Method (Char, Char, Char, Char)

UnsafeStringBuilderAppend Method (Char, Char, Char, Char)

Appends four char to the current UnsafeStringBuilder.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Append(
    char c1,
    char c2,
    char c3,
    char c4
)

Parameters

c1
Type: SystemChar
A char.
c2
Type: SystemChar
A char.
c3
Type: SystemChar
A char.
c4
Type: SystemChar
A char.

Return Value

Type: Boolean
true in case of success, false in case of buffer overflow.
See Also

Reference

UnsafeStringBuilder Class
Append Overload
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.Append Method (Char, Char, Char, Char, Char)

UnsafeStringBuilderAppend Method (Char, Char, Char, Char, Char)

Appends five char to the current UnsafeStringBuilder.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Append(
    char c1,
    char c2,
    char c3,
    char c4,
    char c5
)

Parameters

c1
Type: SystemChar
A char.
c2
Type: SystemChar
A char.
c3
Type: SystemChar
A char.
c4
Type: SystemChar
A char.
c5
Type: SystemChar
A char.

Return Value

Type: Boolean
true in case of success, false in case of buffer overflow.
See Also

Reference

UnsafeStringBuilder Class
Append Overload
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.Clear Method

UnsafeStringBuilderClear Method

Clears the current UnsafeStringBuilder so it can be reused to build a new string.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Clear()
See Also

Reference

UnsafeStringBuilder Class
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.Dispose Method

UnsafeStringBuilderDispose Method

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Dispose()

Implements

IDisposableDispose
See Also

Reference

UnsafeStringBuilder Class
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.Finalize Method

UnsafeStringBuilderFinalize Method

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void Finalize()

Implements

ObjectFinalize
See Also

Reference

UnsafeStringBuilder Class
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.SetNullTermination Method

UnsafeStringBuilderSetNullTermination Method

Appends a null character at the end of the current string, without affecting the string length. In case of overflow, if ThrowOnOverflow is false, the last character of the string is removed and the string lenght is decreased by 1.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool SetNullTermination()

Return Value

Type: Boolean
true if the string was null-terminated without affecting its length, or false if the last character of the string was replaced by the null character and the string length was decreased by 1.
See Also

Reference

UnsafeStringBuilder Class
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.Substring Method

UnsafeStringBuilderSubstring Method

Overload List
 | Name | Description
Public method | Substring(Int32) | Returns the substring starting at a given index and ending at the end of the current string.
Public method | Substring(Int32, Int32) | Returns the substring starting at a given index and having a specified length.
Top
See Also

Reference

UnsafeStringBuilder Class
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.Substring Method (Int32)

UnsafeStringBuilderSubstring Method (Int32)

Returns the substring starting at a given index and ending at the end of the current string.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string Substring(
    int startIndex
)

Parameters

startIndex
Type: SystemInt32
Index of the first character of the substring.

Return Value

Type: String
The substring starting from startIndex.
See Also

Reference

UnsafeStringBuilder Class
Substring Overload
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.Substring Method (Int32, Int32)

UnsafeStringBuilderSubstring Method (Int32, Int32)

Returns the substring starting at a given index and having a specified length.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string Substring(
    int startIndex,
    int length
)

Parameters

startIndex
Type: SystemInt32
Index of the first character of the substring.
length
Type: SystemInt32
Number of characters to return.

Return Value

Type: String
The substring starting from startIndex having length characters.
See Also

Reference

UnsafeStringBuilder Class
Substring Overload
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.ToString Method

UnsafeStringBuilderToString Method

Returns a string that represents the current object.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override string ToString()

Return Value

Type: String
A string that represents the current object.
See Also

Reference

UnsafeStringBuilder Class
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilder.ToUnsafeString Method

UnsafeStringBuilderToUnsafeString Method

Gets an UnsafeString that provides read-only access to the current UnsafeStringBuilder.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public UnsafeString ToUnsafeString()

Return Value

Type: UnsafeString
An UnsafeString that provides read-only access to the current UnsafeStringBuilder.
See Also

Reference

UnsafeStringBuilder Class
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilderPool Class

A thread-safe pool of UnsafeStringBuilder.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.FormattersUnsafeStringBuilderPool

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class UnsafeStringBuilderPool : IDisposable

The UnsafeStringBuilderPool type exposes the following members.

Constructors
 | Name | Description
Public method | UnsafeStringBuilderPool | Initializes a new UnsafeStringBuilderPool.
Top
Properties
 | Name | Description
Public property | StringBuilderCapacity | Gets the maximum number of characters in instances of the UnsafeStringBuilder class managed by the current pool.
Top
Methods
 | Name | Description
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Public method | GetInstance | Gets an instance from the pool.
Public method | ReturnInstance | Returns an UnsafeStringBuilder to the pool.
Top
See Also

Reference

PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilderPool Constructor

Initializes a new UnsafeStringBuilderPool.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public UnsafeStringBuilderPool(
    int stringBuilderCapacity,
    bool throwOnOverflow,
    int maxInstances = 32
)

Parameters

stringBuilderCapacity
Type: SystemInt32
Maximal number of characters in the UnsafeStringBuilder in the pool.
throwOnOverflow
Type: SystemBoolean
true if an OverflowException should be thrown when the buffer capacity is insufficient, false if the Append method should return false without exception.
maxInstances (Optional)
Type: SystemInt32
Maximal number of instances in the pool. The default value is 32.
See Also

Reference

UnsafeStringBuilderPool Class
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilderPool Properties

The UnsafeStringBuilderPool type exposes the following members.

Properties
 | Name | Description
Public property | StringBuilderCapacity | Gets the maximum number of characters in instances of the UnsafeStringBuilder class managed by the current pool.
Top
See Also

Reference

UnsafeStringBuilderPool Class
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilderPool.StringBuilderCapacity Property

UnsafeStringBuilderPoolStringBuilderCapacity Property

Gets the maximum number of characters in instances of the UnsafeStringBuilder class managed by the current pool.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int StringBuilderCapacity { get; }

Property Value

Type: Int32
See Also

Reference

UnsafeStringBuilderPool Class
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilderPool Methods

The UnsafeStringBuilderPool type exposes the following members.

Methods
 | Name | Description
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Public method | GetInstance | Gets an instance from the pool.
Public method | ReturnInstance | Returns an UnsafeStringBuilder to the pool.
Top
See Also

Reference

UnsafeStringBuilderPool Class
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilderPool.Dispose Method

UnsafeStringBuilderPoolDispose Method

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Dispose()

Implements

IDisposableDispose
See Also

Reference

UnsafeStringBuilderPool Class
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilderPool.GetInstance Method

UnsafeStringBuilderPoolGetInstance Method

Gets an instance from the pool.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public UnsafeStringBuilder GetInstance()

Return Value

Type: UnsafeStringBuilder
An UnsafeStringBuilder.
See Also

Reference

UnsafeStringBuilderPool Class
PostSharp.Patterns.Formatters Namespace


UnsafeStringBuilderPool.ReturnInstance Method

UnsafeStringBuilderPoolReturnInstance Method

Returns an UnsafeStringBuilder to the pool.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void ReturnInstance(
    UnsafeStringBuilder stringBuilder
)

Parameters

stringBuilder
Type: PostSharp.Patterns.FormattersUnsafeStringBuilder
An UnsafeStringBuilder that has compatible values of the Capacity and ThrowOnOverflow.
See Also

Reference

UnsafeStringBuilderPool Class
PostSharp.Patterns.Formatters Namespace


PostSharp.Patterns.Model Namespace

The PostSharp.Patterns.Model namespace contains an implementation of the Observer, Aggregatable and Disposable patterns.
Classes
 | Class | Description
Public class | AggregatableAttribute | Custom attribute that, when applied to class, enables instances of this class to be involved in a parent-child relationship.
Public class | AggregatableClientAttribute | Base class for aspects that consume functionalities from the AggregatableAttribute aspect. This class provides functionalities to advise and unadvise children.
Public class | AggregatableExtensions | Provides extension methods to the IAggregatable interface.
Public class | AggregatableServices | Provide static methods to aid with implementation of the IAggregatable interface.
Public class | AggregateAllChangesAttribute | Custom attribute that, when applied to a property of a class enhanced with the NotifyPropertyChangedAttribute, specifies that a change of any property of the property value will be considered as a change of the property itself.
Public class | AncestorChangedEventArgs | Arguments of the AncestorChanged event.
Public class | ChildAttribute | Custom attribute that, when applied to a field or automatic property, specifies that the object assigned to this field or property is a child of the instance of the declaring type.
Public class | ChildInfo | Describes a location (typically a field or collection item) on which a child can be attached to a parent.
Public class | Depends | Provides a way to specify dependencies of a method to properties or chains of properties. This class should be used from methods marked with the SafeForDependencyAnalysisAttribute custom attribute.
Public class | DisposableAttribute | Custom attribute that, when applied to a class, implements the IDisposable in such a way that the Dispose method executes the Dispose method for all children objects that also implement the IDisposable interface.
Public class | IgnoreAutoChangeNotificationAttribute | Custom attribute that, when applied to a method, prevents the NotifyPropertyChangedAttribute aspect to raise change notifications for this property.
Public class | MemberRelationshipAttribute | Base class for custom attributes that determine the kind of relationship of objects in a graph.
Public class | NotifyPropertyChangedAttribute | Custom attribute that, when applied on a type, implements the INotifyPropertyChanged interface for this class and all children classes.
Public class | NotifyPropertyChangedOverflowException | Exception thrown at runtime when the NotifyPropertyChangedAttribute aspect encounters an excessively long chain is dependency. This situation is typically caused by a cyclic dependency.
Public class | NotifyPropertyChangedServices | Utility methods to work with the NotifyPropertyChangedAttribute aspect.
Public class | NotifyPropertyChangingAdapter | Provides a unified adapter to the different variants of the INotifyPropertyChanging interface.
Public class | ParentAttribute | Custom attribute that, when applied to a field or automatic property, specifies that this field or property should be automatically set to the parent of the instance of the declaring type, whenever this instance is attached as a child to another object.
Public class | PropertyPath | Immutable property path with all components interned.
Public class | PureAttribute | Custom attribute that, when applied on a method, specifies that this method is a pure function, i.e. the method always returns the same result given the same parameter values. In the context of NotifyPropertyChangedAttribute, it is also assumed that pure functions have only parameters of primitive types (Int32, String, ...). The Object parameter type is also accepted, but then it is assumed that instances passed are immutable (and changes to these objects will not be tracked).
Public class | ReferenceAttribute | Custom attribute that, when applied to a field or automatic property, specifies that this field or property is a simple reference, and is not involved in a parent-child relationship.
Public class | SafeForDependencyAnalysisAttribute | Custom attribute that, when applied on a property, prevents the dependency analysis algorithm used by the NotifyPropertyChangedAttribute aspect from emitting errors when it encounters constructs that it cannot analyze.
Public class | WeakEventAttribute | Aspect that, when applied to an event, prevents the target event from holding a strong reference to event handlers. Therefore, the aspect prevents the event to prevent clients to be garbage collected.
Structures
 | Structure | Description
Public structure | RelationshipInfo | Describes the relationship between a parent and a child.
Interfaces
 | Interface | Description
Public interface | IAggregatable | Defines members (principally Parent and VisitChildren(ChildVisitor, ChildVisitorOptions, Object)) that allow to consume parent-child relationships in an object tree.
Public interface | IAggregatableCollection | Defines the non-generic semantics of an AggregatableCollection.
Public interface | IAggregatableDependentAdviceT | Defines the semantics of advices that depend on the aggregatable dynamic advices, i.e. they must be able to react to attachment and detachment events.
Public interface | IAttachable | Defines setter methods for the IAggregatable.
Public interface | IAttacher | Describes the semantics of a service through which a child IAggregatable object can attach itself to a parent object. This interface is typically implemented by the parent object by composition.
Delegates
 | Delegate | Description
Public delegate | ChildVisitor | Encapsulates a method that is invoked by the VisitChildren(ChildVisitor, ChildVisitorOptions, Object) method.
Public delegate | DescendantVisitor | Encapsulates a method that is invoked by the VisitSelfAndDescendants(IAggregatable, DescendantVisitor, ChildVisitorOptions, Object) method.
Enumerations
 | Enumeration | Description
Protected enumeration | AggregatableClientAttributeAspectInitializationStatus | Possible values for the InitializationStatus property.
Public enumeration | ChildVisitorOptions | Options for the VisitChildren(ChildVisitor, ChildVisitorOptions, Object) and VisitSelfAndDescendants(IAggregatable, DescendantVisitor, ChildVisitorOptions, Object) methods.
Public enumeration | DescendantVisitorStatus | Type of the return value of ChildVisitor. Determines how the visitor should continue enumerating other objects.
Public enumeration | ObjectAccessLevel | Enumeration of access levels that methods of execution scopes can require on an object.
Public enumeration | RelationshipKind | Enumeration of the kinds of relationship between objects in a object graph.
Public enumeration | WeakEventStrategy | Defines behavior of a weak event.


AggregatableAttribute Class

Custom attribute that, when applied to class, enables instances of this class to be involved in a parent-child relationship.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsTypeLevelAspect
PostSharp.AspectsInstanceLevelAspect
PostSharp.Patterns.ModelAggregatableAttribute

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class AggregatableAttribute : InstanceLevelAspect,
    IAttachable, IAggregatable, IAdviceProvider, IAspect, IAspectProvider,
    IService, IDeserializationCallback

The AggregatableAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | AggregatableAttribute | Initializes a new instance of the AggregatableAttribute class.
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | ChildrenFields | Gets (at build time) the list of children fields together with their ChildInfo.
Public property | DefaultItemRelationship | Gets or sets the default kind of relationship for collection items.
Public property | DefaultMemberRelationship | Gets or sets the default kind of relationship of fields and automatic properties.
Public property | Instance | Gets the object to which the current aspect has been applied. (Inherited from InstanceLevelAspect.)
Public property | IsParentSurrogate | Determines whether instances of the target class of this custom attribute are parent surrogates.
Public property | IsParentSurrogateSpecified | Determines whether the IsParentSurrogate property has been set.
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype. (Inherited from InstanceLevelAspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnCloned | Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object. (Inherited from InstanceLevelAspect.)
Public method | RuntimeInitializeInstance | Initializes the aspect instance. This method is invoked when all system elements of the aspect (like member imports) have completed. (Inherited from InstanceLevelAspect.)
Top
Extension Methods
 | Name | Description
Public Extension Method | GetChildren | Gets the list of children of a specified parent object. (Defined by AggregatableExtensions.)
Public Extension Method | GetDistinctChildren | Gets a list of distinct children of a specified parent object. (Defined by AggregatableExtensions.)
Public Extension Method | IsDescendantOf | Determines whether a specified object is a descendant of a specified ancestor. (Defined by AggregatableExtensions.)
Public Extension Method | VisitSelfAndDescendants | Executes a ChildVisitor for the a specified parent object and all its descendants. (Defined by AggregatableExtensions.)
Top
Remarks

This aspect implements the IAggregatable interface, which exposes members such as VisitChildren(ChildVisitor, ChildVisitorOptions, Object) and Parent.

The AggregatableAttribute aspect is implicitly used by several other aspects, including all threading models.

When a class has the AggregatableAttribute aspect, its reference-type fields and automatic properties must be annotated with one of the following attributes: ChildAttribute, ReferenceAttribute or ParentAttribute.

Target classes can customize the AggregatableAttribute aspect by implementing one or many of the members documented in the AggregatableAttributeTargetClass class.

See Also

Reference

PostSharp.Patterns.Model Namespace

Other Resources

Conceptual: Annotating an Object Model for Parent/Child Relationships (Aggregatable)
Conceptual: Automatically Disposing Children Objects (Disposable)
Conceptual: Enumerating Child Objects (Visitor)
Conceptual: Freezable Threading Model
Conceptual: Immutable Threading Model
Conceptual: Parent/Child, Visitor and Disposable
Conceptual: Reader/Writer Synchronized Threading Model
Conceptual: Synchronized Threading Model
Conceptual: Thread Affine Threading Model
Conceptual: What's New in PostSharp 4.0
Conceptual: Working With Child Collections


AggregatableAttribute Constructor

Initializes a new instance of the AggregatableAttribute class.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AggregatableAttribute()
See Also

Reference

AggregatableAttribute Class
PostSharp.Patterns.Model Namespace


AggregatableAttribute Properties

The AggregatableAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | ChildrenFields | Gets (at build time) the list of children fields together with their ChildInfo.
Public property | DefaultItemRelationship | Gets or sets the default kind of relationship for collection items.
Public property | DefaultMemberRelationship | Gets or sets the default kind of relationship of fields and automatic properties.
Public property | Instance | Gets the object to which the current aspect has been applied. (Inherited from InstanceLevelAspect.)
Public property | IsParentSurrogate | Determines whether instances of the target class of this custom attribute are parent surrogates.
Public property | IsParentSurrogateSpecified | Determines whether the IsParentSurrogate property has been set.
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

AggregatableAttribute Class
PostSharp.Patterns.Model Namespace


AggregatableAttribute.ChildrenFields Property

AggregatableAttributeChildrenFields Property

Gets (at build time) the list of children fields together with their ChildInfo.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IDictionary<FieldInfo, ChildInfo> ChildrenFields { get; }

Return Value

Type: IDictionary FieldInfo, ChildInfo
See Also

Reference

AggregatableAttribute Class
PostSharp.Patterns.Model Namespace


AggregatableAttribute.DefaultItemRelationship Property

AggregatableAttributeDefaultItemRelationship Property

Gets or sets the default kind of relationship for collection items.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public RelationshipKind DefaultItemRelationship { get; set; }

Property Value

Type: RelationshipKind
Remarks

If the target class of the AggregatableAttribute aspect is a collection class, the DefaultItemRelationship property applies to items of this collection. Otherwise, the property applies to items of collection children. In this case, the value of this property can be overwritten by the ItemsRelationship property of the ChildAttribute custom attribute.

The default value of this property is Default, which is interpreted as Child.

See Also

Reference

AggregatableAttribute Class
PostSharp.Patterns.Model Namespace


AggregatableAttribute.DefaultMemberRelationship Property

AggregatableAttributeDefaultMemberRelationship Property

Gets or sets the default kind of relationship of fields and automatic properties.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public RelationshipKind DefaultMemberRelationship { get; set; }

Property Value

Type: RelationshipKind
Remarks

The default value of this property is Default, which causes a build-time error to be emitted if members are not annotated with ChildAttribute, ReferenceAttribute or ParentAttribute.

See Also

Reference

AggregatableAttribute Class
PostSharp.Patterns.Model Namespace


AggregatableAttribute.IsParentSurrogate Property

AggregatableAttributeIsParentSurrogate Property

Determines whether instances of the target class of this custom attribute are parent surrogates.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsParentSurrogate { get; set; }

Property Value

Type: Boolean
Remarks

If this property is set, the IsParentSurrogate property of the ChildAttribute class cannot be used.

See Also

Reference

AggregatableAttribute Class
PostSharp.Patterns.Model Namespace

Other Resources

Conceptual: Working With Child Collections


AggregatableAttribute.IsParentSurrogateSpecified Property

AggregatableAttributeIsParentSurrogateSpecified Property

Determines whether the IsParentSurrogate property has been set.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsParentSurrogateSpecified { get; }

Property Value

Type: Boolean
See Also

Reference

AggregatableAttribute Class
PostSharp.Patterns.Model Namespace


AggregatableAttribute Methods

The AggregatableAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype. (Inherited from InstanceLevelAspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnCloned | Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object. (Inherited from InstanceLevelAspect.)
Public method | RuntimeInitializeInstance | Initializes the aspect instance. This method is invoked when all system elements of the aspect (like member imports) have completed. (Inherited from InstanceLevelAspect.)
Top
Extension Methods
 | Name | Description
Public Extension Method | GetChildren | Gets the list of children of a specified parent object. (Defined by AggregatableExtensions.)
Public Extension Method | GetDistinctChildren | Gets a list of distinct children of a specified parent object. (Defined by AggregatableExtensions.)
Public Extension Method | IsDescendantOf | Determines whether a specified object is a descendant of a specified ancestor. (Defined by AggregatableExtensions.)
Public Extension Method | VisitSelfAndDescendants | Executes a ChildVisitor for the a specified parent object and all its descendants. (Defined by AggregatableExtensions.)
Top
See Also

Reference

AggregatableAttribute Class
PostSharp.Patterns.Model Namespace


AggregatableClientAttribute Class

Base class for aspects that consume functionalities from the AggregatableAttribute aspect. This class provides functionalities to advise and unadvise children.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsTypeLevelAspect
PostSharp.AspectsInstanceLevelAspect
PostSharp.Patterns.ModelAggregatableClientAttribute
PostSharp.Patterns.ModelDisposableAttribute
PostSharp.Patterns.ThreadingThreadAwareAttribute

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class AggregatableClientAttribute : InstanceLevelAspect,
    IAspectProvider, IAspect, IService, IAdviceProvider

The AggregatableClientAttribute type exposes the following members.

Constructors
 | Name | Description
Protected method | AggregatableClientAttribute | Initializes a new instance of the AggregatableClientAttribute class
Top
Properties
 | Name | Description
Protected property | AppliedToCurrentType | Determines if the current custom attribute instance has been applied to the type of the target instance. This value is false if the custom attribute has been applied to a base type.
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | InitializationStatus | Gets the current AggregatableClientAttributeAspectInitializationStatus of the current aspect.
Public property | Instance | Gets the object to which the current aspect has been applied. (Inherited from InstanceLevelAspect.)
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Protected method | Advise | Injects the advice into the child object.
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Overrides TypeLevelAspectCompileTimeInitialize(Type, AspectInfo).)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Inherited from InstanceLevelAspect.)
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype. (Inherited from InstanceLevelAspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Protected method | IsEligibleChild | Determines if an object is eligible to be a child of the target instance of the current aspect.
Public method | OnCloned | Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object. (Inherited from InstanceLevelAspect.)
Public method | OnInstanceConstructed | Executed when the target instance gets fully initialized, i.e. just after all constructors have completed.
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from TypeLevelAspect.)
Public method | RuntimeInitializeInstance | Initializes the aspect instance. This method is invoked when all system elements of the aspect (like member imports) have completed. (Inherited from InstanceLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from TypeLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, Type) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from TypeLevelAspect.)
Top
See Also

Reference

PostSharp.Patterns.Model Namespace


AggregatableClientAttribute Constructor

Initializes a new instance of the AggregatableClientAttribute class

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected AggregatableClientAttribute()
See Also

Reference

AggregatableClientAttribute Class
PostSharp.Patterns.Model Namespace


AggregatableClientAttribute Properties

The AggregatableClientAttribute type exposes the following members.

Properties
 | Name | Description
Protected property | AppliedToCurrentType | Determines if the current custom attribute instance has been applied to the type of the target instance. This value is false if the custom attribute has been applied to a base type.
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | InitializationStatus | Gets the current AggregatableClientAttributeAspectInitializationStatus of the current aspect.
Public property | Instance | Gets the object to which the current aspect has been applied. (Inherited from InstanceLevelAspect.)
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

AggregatableClientAttribute Class
PostSharp.Patterns.Model Namespace


AggregatableClientAttribute.AppliedToCurrentType Property

AggregatableClientAttributeAppliedToCurrentType Property

Determines if the current custom attribute instance has been applied to the type of the target instance. This value is false if the custom attribute has been applied to a base type.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected bool AppliedToCurrentType { get; }

Property Value

Type: Boolean
See Also

Reference

AggregatableClientAttribute Class
PostSharp.Patterns.Model Namespace


AggregatableClientAttribute.InitializationStatus Property

AggregatableClientAttributeInitializationStatus Property

Gets the current AggregatableClientAttributeAspectInitializationStatus of the current aspect.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected AggregatableClientAttributeAspectInitializationStatus InitializationStatus { get; }

Property Value

Type: AggregatableClientAttributeAspectInitializationStatus
See Also

Reference

AggregatableClientAttribute Class
PostSharp.Patterns.Model Namespace


AggregatableClientAttribute Methods

The AggregatableClientAttribute type exposes the following members.

Methods
 | Name | Description
Protected method | Advise | Injects the advice into the child object.
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Overrides TypeLevelAspectCompileTimeInitialize(Type, AspectInfo).)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Inherited from InstanceLevelAspect.)
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype. (Inherited from InstanceLevelAspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Protected method | IsEligibleChild | Determines if an object is eligible to be a child of the target instance of the current aspect.
Public method | OnCloned | Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object. (Inherited from InstanceLevelAspect.)
Public method | OnInstanceConstructed | Executed when the target instance gets fully initialized, i.e. just after all constructors have completed.
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from TypeLevelAspect.)
Public method | RuntimeInitializeInstance | Initializes the aspect instance. This method is invoked when all system elements of the aspect (like member imports) have completed. (Inherited from InstanceLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from TypeLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, Type) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from TypeLevelAspect.)
Top
See Also

Reference

AggregatableClientAttribute Class
PostSharp.Patterns.Model Namespace


AggregatableClientAttribute.Advise Method

AggregatableClientAttributeAdvise Method

Injects the advice into the child object.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected abstract bool Advise(
    Object obj
)

Parameters

obj
Type: SystemObject

Return Value

Type: Boolean
true if the children of obj have to be advised as well, false otherwise.
See Also

Reference

AggregatableClientAttribute Class
PostSharp.Patterns.Model Namespace


AggregatableClientAttribute.CompileTimeInitialize Method

AggregatableClientAttributeCompileTimeInitialize Method

Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void CompileTimeInitialize(
    Type type,
    AspectInfo aspectInfo
)

Parameters

type
Type: SystemType
Type to which the current aspect is applied
aspectInfo
Type: PostSharp.AspectsAspectInfo
Reserved for future usage.

Implements

ITypeLevelAspectBuildSemanticsCompileTimeInitialize(Type, AspectInfo)
See Also

Reference

AggregatableClientAttribute Class
PostSharp.Patterns.Model Namespace

Other Resources

Conceptual: Initializing Aspects


AggregatableClientAttribute.IsEligibleChild Method

AggregatableClientAttributeIsEligibleChild Method

Determines if an object is eligible to be a child of the target instance of the current aspect.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected abstract bool IsEligibleChild(
    Object child,
    ChildInfo childInfo
)

Parameters

child
Type: SystemObject
childInfo
Type: PostSharp.Patterns.ModelChildInfo

Return Value

Type: Boolean
true if child is eligible to be a child without injecting any advice, otherwise false. When this method returns false, the aspect will the invoke the Advise(Object) method.
See Also

Reference

AggregatableClientAttribute Class
PostSharp.Patterns.Model Namespace


AggregatableClientAttribute.OnInstanceConstructed Method

AggregatableClientAttributeOnInstanceConstructed Method

Executed when the target instance gets fully initialized, i.e. just after all constructors have completed.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void OnInstanceConstructed()
See Also

Reference

AggregatableClientAttribute Class
PostSharp.Patterns.Model Namespace


AggregatableClientAttribute.AspectInitializationStatus Enumeration

AggregatableClientAttributeAspectInitializationStatus Enumeration

Possible values for the InitializationStatus property.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected enum AspectInitializationStatus
Members
Member name | Value | Description
Uninitialized | 0 | Uninitialized.
Initialized | 1 | The aspect is initialized, but the constructor of the target class did not complete yet.
Constructed | 2 | The constructor of the target class completed.
Finalizing | 3 | The object finalizer has been invoked.
See Also

Reference

PostSharp.Patterns.Model Namespace


AggregatableExtensions Class

Provides extension methods to the IAggregatable interface.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.ModelAggregatableExtensions

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static class AggregatableExtensions

The AggregatableExtensions type exposes the following members.

Methods
Name | Description
GetChildren | Gets the list of children of a specified parent object.
GetDistinctChildren | Gets a list of distinct children of a specified parent object.
IsDescendantOf | Determines whether a specified object is a descendant of a specified ancestor.
VisitSelfAndDescendants | Executes a ChildVisitor for the a specified parent object and all its descendants.
Top
See Also

Reference

PostSharp.Patterns.Model Namespace


AggregatableExtensions Methods

The AggregatableExtensions type exposes the following members.

Methods
Name | Description
GetChildren | Gets the list of children of a specified parent object.
GetDistinctChildren | Gets a list of distinct children of a specified parent object.
IsDescendantOf | Determines whether a specified object is a descendant of a specified ancestor.
VisitSelfAndDescendants | Executes a ChildVisitor for the a specified parent object and all its descendants.
Top
See Also

Reference

AggregatableExtensions Class
PostSharp.Patterns.Model Namespace


AggregatableExtensions.GetChildren Method

AggregatableExtensionsGetChildren Method

Gets the list of children of a specified parent object.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static IList<Object> GetChildren(
    this IAggregatable parent,
    ChildVisitorOptions options = ChildVisitorOptions.None
)

Parameters

parent
Type: PostSharp.Patterns.ModelIAggregatable
The parent object.
options (Optional)
Type: PostSharp.Patterns.ModelChildVisitorOptions
Options.

Return Value

Type: IList Object
A list of children.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IAggregatable. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks

This list may contain duplicates if an object has several parent-child relationships to the same parent. Use GetDistinctChildren(IAggregatable, ChildVisitorOptions) to get a list of distinct children.

See Also

Reference

AggregatableExtensions Class
PostSharp.Patterns.Model Namespace


AggregatableExtensions.GetDistinctChildren Method

AggregatableExtensionsGetDistinctChildren Method

Gets a list of distinct children of a specified parent object.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static HashSet<Object> GetDistinctChildren(
    this IAggregatable parent,
    ChildVisitorOptions options = ChildVisitorOptions.None
)

Parameters

parent
Type: PostSharp.Patterns.ModelIAggregatable
The parent object.
options (Optional)
Type: PostSharp.Patterns.ModelChildVisitorOptions
Options.

Return Value

Type: HashSet Object

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IAggregatable. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

AggregatableExtensions Class
PostSharp.Patterns.Model Namespace


AggregatableExtensions.IsDescendantOf Method

AggregatableExtensionsIsDescendantOf Method

Determines whether a specified object is a descendant of a specified ancestor.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool IsDescendantOf(
    this IAggregatable child,
    Object ancestor
)

Parameters

child
Type: PostSharp.Patterns.ModelIAggregatable
The child object.
ancestor
Type: SystemObject
The ancestor object.

Return Value

Type: Boolean
true if child is a descendant of ancestor, otherwise false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IAggregatable. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

AggregatableExtensions Class
PostSharp.Patterns.Model Namespace


AggregatableExtensions.VisitSelfAndDescendants Method

AggregatableExtensionsVisitSelfAndDescendants Method

Executes a ChildVisitor for the a specified parent object and all its descendants.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool VisitSelfAndDescendants(
    this IAggregatable parent,
    DescendantVisitor visitor,
    ChildVisitorOptions options = ChildVisitorOptions.None,
    Object state = null
)

Parameters

parent
Type: PostSharp.Patterns.ModelIAggregatable
The parent object.
visitor
Type: PostSharp.Patterns.ModelDescendantVisitor
The action to execute.
options (Optional)
Type: PostSharp.Patterns.ModelChildVisitorOptions
Options.
state (Optional)
Type: SystemObject

Return Value

Type: Boolean

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IAggregatable. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

AggregatableExtensions Class
PostSharp.Patterns.Model Namespace


AggregatableServices Class

Provide static methods to aid with implementation of the IAggregatable interface.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.ModelAggregatableServices

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static class AggregatableServices

The AggregatableServices type exposes the following members.

Methods
Name | Description
Advice(Object, RelationshipInfo, Boolean) | Injects the Aggregatable dynamic impl into an object and specifies the RelationshipInfo.
Advice(Object, RelationshipKind, Boolean) | Injects the Aggregatable dynamic impl into an object and specifies the RelationshipKind.
GetAggregatableAspect | Gets the AggregatableAttribute instance applied on a given Type.
Unadvise | Removes the Aggregatable advise from an object.
Top
See Also

Reference

PostSharp.Patterns.Model Namespace


AggregatableServices Methods

The AggregatableServices type exposes the following members.

Methods
Name | Description
Advice(Object, RelationshipInfo, Boolean) | Injects the Aggregatable dynamic impl into an object and specifies the RelationshipInfo.
Advice(Object, RelationshipKind, Boolean) | Injects the Aggregatable dynamic impl into an object and specifies the RelationshipKind.
GetAggregatableAspect | Gets the AggregatableAttribute instance applied on a given Type.
Unadvise | Removes the Aggregatable advise from an object.
Top
See Also

Reference

AggregatableServices Class
PostSharp.Patterns.Model Namespace


AggregatableServices.Advice Method

AggregatableServicesAdvice Method

Overload List
Name | Description
Advice(Object, RelationshipInfo, Boolean) | Injects the Aggregatable dynamic impl into an object and specifies the RelationshipInfo.
Advice(Object, RelationshipKind, Boolean) | Injects the Aggregatable dynamic impl into an object and specifies the RelationshipKind.
Top
See Also

Reference

AggregatableServices Class
PostSharp.Patterns.Model Namespace


AggregatableServices.Advice Method (Object, RelationshipInfo, Boolean)

AggregatableServicesAdvice Method (Object, RelationshipInfo, Boolean)

Injects the Aggregatable dynamic impl into an object and specifies the RelationshipInfo.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool Advice(
    Object obj,
    RelationshipInfo relationshipInfo,
    bool required = true
)

Parameters

obj
Type: SystemObject
The object into which the impl must be injected.
relationshipInfo
Type: PostSharp.Patterns.ModelRelationshipInfo
The description of the relationship of obj relatively to its parent.
required (Optional)
Type: SystemBoolean
true if an InvalidOperationException should be thrown in case obj cannot be dynamically advised, otherwise false.

Return Value

Type: Boolean
true if the Aggregatable impl was successfully injected into obj, false if obj already implemented the impl, or if obj cannot be dynamically advised and required is false.
See Also

Reference

AggregatableServices Class
Advice Overload
PostSharp.Patterns.Model Namespace


AggregatableServices.Advice Method (Object, RelationshipKind, Boolean)

AggregatableServicesAdvice Method (Object, RelationshipKind, Boolean)

Injects the Aggregatable dynamic impl into an object and specifies the RelationshipKind.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool Advice(
    Object obj,
    RelationshipKind itemsRelationship,
    bool required = true
)

Parameters

obj
Type: SystemObject
The object into which the impl must be injected.
itemsRelationship
Type: PostSharp.Patterns.ModelRelationshipKind
The description of the relationship of obj relatively to its parent.
required (Optional)
Type: SystemBoolean
true if an InvalidOperationException should be thrown in case obj cannot be dynamically advised, otherwise false.

Return Value

Type: Boolean
true if the Aggregatable impl was successfully injected into obj, false if obj already implemented the impl, or if obj cannot be dynamically advised and required is false.
See Also

Reference

AggregatableServices Class
Advice Overload
PostSharp.Patterns.Model Namespace


AggregatableServices.GetAggregatableAspect Method

AggregatableServicesGetAggregatableAspect Method

Gets the AggregatableAttribute instance applied on a given Type.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static AggregatableAttribute GetAggregatableAspect(
    Type type,
    bool throwing = true
)

Parameters

type
Type: SystemType
The type.
throwing (Optional)
Type: SystemBoolean
true if an exception should be thrown if type does not have an AggregatableAttribute, otherwise false.

Return Value

Type: AggregatableAttribute
The AggregatableAttribute found on type
See Also

Reference

AggregatableServices Class
PostSharp.Patterns.Model Namespace


AggregatableServices.Unadvise Method

AggregatableServicesUnadvise Method

Removes the Aggregatable advise from an object.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool Unadvise(
    Object obj
)

Parameters

obj
Type: SystemObject
An AdvisableCollectionT or AdvisableDictionaryTKey, TValue,

Return Value

Type: Boolean
true if the impl was removed from obj, false if obj did not have the Aggregatable impl.
See Also

Reference

AggregatableServices Class
PostSharp.Patterns.Model Namespace


AggregateAllChangesAttribute Class

Custom attribute that, when applied to a property of a class enhanced with the NotifyPropertyChangedAttribute, specifies that a change of any property of the property value will be considered as a change of the property itself.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Patterns.ModelAggregateAllChangesAttribute

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class AggregateAllChangesAttribute : Attribute

The AggregateAllChangesAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | AggregateAllChangesAttribute | Initializes a new instance of the AggregateAllChangesAttribute class
Top
Remarks

This attribute can currently only be used on properties of types derived from ICollection or ICollectionT, and only notifications of the property named Item[] will currently be considered.

See Also

Reference

PostSharp.Patterns.Model Namespace


AggregateAllChangesAttribute Constructor

Initializes a new instance of the AggregateAllChangesAttribute class

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AggregateAllChangesAttribute()
See Also

Reference

AggregateAllChangesAttribute Class
PostSharp.Patterns.Model Namespace


AncestorChangedEventArgs Class

Arguments of the AncestorChanged event.
Inheritance Hierarchy
SystemObject
SystemEventArgs
PostSharp.Patterns.ModelAncestorChangedEventArgs

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class AncestorChangedEventArgs : EventArgs

The AncestorChangedEventArgs type exposes the following members.

Constructors
 | Name | Description
Public method | AncestorChangedEventArgs | Initializes a new instance of the AncestorChangedEventArgs class.
Top
Properties
 | Name | Description
Public property | Child | Gets the child object.
Top
See Also

Reference

PostSharp.Patterns.Model Namespace


AncestorChangedEventArgs Constructor

Initializes a new instance of the AncestorChangedEventArgs class.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AncestorChangedEventArgs(
    Object child
)

Parameters

child
Type: SystemObject
The child object.
See Also

Reference

AncestorChangedEventArgs Class
PostSharp.Patterns.Model Namespace


AncestorChangedEventArgs Properties

The AncestorChangedEventArgs type exposes the following members.

Properties
 | Name | Description
Public property | Child | Gets the child object.
Top
See Also

Reference

AncestorChangedEventArgs Class
PostSharp.Patterns.Model Namespace


AncestorChangedEventArgs.Child Property

AncestorChangedEventArgsChild Property

Gets the child object.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Object Child { get; }

Property Value

Type: Object
See Also

Reference

AncestorChangedEventArgs Class
PostSharp.Patterns.Model Namespace


ChildAttribute Class

Custom attribute that, when applied to a field or automatic property, specifies that the object assigned to this field or property is a child of the instance of the declaring type.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Patterns.ModelMemberRelationshipAttribute
PostSharp.Patterns.ModelChildAttribute

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ChildAttribute : MemberRelationshipAttribute

The ChildAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | ChildAttribute | Initializes a new instance of the ChildAttribute class.
Top
Properties
 | Name | Description
Public property | DisableBehaviorPropagation | Determines whether the behaviors applied to the declaring type of the target field should be applied to the object assigned this field. The default value of this property is false, which means that behaviors such as Recordable or threading models will be applied to children (resulting in build- or run-time exception if it is not possible). When it is set to true, behaviors will not be propagated. When applied to a field of collection type, the value applies to collection items.
Public property | DisableBuildTimeValidation | Determines whether the type of the target field or property should be validated at build-time against the rules of aspects that rely on the Aggregatable model, such as the Recordable aspect or the threading model aspects. If this property is set to true, validation will be performed at runtime only.
Public property | IsParentSurrogate | Determines whether the value assigned to the field or property is a parent surrogate. The Parent property of children of a parent surrogate are set to the parent of the parent surrogate, instead of to the field itself.
Public property | ItemsRelationship | Determines the kind of relationship between items
Top
Methods
 | Name | Description
Public method | CompileTimeValidate | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MemberRelationshipAttribute.)
Top
See Also

Reference

PostSharp.Patterns.Model Namespace
PostSharp.Patterns.ModelReferenceAttribute
PostSharp.Patterns.ModelParentAttribute
PostSharp.Patterns.ModelAggregatableAttribute

Other Resources

Conceptual: Actor Threading Model
Conceptual: Annotating an Object Model for Parent/Child Relationships (Aggregatable)
Conceptual: Enumerating Child Objects (Visitor)
Conceptual: Freezable Threading Model
Conceptual: Immutable Threading Model
Conceptual: Parent/Child, Visitor and Disposable
Conceptual: Rule-Based Annotation
Conceptual: Synchronized Threading Model
Conceptual: Thread Affine Threading Model
Conceptual: Working With Child Collections


ChildAttribute Constructor

Initializes a new instance of the ChildAttribute class.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ChildAttribute()
See Also

Reference

ChildAttribute Class
PostSharp.Patterns.Model Namespace


ChildAttribute Properties

The ChildAttribute type exposes the following members.

Properties
 | Name | Description
Public property | DisableBehaviorPropagation | Determines whether the behaviors applied to the declaring type of the target field should be applied to the object assigned this field. The default value of this property is false, which means that behaviors such as Recordable or threading models will be applied to children (resulting in build- or run-time exception if it is not possible). When it is set to true, behaviors will not be propagated. When applied to a field of collection type, the value applies to collection items.
Public property | DisableBuildTimeValidation | Determines whether the type of the target field or property should be validated at build-time against the rules of aspects that rely on the Aggregatable model, such as the Recordable aspect or the threading model aspects. If this property is set to true, validation will be performed at runtime only.
Public property | IsParentSurrogate | Determines whether the value assigned to the field or property is a parent surrogate. The Parent property of children of a parent surrogate are set to the parent of the parent surrogate, instead of to the field itself.
Public property | ItemsRelationship | Determines the kind of relationship between items
Top
See Also

Reference

ChildAttribute Class
PostSharp.Patterns.Model Namespace


ChildAttribute.DisableBehaviorPropagation Property

ChildAttributeDisableBehaviorPropagation Property

Determines whether the behaviors applied to the declaring type of the target field should be applied to the object assigned this field. The default value of this property is false, which means that behaviors such as Recordable or threading models will be applied to children (resulting in build- or run-time exception if it is not possible). When it is set to true, behaviors will not be propagated. When applied to a field of collection type, the value applies to collection items.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool DisableBehaviorPropagation { get; set; }

Property Value

Type: Boolean
See Also

Reference

ChildAttribute Class
PostSharp.Patterns.Model Namespace


ChildAttribute.DisableBuildTimeValidation Property

ChildAttributeDisableBuildTimeValidation Property

Determines whether the type of the target field or property should be validated at build-time against the rules of aspects that rely on the Aggregatable model, such as the Recordable aspect or the threading model aspects. If this property is set to true, validation will be performed at runtime only.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool DisableBuildTimeValidation { get; set; }

Property Value

Type: Boolean
See Also

Reference

ChildAttribute Class
PostSharp.Patterns.Model Namespace


ChildAttribute.IsParentSurrogate Property

ChildAttributeIsParentSurrogate Property

Determines whether the value assigned to the field or property is a parent surrogate. The Parent property of children of a parent surrogate are set to the parent of the parent surrogate, instead of to the field itself.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsParentSurrogate { get; set; }

Property Value

Type: Boolean
Remarks

When an item is attached to a parent surrogate, the Parent property of the item is set to the Parent of the parent surrogate, instead of the parent surrogate itself. Collections are typical examples of a parent surrogate, because the parent of collection items need to be the owner of the collection and not the collection itself.

The default value of this field is true for collections, and false otherwise.

See Also

Reference

ChildAttribute Class
PostSharp.Patterns.Model Namespace

Other Resources

Conceptual: Working With Child Collections


ChildAttribute.ItemsRelationship Property

ChildAttributeItemsRelationship Property

Determines the kind of relationship between items

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public RelationshipKind ItemsRelationship { get; set; }

Property Value

Type: RelationshipKind
See Also

Reference

ChildAttribute Class
PostSharp.Patterns.Model Namespace

Other Resources

Conceptual: Annotating an Object Model for Parent/Child Relationships (Aggregatable)
Conceptual: Working With Child Collections


ChildAttribute Methods

The ChildAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeValidate | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MemberRelationshipAttribute.)
Top
See Also

Reference

ChildAttribute Class
PostSharp.Patterns.Model Namespace


ChildInfo Class

Describes a location (typically a field or collection item) on which a child can be attached to a parent.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.ModelChildInfo

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ChildInfo

The ChildInfo type exposes the following members.

Constructors
 | Name | Description
Public method | ChildInfo(FieldInfo, RelationshipInfo) | Initializes a new instance of the ChildInfo that represents a field.
Public method | ChildInfo(String, Type, RelationshipInfo) | Initializes a new instance of the ChildInfo that represents a collection item or a custom location.
Top
Properties
 | Name | Description
Public property | BuildTimeVerificationDisabled | Determines whether aspects relying on AggregatableAttribute should verify the field at build time. This property is only relevant at build time.
Public property | DeclarationIdentifier | Gets the DeclarationIdentifier of the field where the child is stored, or Null if the current ChildInfo does not represent a field.
Public property | LocationName | Gets the name of the location to which the child is assigned.
Public property | LocationType | Gets the type of the location to which the child is assigned.
Public property | RelationshipInfo | Describes the kind of relationship between the child and its parent.
Top
See Also

Reference

PostSharp.Patterns.Model Namespace


ChildInfo Constructor

Overload List
 | Name | Description
Public method | ChildInfo(FieldInfo, RelationshipInfo) | Initializes a new instance of the ChildInfo that represents a field.
Public method | ChildInfo(String, Type, RelationshipInfo) | Initializes a new instance of the ChildInfo that represents a collection item or a custom location.
Top
See Also

Reference

ChildInfo Class
PostSharp.Patterns.Model Namespace


ChildInfo Constructor (FieldInfo, RelationshipInfo)

Initializes a new instance of the ChildInfo that represents a field.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ChildInfo(
    FieldInfo field,
    RelationshipInfo relationshipInfo
)

Parameters

field
Type: System.ReflectionFieldInfo
A field.
relationshipInfo
Type: PostSharp.Patterns.ModelRelationshipInfo
A RelationshipInfo instance that describes the kind of relationship of the child object to its direct parent.
See Also

Reference

ChildInfo Class
ChildInfo Overload
PostSharp.Patterns.Model Namespace


ChildInfo Constructor (String, Type, RelationshipInfo)

Initializes a new instance of the ChildInfo that represents a collection item or a custom location.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ChildInfo(
    string locationName,
    Type locationType,
    RelationshipInfo relationshipInfo
)

Parameters

locationName
Type: SystemString
Name of the location, for instance Item for a collection item.
locationType
Type: SystemType
Type of the location.
relationshipInfo
Type: PostSharp.Patterns.ModelRelationshipInfo
A RelationshipInfo instance that describes the kind of relationship of the child object to its direct parent.
See Also

Reference

ChildInfo Class
ChildInfo Overload
PostSharp.Patterns.Model Namespace


ChildInfo Properties

The ChildInfo type exposes the following members.

Properties
 | Name | Description
Public property | BuildTimeVerificationDisabled | Determines whether aspects relying on AggregatableAttribute should verify the field at build time. This property is only relevant at build time.
Public property | DeclarationIdentifier | Gets the DeclarationIdentifier of the field where the child is stored, or Null if the current ChildInfo does not represent a field.
Public property | LocationName | Gets the name of the location to which the child is assigned.
Public property | LocationType | Gets the type of the location to which the child is assigned.
Public property | RelationshipInfo | Describes the kind of relationship between the child and its parent.
Top
See Also

Reference

ChildInfo Class
PostSharp.Patterns.Model Namespace


ChildInfo.BuildTimeVerificationDisabled Property

ChildInfoBuildTimeVerificationDisabled Property

Determines whether aspects relying on AggregatableAttribute should verify the field at build time. This property is only relevant at build time.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool BuildTimeVerificationDisabled { get; }

Property Value

Type: Boolean
See Also

Reference

ChildInfo Class
PostSharp.Patterns.Model Namespace


ChildInfo.DeclarationIdentifier Property

ChildInfoDeclarationIdentifier Property

Gets the DeclarationIdentifier of the field where the child is stored, or Null if the current ChildInfo does not represent a field.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public DeclarationIdentifier DeclarationIdentifier { get; }

Property Value

Type: DeclarationIdentifier
See Also

Reference

ChildInfo Class
PostSharp.Patterns.Model Namespace


ChildInfo.LocationName Property

ChildInfoLocationName Property

Gets the name of the location to which the child is assigned.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string LocationName { get; }

Property Value

Type: String
Remarks

This property should be only used to generate texts of error messages for developers (such as exceptions). It is not meant as a mechanism to uniquely identify the location (use DeclarationIdentifier for this purpose) or to generate messages for the end-user.

See Also

Reference

ChildInfo Class
PostSharp.Patterns.Model Namespace


ChildInfo.LocationType Property

ChildInfoLocationType Property

Gets the type of the location to which the child is assigned.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Type LocationType { get; }

Property Value

Type: Type
See Also

Reference

ChildInfo Class
PostSharp.Patterns.Model Namespace


ChildInfo.RelationshipInfo Property

ChildInfoRelationshipInfo Property

Describes the kind of relationship between the child and its parent.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public RelationshipInfo RelationshipInfo { get; }

Property Value

Type: RelationshipInfo
See Also

Reference

ChildInfo Class
PostSharp.Patterns.Model Namespace


ChildVisitor Delegate

Encapsulates a method that is invoked by the VisitChildren(ChildVisitor, ChildVisitorOptions, Object) method.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public delegate bool ChildVisitor(
    Object child,
    ChildInfo childInfo,
    Object state
)

Parameters

child
Type: SystemObject
The object being visited.
childInfo
Type: PostSharp.Patterns.ModelChildInfo
Describes the field or other location to which the child is assigned.
state
Type: SystemObject
An opaque state object that was requested to be passed to this delegate.

Return Value

Type: Boolean
true to instruct the VisitChildren(ChildVisitor, ChildVisitorOptions, Object) implementation to continue enumerating other children, false to instruct the VisitChildren(ChildVisitor, ChildVisitorOptions, Object) implementation to immediately return the false value without enumerating other children.
See Also

Reference

PostSharp.Patterns.Model Namespace

Other Resources

Conceptual: Working With Child Collections


ChildVisitorOptions Enumeration

Options for the VisitChildren(ChildVisitor, ChildVisitorOptions, Object) and VisitSelfAndDescendants(IAggregatable, DescendantVisitor, ChildVisitorOptions, Object) methods.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[FlagsAttribute]
public enum ChildVisitorOptions
Members
Member name | Value | Description
None | 0 | Enumerates all children, but ignore parent surrogates.
IncludeParentSurrogates | 1 | Include parent surrogates.
ExcludeIndirectChildren | 2 | Exclude children of parent surrogates.
AcquireUpgradableReaderAccess | 4 | Acquires upgradable reader access instead of just reader access.
See Also

Reference

PostSharp.Patterns.Model Namespace

Other Resources

Conceptual: Working With Child Collections


Depends Class

Provides a way to specify dependencies of a method to properties or chains of properties. This class should be used from methods marked with the SafeForDependencyAnalysisAttribute custom attribute.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.ModelDepends

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static class Depends

The Depends type exposes the following members.

Methods
Name | Description
On(Object) | Specifies an explicit dependency between the calling method and the argument passed to this method.
On(Object, Object) | Specifies an explicit dependency between the calling method and the arguments passed to this method.
On(Object, Object, Object) | Specifies an explicit dependency between the calling method and the arguments passed to this method.
On(Object, Object, Object, Object) | Specifies an explicit dependency between the calling method and the arguments passed to this method.
On(Object, Object, Object, Object, Object) | Specifies an explicit dependency between the calling method and the arguments passed to this method.
On(Object, Object, Object, Object, Object, Object) | Specifies an explicit dependency between the calling method and the arguments passed to this method.
On(Object, Object, Object, Object, Object, Object, Object) | Specifies an explicit dependency between the calling method and the arguments passed to this method.
On(Object, Object, Object, Object, Object, Object, Object, Object) | Specifies an explicit dependency between the calling method and the arguments passed to this method.
On(Object, Object, Object, Object, Object, Object, Object, Object, Object) | Specifies an explicit dependency between the calling method and the arguments passed to this method.
On(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object) | Specifies an explicit dependency between the calling method and the arguments passed to this method.
Top
Fields
Name | Description
Guard | A Boolean value that is always false.
Top
Remarks

Members of this class are considered metadata-only. They are used only at build time, where their arguments are decompiled. They have no runtime effect. For performance reason, it is preferable to skip their runtime execution. This can be achieved by using the Guard field in the construct:

Copy
if ( Depends.Guard )
{
  Depends.On(this.foo.Bar);
}
See Also

Reference

PostSharp.Patterns.Model Namespace

Other Resources

Conceptual: Handling Corner Cases of the NotifyPropertyChanged Aspect


Depends Methods

Methods
Name | Description
On(Object) | Specifies an explicit dependency between the calling method and the argument passed to this method.
On(Object, Object) | Specifies an explicit dependency between the calling method and the arguments passed to this method.
On(Object, Object, Object) | Specifies an explicit dependency between the calling method and the arguments passed to this method.
On(Object, Object, Object, Object) | Specifies an explicit dependency between the calling method and the arguments passed to this method.
On(Object, Object, Object, Object, Object) | Specifies an explicit dependency between the calling method and the arguments passed to this method.
On(Object, Object, Object, Object, Object, Object) | Specifies an explicit dependency between the calling method and the arguments passed to this method.
On(Object, Object, Object, Object, Object, Object, Object) | Specifies an explicit dependency between the calling method and the arguments passed to this method.
On(Object, Object, Object, Object, Object, Object, Object, Object) | Specifies an explicit dependency between the calling method and the arguments passed to this method.
On(Object, Object, Object, Object, Object, Object, Object, Object, Object) | Specifies an explicit dependency between the calling method and the arguments passed to this method.
On(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object) | Specifies an explicit dependency between the calling method and the arguments passed to this method.
Top
See Also

Reference

Depends Class
PostSharp.Patterns.Model Namespace


Depends.On Method

DependsOn Method

Overload List
Name | Description
On(Object) | Specifies an explicit dependency between the calling method and the argument passed to this method.
On(Object, Object) | Specifies an explicit dependency between the calling method and the arguments passed to this method.
On(Object, Object, Object) | Specifies an explicit dependency between the calling method and the arguments passed to this method.
On(Object, Object, Object, Object) | Specifies an explicit dependency between the calling method and the arguments passed to this method.
On(Object, Object, Object, Object, Object) | Specifies an explicit dependency between the calling method and the arguments passed to this method.
On(Object, Object, Object, Object, Object, Object) | Specifies an explicit dependency between the calling method and the arguments passed to this method.
On(Object, Object, Object, Object, Object, Object, Object) | Specifies an explicit dependency between the calling method and the arguments passed to this method.
On(Object, Object, Object, Object, Object, Object, Object, Object) | Specifies an explicit dependency between the calling method and the arguments passed to this method.
On(Object, Object, Object, Object, Object, Object, Object, Object, Object) | Specifies an explicit dependency between the calling method and the arguments passed to this method.
On(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object) | Specifies an explicit dependency between the calling method and the arguments passed to this method.
Top
See Also

Reference

Depends Class
PostSharp.Patterns.Model Namespace


Depends.On Method (Object)

DependsOn Method (Object)

Specifies an explicit dependency between the calling method and the argument passed to this method.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void On(
    Object dependency1
)

Parameters

dependency1
Type: SystemObject
See Also

Reference

Depends Class
On Overload
PostSharp.Patterns.Model Namespace


Depends.On Method (Object, Object)

DependsOn Method (Object, Object)

Specifies an explicit dependency between the calling method and the arguments passed to this method.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void On(
    Object dependency1,
    Object dependency2
)

Parameters

dependency1
Type: SystemObject
dependency2
Type: SystemObject
See Also

Reference

Depends Class
On Overload
PostSharp.Patterns.Model Namespace


Depends.On Method (Object, Object, Object)

DependsOn Method (Object, Object, Object)

Specifies an explicit dependency between the calling method and the arguments passed to this method.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void On(
    Object dependency1,
    Object dependency2,
    Object dependency3
)

Parameters

dependency1
Type: SystemObject
dependency2
Type: SystemObject
dependency3
Type: SystemObject
See Also

Reference

Depends Class
On Overload
PostSharp.Patterns.Model Namespace


Depends.On Method (Object, Object, Object, Object)

DependsOn Method (Object, Object, Object, Object)

Specifies an explicit dependency between the calling method and the arguments passed to this method.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void On(
    Object dependency1,
    Object dependency2,
    Object dependency3,
    Object dependency4
)

Parameters

dependency1
Type: SystemObject
dependency2
Type: SystemObject
dependency3
Type: SystemObject
dependency4
Type: SystemObject
See Also

Reference

Depends Class
On Overload
PostSharp.Patterns.Model Namespace


Depends.On Method (Object, Object, Object, Object, Object)

DependsOn Method (Object, Object, Object, Object, Object)

Specifies an explicit dependency between the calling method and the arguments passed to this method.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void On(
    Object dependency1,
    Object dependency2,
    Object dependency3,
    Object dependency4,
    Object dependency5
)

Parameters

dependency1
Type: SystemObject
dependency2
Type: SystemObject
dependency3
Type: SystemObject
dependency4
Type: SystemObject
dependency5
Type: SystemObject
See Also

Reference

Depends Class
On Overload
PostSharp.Patterns.Model Namespace


Depends.On Method (Object, Object, Object, Object, Object, Object)

DependsOn Method (Object, Object, Object, Object, Object, Object)

Specifies an explicit dependency between the calling method and the arguments passed to this method.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void On(
    Object dependency1,
    Object dependency2,
    Object dependency3,
    Object dependency4,
    Object dependency5,
    Object dependency6
)

Parameters

dependency1
Type: SystemObject
dependency2
Type: SystemObject
dependency3
Type: SystemObject
dependency4
Type: SystemObject
dependency5
Type: SystemObject
dependency6
Type: SystemObject
See Also

Reference

Depends Class
On Overload
PostSharp.Patterns.Model Namespace


Depends.On Method (Object, Object, Object, Object, Object, Object, Object)

DependsOn Method (Object, Object, Object, Object, Object, Object, Object)

Specifies an explicit dependency between the calling method and the arguments passed to this method.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void On(
    Object dependency1,
    Object dependency2,
    Object dependency3,
    Object dependency4,
    Object dependency5,
    Object dependency6,
    Object dependency7
)

Parameters

dependency1
Type: SystemObject
dependency2
Type: SystemObject
dependency3
Type: SystemObject
dependency4
Type: SystemObject
dependency5
Type: SystemObject
dependency6
Type: SystemObject
dependency7
Type: SystemObject
See Also

Reference

Depends Class
On Overload
PostSharp.Patterns.Model Namespace


Depends.On Method (Object, Object, Object, Object, Object, Object, Object, Object)

DependsOn Method (Object, Object, Object, Object, Object, Object, Object, Object)

Specifies an explicit dependency between the calling method and the arguments passed to this method.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void On(
    Object dependency1,
    Object dependency2,
    Object dependency3,
    Object dependency4,
    Object dependency5,
    Object dependency6,
    Object dependency7,
    Object dependency8
)

Parameters

dependency1
Type: SystemObject
dependency2
Type: SystemObject
dependency3
Type: SystemObject
dependency4
Type: SystemObject
dependency5
Type: SystemObject
dependency6
Type: SystemObject
dependency7
Type: SystemObject
dependency8
Type: SystemObject
See Also

Reference

Depends Class
On Overload
PostSharp.Patterns.Model Namespace


Depends.On Method (Object, Object, Object, Object, Object, Object, Object, Object, Object)

DependsOn Method (Object, Object, Object, Object, Object, Object, Object, Object, Object)

Specifies an explicit dependency between the calling method and the arguments passed to this method.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void On(
    Object dependency1,
    Object dependency2,
    Object dependency3,
    Object dependency4,
    Object dependency5,
    Object dependency6,
    Object dependency7,
    Object dependency8,
    Object dependency9
)

Parameters

dependency1
Type: SystemObject
dependency2
Type: SystemObject
dependency3
Type: SystemObject
dependency4
Type: SystemObject
dependency5
Type: SystemObject
dependency6
Type: SystemObject
dependency7
Type: SystemObject
dependency8
Type: SystemObject
dependency9
Type: SystemObject
See Also

Reference

Depends Class
On Overload
PostSharp.Patterns.Model Namespace


Depends.On Method (Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)

DependsOn Method (Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)

Specifies an explicit dependency between the calling method and the arguments passed to this method.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void On(
    Object dependency1,
    Object dependency2,
    Object dependency3,
    Object dependency4,
    Object dependency5,
    Object dependency6,
    Object dependency7,
    Object dependency8,
    Object dependency9,
    Object dependency10
)

Parameters

dependency1
Type: SystemObject
dependency2
Type: SystemObject
dependency3
Type: SystemObject
dependency4
Type: SystemObject
dependency5
Type: SystemObject
dependency6
Type: SystemObject
dependency7
Type: SystemObject
dependency8
Type: SystemObject
dependency9
Type: SystemObject
dependency10
Type: SystemObject
See Also

Reference

Depends Class
On Overload
PostSharp.Patterns.Model Namespace


Depends Fields

The Depends type exposes the following members.

Fields
Name | Description
Guard | A Boolean value that is always false.
Top
See Also

Reference

Depends Class
PostSharp.Patterns.Model Namespace


Depends.Guard Field

DependsGuard Field

A Boolean value that is always false.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static readonly bool Guard

Field Value

Type: Boolean
See Also

Reference

Depends Class
PostSharp.Patterns.Model Namespace


DescendantVisitor Delegate

Encapsulates a method that is invoked by the VisitSelfAndDescendants(IAggregatable, DescendantVisitor, ChildVisitorOptions, Object) method.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public delegate DescendantVisitorStatus DescendantVisitor(
    Object descendant,
    ChildInfo childInfo,
    Object state
)

Parameters

descendant
Type: SystemObject
The object being visited.
childInfo
Type: PostSharp.Patterns.ModelChildInfo
Describes the field or other location to which the child is assigned.
state
Type: SystemObject
An opaque state object that was requested to be passed to this delegate.

Return Value

Type: DescendantVisitorStatus
A value that determines how the visitor should continue enumerating other objects.
See Also

Reference

PostSharp.Patterns.Model Namespace


DescendantVisitorStatus Enumeration

Type of the return value of ChildVisitor. Determines how the visitor should continue enumerating other objects.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum DescendantVisitorStatus
Members
Member name | Value | Description
Default | 0 | Equivalent to ContinueWithChildren for VisitSelfAndDescendants(IAggregatable, DescendantVisitor, ChildVisitorOptions, Object) or ContinueWithSiblings for VisitChildren(ChildVisitor, ChildVisitorOptions, Object).
Stop | 1 | Immediately stops enumeration and returns to the caller.
ContinueWithChildren | 2 | Continues enumerating the children of the current node, then the sibling nodes. This value is not supported by the VisitChildren(ChildVisitor, ChildVisitorOptions, Object) method.
ContinueWithSiblings | 3 | Continues enumerating the siblings of the current node, but do not enumerate the children nodes.
See Also

Reference

PostSharp.Patterns.Model Namespace


DisposableAttribute Class

Custom attribute that, when applied to a class, implements the IDisposable in such a way that the Dispose method executes the Dispose method for all children objects that also implement the IDisposable interface.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsTypeLevelAspect
PostSharp.AspectsInstanceLevelAspect
PostSharp.Patterns.ModelAggregatableClientAttribute
PostSharp.Patterns.ModelDisposableAttribute

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class DisposableAttribute : AggregatableClientAttribute,
    IDisposable

The DisposableAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | DisposableAttribute | Initializes a new instance of the DisposableAttribute class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | Instance | Gets the object to which the current aspect has been applied. (Inherited from InstanceLevelAspect.)
Public property | ThrowObjectDisposedException | Determines whether an ObjectDisposedException should be thrown when an attempt is made to access an object that has already been disposed.
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from AggregatableClientAttribute.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype. (Inherited from InstanceLevelAspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnCloned | Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object. (Inherited from InstanceLevelAspect.)
Public method | OnInstanceConstructed | Executed when the target instance gets fully initialized, i.e. just after all constructors have completed. (Inherited from AggregatableClientAttribute.)
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from TypeLevelAspect.)
Public method | RuntimeInitializeInstance | Initializes the aspect instance. This method is invoked when all system elements of the aspect (like member imports) have completed. (Inherited from InstanceLevelAspect.)
Top
See Also

Reference

PostSharp.Patterns.Model Namespace

Other Resources

Conceptual: Annotating an Object Model for Parent/Child Relationships (Aggregatable)
Conceptual: Automatically Disposing Children Objects (Disposable)
Conceptual: Parent/Child, Visitor and Disposable
Conceptual: What's New in PostSharp 4.0


DisposableAttribute Constructor

Initializes a new instance of the DisposableAttribute class

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public DisposableAttribute()
See Also

Reference

DisposableAttribute Class
PostSharp.Patterns.Model Namespace


DisposableAttribute Properties

The DisposableAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | Instance | Gets the object to which the current aspect has been applied. (Inherited from InstanceLevelAspect.)
Public property | ThrowObjectDisposedException | Determines whether an ObjectDisposedException should be thrown when an attempt is made to access an object that has already been disposed.
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

DisposableAttribute Class
PostSharp.Patterns.Model Namespace


DisposableAttribute.ThrowObjectDisposedException Property

DisposableAttributeThrowObjectDisposedException Property

Determines whether an ObjectDisposedException should be thrown when an attempt is made to access an object that has already been disposed.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool ThrowObjectDisposedException { get; set; }

Property Value

Type: Boolean
See Also

Reference

DisposableAttribute Class
PostSharp.Patterns.Model Namespace


DisposableAttribute Methods

The DisposableAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from AggregatableClientAttribute.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype. (Inherited from InstanceLevelAspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnCloned | Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object. (Inherited from InstanceLevelAspect.)
Public method | OnInstanceConstructed | Executed when the target instance gets fully initialized, i.e. just after all constructors have completed. (Inherited from AggregatableClientAttribute.)
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from TypeLevelAspect.)
Public method | RuntimeInitializeInstance | Initializes the aspect instance. This method is invoked when all system elements of the aspect (like member imports) have completed. (Inherited from InstanceLevelAspect.)
Top
See Also

Reference

DisposableAttribute Class
PostSharp.Patterns.Model Namespace


IAggregatable Interface

Defines members (principally Parent and VisitChildren(ChildVisitor, ChildVisitorOptions, Object)) that allow to consume parent-child relationships in an object tree.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IAggregatable

The IAggregatable type exposes the following members.

Properties
 | Name | Description
Public property | Parent | Gets the parent of the current object.
Public property | ParentRelationship | Describes the relationship between the current object and its parent. Valid values are Child or ParentSurrogate.
Top
Methods
 | Name | Description
Public method | VisitChildren | Executes an action for all direct children of the current object.
Top
Events
 | Name | Description
Public event | AncestorChanged | Occurs when any ancestor changes. An ancestor is the parent of the current object or the parent of an ancestor of the current object.
Public event | ParentChanged | Occurs when the Parent property changes.
Top
Extension Methods
 | Name | Description
Public Extension Method | GetChildren | Gets the list of children of a specified parent object. (Defined by AggregatableExtensions.)
Public Extension Method | GetDistinctChildren | Gets a list of distinct children of a specified parent object. (Defined by AggregatableExtensions.)
Public Extension Method | IsDescendantOf | Determines whether a specified object is a descendant of a specified ancestor. (Defined by AggregatableExtensions.)
Public Extension Method | VisitSelfAndDescendants | Executes a ChildVisitor for the a specified parent object and all its descendants. (Defined by AggregatableExtensions.)
Top
Remarks

If a class implements this interface, it must also implement IAttachable. These two interfaces have been separated for clarity, since IAttachable should normally not be consumed from user code.

See Also

Reference

PostSharp.Patterns.Model Namespace

Other Resources

Conceptual: Enumerating Child Objects (Visitor)
Conceptual: Working With Child Collections


IAggregatable Properties

The IAggregatable type exposes the following members.

Properties
 | Name | Description
Public property | Parent | Gets the parent of the current object.
Public property | ParentRelationship | Describes the relationship between the current object and its parent. Valid values are Child or ParentSurrogate.
Top
See Also

Reference

IAggregatable Interface
PostSharp.Patterns.Model Namespace


IAggregatable.Parent Property

IAggregatableParent Property

Gets the parent of the current object.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Object Parent { get; }

Property Value

Type: Object
See Also

Reference

IAggregatable Interface
PostSharp.Patterns.Model Namespace

Other Resources

Conceptual: Annotating an Object Model for Parent/Child Relationships (Aggregatable)


IAggregatable.ParentRelationship Property

IAggregatableParentRelationship Property

Describes the relationship between the current object and its parent. Valid values are Child or ParentSurrogate.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
RelationshipKind ParentRelationship { get; }

Property Value

Type: RelationshipKind
See Also

Reference

IAggregatable Interface
PostSharp.Patterns.Model Namespace


IAggregatable Methods

The IAggregatable type exposes the following members.

Methods
 | Name | Description
Public method | VisitChildren | Executes an action for all direct children of the current object.
Top
Extension Methods
 | Name | Description
Public Extension Method | GetChildren | Gets the list of children of a specified parent object. (Defined by AggregatableExtensions.)
Public Extension Method | GetDistinctChildren | Gets a list of distinct children of a specified parent object. (Defined by AggregatableExtensions.)
Public Extension Method | IsDescendantOf | Determines whether a specified object is a descendant of a specified ancestor. (Defined by AggregatableExtensions.)
Public Extension Method | VisitSelfAndDescendants | Executes a ChildVisitor for the a specified parent object and all its descendants. (Defined by AggregatableExtensions.)
Top
See Also

Reference

IAggregatable Interface
PostSharp.Patterns.Model Namespace


IAggregatable.VisitChildren Method

IAggregatableVisitChildren Method

Executes an action for all direct children of the current object.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
bool VisitChildren(
    ChildVisitor visitor,
    ChildVisitorOptions options = ChildVisitorOptions.None,
    Object state = null
)

Parameters

visitor
Type: PostSharp.Patterns.ModelChildVisitor
The action to be executed for each child.
options (Optional)
Type: PostSharp.Patterns.ModelChildVisitorOptions
Options. The default behavior is to enumerate all children, but ignore parent surrogates.
state (Optional)
Type: SystemObject

Return Value

Type: Boolean
false if visitor returned Stop, otherwise true.
Remarks
Note Note
If a parent is bound to a child through several relationships (for instance several fields), the visitor delegate will be invoked several times, once for each relationship. Store visited children into a HashSetT if you need to perform an action only once per child.
See Also

Reference

IAggregatable Interface
PostSharp.Patterns.Model Namespace

Other Resources

Conceptual: Automatically Disposing Children Objects (Disposable)
Conceptual: Enumerating Child Objects (Visitor)
Conceptual: Working With Child Collections


IAggregatable Events

The IAggregatable type exposes the following members.

Events
 | Name | Description
Public event | AncestorChanged | Occurs when any ancestor changes. An ancestor is the parent of the current object or the parent of an ancestor of the current object.
Public event | ParentChanged | Occurs when the Parent property changes.
Top
See Also

Reference

IAggregatable Interface
PostSharp.Patterns.Model Namespace


IAggregatable.AncestorChanged Event

IAggregatableAncestorChanged Event

Occurs when any ancestor changes. An ancestor is the parent of the current object or the parent of an ancestor of the current object.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
event EventHandler<AncestorChangedEventArgs> AncestorChanged

Value

Type: SystemEventHandler AncestorChangedEventArgs
Remarks

The sender parameter of the event handler will be set to the current object. The Child property of the AncestorChangedEventArgs object will be set to the object whose Parent actually changed. To retrieve the new ancestor, use args.Child.QueryInterface<IAggregatable>.Parent

See Also

Reference

IAggregatable Interface
PostSharp.Patterns.Model Namespace


IAggregatable.ParentChanged Event

IAggregatableParentChanged Event

Occurs when the Parent property changes.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
event EventHandler ParentChanged

Value

Type: SystemEventHandler
See Also

Reference

IAggregatable Interface
PostSharp.Patterns.Model Namespace


IAggregatableCollection Interface

Defines the non-generic semantics of an AggregatableCollection.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IAggregatableCollection : IAttachable,
    IAggregatable

The IAggregatableCollection type exposes the following members.

Properties
 | Name | Description
Public property | ItemsRelationship | Gets RelationshipKind of collection items.
Public property | Parent | Gets the parent of the current object. (Inherited from IAggregatable.)
Public property | ParentRelationship | Describes the relationship between the current object and its parent. Valid values are Child or ParentSurrogate. (Inherited from IAggregatable.)
Top
Methods
 | Name | Description
Public method | AttachToParent | Attaches the current object to a parent object. (Inherited from IAttachable.)
Public method | DetachFromParent | Detaches the current object from its parent object. (Inherited from IAttachable.)
Public method | OnDeserialization | Restores the correct state when the object is being deserialized. (Inherited from IAttachable.)
Public method | VisitChildren | Executes an action for all direct children of the current object. (Inherited from IAggregatable.)
Top
Events
 | Name | Description
Public event | AncestorChanged | Occurs when any ancestor changes. An ancestor is the parent of the current object or the parent of an ancestor of the current object. (Inherited from IAggregatable.)
Public event | ParentChanged | Occurs when the Parent property changes. (Inherited from IAggregatable.)
Top
Extension Methods
 | Name | Description
Public Extension Method | GetChildren | Gets the list of children of a specified parent object. (Defined by AggregatableExtensions.)
Public Extension Method | GetDistinctChildren | Gets a list of distinct children of a specified parent object. (Defined by AggregatableExtensions.)
Public Extension Method | IsDescendantOf | Determines whether a specified object is a descendant of a specified ancestor. (Defined by AggregatableExtensions.)
Public Extension Method | VisitSelfAndDescendants | Executes a ChildVisitor for the a specified parent object and all its descendants. (Defined by AggregatableExtensions.)
Top
See Also

Reference

PostSharp.Patterns.Model Namespace


IAggregatableCollection Properties

The IAggregatableCollection type exposes the following members.

Properties
 | Name | Description
Public property | ItemsRelationship | Gets RelationshipKind of collection items.
Public property | Parent | Gets the parent of the current object. (Inherited from IAggregatable.)
Public property | ParentRelationship | Describes the relationship between the current object and its parent. Valid values are Child or ParentSurrogate. (Inherited from IAggregatable.)
Top
See Also

Reference

IAggregatableCollection Interface
PostSharp.Patterns.Model Namespace


IAggregatableCollection.ItemsRelationship Property

IAggregatableCollectionItemsRelationship Property

Gets RelationshipKind of collection items.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
RelationshipKind ItemsRelationship { get; }

Property Value

Type: RelationshipKind
See Also

Reference

IAggregatableCollection Interface
PostSharp.Patterns.Model Namespace


IAggregatableCollection Methods

The IAggregatableCollection type exposes the following members.

Methods
 | Name | Description
Public method | AttachToParent | Attaches the current object to a parent object. (Inherited from IAttachable.)
Public method | DetachFromParent | Detaches the current object from its parent object. (Inherited from IAttachable.)
Public method | OnDeserialization | Restores the correct state when the object is being deserialized. (Inherited from IAttachable.)
Public method | VisitChildren | Executes an action for all direct children of the current object. (Inherited from IAggregatable.)
Top
Extension Methods
 | Name | Description
Public Extension Method | GetChildren | Gets the list of children of a specified parent object. (Defined by AggregatableExtensions.)
Public Extension Method | GetDistinctChildren | Gets a list of distinct children of a specified parent object. (Defined by AggregatableExtensions.)
Public Extension Method | IsDescendantOf | Determines whether a specified object is a descendant of a specified ancestor. (Defined by AggregatableExtensions.)
Public Extension Method | VisitSelfAndDescendants | Executes a ChildVisitor for the a specified parent object and all its descendants. (Defined by AggregatableExtensions.)
Top
See Also

Reference

IAggregatableCollection Interface
PostSharp.Patterns.Model Namespace


IAggregatableCollection Events

The IAggregatableCollection type exposes the following members.

Events
 | Name | Description
Public event | AncestorChanged | Occurs when any ancestor changes. An ancestor is the parent of the current object or the parent of an ancestor of the current object. (Inherited from IAggregatable.)
Public event | ParentChanged | Occurs when the Parent property changes. (Inherited from IAggregatable.)
Top
See Also

Reference

IAggregatableCollection Interface
PostSharp.Patterns.Model Namespace


IAggregatableDependentAdvice(T) Interface

IAggregatableDependentAdviceT Interface

Defines the semantics of advices that depend on the aggregatable dynamic advices, i.e. they must be able to react to attachment and detachment events.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IAggregatableDependentAdvice<T> : IDynamicAdvice,
    IDynamicInterfaceImplementation

Type Parameters

T
Item types.

The IAggregatableDependentAdviceT type exposes the following members.

Properties
 | Name | Description
Public property | AdvisedObject | Gets the principal object for which the current object is an indirect interface implementation. (Inherited from IDynamicInterfaceImplementation.)
Public property | Identity | Gets the type identity of the advice, which should correspond to the first parameter of the Advise(Type, FuncIQueryInterface, IDynamicAdvice) method. This is typically the generic type definition of the advice (Inherited from IDynamicAdvice.)
Public property | Order | Gets the execution order of the dynamic advice. See DynamicAdviceOrder. (Inherited from IDynamicAdvice.)
Top
Methods
 | Name | Description
Public method | Dispose | Disposes the current advice. // We don't use IDisposable so that advises are not be cast to IDisposable by default. (Inherited from IDynamicAdvice.)
Public method | Initialize | Initializes the current advice. (Inherited from IDynamicAdvice.)
Public method | OnChildAttached | Method invoked when a child is attached to the parent.
Public method | OnChildDetached | Method invoked when a child is detached from the parent.
Public method | OnParentChanged | Method invoked when the parent changes.
Public method | QueryInterfaceT | Gets the implementation of an interface. (Inherited from IDynamicAdvice.)
Top
See Also

Reference

PostSharp.Patterns.Model Namespace


IAggregatableDependentAdvice(T) Properties

IAggregatableDependentAdviceT Properties

The IAggregatableDependentAdviceT generic type exposes the following members.

Properties
 | Name | Description
Public property | AdvisedObject | Gets the principal object for which the current object is an indirect interface implementation. (Inherited from IDynamicInterfaceImplementation.)
Public property | Identity | Gets the type identity of the advice, which should correspond to the first parameter of the Advise(Type, FuncIQueryInterface, IDynamicAdvice) method. This is typically the generic type definition of the advice (Inherited from IDynamicAdvice.)
Public property | Order | Gets the execution order of the dynamic advice. See DynamicAdviceOrder. (Inherited from IDynamicAdvice.)
Top
See Also

Reference

IAggregatableDependentAdviceT Interface
PostSharp.Patterns.Model Namespace


IAggregatableDependentAdvice(T) Methods

IAggregatableDependentAdviceT Methods

The IAggregatableDependentAdviceT generic type exposes the following members.

Methods
 | Name | Description
Public method | Dispose | Disposes the current advice. // We don't use IDisposable so that advises are not be cast to IDisposable by default. (Inherited from IDynamicAdvice.)
Public method | Initialize | Initializes the current advice. (Inherited from IDynamicAdvice.)
Public method | OnChildAttached | Method invoked when a child is attached to the parent.
Public method | OnChildDetached | Method invoked when a child is detached from the parent.
Public method | OnParentChanged | Method invoked when the parent changes.
Public method | QueryInterfaceT | Gets the implementation of an interface. (Inherited from IDynamicAdvice.)
Top
See Also

Reference

IAggregatableDependentAdviceT Interface
PostSharp.Patterns.Model Namespace


IAggregatableDependentAdvice(T).OnChildAttached Method

IAggregatableDependentAdviceTOnChildAttached Method

Method invoked when a child is attached to the parent.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void OnChildAttached(
    T child,
    AdviceEnumerator<IAggregatableDependentAdvice<T>> nextAdvices
)

Parameters

child
Type: T
nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator IAggregatableDependentAdvice T
See Also

Reference

IAggregatableDependentAdviceT Interface
PostSharp.Patterns.Model Namespace


IAggregatableDependentAdvice(T).OnChildDetached Method

IAggregatableDependentAdviceTOnChildDetached Method

Method invoked when a child is detached from the parent.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void OnChildDetached(
    T child,
    AdviceEnumerator<IAggregatableDependentAdvice<T>> nextAdvices
)

Parameters

child
Type: T
nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator IAggregatableDependentAdvice T
See Also

Reference

IAggregatableDependentAdviceT Interface
PostSharp.Patterns.Model Namespace


IAggregatableDependentAdvice(T).OnParentChanged Method

IAggregatableDependentAdviceTOnParentChanged Method

Method invoked when the parent changes.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void OnParentChanged(
    AdviceEnumerator<IAggregatableDependentAdvice<T>> nextAdvices
)

Parameters

nextAdvices
Type: PostSharp.Patterns.DynamicAdvisingAdviceEnumerator IAggregatableDependentAdvice T
See Also

Reference

IAggregatableDependentAdviceT Interface
PostSharp.Patterns.Model Namespace


IAttachable Interface

Defines setter methods for the IAggregatable.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IAttachable : IAggregatable

The IAttachable type exposes the following members.

Properties
 | Name | Description
Public property | Parent | Gets the parent of the current object. (Inherited from IAggregatable.)
Public property | ParentRelationship | Describes the relationship between the current object and its parent. Valid values are Child or ParentSurrogate. (Inherited from IAggregatable.)
Top
Methods
 | Name | Description
Public method | AttachToParent | Attaches the current object to a parent object.
Public method | DetachFromParent | Detaches the current object from its parent object.
Public method | OnDeserialization | Restores the correct state when the object is being deserialized.
Public method | VisitChildren | Executes an action for all direct children of the current object. (Inherited from IAggregatable.)
Top
Events
 | Name | Description
Public event | AncestorChanged | Occurs when any ancestor changes. An ancestor is the parent of the current object or the parent of an ancestor of the current object. (Inherited from IAggregatable.)
Public event | ParentChanged | Occurs when the Parent property changes. (Inherited from IAggregatable.)
Top
Extension Methods
 | Name | Description
Public Extension Method | GetChildren | Gets the list of children of a specified parent object. (Defined by AggregatableExtensions.)
Public Extension Method | GetDistinctChildren | Gets a list of distinct children of a specified parent object. (Defined by AggregatableExtensions.)
Public Extension Method | IsDescendantOf | Determines whether a specified object is a descendant of a specified ancestor. (Defined by AggregatableExtensions.)
Public Extension Method | VisitSelfAndDescendants | Executes a ChildVisitor for the a specified parent object and all its descendants. (Defined by AggregatableExtensions.)
Top
Remarks

This interface is consumed by the AggregatableAttribute aspect. It should normally not be consumed in user code.

User classes may implement this interface in a class if a custom implementation of IAggregatable is required.

A child object may be attached several times to the same parent through several relationships.

See Also

Reference

PostSharp.Patterns.Model Namespace


IAttachable Properties

The IAttachable type exposes the following members.

Properties
 | Name | Description
Public property | Parent | Gets the parent of the current object. (Inherited from IAggregatable.)
Public property | ParentRelationship | Describes the relationship between the current object and its parent. Valid values are Child or ParentSurrogate. (Inherited from IAggregatable.)
Top
See Also

Reference

IAttachable Interface
PostSharp.Patterns.Model Namespace


IAttachable Methods

The IAttachable type exposes the following members.

Methods
 | Name | Description
Public method | AttachToParent | Attaches the current object to a parent object.
Public method | DetachFromParent | Detaches the current object from its parent object.
Public method | OnDeserialization | Restores the correct state when the object is being deserialized.
Public method | VisitChildren | Executes an action for all direct children of the current object. (Inherited from IAggregatable.)
Top
Extension Methods
 | Name | Description
Public Extension Method | GetChildren | Gets the list of children of a specified parent object. (Defined by AggregatableExtensions.)
Public Extension Method | GetDistinctChildren | Gets a list of distinct children of a specified parent object. (Defined by AggregatableExtensions.)
Public Extension Method | IsDescendantOf | Determines whether a specified object is a descendant of a specified ancestor. (Defined by AggregatableExtensions.)
Public Extension Method | VisitSelfAndDescendants | Executes a ChildVisitor for the a specified parent object and all its descendants. (Defined by AggregatableExtensions.)
Top
See Also

Reference

IAttachable Interface
PostSharp.Patterns.Model Namespace


IAttachable.AttachToParent Method

IAttachableAttachToParent Method

Attaches the current object to a parent object.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
bool AttachToParent(
    RelationshipInfo relationshipInfo,
    IAttacher attacher,
    Object attacherState
)

Parameters

relationshipInfo
Type: PostSharp.Patterns.ModelRelationshipInfo
Information about the relationship of the parent node relatively to the current node. The Relationship property must be set to Child or ParentSurrogate.
attacher
Type: PostSharp.Patterns.ModelIAttacher
A service that allows the current node to attach itself to the parent.
attacherState
Type: SystemObject
An opaque state object to be passed as the first argument to all methods of the IAttacher interface.

Return Value

Type: Boolean
true if the current object was not previously attached to any parent, false if it was already attached to the same parent.
Remarks

In case a child is attached to its parent through several relationships, all relationships should have the same characteristics, i.e. their RelationshipInfo value should be identical.

See Also

Reference

IAttachable Interface
PostSharp.Patterns.Model Namespace


IAttachable.DetachFromParent Method

IAttachableDetachFromParent Method

Detaches the current object from its parent object.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
bool DetachFromParent()

Return Value

Type: Boolean
true if the current object has been fully detached, i.e. is no longer attached to its parent by any other relationship, or false if the current object is still attached to the parent by some relationship.
See Also

Reference

IAttachable Interface
PostSharp.Patterns.Model Namespace


IAttachable.OnDeserialization Method

IAttachableOnDeserialization Method

Restores the correct state when the object is being deserialized.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void OnDeserialization(
    Object caller
)

Parameters

caller
Type: SystemObject
Object governing the deserialization.
Remarks

This method is redundant with IDeserializationCallback on platforms where this interface is supported.

See Also

Reference

IAttachable Interface
PostSharp.Patterns.Model Namespace


IAttachable Events

The IAttachable type exposes the following members.

Events
 | Name | Description
Public event | AncestorChanged | Occurs when any ancestor changes. An ancestor is the parent of the current object or the parent of an ancestor of the current object. (Inherited from IAggregatable.)
Public event | ParentChanged | Occurs when the Parent property changes. (Inherited from IAggregatable.)
Top
See Also

Reference

IAttachable Interface
PostSharp.Patterns.Model Namespace


IAttacher Interface

Describes the semantics of a service through which a child IAggregatable object can attach itself to a parent object. This interface is typically implemented by the parent object by composition.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IAttacher

The IAttacher type exposes the following members.

Methods
 | Name | Description
Public method | AttachChild | Attach an object as a child of the current node.
Public method | DetachChild | Detaches an object as a child of the current node.
Public method | GetNode | Gets the underlying object instance which is subject to the current attacher. The instance is the aggregatable node that participates in the parent-child relationships with other objects.
Public method | OnChildAttached | Method invoked after a child has been successfully attached to the current node.
Public method | OnChildDetached | Method invoked when a child has been detached from the current node.
Top
Remarks

This interface should typically not be used or implemented in user code.

See Also

Reference

PostSharp.Patterns.Model Namespace


IAttacher Methods

The IAttacher type exposes the following members.

Methods
 | Name | Description
Public method | AttachChild | Attach an object as a child of the current node.
Public method | DetachChild | Detaches an object as a child of the current node.
Public method | GetNode | Gets the underlying object instance which is subject to the current attacher. The instance is the aggregatable node that participates in the parent-child relationships with other objects.
Public method | OnChildAttached | Method invoked after a child has been successfully attached to the current node.
Public method | OnChildDetached | Method invoked when a child has been detached from the current node.
Top
See Also

Reference

IAttacher Interface
PostSharp.Patterns.Model Namespace


IAttacher.AttachChild Method

IAttacherAttachChild Method

Attach an object as a child of the current node.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Object AttachChild(
    Object state,
    Object child,
    ChildInfo childInfo
)

Parameters

state
Type: SystemObject
The opaque state object passed to AttachToParent(RelationshipInfo, IAttacher, Object).
child
Type: SystemObject
The object that must be attached as a child to the current node.
childInfo
Type: PostSharp.Patterns.ModelChildInfo
Information about the location (field or collection item, typically) to which the child is assigned and about the relationship of the current node relatively to the parent node. The Relationship property must be set to Child or ParentSurrogate

Return Value

Type: Object
The new parent of child, or null if child was already attached to the same parent node through another relationship. If the current node is a parent surrogate, the method returns the parent of the current node.
Remarks
The new parent of child will be the current node (the value returned by GetNode(Object)); or the parent of the current node, if the current node is a parent surrogate.
See Also

Reference

IAttacher Interface
PostSharp.Patterns.Model Namespace


IAttacher.DetachChild Method

IAttacherDetachChild Method

Detaches an object as a child of the current node.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Object DetachChild(
    Object state,
    Object child,
    ChildInfo childInfo
)

Parameters

state
Type: SystemObject
The opaque state object passed to AttachToParent(RelationshipInfo, IAttacher, Object).
child
Type: SystemObject
The object that must be detached as a child as the current node.
childInfo
Type: PostSharp.Patterns.ModelChildInfo

Return Value

Type: Object
The former effective parent of child, or null if the child is still attached to the parent through another relationship.
See Also

Reference

IAttacher Interface
PostSharp.Patterns.Model Namespace


IAttacher.GetNode Method

IAttacherGetNode Method

Gets the underlying object instance which is subject to the current attacher. The instance is the aggregatable node that participates in the parent-child relationships with other objects.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Object GetNode(
    Object state
)

Parameters

state
Type: SystemObject
The opaque state object passed to AttachToParent(RelationshipInfo, IAttacher, Object).

Return Value

Type: Object
An object implementing IAggregatable, either directly or dynamically.
See Also

Reference

IAttacher Interface
PostSharp.Patterns.Model Namespace


IAttacher.OnChildAttached Method

IAttacherOnChildAttached Method

Method invoked after a child has been successfully attached to the current node.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void OnChildAttached(
    Object state,
    Object parent,
    Object child,
    ChildInfo childInfo
)

Parameters

state
Type: SystemObject
The opaque state object passed to AttachToParent(RelationshipInfo, IAttacher, Object).
parent
Type: SystemObject
The actual parent of child. If child is assigned to a parent surrogate, the parameter is set to the actual parent, i.e. to the parent of the parent surrogate.
child
Type: SystemObject
The child object.
childInfo
Type: PostSharp.Patterns.ModelChildInfo
Information about the location (field or collection item, typically) to which the child is assigned and about the relationship of the current node relatively to the parent node.
See Also

Reference

IAttacher Interface
PostSharp.Patterns.Model Namespace


IAttacher.OnChildDetached Method

IAttacherOnChildDetached Method

Method invoked when a child has been detached from the current node.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void OnChildDetached(
    Object state,
    Object parent,
    Object child,
    ChildInfo childInfo
)

Parameters

state
Type: SystemObject
The opaque state object passed to AttachToParent(RelationshipInfo, IAttacher, Object).
parent
Type: SystemObject
The former actual parent of child. If child was assigned to a parent surrogate, the parameter is set to the former actual parent, i.e. to the parent of the parent surrogate.
child
Type: SystemObject
The child object.
childInfo
Type: PostSharp.Patterns.ModelChildInfo
Information about the location (field or collection item, typically) to which the child was assigned and about the relationship of the current node relatively to the parent node.
See Also

Reference

IAttacher Interface
PostSharp.Patterns.Model Namespace


IgnoreAutoChangeNotificationAttribute Class

Custom attribute that, when applied to a method, prevents the NotifyPropertyChangedAttribute aspect to raise change notifications for this property.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Patterns.ModelIgnoreAutoChangeNotificationAttribute

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class IgnoreAutoChangeNotificationAttribute : Attribute

The IgnoreAutoChangeNotificationAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | IgnoreAutoChangeNotificationAttribute | Initializes a new instance of the IgnoreAutoChangeNotificationAttribute class
Top
See Also

Reference

PostSharp.Patterns.Model Namespace

Other Resources

Conceptual: Handling Corner Cases of the NotifyPropertyChanged Aspect


IgnoreAutoChangeNotificationAttribute Constructor

Initializes a new instance of the IgnoreAutoChangeNotificationAttribute class

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IgnoreAutoChangeNotificationAttribute()
See Also

Reference

IgnoreAutoChangeNotificationAttribute Class
PostSharp.Patterns.Model Namespace


MemberRelationshipAttribute Class

Base class for custom attributes that determine the kind of relationship of objects in a graph.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Patterns.ModelMemberRelationshipAttribute
PostSharp.Patterns.ModelChildAttribute
PostSharp.Patterns.ModelParentAttribute
PostSharp.Patterns.ModelReferenceAttribute

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class MemberRelationshipAttribute : Attribute,
    IValidableAnnotation

The MemberRelationshipAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeValidate | Method invoked at build time to ensure that the aspect has been applied to the right target.
Top
See Also

Reference

PostSharp.Patterns.Model Namespace
PostSharp.Patterns.ModelChildAttribute
PostSharp.Patterns.ModelParentAttribute
PostSharp.Patterns.ModelReferenceAttribute


MemberRelationshipAttribute Methods

The MemberRelationshipAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeValidate | Method invoked at build time to ensure that the aspect has been applied to the right target.
Top
See Also

Reference

MemberRelationshipAttribute Class
PostSharp.Patterns.Model Namespace


MemberRelationshipAttribute.CompileTimeValidate Method

MemberRelationshipAttributeCompileTimeValidate Method

Method invoked at build time to ensure that the aspect has been applied to the right target.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool CompileTimeValidate(
    Object target
)

Parameters

target
Type: SystemObject
Target element.

Return Value

Type: Boolean
true if the aspect was applied to an acceptable target, otherwise false.

Implements

IValidableAnnotationCompileTimeValidate(Object)
Remarks
The implementation of this method is expected to emit an error message or an exception of type InvalidAnnotationException in case of error. Only returning false causes the aspect to be silently ignored.
See Also

Reference

MemberRelationshipAttribute Class
PostSharp.Patterns.Model Namespace


NotifyPropertyChangedAttribute Class

Custom attribute that, when applied on a type, implements the INotifyPropertyChanged interface for this class and all children classes.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsTypeLevelAspect
PostSharp.AspectsInstanceLevelAspect
PostSharp.Patterns.ModelNotifyPropertyChangedAttribute

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class NotifyPropertyChangedAttribute : InstanceLevelAspect,
    ISerializationCallback, INotifyPropertyChanged, IAdviceProvider, IAspect, IQueryInterface,
    IDynamicInterfaceImplementation

The NotifyPropertyChangedAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | NotifyPropertyChangedAttribute | Initializes a new instance of the NotifyPropertyChangedAttribute class that stores strong references to the client delegates.
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | Instance | Gets the object to which the current aspect has been applied. (Inherited from InstanceLevelAspect.)
Public property | PreventFalsePositives | Determines whether the aspect should do additional efforts to prevent the PropertyChanged event from being raised when the value itself did not change. The default value of this property is false, which means that the aspect will raise the PropertyChanged event whenever any dependency of the property has changed, whether the property value has eventually changed or not. Setting this property to true consumes more memory and processing power because the aspect will need to evaluate the properties and store their value.
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Public property | WeakEventStrategy | Determines how the PropertyChanged event behaves in terms of keeping weak or strong references.
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Overrides TypeLevelAspectCompileTimeInitialize(Type, AspectInfo).)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Overrides TypeLevelAspectCompileTimeValidate(Type).)
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype. (Overrides InstanceLevelAspectCreateInstance(AdviceArgs).)
Protected method | Finalize | (Overrides ObjectFinalize.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnCloned | Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object. (Overrides InstanceLevelAspectOnCloned(ICloneAwareAspect).)
Top
Remarks

The aspect analyzes dependencies between property getters and fields. The aspect understands indirect dependencies. For instance, a property getter may depend on several other methods or property getters, which in turn can depend on other methods or fields. The algorithm is not able to analyze calls to virtual methods or delegates (because of prohibitive computational cost), and will only try to analyze methods in the current class.

The aspect will emit a build-time error if it is not able to understand the code of the target class. In this case, you can exclude the property from automatic change notification by applying the IgnoreAutoChangeNotificationAttribute custom attribute to the problematic property, or SafeForDependencyAnalysisAttribute to ignore the warnings of the dependency analysis engine. You will then need to specify dependencies explicitly using the Depends class. You can also mark a helper method with the PureAttribute to make it safe from use in a property getter. For instance, the string.Format method is pure.

By default, the NotifyPropertyChangedAttribute aspect holds weak references to the client delegates. This behavior prevents memory leaks if client delegates are not properly removed before client objects are disposed. To cause the aspect to store strong references, set WeakEventStrategy property to AlwaysStrong when applying the aspect.

Target classes can customize the NotifyPropertyChangedAttribute aspect by implementing the OnPropertyChanged(string) method manually. If this method is implemented, it must be protected or public.

By default, the NotifyPropertyChangedAttribute aspect does not call property getters by itself in order to avoid unexpected side-effects. However, this means that there are false positive notifications of property change. To allow aspect to use arbitrary calls to property getters to suppress false positives, set the PreventFalsePositives property to true.

See Also

Reference

PostSharp.Patterns.Model Namespace

Other Resources

Conceptual: Adding Aspects Programmatically using IAspectProvider
Conceptual: Adding Callbacks on Undo and Redo
Conceptual: Command
Conceptual: Dependency Property
Conceptual: Implementing INotifyPropertyChanged
Conceptual: Implementing INotifyPropertyChanged with Properties that Depend on Other Objects
Conceptual: Implementing INotifyPropertyChanging
Conceptual: INotifyPropertyChanged
Conceptual: INotifyPropertyChanged and Caliburn.Micro
Conceptual: INotifyPropertyChanged and MVVM Light Toolkit
Conceptual: Integrating the NotifyPropertyChanged Aspect with UI Frameworks
Conceptual: Intercepting Properties and Fields
Conceptual: Key Technologies
Conceptual: Suppressing False Positives of the NotifyPropertyChanged Aspect
Conceptual: Understanding the NotifyPropertyChanged Aspect
Conceptual: What's New in PostSharp 3.0
Conceptual: What's New in PostSharp 4.0
Conceptual: What's New in PostSharp 4.2
Conceptual: What's New in PostSharp 4.3


NotifyPropertyChangedAttribute Constructor

Initializes a new instance of the NotifyPropertyChangedAttribute class that stores strong references to the client delegates.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public NotifyPropertyChangedAttribute()
See Also

Reference

NotifyPropertyChangedAttribute Class
PostSharp.Patterns.Model Namespace


NotifyPropertyChangedAttribute Properties

The NotifyPropertyChangedAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | Instance | Gets the object to which the current aspect has been applied. (Inherited from InstanceLevelAspect.)
Public property | PreventFalsePositives | Determines whether the aspect should do additional efforts to prevent the PropertyChanged event from being raised when the value itself did not change. The default value of this property is false, which means that the aspect will raise the PropertyChanged event whenever any dependency of the property has changed, whether the property value has eventually changed or not. Setting this property to true consumes more memory and processing power because the aspect will need to evaluate the properties and store their value.
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Public property | WeakEventStrategy | Determines how the PropertyChanged event behaves in terms of keeping weak or strong references.
Top
See Also

Reference

NotifyPropertyChangedAttribute Class
PostSharp.Patterns.Model Namespace


NotifyPropertyChangedAttribute.PreventFalsePositives Property

NotifyPropertyChangedAttributePreventFalsePositives Property

Determines whether the aspect should do additional efforts to prevent the PropertyChanged event from being raised when the value itself did not change. The default value of this property is false, which means that the aspect will raise the PropertyChanged event whenever any dependency of the property has changed, whether the property value has eventually changed or not. Setting this property to true consumes more memory and processing power because the aspect will need to evaluate the properties and store their value.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool PreventFalsePositives { get; set; }

Property Value

Type: Boolean
See Also

Reference

NotifyPropertyChangedAttribute Class
PostSharp.Patterns.Model Namespace


NotifyPropertyChangedAttribute.WeakEventStrategy Property

NotifyPropertyChangedAttributeWeakEventStrategy Property

Determines how the PropertyChanged event behaves in terms of keeping weak or strong references.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public WeakEventStrategy WeakEventStrategy { get; set; }

Property Value

Type: WeakEventStrategy
Remarks

Setting this property to Default is equivalent to AlwaysWeak.

Setting this property to AlwaysWeak forces the event to hold only weak references. A ConditionalWeakTableTKey, TValue is used to bind the lifetime of the delegate to it's target even if registering object does not keep a reference to the delegate. This does not prevent the target object from being collected along with the delegate, which may happen implicitly when a lambda or local function with a closure is used as an event handler. In this case, there is no reference to the closure class retained.

Setting this property to AlwaysStrong forces the event to hold only strong reference. This may prevent components that do not support weak event behavior to have subscribed delegates collected. However, it may cause memory leaks if delegates are not unregistered from the event.

See Also

Reference

NotifyPropertyChangedAttribute Class
PostSharp.Patterns.Model Namespace


NotifyPropertyChangedAttribute Methods

The NotifyPropertyChangedAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Overrides TypeLevelAspectCompileTimeInitialize(Type, AspectInfo).)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Overrides TypeLevelAspectCompileTimeValidate(Type).)
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype. (Overrides InstanceLevelAspectCreateInstance(AdviceArgs).)
Protected method | Finalize | (Overrides ObjectFinalize.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnCloned | Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object. (Overrides InstanceLevelAspectOnCloned(ICloneAwareAspect).)
Top
See Also

Reference

NotifyPropertyChangedAttribute Class
PostSharp.Patterns.Model Namespace


NotifyPropertyChangedAttribute.CompileTimeInitialize Method

NotifyPropertyChangedAttributeCompileTimeInitialize Method

Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void CompileTimeInitialize(
    Type type,
    AspectInfo aspectInfo
)

Parameters

type
Type: SystemType
Type to which the current aspect is applied
aspectInfo
Type: PostSharp.AspectsAspectInfo
Reserved for future usage.

Implements

ITypeLevelAspectBuildSemanticsCompileTimeInitialize(Type, AspectInfo)
See Also

Reference

NotifyPropertyChangedAttribute Class
PostSharp.Patterns.Model Namespace

Other Resources

Conceptual: Initializing Aspects


NotifyPropertyChangedAttribute.CompileTimeValidate Method

NotifyPropertyChangedAttributeCompileTimeValidate Method

Overload List
 | Name | Description
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Overrides TypeLevelAspectCompileTimeValidate(Type).)
Top
See Also

Reference

NotifyPropertyChangedAttribute Class
PostSharp.Patterns.Model Namespace


NotifyPropertyChangedAttribute.CompileTimeValidate Method (Type)

NotifyPropertyChangedAttributeCompileTimeValidate Method (Type)

Method invoked at build time to ensure that the aspect has been applied to the right target.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool CompileTimeValidate(
    Type type
)

Parameters

type
Type: SystemType
Type to which the aspect has been applied

Return Value

Type: Boolean
true if the aspect was applied to an acceptable field, otherwise false.
Remarks
The implementation of this method is expected to emit an error message (see MessageSource) or an exception in case of error. Returning false without emitting an error message or exception causes the aspect to be silently ignored.
See Also

Reference

NotifyPropertyChangedAttribute Class
CompileTimeValidate Overload
PostSharp.Patterns.Model Namespace

Other Resources

Conceptual: Validating Aspects


NotifyPropertyChangedAttribute.CreateInstance Method

NotifyPropertyChangedAttributeCreateInstance Method

Creates a new instance of the aspect based on the current instance, serving as a prototype.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Object CreateInstance(
    AdviceArgs adviceArgs
)

Parameters

adviceArgs
Type: PostSharp.AspectsAdviceArgs
Aspect arguments.

Return Value

Type: Object
A new instance of the aspect, typically a clone of the current prototype instance.

Implements

IInstanceScopedAspectCreateInstance(AdviceArgs)
Remarks
This method is typically implemented by invoking MemberwiseClone.
See Also

Reference

NotifyPropertyChangedAttribute Class
PostSharp.Patterns.Model Namespace

Other Resources

Conceptual: Initializing Aspects
Conceptual: Understanding Aspect Lifetime and Scope


NotifyPropertyChangedAttribute.Finalize Method

NotifyPropertyChangedAttributeFinalize Method

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void Finalize()

Implements

ObjectFinalize
See Also

Reference

NotifyPropertyChangedAttribute Class
PostSharp.Patterns.Model Namespace


NotifyPropertyChangedAttribute.OnCloned Method

NotifyPropertyChangedAttributeOnCloned Method

Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void OnCloned(
    ICloneAwareAspect source
)

Parameters

source
Type: PostSharp.AspectsICloneAwareAspect
Aspect instance corresponding to the current aspect instance in the cloned target object.

Implements

ICloneAwareAspectOnCloned(ICloneAwareAspect)
Remarks

Prior to calling the current method, the aspect framework initializes the source object using CreateInstance(AdviceArgs) and RuntimeInitializeInstance. That is, the aspect instance in the cloned object is not cloned from the source aspect instance, but from the prototype aspect instance.

See Also

Reference

NotifyPropertyChangedAttribute Class
PostSharp.Patterns.Model Namespace


NotifyPropertyChangedOverflowException Class

Exception thrown at runtime when the NotifyPropertyChangedAttribute aspect encounters an excessively long chain is dependency. This situation is typically caused by a cyclic dependency.
Inheritance Hierarchy
SystemObject
SystemException
PostSharp.Patterns.ModelNotifyPropertyChangedOverflowException

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public sealed class NotifyPropertyChangedOverflowException : Exception
Constructors
 | Name | Description
Public method | NotifyPropertyChangedOverflowException | Initializes a new NotifyPropertyChangedOverflowException.
Public method | NotifyPropertyChangedOverflowException(String) | Initializes a new NotifyPropertyChangedOverflowException and sets the exception message.
Public method | NotifyPropertyChangedOverflowException(String, Exception) | Initializes a new NotifyPropertyChangedOverflowException and sets the exception message and the inner exception.
Top
See Also

Reference

PostSharp.Patterns.Model Namespace


NotifyPropertyChangedOverflowException Constructor

Overload List
 | Name | Description
Public method | NotifyPropertyChangedOverflowException | Initializes a new NotifyPropertyChangedOverflowException.
Public method | NotifyPropertyChangedOverflowException(String) | Initializes a new NotifyPropertyChangedOverflowException and sets the exception message.
Public method | NotifyPropertyChangedOverflowException(String, Exception) | Initializes a new NotifyPropertyChangedOverflowException and sets the exception message and the inner exception.
Top
See Also

Reference

NotifyPropertyChangedOverflowException Class
PostSharp.Patterns.Model Namespace


NotifyPropertyChangedOverflowException Constructor

Initializes a new NotifyPropertyChangedOverflowException.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public NotifyPropertyChangedOverflowException()
See Also

Reference

NotifyPropertyChangedOverflowException Class
NotifyPropertyChangedOverflowException Overload
PostSharp.Patterns.Model Namespace


NotifyPropertyChangedOverflowException Constructor (String)

Initializes a new NotifyPropertyChangedOverflowException and sets the exception message.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public NotifyPropertyChangedOverflowException(
    string message
)

Parameters

message
Type: SystemString
Exception message.
See Also

Reference

NotifyPropertyChangedOverflowException Class
NotifyPropertyChangedOverflowException Overload
PostSharp.Patterns.Model Namespace


NotifyPropertyChangedOverflowException Constructor (String, Exception)

Initializes a new NotifyPropertyChangedOverflowException and sets the exception message and the inner exception.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public NotifyPropertyChangedOverflowException(
    string message,
    Exception innerException
)

Parameters

message
Type: SystemString
Exception message.
innerException
Type: SystemException
Inner exception.
See Also

Reference

NotifyPropertyChangedOverflowException Class
NotifyPropertyChangedOverflowException Overload
PostSharp.Patterns.Model Namespace


NotifyPropertyChangedServices Class

Utility methods to work with the NotifyPropertyChangedAttribute aspect.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.ModelNotifyPropertyChangedServices

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static class NotifyPropertyChangedServices

The NotifyPropertyChangedServices type exposes the following members.

Properties
Name | Description
PropertyChangingAdapter | Gets or sets currently active NotifyPropertyChangingAdapter object.
Top
Methods
Name | Description
RaiseEventsImmediate | Raises all PropertyChanged events that are currently stored in the event buffer for the current thread and a given object.
ResumeEvents | Resumes the raising of PropertyChanged events for the current thread after it has been suspending by the SuspendEvents method.
SignalPropertyChanged | Signals the PropertyChanged event of an object that is instrumented with the NotifyPropertyChangedAttribute aspect.
SignalPropertyChanging | Signals the PropertyChanging event of an object that is instrumented with the NotifyPropertyChangedAttribute aspect.
SuspendEvents | Suspends the raising of PropertyChanged events for the current thread.
Top
See Also

Reference

PostSharp.Patterns.Model Namespace


NotifyPropertyChangedServices Properties

The NotifyPropertyChangedServices type exposes the following members.

Properties
Name | Description
PropertyChangingAdapter | Gets or sets currently active NotifyPropertyChangingAdapter object.
Top
See Also

Reference

NotifyPropertyChangedServices Class
PostSharp.Patterns.Model Namespace


NotifyPropertyChangedServices.PropertyChangingAdapter Property

NotifyPropertyChangedServicesPropertyChangingAdapter Property

Gets or sets currently active NotifyPropertyChangingAdapter object.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static NotifyPropertyChangingAdapter PropertyChangingAdapter { get; set; }

Property Value

Type: NotifyPropertyChangingAdapter
Remarks

The adapter form a chain of responsibility. This property represents the head of this chain.

See Also

Reference

NotifyPropertyChangedServices Class
PostSharp.Patterns.Model Namespace


NotifyPropertyChangedServices Methods

The NotifyPropertyChangedServices type exposes the following members.

Methods
Name | Description
RaiseEventsImmediate | Raises all PropertyChanged events that are currently stored in the event buffer for the current thread and a given object.
ResumeEvents | Resumes the raising of PropertyChanged events for the current thread after it has been suspending by the SuspendEvents method.
SignalPropertyChanged | Signals the PropertyChanged event of an object that is instrumented with the NotifyPropertyChangedAttribute aspect.
SignalPropertyChanging | Signals the PropertyChanging event of an object that is instrumented with the NotifyPropertyChangedAttribute aspect.
SuspendEvents | Suspends the raising of PropertyChanged events for the current thread.
Top
See Also

Reference

NotifyPropertyChangedServices Class
PostSharp.Patterns.Model Namespace


NotifyPropertyChangedServices.RaiseEventsImmediate Method

NotifyPropertyChangedServicesRaiseEventsImmediate Method

Raises all PropertyChanged events that are currently stored in the event buffer for the current thread and a given object.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void RaiseEventsImmediate(
    Object instance
)

Parameters

instance
Type: SystemObject
The object for which events should be raised.
See Also

Reference

NotifyPropertyChangedServices Class
PostSharp.Patterns.Model Namespace

Other Resources

Conceptual: Understanding the NotifyPropertyChanged Aspect


NotifyPropertyChangedServices.ResumeEvents Method

NotifyPropertyChangedServicesResumeEvents Method

Resumes the raising of PropertyChanged events for the current thread after it has been suspending by the SuspendEvents method.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void ResumeEvents()
See Also

Reference

NotifyPropertyChangedServices Class
PostSharp.Patterns.Model Namespace

Other Resources

Conceptual: Understanding the NotifyPropertyChanged Aspect


NotifyPropertyChangedServices.SignalPropertyChanged Method

NotifyPropertyChangedServicesSignalPropertyChanged Method

Signals the PropertyChanged event of an object that is instrumented with the NotifyPropertyChangedAttribute aspect.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void SignalPropertyChanged(
    Object instance,
    string propertyName
)

Parameters

instance
Type: SystemObject
An instance of a class instrumented with the NotifyPropertyChangedAttribute aspect
propertyName
Type: SystemString
Name of the changed property.
Remarks

This methods invokes the OnPropertyChanged method on the instance object. If the method has been defined in user code, it will be invoked.

The event is buffered and will actually be raised when the current thread exits the scope of the instance parameter. This methods invokes the OnPropertyChanged method synchronously.

See Also

Reference

NotifyPropertyChangedServices Class
PostSharp.Patterns.Model Namespace


NotifyPropertyChangedServices.SignalPropertyChanging Method

NotifyPropertyChangedServicesSignalPropertyChanging Method

Signals the PropertyChanging event of an object that is instrumented with the NotifyPropertyChangedAttribute aspect.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void SignalPropertyChanging(
    Object instance,
    string propertyName
)

Parameters

instance
Type: SystemObject
An instance of a class instrumented with the NotifyPropertyChangedAttribute aspect
propertyName
Type: SystemString
Name of the changed property.
Remarks

This methods invokes the OnPropertyChanging method on the instance object. If the method has been defined in user code, it will be invoked.

The event is buffered and will actually be raised when the current thread exits the scope of the instance parameter. This methods invokes the OnPropertyChanging method synchronously.

See Also

Reference

NotifyPropertyChangedServices Class
PostSharp.Patterns.Model Namespace


NotifyPropertyChangedServices.SuspendEvents Method

NotifyPropertyChangedServicesSuspendEvents Method

Suspends the raising of PropertyChanged events for the current thread.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool SuspendEvents()

Return Value

Type: Boolean
true if events were suspended as a result of the current method call, false if events were already suspended before.
Remarks

The ResumeEvents method should be invoked as many times as the SuspendEvents method has been invoked, regardless of the return value of the SuspendEvents method. Failing to do so results in events not being fired at all and potentially in memory leaks as collected events hold strong references.

When events are suspended, existing objects have PropertyChanged events collected into an event buffer (multiple changes are treated as one).

When events are suspended, newly created object do not have PropertyChanged events collected.

When events are suspended, all object do not have [!:INotifyPropertyChanged.PropertyChanging] events collected.

See Also

Reference

NotifyPropertyChangedServices Class
PostSharp.Patterns.Model Namespace

Other Resources

Conceptual: Understanding the NotifyPropertyChanged Aspect


NotifyPropertyChangingAdapter Class

Provides a unified adapter to the different variants of the INotifyPropertyChanging interface.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.ModelNotifyPropertyChangingAdapter

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class NotifyPropertyChangingAdapter

The NotifyPropertyChangingAdapter type exposes the following members.

Constructors
 | Name | Description
Protected method | NotifyPropertyChangingAdapter | Initializes a new instance of the NotifyPropertyChangingAdapter class.
Top
Properties
 | Name | Description
Protected property | Next | Gets the next NotifyPropertyChangingAdapter in the chain.
Top
Methods
 | Name | Description
Public method | AddHandler | Adds a handler to PropertyChanging event.
Public method | IsSupported | Determines whether the NotifyPropertyChanging behavior is supported for a given object.
Public method | RemoveHandler | Removes a handler from PropertyChanging event.
Top
Remarks

To register your NotifyPropertyChangingAdapter, set the PropertyChangingAdapter property.

See Also

Reference

PostSharp.Patterns.Model Namespace


NotifyPropertyChangingAdapter Constructor

Initializes a new instance of the NotifyPropertyChangingAdapter class.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected NotifyPropertyChangingAdapter(
    NotifyPropertyChangingAdapter next
)

Parameters

next
Type: PostSharp.Patterns.ModelNotifyPropertyChangingAdapter
Next item in the chain of responsibility. Pass the current value of the PropertyChangingAdapter property to this parameter.
See Also

Reference

NotifyPropertyChangingAdapter Class
PostSharp.Patterns.Model Namespace


NotifyPropertyChangingAdapter Properties

The NotifyPropertyChangingAdapter type exposes the following members.

Properties
 | Name | Description
Protected property | Next | Gets the next NotifyPropertyChangingAdapter in the chain.
Top
See Also

Reference

NotifyPropertyChangingAdapter Class
PostSharp.Patterns.Model Namespace


NotifyPropertyChangingAdapter.Next Property

NotifyPropertyChangingAdapterNext Property

Gets the next NotifyPropertyChangingAdapter in the chain.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected NotifyPropertyChangingAdapter Next { get; }

Property Value

Type: NotifyPropertyChangingAdapter
Remarks

This property is never null.

See Also

Reference

NotifyPropertyChangingAdapter Class
PostSharp.Patterns.Model Namespace


NotifyPropertyChangingAdapter Methods

The NotifyPropertyChangingAdapter type exposes the following members.

Methods
 | Name | Description
Public method | AddHandler | Adds a handler to PropertyChanging event.
Public method | IsSupported | Determines whether the NotifyPropertyChanging behavior is supported for a given object.
Public method | RemoveHandler | Removes a handler from PropertyChanging event.
Top
See Also

Reference

NotifyPropertyChangingAdapter Class
PostSharp.Patterns.Model Namespace


NotifyPropertyChangingAdapter.AddHandler Method

NotifyPropertyChangingAdapterAddHandler Method

Adds a handler to PropertyChanging event.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract Delegate AddHandler(
    Object instance,
    Action<string> handler
)

Parameters

instance
Type: SystemObject
Instance.
handler
Type: SystemAction String
Handler delegate that receives property name as an argument.

Return Value

Type: Delegate
Delegate that was registered to the event or

Field Value

Type: Delegate
null if instance does not implement the represented interface.
Remarks

An implementation should never return null, instead it should return the result of this.Next.AddHandler.

See Also

Reference

NotifyPropertyChangingAdapter Class
PostSharp.Patterns.Model Namespace


NotifyPropertyChangingAdapter.IsSupported Method

NotifyPropertyChangingAdapterIsSupported Method

Determines whether the NotifyPropertyChanging behavior is supported for a given object.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract bool IsSupported(
    Object instance
)

Parameters

instance
Type: SystemObject
Instance.

Return Value

Type: Boolean
true if instance is supported, otherwise false.
Remarks

An implementation should never return false. Instead, it should return the result of base.IsSupported.

See Also

Reference

NotifyPropertyChangingAdapter Class
PostSharp.Patterns.Model Namespace


NotifyPropertyChangingAdapter.RemoveHandler Method

NotifyPropertyChangingAdapterRemoveHandler Method

Removes a handler from PropertyChanging event.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract bool RemoveHandler(
    Object instance,
    Delegate handler
)

Parameters

instance
Type: SystemObject
Instance.
handler
Type: SystemDelegate
Delegate that was registered to the event.

Return Value

Type: Boolean
true if instance implements the represented interface, false otherwise.
Remarks

An implementation should never return false, instead it should return the result of this.Next.RemoveHandler.

See Also

Reference

NotifyPropertyChangingAdapter Class
PostSharp.Patterns.Model Namespace


ObjectAccessLevel Enumeration

Enumeration of access levels that methods of execution scopes can require on an object.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum ObjectAccessLevel
Members
Member name | Value | Description
None | 0 | None.
Unknown | 1 | The required access level is unknown; maximal access is required.
Read | 2 | Read-only.
Write | 3 | Read-write.
UpgradeableRead | 4 | Read-only access that prevents other threads from acquiring Write or UpgradeableRead access.
Unchecked | 5 | Disables all runtime verification of access permissions.
Yield | 6 | Indicates that the control flow is passed to another object.
Inherit | 7 | Indicates that the access level is inherited from the outer scope.
See Also

Reference

PostSharp.Patterns.Model Namespace


ParentAttribute Class

Custom attribute that, when applied to a field or automatic property, specifies that this field or property should be automatically set to the parent of the instance of the declaring type, whenever this instance is attached as a child to another object.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Patterns.ModelMemberRelationshipAttribute
PostSharp.Patterns.ModelParentAttribute

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ParentAttribute : MemberRelationshipAttribute

The ParentAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | ParentAttribute | Initializes a new instance of the ParentAttribute class
Top
Methods
 | Name | Description
Public method | CompileTimeValidate | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MemberRelationshipAttribute.)
Top
Remarks

It is recommended to add this custom attribute only to private fields or automatic properties with a private setter.

See Also

Reference

PostSharp.Patterns.Model Namespace
PostSharp.Patterns.ModelChildAttribute
PostSharp.Patterns.ModelReferenceAttribute
PostSharp.Patterns.ModelAggregatableAttribute

Other Resources

Conceptual: Actor Threading Model
Conceptual: Annotating an Object Model for Parent/Child Relationships (Aggregatable)
Conceptual: Enumerating Child Objects (Visitor)
Conceptual: Freezable Threading Model
Conceptual: Parent/Child, Visitor and Disposable
Conceptual: Rule-Based Annotation


ParentAttribute Constructor

Initializes a new instance of the ParentAttribute class

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ParentAttribute()
See Also

Reference

ParentAttribute Class
PostSharp.Patterns.Model Namespace


ParentAttribute Methods

The ParentAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeValidate | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MemberRelationshipAttribute.)
Top
See Also

Reference

ParentAttribute Class
PostSharp.Patterns.Model Namespace


PropertyPath Class

Immutable property path with all components interned.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.ModelPropertyPath

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class PropertyPath : ISerializationCallback,
    IEquatable<PropertyPath>

The PropertyPath type exposes the following members.

Methods
 | Name | Description
Public method | Equals(Object) | Determines whether the specified object is equal to the current object. (Overrides ObjectEquals(Object).)
Public method | Equals(PropertyPath) | Determines whether the current PropertyPath is equal to another.
Public method | GetHashCode | Serves as the default hash function. (Overrides ObjectGetHashCode.)
Public method | ToString | Returns a string that represents the current object. (Overrides ObjectToString.)
Top
See Also

Reference

PostSharp.Patterns.Model Namespace


PropertyPath Methods

The PropertyPath type exposes the following members.

Methods
 | Name | Description
Public method | Equals(Object) | Determines whether the specified object is equal to the current object. (Overrides ObjectEquals(Object).)
Public method | Equals(PropertyPath) | Determines whether the current PropertyPath is equal to another.
Public method | GetHashCode | Serves as the default hash function. (Overrides ObjectGetHashCode.)
Public method | ToString | Returns a string that represents the current object. (Overrides ObjectToString.)
Top
See Also

Reference

PropertyPath Class
PostSharp.Patterns.Model Namespace


PropertyPath.Equals Method

PropertyPathEquals Method

Overload List
 | Name | Description
Public method | Equals(Object) | Determines whether the specified object is equal to the current object. (Overrides ObjectEquals(Object).)
Public method | Equals(PropertyPath) | Determines whether the current PropertyPath is equal to another.
Top
See Also

Reference

PropertyPath Class
PostSharp.Patterns.Model Namespace


PropertyPath.Equals Method (Object)

PropertyPathEquals Method (Object)

Determines whether the specified object is equal to the current object.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool Equals(
    Object obj
)

Parameters

obj
Type: SystemObject
The object to compare with the current object.

Return Value

Type: Boolean
true if the specified object is equal to the current object; otherwise, false.
See Also

Reference

PropertyPath Class
Equals Overload
PostSharp.Patterns.Model Namespace


PropertyPath.Equals Method (PropertyPath)

PropertyPathEquals Method (PropertyPath)

Determines whether the current PropertyPath is equal to another.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Equals(
    PropertyPath other
)

Parameters

other
Type: PostSharp.Patterns.ModelPropertyPath
Another PropertyPath.

Return Value

Type: Boolean
true if the current PropertyPath equals other, otherwise false.

Implements

IEquatableTEquals(T)
See Also

Reference

PropertyPath Class
Equals Overload
PostSharp.Patterns.Model Namespace


PropertyPath.GetHashCode Method

PropertyPathGetHashCode Method

Serves as the default hash function.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override int GetHashCode()

Return Value

Type: Int32
A hash code for the current object.
See Also

Reference

PropertyPath Class
PostSharp.Patterns.Model Namespace


PropertyPath.ToString Method

PropertyPathToString Method

Returns a string that represents the current object.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override string ToString()

Return Value

Type: String
A string that represents the current object.
See Also

Reference

PropertyPath Class
PostSharp.Patterns.Model Namespace


PureAttribute Class

Custom attribute that, when applied on a method, specifies that this method is a pure function, i.e. the method always returns the same result given the same parameter values. In the context of NotifyPropertyChangedAttribute, it is also assumed that pure functions have only parameters of primitive types (Int32, String, ...). The Object parameter type is also accepted, but then it is assumed that instances passed are immutable (and changes to these objects will not be tracked).
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.Patterns.ModelPureAttribute

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class PureAttribute : MulticastAttribute,
    IValidableAnnotation

The PureAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | PureAttribute | Initializes a new instance of the PureAttribute class
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Top
Methods
 | Name | Description
Public method | CompileTimeValidate | Method invoked at build time to ensure that the aspect has been applied to the right target.
Top
See Also

Reference

PostSharp.Patterns.Model Namespace

Other Resources

Conceptual: Handling Corner Cases of the NotifyPropertyChanged Aspect
Conceptual: Understanding the NotifyPropertyChanged Aspect


PureAttribute Constructor

Initializes a new instance of the PureAttribute class

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public PureAttribute()
See Also

Reference

PureAttribute Class
PostSharp.Patterns.Model Namespace


PureAttribute Properties

The PureAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Top
See Also

Reference

PureAttribute Class
PostSharp.Patterns.Model Namespace


PureAttribute Methods

The PureAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeValidate | Method invoked at build time to ensure that the aspect has been applied to the right target.
Top
See Also

Reference

PureAttribute Class
PostSharp.Patterns.Model Namespace


PureAttribute.CompileTimeValidate Method

PureAttributeCompileTimeValidate Method

Method invoked at build time to ensure that the aspect has been applied to the right target.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool CompileTimeValidate(
    Object target
)

Parameters

target
Type: SystemObject
Target element.

Return Value

Type: Boolean
true if the aspect was applied to an acceptable target, otherwise false.

Implements

IValidableAnnotationCompileTimeValidate(Object)
Remarks
The implementation of this method is expected to emit an error message or an exception of type InvalidAnnotationException in case of error. Only returning false causes the aspect to be silently ignored.
See Also

Reference

PureAttribute Class
PostSharp.Patterns.Model Namespace


ReferenceAttribute Class

Custom attribute that, when applied to a field or automatic property, specifies that this field or property is a simple reference, and is not involved in a parent-child relationship.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Patterns.ModelMemberRelationshipAttribute
PostSharp.Patterns.ModelReferenceAttribute

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ReferenceAttribute : MemberRelationshipAttribute

The ReferenceAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | ReferenceAttribute | Initializes a new instance of the ReferenceAttribute class
Top
Methods
 | Name | Description
Public method | CompileTimeValidate | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MemberRelationshipAttribute.)
Top
See Also

Reference

PostSharp.Patterns.Model Namespace
PostSharp.Patterns.ModelChildAttribute
PostSharp.Patterns.ModelParentAttribute
PostSharp.Patterns.ModelAggregatableAttribute

Other Resources

Conceptual: Actor Threading Model
Conceptual: Annotating an Object Model for Parent/Child Relationships (Aggregatable)
Conceptual: Parent/Child, Visitor and Disposable
Conceptual: Rule-Based Annotation
Conceptual: Working With Child Collections


ReferenceAttribute Constructor

Initializes a new instance of the ReferenceAttribute class

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ReferenceAttribute()
See Also

Reference

ReferenceAttribute Class
PostSharp.Patterns.Model Namespace


ReferenceAttribute Methods

The ReferenceAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeValidate | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MemberRelationshipAttribute.)
Top
See Also

Reference

ReferenceAttribute Class
PostSharp.Patterns.Model Namespace


RelationshipInfo Structure

Describes the relationship between a parent and a child.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public struct RelationshipInfo : IEquatable<RelationshipInfo>

The RelationshipInfo type exposes the following members.

Constructors
 | Name | Description
Public method | RelationshipInfo | Initializes a new instance of the RelationshipInfo type.
Top
Properties
 | Name | Description
Public property | ItemsRelationship | Gets the kind of relationship of items of the child collection relatively to the child collection.
Public property | PropagateBehaviors | Specifies whether behaviors of the parent should be propagated to objects assigned to the field.
Public property | PropagateBehaviorsToItems | Specifies whether behaviors of the parent should be propagated to objects added to collections assigned to this field. This property is ignored if PropagateBehaviors is false.
Public property | Relationship | Gets the kind of relationship of the child relatively to the parent. Valid values are Child, ParentSurrogate or ChildOrParentSurrogate.
Top
Methods
 | Name | Description
Public method | Equals(Object) | Indicates whether this instance and a specified object are equal. (Overrides ValueTypeEquals(Object).)
Public method | Equals(RelationshipInfo) |
Public method | GetHashCode | Returns the hash code for this instance. (Overrides ValueTypeGetHashCode.)
Top
Operators
Name | Description
Equality | Determines whether two instances of the RelationshipInfo type are equal.
Inequality | Determines whether two instances of the RelationshipInfo type are equal.
Top
See Also

Reference

PostSharp.Patterns.Model Namespace

Other Resources

Conceptual: Rule-Based Annotation


RelationshipInfo Constructor

Initializes a new instance of the RelationshipInfo type.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public RelationshipInfo(
    RelationshipKind itemsRelationship,
    RelationshipKind relationship = RelationshipKind.Child
)

Parameters

itemsRelationship
Type: PostSharp.Patterns.ModelRelationshipKind
The kind of relationship of items of the child collection relatively to the child collection.
relationship (Optional)
Type: PostSharp.Patterns.ModelRelationshipKind
The kind of relationship of the child relatively to the parent. Valid values are Child, ParentSurrogate or ChildOrParentSurrogate.
See Also

Reference

RelationshipInfo Structure
PostSharp.Patterns.Model Namespace


RelationshipInfo Properties

The RelationshipInfo type exposes the following members.

Properties
 | Name | Description
Public property | ItemsRelationship | Gets the kind of relationship of items of the child collection relatively to the child collection.
Public property | PropagateBehaviors | Specifies whether behaviors of the parent should be propagated to objects assigned to the field.
Public property | PropagateBehaviorsToItems | Specifies whether behaviors of the parent should be propagated to objects added to collections assigned to this field. This property is ignored if PropagateBehaviors is false.
Public property | Relationship | Gets the kind of relationship of the child relatively to the parent. Valid values are Child, ParentSurrogate or ChildOrParentSurrogate.
Top
See Also

Reference

RelationshipInfo Structure
PostSharp.Patterns.Model Namespace


RelationshipInfo.ItemsRelationship Property

RelationshipInfoItemsRelationship Property

Gets the kind of relationship of items of the child collection relatively to the child collection.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public RelationshipKind ItemsRelationship { get; }

Property Value

Type: RelationshipKind
See Also

Reference

RelationshipInfo Structure
PostSharp.Patterns.Model Namespace


RelationshipInfo.PropagateBehaviors Property

RelationshipInfoPropagateBehaviors Property

Specifies whether behaviors of the parent should be propagated to objects assigned to the field.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool PropagateBehaviors { get; }

Property Value

Type: Boolean
See Also

Reference

RelationshipInfo Structure
PostSharp.Patterns.Model Namespace


RelationshipInfo.PropagateBehaviorsToItems Property

RelationshipInfoPropagateBehaviorsToItems Property

Specifies whether behaviors of the parent should be propagated to objects added to collections assigned to this field. This property is ignored if PropagateBehaviors is false.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool PropagateBehaviorsToItems { get; }

Property Value

Type: Boolean
See Also

Reference

RelationshipInfo Structure
PostSharp.Patterns.Model Namespace


RelationshipInfo.Relationship Property

RelationshipInfoRelationship Property

Gets the kind of relationship of the child relatively to the parent. Valid values are Child, ParentSurrogate or ChildOrParentSurrogate.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public RelationshipKind Relationship { get; }

Property Value

Type: RelationshipKind
See Also

Reference

RelationshipInfo Structure
PostSharp.Patterns.Model Namespace


RelationshipInfo Methods

The RelationshipInfo type exposes the following members.

Methods
 | Name | Description
Public method | Equals(Object) | Indicates whether this instance and a specified object are equal. (Overrides ValueTypeEquals(Object).)
Public method | Equals(RelationshipInfo) |
Public method | GetHashCode | Returns the hash code for this instance. (Overrides ValueTypeGetHashCode.)
Top
See Also

Reference

RelationshipInfo Structure
PostSharp.Patterns.Model Namespace


RelationshipInfo.Equals Method

RelationshipInfoEquals Method

Overload List
 | Name | Description
Public method | Equals(Object) | Indicates whether this instance and a specified object are equal. (Overrides ValueTypeEquals(Object).)
Public method | Equals(RelationshipInfo) |
Top
See Also

Reference

RelationshipInfo Structure
PostSharp.Patterns.Model Namespace


RelationshipInfo.Equals Method (Object)

RelationshipInfoEquals Method (Object)

Indicates whether this instance and a specified object are equal.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool Equals(
    Object obj
)

Parameters

obj
Type: SystemObject
The object to compare with the current instance.

Return Value

Type: Boolean
true if obj and this instance are the same type and represent the same value; otherwise, false.
See Also

Reference

RelationshipInfo Structure
Equals Overload
PostSharp.Patterns.Model Namespace


RelationshipInfo.Equals Method (RelationshipInfo)

RelationshipInfoEquals Method (RelationshipInfo)

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Equals(
    RelationshipInfo other
)

Parameters

other
Type: PostSharp.Patterns.ModelRelationshipInfo

Return Value

Type: Boolean

Implements

IEquatableTEquals(T)
See Also

Reference

RelationshipInfo Structure
Equals Overload
PostSharp.Patterns.Model Namespace


RelationshipInfo.GetHashCode Method

RelationshipInfoGetHashCode Method

Returns the hash code for this instance.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override int GetHashCode()

Return Value

Type: Int32
A 32-bit signed integer that is the hash code for this instance.
See Also

Reference

RelationshipInfo Structure
PostSharp.Patterns.Model Namespace


RelationshipInfo Operators

The RelationshipInfo type exposes the following members.

Operators
Name | Description
Equality | Determines whether two instances of the RelationshipInfo type are equal.
Inequality | Determines whether two instances of the RelationshipInfo type are equal.
Top
See Also

Reference

RelationshipInfo Structure
PostSharp.Patterns.Model Namespace


RelationshipInfo.Equality Operator

RelationshipInfoEquality Operator

Determines whether two instances of the RelationshipInfo type are equal.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool operator ==(
    RelationshipInfo left,
    RelationshipInfo right
)

Parameters

left
Type: PostSharp.Patterns.ModelRelationshipInfo
right
Type: PostSharp.Patterns.ModelRelationshipInfo

Return Value

Type: Boolean
See Also

Reference

RelationshipInfo Structure
PostSharp.Patterns.Model Namespace


RelationshipInfo.Inequality Operator

RelationshipInfoInequality Operator

Determines whether two instances of the RelationshipInfo type are equal.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool operator !=(
    RelationshipInfo left,
    RelationshipInfo right
)

Parameters

left
Type: PostSharp.Patterns.ModelRelationshipInfo
right
Type: PostSharp.Patterns.ModelRelationshipInfo

Return Value

Type: Boolean
See Also

Reference

RelationshipInfo Structure
PostSharp.Patterns.Model Namespace


RelationshipKind Enumeration

Enumeration of the kinds of relationship between objects in a object graph.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[FlagsAttribute]
public enum RelationshipKind
Members
Member name | Value | Description
None | 0 | No relationship.
Default | 1 | Means that the relationship kind has not been specified. The typical behavior is a build-time error or warning.
Child | 2 | Child (see ChildAttribute).
Reference | 4 | Reference (see ReferenceAttribute).
ParentSurrogate | 8 | Parent surrogate (see IsParentSurrogate).
Parent | 16 | Parent (see ParentAttribute).
ChildOrParentSurrogate | 10 | Either Child or ParentSurrogate, depending on the type of the specific object assigned to the field or property. This is the default relationship kind for ChildAttribute when the IsParentSurrogate property is not set: it causes the field to be a ParentSurrogate if the object is an AdvisableCollectionT or an AdvisableDictionaryTKey, TValue, otherwise a Child.
See Also

Reference

PostSharp.Patterns.Model Namespace


SafeForDependencyAnalysisAttribute Class

Custom attribute that, when applied on a property, prevents the dependency analysis algorithm used by the NotifyPropertyChangedAttribute aspect from emitting errors when it encounters constructs that it cannot analyze.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Patterns.ModelSafeForDependencyAnalysisAttribute

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class SafeForDependencyAnalysisAttribute : Attribute

The SafeForDependencyAnalysisAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | SafeForDependencyAnalysisAttribute | Initializes a new instance of the SafeForDependencyAnalysisAttribute class
Top
Remarks

Getters of properties annotated with SafeForDependencyAnalysisAttribute should typically specify dependencies manually using the Depends class. Note that all dependencies that can be found using code analysis will be taken into account. The SafeForDependencyAnalysisAttribute only disables errors, but not the code analysis itself.

See Also

Reference

PostSharp.Patterns.Model Namespace

Other Resources

Conceptual: Handling Corner Cases of the NotifyPropertyChanged Aspect


SafeForDependencyAnalysisAttribute Constructor

Initializes a new instance of the SafeForDependencyAnalysisAttribute class

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SafeForDependencyAnalysisAttribute()
See Also

Reference

SafeForDependencyAnalysisAttribute Class
PostSharp.Patterns.Model Namespace


WeakEventAttribute Class

Aspect that, when applied to an event, prevents the target event from holding a strong reference to event handlers. Therefore, the aspect prevents the event to prevent clients to be garbage collected.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsEventLevelAspect
PostSharp.AspectsEventInterceptionAspect
PostSharp.Patterns.ModelWeakEventAttribute

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class WeakEventAttribute : EventInterceptionAspect,
    IInstanceScopedAspect, IAspect

The WeakEventAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | WeakEventAttribute | Initializes a new instance of the WeakEventAttribute class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from EventLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from EventLevelAspect.)
Public method | CompileTimeValidate(EventInfo) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from EventLevelAspect.)
Protected method | Finalize | (Overrides ObjectFinalize.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | RuntimeInitialize | (Overrides EventLevelAspectRuntimeInitialize(EventInfo).)
Top
Remarks

Event clients do not need to keep a strong reference to the delegates passed to a weak event. The WeakEventAttribute implementation will keep delegate instances alive as long as the event source (i.e. whatever object the Target property points to) is alive, but no longer.

See Also

Reference

PostSharp.Patterns.Model Namespace

Other Resources

Conceptual: Weak Event


WeakEventAttribute Constructor

Initializes a new instance of the WeakEventAttribute class

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public WeakEventAttribute()
See Also

Reference

WeakEventAttribute Class
PostSharp.Patterns.Model Namespace


WeakEventAttribute Properties

The WeakEventAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

WeakEventAttribute Class
PostSharp.Patterns.Model Namespace


WeakEventAttribute Methods

The WeakEventAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from EventLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from EventLevelAspect.)
Public method | CompileTimeValidate(EventInfo) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from EventLevelAspect.)
Protected method | Finalize | (Overrides ObjectFinalize.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | RuntimeInitialize | (Overrides EventLevelAspectRuntimeInitialize(EventInfo).)
Top
See Also

Reference

WeakEventAttribute Class
PostSharp.Patterns.Model Namespace


WeakEventAttribute.Finalize Method

WeakEventAttributeFinalize Method

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void Finalize()

Implements

ObjectFinalize
See Also

Reference

WeakEventAttribute Class
PostSharp.Patterns.Model Namespace


WeakEventAttribute.RuntimeInitialize Method

WeakEventAttributeRuntimeInitialize Method

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void RuntimeInitialize(
    EventInfo eventInfo
)

Parameters

eventInfo
Type: System.ReflectionEventInfo

Implements

IEventLevelAspectRuntimeInitialize(EventInfo)
See Also

Reference

WeakEventAttribute Class
PostSharp.Patterns.Model Namespace


WeakEventStrategy Enumeration

Defines behavior of a weak event.

Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum WeakEventStrategy
Members
Member name | Value | Description
Default | 0 | Default behavior.
AlwaysWeak | 0 | Always keep weak references.
AlwaysStrong | 1 | Always keep strong references.
See Also

Reference

PostSharp.Patterns.Model Namespace


PostSharp.Patterns.Model.Controls Namespace

Classes
 | Class | Description
Public class | RedoButton | A typical implementation of a Redo button, with an optional and expandable list of operations that can be redone.
Public class | RedoCommand | A command that redoes a single operation in a Recorder.
Public class | StringEscaper | Implements an IValueConverter that escapes strings by changing _ into __.
Public class | UndoButton | A typical implementation of an Undo button, with an optional and expandable list of operations that can be undone.
Public class | UndoCommand | A command that undoes a single operation in a Recorder.
Public class | UndoRedoButtonBase | Base class for UndoButton and RedoButton.
Public class | UndoRedoCommandBase | Base class for UndoCommand and RedoCommand.


RedoButton Class

A typical implementation of a Redo button, with an optional and expandable list of operations that can be redone.
Inheritance Hierarchy
SystemObject
System.Windows.ThreadingDispatcherObject
System.WindowsDependencyObject
System.Windows.MediaVisual
System.WindowsUIElement
System.WindowsFrameworkElement
System.Windows.ControlsControl
System.Windows.ControlsContentControl
System.Windows.Controls.PrimitivesButtonBase
System.Windows.ControlsButton
PostSharp.Patterns.Model.ControlsUndoRedoButtonBase
PostSharp.Patterns.Model.ControlsRedoButton

Namespace: PostSharp.Patterns.Model.Controls
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class RedoButton : UndoRedoButtonBase

The RedoButton type exposes the following members.

Constructors
 | Name | Description
Public method | RedoButton | Initializes a new instance of the RedoButton class.
Top
Properties
 | Name | Description
Protected property | IsEnabledCore | Gets the value of the IsEnabled property. (Inherited from UndoRedoButtonBase.)
Public property | IsListEnabled | Determines whether the button can be extended and display the list of operations that can be undone or redone. (Inherited from UndoRedoButtonBase.)
Public property | IsListExpanded | Determines whether the detailed list of operations is currently expanded. (Inherited from UndoRedoButtonBase.)
Public property | MaxOperationsCount | Gets or sets the maximal number of operations displayed by the current button. (Inherited from UndoRedoButtonBase.)
Public property | Operations | Gets the list of operations displayed by the current button when in expanded state. (Inherited from UndoRedoButtonBase.)
Public property | Recorder | Gets or sets the Recorder bound to the current control. (Inherited from UndoRedoButtonBase.)
Public property | UndoCommand | Gets or sets the command used execute the Undo action. (Inherited from UndoRedoButtonBase.)
Top
Methods
 | Name | Description
Public method | OnApplyTemplate | When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate. (Inherited from UndoRedoButtonBase.)
Protected method | OnClick | Called when a Button is clicked. (Inherited from UndoRedoButtonBase.)
Protected method | OnKeyDown | Provides class handling for the KeyDown routed event that occurs when the user presses a key while this control has focus. (Inherited from UndoRedoButtonBase.)
Protected method | OnPropertyChanged | Raises the PropertyChanged event. (Inherited from UndoRedoButtonBase.)
Top
Events
 | Name | Description
Public event | PropertyChanged | Event raised when the value of a property of the current object changes. (Inherited from UndoRedoButtonBase.)
Top
See Also

Reference

PostSharp.Patterns.Model.Controls Namespace


RedoButton Constructor

Initializes a new instance of the RedoButton class.

Namespace: PostSharp.Patterns.Model.Controls
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public RedoButton()
See Also

Reference

RedoButton Class
PostSharp.Patterns.Model.Controls Namespace


RedoButton Properties

The RedoButton type exposes the following members.

Properties
 | Name | Description
Protected property | IsEnabledCore | Gets the value of the IsEnabled property. (Inherited from UndoRedoButtonBase.)
Public property | IsListEnabled | Determines whether the button can be extended and display the list of operations that can be undone or redone. (Inherited from UndoRedoButtonBase.)
Public property | IsListExpanded | Determines whether the detailed list of operations is currently expanded. (Inherited from UndoRedoButtonBase.)
Public property | MaxOperationsCount | Gets or sets the maximal number of operations displayed by the current button. (Inherited from UndoRedoButtonBase.)
Public property | Operations | Gets the list of operations displayed by the current button when in expanded state. (Inherited from UndoRedoButtonBase.)
Public property | Recorder | Gets or sets the Recorder bound to the current control. (Inherited from UndoRedoButtonBase.)
Public property | UndoCommand | Gets or sets the command used execute the Undo action. (Inherited from UndoRedoButtonBase.)
Top
See Also

Reference

RedoButton Class
PostSharp.Patterns.Model.Controls Namespace


RedoButton Methods

The RedoButton type exposes the following members.

Methods
 | Name | Description
Public method | OnApplyTemplate | When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate. (Inherited from UndoRedoButtonBase.)
Protected method | OnClick | Called when a Button is clicked. (Inherited from UndoRedoButtonBase.)
Protected method | OnKeyDown | Provides class handling for the KeyDown routed event that occurs when the user presses a key while this control has focus. (Inherited from UndoRedoButtonBase.)
Protected method | OnPropertyChanged | Raises the PropertyChanged event. (Inherited from UndoRedoButtonBase.)
Top
See Also

Reference

RedoButton Class
PostSharp.Patterns.Model.Controls Namespace


RedoButton Events

The RedoButton type exposes the following members.

Events
 | Name | Description
Public event | PropertyChanged | Event raised when the value of a property of the current object changes. (Inherited from UndoRedoButtonBase.)
Top
See Also

Reference

RedoButton Class
PostSharp.Patterns.Model.Controls Namespace


RedoCommand Class

A command that redoes a single operation in a Recorder.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Model.ControlsUndoRedoCommandBase
PostSharp.Patterns.Model.ControlsRedoCommand

Namespace: PostSharp.Patterns.Model.Controls
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class RedoCommand : UndoRedoCommandBase

The RedoCommand type exposes the following members.

Constructors
 | Name | Description
Public method | RedoCommand | Initializes a new instance of the RedoCommand class and binds it to the DefaultRecorder.
Public method | RedoCommand(Recorder) | Initializes a new instance of the UndoCommand class and specifies to which Recorder it should be bound.
Top
Properties
 | Name | Description
Public property | Recorder | Gets the Recorder bound to this command. (Inherited from UndoRedoCommandBase.)
Top
Methods
 | Name | Description
Public method | CanExecute | Defines the method that determines whether the command can execute in its current state. (Inherited from UndoRedoCommandBase.)
Public method | Execute | Defines the method to be called when the command is invoked. (Inherited from UndoRedoCommandBase.)
Top
Events
 | Name | Description
Public event | CanExecuteChanged | Occurs when changes occur that affect whether or not the command should execute. (Inherited from UndoRedoCommandBase.)
Top
See Also

Reference

PostSharp.Patterns.Model.Controls Namespace


RedoCommand Constructor

Overload List
 | Name | Description
Public method | RedoCommand | Initializes a new instance of the RedoCommand class and binds it to the DefaultRecorder.
Public method | RedoCommand(Recorder) | Initializes a new instance of the UndoCommand class and specifies to which Recorder it should be bound.
Top
See Also

Reference

RedoCommand Class
PostSharp.Patterns.Model.Controls Namespace


RedoCommand Constructor

Initializes a new instance of the RedoCommand class and binds it to the DefaultRecorder.

Namespace: PostSharp.Patterns.Model.Controls
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public RedoCommand()
See Also

Reference

RedoCommand Class
RedoCommand Overload
PostSharp.Patterns.Model.Controls Namespace


RedoCommand Constructor (Recorder)

Initializes a new instance of the UndoCommand class and specifies to which Recorder it should be bound.

Namespace: PostSharp.Patterns.Model.Controls
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public RedoCommand(
    Recorder recorder
)

Parameters

recorder
Type: PostSharp.Patterns.RecordingRecorder
The Recorder to which the new RedoCommand should be bound.
See Also

Reference

RedoCommand Class
RedoCommand Overload
PostSharp.Patterns.Model.Controls Namespace


RedoCommand Properties

The RedoCommand type exposes the following members.

Properties
 | Name | Description
Public property | Recorder | Gets the Recorder bound to this command. (Inherited from UndoRedoCommandBase.)
Top
See Also

Reference

RedoCommand Class
PostSharp.Patterns.Model.Controls Namespace


RedoCommand Methods

The RedoCommand type exposes the following members.

Methods
 | Name | Description
Public method | CanExecute | Defines the method that determines whether the command can execute in its current state. (Inherited from UndoRedoCommandBase.)
Public method | Execute | Defines the method to be called when the command is invoked. (Inherited from UndoRedoCommandBase.)
Top
See Also

Reference

RedoCommand Class
PostSharp.Patterns.Model.Controls Namespace


RedoCommand Events

The RedoCommand type exposes the following members.

Events
 | Name | Description
Public event | CanExecuteChanged | Occurs when changes occur that affect whether or not the command should execute. (Inherited from UndoRedoCommandBase.)
Top
See Also

Reference

RedoCommand Class
PostSharp.Patterns.Model.Controls Namespace


StringEscaper Class

Implements an IValueConverter that escapes strings by changing _ into __.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Model.ControlsStringEscaper

Namespace: PostSharp.Patterns.Model.Controls
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class StringEscaper : IValueConverter

The StringEscaper type exposes the following members.

Constructors
 | Name | Description
Public method | StringEscaper | Initializes a new instance of the StringEscaper class
Top
Methods
 | Name | Description
Public method | Convert | Converts a value.
Public method | ConvertBack | Converts a value.
Top
See Also

Reference

PostSharp.Patterns.Model.Controls Namespace


StringEscaper Constructor

Initializes a new instance of the StringEscaper class

Namespace: PostSharp.Patterns.Model.Controls
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public StringEscaper()
See Also

Reference

StringEscaper Class
PostSharp.Patterns.Model.Controls Namespace


StringEscaper Methods

The StringEscaper type exposes the following members.

Methods
 | Name | Description
Public method | Convert | Converts a value.
Public method | ConvertBack | Converts a value.
Top
See Also

Reference

StringEscaper Class
PostSharp.Patterns.Model.Controls Namespace


StringEscaper.Convert Method

StringEscaperConvert Method

Converts a value.

Namespace: PostSharp.Patterns.Model.Controls
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Object Convert(
    Object value,
    Type targetType,
    Object parameter,
    CultureInfo culture
)

Parameters

value
Type: SystemObject
The value produced by the binding source.
targetType
Type: SystemType
The type of the binding target property.
parameter
Type: SystemObject
The converter parameter to use.
culture
Type: System.GlobalizationCultureInfo
The culture to use in the converter.

Return Value

Type: Object
A converted value. If the method returns , the valid null value is used.

Implements

IValueConverterConvert(Object, Type, Object, CultureInfo)
See Also

Reference

StringEscaper Class
PostSharp.Patterns.Model.Controls Namespace


StringEscaper.ConvertBack Method

StringEscaperConvertBack Method

Converts a value.

Namespace: PostSharp.Patterns.Model.Controls
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Object ConvertBack(
    Object value,
    Type targetType,
    Object parameter,
    CultureInfo culture
)

Parameters

value
Type: SystemObject
The value that is produced by the binding target.
targetType
Type: SystemType
The type to convert to.
parameter
Type: SystemObject
The converter parameter to use.
culture
Type: System.GlobalizationCultureInfo
The culture to use in the converter.

Return Value

Type: Object
A converted value. If the method returns , the valid null value is used.

Implements

IValueConverterConvertBack(Object, Type, Object, CultureInfo)
See Also

Reference

StringEscaper Class
PostSharp.Patterns.Model.Controls Namespace


UndoButton Class

A typical implementation of an Undo button, with an optional and expandable list of operations that can be undone.
Inheritance Hierarchy
SystemObject
System.Windows.ThreadingDispatcherObject
System.WindowsDependencyObject
System.Windows.MediaVisual
System.WindowsUIElement
System.WindowsFrameworkElement
System.Windows.ControlsControl
System.Windows.ControlsContentControl
System.Windows.Controls.PrimitivesButtonBase
System.Windows.ControlsButton
PostSharp.Patterns.Model.ControlsUndoRedoButtonBase
PostSharp.Patterns.Model.ControlsUndoButton

Namespace: PostSharp.Patterns.Model.Controls
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class UndoButton : UndoRedoButtonBase

The UndoButton type exposes the following members.

Constructors
 | Name | Description
Public method | UndoButton | Initializes a new instance of the UndoButton class.
Top
Properties
 | Name | Description
Protected property | IsEnabledCore | Gets the value of the IsEnabled property. (Inherited from UndoRedoButtonBase.)
Public property | IsListEnabled | Determines whether the button can be extended and display the list of operations that can be undone or redone. (Inherited from UndoRedoButtonBase.)
Public property | IsListExpanded | Determines whether the detailed list of operations is currently expanded. (Inherited from UndoRedoButtonBase.)
Public property | MaxOperationsCount | Gets or sets the maximal number of operations displayed by the current button. (Inherited from UndoRedoButtonBase.)
Public property | Operations | Gets the list of operations displayed by the current button when in expanded state. (Inherited from UndoRedoButtonBase.)
Public property | Recorder | Gets or sets the Recorder bound to the current control. (Inherited from UndoRedoButtonBase.)
Public property | UndoCommand | Gets or sets the command used execute the Undo action. (Inherited from UndoRedoButtonBase.)
Top
Methods
 | Name | Description
Public method | OnApplyTemplate | When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate. (Inherited from UndoRedoButtonBase.)
Protected method | OnClick | Called when a Button is clicked. (Inherited from UndoRedoButtonBase.)
Protected method | OnKeyDown | Provides class handling for the KeyDown routed event that occurs when the user presses a key while this control has focus. (Inherited from UndoRedoButtonBase.)
Protected method | OnPropertyChanged | Raises the PropertyChanged event. (Inherited from UndoRedoButtonBase.)
Top
Events
 | Name | Description
Public event | PropertyChanged | Event raised when the value of a property of the current object changes. (Inherited from UndoRedoButtonBase.)
Top
See Also

Reference

PostSharp.Patterns.Model.Controls Namespace


UndoButton Constructor

Initializes a new instance of the UndoButton class.

Namespace: PostSharp.Patterns.Model.Controls
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public UndoButton()
See Also

Reference

UndoButton Class
PostSharp.Patterns.Model.Controls Namespace


UndoButton Properties

The UndoButton type exposes the following members.

Properties
 | Name | Description
Protected property | IsEnabledCore | Gets the value of the IsEnabled property. (Inherited from UndoRedoButtonBase.)
Public property | IsListEnabled | Determines whether the button can be extended and display the list of operations that can be undone or redone. (Inherited from UndoRedoButtonBase.)
Public property | IsListExpanded | Determines whether the detailed list of operations is currently expanded. (Inherited from UndoRedoButtonBase.)
Public property | MaxOperationsCount | Gets or sets the maximal number of operations displayed by the current button. (Inherited from UndoRedoButtonBase.)
Public property | Operations | Gets the list of operations displayed by the current button when in expanded state. (Inherited from UndoRedoButtonBase.)
Public property | Recorder | Gets or sets the Recorder bound to the current control. (Inherited from UndoRedoButtonBase.)
Public property | UndoCommand | Gets or sets the command used execute the Undo action. (Inherited from UndoRedoButtonBase.)
Top
See Also

Reference

UndoButton Class
PostSharp.Patterns.Model.Controls Namespace


UndoButton Methods

The UndoButton type exposes the following members.

Methods
 | Name | Description
Public method | OnApplyTemplate | When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate. (Inherited from UndoRedoButtonBase.)
Protected method | OnClick | Called when a Button is clicked. (Inherited from UndoRedoButtonBase.)
Protected method | OnKeyDown | Provides class handling for the KeyDown routed event that occurs when the user presses a key while this control has focus. (Inherited from UndoRedoButtonBase.)
Protected method | OnPropertyChanged | Raises the PropertyChanged event. (Inherited from UndoRedoButtonBase.)
Top
See Also

Reference

UndoButton Class
PostSharp.Patterns.Model.Controls Namespace


UndoButton Events

The UndoButton type exposes the following members.

Events
 | Name | Description
Public event | PropertyChanged | Event raised when the value of a property of the current object changes. (Inherited from UndoRedoButtonBase.)
Top
See Also

Reference

UndoButton Class
PostSharp.Patterns.Model.Controls Namespace


UndoCommand Class

A command that undoes a single operation in a Recorder.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Model.ControlsUndoRedoCommandBase
PostSharp.Patterns.Model.ControlsUndoCommand

Namespace: PostSharp.Patterns.Model.Controls
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class UndoCommand : UndoRedoCommandBase

The UndoCommand type exposes the following members.

Constructors
 | Name | Description
Public method | UndoCommand | Initializes a new instance of the UndoCommand class and binds it to the DefaultRecorder.
Public method | UndoCommand(Recorder) | Initializes a new instance of the UndoCommand class and specifies to which Recorder it should be bound.
Top
Properties
 | Name | Description
Public property | Recorder | Gets the Recorder bound to this command. (Inherited from UndoRedoCommandBase.)
Top
Methods
 | Name | Description
Public method | CanExecute | Defines the method that determines whether the command can execute in its current state. (Inherited from UndoRedoCommandBase.)
Public method | Execute | Defines the method to be called when the command is invoked. (Inherited from UndoRedoCommandBase.)
Top
Events
 | Name | Description
Public event | CanExecuteChanged | Occurs when changes occur that affect whether or not the command should execute. (Inherited from UndoRedoCommandBase.)
Top
See Also

Reference

PostSharp.Patterns.Model.Controls Namespace


UndoCommand Constructor

Overload List
 | Name | Description
Public method | UndoCommand | Initializes a new instance of the UndoCommand class and binds it to the DefaultRecorder.
Public method | UndoCommand(Recorder) | Initializes a new instance of the UndoCommand class and specifies to which Recorder it should be bound.
Top
See Also

Reference

UndoCommand Class
PostSharp.Patterns.Model.Controls Namespace


UndoCommand Constructor

Initializes a new instance of the UndoCommand class and binds it to the DefaultRecorder.

Namespace: PostSharp.Patterns.Model.Controls
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public UndoCommand()
See Also

Reference

UndoCommand Class
UndoCommand Overload
PostSharp.Patterns.Model.Controls Namespace


UndoCommand Constructor (Recorder)

Initializes a new instance of the UndoCommand class and specifies to which Recorder it should be bound.

Namespace: PostSharp.Patterns.Model.Controls
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public UndoCommand(
    Recorder recorder
)

Parameters

recorder
Type: PostSharp.Patterns.RecordingRecorder
The Recorder to which the new UndoCommand should be bound.
See Also

Reference

UndoCommand Class
UndoCommand Overload
PostSharp.Patterns.Model.Controls Namespace


UndoCommand Properties

The UndoCommand type exposes the following members.

Properties
 | Name | Description
Public property | Recorder | Gets the Recorder bound to this command. (Inherited from UndoRedoCommandBase.)
Top
See Also

Reference

UndoCommand Class
PostSharp.Patterns.Model.Controls Namespace


UndoCommand Methods

The UndoCommand type exposes the following members.

Methods
 | Name | Description
Public method | CanExecute | Defines the method that determines whether the command can execute in its current state. (Inherited from UndoRedoCommandBase.)
Public method | Execute | Defines the method to be called when the command is invoked. (Inherited from UndoRedoCommandBase.)
Top
See Also

Reference

UndoCommand Class
PostSharp.Patterns.Model.Controls Namespace


UndoCommand Events

The UndoCommand type exposes the following members.

Events
 | Name | Description
Public event | CanExecuteChanged | Occurs when changes occur that affect whether or not the command should execute. (Inherited from UndoRedoCommandBase.)
Top
See Also

Reference

UndoCommand Class
PostSharp.Patterns.Model.Controls Namespace


UndoRedoButtonBase Class

Base class for UndoButton and RedoButton.
Inheritance Hierarchy
SystemObject
System.Windows.ThreadingDispatcherObject
System.WindowsDependencyObject
System.Windows.MediaVisual
System.WindowsUIElement
System.WindowsFrameworkElement
System.Windows.ControlsControl
System.Windows.ControlsContentControl
System.Windows.Controls.PrimitivesButtonBase
System.Windows.ControlsButton
PostSharp.Patterns.Model.ControlsUndoRedoButtonBase
PostSharp.Patterns.Model.ControlsRedoButton
PostSharp.Patterns.Model.ControlsUndoButton

Namespace: PostSharp.Patterns.Model.Controls
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class UndoRedoButtonBase : Button,
    INotifyPropertyChanged

The UndoRedoButtonBase type exposes the following members.

Properties
 | Name | Description
Protected property | IsEnabledCore | Gets the value of the IsEnabled property. (Overrides ButtonBaseIsEnabledCore.)
Public property | IsListEnabled | Determines whether the button can be extended and display the list of operations that can be undone or redone.
Public property | IsListExpanded | Determines whether the detailed list of operations is currently expanded.
Public property | MaxOperationsCount | Gets or sets the maximal number of operations displayed by the current button.
Public property | Operations | Gets the list of operations displayed by the current button when in expanded state.
Public property | Recorder | Gets or sets the Recorder bound to the current control.
Public property | UndoCommand | Gets or sets the command used execute the Undo action.
Top
Methods
 | Name | Description
Public method | OnApplyTemplate | When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate. (Overrides FrameworkElementOnApplyTemplate.)
Protected method | OnClick | Called when a Button is clicked. (Overrides ButtonOnClick.)
Protected method | OnKeyDown | Provides class handling for the KeyDown routed event that occurs when the user presses a key while this control has focus. (Overrides ButtonBaseOnKeyDown(KeyEventArgs).)
Protected method | OnPropertyChanged | Raises the PropertyChanged event.
Top
Events
 | Name | Description
Public event | PropertyChanged | Event raised when the value of a property of the current object changes.
Top
Fields
Name | Description
IsListEnabledProperty | Definition of the IsListEnabled property.
MaxOperationsCountProperty | Definition of the MaxOperationsCount property.
RecorderProperty | Definition of the Recorder dependency property.
UndoCommandProperty | Definition of the UndoCommand dependency property.
Top
See Also

Reference

PostSharp.Patterns.Model.Controls Namespace


UndoRedoButtonBase Properties

The UndoRedoButtonBase type exposes the following members.

Properties
 | Name | Description
Protected property | IsEnabledCore | Gets the value of the IsEnabled property. (Overrides ButtonBaseIsEnabledCore.)
Public property | IsListEnabled | Determines whether the button can be extended and display the list of operations that can be undone or redone.
Public property | IsListExpanded | Determines whether the detailed list of operations is currently expanded.
Public property | MaxOperationsCount | Gets or sets the maximal number of operations displayed by the current button.
Public property | Operations | Gets the list of operations displayed by the current button when in expanded state.
Public property | Recorder | Gets or sets the Recorder bound to the current control.
Public property | UndoCommand | Gets or sets the command used execute the Undo action.
Top
See Also

Reference

UndoRedoButtonBase Class
PostSharp.Patterns.Model.Controls Namespace


UndoRedoButtonBase.IsEnabledCore Property

UndoRedoButtonBaseIsEnabledCore Property

Gets the value of the IsEnabled property.

Namespace: PostSharp.Patterns.Model.Controls
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override bool IsEnabledCore { get; }

Return Value

Type: Boolean
if the control is enabled; otherwise, .
See Also

Reference

UndoRedoButtonBase Class
PostSharp.Patterns.Model.Controls Namespace


UndoRedoButtonBase.IsListEnabled Property

UndoRedoButtonBaseIsListEnabled Property

Determines whether the button can be extended and display the list of operations that can be undone or redone.

Namespace: PostSharp.Patterns.Model.Controls
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsListEnabled { get; set; }

Property Value

Type: Boolean
See Also

Reference

UndoRedoButtonBase Class
PostSharp.Patterns.Model.Controls Namespace


UndoRedoButtonBase.IsListExpanded Property

UndoRedoButtonBaseIsListExpanded Property

Determines whether the detailed list of operations is currently expanded.

Namespace: PostSharp.Patterns.Model.Controls
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsListExpanded { get; set; }

Property Value

Type: Boolean
See Also

Reference

UndoRedoButtonBase Class
PostSharp.Patterns.Model.Controls Namespace


UndoRedoButtonBase.MaxOperationsCount Property

UndoRedoButtonBaseMaxOperationsCount Property

Gets or sets the maximal number of operations displayed by the current button.

Namespace: PostSharp.Patterns.Model.Controls
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int MaxOperationsCount { get; set; }

Property Value

Type: Int32
See Also

Reference

UndoRedoButtonBase Class
PostSharp.Patterns.Model.Controls Namespace


UndoRedoButtonBase.Operations Property

UndoRedoButtonBaseOperations Property

Gets the list of operations displayed by the current button when in expanded state.

Namespace: PostSharp.Patterns.Model.Controls
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IEnumerable<Operation> Operations { get; }

Property Value

Type: IEnumerable Operation
See Also

Reference

UndoRedoButtonBase Class
PostSharp.Patterns.Model.Controls Namespace


UndoRedoButtonBase.Recorder Property

UndoRedoButtonBaseRecorder Property

Gets or sets the Recorder bound to the current control.

Namespace: PostSharp.Patterns.Model.Controls
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Recorder Recorder { get; set; }

Property Value

Type: Recorder
Remarks
When this property is not set, the ambient recorder is used.
See Also

Reference

UndoRedoButtonBase Class
PostSharp.Patterns.Model.Controls Namespace


UndoRedoButtonBase.UndoCommand Property

UndoRedoButtonBaseUndoCommand Property

Gets or sets the command used execute the Undo action.

Namespace: PostSharp.Patterns.Model.Controls
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public UndoRedoCommandBase UndoCommand { get; }

Property Value

Type: UndoRedoCommandBase
See Also

Reference

UndoRedoButtonBase Class
PostSharp.Patterns.Model.Controls Namespace


UndoRedoButtonBase Methods

The UndoRedoButtonBase type exposes the following members.

Methods
 | Name | Description
Public method | OnApplyTemplate | When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate. (Overrides FrameworkElementOnApplyTemplate.)
Protected method | OnClick | Called when a Button is clicked. (Overrides ButtonOnClick.)
Protected method | OnKeyDown | Provides class handling for the KeyDown routed event that occurs when the user presses a key while this control has focus. (Overrides ButtonBaseOnKeyDown(KeyEventArgs).)
Protected method | OnPropertyChanged | Raises the PropertyChanged event.
Top
See Also

Reference

UndoRedoButtonBase Class
PostSharp.Patterns.Model.Controls Namespace


UndoRedoButtonBase.OnApplyTemplate Method

UndoRedoButtonBaseOnApplyTemplate Method

When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate.

Namespace: PostSharp.Patterns.Model.Controls
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void OnApplyTemplate()
See Also

Reference

UndoRedoButtonBase Class
PostSharp.Patterns.Model.Controls Namespace


UndoRedoButtonBase.OnClick Method

UndoRedoButtonBaseOnClick Method

Called when a Button is clicked.

Namespace: PostSharp.Patterns.Model.Controls
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void OnClick()
See Also

Reference

UndoRedoButtonBase Class
PostSharp.Patterns.Model.Controls Namespace


UndoRedoButtonBase.OnKeyDown Method

UndoRedoButtonBaseOnKeyDown Method

Provides class handling for the KeyDown routed event that occurs when the user presses a key while this control has focus.

Namespace: PostSharp.Patterns.Model.Controls
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override void OnKeyDown(
    KeyEventArgs eventArgs
)

Parameters

eventArgs
Type: System.Windows.InputKeyEventArgs
See Also

Reference

UndoRedoButtonBase Class
PostSharp.Patterns.Model.Controls Namespace


UndoRedoButtonBase.OnPropertyChanged Method

UndoRedoButtonBaseOnPropertyChanged Method

Raises the PropertyChanged event.

Namespace: PostSharp.Patterns.Model.Controls
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void OnPropertyChanged(
    string propertyName
)

Parameters

propertyName
Type: SystemString
Name of the changed property.
See Also

Reference

UndoRedoButtonBase Class
PostSharp.Patterns.Model.Controls Namespace


UndoRedoButtonBase Events

The UndoRedoButtonBase type exposes the following members.

Events
 | Name | Description
Public event | PropertyChanged | Event raised when the value of a property of the current object changes.
Top
See Also

Reference

UndoRedoButtonBase Class
PostSharp.Patterns.Model.Controls Namespace


UndoRedoButtonBase.PropertyChanged Event

UndoRedoButtonBasePropertyChanged Event

Event raised when the value of a property of the current object changes.

Namespace: PostSharp.Patterns.Model.Controls
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public event PropertyChangedEventHandler PropertyChanged

Value

Type: System.ComponentModelPropertyChangedEventHandler

Implements

INotifyPropertyChangedPropertyChanged
See Also

Reference

UndoRedoButtonBase Class
PostSharp.Patterns.Model.Controls Namespace


UndoRedoButtonBase Fields

The UndoRedoButtonBase type exposes the following members.

Fields
Name | Description
IsListEnabledProperty | Definition of the IsListEnabled property.
MaxOperationsCountProperty | Definition of the MaxOperationsCount property.
RecorderProperty | Definition of the Recorder dependency property.
UndoCommandProperty | Definition of the UndoCommand dependency property.
Top
See Also

Reference

UndoRedoButtonBase Class
PostSharp.Patterns.Model.Controls Namespace


UndoRedoButtonBase.IsListEnabledProperty Field

UndoRedoButtonBaseIsListEnabledProperty Field

Definition of the IsListEnabled property.

Namespace: PostSharp.Patterns.Model.Controls
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static readonly DependencyProperty IsListEnabledProperty

Field Value

Type: DependencyProperty
See Also

Reference

UndoRedoButtonBase Class
PostSharp.Patterns.Model.Controls Namespace


UndoRedoButtonBase.MaxOperationsCountProperty Field

UndoRedoButtonBaseMaxOperationsCountProperty Field

Definition of the MaxOperationsCount property.

Namespace: PostSharp.Patterns.Model.Controls
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static readonly DependencyProperty MaxOperationsCountProperty

Field Value

Type: DependencyProperty
See Also

Reference

UndoRedoButtonBase Class
PostSharp.Patterns.Model.Controls Namespace


UndoRedoButtonBase.RecorderProperty Field

UndoRedoButtonBaseRecorderProperty Field

Definition of the Recorder dependency property.

Namespace: PostSharp.Patterns.Model.Controls
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static readonly DependencyProperty RecorderProperty

Field Value

Type: DependencyProperty
See Also

Reference

UndoRedoButtonBase Class
PostSharp.Patterns.Model.Controls Namespace


UndoRedoButtonBase.UndoCommandProperty Field

UndoRedoButtonBaseUndoCommandProperty Field

Definition of the UndoCommand dependency property.

Namespace: PostSharp.Patterns.Model.Controls
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static readonly DependencyProperty UndoCommandProperty

Field Value

Type: DependencyProperty
See Also

Reference

UndoRedoButtonBase Class
PostSharp.Patterns.Model.Controls Namespace


UndoRedoCommandBase Class

Base class for UndoCommand and RedoCommand.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Model.ControlsUndoRedoCommandBase
PostSharp.Patterns.Model.ControlsRedoCommand
PostSharp.Patterns.Model.ControlsUndoCommand

Namespace: PostSharp.Patterns.Model.Controls
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class UndoRedoCommandBase : ICommand

The UndoRedoCommandBase type exposes the following members.

Properties
 | Name | Description
Public property | Recorder | Gets the Recorder bound to this command.
Top
Methods
 | Name | Description
Public method | CanExecute | Defines the method that determines whether the command can execute in its current state.
Public method | Execute | Defines the method to be called when the command is invoked.
Top
Events
 | Name | Description
Public event | CanExecuteChanged | Occurs when changes occur that affect whether or not the command should execute.
Top
See Also

Reference

PostSharp.Patterns.Model.Controls Namespace


UndoRedoCommandBase Properties

The UndoRedoCommandBase type exposes the following members.

Properties
 | Name | Description
Public property | Recorder | Gets the Recorder bound to this command.
Top
See Also

Reference

UndoRedoCommandBase Class
PostSharp.Patterns.Model.Controls Namespace


UndoRedoCommandBase.Recorder Property

UndoRedoCommandBaseRecorder Property

Gets the Recorder bound to this command.

Namespace: PostSharp.Patterns.Model.Controls
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Recorder Recorder { get; }

Property Value

Type: Recorder
See Also

Reference

UndoRedoCommandBase Class
PostSharp.Patterns.Model.Controls Namespace


UndoRedoCommandBase Methods

The UndoRedoCommandBase type exposes the following members.

Methods
 | Name | Description
Public method | CanExecute | Defines the method that determines whether the command can execute in its current state.
Public method | Execute | Defines the method to be called when the command is invoked.
Top
See Also

Reference

UndoRedoCommandBase Class
PostSharp.Patterns.Model.Controls Namespace


UndoRedoCommandBase.CanExecute Method

UndoRedoCommandBaseCanExecute Method

Defines the method that determines whether the command can execute in its current state.

Namespace: PostSharp.Patterns.Model.Controls
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool CanExecute(
    Object parameter
)

Parameters

parameter
Type: SystemObject
Data used by the command. If the command does not require data to be passed, this object can be set to .

Return Value

Type: Boolean
if this command can be executed; otherwise, .

Implements

ICommandCanExecute(Object)
See Also

Reference

UndoRedoCommandBase Class
PostSharp.Patterns.Model.Controls Namespace


UndoRedoCommandBase.Execute Method

UndoRedoCommandBaseExecute Method

Defines the method to be called when the command is invoked.

Namespace: PostSharp.Patterns.Model.Controls
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Execute(
    Object parameter
)

Parameters

parameter
Type: SystemObject
Data used by the command. If the command does not require data to be passed, this object can be set to .

Implements

ICommandExecute(Object)
See Also

Reference

UndoRedoCommandBase Class
PostSharp.Patterns.Model.Controls Namespace


UndoRedoCommandBase Events

The UndoRedoCommandBase type exposes the following members.

Events
 | Name | Description
Public event | CanExecuteChanged | Occurs when changes occur that affect whether or not the command should execute.
Top
See Also

Reference

UndoRedoCommandBase Class
PostSharp.Patterns.Model.Controls Namespace


UndoRedoCommandBase.CanExecuteChanged Event

UndoRedoCommandBaseCanExecuteChanged Event

Occurs when changes occur that affect whether or not the command should execute.

Namespace: PostSharp.Patterns.Model.Controls
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public event EventHandler CanExecuteChanged

Value

Type: SystemEventHandler

Implements

ICommandCanExecuteChanged
See Also

Reference

UndoRedoCommandBase Class
PostSharp.Patterns.Model.Controls Namespace


PostSharp.Patterns.Model.TypeAdapters Namespace

Classes
 | Class | Description
Public class | FieldRule | Exposes a method GetRelationshipInfo(FieldInfo) that allows to mark a field as Child or Reference programmatically, without custom attribute.
Public class | RegisterFieldRuleAttribute | Custom attribute that registers a FieldRule. The custom attribute must be applied to the current project at assembly-level.
Public class | RegisterTypeAdapterAttribute | Custom attribute that registers a TypeAdapter. The custom attribute must be applied to the current project at assembly-level.
Public class | TypeAdapter | Adapter that implements the features otherwise added by AggregatableAttribute to external or third-party types.
Public class | TypeAdapterFactory | Factory class for the TypeAdapter type. Implementations must have a public default constructor.


FieldRule Class

Exposes a method GetRelationshipInfo(FieldInfo) that allows to mark a field as Child or Reference programmatically, without custom attribute.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Model.TypeAdaptersFieldRule

Namespace: PostSharp.Patterns.Model.TypeAdapters
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class FieldRule

The FieldRule type exposes the following members.

Constructors
 | Name | Description
Protected method | FieldRule | Initializes a new instance of the FieldRule class
Top
Methods
 | Name | Description
Public method | GetRelationshipInfo | Gets the RelationshipInfo of a given field.
Top
Remarks

Field rules must be registered using the RegisterFieldRuleAttribute custom attribute.

See Also

Reference

PostSharp.Patterns.Model.TypeAdapters Namespace

Other Resources

Conceptual: Pushing Information to PostSharp Tools Programmatically
Conceptual: Rule-Based Annotation
Conceptual: What's New in PostSharp 4.2


FieldRule Constructor

Initializes a new instance of the FieldRule class

Namespace: PostSharp.Patterns.Model.TypeAdapters
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected FieldRule()
See Also

Reference

FieldRule Class
PostSharp.Patterns.Model.TypeAdapters Namespace


FieldRule Methods

The FieldRule type exposes the following members.

Methods
 | Name | Description
Public method | GetRelationshipInfo | Gets the RelationshipInfo of a given field.
Top
See Also

Reference

FieldRule Class
PostSharp.Patterns.Model.TypeAdapters Namespace


FieldRule.GetRelationshipInfo Method

FieldRuleGetRelationshipInfo Method

Gets the RelationshipInfo of a given field.

Namespace: PostSharp.Patterns.Model.TypeAdapters
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract Nullable<RelationshipInfo> GetRelationshipInfo(
    FieldInfo field
)

Parameters

field
Type: System.ReflectionFieldInfo
A FieldInfo that is not annotated by any MemberRelationshipAttribute.

Return Value

Type: Nullable RelationshipInfo
A RelationshipInfo structure for field, or null if the current FieldRule does not know how to handle field.
See Also

Reference

FieldRule Class
PostSharp.Patterns.Model.TypeAdapters Namespace

Other Resources

Conceptual: Rule-Based Annotation


RegisterFieldRuleAttribute Class

Custom attribute that registers a FieldRule. The custom attribute must be applied to the current project at assembly-level.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Patterns.Model.TypeAdaptersRegisterFieldRuleAttribute

Namespace: PostSharp.Patterns.Model.TypeAdapters
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class RegisterFieldRuleAttribute : Attribute

The RegisterFieldRuleAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | RegisterFieldRuleAttribute | Initializes a new instance of the RegisterFieldRuleAttribute type.
Top
Properties
 | Name | Description
Public property | FieldRuleType | Gets the Type (derived from FieldRule).
Top
See Also

Reference

PostSharp.Patterns.Model.TypeAdapters Namespace

Other Resources

Conceptual: Rule-Based Annotation


RegisterFieldRuleAttribute Constructor

Initializes a new instance of the RegisterFieldRuleAttribute type.

Namespace: PostSharp.Patterns.Model.TypeAdapters
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public RegisterFieldRuleAttribute(
    Type fieldRuleType
)

Parameters

fieldRuleType
Type: SystemType
A Type derived from FieldRule. The type must have a default constructor.
See Also

Reference

RegisterFieldRuleAttribute Class
PostSharp.Patterns.Model.TypeAdapters Namespace


RegisterFieldRuleAttribute Properties

The RegisterFieldRuleAttribute type exposes the following members.

Properties
 | Name | Description
Public property | FieldRuleType | Gets the Type (derived from FieldRule).
Top
See Also

Reference

RegisterFieldRuleAttribute Class
PostSharp.Patterns.Model.TypeAdapters Namespace


RegisterFieldRuleAttribute.FieldRuleType Property

RegisterFieldRuleAttributeFieldRuleType Property

Gets the Type (derived from FieldRule).

Namespace: PostSharp.Patterns.Model.TypeAdapters
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Type FieldRuleType { get; }

Property Value

Type: Type
See Also

Reference

RegisterFieldRuleAttribute Class
PostSharp.Patterns.Model.TypeAdapters Namespace


RegisterTypeAdapterAttribute Class

Custom attribute that registers a TypeAdapter. The custom attribute must be applied to the current project at assembly-level.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Patterns.Model.TypeAdaptersRegisterTypeAdapterAttribute

Namespace: PostSharp.Patterns.Model.TypeAdapters
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class RegisterTypeAdapterAttribute : Attribute

The RegisterTypeAdapterAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | RegisterTypeAdapterAttribute(String, Type) | Initializes a new RegisterFieldRuleAttribute and specifies the name of the target type. Use this constructor when the target type is not in the current assembly or in an assembly referenced by the current assembly.
Public method | RegisterTypeAdapterAttribute(Type, Type) | Initializes a new RegisterFieldRuleAttribute and specifies the name of the target type.
Top
Properties
 | Name | Description
Public property | TargetTypeName | Gets the name of the target type.
Public property | TypeAdapterFactoryType | Gets the Type (derived from TypeAdapterFactory).
Top
See Also

Reference

PostSharp.Patterns.Model.TypeAdapters Namespace


RegisterTypeAdapterAttribute Constructor

Overload List
 | Name | Description
Public method | RegisterTypeAdapterAttribute(String, Type) | Initializes a new RegisterFieldRuleAttribute and specifies the name of the target type. Use this constructor when the target type is not in the current assembly or in an assembly referenced by the current assembly.
Public method | RegisterTypeAdapterAttribute(Type, Type) | Initializes a new RegisterFieldRuleAttribute and specifies the name of the target type.
Top
See Also

Reference

RegisterTypeAdapterAttribute Class
PostSharp.Patterns.Model.TypeAdapters Namespace


RegisterTypeAdapterAttribute Constructor (String, Type)

Initializes a new RegisterFieldRuleAttribute and specifies the name of the target type. Use this constructor when the target type is not in the current assembly or in an assembly referenced by the current assembly.

Namespace: PostSharp.Patterns.Model.TypeAdapters
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public RegisterTypeAdapterAttribute(
    string targetTypeName,
    Type typeAdapterFactoryType
)

Parameters

targetTypeName
Type: SystemString
The name of the target type (equal to the FullName property of the target Type).
typeAdapterFactoryType
Type: SystemType
A Type derived from TypeAdapterFactory. The type must have a public default constructor.
See Also

Reference

RegisterTypeAdapterAttribute Class
RegisterTypeAdapterAttribute Overload
PostSharp.Patterns.Model.TypeAdapters Namespace


RegisterTypeAdapterAttribute Constructor (Type, Type)

Initializes a new RegisterFieldRuleAttribute and specifies the name of the target type.

Namespace: PostSharp.Patterns.Model.TypeAdapters
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public RegisterTypeAdapterAttribute(
    Type targetType,
    Type typeAdapterFactoryType
)

Parameters

targetType
Type: SystemType
The target Type.
typeAdapterFactoryType
Type: SystemType
A Type derived from TypeAdapterFactory. The type must have a public default constructor.
See Also

Reference

RegisterTypeAdapterAttribute Class
RegisterTypeAdapterAttribute Overload
PostSharp.Patterns.Model.TypeAdapters Namespace


RegisterTypeAdapterAttribute Properties

The RegisterTypeAdapterAttribute type exposes the following members.

Properties
 | Name | Description
Public property | TargetTypeName | Gets the name of the target type.
Public property | TypeAdapterFactoryType | Gets the Type (derived from TypeAdapterFactory).
Top
See Also

Reference

RegisterTypeAdapterAttribute Class
PostSharp.Patterns.Model.TypeAdapters Namespace


RegisterTypeAdapterAttribute.TargetTypeName Property

RegisterTypeAdapterAttributeTargetTypeName Property

Gets the name of the target type.

Namespace: PostSharp.Patterns.Model.TypeAdapters
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string TargetTypeName { get; }

Property Value

Type: String
See Also

Reference

RegisterTypeAdapterAttribute Class
PostSharp.Patterns.Model.TypeAdapters Namespace


RegisterTypeAdapterAttribute.TypeAdapterFactoryType Property

RegisterTypeAdapterAttributeTypeAdapterFactoryType Property

Gets the Type (derived from TypeAdapterFactory).

Namespace: PostSharp.Patterns.Model.TypeAdapters
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Type TypeAdapterFactoryType { get; }

Property Value

Type: Type
See Also

Reference

RegisterTypeAdapterAttribute Class
PostSharp.Patterns.Model.TypeAdapters Namespace


TypeAdapter Class

Adapter that implements the features otherwise added by AggregatableAttribute to external or third-party types.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Model.TypeAdaptersTypeAdapter

Namespace: PostSharp.Patterns.Model.TypeAdapters
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class TypeAdapter

The TypeAdapter type exposes the following members.

Constructors
 | Name | Description
Protected method | TypeAdapter(Boolean) | Initializes a new TypeAdapter for no specific type.
Protected method | TypeAdapter(Type) | Initializes a new TypeAdapter for a specific AdaptedType.
Top
Properties
 | Name | Description
Public property | AdaptedType | Gets the AdaptedType adapted by the current TypeAdapter, or null if the current TypeAdapter is not specific to any AdaptedType.
Public property | EligibleRelationshipKind | Determines which kind of relationships the adapted type can enter with respect to the parent object.
Public property | IsAnyInstanceImmutable | Determines whether any instance of this type or of any derived class is immutable.
Public property | IsAnyInstanceThreadSafe | Determines whether any instance of this type or of any derived class can be safely shared by several threads.
Public property | IsImmutable | Determines whether the adapted type is immutable.
Public property | IsThreadSafe | Determines whether instances of this type can be safely shared by several threads.
Public property | ObjectReferenceTypes | Gets a list of all types referenced from the adapted type.
Top
Methods
 | Name | Description
Protected method | AttachChild | Attaches an item to a parent. This method is typically invoked by implementations of AttachToParent(Object, RelationshipInfo, IAttacher, Object) to attach items or children to the parent.
Public method | AttachToParent | Attaches an object to a parent object.
Protected method | DetachChild | Detaches an item from its parent. This method is typically invoked by implementations of DetachFromParent(Object, Object, RelationshipInfo) to detach items or children from the parent.
Public method | DetachFromParent | Detaches an object from its parent object.
Public method | VisitChildren | Visit children or collection items.
Top
Remarks

Type adapters must be registered using the RegisterTypeAdapterAttribute custom attribute.

See Also

Reference

PostSharp.Patterns.Model.TypeAdapters Namespace

Other Resources

Conceptual: What's New in PostSharp 4.2


TypeAdapter Constructor

Overload List
 | Name | Description
Protected method | TypeAdapter(Boolean) | Initializes a new TypeAdapter for no specific type.
Protected method | TypeAdapter(Type) | Initializes a new TypeAdapter for a specific AdaptedType.
Top
See Also

Reference

TypeAdapter Class
PostSharp.Patterns.Model.TypeAdapters Namespace


TypeAdapter Constructor (Boolean)

Initializes a new TypeAdapter for no specific type.

Namespace: PostSharp.Patterns.Model.TypeAdapters
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected TypeAdapter(
    bool isSealed
)

Parameters

isSealed
Type: SystemBoolean
true if the TypeAdapter represents a type that cannot have derived types (such as a value type or a sealed class), otherwise false.
See Also

Reference

TypeAdapter Class
TypeAdapter Overload
PostSharp.Patterns.Model.TypeAdapters Namespace


TypeAdapter Constructor (Type)

Initializes a new TypeAdapter for a specific AdaptedType.

Namespace: PostSharp.Patterns.Model.TypeAdapters
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected TypeAdapter(
    Type type
)

Parameters

type
Type: SystemType
The AdaptedType being adapted.
See Also

Reference

TypeAdapter Class
TypeAdapter Overload
PostSharp.Patterns.Model.TypeAdapters Namespace


TypeAdapter Properties

The TypeAdapter type exposes the following members.

Properties
 | Name | Description
Public property | AdaptedType | Gets the AdaptedType adapted by the current TypeAdapter, or null if the current TypeAdapter is not specific to any AdaptedType.
Public property | EligibleRelationshipKind | Determines which kind of relationships the adapted type can enter with respect to the parent object.
Public property | IsAnyInstanceImmutable | Determines whether any instance of this type or of any derived class is immutable.
Public property | IsAnyInstanceThreadSafe | Determines whether any instance of this type or of any derived class can be safely shared by several threads.
Public property | IsImmutable | Determines whether the adapted type is immutable.
Public property | IsThreadSafe | Determines whether instances of this type can be safely shared by several threads.
Public property | ObjectReferenceTypes | Gets a list of all types referenced from the adapted type.
Top
See Also

Reference

TypeAdapter Class
PostSharp.Patterns.Model.TypeAdapters Namespace


TypeAdapter.AdaptedType Property

TypeAdapterAdaptedType Property

Gets the AdaptedType adapted by the current TypeAdapter, or null if the current TypeAdapter is not specific to any AdaptedType.

Namespace: PostSharp.Patterns.Model.TypeAdapters
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Type AdaptedType { get; }

Property Value

Type: Type
See Also

Reference

TypeAdapter Class
PostSharp.Patterns.Model.TypeAdapters Namespace


TypeAdapter.EligibleRelationshipKind Property

TypeAdapterEligibleRelationshipKind Property

Determines which kind of relationships the adapted type can enter with respect to the parent object.

Namespace: PostSharp.Patterns.Model.TypeAdapters
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual RelationshipKind EligibleRelationshipKind { get; }

Property Value

Type: RelationshipKind
See Also

Reference

TypeAdapter Class
PostSharp.Patterns.Model.TypeAdapters Namespace


TypeAdapter.IsAnyInstanceImmutable Property

TypeAdapterIsAnyInstanceImmutable Property

Determines whether any instance of this type or of any derived class is immutable.

Namespace: PostSharp.Patterns.Model.TypeAdapters
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual bool IsAnyInstanceImmutable { get; }

Property Value

Type: Boolean
Remarks

If the type is immutable but can have non-immutable instances of a derived type, the IsImmutable property shall be true but the IsAnyInstanceImmutable property shall be true.

See Also

Reference

TypeAdapter Class
PostSharp.Patterns.Model.TypeAdapters Namespace


TypeAdapter.IsAnyInstanceThreadSafe Property

TypeAdapterIsAnyInstanceThreadSafe Property

Determines whether any instance of this type or of any derived class can be safely shared by several threads.

Namespace: PostSharp.Patterns.Model.TypeAdapters
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual bool IsAnyInstanceThreadSafe { get; }

Property Value

Type: Boolean
Remarks

If the type is thread-safe but can have non-immutable instances of a derived type, the IsThreadSafe property shall be true but the IsAnyInstanceThreadSafe property shall be true.

See Also

Reference

TypeAdapter Class
PostSharp.Patterns.Model.TypeAdapters Namespace


TypeAdapter.IsImmutable Property

TypeAdapterIsImmutable Property

Determines whether the adapted type is immutable.

Namespace: PostSharp.Patterns.Model.TypeAdapters
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual bool IsImmutable { get; }

Property Value

Type: Boolean
Remarks

If the type is immutable but can have non-immutable instances of a derived type, the IsImmutable property shall be true but the IsAnyInstanceImmutable property shall be true.

See Also

Reference

TypeAdapter Class
PostSharp.Patterns.Model.TypeAdapters Namespace


TypeAdapter.IsThreadSafe Property

TypeAdapterIsThreadSafe Property

Determines whether instances of this type can be safely shared by several threads.

Namespace: PostSharp.Patterns.Model.TypeAdapters
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual bool IsThreadSafe { get; }

Property Value

Type: Boolean
Remarks

If the type is thread-safe but can have non-immutable instances of a derived type, the IsThreadSafe property shall be true but the IsAnyInstanceThreadSafe property shall be true.

See Also

Reference

TypeAdapter Class
PostSharp.Patterns.Model.TypeAdapters Namespace


TypeAdapter.ObjectReferenceTypes Property

TypeAdapterObjectReferenceTypes Property

Gets a list of all types referenced from the adapted type.

Namespace: PostSharp.Patterns.Model.TypeAdapters
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual IList<Type> ObjectReferenceTypes { get; }

Property Value

Type: IList Type
See Also

Reference

TypeAdapter Class
PostSharp.Patterns.Model.TypeAdapters Namespace


TypeAdapter Methods

The TypeAdapter type exposes the following members.

Methods
 | Name | Description
Protected method | AttachChild | Attaches an item to a parent. This method is typically invoked by implementations of AttachToParent(Object, RelationshipInfo, IAttacher, Object) to attach items or children to the parent.
Public method | AttachToParent | Attaches an object to a parent object.
Protected method | DetachChild | Detaches an item from its parent. This method is typically invoked by implementations of DetachFromParent(Object, Object, RelationshipInfo) to detach items or children from the parent.
Public method | DetachFromParent | Detaches an object from its parent object.
Public method | VisitChildren | Visit children or collection items.
Top
See Also

Reference

TypeAdapter Class
PostSharp.Patterns.Model.TypeAdapters Namespace


TypeAdapter.AttachChild Method

TypeAdapterAttachChild Method

Attaches an item to a parent. This method is typically invoked by implementations of AttachToParent(Object, RelationshipInfo, IAttacher, Object) to attach items or children to the parent.

Namespace: PostSharp.Patterns.Model.TypeAdapters
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected bool AttachChild(
    Object item,
    RelationshipInfo relationshipInfo,
    IAttacher attacher,
    Object attacherState
)

Parameters

item
Type: SystemObject
The object to attach.
relationshipInfo
Type: PostSharp.Patterns.ModelRelationshipInfo
Relationship of item with respect to the object represented by attacher and attacherState.
attacher
Type: PostSharp.Patterns.ModelIAttacher
An interface that represents to parent's ability to attach children.
attacherState
Type: SystemObject
An opaque state object to be passed to attacher.

Return Value

Type: Boolean
true if the current object was not previously attached to any parent, false if it was already attached to the same parent.
See Also

Reference

TypeAdapter Class
PostSharp.Patterns.Model.TypeAdapters Namespace


TypeAdapter.AttachToParent Method

TypeAdapterAttachToParent Method

Attaches an object to a parent object.

Namespace: PostSharp.Patterns.Model.TypeAdapters
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual bool AttachToParent(
    Object obj,
    RelationshipInfo relationshipInfo,
    IAttacher attacher,
    Object attacherState
)

Parameters

obj
Type: SystemObject
An instance of the adapted type.
relationshipInfo
Type: PostSharp.Patterns.ModelRelationshipInfo
Information about the relationship of the parent node relatively to the current node. The Relationship property must be set to Child or ParentSurrogate.
attacher
Type: PostSharp.Patterns.ModelIAttacher
A service that allows the current node to attach itself to the parent.
attacherState
Type: SystemObject
An opaque state object to be passed as the first argument to all methods of the IAttacher interface.

Return Value

Type: Boolean
true if the current object was not previously attached to any parent, false if it was already attached to the same parent.
Remarks

This method is equivalent to AttachToParent(RelationshipInfo, IAttacher, Object).

Implementations of this method can use the AttachChild(Object, RelationshipInfo, IAttacher, Object) method to attach items to the parent.

See Also

Reference

TypeAdapter Class
PostSharp.Patterns.Model.TypeAdapters Namespace


TypeAdapter.DetachChild Method

TypeAdapterDetachChild Method

Detaches an item from its parent. This method is typically invoked by implementations of DetachFromParent(Object, Object, RelationshipInfo) to detach items or children from the parent.

Namespace: PostSharp.Patterns.Model.TypeAdapters
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected bool DetachChild(
    Object item,
    Object itemParent,
    RelationshipInfo relationshipInfo
)

Parameters

item
Type: SystemObject
The object to detach.
itemParent
Type: SystemObject
Parent from which item is detached.
relationshipInfo
Type: PostSharp.Patterns.ModelRelationshipInfo
Relationship of item with respect to itemParent.

Return Value

Type: Boolean
true if the current object has been fully detached, i.e. is no longer attached to its parent by any other relationship, or false if the current object is still attached to the parent by some relationship.
See Also

Reference

TypeAdapter Class
PostSharp.Patterns.Model.TypeAdapters Namespace


TypeAdapter.DetachFromParent Method

TypeAdapterDetachFromParent Method

Detaches an object from its parent object.

Namespace: PostSharp.Patterns.Model.TypeAdapters
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual bool DetachFromParent(
    Object obj,
    Object parent,
    RelationshipInfo relationshipInfo
)

Parameters

obj
Type: SystemObject
An instance of the adapted type.
parent
Type: SystemObject
The object from which obj is detached.
relationshipInfo
Type: PostSharp.Patterns.ModelRelationshipInfo
Relationship of obj with respect to parent.

Return Value

Type: Boolean
true if the current object has been fully detached, i.e. is no longer attached to its parent by any other relationship, or false if the current object is still attached to the parent by some relationship.
Remarks

This method is equivalent to DetachFromParent.

Implementations of this method can use the DetachChild(Object, Object, RelationshipInfo) method to detach items from the parent.

See Also

Reference

TypeAdapter Class
PostSharp.Patterns.Model.TypeAdapters Namespace


TypeAdapter.VisitChildren Method

TypeAdapterVisitChildren Method

Visit children or collection items.

Namespace: PostSharp.Patterns.Model.TypeAdapters
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual bool VisitChildren(
    Object obj,
    ChildVisitor visitor,
    ChildVisitorOptions options,
    Object state
)

Parameters

obj
Type: SystemObject
An instance of the adapted type.
visitor
Type: PostSharp.Patterns.ModelChildVisitor
Visitor.
options
Type: PostSharp.Patterns.ModelChildVisitorOptions
Options.
state
Type: SystemObject
State to be passed to visitor.

Return Value

Type: Boolean
false if visitor returned Stop, otherwise true.
Remarks

This method is equivalent to VisitChildren(ChildVisitor, ChildVisitorOptions, Object).

See Also

Reference

TypeAdapter Class
PostSharp.Patterns.Model.TypeAdapters Namespace


TypeAdapterFactory Class

Factory class for the TypeAdapter type. Implementations must have a public default constructor.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Model.TypeAdaptersTypeAdapterFactory

Namespace: PostSharp.Patterns.Model.TypeAdapters
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class TypeAdapterFactory

The TypeAdapterFactory type exposes the following members.

Constructors
 | Name | Description
Protected method | TypeAdapterFactory | Initializes a new instance of the TypeAdapterFactory class
Top
Methods
 | Name | Description
Public method | CreateTypeAdapter | Creates a TypeAdapter for a specific Type.
Top
See Also

Reference

PostSharp.Patterns.Model.TypeAdapters Namespace


TypeAdapterFactory Constructor

Initializes a new instance of the TypeAdapterFactory class

Namespace: PostSharp.Patterns.Model.TypeAdapters
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected TypeAdapterFactory()
See Also

Reference

TypeAdapterFactory Class
PostSharp.Patterns.Model.TypeAdapters Namespace


TypeAdapterFactory Methods

The TypeAdapterFactory type exposes the following members.

Methods
 | Name | Description
Public method | CreateTypeAdapter | Creates a TypeAdapter for a specific Type.
Top
See Also

Reference

TypeAdapterFactory Class
PostSharp.Patterns.Model.TypeAdapters Namespace


TypeAdapterFactory.CreateTypeAdapter Method

TypeAdapterFactoryCreateTypeAdapter Method

Creates a TypeAdapter for a specific Type.

Namespace: PostSharp.Patterns.Model.TypeAdapters
Assembly: PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract TypeAdapter CreateTypeAdapter(
    Type type
)

Parameters

type
Type: SystemType
The target Type for which the TypeAdapter should be created.

Return Value

Type: TypeAdapter
A TypeAdapter for type.
See Also

Reference

TypeAdapterFactory Class
PostSharp.Patterns.Model.TypeAdapters Namespace


PostSharp.Patterns.Recording Namespace

The PostSharp.Patterns.Recording namespace implements the undo/redo feature.
Classes
 | Class | Description
Public class | EditableObjectAttribute | Custom attribute that, when applied to a class, implements IEditableObject into this class.
Public class | NotRecordedAttribute | Custom attribute that, when applied to field or property, specifies that it should not be affected by the RecordableAttribute aspect. Therefore, changes to this field or property will not be recorded into a Recorder, and will not be affected by undo/redo operations.
Public class | Operation | Base class for all operations. An operation is any change of state that can be appended to a Recorder and be therefore involved in an undo/redo operation.
Public class | OperationCollection | Read-only collection of operations (Operation). The class is exposed on the UndoOperations and RedoOperations properties.
Public class | OperationFormatter | Base class for all operation formatters, which provide a human-readable description of operations (Operation).
Public class | RecordableAttribute | Custom attribute that, when applied to a class, instruments fields and methods of this class so that it can be involved in undo/redo operations.
Public class | Recorder | Records changed done on an object model and allow to undo and redo them.
Public class | RecorderProvider | Abstract class that represents a node in the chain of responsibility, starting at the RecorderProvider property, whose role is to provide a default Recorder to recordable objects.
Public class | RecordingScope | Defines the scope a logical operation, that is, a set of change that should be undone or redone as a whole.
Public class | RecordingScopeAttribute | Custom attribute that, when applied to a method, defines the characteristics of the RecordingScope that corresponds to the target method.
Public class | RecordingServices | Provides global methods to work with the PostSharp.Patterns.Recording namespace.
Public class | ReplayContext | Represents the context of an undo or redo operation. The class gives access to system-defined and user-defined pieces of information.
Public class | RestorePoint | Represents a point to which operations can be undone or redone. A RestorePoint is a pseudo-Operation that does not represent any change.
Interfaces
 | Interface | Description
Public interface | IRecordable | Interface implemented by the RecordableAttribute aspect.
Public interface | IRecordableCallback | Defines callback methods that are invoked when a recordable object is involved in an undo or redo operation.
Enumerations
 | Enumeration | Description
Public enumeration | MergeStatus | Enumeration of possible return values for the GetMergeStatus(Operation) method.
Public enumeration | OperationKind | Enumeration of different kinds of Operation
Public enumeration | RecordingScopeOption | Enumerates the kinds of recording scope.
Public enumeration | ReplayKind | Enumerates the kind of situations in which the OnReplaying(ReplayKind, ReplayContext) or OnReplayed(ReplayKind, ReplayContext) methods are invoked.


EditableObjectAttribute Class

Custom attribute that, when applied to a class, implements IEditableObject into this class.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsTypeLevelAspect
PostSharp.AspectsInstanceLevelAspect
PostSharp.Patterns.RecordingEditableObjectAttribute

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class EditableObjectAttribute : InstanceLevelAspect,
    IEditableObject, IAspectProvider, IAspect, IService

The EditableObjectAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | EditableObjectAttribute | Initializes a new instance of the EditableObjectAttribute class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | Instance | Gets the object to which the current aspect has been applied. (Inherited from InstanceLevelAspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype. (Inherited from InstanceLevelAspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnCloned | Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object. (Inherited from InstanceLevelAspect.)
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from TypeLevelAspect.)
Public method | RuntimeInitializeInstance | Initializes the aspect instance. This method is invoked when all system elements of the aspect (like member imports) have completed. (Inherited from InstanceLevelAspect.)
Top
Remarks

This aspect implicitly adds the RecordableAttribute aspect to the target class, unless the aspect is already applied to this class.

The aspect is implemented by creating a restore point using the AddRestorePoint(String) method in the BeginEdit method, and undo using UndoTo(Operation) when the CancelEdit method is invoked. The restore point is removed using Remove after invoking CancelEdit and EndEdit

The implementation assumes that no other object being tracked by the same Recorder will be modified between calls to BeginEdit and CancelEdit, otherwise changes to these other objects will be canceled as well.

See Also

Reference

PostSharp.Patterns.Recording Namespace

Other Resources

Conceptual: Understanding the Recordable Aspect


EditableObjectAttribute Constructor

Initializes a new instance of the EditableObjectAttribute class

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public EditableObjectAttribute()
See Also

Reference

EditableObjectAttribute Class
PostSharp.Patterns.Recording Namespace


EditableObjectAttribute Properties

The EditableObjectAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | Instance | Gets the object to which the current aspect has been applied. (Inherited from InstanceLevelAspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

EditableObjectAttribute Class
PostSharp.Patterns.Recording Namespace


EditableObjectAttribute Methods

The EditableObjectAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype. (Inherited from InstanceLevelAspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnCloned | Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object. (Inherited from InstanceLevelAspect.)
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from TypeLevelAspect.)
Public method | RuntimeInitializeInstance | Initializes the aspect instance. This method is invoked when all system elements of the aspect (like member imports) have completed. (Inherited from InstanceLevelAspect.)
Top
See Also

Reference

EditableObjectAttribute Class
PostSharp.Patterns.Recording Namespace


IRecordable Interface

Interface implemented by the RecordableAttribute aspect.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IRecordable

The IRecordable type exposes the following members.

Properties
 | Name | Description
Public property | Recorder | Gets the recorder attached to the current object.
Top
Methods
 | Name | Description
Public method | HasRecorder | Determines whether the current object is attached to a Recorder, if not, optionally attaches the object to the default Recorder.
Top
See Also

Reference

PostSharp.Patterns.Recording Namespace

Other Resources

Conceptual: Working With Child Collections


IRecordable Properties

The IRecordable type exposes the following members.

Properties
 | Name | Description
Public property | Recorder | Gets the recorder attached to the current object.
Top
See Also

Reference

IRecordable Interface
PostSharp.Patterns.Recording Namespace


IRecordable.Recorder Property

IRecordableRecorder Property

Gets the recorder attached to the current object.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Recorder Recorder { get; set; }

Property Value

Type: Recorder
Remarks

Getting this property automatically attaches the object to the default Recorder if it is not yet attached. Use the HasRecorder(Boolean) method with the false argument to determine whether the object is already attached to a recorder.

Note Note
Named code should not invoke the setting of this property.

When this property is set, it is not the responsibility of the class implementing this interface to also set the property to all children. This responsibility belongs to the Recorder class

See Also

Reference

IRecordable Interface
PostSharp.Patterns.Recording Namespace


IRecordable Methods

The IRecordable type exposes the following members.

Methods
 | Name | Description
Public method | HasRecorder | Determines whether the current object is attached to a Recorder, if not, optionally attaches the object to the default Recorder.
Top
See Also

Reference

IRecordable Interface
PostSharp.Patterns.Recording Namespace


IRecordable.HasRecorder Method

IRecordableHasRecorder Method

Determines whether the current object is attached to a Recorder, if not, optionally attaches the object to the default Recorder.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
bool HasRecorder(
    bool autoAttach
)

Parameters

autoAttach
Type: SystemBoolean
true if the current object should be automatically attached to the default Recorder if it is not yet attached, otherwise false.

Return Value

Type: Boolean
true if the object is already attached to a Recorder or if autoAttach is true, otherwise false.
See Also

Reference

IRecordable Interface
PostSharp.Patterns.Recording Namespace


IRecordableCallback Interface

Defines callback methods that are invoked when a recordable object is involved in an undo or redo operation.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IRecordableCallback

The IRecordableCallback type exposes the following members.

Methods
 | Name | Description
Public method | OnReplayed | Method invoked after the undo or redo operation has started.
Public method | OnReplaying | Method invoked before the undo or redo operation has started.
Top
See Also

Reference

PostSharp.Patterns.Recording Namespace

Other Resources

Conceptual: Adding Callbacks on Undo and Redo
Conceptual: Understanding the Recordable Aspect


IRecordableCallback Methods

The IRecordableCallback type exposes the following members.

Methods
 | Name | Description
Public method | OnReplayed | Method invoked after the undo or redo operation has started.
Public method | OnReplaying | Method invoked before the undo or redo operation has started.
Top
See Also

Reference

IRecordableCallback Interface
PostSharp.Patterns.Recording Namespace


IRecordableCallback.OnReplayed Method

IRecordableCallbackOnReplayed Method

Method invoked after the undo or redo operation has started.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void OnReplayed(
    ReplayKind kind,
    ReplayContext context
)

Parameters

kind
Type: PostSharp.Patterns.RecordingReplayKind
Undo or Redo.
context
Type: PostSharp.Patterns.RecordingReplayContext
Reserved for future use.
See Also

Reference

IRecordableCallback Interface
PostSharp.Patterns.Recording Namespace

Other Resources

Conceptual: Understanding the Recordable Aspect


IRecordableCallback.OnReplaying Method

IRecordableCallbackOnReplaying Method

Method invoked before the undo or redo operation has started.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void OnReplaying(
    ReplayKind kind,
    ReplayContext context
)

Parameters

kind
Type: PostSharp.Patterns.RecordingReplayKind
Undo or Redo.
context
Type: PostSharp.Patterns.RecordingReplayContext
Reserved for future use.
See Also

Reference

IRecordableCallback Interface
PostSharp.Patterns.Recording Namespace

Other Resources

Conceptual: Understanding the Recordable Aspect


MergeStatus Enumeration

Enumeration of possible return values for the GetMergeStatus(Operation) method.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum MergeStatus
Members
Member name | Value | Description
None | 0 | The subsequent Operation cannot be merged and is not commutative with the current Operation.
Mergeable | 1 | The subsequent Operation can be merged into the current Operation (for instance, two subsequent changes to the same field).
Commutative | 2 | The subsequent Operation cannot be merged into the current Operation, but both operations are commutative (for instance, two subsequent changes to different fields).
See Also

Reference

PostSharp.Patterns.Recording Namespace


NotRecordedAttribute Class

Custom attribute that, when applied to field or property, specifies that it should not be affected by the RecordableAttribute aspect. Therefore, changes to this field or property will not be recorded into a Recorder, and will not be affected by undo/redo operations.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Patterns.RecordingNotRecordedAttribute

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class NotRecordedAttribute : Attribute

The NotRecordedAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | NotRecordedAttribute | Initializes a new instance of the NotRecordedAttribute class
Top
See Also

Reference

PostSharp.Patterns.Recording Namespace

Other Resources

Conceptual: Understanding the Recordable Aspect


NotRecordedAttribute Constructor

Initializes a new instance of the NotRecordedAttribute class

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public NotRecordedAttribute()
See Also

Reference

NotRecordedAttribute Class
PostSharp.Patterns.Recording Namespace


Operation Class

Base class for all operations. An operation is any change of state that can be appended to a Recorder and be therefore involved in an undo/redo operation.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.RecordingOperation
More...

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class Operation : IOperationDescriptor

The Operation type exposes the following members.

Constructors
 | Name | Description
Protected method | Operation | Initializes a new instance of the Operation class.
Top
Properties
 | Name | Description
Public property | Name | Gets the operation name.
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation.
Public property | OperationKind | Gets the kind of operation.
Top
Methods
 | Name | Description
Protected method | GetMergeStatus | Determines how a given Operation can be merged with the current Operation.
Protected method | Merge | Merges a given Operation into the current Operation.
Protected method | Redo | Redo the current operation.
Protected method | Undo | Undo the current operation.
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation.
Top
See Also

Reference

PostSharp.Patterns.Recording Namespace

Other Resources

Conceptual: Understanding the Recordable Aspect
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.RecordingOperation
PostSharp.Patterns.Recording.OperationsCollectionOperationT
PostSharp.Patterns.Recording.OperationsCompositeOperation
PostSharp.Patterns.Recording.OperationsDictionaryOperationTKey, TValue
PostSharp.Patterns.Recording.OperationsFieldOperationT
PostSharp.Patterns.Recording.OperationsHashSetOperationT
PostSharp.Patterns.Recording.OperationsRecorderOperation
PostSharp.Patterns.RecordingRestorePoint


Operation Constructor

Initializes a new instance of the Operation class.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected Operation()
See Also

Reference

Operation Class
PostSharp.Patterns.Recording Namespace


Operation Properties

The Operation type exposes the following members.

Properties
 | Name | Description
Public property | Name | Gets the operation name.
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation.
Public property | OperationKind | Gets the kind of operation.
Top
See Also

Reference

Operation Class
PostSharp.Patterns.Recording Namespace


Operation.Name Property

OperationName Property

Gets the operation name.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string Name { get; }

Property Value

Type: String
Remarks

Operation names are lazily evaluated thanks to the OperationFormatter.

See Also

Reference

Operation Class
PostSharp.Patterns.Recording Namespace


Operation.OperationDescriptor Property

OperationOperationDescriptor Property

Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual IOperationDescriptor OperationDescriptor { get; }

Property Value

Type: IOperationDescriptor
Remarks

By default, the OperationDescriptor property returns the current Operation.

When the Operation represents a user-defined scope, the property evaluates to an instance of the NamedOperationDescriptor class. When it represents a method scope, it evaluates to an instance of the MethodExecutionOperationDescriptor class.

See Also

Reference

Operation Class
PostSharp.Patterns.Recording Namespace


Operation.OperationKind Property

OperationOperationKind Property

Gets the kind of operation.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract OperationKind OperationKind { get; }

Property Value

Type: OperationKind

Implements

IOperationDescriptorOperationKind
See Also

Reference

Operation Class
PostSharp.Patterns.Recording Namespace


Operation Methods

The Operation type exposes the following members.

Methods
 | Name | Description
Protected method | GetMergeStatus | Determines how a given Operation can be merged with the current Operation.
Protected method | Merge | Merges a given Operation into the current Operation.
Protected method | Redo | Redo the current operation.
Protected method | Undo | Undo the current operation.
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation.
Top
See Also

Reference

Operation Class
PostSharp.Patterns.Recording Namespace


Operation.GetMergeStatus Method

OperationGetMergeStatus Method

Determines how a given Operation can be merged with the current Operation.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual MergeStatus GetMergeStatus(
    Operation subsequent
)

Parameters

subsequent
Type: PostSharp.Patterns.RecordingOperation
The subsequent Operation to be merged with the current one.

Return Value

Type: MergeStatus
A MergeStatus.
See Also

Reference

Operation Class
PostSharp.Patterns.Recording Namespace


Operation.Merge Method

OperationMerge Method

Merges a given Operation into the current Operation.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void Merge(
    Operation subsequent
)

Parameters

subsequent
Type: PostSharp.Patterns.RecordingOperation
The Operation to merge into the current one.
Remarks

This method is invoked only if the GetMergeStatus(Operation) method returned MergeStatus.

See Also

Reference

Operation Class
PostSharp.Patterns.Recording Namespace


Operation.Redo Method

OperationRedo Method

Redo the current operation.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected abstract void Redo(
    ReplayContext context
)

Parameters

context
Type: PostSharp.Patterns.RecordingReplayContext
Reserved for future use.
See Also

Reference

Operation Class
PostSharp.Patterns.Recording Namespace

Other Resources

Conceptual: Understanding the Recordable Aspect


Operation.Undo Method

OperationUndo Method

Undo the current operation.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected abstract void Undo(
    ReplayContext context
)

Parameters

context
Type: PostSharp.Patterns.RecordingReplayContext
Reserved for future use.
See Also

Reference

Operation Class
PostSharp.Patterns.Recording Namespace

Other Resources

Conceptual: Understanding the Recordable Aspect


Operation.VisitAffectedObjects Method

OperationVisitAffectedObjects Method

Executes a given action on all recordable objects involved with the current Operation.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract void VisitAffectedObjects(
    Action<Object> action
)

Parameters

action
Type: SystemAction Object
See Also

Reference

Operation Class
PostSharp.Patterns.Recording Namespace


OperationCollection Class

Read-only collection of operations (Operation). The class is exposed on the UndoOperations and RedoOperations properties.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.RecordingOperationCollection

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class OperationCollection : ICollection<Operation>,
    IEnumerable<Operation>, IEnumerable, INotifyPropertyChanged, INotifyCollectionChanged

The OperationCollection type exposes the following members.

Properties
 | Name | Description
Public property | Count | Gets the number of elements contained in the ICollectionT.
Public property | IsReadOnly | Gets a value indicating whether the ICollectionT is read-only.
Top
Methods
 | Name | Description
Public method | CopyTo | Copies the elements of the ICollectionT to an Array, starting at a particular Array index.
Public method | GetEnumerator | Returns an enumerator that iterates through the collection.
Public method | Trim(Int32) | Trims the current collection to a given maximal number of operations.
Public method | Trim(RestorePoint) | Trims the current collection to a specified RestorePoint.
Top
Events
 | Name | Description
Public event | CollectionChanged | Occurs when the collection changes.
Public event | PropertyChanged | Event raised when the value of a property of the current object changes.
Top
Extension Methods
 | Name | Description
Public Extension Method | ToAdvisableCollectionOperation | Converts an IEnumerableT into an AdvisableCollectionT. (Defined by Extensions.)
Public Extension Method | ToAdvisableDictionaryOperation, TKey, TValue | Converts an IEnumerableT into a AdvisableDictionaryTKey, TValue given a method returning the item key and a method returning the item value. (Defined by Extensions.)
Public Extension Method | ToAdvisableHashSetOperation | Converts an IEnumerableT into an AdvisableHashSetT. (Defined by Extensions.)
Top
Remarks

Additionally to traditional collection members, this class exposes the Trim(Int32) method, which allows to trim the collection of UndoOperations or RedoOperations.

See Also

Reference

PostSharp.Patterns.Recording Namespace


OperationCollection Properties

The OperationCollection type exposes the following members.

Properties
 | Name | Description
Public property | Count | Gets the number of elements contained in the ICollectionT.
Public property | IsReadOnly | Gets a value indicating whether the ICollectionT is read-only.
Top
See Also

Reference

OperationCollection Class
PostSharp.Patterns.Recording Namespace


OperationCollection.Count Property

OperationCollectionCount Property

Gets the number of elements contained in the ICollectionT.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int Count { get; }

Return Value

Type: Int32
The number of elements contained in the ICollectionT.

Implements

ICollectionTCount
See Also

Reference

OperationCollection Class
PostSharp.Patterns.Recording Namespace


OperationCollection.IsReadOnly Property

OperationCollectionIsReadOnly Property

Gets a value indicating whether the ICollectionT is read-only.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsReadOnly { get; }

Return Value

Type: Boolean
true if the ICollectionT is read-only; otherwise, false.

Implements

ICollectionTIsReadOnly
See Also

Reference

OperationCollection Class
PostSharp.Patterns.Recording Namespace


OperationCollection Methods

The OperationCollection type exposes the following members.

Methods
 | Name | Description
Public method | CopyTo | Copies the elements of the ICollectionT to an Array, starting at a particular Array index.
Public method | GetEnumerator | Returns an enumerator that iterates through the collection.
Public method | Trim(Int32) | Trims the current collection to a given maximal number of operations.
Public method | Trim(RestorePoint) | Trims the current collection to a specified RestorePoint.
Top
Extension Methods
 | Name | Description
Public Extension Method | ToAdvisableCollectionOperation | Converts an IEnumerableT into an AdvisableCollectionT. (Defined by Extensions.)
Public Extension Method | ToAdvisableDictionaryOperation, TKey, TValue | Converts an IEnumerableT into a AdvisableDictionaryTKey, TValue given a method returning the item key and a method returning the item value. (Defined by Extensions.)
Public Extension Method | ToAdvisableHashSetOperation | Converts an IEnumerableT into an AdvisableHashSetT. (Defined by Extensions.)
Top
See Also

Reference

OperationCollection Class
PostSharp.Patterns.Recording Namespace


OperationCollection.CopyTo Method

OperationCollectionCopyTo Method

Copies the elements of the ICollectionT to an Array, starting at a particular Array index.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void CopyTo(
    Operation[] array,
    int arrayIndex
)

Parameters

array
Type: PostSharp.Patterns.RecordingOperation
The one-dimensional Array that is the destination of the elements copied from ICollectionT. The Array must have zero-based indexing.
arrayIndex
Type: SystemInt32
The zero-based index in array at which copying begins.

Implements

ICollectionTCopyTo(T, Int32)
Exceptions
Exception | Condition
ArgumentNullException | array is null.
ArgumentOutOfRangeException | arrayIndex is less than 0.
ArgumentException | The number of elements in the source ICollectionT is greater than the available space from arrayIndex to the end of the destination array.
See Also

Reference

OperationCollection Class
PostSharp.Patterns.Recording Namespace


OperationCollection.GetEnumerator Method

OperationCollectionGetEnumerator Method

Returns an enumerator that iterates through the collection.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IEnumerator<Operation> GetEnumerator()

Return Value

Type: IEnumerator Operation
An enumerator that can be used to iterate through the collection.

Implements

IEnumerableTGetEnumerator
See Also

Reference

OperationCollection Class
PostSharp.Patterns.Recording Namespace


OperationCollection.Trim Method

OperationCollectionTrim Method

Overload List
 | Name | Description
Public method | Trim(Int32) | Trims the current collection to a given maximal number of operations.
Public method | Trim(RestorePoint) | Trims the current collection to a specified RestorePoint.
Top
See Also

Reference

OperationCollection Class
PostSharp.Patterns.Recording Namespace


OperationCollection.Trim Method (Int32)

OperationCollectionTrim Method (Int32)

Trims the current collection to a given maximal number of operations.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Trim(
    int count
)

Parameters

count
Type: SystemInt32
The maximal number of operations to keep in the collection.
Remarks
Note Note
The UndoOperations collection is automatically trimmed to the value of MaximumOperationsCount property.
See Also

Reference

OperationCollection Class
Trim Overload
PostSharp.Patterns.Recording Namespace


OperationCollection.Trim Method (RestorePoint)

OperationCollectionTrim Method (RestorePoint)

Trims the current collection to a specified RestorePoint.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Trim(
    RestorePoint restorePoint
)

Parameters

restorePoint
Type: PostSharp.Patterns.RecordingRestorePoint
A token to the RestorePoint to which the current collection should be trimmed.
See Also

Reference

OperationCollection Class
Trim Overload
PostSharp.Patterns.Recording Namespace


OperationCollection Events

The OperationCollection type exposes the following members.

Events
 | Name | Description
Public event | CollectionChanged | Occurs when the collection changes.
Public event | PropertyChanged | Event raised when the value of a property of the current object changes.
Top
See Also

Reference

OperationCollection Class
PostSharp.Patterns.Recording Namespace


OperationCollection.CollectionChanged Event

OperationCollectionCollectionChanged Event

Occurs when the collection changes.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public event NotifyCollectionChangedEventHandler CollectionChanged

Value

Type: System.Collections.SpecializedNotifyCollectionChangedEventHandler

Implements

INotifyCollectionChangedCollectionChanged
See Also

Reference

OperationCollection Class
PostSharp.Patterns.Recording Namespace


OperationCollection.PropertyChanged Event

OperationCollectionPropertyChanged Event

Event raised when the value of a property of the current object changes.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public event PropertyChangedEventHandler PropertyChanged

Value

Type: System.ComponentModelPropertyChangedEventHandler

Implements

INotifyPropertyChangedPropertyChanged
See Also

Reference

OperationCollection Class
PostSharp.Patterns.Recording Namespace


OperationFormatter Class

Base class for all operation formatters, which provide a human-readable description of operations (Operation).
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.RecordingOperationFormatter

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class OperationFormatter

The OperationFormatter type exposes the following members.

Constructors
 | Name | Description
Protected method | OperationFormatter | Initializes a new instance of the OperationFormatter class.
Top
Methods
 | Name | Description
Public method | FormatOperation | Gets a human-readable description of an Operation.
Protected method | FormatOperationDescriptor | Gets a human-readable description of an Operation given its IOperationDescriptor.
Top
Remarks

Instances of the OperationFormatter class form a chain of responsibility. If one instance does not know how to format an Operation, it calls the next instance in the chain.

See Also

Reference

PostSharp.Patterns.Recording Namespace

Other Resources

Conceptual: Customizing Undo/Redo Operation Names
Conceptual: Understanding the Recordable Aspect


OperationFormatter Constructor

Initializes a new instance of the OperationFormatter class.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected OperationFormatter(
    OperationFormatter next
)

Parameters

next
Type: PostSharp.Patterns.RecordingOperationFormatter
The next instance in the chain of responsibility.
See Also

Reference

OperationFormatter Class
PostSharp.Patterns.Recording Namespace


OperationFormatter Methods

The OperationFormatter type exposes the following members.

Methods
 | Name | Description
Public method | FormatOperation | Gets a human-readable description of an Operation.
Protected method | FormatOperationDescriptor | Gets a human-readable description of an Operation given its IOperationDescriptor.
Top
See Also

Reference

OperationFormatter Class
PostSharp.Patterns.Recording Namespace


OperationFormatter.FormatOperation Method

OperationFormatterFormatOperation Method

Gets a human-readable description of an Operation.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string FormatOperation(
    Operation operation
)

Parameters

operation
Type: PostSharp.Patterns.RecordingOperation
The Operation.

Return Value

Type: String
A human-readable description of the Operation.
See Also

Reference

OperationFormatter Class
PostSharp.Patterns.Recording Namespace


OperationFormatter.FormatOperationDescriptor Method

OperationFormatterFormatOperationDescriptor Method

Gets a human-readable description of an Operation given its IOperationDescriptor.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected abstract string FormatOperationDescriptor(
    IOperationDescriptor operation
)

Parameters

operation
Type: PostSharp.Patterns.Recording.OperationsIOperationDescriptor
The operation descriptor.

Return Value

Type: String
A human-readable description for operation, or null if the current OperationFormatter does not know how to format operation, in which case the next OperationFormatter in the chain of responsibility will be invoked.
See Also

Reference

OperationFormatter Class
PostSharp.Patterns.Recording Namespace

Other Resources

Conceptual: Customizing Undo/Redo Operation Names


OperationKind Enumeration

Enumeration of different kinds of Operation

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum OperationKind
Members
Member name | Value | Description
AttachRecorderToObject | 0 | AttachObjectToRecorderOperation
ClearCollection | 1 | ClearCollectionOperationT
Composite | 2 | CompositeOperation
DetachRecorderFromObject | 3 | DetachObjectFromRecorderOperation
Field | 4 | FieldOperationT
InsertCollectionItem | 5 | AddCollectionItemOperationT
RemoveCollectionItem | 6 | RemoveCollectionItemOperationT
SetCollectionItem | 7 | SetCollectionItemOperationT
MoveCollectionItem | 8 | MoveCollectionItemOperationT
InsertCollectionRange | 9 | AddCollectionRangeOperationT
RemoveCollectionRange | 10 | RemoveCollectionItemOperationT
RestorePoint | 11 | RestorePoint
Method | 12 | MethodExecutionOperationDescriptor
Named | 13 | NamedOperationDescriptor
InsertDictionaryItem | 14 | AddDictionaryItemOperationTKey, TValue
RemoveDictionaryItem | 15 |
SetDictionaryItem | 16 | SetDictionaryItemOperationTKey, TValue
ClearDictionary | 17 | ClearDictionaryOperationTKey, TValue
InsertSetItem | 18 | AddSetItemOperationT
RemoveSetItem | 19 | RemoveSetItemOperationT
ClearSet | 20 | ClearSetOperationT
ChangeManySetItems | 21 | ChangeManySetOperationT
Other | 65536 | User-defined operation. Any value higher than Other is acceptable.
See Also

Reference

PostSharp.Patterns.Recording Namespace


RecordableAttribute Class

Custom attribute that, when applied to a class, instruments fields and methods of this class so that it can be involved in undo/redo operations.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsTypeLevelAspect
PostSharp.AspectsInstanceLevelAspect
PostSharp.Patterns.RecordingRecordableAttribute

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class RecordableAttribute : InstanceLevelAspect,
    IRecordable, IAspectProvider, IAspect, IService

The RecordableAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | RecordableAttribute | Initializes a new instance of the class.
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | AutoRecord | Determines whether changes in this object must be recorded as soon as the object constructor has completed.
Public property | Instance | Gets the object to which the current aspect has been applied. (Inherited from InstanceLevelAspect.)
Public property | ProvideMethodContext | Determines whether full method invocation context is provided to the MethodExecutionOperationDescriptor class for use in a custom OperationFormatter. This property is set to false by default for performance reasons.
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Overrides TypeLevelAspectCompileTimeInitialize(Type, AspectInfo).)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Overrides TypeLevelAspectCompileTimeValidate(Type).)
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype. (Inherited from InstanceLevelAspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnCloned | Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object. (Inherited from InstanceLevelAspect.)
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from TypeLevelAspect.)
Public method | RuntimeInitializeInstance | Initializes the aspect instance. This method is invoked when all system elements of the aspect (like member imports) have completed. (Inherited from InstanceLevelAspect.)
Top
See Also

Reference

PostSharp.Patterns.Recording Namespace
PostSharp.Patterns.RecordingRecorder

Other Resources

Conceptual: Adding Callbacks on Undo and Redo
Conceptual: Adding Undo/Redo to the User Interface
Conceptual: Annotating an Object Model for Parent/Child Relationships (Aggregatable)
Conceptual: Assigning Recorders Manually
Conceptual: Customizing Undo/Redo Operation Names
Conceptual: Enumerating Child Objects (Visitor)
Conceptual: Making Your Model Recordable
Conceptual: Parent/Child, Visitor and Disposable
Conceptual: Understanding the Recordable Aspect
Conceptual: Undo/Redo
Conceptual: What's New in PostSharp 4.0


RecordableAttribute Constructor

Initializes a new instance of the class.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public RecordableAttribute()
See Also

Reference

RecordableAttribute Class
PostSharp.Patterns.Recording Namespace
PostSharp.Patterns.RecordingRecordableAttribute


RecordableAttribute Properties

The RecordableAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | AutoRecord | Determines whether changes in this object must be recorded as soon as the object constructor has completed.
Public property | Instance | Gets the object to which the current aspect has been applied. (Inherited from InstanceLevelAspect.)
Public property | ProvideMethodContext | Determines whether full method invocation context is provided to the MethodExecutionOperationDescriptor class for use in a custom OperationFormatter. This property is set to false by default for performance reasons.
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

RecordableAttribute Class
PostSharp.Patterns.Recording Namespace


RecordableAttribute.AutoRecord Property

RecordableAttributeAutoRecord Property

Determines whether changes in this object must be recorded as soon as the object constructor has completed.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool AutoRecord { get; set; }

Property Value

Type: Boolean
Remarks

If this property is set to true, a Recorder will be automatically assigned to the target instance using the OperationFormatter. Set this property to false if you need to assign the Recorder manually.

See Also

Reference

RecordableAttribute Class
PostSharp.Patterns.Recording Namespace

Other Resources

Conceptual: Assigning Recorders Manually


RecordableAttribute.ProvideMethodContext Property

RecordableAttributeProvideMethodContext Property

Determines whether full method invocation context is provided to the MethodExecutionOperationDescriptor class for use in a custom OperationFormatter. This property is set to false by default for performance reasons.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool ProvideMethodContext { get; set; }

Property Value

Type: Boolean
Remarks

This property applies to all public methods of the target class.

See Also

Reference

RecordableAttribute Class
PostSharp.Patterns.Recording Namespace


RecordableAttribute Methods

The RecordableAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Overrides TypeLevelAspectCompileTimeInitialize(Type, AspectInfo).)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Overrides TypeLevelAspectCompileTimeValidate(Type).)
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype. (Inherited from InstanceLevelAspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnCloned | Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object. (Inherited from InstanceLevelAspect.)
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from TypeLevelAspect.)
Public method | RuntimeInitializeInstance | Initializes the aspect instance. This method is invoked when all system elements of the aspect (like member imports) have completed. (Inherited from InstanceLevelAspect.)
Top
See Also

Reference

RecordableAttribute Class
PostSharp.Patterns.Recording Namespace


RecordableAttribute.CompileTimeInitialize Method

RecordableAttributeCompileTimeInitialize Method

Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void CompileTimeInitialize(
    Type type,
    AspectInfo aspectInfo
)

Parameters

type
Type: SystemType
Type to which the current aspect is applied
aspectInfo
Type: PostSharp.AspectsAspectInfo
Reserved for future usage.

Implements

ITypeLevelAspectBuildSemanticsCompileTimeInitialize(Type, AspectInfo)
See Also

Reference

RecordableAttribute Class
PostSharp.Patterns.Recording Namespace

Other Resources

Conceptual: Initializing Aspects


RecordableAttribute.CompileTimeValidate Method

RecordableAttributeCompileTimeValidate Method

Overload List
 | Name | Description
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Overrides TypeLevelAspectCompileTimeValidate(Type).)
Top
See Also

Reference

RecordableAttribute Class
PostSharp.Patterns.Recording Namespace


RecordableAttribute.CompileTimeValidate Method (Type)

RecordableAttributeCompileTimeValidate Method (Type)

Method invoked at build time to ensure that the aspect has been applied to the right target.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool CompileTimeValidate(
    Type type
)

Parameters

type
Type: SystemType
Type to which the aspect has been applied

Return Value

Type: Boolean
true if the aspect was applied to an acceptable field, otherwise false.
Remarks
The implementation of this method is expected to emit an error message (see MessageSource) or an exception in case of error. Returning false without emitting an error message or exception causes the aspect to be silently ignored.
See Also

Reference

RecordableAttribute Class
CompileTimeValidate Overload
PostSharp.Patterns.Recording Namespace

Other Resources

Conceptual: Validating Aspects


Recorder Class

Records changed done on an object model and allow to undo and redo them.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.RecordingRecorder

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class Recorder : INotifyPropertyChanged

The Recorder type exposes the following members.

Constructors
 | Name | Description
Public method | Recorder | Initializes a new instance of the Recorder class.
Public method | Recorder(Object) | Initializes a new instance of the Recorder class and attaches it to a given object.
Top
Properties
 | Name | Description
Public property | CanAddRestorePoint | Determines if the AddRestorePoint(String) method can be invoked.
Public property | CanRedo | Determines if the Redo method can be invoked.
Public property | CanUndo | Determines if the Undo method can be invoked.
Public property | MaximumOperationsCount | Gets the maximum number of operations in the UndoOperations and RedoOperations collections. These collections are automatically trimmed so that their size never exceeds MaximumOperationsCount.
Public property | RedoOperations | Gets the collection of operations that can be redone using the Redo method.
Public property | UndoOperations | Gets the collection of operations that can be undone using the Undo method.
Top
Methods
 | Name | Description
Public method | AddOperation | Adds a new Operation to UndoOperations collection of the current Recorder.
Public method | AddRestorePoint | Adds new restore point with given name.
Public method | Attach | Attaches a recordable object (including its descendant objects) to the current Recorder so that changes in this objects start being recorded into the current Recorder.
Public method | Clear | Clears undo and redo lists.
Public method | Detach | Detaches a recordable object from the current Recorder, so that changes in this objects stop being recorded into the current Recorder.
Public method | OpenScope(RecordingScopeOption) | Opens an unnamed RecordingScope.
Public method | OpenScope(String, RecordingScopeOption) | Opens a RecordingScope with a given name.
Public method | Redo | Redo last operation.
Public method | RedoTo | redo all operation to specific operation.
Public method | Undo | Undo last operation.
Public method | UndoTo | Undo all operations to specific Operation or RestorePoint.
Top
Events
 | Name | Description
Public event | ChildPropertyChanged | Event raised after the property of a child object has been changed.
Public event | ChildPropertyChanging | Event raised before the property of a child object is changed.
Public event | PropertyChanged | Event raised when the value of a property of the current object changes.
Top
See Also

Reference

PostSharp.Patterns.Recording Namespace

Other Resources

Conceptual: Adding Undo/Redo to the User Interface
Conceptual: Assigning Recorders Manually
Conceptual: Customizing Undo/Redo Operation Names
Conceptual: Making Your Model Recordable
Conceptual: Understanding the Recordable Aspect
Conceptual: Undo/Redo
Conceptual: What's New in PostSharp 4.0


Recorder Constructor

Overload List
 | Name | Description
Public method | Recorder | Initializes a new instance of the Recorder class.
Public method | Recorder(Object) | Initializes a new instance of the Recorder class and attaches it to a given object.
Top
See Also

Reference

Recorder Class
PostSharp.Patterns.Recording Namespace


Recorder Constructor

Initializes a new instance of the Recorder class.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Recorder()
See Also

Reference

Recorder Class
Recorder Overload
PostSharp.Patterns.Recording Namespace


Recorder Constructor (Object)

Initializes a new instance of the Recorder class and attaches it to a given object.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Recorder(
    Object owner
)

Parameters

owner
Type: SystemObject
The object to which the new Recorder should be attached.
Remarks

The Recorder created using this constructor will be private to its owner, that is, no other object than owner and descendants of owner will be allowed to be attached to this Recorder.

See Also

Reference

Recorder Class
Recorder Overload
PostSharp.Patterns.Recording Namespace


Recorder Properties

The Recorder type exposes the following members.

Properties
 | Name | Description
Public property | CanAddRestorePoint | Determines if the AddRestorePoint(String) method can be invoked.
Public property | CanRedo | Determines if the Redo method can be invoked.
Public property | CanUndo | Determines if the Undo method can be invoked.
Public property | MaximumOperationsCount | Gets the maximum number of operations in the UndoOperations and RedoOperations collections. These collections are automatically trimmed so that their size never exceeds MaximumOperationsCount.
Public property | RedoOperations | Gets the collection of operations that can be redone using the Redo method.
Public property | UndoOperations | Gets the collection of operations that can be undone using the Undo method.
Top
See Also

Reference

Recorder Class
PostSharp.Patterns.Recording Namespace


Recorder.CanAddRestorePoint Property

RecorderCanAddRestorePoint Property

Determines if the AddRestorePoint(String) method can be invoked.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool CanAddRestorePoint { get; }

Property Value

Type: Boolean
See Also

Reference

Recorder Class
PostSharp.Patterns.Recording Namespace


Recorder.CanRedo Property

RecorderCanRedo Property

Determines if the Redo method can be invoked.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool CanRedo { get; }

Property Value

Type: Boolean
See Also

Reference

Recorder Class
PostSharp.Patterns.Recording Namespace


Recorder.CanUndo Property

RecorderCanUndo Property

Determines if the Undo method can be invoked.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool CanUndo { get; }

Property Value

Type: Boolean
See Also

Reference

Recorder Class
PostSharp.Patterns.Recording Namespace


Recorder.MaximumOperationsCount Property

RecorderMaximumOperationsCount Property

Gets the maximum number of operations in the UndoOperations and RedoOperations collections. These collections are automatically trimmed so that their size never exceeds MaximumOperationsCount.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int MaximumOperationsCount { get; set; }

Property Value

Type: Int32
The default value is int.MaxValue.
See Also

Reference

Recorder Class
PostSharp.Patterns.Recording Namespace

Other Resources

Conceptual: Understanding the Recordable Aspect


Recorder.RedoOperations Property

RecorderRedoOperations Property

Gets the collection of operations that can be redone using the Redo method.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public OperationCollection RedoOperations { get; }

Property Value

Type: OperationCollection
See Also

Reference

Recorder Class
PostSharp.Patterns.Recording Namespace

Other Resources

Conceptual: Adding Undo/Redo to the User Interface
Conceptual: Understanding the Recordable Aspect


Recorder.UndoOperations Property

RecorderUndoOperations Property

Gets the collection of operations that can be undone using the Undo method.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public OperationCollection UndoOperations { get; }

Property Value

Type: OperationCollection
See Also

Reference

Recorder Class
PostSharp.Patterns.Recording Namespace

Other Resources

Conceptual: Adding Undo/Redo to the User Interface
Conceptual: Understanding the Recordable Aspect


Recorder Methods

The Recorder type exposes the following members.

Methods
 | Name | Description
Public method | AddOperation | Adds a new Operation to UndoOperations collection of the current Recorder.
Public method | AddRestorePoint | Adds new restore point with given name.
Public method | Attach | Attaches a recordable object (including its descendant objects) to the current Recorder so that changes in this objects start being recorded into the current Recorder.
Public method | Clear | Clears undo and redo lists.
Public method | Detach | Detaches a recordable object from the current Recorder, so that changes in this objects stop being recorded into the current Recorder.
Public method | OpenScope(RecordingScopeOption) | Opens an unnamed RecordingScope.
Public method | OpenScope(String, RecordingScopeOption) | Opens a RecordingScope with a given name.
Public method | Redo | Redo last operation.
Public method | RedoTo | redo all operation to specific operation.
Public method | Undo | Undo last operation.
Public method | UndoTo | Undo all operations to specific Operation or RestorePoint.
Top
See Also

Reference

Recorder Class
PostSharp.Patterns.Recording Namespace


Recorder.AddOperation Method

RecorderAddOperation Method

Adds a new Operation to UndoOperations collection of the current Recorder.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void AddOperation(
    Operation operation
)

Parameters

operation
Type: PostSharp.Patterns.RecordingOperation
The operation.
See Also

Reference

Recorder Class
PostSharp.Patterns.Recording Namespace

Other Resources

Conceptual: Understanding the Recordable Aspect


Recorder.AddRestorePoint Method

RecorderAddRestorePoint Method

Adds new restore point with given name.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public RestorePoint AddRestorePoint(
    string name = null
)

Parameters

name (Optional)
Type: SystemString
The name of the restore point, or null to create an unnamed restore point.

Return Value

Type: RestorePoint
The newly created RestorePoint.
Remarks

A RestorePoint can be used as an argument to the UndoTo(Operation) or RedoTo(Operation) method.

To remove a RestorePoint from UndoOperations or RedoOperations, call the Remove method.

See Also

Reference

Recorder Class
PostSharp.Patterns.Recording Namespace

Other Resources

Conceptual: Understanding the Recordable Aspect


Recorder.Attach Method

RecorderAttach Method

Attaches a recordable object (including its descendant objects) to the current Recorder so that changes in this objects start being recorded into the current Recorder.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Attach(
    Object obj
)

Parameters

obj
Type: SystemObject
The recordable object whose changes need to be recorded into the current Recorder.
Remarks

This method implicitly attaches all descendants of obj to the current Recorder.

See Also

Reference

Recorder Class
PostSharp.Patterns.Recording Namespace

Other Resources

Conceptual: Assigning Recorders Manually


Recorder.Clear Method

RecorderClear Method

Clears undo and redo lists.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Clear()
See Also

Reference

Recorder Class
PostSharp.Patterns.Recording Namespace

Other Resources

Conceptual: Adding Undo/Redo to the User Interface


Recorder.Detach Method

RecorderDetach Method

Detaches a recordable object from the current Recorder, so that changes in this objects stop being recorded into the current Recorder.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Detach(
    Object obj
)

Parameters

obj
Type: SystemObject
The recordable object whose changes no longer need to be recorded into the current Recorder.
Remarks

This method implicitly detaches all descendants of obj from the current Recorder.

See Also

Reference

Recorder Class
PostSharp.Patterns.Recording Namespace

Other Resources

Conceptual: Assigning Recorders Manually


Recorder.OpenScope Method

RecorderOpenScope Method

Overload List
 | Name | Description
Public method | OpenScope(RecordingScopeOption) | Opens an unnamed RecordingScope.
Public method | OpenScope(String, RecordingScopeOption) | Opens a RecordingScope with a given name.
Top
See Also

Reference

Recorder Class
PostSharp.Patterns.Recording Namespace


Recorder.OpenScope Method (RecordingScopeOption)

RecorderOpenScope Method (RecordingScopeOption)

Opens an unnamed RecordingScope.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public RecordingScope OpenScope(
    RecordingScopeOption option = RecordingScopeOption.Default
)

Parameters

option (Optional)
Type: PostSharp.Patterns.RecordingRecordingScopeOption
Scope options. Specify this parameter if you want the scope to be Atomic.

Return Value

Type: RecordingScope
A RecordingScope object, which should be closed using Complete or Dispose.
Remarks

The name of the scope can be set at any time by setting the OperationDescriptor property.

See Also

Reference

Recorder Class
OpenScope Overload
PostSharp.Patterns.Recording Namespace

Other Resources

Conceptual: Understanding the Recordable Aspect


Recorder.OpenScope Method (String, RecordingScopeOption)

RecorderOpenScope Method (String, RecordingScopeOption)

Opens a RecordingScope with a given name.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public RecordingScope OpenScope(
    string name,
    RecordingScopeOption option = RecordingScopeOption.Default
)

Parameters

name
Type: SystemString
The scope name, or null to create an unnamed scope.
option (Optional)
Type: PostSharp.Patterns.RecordingRecordingScopeOption
Scope options. Specify this parameter if you want the scope to be Atomic.

Return Value

Type: RecordingScope
A RecordingScope object, which should be closed using Complete or Dispose.
Remarks

The name of the scope can be set at any time by setting the OperationDescriptor property.

See Also

Reference

Recorder Class
OpenScope Overload
PostSharp.Patterns.Recording Namespace

Other Resources

Conceptual: Customizing Undo/Redo Operation Names
Conceptual: Understanding the Recordable Aspect


Recorder.Redo Method

RecorderRedo Method

Redo last operation.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Redo()
See Also

Reference

Recorder Class
PostSharp.Patterns.Recording Namespace

Other Resources

Conceptual: Adding Undo/Redo to the User Interface


Recorder.RedoTo Method

RecorderRedoTo Method

redo all operation to specific operation.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void RedoTo(
    Operation operation
)

Parameters

operation
Type: PostSharp.Patterns.RecordingOperation
the operation.
See Also

Reference

Recorder Class
PostSharp.Patterns.Recording Namespace


Recorder.Undo Method

RecorderUndo Method

Undo last operation.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Undo()
See Also

Reference

Recorder Class
PostSharp.Patterns.Recording Namespace

Other Resources

Conceptual: Adding Undo/Redo to the User Interface
Conceptual: Understanding the Recordable Aspect


Recorder.UndoTo Method

RecorderUndoTo Method

Undo all operations to specific Operation or RestorePoint.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void UndoTo(
    Operation operation
)

Parameters

operation
Type: PostSharp.Patterns.RecordingOperation
the operation.
See Also

Reference

Recorder Class
PostSharp.Patterns.Recording Namespace


Recorder Events

The Recorder type exposes the following members.

Events
 | Name | Description
Public event | ChildPropertyChanged | Event raised after the property of a child object has been changed.
Public event | ChildPropertyChanging | Event raised before the property of a child object is changed.
Public event | PropertyChanged | Event raised when the value of a property of the current object changes.
Top
See Also

Reference

Recorder Class
PostSharp.Patterns.Recording Namespace


Recorder.ChildPropertyChanged Event

RecorderChildPropertyChanged Event

Event raised after the property of a child object has been changed.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public event EventHandler<ChildPropertyChangedEventArgs> ChildPropertyChanged

Value

Type: SystemEventHandler ChildPropertyChangedEventArgs
See Also

Reference

Recorder Class
PostSharp.Patterns.Recording Namespace


Recorder.ChildPropertyChanging Event

RecorderChildPropertyChanging Event

Event raised before the property of a child object is changed.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public event EventHandler<ChildPropertyChangedEventArgs> ChildPropertyChanging

Value

Type: SystemEventHandler ChildPropertyChangedEventArgs
See Also

Reference

Recorder Class
PostSharp.Patterns.Recording Namespace


Recorder.PropertyChanged Event

RecorderPropertyChanged Event

Event raised when the value of a property of the current object changes.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public event PropertyChangedEventHandler PropertyChanged

Value

Type: System.ComponentModelPropertyChangedEventHandler

Implements

INotifyPropertyChangedPropertyChanged
See Also

Reference

Recorder Class
PostSharp.Patterns.Recording Namespace


RecorderProvider Class

Abstract class that represents a node in the chain of responsibility, starting at the RecorderProvider property, whose role is to provide a default Recorder to recordable objects.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.RecordingRecorderProvider

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class RecorderProvider

The RecorderProvider type exposes the following members.

Constructors
 | Name | Description
Protected method | RecorderProvider | Initializes a new instance of the RecorderProvider class.
Top
Methods
 | Name | Description
Public method | GetRecorder | Gets the default Recorder for a given object. This method goes through the whole chain of responsibility.
Protected method | GetRecorderCore | Gets the default Recorder for a given object.
Top
See Also

Reference

PostSharp.Patterns.Recording Namespace

Other Resources

Conceptual: Assigning Recorders Manually


RecorderProvider Constructor

Initializes a new instance of the RecorderProvider class.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected RecorderProvider(
    RecorderProvider next
)

Parameters

next
Type: PostSharp.Patterns.RecordingRecorderProvider
Next instance in the chain of responsibility.
See Also

Reference

RecorderProvider Class
PostSharp.Patterns.Recording Namespace


RecorderProvider Methods

The RecorderProvider type exposes the following members.

Methods
 | Name | Description
Public method | GetRecorder | Gets the default Recorder for a given object. This method goes through the whole chain of responsibility.
Protected method | GetRecorderCore | Gets the default Recorder for a given object.
Top
See Also

Reference

RecorderProvider Class
PostSharp.Patterns.Recording Namespace


RecorderProvider.GetRecorder Method

RecorderProviderGetRecorder Method

Gets the default Recorder for a given object. This method goes through the whole chain of responsibility.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Recorder GetRecorder(
    Object obj
)

Parameters

obj
Type: SystemObject
The object for which the default Recorder is required, or null if the global default provider (exposed for convenience on the DefaultRecorder) property if required.

Return Value

Type: Recorder
The Recorder for obj, or null if no RecorderProvider in the chain of responsibility knows how to provide a Recorder for obj.
See Also

Reference

RecorderProvider Class
PostSharp.Patterns.Recording Namespace


RecorderProvider.GetRecorderCore Method

RecorderProviderGetRecorderCore Method

Gets the default Recorder for a given object.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected abstract Recorder GetRecorderCore(
    Object obj
)

Parameters

obj
Type: SystemObject
The object for which the default Recorder is required, or null if the global default provider (exposed for convenience on the DefaultRecorder) property if required.

Return Value

Type: Recorder
The Recorder for obj, or null if the current RecorderProvider does not know how to provide a Recorder for obj, in which case the caller shall invoke the next RecorderProvider in the chain of responsibility.
See Also

Reference

RecorderProvider Class
PostSharp.Patterns.Recording Namespace

Other Resources

Conceptual: Assigning Recorders Manually


RecordingScope Class

Defines the scope a logical operation, that is, a set of change that should be undone or redone as a whole.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.RecordingRecordingScope

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class RecordingScope : IDisposable

The RecordingScope type exposes the following members.

Properties
 | Name | Description
Public property | OperationDescriptor | Gets or sets the IOperationDescriptor for the current scope.
Top
Methods
 | Name | Description
Public method | Complete | Closes the current RecordingScope and mark it as successful.
Public method | Dispose | Closes the current RecordingScope.
Top
Remarks

Scopes can be defined declaratively using the RecordingScopeAttribute custom attribute.

To open a scope imperatively, use the OpenScope(RecordingScopeOption) method. Use the Complete or Dispose method to close the scope.

See Also

Reference

PostSharp.Patterns.Recording Namespace

Other Resources

Conceptual: Understanding the Recordable Aspect


RecordingScope Properties

The RecordingScope type exposes the following members.

Properties
 | Name | Description
Public property | OperationDescriptor | Gets or sets the IOperationDescriptor for the current scope.
Top
See Also

Reference

RecordingScope Class
PostSharp.Patterns.Recording Namespace


RecordingScope.OperationDescriptor Property

RecordingScopeOperationDescriptor Property

Gets or sets the IOperationDescriptor for the current scope.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IOperationDescriptor OperationDescriptor { get; set; }

Property Value

Type: IOperationDescriptor
Remarks

To set the name of the current scope, assign this property to an instance of the NamedOperationDescriptor class.

See Also

Reference

RecordingScope Class
PostSharp.Patterns.Recording Namespace


RecordingScope Methods

The RecordingScope type exposes the following members.

Methods
 | Name | Description
Public method | Complete | Closes the current RecordingScope and mark it as successful.
Public method | Dispose | Closes the current RecordingScope.
Top
See Also

Reference

RecordingScope Class
PostSharp.Patterns.Recording Namespace


RecordingScope.Complete Method

RecordingScopeComplete Method

Closes the current RecordingScope and mark it as successful.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Complete()
Remarks

It allowed but unnecessary to call the Dispose method after the Complete method.

See Also

Reference

RecordingScope Class
PostSharp.Patterns.Recording Namespace


RecordingScope.Dispose Method

RecordingScopeDispose Method

Closes the current RecordingScope.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Dispose()

Implements

IDisposableDispose
Remarks

If the current RecordingScope is atomic, invoking Dispose without Complete will undo all changes done in the current scope. In other words, Dispose without Complete has rollback semantics.

See Also

Reference

RecordingScope Class
PostSharp.Patterns.Recording Namespace


RecordingScopeAttribute Class

Custom attribute that, when applied to a method, defines the characteristics of the RecordingScope that corresponds to the target method.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.Patterns.RecordingRecordingScopeAttribute

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class RecordingScopeAttribute : MulticastAttribute

The RecordingScopeAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | RecordingScopeAttribute(RecordingScopeOption) | Initializes a new instance of the RecordingScopeAttribute.
Public method | RecordingScopeAttribute(String, RecordingScopeOption) | Initializes a new instance of the RecordingScopeAttribute class and specify the scope name.
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | Name | Gets the scope name.
Public property | Option | Gets the scope option.
Top
See Also

Reference

PostSharp.Patterns.Recording Namespace

Other Resources

Conceptual: Customizing Undo/Redo Operation Names
Conceptual: Understanding the Recordable Aspect


RecordingScopeAttribute Constructor

Overload List
 | Name | Description
Public method | RecordingScopeAttribute(RecordingScopeOption) | Initializes a new instance of the RecordingScopeAttribute.
Public method | RecordingScopeAttribute(String, RecordingScopeOption) | Initializes a new instance of the RecordingScopeAttribute class and specify the scope name.
Top
See Also

Reference

RecordingScopeAttribute Class
PostSharp.Patterns.Recording Namespace


RecordingScopeAttribute Constructor (RecordingScopeOption)

Initializes a new instance of the RecordingScopeAttribute.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public RecordingScopeAttribute(
    RecordingScopeOption option
)

Parameters

option
Type: PostSharp.Patterns.RecordingRecordingScopeOption
Scope options. Typically Atomic or Skip.
See Also

Reference

RecordingScopeAttribute Class
RecordingScopeAttribute Overload
PostSharp.Patterns.Recording Namespace


RecordingScopeAttribute Constructor (String, RecordingScopeOption)

Initializes a new instance of the RecordingScopeAttribute class and specify the scope name.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public RecordingScopeAttribute(
    string name,
    RecordingScopeOption option = RecordingScopeOption.Default
)

Parameters

name
Type: SystemString
The scope name, or null.
option (Optional)
Type: PostSharp.Patterns.RecordingRecordingScopeOption
Scope options.
See Also

Reference

RecordingScopeAttribute Class
RecordingScopeAttribute Overload
PostSharp.Patterns.Recording Namespace


RecordingScopeAttribute Properties

The RecordingScopeAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | Name | Gets the scope name.
Public property | Option | Gets the scope option.
Top
See Also

Reference

RecordingScopeAttribute Class
PostSharp.Patterns.Recording Namespace


RecordingScopeAttribute.Name Property

RecordingScopeAttributeName Property

Gets the scope name.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string Name { get; }

Property Value

Type: String
See Also

Reference

RecordingScopeAttribute Class
PostSharp.Patterns.Recording Namespace


RecordingScopeAttribute.Option Property

RecordingScopeAttributeOption Property

Gets the scope option.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public RecordingScopeOption Option { get; }

Property Value

Type: RecordingScopeOption
See Also

Reference

RecordingScopeAttribute Class
PostSharp.Patterns.Recording Namespace


RecordingScopeOption Enumeration

Enumerates the kinds of recording scope.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum RecordingScopeOption
Members
Member name | Value | Description
Default | 0 | For declarative scopes, a RecordingScope is automatically opened for the first public method of a recordable object on the call stack.
Skip | 1 | Prevents a RecordingScope to be automatically opened for the target method. Cannot be used with OpenScope(RecordingScopeOption).
Atomic | 2 | Causes changes in the RecordingScope to be rolled back if the scope execution is not successful. In case of declarative scope (RecordingScopeAttribute), it means that changes done by the method will be rolled back if the method results in an exception. For imperative scopes (OpenScope(RecordingScopeOption), the changes will be rolled back if the scope is disposed by the Dispose method without previous call to the Complete method. Unlike normal scopes, atomic scopes are nested. However, only the top scope can be seen in the UndoOperations and RedoOperations collections.
See Also

Reference

PostSharp.Patterns.Recording Namespace
PostSharp.Patterns.RecordingRecordingScope
PostSharp.Patterns.RecordingRecordingScopeAttribute
RecorderOpenScope(RecordingScopeOption)


RecordingServices Class

Provides global methods to work with the PostSharp.Patterns.Recording namespace.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.RecordingRecordingServices

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static class RecordingServices

The RecordingServices type exposes the following members.

Properties
Name | Description
DefaultRecorder | Gets the global default Recorder.
OperationFormatter | Gets or sets the OperationFormatter, which provides human-readable descriptions of operations.
RecorderProvider | Gets or sets the RecorderProvider, which provides the default Recorder for recordable objects that have the AutoRecord property set to true (which is the default value).
Top
See Also

Reference

PostSharp.Patterns.Recording Namespace

Other Resources

Conceptual: Assigning Recorders Manually
Conceptual: Customizing Undo/Redo Operation Names


RecordingServices Properties

The RecordingServices type exposes the following members.

Properties
Name | Description
DefaultRecorder | Gets the global default Recorder.
OperationFormatter | Gets or sets the OperationFormatter, which provides human-readable descriptions of operations.
RecorderProvider | Gets or sets the RecorderProvider, which provides the default Recorder for recordable objects that have the AutoRecord property set to true (which is the default value).
Top
See Also

Reference

RecordingServices Class
PostSharp.Patterns.Recording Namespace


RecordingServices.DefaultRecorder Property

RecordingServicesDefaultRecorder Property

Gets the global default Recorder.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static Recorder DefaultRecorder { get; }

Property Value

Type: Recorder
Remarks

This property is provided for convenience only. It is equivalent to calling GetRecorder(Object) with a null argument.

See Also

Reference

RecordingServices Class
PostSharp.Patterns.Recording Namespace

Other Resources

Conceptual: Adding Undo/Redo to the User Interface
Conceptual: Assigning Recorders Manually
Conceptual: Understanding the Recordable Aspect


RecordingServices.OperationFormatter Property

RecordingServicesOperationFormatter Property

Gets or sets the OperationFormatter, which provides human-readable descriptions of operations.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static OperationFormatter OperationFormatter { get; set; }

Property Value

Type: OperationFormatter
Remarks

This property is the head of a chain of responsibility. If you set this property to a new value, you typically have to pass the previous value of this property to the constructor of your custom OperationFormatter.

See Also

Reference

RecordingServices Class
PostSharp.Patterns.Recording Namespace


RecordingServices.RecorderProvider Property

RecordingServicesRecorderProvider Property

Gets or sets the RecorderProvider, which provides the default Recorder for recordable objects that have the AutoRecord property set to true (which is the default value).

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static RecorderProvider RecorderProvider { get; set; }

Property Value

Type: RecorderProvider
Remarks

This property is the head of a chain of responsibility. If you set this property to a new value, you typically have to pass the previous value of this property to the constructor of your custom RecorderProvider.

The default implementation unconditionally returns a single global instance of the Recorder class.

See Also

Reference

RecordingServices Class
PostSharp.Patterns.Recording Namespace

Other Resources

Conceptual: Assigning Recorders Manually


ReplayContext Class

Represents the context of an undo or redo operation. The class gives access to system-defined and user-defined pieces of information.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.RecordingReplayContext

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ReplayContext

The ReplayContext type exposes the following members.

Properties
 | Name | Description
Public property | CustomContext | Gets a dictionary that user code can use to store arbitrary pieces of information.
Public property | Success | Determines whether the operation was successful. This flag is set only in the OnReplayed(ReplayKind, ReplayContext) method.
Top
See Also

Reference

PostSharp.Patterns.Recording Namespace


ReplayContext Properties

The ReplayContext type exposes the following members.

Properties
 | Name | Description
Public property | CustomContext | Gets a dictionary that user code can use to store arbitrary pieces of information.
Public property | Success | Determines whether the operation was successful. This flag is set only in the OnReplayed(ReplayKind, ReplayContext) method.
Top
See Also

Reference

ReplayContext Class
PostSharp.Patterns.Recording Namespace


ReplayContext.CustomContext Property

ReplayContextCustomContext Property

Gets a dictionary that user code can use to store arbitrary pieces of information.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IDictionary<Object, Object> CustomContext { get; }

Property Value

Type: IDictionary Object, Object
See Also

Reference

ReplayContext Class
PostSharp.Patterns.Recording Namespace


ReplayContext.Success Property

ReplayContextSuccess Property

Determines whether the operation was successful. This flag is set only in the OnReplayed(ReplayKind, ReplayContext) method.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Success { get; }

Property Value

Type: Boolean
See Also

Reference

ReplayContext Class
PostSharp.Patterns.Recording Namespace


ReplayKind Enumeration

Enumerates the kind of situations in which the OnReplaying(ReplayKind, ReplayContext) or OnReplayed(ReplayKind, ReplayContext) methods are invoked.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum ReplayKind
Members
Member name | Value | Description
Undo | 0 | Undo operation.
Redo | 1 | Redo operation.
Remarks

Other reasons may be added in the future.

See Also

Reference

PostSharp.Patterns.Recording Namespace


RestorePoint Class

Represents a point to which operations can be undone or redone. A RestorePoint is a pseudo-Operation that does not represent any change.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.RecordingOperation
PostSharp.Patterns.RecordingRestorePoint

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class RestorePoint : Operation

The RestorePoint type exposes the following members.

Properties
 | Name | Description
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Public property | RestorePointName | Gets the name of the current RestorePoint.
Top
Methods
 | Name | Description
Public method | Remove | Removes the current RestorePoint from the UndoOperations or RedoOperations.
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Overrides OperationVisitAffectedObjects(ActionObject).)
Top
See Also

Reference

PostSharp.Patterns.Recording Namespace

Other Resources

Conceptual: Understanding the Recordable Aspect


RestorePoint Properties

The RestorePoint type exposes the following members.

Properties
 | Name | Description
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Public property | RestorePointName | Gets the name of the current RestorePoint.
Top
See Also

Reference

RestorePoint Class
PostSharp.Patterns.Recording Namespace


RestorePoint.OperationKind Property

RestorePointOperationKind Property

Gets the kind of operation.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override OperationKind OperationKind { get; }

Property Value

Type: OperationKind

Implements

IOperationDescriptorOperationKind
See Also

Reference

RestorePoint Class
PostSharp.Patterns.Recording Namespace


RestorePoint.RestorePointName Property

RestorePointRestorePointName Property

Gets the name of the current RestorePoint.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string RestorePointName { get; }

Property Value

Type: String
See Also

Reference

RestorePoint Class
PostSharp.Patterns.Recording Namespace


RestorePoint Methods

The RestorePoint type exposes the following members.

Methods
 | Name | Description
Public method | Remove | Removes the current RestorePoint from the UndoOperations or RedoOperations.
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Overrides OperationVisitAffectedObjects(ActionObject).)
Top
See Also

Reference

RestorePoint Class
PostSharp.Patterns.Recording Namespace


RestorePoint.Remove Method

RestorePointRemove Method

Removes the current RestorePoint from the UndoOperations or RedoOperations.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Remove()

Return Value

Type: Boolean
true if the RestorePoint was removed, false if it was not present in these collections.
See Also

Reference

RestorePoint Class
PostSharp.Patterns.Recording Namespace

Other Resources

Conceptual: Understanding the Recordable Aspect


RestorePoint.VisitAffectedObjects Method

RestorePointVisitAffectedObjects Method

Executes a given action on all recordable objects involved with the current Operation.

Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void VisitAffectedObjects(
    Action<Object> action
)

Parameters

action
Type: SystemAction Object
See Also

Reference

RestorePoint Class
PostSharp.Patterns.Recording Namespace


PostSharp.Patterns.Recording.Operations Namespace

The PostSharp.Patterns.Recording.Operations namespace defines recordable operations.
Classes
 | Class | Description
Public class | AddCollectionItemOperationT | Represents a Add(T) or Insert(Int32, T) operation.
Public class | AddCollectionRangeOperationT | Represents a AddRange(IEnumerableT) or InsertRange(Int32, IEnumerableT) operation.
Public class | AddDictionaryItemOperationTKey, TValue | Represents a Add(TKey, TValue) operation.
Public class | AddSetItemOperationT | Represents a Add(T) operation.
Public class | AttachObjectToRecorderOperation | Encapsulates the Attach(Object) operation.
Public class | ChangeManySetOperationT | Represents any of the set operations that add or remove multiple items (e.g. IntersectWith(IEnumerableT), UnionWith(IEnumerableT), ...).
Public class | ClearCollectionOperationT | Represents the Clear operation.
Public class | ClearDictionaryOperationTKey, TValue | Represents the AdvisableDictionaryTKey, TValue operation.
Public class | ClearSetOperationT | Represents the Clear operation.
Public class | CollectionOperationT | Base class for operations on an AdvisableCollectionT.
Public class | CompositeOperation | Represents an Operation composed of other sub-operations.
Public class | DetachObjectFromRecorderOperation | Encapsulates the Detach(Object) operation.
Public class | DictionaryOperationTKey, TValue | Base class for operations on an AdvisableDictionaryTKey, TValue.
Public class | FieldOperationT | Encapsulates a modification of a field value.
Public class | HashSetOperationT | Base class for operations on an AdvisableHashSetT.
Public class | MethodExecutionOperationDescriptor | Represents a call to a method in user code.
Public class | MoveCollectionItemOperationT | Represents a Move(Int32, Int32) operation.
Public class | NamedOperationDescriptor | Represents an operation whose named has been set declaratively or imperatively.
Public class | RecorderOperation | An Operation on a Recorder, specifically a base class for AttachObjectToRecorderOperation and DetachObjectFromRecorderOperation.
Public class | RemoveCollectionItemOperationT | Represents a Remove(T) operation.
Public class | RemoveCollectionRangeOperationT | Represents a RemoveRange(Int32, Int32) operation.
Public class | RemoveDictionaryItemOperationTKey, TValue | Represents a Remove(TKey) operation.
Public class | RemoveSetItemOperationT | Represents a Remove(T) operation.
Public class | SetCollectionItemOperationT | Represents the operation of setting an item in an AdvisableCollectionT .
Public class | SetDictionaryItemOperationTKey, TValue | Represents the operation of setting a value in an AdvisableDictionaryTKey, TValue.
Interfaces
 | Interface | Description
Public interface | ICollectionOperation | Weakly-typed interface for the CollectionOperationT class.
Public interface | IDictionaryOperation | Weakly-typed interface for the DictionaryOperationTKey, TValue class.
Public interface | IFieldOperation | Weakly-typed interface for FieldOperationT.
Public interface | IHashSetOperation | Weakly-typed interface for the HashSetOperationT class.
Public interface | IOperationDescriptor | Encapsulates information that allow implementations of the OperationFormatter class to provide a human-readable description of an Operation.


AddCollectionItemOperation(T) Class

AddCollectionItemOperationT Class

Represents a Add(T) or Insert(Int32, T) operation.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.RecordingOperation
PostSharp.Patterns.Recording.OperationsCollectionOperation T
PostSharp.Patterns.Recording.OperationsAddCollectionItemOperationT

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class AddCollectionItemOperation<T> : CollectionOperation<T>

Type Parameters

T
Type of collection items.

The AddCollectionItemOperationT type exposes the following members.

Properties
 | Name | Description
Public property | Collection | Gets the collection on which the operation was performed. (Inherited from CollectionOperationT.)
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | NewIndex | Gets the index after the operation. (Overrides CollectionOperationTNewIndex.)
Public property | NewItem | Gets the item before the operation. (Overrides CollectionOperationTNewItem.)
Public property | OldIndex | Gets the index before the operation. (Inherited from CollectionOperationT.)
Public property | OldItem | Gets the item after the operation. (Inherited from CollectionOperationT.)
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Top
Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Inherited from CollectionOperationT.)
Top
See Also

Reference

PostSharp.Patterns.Recording.Operations Namespace


AddCollectionItemOperation(T) Properties

AddCollectionItemOperationT Properties

The AddCollectionItemOperationT generic type exposes the following members.

Properties
 | Name | Description
Public property | Collection | Gets the collection on which the operation was performed. (Inherited from CollectionOperationT.)
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | NewIndex | Gets the index after the operation. (Overrides CollectionOperationTNewIndex.)
Public property | NewItem | Gets the item before the operation. (Overrides CollectionOperationTNewItem.)
Public property | OldIndex | Gets the index before the operation. (Inherited from CollectionOperationT.)
Public property | OldItem | Gets the item after the operation. (Inherited from CollectionOperationT.)
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Top
See Also

Reference

AddCollectionItemOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


AddCollectionItemOperation(T).NewIndex Property

AddCollectionItemOperationTNewIndex Property

Gets the index after the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override int NewIndex { get; }

Property Value

Type: Int32

Implements

ICollectionOperationNewIndex
See Also

Reference

AddCollectionItemOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


AddCollectionItemOperation(T).NewItem Property

AddCollectionItemOperationTNewItem Property

Gets the item before the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override T NewItem { get; }

Property Value

Type: T
See Also

Reference

AddCollectionItemOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


AddCollectionItemOperation(T).OperationKind Property

AddCollectionItemOperationTOperationKind Property

Gets the kind of operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override OperationKind OperationKind { get; }

Property Value

Type: OperationKind

Implements

IOperationDescriptorOperationKind
See Also

Reference

AddCollectionItemOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


AddCollectionItemOperation(T) Methods

AddCollectionItemOperationT Methods

The AddCollectionItemOperationT generic type exposes the following members.

Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Inherited from CollectionOperationT.)
Top
See Also

Reference

AddCollectionItemOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


AddCollectionRangeOperation(T) Class

AddCollectionRangeOperationT Class

Represents a AddRange(IEnumerableT) or InsertRange(Int32, IEnumerableT) operation.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.RecordingOperation
PostSharp.Patterns.Recording.OperationsCollectionOperation T
PostSharp.Patterns.Recording.OperationsAddCollectionRangeOperationT

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class AddCollectionRangeOperation<T> : CollectionOperation<T>

Type Parameters

T
Type of collection items.

The AddCollectionRangeOperationT type exposes the following members.

Properties
 | Name | Description
Public property | Collection | Gets the collection on which the operation was performed. (Inherited from CollectionOperationT.)
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | NewIndex | Gets the index after the operation. (Overrides CollectionOperationTNewIndex.)
Public property | NewItem | Gets the item before the operation. (Inherited from CollectionOperationT.)
Public property | NewItems | Gets the items that were added to the set after the operation.
Public property | OldIndex | Gets the index before the operation. (Inherited from CollectionOperationT.)
Public property | OldItem | Gets the item after the operation. (Inherited from CollectionOperationT.)
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Top
Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Inherited from CollectionOperationT.)
Top
See Also

Reference

PostSharp.Patterns.Recording.Operations Namespace


AddCollectionRangeOperation(T) Properties

AddCollectionRangeOperationT Properties

The AddCollectionRangeOperationT generic type exposes the following members.

Properties
 | Name | Description
Public property | Collection | Gets the collection on which the operation was performed. (Inherited from CollectionOperationT.)
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | NewIndex | Gets the index after the operation. (Overrides CollectionOperationTNewIndex.)
Public property | NewItem | Gets the item before the operation. (Inherited from CollectionOperationT.)
Public property | NewItems | Gets the items that were added to the set after the operation.
Public property | OldIndex | Gets the index before the operation. (Inherited from CollectionOperationT.)
Public property | OldItem | Gets the item after the operation. (Inherited from CollectionOperationT.)
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Top
See Also

Reference

AddCollectionRangeOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


AddCollectionRangeOperation(T).NewIndex Property

AddCollectionRangeOperationTNewIndex Property

Gets the index after the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override int NewIndex { get; }

Property Value

Type: Int32

Implements

ICollectionOperationNewIndex
See Also

Reference

AddCollectionRangeOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


AddCollectionRangeOperation(T).NewItems Property

AddCollectionRangeOperationTNewItems Property

Gets the items that were added to the set after the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ReadOnlyArray<T> NewItems { get; }

Property Value

Type: ReadOnlyArray T
See Also

Reference

AddCollectionRangeOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


AddCollectionRangeOperation(T).OperationKind Property

AddCollectionRangeOperationTOperationKind Property

Gets the kind of operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override OperationKind OperationKind { get; }

Property Value

Type: OperationKind

Implements

IOperationDescriptorOperationKind
See Also

Reference

AddCollectionRangeOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


AddCollectionRangeOperation(T) Methods

AddCollectionRangeOperationT Methods

The AddCollectionRangeOperationT generic type exposes the following members.

Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Inherited from CollectionOperationT.)
Top
See Also

Reference

AddCollectionRangeOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


AddDictionaryItemOperation(TKey, TValue) Class

AddDictionaryItemOperationTKey, TValue Class

Represents a Add(TKey, TValue) operation.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.RecordingOperation
PostSharp.Patterns.Recording.OperationsDictionaryOperation TKey, TValue
PostSharp.Patterns.Recording.OperationsAddDictionaryItemOperationTKey, TValue

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class AddDictionaryItemOperation<TKey, TValue> : DictionaryOperation<TKey, TValue>

Type Parameters

TKey
Type of dictionary keys.
TValue
Type of dictionary values.

The AddDictionaryItemOperationTKey, TValue type exposes the following members.

Properties
 | Name | Description
Public property | Dictionary | Gets the collection on which the operation was performed. (Inherited from DictionaryOperationTKey, TValue.)
Public property | Key | Gets the key of the dictionary entry affected by the operation. (Overrides DictionaryOperationTKey, TValueKey.)
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | NewValue | Gets the value of the dictionary entry after the operation. (Overrides DictionaryOperationTKey, TValueNewValue.)
Public property | OldValue | Gets the value of the dictionary entry before the operation. (Inherited from DictionaryOperationTKey, TValue.)
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Top
Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Inherited from DictionaryOperationTKey, TValue.)
Top
See Also

Reference

PostSharp.Patterns.Recording.Operations Namespace


AddDictionaryItemOperation(TKey, TValue) Properties

AddDictionaryItemOperationTKey, TValue Properties

The AddDictionaryItemOperationTKey, TValue generic type exposes the following members.

Properties
 | Name | Description
Public property | Dictionary | Gets the collection on which the operation was performed. (Inherited from DictionaryOperationTKey, TValue.)
Public property | Key | Gets the key of the dictionary entry affected by the operation. (Overrides DictionaryOperationTKey, TValueKey.)
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | NewValue | Gets the value of the dictionary entry after the operation. (Overrides DictionaryOperationTKey, TValueNewValue.)
Public property | OldValue | Gets the value of the dictionary entry before the operation. (Inherited from DictionaryOperationTKey, TValue.)
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Top
See Also

Reference

AddDictionaryItemOperationTKey, TValue Class
PostSharp.Patterns.Recording.Operations Namespace


AddDictionaryItemOperation(TKey, TValue).Key Property

AddDictionaryItemOperationTKey, TValueKey Property

Gets the key of the dictionary entry affected by the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override TKey Key { get; }

Property Value

Type: TKey
See Also

Reference

AddDictionaryItemOperationTKey, TValue Class
PostSharp.Patterns.Recording.Operations Namespace


AddDictionaryItemOperation(TKey, TValue).NewValue Property

AddDictionaryItemOperationTKey, TValueNewValue Property

Gets the value of the dictionary entry after the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override TValue NewValue { get; }

Property Value

Type: TValue
See Also

Reference

AddDictionaryItemOperationTKey, TValue Class
PostSharp.Patterns.Recording.Operations Namespace


AddDictionaryItemOperation(TKey, TValue).OperationKind Property

AddDictionaryItemOperationTKey, TValueOperationKind Property

Gets the kind of operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override OperationKind OperationKind { get; }

Property Value

Type: OperationKind

Implements

IOperationDescriptorOperationKind
See Also

Reference

AddDictionaryItemOperationTKey, TValue Class
PostSharp.Patterns.Recording.Operations Namespace


AddDictionaryItemOperation(TKey, TValue) Methods

AddDictionaryItemOperationTKey, TValue Methods

The AddDictionaryItemOperationTKey, TValue generic type exposes the following members.

Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Inherited from DictionaryOperationTKey, TValue.)
Top
See Also

Reference

AddDictionaryItemOperationTKey, TValue Class
PostSharp.Patterns.Recording.Operations Namespace


AddSetItemOperation(T) Class

AddSetItemOperationT Class

Represents a Add(T) operation.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.RecordingOperation
PostSharp.Patterns.Recording.OperationsHashSetOperation T
PostSharp.Patterns.Recording.OperationsAddSetItemOperationT

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class AddSetItemOperation<T> : HashSetOperation<T>

Type Parameters

T
Type of set items.

The AddSetItemOperationT type exposes the following members.

Properties
 | Name | Description
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | NewItem | Gets the item before the operation. (Overrides HashSetOperationTNewItem.)
Public property | OldItem | Gets the item after the operation. (Inherited from HashSetOperationT.)
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Public property | Set | Gets the set on which the operation was performed. (Inherited from HashSetOperationT.)
Top
Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Inherited from HashSetOperationT.)
Top
See Also

Reference

PostSharp.Patterns.Recording.Operations Namespace


AddSetItemOperation(T) Properties

AddSetItemOperationT Properties

The AddSetItemOperationT generic type exposes the following members.

Properties
 | Name | Description
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | NewItem | Gets the item before the operation. (Overrides HashSetOperationTNewItem.)
Public property | OldItem | Gets the item after the operation. (Inherited from HashSetOperationT.)
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Public property | Set | Gets the set on which the operation was performed. (Inherited from HashSetOperationT.)
Top
See Also

Reference

AddSetItemOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


AddSetItemOperation(T).NewItem Property

AddSetItemOperationTNewItem Property

Gets the item before the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override T NewItem { get; }

Property Value

Type: T
See Also

Reference

AddSetItemOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


AddSetItemOperation(T).OperationKind Property

AddSetItemOperationTOperationKind Property

Gets the kind of operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override OperationKind OperationKind { get; }

Property Value

Type: OperationKind

Implements

IOperationDescriptorOperationKind
See Also

Reference

AddSetItemOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


AddSetItemOperation(T) Methods

AddSetItemOperationT Methods

The AddSetItemOperationT generic type exposes the following members.

Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Inherited from HashSetOperationT.)
Top
See Also

Reference

AddSetItemOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


AttachObjectToRecorderOperation Class

Encapsulates the Attach(Object) operation.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.RecordingOperation
PostSharp.Patterns.Recording.OperationsRecorderOperation
PostSharp.Patterns.Recording.OperationsAttachObjectToRecorderOperation

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class AttachObjectToRecorderOperation : RecorderOperation

The AttachObjectToRecorderOperation type exposes the following members.

Properties
 | Name | Description
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | Object | Gets the object being attached to the Recorder.
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Public property | Recorder | Gets the Recorder to which the current Operation relates. (Inherited from RecorderOperation.)
Top
Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Inherited from RecorderOperation.)
Top
See Also

Reference

PostSharp.Patterns.Recording.Operations Namespace


AttachObjectToRecorderOperation Properties

The AttachObjectToRecorderOperation type exposes the following members.

Properties
 | Name | Description
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | Object | Gets the object being attached to the Recorder.
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Public property | Recorder | Gets the Recorder to which the current Operation relates. (Inherited from RecorderOperation.)
Top
See Also

Reference

AttachObjectToRecorderOperation Class
PostSharp.Patterns.Recording.Operations Namespace


AttachObjectToRecorderOperation.Object Property

AttachObjectToRecorderOperationObject Property

Gets the object being attached to the Recorder.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Object Object { get; }

Property Value

Type: Object
See Also

Reference

AttachObjectToRecorderOperation Class
PostSharp.Patterns.Recording.Operations Namespace


AttachObjectToRecorderOperation.OperationKind Property

AttachObjectToRecorderOperationOperationKind Property

Gets the kind of operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override OperationKind OperationKind { get; }

Property Value

Type: OperationKind

Implements

IOperationDescriptorOperationKind
See Also

Reference

AttachObjectToRecorderOperation Class
PostSharp.Patterns.Recording.Operations Namespace


AttachObjectToRecorderOperation Methods

The AttachObjectToRecorderOperation type exposes the following members.

Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Inherited from RecorderOperation.)
Top
See Also

Reference

AttachObjectToRecorderOperation Class
PostSharp.Patterns.Recording.Operations Namespace


ChangeManySetOperation(T) Class

ChangeManySetOperationT Class

Represents any of the set operations that add or remove multiple items (e.g. IntersectWith(IEnumerableT), UnionWith(IEnumerableT), ...).
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.RecordingOperation
PostSharp.Patterns.Recording.OperationsHashSetOperation T
PostSharp.Patterns.Recording.OperationsChangeManySetOperationT

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ChangeManySetOperation<T> : HashSetOperation<T>

Type Parameters

T
Type of items in the set.

The ChangeManySetOperationT type exposes the following members.

Properties
 | Name | Description
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | NewItem | Gets the item before the operation. (Inherited from HashSetOperationT.)
Public property | NewItems | Gets the items that were added to the set after the operation.
Public property | OldItem | Gets the item after the operation. (Inherited from HashSetOperationT.)
Public property | OldItems | Gets the items that were in the set before the operation.
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Public property | Set | Gets the set on which the operation was performed. (Inherited from HashSetOperationT.)
Top
Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Inherited from HashSetOperationT.)
Top
See Also

Reference

PostSharp.Patterns.Recording.Operations Namespace


ChangeManySetOperation(T) Properties

ChangeManySetOperationT Properties

The ChangeManySetOperationT generic type exposes the following members.

Properties
 | Name | Description
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | NewItem | Gets the item before the operation. (Inherited from HashSetOperationT.)
Public property | NewItems | Gets the items that were added to the set after the operation.
Public property | OldItem | Gets the item after the operation. (Inherited from HashSetOperationT.)
Public property | OldItems | Gets the items that were in the set before the operation.
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Public property | Set | Gets the set on which the operation was performed. (Inherited from HashSetOperationT.)
Top
See Also

Reference

ChangeManySetOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


ChangeManySetOperation(T).NewItems Property

ChangeManySetOperationTNewItems Property

Gets the items that were added to the set after the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ReadOnlyArray<T> NewItems { get; }

Property Value

Type: ReadOnlyArray T
See Also

Reference

ChangeManySetOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


ChangeManySetOperation(T).OldItems Property

ChangeManySetOperationTOldItems Property

Gets the items that were in the set before the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ReadOnlyArray<T> OldItems { get; }

Property Value

Type: ReadOnlyArray T
See Also

Reference

ChangeManySetOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


ChangeManySetOperation(T).OperationKind Property

ChangeManySetOperationTOperationKind Property

Gets the kind of operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override OperationKind OperationKind { get; }

Property Value

Type: OperationKind

Implements

IOperationDescriptorOperationKind
See Also

Reference

ChangeManySetOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


ChangeManySetOperation(T) Methods

ChangeManySetOperationT Methods

The ChangeManySetOperationT generic type exposes the following members.

Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Inherited from HashSetOperationT.)
Top
See Also

Reference

ChangeManySetOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


ClearCollectionOperation(T) Class

ClearCollectionOperationT Class

Represents the Clear operation.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.RecordingOperation
PostSharp.Patterns.Recording.OperationsCollectionOperation T
PostSharp.Patterns.Recording.OperationsClearCollectionOperationT

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ClearCollectionOperation<T> : CollectionOperation<T>

Type Parameters

T
Type of items in the collection.

The ClearCollectionOperationT type exposes the following members.

Properties
 | Name | Description
Public property | Collection | Gets the collection on which the operation was performed. (Inherited from CollectionOperationT.)
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | NewIndex | Gets the index after the operation. (Inherited from CollectionOperationT.)
Public property | NewItem | Gets the item before the operation. (Inherited from CollectionOperationT.)
Public property | OldIndex | Gets the index before the operation. (Inherited from CollectionOperationT.)
Public property | OldItem | Gets the item after the operation. (Inherited from CollectionOperationT.)
Public property | OldItems | Gets the items that were in the collection before it was cleared.
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Top
Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Inherited from CollectionOperationT.)
Top
See Also

Reference

PostSharp.Patterns.Recording.Operations Namespace


ClearCollectionOperation(T) Properties

ClearCollectionOperationT Properties

The ClearCollectionOperationT generic type exposes the following members.

Properties
 | Name | Description
Public property | Collection | Gets the collection on which the operation was performed. (Inherited from CollectionOperationT.)
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | NewIndex | Gets the index after the operation. (Inherited from CollectionOperationT.)
Public property | NewItem | Gets the item before the operation. (Inherited from CollectionOperationT.)
Public property | OldIndex | Gets the index before the operation. (Inherited from CollectionOperationT.)
Public property | OldItem | Gets the item after the operation. (Inherited from CollectionOperationT.)
Public property | OldItems | Gets the items that were in the collection before it was cleared.
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Top
See Also

Reference

ClearCollectionOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


ClearCollectionOperation(T).OldItems Property

ClearCollectionOperationTOldItems Property

Gets the items that were in the collection before it was cleared.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ReadOnlyArray<T> OldItems { get; }

Property Value

Type: ReadOnlyArray T
See Also

Reference

ClearCollectionOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


ClearCollectionOperation(T).OperationKind Property

ClearCollectionOperationTOperationKind Property

Gets the kind of operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override OperationKind OperationKind { get; }

Property Value

Type: OperationKind

Implements

IOperationDescriptorOperationKind
See Also

Reference

ClearCollectionOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


ClearCollectionOperation(T) Methods

ClearCollectionOperationT Methods

The ClearCollectionOperationT generic type exposes the following members.

Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Inherited from CollectionOperationT.)
Top
See Also

Reference

ClearCollectionOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


ClearDictionaryOperation(TKey, TValue) Class

ClearDictionaryOperationTKey, TValue Class

Represents the AdvisableDictionaryTKey, TValue operation.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.RecordingOperation
PostSharp.Patterns.Recording.OperationsDictionaryOperation TKey, TValue
PostSharp.Patterns.Recording.OperationsClearDictionaryOperationTKey, TValue

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ClearDictionaryOperation<TKey, TValue> : DictionaryOperation<TKey, TValue>

Type Parameters

TKey
Type of keys.
TValue
Type of values.

The ClearDictionaryOperationTKey, TValue type exposes the following members.

Properties
 | Name | Description
Public property | Dictionary | Gets the collection on which the operation was performed. (Inherited from DictionaryOperationTKey, TValue.)
Public property | Key | Gets the key of the dictionary entry affected by the operation. (Inherited from DictionaryOperationTKey, TValue.)
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | NewValue | Gets the value of the dictionary entry after the operation. (Inherited from DictionaryOperationTKey, TValue.)
Public property | OldEntries | Gets the items that were in the dictionary before it was cleared.
Public property | OldValue | Gets the value of the dictionary entry before the operation. (Inherited from DictionaryOperationTKey, TValue.)
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Top
Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Inherited from DictionaryOperationTKey, TValue.)
Top
See Also

Reference

PostSharp.Patterns.Recording.Operations Namespace


ClearDictionaryOperation(TKey, TValue) Properties

ClearDictionaryOperationTKey, TValue Properties

The ClearDictionaryOperationTKey, TValue generic type exposes the following members.

Properties
 | Name | Description
Public property | Dictionary | Gets the collection on which the operation was performed. (Inherited from DictionaryOperationTKey, TValue.)
Public property | Key | Gets the key of the dictionary entry affected by the operation. (Inherited from DictionaryOperationTKey, TValue.)
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | NewValue | Gets the value of the dictionary entry after the operation. (Inherited from DictionaryOperationTKey, TValue.)
Public property | OldEntries | Gets the items that were in the dictionary before it was cleared.
Public property | OldValue | Gets the value of the dictionary entry before the operation. (Inherited from DictionaryOperationTKey, TValue.)
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Top
See Also

Reference

ClearDictionaryOperationTKey, TValue Class
PostSharp.Patterns.Recording.Operations Namespace


ClearDictionaryOperation(TKey, TValue).OldEntries Property

ClearDictionaryOperationTKey, TValueOldEntries Property

Gets the items that were in the dictionary before it was cleared.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ReadOnlyArray<KeyValuePair<TKey, TValue>> OldEntries { get; }

Property Value

Type: ReadOnlyArray KeyValuePair TKey, TValue
See Also

Reference

ClearDictionaryOperationTKey, TValue Class
PostSharp.Patterns.Recording.Operations Namespace


ClearDictionaryOperation(TKey, TValue).OperationKind Property

ClearDictionaryOperationTKey, TValueOperationKind Property

Gets the kind of operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override OperationKind OperationKind { get; }

Property Value

Type: OperationKind

Implements

IOperationDescriptorOperationKind
See Also

Reference

ClearDictionaryOperationTKey, TValue Class
PostSharp.Patterns.Recording.Operations Namespace


ClearDictionaryOperation(TKey, TValue) Methods

ClearDictionaryOperationTKey, TValue Methods

The ClearDictionaryOperationTKey, TValue generic type exposes the following members.

Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Inherited from DictionaryOperationTKey, TValue.)
Top
See Also

Reference

ClearDictionaryOperationTKey, TValue Class
PostSharp.Patterns.Recording.Operations Namespace


ClearSetOperation(T) Class

ClearSetOperationT Class

Represents the Clear operation.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.RecordingOperation
PostSharp.Patterns.Recording.OperationsHashSetOperation T
PostSharp.Patterns.Recording.OperationsClearSetOperationT

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ClearSetOperation<T> : HashSetOperation<T>

Type Parameters

T
Type of items in the set.

The ClearSetOperationT type exposes the following members.

Properties
 | Name | Description
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | NewItem | Gets the item before the operation. (Inherited from HashSetOperationT.)
Public property | OldItem | Gets the item after the operation. (Inherited from HashSetOperationT.)
Public property | OldItems | Gets the items that were in the set before it was cleared.
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Public property | Set | Gets the set on which the operation was performed. (Inherited from HashSetOperationT.)
Top
Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Inherited from HashSetOperationT.)
Top
See Also

Reference

PostSharp.Patterns.Recording.Operations Namespace


ClearSetOperation(T) Properties

ClearSetOperationT Properties

The ClearSetOperationT generic type exposes the following members.

Properties
 | Name | Description
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | NewItem | Gets the item before the operation. (Inherited from HashSetOperationT.)
Public property | OldItem | Gets the item after the operation. (Inherited from HashSetOperationT.)
Public property | OldItems | Gets the items that were in the set before it was cleared.
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Public property | Set | Gets the set on which the operation was performed. (Inherited from HashSetOperationT.)
Top
See Also

Reference

ClearSetOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


ClearSetOperation(T).OldItems Property

ClearSetOperationTOldItems Property

Gets the items that were in the set before it was cleared.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ReadOnlyArray<T> OldItems { get; }

Property Value

Type: ReadOnlyArray T
See Also

Reference

ClearSetOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


ClearSetOperation(T).OperationKind Property

ClearSetOperationTOperationKind Property

Gets the kind of operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override OperationKind OperationKind { get; }

Property Value

Type: OperationKind

Implements

IOperationDescriptorOperationKind
See Also

Reference

ClearSetOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


ClearSetOperation(T) Methods

ClearSetOperationT Methods

The ClearSetOperationT generic type exposes the following members.

Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Inherited from HashSetOperationT.)
Top
See Also

Reference

ClearSetOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


CollectionOperation(T) Class

CollectionOperationT Class

Base class for operations on an AdvisableCollectionT.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.RecordingOperation
PostSharp.Patterns.Recording.OperationsCollectionOperationT
More...

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class CollectionOperation<T> : Operation,
    ICollectionOperation, IOperationDescriptor

Type Parameters

T
Type of collection items.

The CollectionOperationT type exposes the following members.

Properties
 | Name | Description
Public property | Collection | Gets the collection on which the operation was performed.
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | NewIndex | Gets the index after the operation.
Public property | NewItem | Gets the item before the operation.
Public property | OldIndex | Gets the index before the operation.
Public property | OldItem | Gets the item after the operation.
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Inherited from Operation.)
Top
Methods
 | Name | Description
Protected method | GetMergeStatus | Determines how a given Operation can be merged with the current Operation. (Inherited from Operation.)
Protected method | Merge | Merges a given Operation into the current Operation. (Inherited from Operation.)
Protected method | Redo | Redo the current operation. (Inherited from Operation.)
Protected method | Undo | Undo the current operation. (Inherited from Operation.)
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Overrides OperationVisitAffectedObjects(ActionObject).)
Top
See Also

Reference

PostSharp.Patterns.Recording.Operations Namespace

Other Resources

Conceptual: Understanding the Recordable Aspect
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.RecordingOperation
PostSharp.Patterns.Recording.OperationsCollectionOperationT
PostSharp.Patterns.Recording.OperationsAddCollectionItemOperationT
PostSharp.Patterns.Recording.OperationsAddCollectionRangeOperationT
PostSharp.Patterns.Recording.OperationsClearCollectionOperationT
PostSharp.Patterns.Recording.OperationsMoveCollectionItemOperationT
PostSharp.Patterns.Recording.OperationsRemoveCollectionItemOperationT
PostSharp.Patterns.Recording.OperationsRemoveCollectionRangeOperationT
PostSharp.Patterns.Recording.OperationsSetCollectionItemOperationT


CollectionOperation(T) Properties

CollectionOperationT Properties

The CollectionOperationT generic type exposes the following members.

Properties
 | Name | Description
Public property | Collection | Gets the collection on which the operation was performed.
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | NewIndex | Gets the index after the operation.
Public property | NewItem | Gets the item before the operation.
Public property | OldIndex | Gets the index before the operation.
Public property | OldItem | Gets the item after the operation.
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Inherited from Operation.)
Top
See Also

Reference

CollectionOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


CollectionOperation(T).Collection Property

CollectionOperationTCollection Property

Gets the collection on which the operation was performed.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AdvisableCollection<T> Collection { get; }

Property Value

Type: AdvisableCollection T
See Also

Reference

CollectionOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


CollectionOperation(T).NewIndex Property

CollectionOperationTNewIndex Property

Gets the index after the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual int NewIndex { get; }

Property Value

Type: Int32

Implements

ICollectionOperationNewIndex
See Also

Reference

CollectionOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


CollectionOperation(T).NewItem Property

CollectionOperationTNewItem Property

Gets the item before the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual T NewItem { get; }

Property Value

Type: T
See Also

Reference

CollectionOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


CollectionOperation(T).OldIndex Property

CollectionOperationTOldIndex Property

Gets the index before the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual int OldIndex { get; }

Property Value

Type: Int32

Implements

ICollectionOperationOldIndex
See Also

Reference

CollectionOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


CollectionOperation(T).OldItem Property

CollectionOperationTOldItem Property

Gets the item after the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual T OldItem { get; }

Property Value

Type: T
See Also

Reference

CollectionOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


CollectionOperation(T) Methods

CollectionOperationT Methods

The CollectionOperationT generic type exposes the following members.

Methods
 | Name | Description
Protected method | GetMergeStatus | Determines how a given Operation can be merged with the current Operation. (Inherited from Operation.)
Protected method | Merge | Merges a given Operation into the current Operation. (Inherited from Operation.)
Protected method | Redo | Redo the current operation. (Inherited from Operation.)
Protected method | Undo | Undo the current operation. (Inherited from Operation.)
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Overrides OperationVisitAffectedObjects(ActionObject).)
Top
See Also

Reference

CollectionOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


CollectionOperation(T).VisitAffectedObjects Method

CollectionOperationTVisitAffectedObjects Method

Executes a given action on all recordable objects involved with the current Operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void VisitAffectedObjects(
    Action<Object> action
)

Parameters

action
Type: SystemAction Object
See Also

Reference

CollectionOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


CompositeOperation Class

Represents an Operation composed of other sub-operations.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.RecordingOperation
PostSharp.Patterns.Recording.OperationsCompositeOperation

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class CompositeOperation : Operation

The CompositeOperation type exposes the following members.

Properties
 | Name | Description
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Overrides OperationOperationDescriptor.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Top
Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Overrides OperationVisitAffectedObjects(ActionObject).)
Top
Remarks

The OperationDescriptor is typically not identical to the CompositeOperation itself.

See Also

Reference

PostSharp.Patterns.Recording.Operations Namespace

Other Resources

Conceptual: Understanding the Recordable Aspect


CompositeOperation Properties

The CompositeOperation type exposes the following members.

Properties
 | Name | Description
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Overrides OperationOperationDescriptor.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Top
See Also

Reference

CompositeOperation Class
PostSharp.Patterns.Recording.Operations Namespace


CompositeOperation.OperationDescriptor Property

CompositeOperationOperationDescriptor Property

Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override IOperationDescriptor OperationDescriptor { get; }

Property Value

Type: IOperationDescriptor
Remarks

By default, the OperationDescriptor property returns the current Operation.

When the Operation represents a user-defined scope, the property evaluates to an instance of the NamedOperationDescriptor class. When it represents a method scope, it evaluates to an instance of the MethodExecutionOperationDescriptor class.

See Also

Reference

CompositeOperation Class
PostSharp.Patterns.Recording.Operations Namespace


CompositeOperation.OperationKind Property

CompositeOperationOperationKind Property

Gets the kind of operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override OperationKind OperationKind { get; }

Property Value

Type: OperationKind

Implements

IOperationDescriptorOperationKind
See Also

Reference

CompositeOperation Class
PostSharp.Patterns.Recording.Operations Namespace


CompositeOperation Methods

The CompositeOperation type exposes the following members.

Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Overrides OperationVisitAffectedObjects(ActionObject).)
Top
See Also

Reference

CompositeOperation Class
PostSharp.Patterns.Recording.Operations Namespace


CompositeOperation.VisitAffectedObjects Method

CompositeOperationVisitAffectedObjects Method

Executes a given action on all recordable objects involved with the current Operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void VisitAffectedObjects(
    Action<Object> action
)

Parameters

action
Type: SystemAction Object
See Also

Reference

CompositeOperation Class
PostSharp.Patterns.Recording.Operations Namespace


DetachObjectFromRecorderOperation Class

Encapsulates the Detach(Object) operation.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.RecordingOperation
PostSharp.Patterns.Recording.OperationsRecorderOperation
PostSharp.Patterns.Recording.OperationsDetachObjectFromRecorderOperation

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class DetachObjectFromRecorderOperation : RecorderOperation

The DetachObjectFromRecorderOperation type exposes the following members.

Properties
 | Name | Description
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | Object | Gets the object being attached to the Recorder.
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Public property | Recorder | Gets the Recorder to which the current Operation relates. (Inherited from RecorderOperation.)
Top
Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Inherited from RecorderOperation.)
Top
See Also

Reference

PostSharp.Patterns.Recording.Operations Namespace


DetachObjectFromRecorderOperation Properties

The DetachObjectFromRecorderOperation type exposes the following members.

Properties
 | Name | Description
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | Object | Gets the object being attached to the Recorder.
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Public property | Recorder | Gets the Recorder to which the current Operation relates. (Inherited from RecorderOperation.)
Top
See Also

Reference

DetachObjectFromRecorderOperation Class
PostSharp.Patterns.Recording.Operations Namespace


DetachObjectFromRecorderOperation.Object Property

DetachObjectFromRecorderOperationObject Property

Gets the object being attached to the Recorder.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Object Object { get; }

Property Value

Type: Object
See Also

Reference

DetachObjectFromRecorderOperation Class
PostSharp.Patterns.Recording.Operations Namespace


DetachObjectFromRecorderOperation.OperationKind Property

DetachObjectFromRecorderOperationOperationKind Property

Gets the kind of operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override OperationKind OperationKind { get; }

Property Value

Type: OperationKind

Implements

IOperationDescriptorOperationKind
See Also

Reference

DetachObjectFromRecorderOperation Class
PostSharp.Patterns.Recording.Operations Namespace


DetachObjectFromRecorderOperation Methods

The DetachObjectFromRecorderOperation type exposes the following members.

Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Inherited from RecorderOperation.)
Top
See Also

Reference

DetachObjectFromRecorderOperation Class
PostSharp.Patterns.Recording.Operations Namespace


DictionaryOperation(TKey, TValue) Class

DictionaryOperationTKey, TValue Class

Base class for operations on an AdvisableDictionaryTKey, TValue.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.RecordingOperation
PostSharp.Patterns.Recording.OperationsDictionaryOperationTKey, TValue
PostSharp.Patterns.Recording.OperationsAddDictionaryItemOperationTKey, TValue
PostSharp.Patterns.Recording.OperationsClearDictionaryOperationTKey, TValue
PostSharp.Patterns.Recording.OperationsRemoveDictionaryItemOperationTKey, TValue
PostSharp.Patterns.Recording.OperationsSetDictionaryItemOperationTKey, TValue

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class DictionaryOperation<TKey, TValue> : Operation,
    IDictionaryOperation, IOperationDescriptor

Type Parameters

TKey
Type of keys.
TValue
Type of values.

The DictionaryOperationTKey, TValue type exposes the following members.

Properties
 | Name | Description
Public property | Dictionary | Gets the collection on which the operation was performed.
Public property | Key | Gets the key of the dictionary entry affected by the operation.
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | NewValue | Gets the value of the dictionary entry after the operation.
Public property | OldValue | Gets the value of the dictionary entry before the operation.
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Inherited from Operation.)
Top
Methods
 | Name | Description
Protected method | GetMergeStatus | Determines how a given Operation can be merged with the current Operation. (Inherited from Operation.)
Protected method | Merge | Merges a given Operation into the current Operation. (Inherited from Operation.)
Protected method | Redo | Redo the current operation. (Inherited from Operation.)
Protected method | Undo | Undo the current operation. (Inherited from Operation.)
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Overrides OperationVisitAffectedObjects(ActionObject).)
Top
See Also

Reference

PostSharp.Patterns.Recording.Operations Namespace

Other Resources

Conceptual: Understanding the Recordable Aspect


DictionaryOperation(TKey, TValue) Properties

DictionaryOperationTKey, TValue Properties

The DictionaryOperationTKey, TValue generic type exposes the following members.

Properties
 | Name | Description
Public property | Dictionary | Gets the collection on which the operation was performed.
Public property | Key | Gets the key of the dictionary entry affected by the operation.
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | NewValue | Gets the value of the dictionary entry after the operation.
Public property | OldValue | Gets the value of the dictionary entry before the operation.
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Inherited from Operation.)
Top
See Also

Reference

DictionaryOperationTKey, TValue Class
PostSharp.Patterns.Recording.Operations Namespace


DictionaryOperation(TKey, TValue).Dictionary Property

DictionaryOperationTKey, TValueDictionary Property

Gets the collection on which the operation was performed.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AdvisableDictionary<TKey, TValue> Dictionary { get; }

Property Value

Type: AdvisableDictionary TKey, TValue
See Also

Reference

DictionaryOperationTKey, TValue Class
PostSharp.Patterns.Recording.Operations Namespace


DictionaryOperation(TKey, TValue).Key Property

DictionaryOperationTKey, TValueKey Property

Gets the key of the dictionary entry affected by the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual TKey Key { get; }

Property Value

Type: TKey
See Also

Reference

DictionaryOperationTKey, TValue Class
PostSharp.Patterns.Recording.Operations Namespace


DictionaryOperation(TKey, TValue).NewValue Property

DictionaryOperationTKey, TValueNewValue Property

Gets the value of the dictionary entry after the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual TValue NewValue { get; }

Property Value

Type: TValue
See Also

Reference

DictionaryOperationTKey, TValue Class
PostSharp.Patterns.Recording.Operations Namespace


DictionaryOperation(TKey, TValue).OldValue Property

DictionaryOperationTKey, TValueOldValue Property

Gets the value of the dictionary entry before the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual TValue OldValue { get; }

Property Value

Type: TValue
See Also

Reference

DictionaryOperationTKey, TValue Class
PostSharp.Patterns.Recording.Operations Namespace


DictionaryOperation(TKey, TValue) Methods

DictionaryOperationTKey, TValue Methods

The DictionaryOperationTKey, TValue generic type exposes the following members.

Methods
 | Name | Description
Protected method | GetMergeStatus | Determines how a given Operation can be merged with the current Operation. (Inherited from Operation.)
Protected method | Merge | Merges a given Operation into the current Operation. (Inherited from Operation.)
Protected method | Redo | Redo the current operation. (Inherited from Operation.)
Protected method | Undo | Undo the current operation. (Inherited from Operation.)
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Overrides OperationVisitAffectedObjects(ActionObject).)
Top
See Also

Reference

DictionaryOperationTKey, TValue Class
PostSharp.Patterns.Recording.Operations Namespace


DictionaryOperation(TKey, TValue).VisitAffectedObjects Method

DictionaryOperationTKey, TValueVisitAffectedObjects Method

Executes a given action on all recordable objects involved with the current Operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void VisitAffectedObjects(
    Action<Object> action
)

Parameters

action
Type: SystemAction Object
See Also

Reference

DictionaryOperationTKey, TValue Class
PostSharp.Patterns.Recording.Operations Namespace


FieldOperation(T) Class

FieldOperationT Class

Encapsulates a modification of a field value.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.RecordingOperation
PostSharp.Patterns.Recording.OperationsFieldOperationT

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class FieldOperation<T> : Operation,
    IFieldOperation

Type Parameters

T

The FieldOperationT type exposes the following members.

Properties
 | Name | Description
Public property | Location | Gets the LocationInfo of the modified field.
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Public property | Target | Gets the this instance.
Top
Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Overrides OperationVisitAffectedObjects(ActionObject).)
Top
See Also

Reference

PostSharp.Patterns.Recording.Operations Namespace

Other Resources

Conceptual: Understanding the Recordable Aspect


FieldOperation(T) Properties

FieldOperationT Properties

The FieldOperationT generic type exposes the following members.

Properties
 | Name | Description
Public property | Location | Gets the LocationInfo of the modified field.
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Public property | Target | Gets the this instance.
Top
See Also

Reference

FieldOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


FieldOperation(T).Location Property

FieldOperationTLocation Property

Gets the LocationInfo of the modified field.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LocationInfo Location { get; }

Property Value

Type: LocationInfo

Implements

IFieldOperationLocation
See Also

Reference

FieldOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


FieldOperation(T).OperationKind Property

FieldOperationTOperationKind Property

Gets the kind of operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override OperationKind OperationKind { get; }

Property Value

Type: OperationKind

Implements

IOperationDescriptorOperationKind
See Also

Reference

FieldOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


FieldOperation(T).Target Property

FieldOperationTTarget Property

Gets the this instance.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Object Target { get; }

Property Value

Type: Object

Implements

IFieldOperationTarget
See Also

Reference

FieldOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


FieldOperation(T) Methods

FieldOperationT Methods

The FieldOperationT generic type exposes the following members.

Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Overrides OperationVisitAffectedObjects(ActionObject).)
Top
See Also

Reference

FieldOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


FieldOperation(T).VisitAffectedObjects Method

FieldOperationTVisitAffectedObjects Method

Executes a given action on all recordable objects involved with the current Operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void VisitAffectedObjects(
    Action<Object> action
)

Parameters

action
Type: SystemAction Object
See Also

Reference

FieldOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


HashSetOperation(T) Class

HashSetOperationT Class

Base class for operations on an AdvisableHashSetT.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.RecordingOperation
PostSharp.Patterns.Recording.OperationsHashSetOperationT
PostSharp.Patterns.Recording.OperationsAddSetItemOperationT
PostSharp.Patterns.Recording.OperationsChangeManySetOperationT
PostSharp.Patterns.Recording.OperationsClearSetOperationT
PostSharp.Patterns.Recording.OperationsRemoveSetItemOperationT

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class HashSetOperation<T> : Operation,
    IHashSetOperation, IOperationDescriptor

Type Parameters

T
Type of items in set.

The HashSetOperationT type exposes the following members.

Properties
 | Name | Description
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | NewItem | Gets the item before the operation.
Public property | OldItem | Gets the item after the operation.
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Inherited from Operation.)
Public property | Set | Gets the set on which the operation was performed.
Top
Methods
 | Name | Description
Protected method | GetMergeStatus | Determines how a given Operation can be merged with the current Operation. (Inherited from Operation.)
Protected method | Merge | Merges a given Operation into the current Operation. (Inherited from Operation.)
Protected method | Redo | Redo the current operation. (Inherited from Operation.)
Protected method | Undo | Undo the current operation. (Inherited from Operation.)
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Overrides OperationVisitAffectedObjects(ActionObject).)
Top
See Also

Reference

PostSharp.Patterns.Recording.Operations Namespace


HashSetOperation(T) Properties

HashSetOperationT Properties

The HashSetOperationT generic type exposes the following members.

Properties
 | Name | Description
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | NewItem | Gets the item before the operation.
Public property | OldItem | Gets the item after the operation.
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Inherited from Operation.)
Public property | Set | Gets the set on which the operation was performed.
Top
See Also

Reference

HashSetOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


HashSetOperation(T).NewItem Property

HashSetOperationTNewItem Property

Gets the item before the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual T NewItem { get; }

Property Value

Type: T
See Also

Reference

HashSetOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


HashSetOperation(T).OldItem Property

HashSetOperationTOldItem Property

Gets the item after the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual T OldItem { get; }

Property Value

Type: T
See Also

Reference

HashSetOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


HashSetOperation(T).Set Property

HashSetOperationTSet Property

Gets the set on which the operation was performed.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AdvisableHashSet<T> Set { get; }

Property Value

Type: AdvisableHashSet T
See Also

Reference

HashSetOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


HashSetOperation(T) Methods

HashSetOperationT Methods

The HashSetOperationT generic type exposes the following members.

Methods
 | Name | Description
Protected method | GetMergeStatus | Determines how a given Operation can be merged with the current Operation. (Inherited from Operation.)
Protected method | Merge | Merges a given Operation into the current Operation. (Inherited from Operation.)
Protected method | Redo | Redo the current operation. (Inherited from Operation.)
Protected method | Undo | Undo the current operation. (Inherited from Operation.)
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Overrides OperationVisitAffectedObjects(ActionObject).)
Top
See Also

Reference

HashSetOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


HashSetOperation(T).VisitAffectedObjects Method

HashSetOperationTVisitAffectedObjects Method

Executes a given action on all recordable objects involved with the current Operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void VisitAffectedObjects(
    Action<Object> action
)

Parameters

action
Type: SystemAction Object
See Also

Reference

HashSetOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


ICollectionOperation Interface

Weakly-typed interface for the CollectionOperationT class.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ICollectionOperation : IOperationDescriptor

The ICollectionOperation type exposes the following members.

Properties
 | Name | Description
Public property | Collection | Gets the collection on which the operation was performed.
Public property | NewIndex | Gets the index after the operation.
Public property | NewItem | Gets the item after the operation.
Public property | OldIndex | Gets the index before the operation.
Public property | OldItem | Gets the item before the operation.
Public property | OperationKind | Gets the kind of operation. (Inherited from IOperationDescriptor.)
Top
See Also

Reference

PostSharp.Patterns.Recording.Operations Namespace


ICollectionOperation Properties

The ICollectionOperation type exposes the following members.

Properties
 | Name | Description
Public property | Collection | Gets the collection on which the operation was performed.
Public property | NewIndex | Gets the index after the operation.
Public property | NewItem | Gets the item after the operation.
Public property | OldIndex | Gets the index before the operation.
Public property | OldItem | Gets the item before the operation.
Public property | OperationKind | Gets the kind of operation. (Inherited from IOperationDescriptor.)
Top
See Also

Reference

ICollectionOperation Interface
PostSharp.Patterns.Recording.Operations Namespace


ICollectionOperation.Collection Property

ICollectionOperationCollection Property

Gets the collection on which the operation was performed.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
ICollection Collection { get; }

Property Value

Type: ICollection
See Also

Reference

ICollectionOperation Interface
PostSharp.Patterns.Recording.Operations Namespace


ICollectionOperation.NewIndex Property

ICollectionOperationNewIndex Property

Gets the index after the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
int NewIndex { get; }

Property Value

Type: Int32
See Also

Reference

ICollectionOperation Interface
PostSharp.Patterns.Recording.Operations Namespace


ICollectionOperation.NewItem Property

ICollectionOperationNewItem Property

Gets the item after the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Object NewItem { get; }

Property Value

Type: Object
See Also

Reference

ICollectionOperation Interface
PostSharp.Patterns.Recording.Operations Namespace


ICollectionOperation.OldIndex Property

ICollectionOperationOldIndex Property

Gets the index before the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
int OldIndex { get; }

Property Value

Type: Int32
See Also

Reference

ICollectionOperation Interface
PostSharp.Patterns.Recording.Operations Namespace


ICollectionOperation.OldItem Property

ICollectionOperationOldItem Property

Gets the item before the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Object OldItem { get; }

Property Value

Type: Object
See Also

Reference

ICollectionOperation Interface
PostSharp.Patterns.Recording.Operations Namespace


IDictionaryOperation Interface

Weakly-typed interface for the DictionaryOperationTKey, TValue class.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IDictionaryOperation : IOperationDescriptor

The IDictionaryOperation type exposes the following members.

Properties
 | Name | Description
Public property | Dictionary | Gets the collection on which the operation was performed.
Public property | Key | Gets the key of the dictionary entry affected by the operation.
Public property | NewValue | Gets the value of the dictionary entry after the operation.
Public property | OldValue | Gets the value of the dictionary entry before the operation.
Public property | OperationKind | Gets the kind of operation. (Inherited from IOperationDescriptor.)
Top
See Also

Reference

PostSharp.Patterns.Recording.Operations Namespace


IDictionaryOperation Properties

The IDictionaryOperation type exposes the following members.

Properties
 | Name | Description
Public property | Dictionary | Gets the collection on which the operation was performed.
Public property | Key | Gets the key of the dictionary entry affected by the operation.
Public property | NewValue | Gets the value of the dictionary entry after the operation.
Public property | OldValue | Gets the value of the dictionary entry before the operation.
Public property | OperationKind | Gets the kind of operation. (Inherited from IOperationDescriptor.)
Top
See Also

Reference

IDictionaryOperation Interface
PostSharp.Patterns.Recording.Operations Namespace


IDictionaryOperation.Dictionary Property

IDictionaryOperationDictionary Property

Gets the collection on which the operation was performed.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IDictionary Dictionary { get; }

Property Value

Type: IDictionary
See Also

Reference

IDictionaryOperation Interface
PostSharp.Patterns.Recording.Operations Namespace


IDictionaryOperation.Key Property

IDictionaryOperationKey Property

Gets the key of the dictionary entry affected by the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Object Key { get; }

Property Value

Type: Object
See Also

Reference

IDictionaryOperation Interface
PostSharp.Patterns.Recording.Operations Namespace


IDictionaryOperation.NewValue Property

IDictionaryOperationNewValue Property

Gets the value of the dictionary entry after the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Object NewValue { get; }

Property Value

Type: Object
See Also

Reference

IDictionaryOperation Interface
PostSharp.Patterns.Recording.Operations Namespace


IDictionaryOperation.OldValue Property

IDictionaryOperationOldValue Property

Gets the value of the dictionary entry before the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Object OldValue { get; }

Property Value

Type: Object
See Also

Reference

IDictionaryOperation Interface
PostSharp.Patterns.Recording.Operations Namespace


IFieldOperation Interface

Weakly-typed interface for FieldOperationT.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IFieldOperation

The IFieldOperation type exposes the following members.

Properties
 | Name | Description
Public property | Location | Gets the LocationInfo of the modified field.
Public property | NewValue | Gets the value of the field after the operation.
Public property | OldValue | Gets the value of the field before the operation.
Public property | Target | Gets the this instance.
Top
See Also

Reference

PostSharp.Patterns.Recording.Operations Namespace


IFieldOperation Properties

The IFieldOperation type exposes the following members.

Properties
 | Name | Description
Public property | Location | Gets the LocationInfo of the modified field.
Public property | NewValue | Gets the value of the field after the operation.
Public property | OldValue | Gets the value of the field before the operation.
Public property | Target | Gets the this instance.
Top
See Also

Reference

IFieldOperation Interface
PostSharp.Patterns.Recording.Operations Namespace


IFieldOperation.Location Property

IFieldOperationLocation Property

Gets the LocationInfo of the modified field.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
LocationInfo Location { get; }

Property Value

Type: LocationInfo
See Also

Reference

IFieldOperation Interface
PostSharp.Patterns.Recording.Operations Namespace


IFieldOperation.NewValue Property

IFieldOperationNewValue Property

Gets the value of the field after the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Object NewValue { get; }

Property Value

Type: Object
See Also

Reference

IFieldOperation Interface
PostSharp.Patterns.Recording.Operations Namespace


IFieldOperation.OldValue Property

IFieldOperationOldValue Property

Gets the value of the field before the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Object OldValue { get; }

Property Value

Type: Object
See Also

Reference

IFieldOperation Interface
PostSharp.Patterns.Recording.Operations Namespace


IFieldOperation.Target Property

IFieldOperationTarget Property

Gets the this instance.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Object Target { get; }

Property Value

Type: Object
See Also

Reference

IFieldOperation Interface
PostSharp.Patterns.Recording.Operations Namespace


IHashSetOperation Interface

Weakly-typed interface for the HashSetOperationT class.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IHashSetOperation : IOperationDescriptor

The IHashSetOperation type exposes the following members.

Properties
 | Name | Description
Public property | HashSet | Gets the collection on which the operation was performed.
Public property | NewItem | Gets the item after the operation.
Public property | OldItem | Gets the item before the operation.
Public property | OperationKind | Gets the kind of operation. (Inherited from IOperationDescriptor.)
Top
See Also

Reference

PostSharp.Patterns.Recording.Operations Namespace


IHashSetOperation Properties

The IHashSetOperation type exposes the following members.

Properties
 | Name | Description
Public property | HashSet | Gets the collection on which the operation was performed.
Public property | NewItem | Gets the item after the operation.
Public property | OldItem | Gets the item before the operation.
Public property | OperationKind | Gets the kind of operation. (Inherited from IOperationDescriptor.)
Top
See Also

Reference

IHashSetOperation Interface
PostSharp.Patterns.Recording.Operations Namespace


IHashSetOperation.HashSet Property

IHashSetOperationHashSet Property

Gets the collection on which the operation was performed.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
ICollection HashSet { get; }

Property Value

Type: ICollection
See Also

Reference

IHashSetOperation Interface
PostSharp.Patterns.Recording.Operations Namespace


IHashSetOperation.NewItem Property

IHashSetOperationNewItem Property

Gets the item after the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Object NewItem { get; }

Property Value

Type: Object
See Also

Reference

IHashSetOperation Interface
PostSharp.Patterns.Recording.Operations Namespace


IHashSetOperation.OldItem Property

IHashSetOperationOldItem Property

Gets the item before the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Object OldItem { get; }

Property Value

Type: Object
See Also

Reference

IHashSetOperation Interface
PostSharp.Patterns.Recording.Operations Namespace


IOperationDescriptor Interface

Encapsulates information that allow implementations of the OperationFormatter class to provide a human-readable description of an Operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IOperationDescriptor

The IOperationDescriptor type exposes the following members.

Properties
 | Name | Description
Public property | OperationKind | Gets the kind of operation.
Top
Remarks

If you implement your own OperationFormatter, you can also implement your own IOperationDescriptor and assign it to the OperationDescriptor property of the RecordingScope returned by OpenScope(RecordingScopeOption).

See Also

Reference

PostSharp.Patterns.Recording.Operations Namespace


IOperationDescriptor Properties

The IOperationDescriptor type exposes the following members.

Properties
 | Name | Description
Public property | OperationKind | Gets the kind of operation.
Top
See Also

Reference

IOperationDescriptor Interface
PostSharp.Patterns.Recording.Operations Namespace


IOperationDescriptor.OperationKind Property

IOperationDescriptorOperationKind Property

Gets the kind of operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
OperationKind OperationKind { get; }

Property Value

Type: OperationKind
See Also

Reference

IOperationDescriptor Interface
PostSharp.Patterns.Recording.Operations Namespace


MethodExecutionOperationDescriptor Class

Represents a call to a method in user code.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Recording.OperationsMethodExecutionOperationDescriptor

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class MethodExecutionOperationDescriptor : IOperationDescriptor

The MethodExecutionOperationDescriptor type exposes the following members.

Properties
 | Name | Description
Public property | Arguments | Gets the method arguments.
Public property | Method | Gets the executed method.
Public property | MethodName | Gets the name of the method. This property is set even if the Method property is null.
Public property | OperationKind | Gets the kind of operation.
Public property | Target | Gets the this instance.
Top
See Also

Reference

PostSharp.Patterns.Recording.Operations Namespace


MethodExecutionOperationDescriptor Properties

The MethodExecutionOperationDescriptor type exposes the following members.

Properties
 | Name | Description
Public property | Arguments | Gets the method arguments.
Public property | Method | Gets the executed method.
Public property | MethodName | Gets the name of the method. This property is set even if the Method property is null.
Public property | OperationKind | Gets the kind of operation.
Public property | Target | Gets the this instance.
Top
See Also

Reference

MethodExecutionOperationDescriptor Class
PostSharp.Patterns.Recording.Operations Namespace


MethodExecutionOperationDescriptor.Arguments Property

MethodExecutionOperationDescriptorArguments Property

Gets the method arguments.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IList<Object> Arguments { get; }

Property Value

Type: IList Object
Remarks

This property is null unless the ProvideMethodContext property is set to true for the target class.

See Also

Reference

MethodExecutionOperationDescriptor Class
PostSharp.Patterns.Recording.Operations Namespace


MethodExecutionOperationDescriptor.Method Property

MethodExecutionOperationDescriptorMethod Property

Gets the executed method.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MethodInfo Method { get; }

Property Value

Type: MethodInfo
Remarks

This property is null unless the ProvideMethodContext property is set to true for the target class.

See Also

Reference

MethodExecutionOperationDescriptor Class
PostSharp.Patterns.Recording.Operations Namespace


MethodExecutionOperationDescriptor.MethodName Property

MethodExecutionOperationDescriptorMethodName Property

Gets the name of the method. This property is set even if the Method property is null.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string MethodName { get; }

Property Value

Type: String
See Also

Reference

MethodExecutionOperationDescriptor Class
PostSharp.Patterns.Recording.Operations Namespace


MethodExecutionOperationDescriptor.OperationKind Property

MethodExecutionOperationDescriptorOperationKind Property

Gets the kind of operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public OperationKind OperationKind { get; }

Property Value

Type: OperationKind

Implements

IOperationDescriptorOperationKind
See Also

Reference

MethodExecutionOperationDescriptor Class
PostSharp.Patterns.Recording.Operations Namespace


MethodExecutionOperationDescriptor.Target Property

MethodExecutionOperationDescriptorTarget Property

Gets the this instance.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Object Target { get; }

Property Value

Type: Object
See Also

Reference

MethodExecutionOperationDescriptor Class
PostSharp.Patterns.Recording.Operations Namespace


MoveCollectionItemOperation(T) Class

MoveCollectionItemOperationT Class

Represents a Move(Int32, Int32) operation.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.RecordingOperation
PostSharp.Patterns.Recording.OperationsCollectionOperation T
PostSharp.Patterns.Recording.OperationsMoveCollectionItemOperationT

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class MoveCollectionItemOperation<T> : CollectionOperation<T>

Type Parameters

T
Type of collection items.

The MoveCollectionItemOperationT type exposes the following members.

Properties
 | Name | Description
Public property | Collection | Gets the collection on which the operation was performed. (Inherited from CollectionOperationT.)
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | NewIndex | Gets the index after the operation. (Overrides CollectionOperationTNewIndex.)
Public property | NewItem | Gets the item before the operation. (Inherited from CollectionOperationT.)
Public property | OldIndex | Gets the index before the operation. (Overrides CollectionOperationTOldIndex.)
Public property | OldItem | Gets the item after the operation. (Overrides CollectionOperationTOldItem.)
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Top
Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Inherited from CollectionOperationT.)
Top
See Also

Reference

PostSharp.Patterns.Recording.Operations Namespace


MoveCollectionItemOperation(T) Properties

MoveCollectionItemOperationT Properties

The MoveCollectionItemOperationT generic type exposes the following members.

Properties
 | Name | Description
Public property | Collection | Gets the collection on which the operation was performed. (Inherited from CollectionOperationT.)
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | NewIndex | Gets the index after the operation. (Overrides CollectionOperationTNewIndex.)
Public property | NewItem | Gets the item before the operation. (Inherited from CollectionOperationT.)
Public property | OldIndex | Gets the index before the operation. (Overrides CollectionOperationTOldIndex.)
Public property | OldItem | Gets the item after the operation. (Overrides CollectionOperationTOldItem.)
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Top
See Also

Reference

MoveCollectionItemOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


MoveCollectionItemOperation(T).NewIndex Property

MoveCollectionItemOperationTNewIndex Property

Gets the index after the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override int NewIndex { get; }

Property Value

Type: Int32

Implements

ICollectionOperationNewIndex
See Also

Reference

MoveCollectionItemOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


MoveCollectionItemOperation(T).OldIndex Property

MoveCollectionItemOperationTOldIndex Property

Gets the index before the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override int OldIndex { get; }

Property Value

Type: Int32

Implements

ICollectionOperationOldIndex
See Also

Reference

MoveCollectionItemOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


MoveCollectionItemOperation(T).OldItem Property

MoveCollectionItemOperationTOldItem Property

Gets the item after the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override T OldItem { get; }

Property Value

Type: T
See Also

Reference

MoveCollectionItemOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


MoveCollectionItemOperation(T).OperationKind Property

MoveCollectionItemOperationTOperationKind Property

Gets the kind of operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override OperationKind OperationKind { get; }

Property Value

Type: OperationKind

Implements

IOperationDescriptorOperationKind
See Also

Reference

MoveCollectionItemOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


MoveCollectionItemOperation(T) Methods

MoveCollectionItemOperationT Methods

The MoveCollectionItemOperationT generic type exposes the following members.

Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Inherited from CollectionOperationT.)
Top
See Also

Reference

MoveCollectionItemOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


NamedOperationDescriptor Class

Represents an operation whose named has been set declaratively or imperatively.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.Recording.OperationsNamedOperationDescriptor

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class NamedOperationDescriptor : IOperationDescriptor

The NamedOperationDescriptor type exposes the following members.

Constructors
 | Name | Description
Public method | NamedOperationDescriptor | Initializes a new NamedOperationDescriptor.
Top
Properties
 | Name | Description
Public property | Name | Gets the operation name.
Public property | OperationKind | Gets the kind of operation.
Top
See Also

Reference

PostSharp.Patterns.Recording.Operations Namespace


NamedOperationDescriptor Constructor

Initializes a new NamedOperationDescriptor.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public NamedOperationDescriptor(
    string name
)

Parameters

name
Type: SystemString
The operation name.
See Also

Reference

NamedOperationDescriptor Class
PostSharp.Patterns.Recording.Operations Namespace


NamedOperationDescriptor Properties

The NamedOperationDescriptor type exposes the following members.

Properties
 | Name | Description
Public property | Name | Gets the operation name.
Public property | OperationKind | Gets the kind of operation.
Top
See Also

Reference

NamedOperationDescriptor Class
PostSharp.Patterns.Recording.Operations Namespace


NamedOperationDescriptor.Name Property

NamedOperationDescriptorName Property

Gets the operation name.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string Name { get; }

Property Value

Type: String
See Also

Reference

NamedOperationDescriptor Class
PostSharp.Patterns.Recording.Operations Namespace


NamedOperationDescriptor.OperationKind Property

NamedOperationDescriptorOperationKind Property

Gets the kind of operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public OperationKind OperationKind { get; }

Property Value

Type: OperationKind

Implements

IOperationDescriptorOperationKind
See Also

Reference

NamedOperationDescriptor Class
PostSharp.Patterns.Recording.Operations Namespace


RecorderOperation Class

An Operation on a Recorder, specifically a base class for AttachObjectToRecorderOperation and DetachObjectFromRecorderOperation.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.RecordingOperation
PostSharp.Patterns.Recording.OperationsRecorderOperation
PostSharp.Patterns.Recording.OperationsAttachObjectToRecorderOperation
PostSharp.Patterns.Recording.OperationsDetachObjectFromRecorderOperation

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class RecorderOperation : Operation

The RecorderOperation type exposes the following members.

Properties
 | Name | Description
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Inherited from Operation.)
Public property | Recorder | Gets the Recorder to which the current Operation relates.
Top
Methods
 | Name | Description
Protected method | GetMergeStatus | Determines how a given Operation can be merged with the current Operation. (Inherited from Operation.)
Protected method | Merge | Merges a given Operation into the current Operation. (Inherited from Operation.)
Protected method | Redo | Redo the current operation. (Inherited from Operation.)
Protected method | Undo | Undo the current operation. (Inherited from Operation.)
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Overrides OperationVisitAffectedObjects(ActionObject).)
Top
See Also

Reference

PostSharp.Patterns.Recording.Operations Namespace

Other Resources

Conceptual: Understanding the Recordable Aspect


RecorderOperation Properties

The RecorderOperation type exposes the following members.

Properties
 | Name | Description
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Inherited from Operation.)
Public property | Recorder | Gets the Recorder to which the current Operation relates.
Top
See Also

Reference

RecorderOperation Class
PostSharp.Patterns.Recording.Operations Namespace


RecorderOperation.Recorder Property

RecorderOperationRecorder Property

Gets the Recorder to which the current Operation relates.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Recorder Recorder { get; }

Property Value

Type: Recorder
See Also

Reference

RecorderOperation Class
PostSharp.Patterns.Recording.Operations Namespace


RecorderOperation Methods

The RecorderOperation type exposes the following members.

Methods
 | Name | Description
Protected method | GetMergeStatus | Determines how a given Operation can be merged with the current Operation. (Inherited from Operation.)
Protected method | Merge | Merges a given Operation into the current Operation. (Inherited from Operation.)
Protected method | Redo | Redo the current operation. (Inherited from Operation.)
Protected method | Undo | Undo the current operation. (Inherited from Operation.)
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Overrides OperationVisitAffectedObjects(ActionObject).)
Top
See Also

Reference

RecorderOperation Class
PostSharp.Patterns.Recording.Operations Namespace


RecorderOperation.VisitAffectedObjects Method

RecorderOperationVisitAffectedObjects Method

Executes a given action on all recordable objects involved with the current Operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void VisitAffectedObjects(
    Action<Object> action
)

Parameters

action
Type: SystemAction Object
See Also

Reference

RecorderOperation Class
PostSharp.Patterns.Recording.Operations Namespace


RemoveCollectionItemOperation(T) Class

RemoveCollectionItemOperationT Class

Represents a Remove(T) operation.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.RecordingOperation
PostSharp.Patterns.Recording.OperationsCollectionOperation T
PostSharp.Patterns.Recording.OperationsRemoveCollectionItemOperationT

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class RemoveCollectionItemOperation<T> : CollectionOperation<T>

Type Parameters

T
Type of collection items.

The RemoveCollectionItemOperationT type exposes the following members.

Properties
 | Name | Description
Public property | Collection | Gets the collection on which the operation was performed. (Inherited from CollectionOperationT.)
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | NewIndex | Gets the index after the operation. (Inherited from CollectionOperationT.)
Public property | NewItem | Gets the item before the operation. (Inherited from CollectionOperationT.)
Public property | OldIndex | Gets the index before the operation. (Overrides CollectionOperationTOldIndex.)
Public property | OldItem | Gets the item after the operation. (Overrides CollectionOperationTOldItem.)
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Top
Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Inherited from CollectionOperationT.)
Top
See Also

Reference

PostSharp.Patterns.Recording.Operations Namespace


RemoveCollectionItemOperation(T) Properties

RemoveCollectionItemOperationT Properties

The RemoveCollectionItemOperationT generic type exposes the following members.

Properties
 | Name | Description
Public property | Collection | Gets the collection on which the operation was performed. (Inherited from CollectionOperationT.)
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | NewIndex | Gets the index after the operation. (Inherited from CollectionOperationT.)
Public property | NewItem | Gets the item before the operation. (Inherited from CollectionOperationT.)
Public property | OldIndex | Gets the index before the operation. (Overrides CollectionOperationTOldIndex.)
Public property | OldItem | Gets the item after the operation. (Overrides CollectionOperationTOldItem.)
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Top
See Also

Reference

RemoveCollectionItemOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


RemoveCollectionItemOperation(T).OldIndex Property

RemoveCollectionItemOperationTOldIndex Property

Gets the index before the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override int OldIndex { get; }

Property Value

Type: Int32

Implements

ICollectionOperationOldIndex
See Also

Reference

RemoveCollectionItemOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


RemoveCollectionItemOperation(T).OldItem Property

RemoveCollectionItemOperationTOldItem Property

Gets the item after the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override T OldItem { get; }

Property Value

Type: T
See Also

Reference

RemoveCollectionItemOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


RemoveCollectionItemOperation(T).OperationKind Property

RemoveCollectionItemOperationTOperationKind Property

Gets the kind of operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override OperationKind OperationKind { get; }

Property Value

Type: OperationKind

Implements

IOperationDescriptorOperationKind
See Also

Reference

RemoveCollectionItemOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


RemoveCollectionItemOperation(T) Methods

RemoveCollectionItemOperationT Methods

The RemoveCollectionItemOperationT generic type exposes the following members.

Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Inherited from CollectionOperationT.)
Top
See Also

Reference

RemoveCollectionItemOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


RemoveCollectionRangeOperation(T) Class

RemoveCollectionRangeOperationT Class

Represents a RemoveRange(Int32, Int32) operation.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.RecordingOperation
PostSharp.Patterns.Recording.OperationsCollectionOperation T
PostSharp.Patterns.Recording.OperationsRemoveCollectionRangeOperationT

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class RemoveCollectionRangeOperation<T> : CollectionOperation<T>

Type Parameters

T
Type of collection items.

The RemoveCollectionRangeOperationT type exposes the following members.

Properties
 | Name | Description
Public property | Collection | Gets the collection on which the operation was performed. (Inherited from CollectionOperationT.)
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | NewIndex | Gets the index after the operation. (Inherited from CollectionOperationT.)
Public property | NewItem | Gets the item before the operation. (Inherited from CollectionOperationT.)
Public property | OldIndex | Gets the index before the operation. (Overrides CollectionOperationTOldIndex.)
Public property | OldItem | Gets the item after the operation. (Inherited from CollectionOperationT.)
Public property | OldItems | Gets the items that were in the collection before the operation.
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Top
Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Inherited from CollectionOperationT.)
Top
See Also

Reference

PostSharp.Patterns.Recording.Operations Namespace


RemoveCollectionRangeOperation(T) Properties

RemoveCollectionRangeOperationT Properties

The RemoveCollectionRangeOperationT generic type exposes the following members.

Properties
 | Name | Description
Public property | Collection | Gets the collection on which the operation was performed. (Inherited from CollectionOperationT.)
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | NewIndex | Gets the index after the operation. (Inherited from CollectionOperationT.)
Public property | NewItem | Gets the item before the operation. (Inherited from CollectionOperationT.)
Public property | OldIndex | Gets the index before the operation. (Overrides CollectionOperationTOldIndex.)
Public property | OldItem | Gets the item after the operation. (Inherited from CollectionOperationT.)
Public property | OldItems | Gets the items that were in the collection before the operation.
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Top
See Also

Reference

RemoveCollectionRangeOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


RemoveCollectionRangeOperation(T).OldIndex Property

RemoveCollectionRangeOperationTOldIndex Property

Gets the index before the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override int OldIndex { get; }

Property Value

Type: Int32

Implements

ICollectionOperationOldIndex
See Also

Reference

RemoveCollectionRangeOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


RemoveCollectionRangeOperation(T).OldItems Property

RemoveCollectionRangeOperationTOldItems Property

Gets the items that were in the collection before the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ReadOnlyArray<T> OldItems { get; }

Property Value

Type: ReadOnlyArray T
See Also

Reference

RemoveCollectionRangeOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


RemoveCollectionRangeOperation(T).OperationKind Property

RemoveCollectionRangeOperationTOperationKind Property

Gets the kind of operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override OperationKind OperationKind { get; }

Property Value

Type: OperationKind

Implements

IOperationDescriptorOperationKind
See Also

Reference

RemoveCollectionRangeOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


RemoveCollectionRangeOperation(T) Methods

RemoveCollectionRangeOperationT Methods

The RemoveCollectionRangeOperationT generic type exposes the following members.

Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Inherited from CollectionOperationT.)
Top
See Also

Reference

RemoveCollectionRangeOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


RemoveDictionaryItemOperation(TKey, TValue) Class

RemoveDictionaryItemOperationTKey, TValue Class

Represents a Remove(TKey) operation.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.RecordingOperation
PostSharp.Patterns.Recording.OperationsDictionaryOperation TKey, TValue
PostSharp.Patterns.Recording.OperationsRemoveDictionaryItemOperationTKey, TValue

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class RemoveDictionaryItemOperation<TKey, TValue> : DictionaryOperation<TKey, TValue>

Type Parameters

TKey
Type of dictionary keys.
TValue
Type of dictionary values.

The RemoveDictionaryItemOperationTKey, TValue type exposes the following members.

Properties
 | Name | Description
Public property | Dictionary | Gets the collection on which the operation was performed. (Inherited from DictionaryOperationTKey, TValue.)
Public property | Key | Gets the key of the dictionary entry affected by the operation. (Overrides DictionaryOperationTKey, TValueKey.)
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | NewValue | Gets the value of the dictionary entry after the operation. (Inherited from DictionaryOperationTKey, TValue.)
Public property | OldValue | Gets the value of the dictionary entry before the operation. (Overrides DictionaryOperationTKey, TValueOldValue.)
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Top
Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Inherited from DictionaryOperationTKey, TValue.)
Top
See Also

Reference

PostSharp.Patterns.Recording.Operations Namespace


RemoveDictionaryItemOperation(TKey, TValue) Properties

RemoveDictionaryItemOperationTKey, TValue Properties

The RemoveDictionaryItemOperationTKey, TValue generic type exposes the following members.

Properties
 | Name | Description
Public property | Dictionary | Gets the collection on which the operation was performed. (Inherited from DictionaryOperationTKey, TValue.)
Public property | Key | Gets the key of the dictionary entry affected by the operation. (Overrides DictionaryOperationTKey, TValueKey.)
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | NewValue | Gets the value of the dictionary entry after the operation. (Inherited from DictionaryOperationTKey, TValue.)
Public property | OldValue | Gets the value of the dictionary entry before the operation. (Overrides DictionaryOperationTKey, TValueOldValue.)
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Top
See Also

Reference

RemoveDictionaryItemOperationTKey, TValue Class
PostSharp.Patterns.Recording.Operations Namespace


RemoveDictionaryItemOperation(TKey, TValue).Key Property

RemoveDictionaryItemOperationTKey, TValueKey Property

Gets the key of the dictionary entry affected by the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override TKey Key { get; }

Property Value

Type: TKey
See Also

Reference

RemoveDictionaryItemOperationTKey, TValue Class
PostSharp.Patterns.Recording.Operations Namespace


RemoveDictionaryItemOperation(TKey, TValue).OldValue Property

RemoveDictionaryItemOperationTKey, TValueOldValue Property

Gets the value of the dictionary entry before the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override TValue OldValue { get; }

Property Value

Type: TValue
See Also

Reference

RemoveDictionaryItemOperationTKey, TValue Class
PostSharp.Patterns.Recording.Operations Namespace


RemoveDictionaryItemOperation(TKey, TValue).OperationKind Property

RemoveDictionaryItemOperationTKey, TValueOperationKind Property

Gets the kind of operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override OperationKind OperationKind { get; }

Property Value

Type: OperationKind

Implements

IOperationDescriptorOperationKind
See Also

Reference

RemoveDictionaryItemOperationTKey, TValue Class
PostSharp.Patterns.Recording.Operations Namespace


RemoveDictionaryItemOperation(TKey, TValue) Methods

RemoveDictionaryItemOperationTKey, TValue Methods

The RemoveDictionaryItemOperationTKey, TValue generic type exposes the following members.

Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Inherited from DictionaryOperationTKey, TValue.)
Top
See Also

Reference

RemoveDictionaryItemOperationTKey, TValue Class
PostSharp.Patterns.Recording.Operations Namespace


RemoveSetItemOperation(T) Class

RemoveSetItemOperationT Class

Represents a Remove(T) operation.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.RecordingOperation
PostSharp.Patterns.Recording.OperationsHashSetOperation T
PostSharp.Patterns.Recording.OperationsRemoveSetItemOperationT

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class RemoveSetItemOperation<T> : HashSetOperation<T>

Type Parameters

T
Type of set items.

The RemoveSetItemOperationT type exposes the following members.

Properties
 | Name | Description
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | NewItem | Gets the item before the operation. (Inherited from HashSetOperationT.)
Public property | OldItem | Gets the item after the operation. (Overrides HashSetOperationTOldItem.)
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Public property | Set | Gets the set on which the operation was performed. (Inherited from HashSetOperationT.)
Top
Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Inherited from HashSetOperationT.)
Top
See Also

Reference

PostSharp.Patterns.Recording.Operations Namespace


RemoveSetItemOperation(T) Properties

RemoveSetItemOperationT Properties

The RemoveSetItemOperationT generic type exposes the following members.

Properties
 | Name | Description
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | NewItem | Gets the item before the operation. (Inherited from HashSetOperationT.)
Public property | OldItem | Gets the item after the operation. (Overrides HashSetOperationTOldItem.)
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Public property | Set | Gets the set on which the operation was performed. (Inherited from HashSetOperationT.)
Top
See Also

Reference

RemoveSetItemOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


RemoveSetItemOperation(T).OldItem Property

RemoveSetItemOperationTOldItem Property

Gets the item after the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override T OldItem { get; }

Property Value

Type: T
See Also

Reference

RemoveSetItemOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


RemoveSetItemOperation(T).OperationKind Property

RemoveSetItemOperationTOperationKind Property

Gets the kind of operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override OperationKind OperationKind { get; }

Property Value

Type: OperationKind

Implements

IOperationDescriptorOperationKind
See Also

Reference

RemoveSetItemOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


RemoveSetItemOperation(T) Methods

RemoveSetItemOperationT Methods

The RemoveSetItemOperationT generic type exposes the following members.

Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Inherited from HashSetOperationT.)
Top
See Also

Reference

RemoveSetItemOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


SetCollectionItemOperation(T) Class

SetCollectionItemOperationT Class

Represents the operation of setting an item in an AdvisableCollectionT .
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.RecordingOperation
PostSharp.Patterns.Recording.OperationsCollectionOperation T
PostSharp.Patterns.Recording.OperationsSetCollectionItemOperationT

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class SetCollectionItemOperation<T> : CollectionOperation<T>

Type Parameters

T
Type of collection items.

The SetCollectionItemOperationT type exposes the following members.

Properties
 | Name | Description
Public property | Collection | Gets the collection on which the operation was performed. (Inherited from CollectionOperationT.)
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | NewIndex | Gets the index after the operation. (Overrides CollectionOperationTNewIndex.)
Public property | NewItem | Gets the item before the operation. (Overrides CollectionOperationTNewItem.)
Public property | OldIndex | Gets the index before the operation. (Overrides CollectionOperationTOldIndex.)
Public property | OldItem | Gets the item after the operation. (Overrides CollectionOperationTOldItem.)
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Top
Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Inherited from CollectionOperationT.)
Top
See Also

Reference

PostSharp.Patterns.Recording.Operations Namespace


SetCollectionItemOperation(T) Properties

SetCollectionItemOperationT Properties

The SetCollectionItemOperationT generic type exposes the following members.

Properties
 | Name | Description
Public property | Collection | Gets the collection on which the operation was performed. (Inherited from CollectionOperationT.)
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | NewIndex | Gets the index after the operation. (Overrides CollectionOperationTNewIndex.)
Public property | NewItem | Gets the item before the operation. (Overrides CollectionOperationTNewItem.)
Public property | OldIndex | Gets the index before the operation. (Overrides CollectionOperationTOldIndex.)
Public property | OldItem | Gets the item after the operation. (Overrides CollectionOperationTOldItem.)
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Top
See Also

Reference

SetCollectionItemOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


SetCollectionItemOperation(T).NewIndex Property

SetCollectionItemOperationTNewIndex Property

Gets the index after the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override int NewIndex { get; }

Property Value

Type: Int32

Implements

ICollectionOperationNewIndex
See Also

Reference

SetCollectionItemOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


SetCollectionItemOperation(T).NewItem Property

SetCollectionItemOperationTNewItem Property

Gets the item before the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override T NewItem { get; }

Property Value

Type: T
See Also

Reference

SetCollectionItemOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


SetCollectionItemOperation(T).OldIndex Property

SetCollectionItemOperationTOldIndex Property

Gets the index before the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override int OldIndex { get; }

Property Value

Type: Int32

Implements

ICollectionOperationOldIndex
See Also

Reference

SetCollectionItemOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


SetCollectionItemOperation(T).OldItem Property

SetCollectionItemOperationTOldItem Property

Gets the item after the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override T OldItem { get; }

Property Value

Type: T
See Also

Reference

SetCollectionItemOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


SetCollectionItemOperation(T).OperationKind Property

SetCollectionItemOperationTOperationKind Property

Gets the kind of operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override OperationKind OperationKind { get; }

Property Value

Type: OperationKind

Implements

IOperationDescriptorOperationKind
See Also

Reference

SetCollectionItemOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


SetCollectionItemOperation(T) Methods

SetCollectionItemOperationT Methods

The SetCollectionItemOperationT generic type exposes the following members.

Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Inherited from CollectionOperationT.)
Top
See Also

Reference

SetCollectionItemOperationT Class
PostSharp.Patterns.Recording.Operations Namespace


SetDictionaryItemOperation(TKey, TValue) Class

SetDictionaryItemOperationTKey, TValue Class

Represents the operation of setting a value in an AdvisableDictionaryTKey, TValue.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.RecordingOperation
PostSharp.Patterns.Recording.OperationsDictionaryOperation TKey, TValue
PostSharp.Patterns.Recording.OperationsSetDictionaryItemOperationTKey, TValue

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class SetDictionaryItemOperation<TKey, TValue> : DictionaryOperation<TKey, TValue>

Type Parameters

TKey
Type of dictionary keys.
TValue
Type of dictionary values.

The SetDictionaryItemOperationTKey, TValue type exposes the following members.

Properties
 | Name | Description
Public property | Dictionary | Gets the collection on which the operation was performed. (Inherited from DictionaryOperationTKey, TValue.)
Public property | Key | Gets the key of the dictionary entry affected by the operation. (Overrides DictionaryOperationTKey, TValueKey.)
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | NewValue | Gets the value of the dictionary entry after the operation. (Overrides DictionaryOperationTKey, TValueNewValue.)
Public property | OldValue | Gets the value of the dictionary entry before the operation. (Overrides DictionaryOperationTKey, TValueOldValue.)
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Top
Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Inherited from DictionaryOperationTKey, TValue.)
Top
See Also

Reference

PostSharp.Patterns.Recording.Operations Namespace


SetDictionaryItemOperation(TKey, TValue) Properties

SetDictionaryItemOperationTKey, TValue Properties

The SetDictionaryItemOperationTKey, TValue generic type exposes the following members.

Properties
 | Name | Description
Public property | Dictionary | Gets the collection on which the operation was performed. (Inherited from DictionaryOperationTKey, TValue.)
Public property | Key | Gets the key of the dictionary entry affected by the operation. (Overrides DictionaryOperationTKey, TValueKey.)
Public property | Name | Gets the operation name. (Inherited from Operation.)
Public property | NewValue | Gets the value of the dictionary entry after the operation. (Overrides DictionaryOperationTKey, TValueNewValue.)
Public property | OldValue | Gets the value of the dictionary entry before the operation. (Overrides DictionaryOperationTKey, TValueOldValue.)
Public property | OperationDescriptor | Gets the IOperationDescriptor, which is used by the OperationFormatter to produce a human-readable description of the current operation. (Inherited from Operation.)
Public property | OperationKind | Gets the kind of operation. (Overrides OperationOperationKind.)
Top
See Also

Reference

SetDictionaryItemOperationTKey, TValue Class
PostSharp.Patterns.Recording.Operations Namespace


SetDictionaryItemOperation(TKey, TValue).Key Property

SetDictionaryItemOperationTKey, TValueKey Property

Gets the key of the dictionary entry affected by the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override TKey Key { get; }

Property Value

Type: TKey
See Also

Reference

SetDictionaryItemOperationTKey, TValue Class
PostSharp.Patterns.Recording.Operations Namespace


SetDictionaryItemOperation(TKey, TValue).NewValue Property

SetDictionaryItemOperationTKey, TValueNewValue Property

Gets the value of the dictionary entry after the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override TValue NewValue { get; }

Property Value

Type: TValue
See Also

Reference

SetDictionaryItemOperationTKey, TValue Class
PostSharp.Patterns.Recording.Operations Namespace


SetDictionaryItemOperation(TKey, TValue).OldValue Property

SetDictionaryItemOperationTKey, TValueOldValue Property

Gets the value of the dictionary entry before the operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override TValue OldValue { get; }

Property Value

Type: TValue
See Also

Reference

SetDictionaryItemOperationTKey, TValue Class
PostSharp.Patterns.Recording.Operations Namespace


SetDictionaryItemOperation(TKey, TValue).OperationKind Property

SetDictionaryItemOperationTKey, TValueOperationKind Property

Gets the kind of operation.

Namespace: PostSharp.Patterns.Recording.Operations
Assembly: PostSharp.Patterns.Model (in PostSharp.Patterns.Model.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override OperationKind OperationKind { get; }

Property Value

Type: OperationKind

Implements

IOperationDescriptorOperationKind
See Also

Reference

SetDictionaryItemOperationTKey, TValue Class
PostSharp.Patterns.Recording.Operations Namespace


SetDictionaryItemOperation(TKey, TValue) Methods

SetDictionaryItemOperationTKey, TValue Methods

The SetDictionaryItemOperationTKey, TValue generic type exposes the following members.

Methods
 | Name | Description
Public method | VisitAffectedObjects | Executes a given action on all recordable objects involved with the current Operation. (Inherited from DictionaryOperationTKey, TValue.)
Top
See Also

Reference

SetDictionaryItemOperationTKey, TValue Class
PostSharp.Patterns.Recording.Operations Namespace


PostSharp.Patterns.Threading Namespace

The PostSharp.Patterns.Threading namespace contains an implementation of several threading models, and other thread dispatching aspects.
Classes
 | Class | Description
Public class | AccessLevelAttribute | Base class for ReaderAttribute, WriterAttribute, YielderAttribute UpgradeableReaderAttribute.
Public class | ActorAttribute | Custom attribute that, when applied to a class, implements the ActorThreadingModel to this class, in which calls to methods are processed asynchronously from a single thread, suppressing concurrency inside each instance of the target class.
Public class | ActorDispatcher | A dispatcher compatible with the ActorThreadingModel threading model, with a message queue based on a ConcurrentQueue The queue itself is processed from the ThreadPool.
Public class | AssumeImmutableAttribute | Custom attribute that, when applied to a targetType, means that targetType should be assumed to be immutable. The custom attribute can be applied to a type on assembly level by specifying the Type property using the AssumeImmutableAttribute(Type) constructor.
Public class | BackgroundAttribute | Custom attribute that, when applied on a method, causes the method to execute in the background. This aspect can be applied to a method with void or Task return type.
Public class | ConcurrencyControllerFactory | Provides methods to create new instances of concurrency controllers.
Public class | ConcurrentAccessException | Exception thrown when two threads simultaneously attempt to access a method annotated with the ThreadUnsafeAttribute custom attribute.
Public class | DeadlockDetectedEventArgs | Arguments for the DeadlockDetected event.
Public class | DeadlockDetectionPolicy | Detects deadlocks occurring because of circular wait conditions.
Public class | DeadlockedThreadInfo | Described state of thread that was detected to be in a deadlock.
Public class | DeadlockException | Exception thrown by the DeadlockDetectionPolicy class when a deadlock is detected.
Public class | DeadlockInfo | Describes the detected deadlock.
Public class | DispatchedAttribute | Custom attribute that, when applied on a method, specifies that the method should be executed in UI thread.
Public class | DispatcherFactory | Provides implementations of the IDispatcher interface.
Public class | EntryPointAttribute | Custom attribute that, when applied to a private or protected instance method, causes all threading model aspects (derived from ThreadAwareAttribute to introduce runtime generation code.
Public class | ExplicitlySynchronizedAttribute | Custom attribute that, when applied to a method or field, specifies that threading model aspects (derived from ThreadAwareAttribute) should ignore all verifications for this field or method.
Public class | FreezableAttribute | Custom attribute that, when applied to a class, implements the FreezableThreadingModel to this class. The aspect introduces the IFreezable interface into the target class. After the Freeze method has been invoked, the object can no longer be modified, and can therefore be safely shared between several threads.
Public class | ImmutableAttribute | Custom attribute that, when applied to a class, implements the ImmutableThreadingModel to this class. The aspect introduces the IImmutable interface into the target class. Immutable objects cannot be modified after the constructor exits.
Public class | ObjectReadOnlyException | Exception thrown by objects that have the FreezableThreadingModel or ImmutableThreadingModel when an attempt is made to modify the object after it has been made read-only.
Public class | PrivateThreadAwareAttribute | Custom attribute that, when applied to a class, implement the PrivateThreadingModel into this class, in which the threading model of an object is determined by the parent it is assigned to in a parent-child relationship.
Public class | ReaderAttribute | Custom attribute that, when applied on a method, specifies that the method requires read access to the object.
Public class | ReaderWriterSynchronizedAttribute | Custom attribute that, when applied on a class, applies the ReaderWriterSynchronizedThreadingModel model to this class and all derived class. Members of this class must then be annotated with attributes specifying the required access level (ReaderAttribute, WriterAttribute, YielderAttribute or UpgradeableReaderAttribute), otherwise build-time and run-time errors are emitted.
Public class | ReadOnlyThreadAwareAttribute | Base class for aspects FreezableAttribute and ImmutableAttribute.
Public class | ReentrantAttribute | Custom attribute that means that the async method to which it is applied can be safely re-entered on each await statement. In case of lock-based models, it means that the lock is released while awaiting. For the actor model, it means that other methods can be invoked during awaiting.
Public class | RequiresThreadSafeAttribute | Custom attribute that, when applied to a field, property or parameter, checks that the assigned object is thread safe. Otherwise, the assignment results in an ArgumentException/
Public class | SynchronizedAttribute | Custom attribute that, when applied to a class, implements the SynchronizedThreadingModel into this class. In a synchronized object, only a single thread can access the object at a time. If a second thread needs to access the object while it is in used by a first thread, the second thread has to wait until the first thread completes its access.
Public class | ThreadAccessException | Exception thrown when the calling thread does not have access to the object.
Public class | ThreadAffineAttribute | Custom attribute that, when applied on a type, ensures the instances of this type can only be accessed by the thread that created the instance. When a different thread accesses instances of this type, a ThreadMismatchException exception is thrown.
Public class | ThreadAwareAttribute | Base class for all aspects implementing threading models.
Public class | ThreadAwareExtensions | Provides extension methods to the IThreadAware interface.
Public class | ThreadingException | Base class for exceptions thrown by the PostSharp.Patterns.Threading component.
Public class | ThreadingModel | Base class for all threading models. Defines properties that describe the characteristics of threading models. All classes derived from ThreadingModel are necessarily singletons.
Public class | ThreadingPatternsAspectRoles | Enumerates the aspect roles (for use with AspectRoleDependencyAttribute) used by the PostSharp.Patterns.Threading component.
Public class | ThreadingServices | Exposes methods to work with the PostSharp.Patterns.Threading namespace.
Public class | ThreadingUnhandledExceptionEventArgs | Arguments of the UnhandledException event.
Public class | ThreadMismatchException | Exception thrown when a thread attempts to access an object that is affined to another thread.
Public class | ThreadSafetyPolicy | When applied to an assembly, this policy will check for possible concurrency issues.
Public class | ThreadUnsafeAttribute | Custom attribute that, when applied on a type, ensures that only one thread executes in methods of this type. When more than one thread accesses methods of this type, a ConcurrentAccessException exception is thrown.
Public class | UpgradeableReaderAttribute | Custom attribute that, when applied on a method, specifies that the method requires read and write access to the object, but other threads are allowed to acquire read (but not write) access to the object until a method with the WriterAttribute custom attribute is executed.
Public class | WriterAttribute | Custom attribute that, when applied on a method, specifies that the method requires write access to the object.
Public class | YielderAttribute | Custom attribute that, when applied on a method, specifies that the method that currently holds write access to the object (see WriterAttribute) allows other threads to read the object during the execution of the target method. This custom attribute is typically used on methods that raise events that must be processed synchronously by other threads.
Structures
 | Structure | Description
Public structure | AmbientConcurrencyControllerContext | A disposable cookie returned by WithConcurrencyController(IConcurrencyController).
Public structure | ConcurrentAccessAwaiter | An awaiter for the AcquireAccessAsync(ObjectAccessLevel) method. The struct implements both the Awaiter and Awaitable contracts.
Public structure | ConcurrentAccessToken | Token returned by the AcquireAccess(ObjectAccessLevel, ConcurrentAccessToken) method. This token is intended to be used in a using block. Consumers of this method must call Complete on success, and Dispose on exception.
Interfaces
 | Interface | Description
Public interface | IActor | Interface implemented by the ActorAttribute aspect.
Public interface | IActorController | Specific definition of the IConcurrencyController for the ActorThreadingModel.
Public interface | IActorDispatcher | Augments the IDispatcher interface with an Initialize method, which is invoked after the actor constructor has been invoked.
Public interface | IConcurrencyController | Controls access to an entity from possibly several threads.
Public interface | IDispatcher | Defines the semantics of a facility that executes actions synchronously or asynchronously, possibly on a different thread.
Public interface | IDispatcherObject | Interface implemented by objects that are whose access to methods is being controlled by a Dispatcher.
Public interface | IFreezable | Interface implemented by the FreezableAttribute aspect. Defines a Freeze method.
Public interface | IImmutable | Interface implemented by the ImmutableAttribute aspect.
Public interface | IThreadAware | Interface implemented by objects that are aware of concurrency. Access to thread-aware objects is controlled by a concurrency controller (IConcurrencyController). Any aspect implementing a threading model (ThreadAwareObjectAttribute) introduces this interface to the target class and ensures that accesses to this class go through the controller.
Enumerations
 | Enumeration | Description
Public enumeration | ThreadingUnhandledExceptionSource | Enumeration of components that can raise the UnhandledException event.


AccessLevelAttribute Class

Base class for ReaderAttribute, WriterAttribute, YielderAttribute UpgradeableReaderAttribute.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.Patterns.ThreadingAccessLevelAttribute
PostSharp.Patterns.ThreadingReaderAttribute
PostSharp.Patterns.ThreadingUpgradeableReaderAttribute
PostSharp.Patterns.ThreadingWriterAttribute
PostSharp.Patterns.ThreadingYielderAttribute

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class AccessLevelAttribute : MulticastAttribute

The AccessLevelAttribute type exposes the following members.

Constructors
 | Name | Description
Protected method | AccessLevelAttribute | Initializes a new instance of the AccessLevelAttribute class
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Top
See Also

Reference

PostSharp.Patterns.Threading Namespace

Other Resources

Conceptual: Reader/Writer Synchronized Threading Model


AccessLevelAttribute Constructor

Initializes a new instance of the AccessLevelAttribute class

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected AccessLevelAttribute()
See Also

Reference

AccessLevelAttribute Class
PostSharp.Patterns.Threading Namespace


AccessLevelAttribute Properties

The AccessLevelAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Top
See Also

Reference

AccessLevelAttribute Class
PostSharp.Patterns.Threading Namespace


ActorAttribute Class

Custom attribute that, when applied to a class, implements the ActorThreadingModel to this class, in which calls to methods are processed asynchronously from a single thread, suppressing concurrency inside each instance of the target class.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsTypeLevelAspect
PostSharp.AspectsInstanceLevelAspect
PostSharp.Patterns.ModelAggregatableClientAttribute
PostSharp.Patterns.ThreadingThreadAwareAttribute
PostSharp.Patterns.ThreadingActorAttribute

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ActorAttribute : ThreadAwareAttribute,
    IActor, IDispatcherObject, IThreadAware

The ActorAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | ActorAttribute | Initializes a new instance of the ActorAttribute class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | Instance | Gets the object to which the current aspect has been applied. (Inherited from InstanceLevelAspect.)
Public property | RuntimeVerificationEnabled | Determines whether the code should be verified against the model at runtime. The default value is true for the debug build configuration and false for the release build configuration. (Inherited from ThreadAwareAttribute.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from AggregatableClientAttribute.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from ThreadAwareAttribute.)
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype. (Inherited from InstanceLevelAspect.)
Public method | Finalize | Destructor. (Inherited from ThreadAwareAttribute.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnCloned | Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object. (Inherited from InstanceLevelAspect.)
Public method | OnInstanceConstructed | Executed when the target instance gets fully initialized, i.e. just after all constructors have completed. (Overrides AggregatableClientAttributeOnInstanceConstructed.)
Public method | OnSerializing | Requires read access level to the current object before serialization can proceed. This method will be introduced into the target class. (Inherited from ThreadAwareAttribute.)
Top
Extension Methods
 | Name | Description
Public Extension Method | AcquireAccess(ObjectAccessLevel) | Overloaded. Acquires access to given object and returns the ConcurrentAccessToken. (Defined by ThreadAwareExtensions.)
Public Extension Method | AcquireAccess(ObjectAccessLevel, ConcurrentAccessToken) | Overloaded. Acquires access for a given object and gets the ConcurrentAccessToken as a reference parameter. (Defined by ThreadAwareExtensions.)
Public Extension Method | AcquireAccessAsync | Asynchronously acquires access for a given object. (Defined by ThreadAwareExtensions.)
Top
Remarks

Calls to public methods of actors are packaged into messages and appended to a message queue. This message queue is processed by a single thread. Therefore, there is never more than one thread accessing the object, which makes the this object thread safe.

Public methods cannot have out or ref parameters. All method invocations are appended to the message queue. In case the method has a return value and is not async, the calling thread will wait synchronously for the method to be executed by the actor. Add the ExplicitlySynchronizedAttribute custom attribute to a method to prevent its execution to be dispatched to the actor queue. Note that using ExplicitlySynchronizedAttribute breaks the thread-safety guarantees of the ActorThreadingModel.

Several actors can share the same message queue by sharing the same instance of IActorDispatcher interface, which the target class can provide by overriding the IDispatcherObject interface.

See Also

Reference

PostSharp.Patterns.Threading Namespace

Other Resources

Conceptual: Actor Threading Model
Conceptual: Writing Thread-Safe Code with Threading Models


ActorAttribute Constructor

Initializes a new instance of the ActorAttribute class

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ActorAttribute()
See Also

Reference

ActorAttribute Class
PostSharp.Patterns.Threading Namespace


ActorAttribute Properties

The ActorAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | Instance | Gets the object to which the current aspect has been applied. (Inherited from InstanceLevelAspect.)
Public property | RuntimeVerificationEnabled | Determines whether the code should be verified against the model at runtime. The default value is true for the debug build configuration and false for the release build configuration. (Inherited from ThreadAwareAttribute.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

ActorAttribute Class
PostSharp.Patterns.Threading Namespace


ActorAttribute Methods

The ActorAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from AggregatableClientAttribute.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from ThreadAwareAttribute.)
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype. (Inherited from InstanceLevelAspect.)
Public method | Finalize | Destructor. (Inherited from ThreadAwareAttribute.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnCloned | Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object. (Inherited from InstanceLevelAspect.)
Public method | OnInstanceConstructed | Executed when the target instance gets fully initialized, i.e. just after all constructors have completed. (Overrides AggregatableClientAttributeOnInstanceConstructed.)
Public method | OnSerializing | Requires read access level to the current object before serialization can proceed. This method will be introduced into the target class. (Inherited from ThreadAwareAttribute.)
Top
Extension Methods
 | Name | Description
Public Extension Method | AcquireAccess(ObjectAccessLevel) | Overloaded. Acquires access to given object and returns the ConcurrentAccessToken. (Defined by ThreadAwareExtensions.)
Public Extension Method | AcquireAccess(ObjectAccessLevel, ConcurrentAccessToken) | Overloaded. Acquires access for a given object and gets the ConcurrentAccessToken as a reference parameter. (Defined by ThreadAwareExtensions.)
Public Extension Method | AcquireAccessAsync | Asynchronously acquires access for a given object. (Defined by ThreadAwareExtensions.)
Top
See Also

Reference

ActorAttribute Class
PostSharp.Patterns.Threading Namespace


ActorAttribute.OnInstanceConstructed Method

ActorAttributeOnInstanceConstructed Method

Executed when the target instance gets fully initialized, i.e. just after all constructors have completed.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void OnInstanceConstructed()
See Also

Reference

ActorAttribute Class
PostSharp.Patterns.Threading Namespace


ActorDispatcher Class

A dispatcher compatible with the ActorThreadingModel threading model, with a message queue based on a ConcurrentQueue The queue itself is processed from the ThreadPool.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.ThreadingActorDispatcher

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class ActorDispatcher : IActorDispatcher,
    IDispatcher

The ActorDispatcher type exposes the following members.

Constructors
 | Name | Description
Public method | ActorDispatcher | Initializes a new ActorDispatcher.
Top
Methods
 | Name | Description
Public method | BeginInvoke | Queues an action for asynchronous execution.
Public method | CheckAccess | Determines whether the current thread has access to the current dispatcher.
Public method | Invoke | Executes an action synchronously.
Protected method | MustYield | Determines whether the ProcessQueue method should interrupt the processing of the message queue before the queue is empty.
Protected method | OnQueueEmpty | Method invoked when the queue becomes empty. The default implementation does not do anything.
Protected method | ProcessQueue | Processes the message queue synchronously.
Protected method | ScheduleProcessQueue | Schedules the execution of the ProcessQueue, typically on a worker thread or in the ThreadPool. The default implementation uses the ThreadPool on platforms that have a thread pool, otherwise it schedules a new Task.
Top
Remarks

This implementation will append every action (as a result of the BeginInvoke(SendOrPostCallback, Object) method) into a ConcurrentQueue. If will then create a work item to process the ConcurrentQueue and schedule the work item to the ThreadPool. The same work item will keep running unless the message queue is empty, then will terminate.

You can use a different scheduling mechanism instead of the ThreadPool by deriving the class and overriding the ScheduleProcessQueue method.

Note that the Invoke(SendOrPostCallback, Object) method of the IDispatcher interface is not supported, because the ActorThreadingModel does not support synchronous calls.

See Also

Reference

PostSharp.Patterns.Threading Namespace


ActorDispatcher Constructor

Initializes a new ActorDispatcher.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ActorDispatcher()
See Also

Reference

ActorDispatcher Class
PostSharp.Patterns.Threading Namespace


ActorDispatcher Methods

The ActorDispatcher type exposes the following members.

Methods
 | Name | Description
Public method | BeginInvoke | Queues an action for asynchronous execution.
Public method | CheckAccess | Determines whether the current thread has access to the current dispatcher.
Public method | Invoke | Executes an action synchronously.
Protected method | MustYield | Determines whether the ProcessQueue method should interrupt the processing of the message queue before the queue is empty.
Protected method | OnQueueEmpty | Method invoked when the queue becomes empty. The default implementation does not do anything.
Protected method | ProcessQueue | Processes the message queue synchronously.
Protected method | ScheduleProcessQueue | Schedules the execution of the ProcessQueue, typically on a worker thread or in the ThreadPool. The default implementation uses the ThreadPool on platforms that have a thread pool, otherwise it schedules a new Task.
Top
See Also

Reference

ActorDispatcher Class
PostSharp.Patterns.Threading Namespace


ActorDispatcher.BeginInvoke Method

ActorDispatcherBeginInvoke Method

Queues an action for asynchronous execution.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void BeginInvoke(
    SendOrPostCallback action,
    Object state
)

Parameters

action
Type: System.ThreadingSendOrPostCallback
Action to be executed.
state
Type: SystemObject
Parameter passed to action

Implements

IDispatcherBeginInvoke(SendOrPostCallback, Object)
See Also

Reference

ActorDispatcher Class
PostSharp.Patterns.Threading Namespace


ActorDispatcher.CheckAccess Method

ActorDispatcherCheckAccess Method

Determines whether the current thread has access to the current dispatcher.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool CheckAccess()

Return Value

Type: Boolean
true if the current thread can directly call methods of objects protected by the current dispatcher, or false if methods Invoke(SendOrPostCallback, Object) or BeginInvoke(SendOrPostCallback, Object) must be used.

Implements

IDispatcherCheckAccess
See Also

Reference

ActorDispatcher Class
PostSharp.Patterns.Threading Namespace


ActorDispatcher.Invoke Method

ActorDispatcherInvoke Method

Executes an action synchronously.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Invoke(
    SendOrPostCallback action,
    Object state
)

Parameters

action
Type: System.ThreadingSendOrPostCallback
Action to be executed.
state
Type: SystemObject
Parameter passed to action.

Implements

IDispatcherInvoke(SendOrPostCallback, Object)
See Also

Reference

ActorDispatcher Class
PostSharp.Patterns.Threading Namespace


ActorDispatcher.MustYield Method

ActorDispatcherMustYield Method

Determines whether the ProcessQueue method should interrupt the processing of the message queue before the queue is empty.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual bool MustYield(
    int count
)

Parameters

count
Type: SystemInt32
Number of messages already processed by the current invocation of the ProcessQueue method.

Return Value

Type: Boolean
true if the ProcessQueue method should stop processing messages, false if it should continue.
Remarks

When this method returns true, the ProcessQueue method will immediately invoke the ScheduleProcessQueue method to process remaining messages.

The purpose of this method is to allow custom implementations of the ActorDispatcher class, which may dispatch the message queue execution on a pool composed of a small numbers of threads, to prevent a few actors to consume all available threads.

See Also

Reference

ActorDispatcher Class
PostSharp.Patterns.Threading Namespace


ActorDispatcher.OnQueueEmpty Method

ActorDispatcherOnQueueEmpty Method

Method invoked when the queue becomes empty. The default implementation does not do anything.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void OnQueueEmpty()
See Also

Reference

ActorDispatcher Class
PostSharp.Patterns.Threading Namespace


ActorDispatcher.ProcessQueue Method

ActorDispatcherProcessQueue Method

Processes the message queue synchronously.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected void ProcessQueue()
Remarks

This method can be invoked by an overridden implementation of the ScheduleProcessQueue method.

This method will process all messages until the queue is empty, unless the overridden implementation of MustYield(Int32) returns false.

See Also

Reference

ActorDispatcher Class
PostSharp.Patterns.Threading Namespace


ActorDispatcher.ScheduleProcessQueue Method

ActorDispatcherScheduleProcessQueue Method

Schedules the execution of the ProcessQueue, typically on a worker thread or in the ThreadPool. The default implementation uses the ThreadPool on platforms that have a thread pool, otherwise it schedules a new Task.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected virtual void ScheduleProcessQueue()
See Also

Reference

ActorDispatcher Class
PostSharp.Patterns.Threading Namespace


AmbientConcurrencyControllerContext Structure

A disposable cookie returned by WithConcurrencyController(IConcurrencyController).

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public struct AmbientConcurrencyControllerContext : IDisposable

The AmbientConcurrencyControllerContext type exposes the following members.

Methods
 | Name | Description
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Top
See Also

Reference

PostSharp.Patterns.Threading Namespace


AmbientConcurrencyControllerContext Methods

The AmbientConcurrencyControllerContext type exposes the following members.

Methods
 | Name | Description
Public method | Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Top
See Also

Reference

AmbientConcurrencyControllerContext Structure
PostSharp.Patterns.Threading Namespace


AmbientConcurrencyControllerContext.Dispose Method

AmbientConcurrencyControllerContextDispose Method

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Dispose()

Implements

IDisposableDispose
See Also

Reference

AmbientConcurrencyControllerContext Structure
PostSharp.Patterns.Threading Namespace


AssumeImmutableAttribute Class

Custom attribute that, when applied to a targetType, means that targetType should be assumed to be immutable. The custom attribute can be applied to a type on assembly level by specifying the Type property using the AssumeImmutableAttribute(Type) constructor.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.Patterns.ThreadingAssumeImmutableAttribute

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class AssumeImmutableAttribute : Attribute

The AssumeImmutableAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | AssumeImmutableAttribute | Initializes a new instance of the AssumeImmutableAttribute custom attribute that can be applied to a specific targetType.
Public method | AssumeImmutableAttribute(Type) | Initializes a new instance of the AssumeImmutableAttribute custom attribute that can be applied to an assembly, passing the immutable as a constructor argument. This constructor allows to add assumptions for types that are not defined in this current assembly.
Top
Properties
 | Name | Description
Public property | TargetType | Gets the targetType that should be assumed immutable, if the AssumeImmutableAttribute(Type) constructor was used.
Top
See Also

Reference

PostSharp.Patterns.Threading Namespace


AssumeImmutableAttribute Constructor

Overload List
 | Name | Description
Public method | AssumeImmutableAttribute | Initializes a new instance of the AssumeImmutableAttribute custom attribute that can be applied to a specific targetType.
Public method | AssumeImmutableAttribute(Type) | Initializes a new instance of the AssumeImmutableAttribute custom attribute that can be applied to an assembly, passing the immutable as a constructor argument. This constructor allows to add assumptions for types that are not defined in this current assembly.
Top
See Also

Reference

AssumeImmutableAttribute Class
PostSharp.Patterns.Threading Namespace


AssumeImmutableAttribute Constructor

Initializes a new instance of the AssumeImmutableAttribute custom attribute that can be applied to a specific targetType.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AssumeImmutableAttribute()
See Also

Reference

AssumeImmutableAttribute Class
AssumeImmutableAttribute Overload
PostSharp.Patterns.Threading Namespace


AssumeImmutableAttribute Constructor (Type)

Initializes a new instance of the AssumeImmutableAttribute custom attribute that can be applied to an assembly, passing the immutable as a constructor argument. This constructor allows to add assumptions for types that are not defined in this current assembly.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AssumeImmutableAttribute(
    Type targetType
)

Parameters

targetType
Type: SystemType
The immutable targetType.
See Also

Reference

AssumeImmutableAttribute Class
AssumeImmutableAttribute Overload
PostSharp.Patterns.Threading Namespace


AssumeImmutableAttribute Properties

The AssumeImmutableAttribute type exposes the following members.

Properties
 | Name | Description
Public property | TargetType | Gets the targetType that should be assumed immutable, if the AssumeImmutableAttribute(Type) constructor was used.
Top
See Also

Reference

AssumeImmutableAttribute Class
PostSharp.Patterns.Threading Namespace


AssumeImmutableAttribute.TargetType Property

AssumeImmutableAttributeTargetType Property

Gets the targetType that should be assumed immutable, if the AssumeImmutableAttribute(Type) constructor was used.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Type TargetType { get; }

Property Value

Type: Type
See Also

Reference

AssumeImmutableAttribute Class
PostSharp.Patterns.Threading Namespace


BackgroundAttribute Class

Custom attribute that, when applied on a method, causes the method to execute in the background. This aspect can be applied to a method with void or Task return type.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsMethodLevelAspect
PostSharp.AspectsMethodInterceptionAspect
PostSharp.Patterns.ThreadingBackgroundAttribute

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class BackgroundAttribute : MethodInterceptionAspect

The BackgroundAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | BackgroundAttribute | Initializes a new BackgroundAttribute.
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | IsLongRunning | Specifies that the method is long-running and should be executed on its own thread, if that is supported on the target platform. If false, the method will be executed in the thread pool.
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an async method with unsupported return value type. (Inherited from MethodInterceptionAspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(MethodBase) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Overrides MethodLevelAspectCompileTimeValidate(MethodBase).)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnInvoke | Method invoked instead of the method to which the aspect has been applied. (Overrides MethodInterceptionAspectOnInvoke(MethodInterceptionArgs).)
Public method | OnInvokeAsync | Method invoked instead of the method to which the aspect has been applied. (Overrides MethodInterceptionAspectOnInvokeAsync(MethodInterceptionArgs).)
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from MethodLevelAspect.)
Top
Remarks

When this aspect is applied to a method returning a Task, the aspects wraps the method call by a call to Task.Factory.StartNew, therefore executing the whole method in a background thread. Without this aspect, the target method would execute asynchronously, but in the current context, instead of in the background context.

If the IsLongRunning property is set to true, the method will be executed in a new thread. Otherwise, it will be queued into the ThreadPool.

If the target method results in an exception, the exception can be handled by subscribing to the UnhandledException event. Unhandled exceptions are rethrown, typically causing the application to crash.

See Also

Reference

PostSharp.Patterns.Threading Namespace

Other Resources

Conceptual: Dispatching a Method to Background
Conceptual: Dispatching a Method to the UI Thread
Conceptual: Multithreading
Conceptual: What's New in PostSharp 3.0


BackgroundAttribute Constructor

Initializes a new BackgroundAttribute.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public BackgroundAttribute()
See Also

Reference

BackgroundAttribute Class
PostSharp.Patterns.Threading Namespace


BackgroundAttribute Properties

The BackgroundAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | IsLongRunning | Specifies that the method is long-running and should be executed on its own thread, if that is supported on the target platform. If false, the method will be executed in the thread pool.
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an async method with unsupported return value type. (Inherited from MethodInterceptionAspect.)
Top
See Also

Reference

BackgroundAttribute Class
PostSharp.Patterns.Threading Namespace


BackgroundAttribute.IsLongRunning Property

BackgroundAttributeIsLongRunning Property

Specifies that the method is long-running and should be executed on its own thread, if that is supported on the target platform. If false, the method will be executed in the thread pool.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsLongRunning { get; set; }

Property Value

Type: Boolean
See Also

Reference

BackgroundAttribute Class
PostSharp.Patterns.Threading Namespace


BackgroundAttribute Methods

The BackgroundAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(MethodBase) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Overrides MethodLevelAspectCompileTimeValidate(MethodBase).)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnInvoke | Method invoked instead of the method to which the aspect has been applied. (Overrides MethodInterceptionAspectOnInvoke(MethodInterceptionArgs).)
Public method | OnInvokeAsync | Method invoked instead of the method to which the aspect has been applied. (Overrides MethodInterceptionAspectOnInvokeAsync(MethodInterceptionArgs).)
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from MethodLevelAspect.)
Top
See Also

Reference

BackgroundAttribute Class
PostSharp.Patterns.Threading Namespace


BackgroundAttribute.CompileTimeValidate Method

BackgroundAttributeCompileTimeValidate Method

Overload List
 | Name | Description
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(MethodBase) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Overrides MethodLevelAspectCompileTimeValidate(MethodBase).)
Top
See Also

Reference

BackgroundAttribute Class
PostSharp.Patterns.Threading Namespace


BackgroundAttribute.CompileTimeValidate Method (MethodBase)

BackgroundAttributeCompileTimeValidate Method (MethodBase)

Method invoked at build time to ensure that the aspect has been applied to the right target.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool CompileTimeValidate(
    MethodBase method
)

Parameters

method
Type: System.ReflectionMethodBase
Method to which the aspect has been applied

Return Value

Type: Boolean
true if the aspect was applied to an acceptable field, otherwise false.
Remarks
The implementation of this method is expected to emit an error message (see MessageSource) or an exception in case of error. Returning false without emitting an error message or exception causes the aspect to be silently ignored.
See Also

Reference

BackgroundAttribute Class
CompileTimeValidate Overload
PostSharp.Patterns.Threading Namespace

Other Resources

Conceptual: Validating Aspects
Conceptual: Testing that an Aspect has been Applied


BackgroundAttribute.OnInvoke Method

BackgroundAttributeOnInvoke Method

Method invoked instead of the method to which the aspect has been applied.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void OnInvoke(
    MethodInterceptionArgs args
)

Parameters

args
Type: PostSharp.AspectsMethodInterceptionArgs
Advice arguments.

Implements

IMethodInterceptionAspectOnInvoke(MethodInterceptionArgs)
Remarks

The implementation of OnInvoke(MethodInterceptionArgs) may invoke Proceed, may schedule it for invocation from another thread, or may completely skip its invocation. Alternatively, it may use Binding. Before returning to the caller, the OnInvoke(MethodInterceptionArgs) method must set the return value (property ReturnValue) and all output arguments (property Arguments), otherwise the target method may fail with a NullReferenceException. These are normally set by calling Proceed.

See Also

Reference

BackgroundAttribute Class
PostSharp.Patterns.Threading Namespace
PostSharp.AspectsMethodInterceptionArgs

Other Resources

Conceptual: Intercepting Methods


BackgroundAttribute.OnInvokeAsync Method

BackgroundAttributeOnInvokeAsync Method

Method invoked instead of the method to which the aspect has been applied.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Task OnInvokeAsync(
    MethodInterceptionArgs args
)

Parameters

args
Type: PostSharp.AspectsMethodInterceptionArgs
Advice arguments.

Return Value

Type: Task

Implements

IAsyncMethodInterceptionAspectOnInvokeAsync(MethodInterceptionArgs)
Remarks

The implementation of OnInvokeAsync(MethodInterceptionArgs) may invoke ProceedAsync, may schedule it for invocation from another thread, or may completely skip its invocation. Alternatively, it may use Binding. Before returning to the caller, the OnInvokeAsync(MethodInterceptionArgs) method must set the return value (property ReturnValue), otherwise the target method may fail with a NullReferenceException. It is normally set by calling ProceedAsync.

See Also

Reference

BackgroundAttribute Class
PostSharp.Patterns.Threading Namespace
PostSharp.AspectsMethodInterceptionArgs

Other Resources

Conceptual: Intercepting Methods
Conceptual: Semantic Advising of Iterator and Async Methods
Conceptual: What's New in PostSharp 5.0


ConcurrencyControllerFactory Class

Provides methods to create new instances of concurrency controllers.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.ThreadingConcurrencyControllerFactory

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static class ConcurrencyControllerFactory

The ConcurrencyControllerFactory type exposes the following members.

Methods
Name | Description
CreateReaderWriterSynchronizedController | Creates a new concurrency controller for the reader-writer-synchronized threading model (ReaderWriterSynchronizedThreadingModel) and specifies whether the new controller should participate in deadlock detection.
CreateSynchronizedController | Creates a new concurrency controller for the synchronized threading model (SynchronizedThreadingModel) and specifies whether the new controller should participate in deadlock detection.
CreateThreadUnsafeController | Creates a new concurrency controller for thread-unsafe threading model (ThreadUnsafeThreadingModel).
Top
See Also

Reference

PostSharp.Patterns.Threading Namespace


ConcurrencyControllerFactory Methods

The ConcurrencyControllerFactory type exposes the following members.

Methods
Name | Description
CreateReaderWriterSynchronizedController | Creates a new concurrency controller for the reader-writer-synchronized threading model (ReaderWriterSynchronizedThreadingModel) and specifies whether the new controller should participate in deadlock detection.
CreateSynchronizedController | Creates a new concurrency controller for the synchronized threading model (SynchronizedThreadingModel) and specifies whether the new controller should participate in deadlock detection.
CreateThreadUnsafeController | Creates a new concurrency controller for thread-unsafe threading model (ThreadUnsafeThreadingModel).
Top
See Also

Reference

ConcurrencyControllerFactory Class
PostSharp.Patterns.Threading Namespace


ConcurrencyControllerFactory.CreateReaderWriterSynchronizedController Method

ConcurrencyControllerFactoryCreateReaderWriterSynchronizedController Method

Creates a new concurrency controller for the reader-writer-synchronized threading model (ReaderWriterSynchronizedThreadingModel) and specifies whether the new controller should participate in deadlock detection.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static IConcurrencyController CreateReaderWriterSynchronizedController(
    bool useDeadlockDetection
)

Parameters

useDeadlockDetection
Type: SystemBoolean
Indicates whether the controller should participate in the deadlock detection algorithm. Use IsEnabled(Assembly) to determine whether the policy is enabled for the current assembly.

Return Value

Type: IConcurrencyController
A new instance of the reader-writer-synchronized concurrency controller.
See Also

Reference

ConcurrencyControllerFactory Class
PostSharp.Patterns.Threading Namespace


ConcurrencyControllerFactory.CreateSynchronizedController Method

ConcurrencyControllerFactoryCreateSynchronizedController Method

Creates a new concurrency controller for the synchronized threading model (SynchronizedThreadingModel) and specifies whether the new controller should participate in deadlock detection.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static IConcurrencyController CreateSynchronizedController(
    bool useDeadlockDetection
)

Parameters

useDeadlockDetection
Type: SystemBoolean
Indicates whether the controller should participate in the deadlock detection algorithm. Use IsEnabled(Assembly) to determine whether the policy is enabled for the current assembly.

Return Value

Type: IConcurrencyController
A new instance of the synchronized concurrency controller.
See Also

Reference

ConcurrencyControllerFactory Class
PostSharp.Patterns.Threading Namespace


ConcurrencyControllerFactory.CreateThreadUnsafeController Method

ConcurrencyControllerFactoryCreateThreadUnsafeController Method

Creates a new concurrency controller for thread-unsafe threading model (ThreadUnsafeThreadingModel).

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static IConcurrencyController CreateThreadUnsafeController()

Return Value

Type: IConcurrencyController
A new instance of the thread-unsafe concurrency controller.
See Also

Reference

ConcurrencyControllerFactory Class
PostSharp.Patterns.Threading Namespace


ConcurrentAccessAwaiter Structure

An awaiter for the AcquireAccessAsync(ObjectAccessLevel) method. The struct implements both the Awaiter and Awaitable contracts.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public struct ConcurrentAccessAwaiter : ICriticalNotifyCompletion,
    INotifyCompletion

The ConcurrentAccessAwaiter type exposes the following members.

Properties
 | Name | Description
Public property | IsCompleted | Determines whether the operation has already completed.
Top
Methods
 | Name | Description
Public method | GetAwaiter | Gets the Awaiter from the Awaitable. This method is a part of the Awaitable contract.
Public method | GetResult | Gets the result of the async method. This method is a part of the Awaiter contract.
Public method | OnCompleted | Schedules the continuation action that's invoked when the instance completes.
Public method | UnsafeOnCompleted | Schedules the continuation action that's invoked when the instance completes.
Top
See Also

Reference

PostSharp.Patterns.Threading Namespace


ConcurrentAccessAwaiter Properties

The ConcurrentAccessAwaiter type exposes the following members.

Properties
 | Name | Description
Public property | IsCompleted | Determines whether the operation has already completed.
Top
See Also

Reference

ConcurrentAccessAwaiter Structure
PostSharp.Patterns.Threading Namespace


ConcurrentAccessAwaiter.IsCompleted Property

ConcurrentAccessAwaiterIsCompleted Property

Determines whether the operation has already completed.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsCompleted { get; }

Property Value

Type: Boolean
See Also

Reference

ConcurrentAccessAwaiter Structure
PostSharp.Patterns.Threading Namespace


ConcurrentAccessAwaiter Methods

The ConcurrentAccessAwaiter type exposes the following members.

Methods
 | Name | Description
Public method | GetAwaiter | Gets the Awaiter from the Awaitable. This method is a part of the Awaitable contract.
Public method | GetResult | Gets the result of the async method. This method is a part of the Awaiter contract.
Public method | OnCompleted | Schedules the continuation action that's invoked when the instance completes.
Public method | UnsafeOnCompleted | Schedules the continuation action that's invoked when the instance completes.
Top
See Also

Reference

ConcurrentAccessAwaiter Structure
PostSharp.Patterns.Threading Namespace


ConcurrentAccessAwaiter.GetAwaiter Method

ConcurrentAccessAwaiterGetAwaiter Method

Gets the Awaiter from the Awaitable. This method is a part of the Awaitable contract.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ConcurrentAccessAwaiter GetAwaiter()

Return Value

Type: ConcurrentAccessAwaiter
The current object.
See Also

Reference

ConcurrentAccessAwaiter Structure
PostSharp.Patterns.Threading Namespace


ConcurrentAccessAwaiter.GetResult Method

ConcurrentAccessAwaiterGetResult Method

Gets the result of the async method. This method is a part of the Awaiter contract.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ConcurrentAccessToken GetResult()

Return Value

Type: ConcurrentAccessToken
The result of the AcquireAccessAsync(ObjectAccessLevel) method.
See Also

Reference

ConcurrentAccessAwaiter Structure
PostSharp.Patterns.Threading Namespace


ConcurrentAccessAwaiter.OnCompleted Method

ConcurrentAccessAwaiterOnCompleted Method

Schedules the continuation action that's invoked when the instance completes.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void OnCompleted(
    Action continuation
)

Parameters

continuation
Type: SystemAction
The action to invoke when the operation completes.

Implements

INotifyCompletionOnCompleted(Action)
Exceptions
Exception | Condition
ArgumentNullException | The continuation argument is null (Nothing in Visual Basic).
See Also

Reference

ConcurrentAccessAwaiter Structure
PostSharp.Patterns.Threading Namespace


ConcurrentAccessAwaiter.UnsafeOnCompleted Method

ConcurrentAccessAwaiterUnsafeOnCompleted Method

Schedules the continuation action that's invoked when the instance completes.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void UnsafeOnCompleted(
    Action continuation
)

Parameters

continuation
Type: SystemAction
The action to invoke when the operation completes.

Implements

ICriticalNotifyCompletionUnsafeOnCompleted(Action)
Exceptions
Exception | Condition
ArgumentNullException | The continuation argument is null (Nothing in Visual Basic).
See Also

Reference

ConcurrentAccessAwaiter Structure
PostSharp.Patterns.Threading Namespace


ConcurrentAccessException Class

Exception thrown when two threads simultaneously attempt to access a method annotated with the ThreadUnsafeAttribute custom attribute.
Inheritance Hierarchy
SystemObject
SystemException
PostSharp.Patterns.ThreadingThreadingException
PostSharp.Patterns.ThreadingConcurrentAccessException

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public sealed class ConcurrentAccessException : ThreadingException
Constructors
 | Name | Description
Public method | ConcurrentAccessException | Initializes a new ConcurrentAccessException.
Public method | ConcurrentAccessException(String) | Initializes a new ConcurrentAccessException and sets the error message.
Public method | ConcurrentAccessException(String, Exception) | Initializes a new ConcurrentAccessException and sets the error message and the inner exception.
Top
See Also

Reference

PostSharp.Patterns.Threading Namespace

Other Resources

Conceptual: Thread-Unsafe Threading Model


ConcurrentAccessException Constructor

Overload List
 | Name | Description
Public method | ConcurrentAccessException | Initializes a new ConcurrentAccessException.
Public method | ConcurrentAccessException(String) | Initializes a new ConcurrentAccessException and sets the error message.
Public method | ConcurrentAccessException(String, Exception) | Initializes a new ConcurrentAccessException and sets the error message and the inner exception.
Top
See Also

Reference

ConcurrentAccessException Class
PostSharp.Patterns.Threading Namespace


ConcurrentAccessException Constructor

Initializes a new ConcurrentAccessException.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ConcurrentAccessException()
See Also

Reference

ConcurrentAccessException Class
ConcurrentAccessException Overload
PostSharp.Patterns.Threading Namespace


ConcurrentAccessException Constructor (String)

Initializes a new ConcurrentAccessException and sets the error message.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ConcurrentAccessException(
    string message
)

Parameters

message
Type: SystemString
Error message.
See Also

Reference

ConcurrentAccessException Class
ConcurrentAccessException Overload
PostSharp.Patterns.Threading Namespace


ConcurrentAccessException Constructor (String, Exception)

Initializes a new ConcurrentAccessException and sets the error message and the inner exception.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ConcurrentAccessException(
    string message,
    Exception inner
)

Parameters

message
Type: SystemString
Error message.
inner
Type: SystemException
Inner exception.
See Also

Reference

ConcurrentAccessException Class
ConcurrentAccessException Overload
PostSharp.Patterns.Threading Namespace


ConcurrentAccessToken Structure

Token returned by the AcquireAccess(ObjectAccessLevel, ConcurrentAccessToken) method. This token is intended to be used in a using block. Consumers of this method must call Complete on success, and Dispose on exception.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public struct ConcurrentAccessToken : IDisposable

The ConcurrentAccessToken type exposes the following members.

Properties
Name | Description
Null | Gets a null instance of the ConcurrentAccessToken type.
Top
Methods
 | Name | Description
Public method | Cancel | Indicates that the operation requiring access on an object failed.
Public method | CheckContext | Determines whether the current ConcurrentAccessToken is valid in the current context.
Public method | Complete | Indicates that the operation requiring access on an object has successfully completed.
Public method | Dispose | Indicates that the operation requiring access on an object has completed. If the Complete method is not invoked before the Dispose method, the transaction is considered to have failed. Current threading models do not support transactions and therefore this semantic is currently unused, but it may be used in the future.
Top
See Also

Reference

PostSharp.Patterns.Threading Namespace


ConcurrentAccessToken Properties

The ConcurrentAccessToken type exposes the following members.

Properties
Name | Description
Null | Gets a null instance of the ConcurrentAccessToken type.
Top
See Also

Reference

ConcurrentAccessToken Structure
PostSharp.Patterns.Threading Namespace


ConcurrentAccessToken.Null Property

ConcurrentAccessTokenNull Property

Gets a null instance of the ConcurrentAccessToken type.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static ConcurrentAccessToken Null { get; }

Property Value

Type: ConcurrentAccessToken
See Also

Reference

ConcurrentAccessToken Structure
PostSharp.Patterns.Threading Namespace


ConcurrentAccessToken Methods

The ConcurrentAccessToken type exposes the following members.

Methods
 | Name | Description
Public method | Cancel | Indicates that the operation requiring access on an object failed.
Public method | CheckContext | Determines whether the current ConcurrentAccessToken is valid in the current context.
Public method | Complete | Indicates that the operation requiring access on an object has successfully completed.
Public method | Dispose | Indicates that the operation requiring access on an object has completed. If the Complete method is not invoked before the Dispose method, the transaction is considered to have failed. Current threading models do not support transactions and therefore this semantic is currently unused, but it may be used in the future.
Top
See Also

Reference

ConcurrentAccessToken Structure
PostSharp.Patterns.Threading Namespace


ConcurrentAccessToken.Cancel Method

ConcurrentAccessTokenCancel Method

Indicates that the operation requiring access on an object failed.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Cancel()
See Also

Reference

ConcurrentAccessToken Structure
PostSharp.Patterns.Threading Namespace


ConcurrentAccessToken.CheckContext Method

ConcurrentAccessTokenCheckContext Method

Determines whether the current ConcurrentAccessToken is valid in the current context.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool CheckContext(
    bool canBeParentContext = false
)

Parameters

canBeParentContext (Optional)
Type: SystemBoolean
true if the current ConcurrentAccessToken can be the token of a parent token, false if it must be the token of the current context.

Return Value

Type: Boolean
true if the current ConcurrentAccessToken is valid for the current context, otherwise false.
See Also

Reference

ConcurrentAccessToken Structure
PostSharp.Patterns.Threading Namespace


ConcurrentAccessToken.Complete Method

ConcurrentAccessTokenComplete Method

Indicates that the operation requiring access on an object has successfully completed.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Complete()
See Also

Reference

ConcurrentAccessToken Structure
PostSharp.Patterns.Threading Namespace


ConcurrentAccessToken.Dispose Method

ConcurrentAccessTokenDispose Method

Indicates that the operation requiring access on an object has completed. If the Complete method is not invoked before the Dispose method, the transaction is considered to have failed. Current threading models do not support transactions and therefore this semantic is currently unused, but it may be used in the future.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Dispose()

Implements

IDisposableDispose
See Also

Reference

ConcurrentAccessToken Structure
PostSharp.Patterns.Threading Namespace


DeadlockDetectedEventArgs Class

Arguments for the DeadlockDetected event.
Inheritance Hierarchy
SystemObject
SystemEventArgs
PostSharp.Patterns.ThreadingDeadlockDetectedEventArgs

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public sealed class DeadlockDetectedEventArgs : EventArgs

The DeadlockDetectedEventArgs type exposes the following members.

Properties
 | Name | Description
Public property | DeadlockInfo | Gets the deadlock information object.
Public property | Handled | Gets of sets an information indicating whether the event was handled by the user. If the event is not handled, an exception will be thrown on all involved threads.
Top
See Also

Reference

PostSharp.Patterns.Threading Namespace


DeadlockDetectedEventArgs Properties

The DeadlockDetectedEventArgs type exposes the following members.

Properties
 | Name | Description
Public property | DeadlockInfo | Gets the deadlock information object.
Public property | Handled | Gets of sets an information indicating whether the event was handled by the user. If the event is not handled, an exception will be thrown on all involved threads.
Top
See Also

Reference

DeadlockDetectedEventArgs Class
PostSharp.Patterns.Threading Namespace


DeadlockDetectedEventArgs.DeadlockInfo Property

DeadlockDetectedEventArgsDeadlockInfo Property

Gets the deadlock information object.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public DeadlockInfo DeadlockInfo { get; }

Property Value

Type: DeadlockInfo
See Also

Reference

DeadlockDetectedEventArgs Class
PostSharp.Patterns.Threading Namespace


DeadlockDetectedEventArgs.Handled Property

DeadlockDetectedEventArgsHandled Property

Gets of sets an information indicating whether the event was handled by the user. If the event is not handled, an exception will be thrown on all involved threads.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Handled { get; set; }

Property Value

Type: Boolean
See Also

Reference

DeadlockDetectedEventArgs Class
PostSharp.Patterns.Threading Namespace


DeadlockDetectionPolicy Class

Detects deadlocks occurring because of circular wait conditions.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsAssemblyLevelAspect
PostSharp.Patterns.ThreadingDeadlockDetectionPolicy

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class DeadlockDetectionPolicy : AssemblyLevelAspect,
    IAspectProvider, IAspect, IService

The DeadlockDetectionPolicy type exposes the following members.

Constructors
 | Name | Description
Public method | DeadlockDetectionPolicy | Initializes a new instance of the DeadlockDetectionPolicy class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from AssemblyLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from AssemblyLevelAspect.)
Public method | CompileTimeValidate(Assembly) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Overrides AssemblyLevelAspectCompileTimeValidate(Assembly).)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
 | IsEnabled | Determines whether an Assembly has been instrumented for deadlock detection.
Top
Remarks

The DeadlockDetectionPolicy works by building, in real time, a graph of dependencies between threads and waiting objects. All synchronization aspects of the threading pattern library, additionally to the most common .NET synchronization primitives. The following .NET methods that are supported: Mutex.WaitOne, Mutex.WaitAll, Mutex.Release, Mutex.SignalAndWait, Monitor.Enter, Monitor.Exit, Monitor.TryEnter, Thread.Join, all methods of ReaderWriterLockSlim, all methods of ReaderWriterLock except ReaderWriterLock.ReleaseLock, ReaderWriterLock.RestoreLock, all methods of Dispatcher, Dispatcher.BeginInvoke, Dispatcher.InvokeAsync, DispatcherOperation.Wait, Dispatcher

When synchronization objects wait for more then 200ms, a deadlock detection is performed. The algorithm analyzes the dependency graph for cycles and throws a DeadlockException in all threads involved in the cycle if one is detected.

Some actions on synchronization primitives, such as ReaderWriterLock.RestoreLock and WaitHandle.Handle, make it impossible to track deadlocks. If such methods are called, the synchronization primitive is excluded from the deadlock detection mechanism. If too many objects are excluded, the deadlock detection is automatically turned off.

See Also

Reference

PostSharp.Patterns.Threading Namespace

Other Resources

Conceptual: Detecting Deadlocks at Runtime
Conceptual: Making a Whole Project or Solution Thread Safe


DeadlockDetectionPolicy Constructor

Initializes a new instance of the DeadlockDetectionPolicy class

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public DeadlockDetectionPolicy()
See Also

Reference

DeadlockDetectionPolicy Class
PostSharp.Patterns.Threading Namespace


DeadlockDetectionPolicy Properties

The DeadlockDetectionPolicy type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

DeadlockDetectionPolicy Class
PostSharp.Patterns.Threading Namespace


DeadlockDetectionPolicy Methods

The DeadlockDetectionPolicy type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from AssemblyLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from AssemblyLevelAspect.)
Public method | CompileTimeValidate(Assembly) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Overrides AssemblyLevelAspectCompileTimeValidate(Assembly).)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
 | IsEnabled | Determines whether an Assembly has been instrumented for deadlock detection.
Top
See Also

Reference

DeadlockDetectionPolicy Class
PostSharp.Patterns.Threading Namespace


DeadlockDetectionPolicy.CompileTimeValidate Method

DeadlockDetectionPolicyCompileTimeValidate Method

Overload List
 | Name | Description
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from AssemblyLevelAspect.)
Public method | CompileTimeValidate(Assembly) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Overrides AssemblyLevelAspectCompileTimeValidate(Assembly).)
Top
See Also

Reference

DeadlockDetectionPolicy Class
PostSharp.Patterns.Threading Namespace


DeadlockDetectionPolicy.CompileTimeValidate Method (Assembly)

DeadlockDetectionPolicyCompileTimeValidate Method (Assembly)

Method invoked at build time to ensure that the aspect has been applied to the right target.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool CompileTimeValidate(
    Assembly assembly
)

Parameters

assembly
Type: System.ReflectionAssembly
Assembly on which the current aspect is applied.

Return Value

Type: Boolean
true if the aspect was applied to an acceptable target, otherwise false.
Remarks
The implementation of this method is expected to emit an error message (see MessageSource) or an exception in case of error. Returning false without emitting an error message or exception causes the aspect to be silently ignored.
See Also

Reference

DeadlockDetectionPolicy Class
CompileTimeValidate Overload
PostSharp.Patterns.Threading Namespace

Other Resources

Conceptual: Validating Aspects


DeadlockDetectionPolicy.IsEnabled Method

DeadlockDetectionPolicyIsEnabled Method

Determines whether an Assembly has been instrumented for deadlock detection.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool IsEnabled(
    Assembly assembly
)

Parameters

assembly
Type: System.ReflectionAssembly
An Assembly.

Return Value

Type: Boolean
true if assembly has been instrumented for deadlock detection, otherwise false.
See Also

Reference

DeadlockDetectionPolicy Class
PostSharp.Patterns.Threading Namespace


DeadlockedThreadInfo Class

Described state of thread that was detected to be in a deadlock.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.ThreadingDeadlockedThreadInfo

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public sealed class DeadlockedThreadInfo

The DeadlockedThreadInfo type exposes the following members.

Constructors
 | Name | Description
Public method | DeadlockedThreadInfo | Initializes the object.
Top
Properties
 | Name | Description
Public property | ManagedThreadId | Gets ID of the managed thread.
Public property | StackTrace | Gets the stack trace of the thread in deadlock or null if it was not possible to obtain the stack trace.
Public property | Thread | Gets the thread in deadlock or null if the object was deserialized.
Top
See Also

Reference

PostSharp.Patterns.Threading Namespace


DeadlockedThreadInfo Constructor

Initializes the object.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public DeadlockedThreadInfo(
    Thread thread,
    StackTrace stackTrace
)

Parameters

thread
Type: System.ThreadingThread
Thread in a deadlock.
stackTrace
Type: System.DiagnosticsStackTrace
Stack trace of the thread or null if it was not possible to obtain it.
See Also

Reference

DeadlockedThreadInfo Class
PostSharp.Patterns.Threading Namespace


DeadlockedThreadInfo Properties

The DeadlockedThreadInfo type exposes the following members.

Properties
 | Name | Description
Public property | ManagedThreadId | Gets ID of the managed thread.
Public property | StackTrace | Gets the stack trace of the thread in deadlock or null if it was not possible to obtain the stack trace.
Public property | Thread | Gets the thread in deadlock or null if the object was deserialized.
Top
See Also

Reference

DeadlockedThreadInfo Class
PostSharp.Patterns.Threading Namespace


DeadlockedThreadInfo.ManagedThreadId Property

DeadlockedThreadInfoManagedThreadId Property

Gets ID of the managed thread.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int ManagedThreadId { get; }

Property Value

Type: Int32
See Also

Reference

DeadlockedThreadInfo Class
PostSharp.Patterns.Threading Namespace


DeadlockedThreadInfo.StackTrace Property

DeadlockedThreadInfoStackTrace Property

Gets the stack trace of the thread in deadlock or null if it was not possible to obtain the stack trace.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public StackTrace StackTrace { get; }

Property Value

Type: StackTrace
See Also

Reference

DeadlockedThreadInfo Class
PostSharp.Patterns.Threading Namespace


DeadlockedThreadInfo.Thread Property

DeadlockedThreadInfoThread Property

Gets the thread in deadlock or null if the object was deserialized.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Thread Thread { get; }

Property Value

Type: Thread
See Also

Reference

DeadlockedThreadInfo Class
PostSharp.Patterns.Threading Namespace


DeadlockException Class

Exception thrown by the DeadlockDetectionPolicy class when a deadlock is detected.
Inheritance Hierarchy
SystemObject
SystemException
PostSharp.Patterns.ThreadingThreadingException
PostSharp.Patterns.ThreadingDeadlockException

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public sealed class DeadlockException : ThreadingException

The DeadlockException type exposes the following members.

Constructors
 | Name | Description
Public method | DeadlockException | Initializes a new instance of see cref="DeadlockException"/>.
Public method | DeadlockException(String) | Initializes a new instance of see cref="DeadlockException"/>.
Public method | DeadlockException(DeadlockInfo) | Initializes a new instance of DeadlockException and specifies the message and involved threads.
Public method | DeadlockException(String, Exception) | Initializes a new instance of see cref="DeadlockException"/>.
Top
Properties
 | Name | Description
Public property | DeadlockInfo | Gets an information about the deadlock.
Top
Methods
 | Name | Description
Public method | GetObjectData | When overridden in a derived class, sets the SerializationInfo with information about the exception. (Overrides ExceptionGetObjectData(SerializationInfo, StreamingContext).)
Top
See Also

Reference

PostSharp.Patterns.Threading Namespace

Other Resources

Conceptual: Detecting Deadlocks at Runtime


DeadlockException Constructor

Overload List
 | Name | Description
Public method | DeadlockException | Initializes a new instance of see cref="DeadlockException"/>.
Public method | DeadlockException(String) | Initializes a new instance of see cref="DeadlockException"/>.
Public method | DeadlockException(DeadlockInfo) | Initializes a new instance of DeadlockException and specifies the message and involved threads.
Public method | DeadlockException(String, Exception) | Initializes a new instance of see cref="DeadlockException"/>.
Top
See Also

Reference

DeadlockException Class
PostSharp.Patterns.Threading Namespace


DeadlockException Constructor

Initializes a new instance of see cref="DeadlockException"/>.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public DeadlockException()
See Also

Reference

DeadlockException Class
DeadlockException Overload
PostSharp.Patterns.Threading Namespace


DeadlockException Constructor (String)

Initializes a new instance of see cref="DeadlockException"/>.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public DeadlockException(
    string message
)

Parameters

message
Type: SystemString
Exception message.
See Also

Reference

DeadlockException Class
DeadlockException Overload
PostSharp.Patterns.Threading Namespace


DeadlockException Constructor (DeadlockInfo)

Initializes a new instance of DeadlockException and specifies the message and involved threads.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public DeadlockException(
    DeadlockInfo deadlockInfo
)

Parameters

deadlockInfo
Type: PostSharp.Patterns.ThreadingDeadlockInfo
Information about the deadlock.
See Also

Reference

DeadlockException Class
DeadlockException Overload
PostSharp.Patterns.Threading Namespace


DeadlockException Constructor (String, Exception)

Initializes a new instance of see cref="DeadlockException"/>.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public DeadlockException(
    string message,
    Exception innerException
)

Parameters

message
Type: SystemString
Exception message.
innerException
Type: SystemException
Inner exception.
See Also

Reference

DeadlockException Class
DeadlockException Overload
PostSharp.Patterns.Threading Namespace


DeadlockException Properties

The DeadlockException type exposes the following members.

Properties
 | Name | Description
Public property | DeadlockInfo | Gets an information about the deadlock.
Top
See Also

Reference

DeadlockException Class
PostSharp.Patterns.Threading Namespace


DeadlockException.DeadlockInfo Property

DeadlockExceptionDeadlockInfo Property

Gets an information about the deadlock.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public DeadlockInfo DeadlockInfo { get; }

Property Value

Type: DeadlockInfo
Remarks
This property is not serialized and therefore can be potentially null.
See Also

Reference

DeadlockException Class
PostSharp.Patterns.Threading Namespace


DeadlockException Methods

The DeadlockException type exposes the following members.

Methods
 | Name | Description
Public method | GetObjectData | When overridden in a derived class, sets the SerializationInfo with information about the exception. (Overrides ExceptionGetObjectData(SerializationInfo, StreamingContext).)
Top
See Also

Reference

DeadlockException Class
PostSharp.Patterns.Threading Namespace


DeadlockException.GetObjectData Method

DeadlockExceptionGetObjectData Method

When overridden in a derived class, sets the SerializationInfo with information about the exception.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void GetObjectData(
    SerializationInfo info,
    StreamingContext context
)

Parameters

info
Type: System.Runtime.SerializationSerializationInfo
The SerializationInfo that holds the serialized object data about the exception being thrown.
context
Type: System.Runtime.SerializationStreamingContext
The StreamingContext that contains contextual information about the source or destination.

Implements

ISerializableGetObjectData(SerializationInfo, StreamingContext)
_ExceptionGetObjectData(SerializationInfo, StreamingContext)
Exceptions
Exception | Condition
ArgumentNullException | The info parameter is a null reference ( in Visual Basic).
SecurityException | The caller does not have the required permission.
See Also

Reference

DeadlockException Class
PostSharp.Patterns.Threading Namespace


DeadlockInfo Class

Describes the detected deadlock.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.ThreadingDeadlockInfo

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public sealed class DeadlockInfo

The DeadlockInfo type exposes the following members.

Constructors
 | Name | Description
Public method | DeadlockInfo | Initializes the object.
Top
Properties
 | Name | Description
Public property | DeadlockedThreads | Gets a collection of objects describing each thread in the deadlock.
Public property | Description | Gets textual description of the deadlock.
Top
See Also

Reference

PostSharp.Patterns.Threading Namespace


DeadlockInfo Constructor

Initializes the object.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public DeadlockInfo(
    string description,
    IList<DeadlockedThreadInfo> deadlockedThreads
)

Parameters

description
Type: SystemString
Textual description of the detected deadlock.
deadlockedThreads
Type: System.Collections.GenericIList DeadlockedThreadInfo
List of objects describing each thread in the deadlock.
See Also

Reference

DeadlockInfo Class
PostSharp.Patterns.Threading Namespace


DeadlockInfo Properties

The DeadlockInfo type exposes the following members.

Properties
 | Name | Description
Public property | DeadlockedThreads | Gets a collection of objects describing each thread in the deadlock.
Public property | Description | Gets textual description of the deadlock.
Top
See Also

Reference

DeadlockInfo Class
PostSharp.Patterns.Threading Namespace


DeadlockInfo.DeadlockedThreads Property

DeadlockInfoDeadlockedThreads Property

Gets a collection of objects describing each thread in the deadlock.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ReadOnlyCollection<DeadlockedThreadInfo> DeadlockedThreads { get; }

Property Value

Type: ReadOnlyCollection DeadlockedThreadInfo
See Also

Reference

DeadlockInfo Class
PostSharp.Patterns.Threading Namespace


DeadlockInfo.Description Property

DeadlockInfoDescription Property

Gets textual description of the deadlock.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string Description { get; }

Property Value

Type: String
See Also

Reference

DeadlockInfo Class
PostSharp.Patterns.Threading Namespace


DispatchedAttribute Class

Custom attribute that, when applied on a method, specifies that the method should be executed in UI thread.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsMethodLevelAspect
PostSharp.Patterns.ThreadingDispatchedAttribute

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class DispatchedAttribute : MethodLevelAspect,
    IAspectProvider, IAspect, IService

The DispatchedAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | DispatchedAttribute | Initializes a new DispatchedAttribute.
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | FireAndForget | When the aspect is applied to a void non-async method, this property determines whether the caller will continue immediately after enqueuing the call to the target method, without waiting for the method. The default value is false.
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(MethodBase) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Overrides MethodLevelAspectCompileTimeValidate(MethodBase).)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from MethodLevelAspect.)
Top
Remarks

Execution of the method can be synchronous or asynchronous according to the value of the FireAndForget property.

This aspect can be applied to instance methods of UI controls (WinForms or WPF), or to any class implementing the IDispatcherObject manually.

See Also

Reference

PostSharp.Patterns.Threading Namespace

Other Resources

Conceptual: Dispatching a Method to the UI Thread
Conceptual: Multithreading
Conceptual: What's New in PostSharp 3.0


DispatchedAttribute Constructor

Initializes a new DispatchedAttribute.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public DispatchedAttribute(
    bool fireAndForget = false
)

Parameters

fireAndForget (Optional)
Type: SystemBoolean
true if the target method must be invoked asynchronously, or false if the target method must be invoked synchronously, that is, if the caller must wait for the dispatched method to complete.
Remarks

Method that have a non-void return type or ref or out parameters cannot be dispatched asynchronously.

See Also

Reference

DispatchedAttribute Class
PostSharp.Patterns.Threading Namespace

Other Resources

Conceptual: Dispatching a Method to the UI Thread


DispatchedAttribute Properties

The DispatchedAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | FireAndForget | When the aspect is applied to a void non-async method, this property determines whether the caller will continue immediately after enqueuing the call to the target method, without waiting for the method. The default value is false.
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

DispatchedAttribute Class
PostSharp.Patterns.Threading Namespace


DispatchedAttribute.FireAndForget Property

DispatchedAttributeFireAndForget Property

When the aspect is applied to a void non-async method, this property determines whether the caller will continue immediately after enqueuing the call to the target method, without waiting for the method. The default value is false.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool FireAndForget { get; set; }

Property Value

Type: Boolean
true if the target method must be invoked asynchronously, or false if the target method must be invoked synchronously, that is, if the caller must wait for the dispatched method to complete.
Remarks

Method that have a non-void return type or ref or out parameters cannot be dispatched asynchronously.

See Also

Reference

DispatchedAttribute Class
PostSharp.Patterns.Threading Namespace


DispatchedAttribute Methods

The DispatchedAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(MethodBase) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Overrides MethodLevelAspectCompileTimeValidate(MethodBase).)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | RuntimeInitialize | Initializes the current aspect. (Inherited from MethodLevelAspect.)
Top
See Also

Reference

DispatchedAttribute Class
PostSharp.Patterns.Threading Namespace


DispatchedAttribute.CompileTimeValidate Method

DispatchedAttributeCompileTimeValidate Method

Overload List
 | Name | Description
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from MethodLevelAspect.)
Public method | CompileTimeValidate(MethodBase) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Overrides MethodLevelAspectCompileTimeValidate(MethodBase).)
Top
See Also

Reference

DispatchedAttribute Class
PostSharp.Patterns.Threading Namespace


DispatchedAttribute.CompileTimeValidate Method (MethodBase)

DispatchedAttributeCompileTimeValidate Method (MethodBase)

Method invoked at build time to ensure that the aspect has been applied to the right target.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool CompileTimeValidate(
    MethodBase method
)

Parameters

method
Type: System.ReflectionMethodBase
Method to which the aspect has been applied

Return Value

Type: Boolean
true if the aspect was applied to an acceptable field, otherwise false.
Remarks
The implementation of this method is expected to emit an error message (see MessageSource) or an exception in case of error. Returning false without emitting an error message or exception causes the aspect to be silently ignored.
See Also

Reference

DispatchedAttribute Class
CompileTimeValidate Overload
PostSharp.Patterns.Threading Namespace

Other Resources

Conceptual: Validating Aspects
Conceptual: Testing that an Aspect has been Applied


DispatcherFactory Class

Provides implementations of the IDispatcher interface.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.ThreadingDispatcherFactory

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static class DispatcherFactory

The DispatcherFactory type exposes the following members.

Methods
Name | Description
GetDispatcherForCurrentContext | Gets an implementation of the IDispatcher interface that is suitable for dispatching to the current context. This method requires that the current thread is associated to a SynchronizationContext or a WPF Dispatcher.
GetDispatcherForSynchronizationContext | Gets an implementation of the IDispatcher interface for a given SynchronizationContext.
GetDispatcherForWindowsDispatcher | Gets an implementation of the IDispatcher interface for a given instance of the System.Windows.Threading.Dispatcher class.
Top
See Also

Reference

PostSharp.Patterns.Threading Namespace


DispatcherFactory Methods

The DispatcherFactory type exposes the following members.

Methods
Name | Description
GetDispatcherForCurrentContext | Gets an implementation of the IDispatcher interface that is suitable for dispatching to the current context. This method requires that the current thread is associated to a SynchronizationContext or a WPF Dispatcher.
GetDispatcherForSynchronizationContext | Gets an implementation of the IDispatcher interface for a given SynchronizationContext.
GetDispatcherForWindowsDispatcher | Gets an implementation of the IDispatcher interface for a given instance of the System.Windows.Threading.Dispatcher class.
Top
See Also

Reference

DispatcherFactory Class
PostSharp.Patterns.Threading Namespace


DispatcherFactory.GetDispatcherForCurrentContext Method

DispatcherFactoryGetDispatcherForCurrentContext Method

Gets an implementation of the IDispatcher interface that is suitable for dispatching to the current context. This method requires that the current thread is associated to a SynchronizationContext or a WPF Dispatcher.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static IDispatcher GetDispatcherForCurrentContext()

Return Value

Type: IDispatcher
An implementation of the IDispatcher for the current context, or null if the current thread is not associated with any SynchronizationContext or a WPF Dispatcher.
Remarks

Subsequent calls to this method in the same context will return the same instance.

If this method is invoke in the contact of an actor (see ActorAttribute), this method will return a dispatcher that allows to dispatch to the actor queue.

See Also

Reference

DispatcherFactory Class
PostSharp.Patterns.Threading Namespace


DispatcherFactory.GetDispatcherForSynchronizationContext Method

DispatcherFactoryGetDispatcherForSynchronizationContext Method

Gets an implementation of the IDispatcher interface for a given SynchronizationContext.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static IDispatcher GetDispatcherForSynchronizationContext(
    SynchronizationContext synchronizationContext
)

Parameters

synchronizationContext
Type: System.ThreadingSynchronizationContext
A SynchronizationContext.

Return Value

Type: IDispatcher
An implementation of IDispatcher that dispatches using synchronizationContext.
See Also

Reference

DispatcherFactory Class
PostSharp.Patterns.Threading Namespace


DispatcherFactory.GetDispatcherForWindowsDispatcher Method

DispatcherFactoryGetDispatcherForWindowsDispatcher Method

Gets an implementation of the IDispatcher interface for a given instance of the System.Windows.Threading.Dispatcher class.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static IDispatcher GetDispatcherForWindowsDispatcher(
    Object dispatcher
)

Parameters

dispatcher
Type: SystemObject
An instance of the System.Windows.Threading.Dispatcher class.

Return Value

Type: IDispatcher
An implementation of IDispatcher wrapping the functionality of dispatcher.
Remarks
Throws PlatformNotSupportedException on platforms that don't support WPF.
See Also

Reference

DispatcherFactory Class
PostSharp.Patterns.Threading Namespace


EntryPointAttribute Class

Custom attribute that, when applied to a private or protected instance method, causes all threading model aspects (derived from ThreadAwareAttribute to introduce runtime generation code.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.Patterns.ThreadingEntryPointAttribute

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class EntryPointAttribute : MulticastAttribute

The EntryPointAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | EntryPointAttribute | Initializes a new instance of the EntryPointAttribute class
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Top
See Also

Reference

PostSharp.Patterns.Threading Namespace

Other Resources

Conceptual: Actor Threading Model
Conceptual: Opting In and Out From Thread Safety
Conceptual: Thread-Unsafe Threading Model


EntryPointAttribute Constructor

Initializes a new instance of the EntryPointAttribute class

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public EntryPointAttribute()
See Also

Reference

EntryPointAttribute Class
PostSharp.Patterns.Threading Namespace


EntryPointAttribute Properties

The EntryPointAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Top
See Also

Reference

EntryPointAttribute Class
PostSharp.Patterns.Threading Namespace


ExplicitlySynchronizedAttribute Class

Custom attribute that, when applied to a method or field, specifies that threading model aspects (derived from ThreadAwareAttribute) should ignore all verifications for this field or method.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.Patterns.ThreadingExplicitlySynchronizedAttribute

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ExplicitlySynchronizedAttribute : MulticastAttribute

The ExplicitlySynchronizedAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | ExplicitlySynchronizedAttribute | Initializes a new ExplicitlySynchronizedAttribute.
Public method | ExplicitlySynchronizedAttribute(Boolean) | Initializes a new ExplicitlySynchronizedAttribute and specifies the synchronization strategy.
Top
Properties
 | Name | Description
Public property | AppliesToMethodOnly | Determines the synchronization strategy. When AppliesToMethodOnly is true, no synchronization code will be added to the target method. When it is set to false to add synchronization code will be added to allow the method to access other field or method of the target object. The default value is false.
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Top
Remarks

When the custom attribute is applied to a field, accesses to this field are never checked.

When the custom attribute is applied to a method, checking of accesses to all fields is disabled during the whole method execution, for the current thread.

See Also

Reference

PostSharp.Patterns.Threading Namespace

Other Resources

Conceptual: Opting In and Out From Thread Safety
Conceptual: Reader/Writer Synchronized Threading Model
Conceptual: Thread-Unsafe Threading Model


ExplicitlySynchronizedAttribute Constructor

Overload List
 | Name | Description
Public method | ExplicitlySynchronizedAttribute | Initializes a new ExplicitlySynchronizedAttribute.
Public method | ExplicitlySynchronizedAttribute(Boolean) | Initializes a new ExplicitlySynchronizedAttribute and specifies the synchronization strategy.
Top
See Also

Reference

ExplicitlySynchronizedAttribute Class
PostSharp.Patterns.Threading Namespace


ExplicitlySynchronizedAttribute Constructor

Initializes a new ExplicitlySynchronizedAttribute.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ExplicitlySynchronizedAttribute()
See Also

Reference

ExplicitlySynchronizedAttribute Class
ExplicitlySynchronizedAttribute Overload
PostSharp.Patterns.Threading Namespace


ExplicitlySynchronizedAttribute Constructor (Boolean)

Initializes a new ExplicitlySynchronizedAttribute and specifies the synchronization strategy.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ExplicitlySynchronizedAttribute(
    bool appliesToMethodOnly
)

Parameters

appliesToMethodOnly
Type: SystemBoolean
true to avoid adding any synchronization code to the target method, false to add synchronization code that allows the method to access other field or method of the target object.
See Also

Reference

ExplicitlySynchronizedAttribute Class
ExplicitlySynchronizedAttribute Overload
PostSharp.Patterns.Threading Namespace


ExplicitlySynchronizedAttribute Properties

The ExplicitlySynchronizedAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AppliesToMethodOnly | Determines the synchronization strategy. When AppliesToMethodOnly is true, no synchronization code will be added to the target method. When it is set to false to add synchronization code will be added to allow the method to access other field or method of the target object. The default value is false.
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Top
See Also

Reference

ExplicitlySynchronizedAttribute Class
PostSharp.Patterns.Threading Namespace


ExplicitlySynchronizedAttribute.AppliesToMethodOnly Property

ExplicitlySynchronizedAttributeAppliesToMethodOnly Property

Determines the synchronization strategy. When AppliesToMethodOnly is true, no synchronization code will be added to the target method. When it is set to false to add synchronization code will be added to allow the method to access other field or method of the target object. The default value is false.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool AppliesToMethodOnly { get; }

Property Value

Type: Boolean
See Also

Reference

ExplicitlySynchronizedAttribute Class
PostSharp.Patterns.Threading Namespace


FreezableAttribute Class

Custom attribute that, when applied to a class, implements the FreezableThreadingModel to this class. The aspect introduces the IFreezable interface into the target class. After the Freeze method has been invoked, the object can no longer be modified, and can therefore be safely shared between several threads.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsTypeLevelAspect
PostSharp.AspectsInstanceLevelAspect
PostSharp.Patterns.ModelAggregatableClientAttribute
PostSharp.Patterns.ThreadingThreadAwareAttribute
PostSharp.Patterns.ThreadingReadOnlyThreadAwareAttribute
PostSharp.Patterns.ThreadingFreezableAttribute

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class FreezableAttribute : ReadOnlyThreadAwareAttribute,
    IFreezable, IThreadAware

The FreezableAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | FreezableAttribute | Initializes a new instance of the FreezableAttribute class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | Instance | Gets the object to which the current aspect has been applied. (Inherited from InstanceLevelAspect.)
Public property | RuntimeVerificationEnabled | Determines whether the code should be verified against the model at runtime. The default value is true for the debug build configuration and false for the release build configuration. (Inherited from ThreadAwareAttribute.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from AggregatableClientAttribute.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from ThreadAwareAttribute.)
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype. (Inherited from InstanceLevelAspect.)
Public method | Finalize | Destructor. (Inherited from ThreadAwareAttribute.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnCloned | Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object. (Overrides InstanceLevelAspectOnCloned(ICloneAwareAspect).)
Public method | OnInstanceConstructed | Executed when the target instance gets fully initialized, i.e. just after all constructors have completed. (Inherited from AggregatableClientAttribute.)
Public method | OnSerializing | Requires read access level to the current object before serialization can proceed. This method will be introduced into the target class. (Inherited from ThreadAwareAttribute.)
Public method | RuntimeInitializeInstance | Initializes the aspect instance. This method is invoked when all system elements of the aspect (like member imports) have completed. (Inherited from ReadOnlyThreadAwareAttribute.)
Public method | ToString | Returns a string that represents the current object. (Overrides ObjectToString.)
Top
Extension Methods
 | Name | Description
Public Extension Method | AcquireAccess(ObjectAccessLevel) | Overloaded. Acquires access to given object and returns the ConcurrentAccessToken. (Defined by ThreadAwareExtensions.)
Public Extension Method | AcquireAccess(ObjectAccessLevel, ConcurrentAccessToken) | Overloaded. Acquires access for a given object and gets the ConcurrentAccessToken as a reference parameter. (Defined by ThreadAwareExtensions.)
Public Extension Method | AcquireAccessAsync | Asynchronously acquires access for a given object. (Defined by ThreadAwareExtensions.)
Top
Remarks

Accessing a freezable object from a different thread than the one that created before the Freeze method has been invoked it will result in a ThreadMismatchException.

Attempts to modify a freezable object after the Freeze method has been invoked will result in an ObjectReadOnlyException.

See Also

Reference

PostSharp.Patterns.Threading Namespace

Other Resources

Conceptual: Enumerating Child Objects (Visitor)
Conceptual: Freezable Threading Model
Conceptual: Immutable Threading Model
Conceptual: What's New in PostSharp 4.0
Conceptual: Writing Thread-Safe Code with Threading Models


FreezableAttribute Constructor

Initializes a new instance of the FreezableAttribute class

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public FreezableAttribute()
See Also

Reference

FreezableAttribute Class
PostSharp.Patterns.Threading Namespace


FreezableAttribute Properties

The FreezableAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | Instance | Gets the object to which the current aspect has been applied. (Inherited from InstanceLevelAspect.)
Public property | RuntimeVerificationEnabled | Determines whether the code should be verified against the model at runtime. The default value is true for the debug build configuration and false for the release build configuration. (Inherited from ThreadAwareAttribute.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

FreezableAttribute Class
PostSharp.Patterns.Threading Namespace


FreezableAttribute Methods

The FreezableAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from AggregatableClientAttribute.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from ThreadAwareAttribute.)
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype. (Inherited from InstanceLevelAspect.)
Public method | Finalize | Destructor. (Inherited from ThreadAwareAttribute.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnCloned | Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object. (Overrides InstanceLevelAspectOnCloned(ICloneAwareAspect).)
Public method | OnInstanceConstructed | Executed when the target instance gets fully initialized, i.e. just after all constructors have completed. (Inherited from AggregatableClientAttribute.)
Public method | OnSerializing | Requires read access level to the current object before serialization can proceed. This method will be introduced into the target class. (Inherited from ThreadAwareAttribute.)
Public method | RuntimeInitializeInstance | Initializes the aspect instance. This method is invoked when all system elements of the aspect (like member imports) have completed. (Inherited from ReadOnlyThreadAwareAttribute.)
Public method | ToString | Returns a string that represents the current object. (Overrides ObjectToString.)
Top
Extension Methods
 | Name | Description
Public Extension Method | AcquireAccess(ObjectAccessLevel) | Overloaded. Acquires access to given object and returns the ConcurrentAccessToken. (Defined by ThreadAwareExtensions.)
Public Extension Method | AcquireAccess(ObjectAccessLevel, ConcurrentAccessToken) | Overloaded. Acquires access for a given object and gets the ConcurrentAccessToken as a reference parameter. (Defined by ThreadAwareExtensions.)
Public Extension Method | AcquireAccessAsync | Asynchronously acquires access for a given object. (Defined by ThreadAwareExtensions.)
Top
See Also

Reference

FreezableAttribute Class
PostSharp.Patterns.Threading Namespace


FreezableAttribute.OnCloned Method

FreezableAttributeOnCloned Method

Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void OnCloned(
    ICloneAwareAspect source
)

Parameters

source
Type: PostSharp.AspectsICloneAwareAspect
Aspect instance corresponding to the current aspect instance in the cloned target object.

Implements

ICloneAwareAspectOnCloned(ICloneAwareAspect)
Remarks

Prior to calling the current method, the aspect framework initializes the source object using CreateInstance(AdviceArgs) and RuntimeInitializeInstance. That is, the aspect instance in the cloned object is not cloned from the source aspect instance, but from the prototype aspect instance.

See Also

Reference

FreezableAttribute Class
PostSharp.Patterns.Threading Namespace


FreezableAttribute.ToString Method

FreezableAttributeToString Method

Returns a string that represents the current object.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override string ToString()

Return Value

Type: String
A string that represents the current object.
See Also

Reference

FreezableAttribute Class
PostSharp.Patterns.Threading Namespace


IActor Interface

Interface implemented by the ActorAttribute aspect.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IActor : IDispatcherObject, IThreadAware

The IActor type exposes the following members.

Properties
 | Name | Description
Public property | ConcurrencyController | Gets the concurrency controller for the current object. (Inherited from IThreadAware.)
Public property | Dispatcher | Gets the IActorDispatcher for the current actor.
Top
Methods
 | Name | Description
Public method | OnParentControllerChanged | Notifies the object that the effective controller of it's parent has changed. The new parent controller or null. (Inherited from IThreadAware.)
Top
Extension Methods
 | Name | Description
Public Extension Method | AcquireAccess(ObjectAccessLevel) | Overloaded. Acquires access to given object and returns the ConcurrentAccessToken. (Defined by ThreadAwareExtensions.)
Public Extension Method | AcquireAccess(ObjectAccessLevel, ConcurrentAccessToken) | Overloaded. Acquires access for a given object and gets the ConcurrentAccessToken as a reference parameter. (Defined by ThreadAwareExtensions.)
Public Extension Method | AcquireAccessAsync | Asynchronously acquires access for a given object. (Defined by ThreadAwareExtensions.)
Top
Remarks
See Also

Reference

PostSharp.Patterns.Threading Namespace


IActor Properties

The IActor type exposes the following members.

Properties
 | Name | Description
Public property | ConcurrencyController | Gets the concurrency controller for the current object. (Inherited from IThreadAware.)
Public property | Dispatcher | Gets the IActorDispatcher for the current actor.
Top
See Also

Reference

IActor Interface
PostSharp.Patterns.Threading Namespace


IActor.Dispatcher Property

IActorDispatcher Property

Gets the IActorDispatcher for the current actor.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IActorDispatcher Dispatcher { get; }

Property Value

Type: IActorDispatcher
See Also

Reference

IActor Interface
PostSharp.Patterns.Threading Namespace


IActor Methods

The IActor type exposes the following members.

Methods
 | Name | Description
Public method | OnParentControllerChanged | Notifies the object that the effective controller of it's parent has changed. The new parent controller or null. (Inherited from IThreadAware.)
Top
Extension Methods
 | Name | Description
Public Extension Method | AcquireAccess(ObjectAccessLevel) | Overloaded. Acquires access to given object and returns the ConcurrentAccessToken. (Defined by ThreadAwareExtensions.)
Public Extension Method | AcquireAccess(ObjectAccessLevel, ConcurrentAccessToken) | Overloaded. Acquires access for a given object and gets the ConcurrentAccessToken as a reference parameter. (Defined by ThreadAwareExtensions.)
Public Extension Method | AcquireAccessAsync | Asynchronously acquires access for a given object. (Defined by ThreadAwareExtensions.)
Top
See Also

Reference

IActor Interface
PostSharp.Patterns.Threading Namespace


IActorController Interface

Specific definition of the IConcurrencyController for the ActorThreadingModel.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IActorController : IConcurrencyController,
    IDispatcherObject

The IActorController type exposes the following members.

Properties
 | Name | Description
Public property | Dispatcher | Gets the IActorDispatcher for the current actor.
Public property | IsReadOnly | Determines whether the entity is currently read-only. (Inherited from IConcurrencyController.)
Public property | IsSharable | Determines whether the entity can currently be accessed concurrently by several threads. (Inherited from IConcurrencyController.)
Public property | ThreadingModel | Gets the ThreadingModel implemented by the current controller. (Inherited from IConcurrencyController.)
Top
Methods
 | Name | Description
Public method | AcquireAccess | Acquires access on the entity for the current thread and waits synchronously if access cannot be immediately acquired. (Inherited from IConcurrencyController.)
Public method | AcquireAccessAsync | Asynchronously acquires access on the entity for the current thread and returns an async awaiter. (Inherited from IConcurrencyController.)
Public method | CheckAccess | Determines whether the current thread has a specified level of access to the entity. (Inherited from IConcurrencyController.)
Public method | RequireAccess | Determines whether the current thread has a specified level of access to the entity and throws an exception if not. (Inherited from IConcurrencyController.)
Top
See Also

Reference

PostSharp.Patterns.Threading Namespace


IActorController Properties

The IActorController type exposes the following members.

Properties
 | Name | Description
Public property | Dispatcher | Gets the IActorDispatcher for the current actor.
Public property | IsReadOnly | Determines whether the entity is currently read-only. (Inherited from IConcurrencyController.)
Public property | IsSharable | Determines whether the entity can currently be accessed concurrently by several threads. (Inherited from IConcurrencyController.)
Public property | ThreadingModel | Gets the ThreadingModel implemented by the current controller. (Inherited from IConcurrencyController.)
Top
See Also

Reference

IActorController Interface
PostSharp.Patterns.Threading Namespace


IActorController.Dispatcher Property

IActorControllerDispatcher Property

Gets the IActorDispatcher for the current actor.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IActorDispatcher Dispatcher { get; }

Property Value

Type: IActorDispatcher
See Also

Reference

IActorController Interface
PostSharp.Patterns.Threading Namespace


IActorController Methods

The IActorController type exposes the following members.

Methods
 | Name | Description
Public method | AcquireAccess | Acquires access on the entity for the current thread and waits synchronously if access cannot be immediately acquired. (Inherited from IConcurrencyController.)
Public method | AcquireAccessAsync | Asynchronously acquires access on the entity for the current thread and returns an async awaiter. (Inherited from IConcurrencyController.)
Public method | CheckAccess | Determines whether the current thread has a specified level of access to the entity. (Inherited from IConcurrencyController.)
Public method | RequireAccess | Determines whether the current thread has a specified level of access to the entity and throws an exception if not. (Inherited from IConcurrencyController.)
Top
See Also

Reference

IActorController Interface
PostSharp.Patterns.Threading Namespace


IActorDispatcher Interface

Augments the IDispatcher interface with an Initialize method, which is invoked after the actor constructor has been invoked.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IActorDispatcher : IDispatcher

The IActorDispatcher type exposes the following members.

Properties
 | Name | Description
Public property | IsInvokeSupported | Determines whether the Invoke(SendOrPostCallback, Object) method is supported. (Inherited from IDispatcher.)
Public property | SynchronizationContext | Gets the SynchronizationContext associated with the current dispatcher. (Inherited from IDispatcher.)
Top
Methods
 | Name | Description
Public method | BeginInvoke | Queues an action for asynchronous execution. (Inherited from IDispatcher.)
Public method | CheckAccess | Determines whether the current thread has access to the current dispatcher. (Inherited from IDispatcher.)
Public method | Initialize | Indicates that the controller should start enforcing access. Before this method is invoked, the CheckAccess method should always return true, allowing any access to the object. This mechanism allows the actor constructor to have full access on itself.
Public method | Invoke | Executes an action synchronously. (Inherited from IDispatcher.)
Top
See Also

Reference

PostSharp.Patterns.Threading Namespace


IActorDispatcher Properties

The IActorDispatcher type exposes the following members.

Properties
 | Name | Description
Public property | IsInvokeSupported | Determines whether the Invoke(SendOrPostCallback, Object) method is supported. (Inherited from IDispatcher.)
Public property | SynchronizationContext | Gets the SynchronizationContext associated with the current dispatcher. (Inherited from IDispatcher.)
Top
See Also

Reference

IActorDispatcher Interface
PostSharp.Patterns.Threading Namespace


IActorDispatcher Methods

The IActorDispatcher type exposes the following members.

Methods
 | Name | Description
Public method | BeginInvoke | Queues an action for asynchronous execution. (Inherited from IDispatcher.)
Public method | CheckAccess | Determines whether the current thread has access to the current dispatcher. (Inherited from IDispatcher.)
Public method | Initialize | Indicates that the controller should start enforcing access. Before this method is invoked, the CheckAccess method should always return true, allowing any access to the object. This mechanism allows the actor constructor to have full access on itself.
Public method | Invoke | Executes an action synchronously. (Inherited from IDispatcher.)
Top
See Also

Reference

IActorDispatcher Interface
PostSharp.Patterns.Threading Namespace


IActorDispatcher.Initialize Method

IActorDispatcherInitialize Method

Indicates that the controller should start enforcing access. Before this method is invoked, the CheckAccess method should always return true, allowing any access to the object. This mechanism allows the actor constructor to have full access on itself.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void Initialize()
See Also

Reference

IActorDispatcher Interface
PostSharp.Patterns.Threading Namespace


IConcurrencyController Interface

Controls access to an entity from possibly several threads.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IConcurrencyController

The IConcurrencyController type exposes the following members.

Properties
 | Name | Description
Public property | IsReadOnly | Determines whether the entity is currently read-only.
Public property | IsSharable | Determines whether the entity can currently be accessed concurrently by several threads.
Public property | ThreadingModel | Gets the ThreadingModel implemented by the current controller.
Top
Methods
 | Name | Description
Public method | AcquireAccess | Acquires access on the entity for the current thread and waits synchronously if access cannot be immediately acquired.
Public method | AcquireAccessAsync | Asynchronously acquires access on the entity for the current thread and returns an async awaiter.
Public method | CheckAccess | Determines whether the current thread has a specified level of access to the entity.
Public method | RequireAccess | Determines whether the current thread has a specified level of access to the entity and throws an exception if not.
Top
Remarks

An entity, for the sake of this documentation article, is a group of objects that share the same concurrency controller.

Objects that are controlled by a concurrency controller implement the IThreadAware interface.

See Also

Reference

PostSharp.Patterns.Threading Namespace


IConcurrencyController Properties

The IConcurrencyController type exposes the following members.

Properties
 | Name | Description
Public property | IsReadOnly | Determines whether the entity is currently read-only.
Public property | IsSharable | Determines whether the entity can currently be accessed concurrently by several threads.
Public property | ThreadingModel | Gets the ThreadingModel implemented by the current controller.
Top
See Also

Reference

IConcurrencyController Interface
PostSharp.Patterns.Threading Namespace


IConcurrencyController.IsReadOnly Property

IConcurrencyControllerIsReadOnly Property

Determines whether the entity is currently read-only.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
bool IsReadOnly { get; }

Property Value

Type: Boolean
See Also

Reference

IConcurrencyController Interface
PostSharp.Patterns.Threading Namespace

Other Resources

Conceptual: Freezable Threading Model


IConcurrencyController.IsSharable Property

IConcurrencyControllerIsSharable Property

Determines whether the entity can currently be accessed concurrently by several threads.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
bool IsSharable { get; }

Property Value

Type: Boolean
See Also

Reference

IConcurrencyController Interface
PostSharp.Patterns.Threading Namespace


IConcurrencyController.ThreadingModel Property

IConcurrencyControllerThreadingModel Property

Gets the ThreadingModel implemented by the current controller.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
ThreadingModel ThreadingModel { get; }

Property Value

Type: ThreadingModel
See Also

Reference

IConcurrencyController Interface
PostSharp.Patterns.Threading Namespace


IConcurrencyController Methods

The IConcurrencyController type exposes the following members.

Methods
 | Name | Description
Public method | AcquireAccess | Acquires access on the entity for the current thread and waits synchronously if access cannot be immediately acquired.
Public method | AcquireAccessAsync | Asynchronously acquires access on the entity for the current thread and returns an async awaiter.
Public method | CheckAccess | Determines whether the current thread has a specified level of access to the entity.
Public method | RequireAccess | Determines whether the current thread has a specified level of access to the entity and throws an exception if not.
Top
See Also

Reference

IConcurrencyController Interface
PostSharp.Patterns.Threading Namespace


IConcurrencyController.AcquireAccess Method

IConcurrencyControllerAcquireAccess Method

Acquires access on the entity for the current thread and waits synchronously if access cannot be immediately acquired.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void AcquireAccess(
    ObjectAccessLevel objectAccessLevel,
    ref ConcurrentAccessToken concurrencyAccessToken
)

Parameters

objectAccessLevel
Type: PostSharp.Patterns.ModelObjectAccessLevel
The required access level on the entity.
concurrencyAccessToken
Type: PostSharp.Patterns.ThreadingConcurrentAccessToken
An opaque ConcurrentAccessToken, typically used in a using block. Consumers must invoke the Complete method upon success before exiting the using block.
Remarks

When you are using this method through the expression threadAware.ConcurrentController.AcquireAccess, there may be a race condition during the evaluation of the expression. Use the AcquireAccess(IThreadAware, ObjectAccessLevel) extension method to acquire access to a thread-aware object in a thread-safe manner.

See Also

Reference

IConcurrencyController Interface
PostSharp.Patterns.Threading Namespace


IConcurrencyController.AcquireAccessAsync Method

IConcurrencyControllerAcquireAccessAsync Method

Asynchronously acquires access on the entity for the current thread and returns an async awaiter.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
ConcurrentAccessAwaiter AcquireAccessAsync(
    ObjectAccessLevel objectAccessLevel
)

Parameters

objectAccessLevel
Type: PostSharp.Patterns.ModelObjectAccessLevel
The required access level on the entity.

Return Value

Type: ConcurrentAccessAwaiter
a ConcurrentAccessAwaiter compatible with the await keyword, and evaluating to an opaque ConcurrentAccessToken typically used in a using block. Consumers must invoke the Complete method upon success before exiting the using block.
Remarks

When you are using this method through the expression threadAware.ConcurrentController.AcquireAccess, there may be a race condition during the evaluation of the expression. Use the AcquireAccessAsync(IThreadAware, ObjectAccessLevel) extension method to acquire access to a thread-aware object in a thread-safe manner.

See Also

Reference

IConcurrencyController Interface
PostSharp.Patterns.Threading Namespace


IConcurrencyController.CheckAccess Method

IConcurrencyControllerCheckAccess Method

Determines whether the current thread has a specified level of access to the entity.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
bool CheckAccess(
    ObjectAccessLevel objectAccessLevel
)

Parameters

objectAccessLevel
Type: PostSharp.Patterns.ModelObjectAccessLevel
The required access level on the entity.

Return Value

Type: Boolean
true if the current thread has the required level of access, otherwise false.
See Also

Reference

IConcurrencyController Interface
PostSharp.Patterns.Threading Namespace


IConcurrencyController.RequireAccess Method

IConcurrencyControllerRequireAccess Method

Determines whether the current thread has a specified level of access to the entity and throws an exception if not.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void RequireAccess(
    ObjectAccessLevel objectAccessLevel
)

Parameters

objectAccessLevel
Type: PostSharp.Patterns.ModelObjectAccessLevel
The required access level on the entity.
See Also

Reference

IConcurrencyController Interface
PostSharp.Patterns.Threading Namespace


IDispatcher Interface

Defines the semantics of a facility that executes actions synchronously or asynchronously, possibly on a different thread.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IDispatcher

The IDispatcher type exposes the following members.

Properties
 | Name | Description
Public property | IsInvokeSupported | Determines whether the Invoke(SendOrPostCallback, Object) method is supported.
Public property | SynchronizationContext | Gets the SynchronizationContext associated with the current dispatcher.
Top
Methods
 | Name | Description
Public method | BeginInvoke | Queues an action for asynchronous execution.
Public method | CheckAccess | Determines whether the current thread has access to the current dispatcher.
Public method | Invoke | Executes an action synchronously.
Top
Remarks

Use the DispatcherFactory class to get implementations of this interface. You can also create a custom implementation.

See Also

Reference

PostSharp.Patterns.Threading Namespace
PostSharp.Patterns.ThreadingIDispatcherObject
PostSharp.Patterns.ThreadingDispatcherFactory


IDispatcher Properties

The IDispatcher type exposes the following members.

Properties
 | Name | Description
Public property | IsInvokeSupported | Determines whether the Invoke(SendOrPostCallback, Object) method is supported.
Public property | SynchronizationContext | Gets the SynchronizationContext associated with the current dispatcher.
Top
See Also

Reference

IDispatcher Interface
PostSharp.Patterns.Threading Namespace


IDispatcher.IsInvokeSupported Property

IDispatcherIsInvokeSupported Property

Determines whether the Invoke(SendOrPostCallback, Object) method is supported.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
bool IsInvokeSupported { get; }

Property Value

Type: Boolean
Remarks
If false, the dispatcher only supports asynchronous invocation (BeginInvoke(SendOrPostCallback, Object)).
See Also

Reference

IDispatcher Interface
PostSharp.Patterns.Threading Namespace


IDispatcher.SynchronizationContext Property

IDispatcherSynchronizationContext Property

Gets the SynchronizationContext associated with the current dispatcher.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
SynchronizationContext SynchronizationContext { get; }

Property Value

Type: SynchronizationContext
See Also

Reference

IDispatcher Interface
PostSharp.Patterns.Threading Namespace


IDispatcher Methods

The IDispatcher type exposes the following members.

Methods
 | Name | Description
Public method | BeginInvoke | Queues an action for asynchronous execution.
Public method | CheckAccess | Determines whether the current thread has access to the current dispatcher.
Public method | Invoke | Executes an action synchronously.
Top
See Also

Reference

IDispatcher Interface
PostSharp.Patterns.Threading Namespace


IDispatcher.BeginInvoke Method

IDispatcherBeginInvoke Method

Queues an action for asynchronous execution.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void BeginInvoke(
    SendOrPostCallback action,
    Object state
)

Parameters

action
Type: System.ThreadingSendOrPostCallback
Action to be executed.
state
Type: SystemObject
Parameter passed to action
See Also

Reference

IDispatcher Interface
PostSharp.Patterns.Threading Namespace


IDispatcher.CheckAccess Method

IDispatcherCheckAccess Method

Determines whether the current thread has access to the current dispatcher.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
bool CheckAccess()

Return Value

Type: Boolean
true if the current thread can directly call methods of objects protected by the current dispatcher, or false if methods Invoke(SendOrPostCallback, Object) or BeginInvoke(SendOrPostCallback, Object) must be used.
See Also

Reference

IDispatcher Interface
PostSharp.Patterns.Threading Namespace


IDispatcher.Invoke Method

IDispatcherInvoke Method

Executes an action synchronously.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void Invoke(
    SendOrPostCallback action,
    Object state
)

Parameters

action
Type: System.ThreadingSendOrPostCallback
Action to be executed.
state
Type: SystemObject
Parameter passed to action.
See Also

Reference

IDispatcher Interface
PostSharp.Patterns.Threading Namespace


IDispatcherObject Interface

Interface implemented by objects that are whose access to methods is being controlled by a Dispatcher.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IDispatcherObject

The IDispatcherObject type exposes the following members.

Properties
 | Name | Description
Public property | Dispatcher | Gets the IDispatcher that controls access to methods of the current object.
Top
Remarks

If you need to implement the IDispatcherObject interface in a class, consider using the DispatcherFactory class to get an implementation of the IDispatcher interface in your instance constructor.

See Also

Reference

PostSharp.Patterns.Threading Namespace
PostSharp.Patterns.ThreadingDispatcherFactory


IDispatcherObject Properties

The IDispatcherObject type exposes the following members.

Properties
 | Name | Description
Public property | Dispatcher | Gets the IDispatcher that controls access to methods of the current object.
Top
See Also

Reference

IDispatcherObject Interface
PostSharp.Patterns.Threading Namespace


IDispatcherObject.Dispatcher Property

IDispatcherObjectDispatcher Property

Gets the IDispatcher that controls access to methods of the current object.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IDispatcher Dispatcher { get; }

Property Value

Type: IDispatcher
See Also

Reference

IDispatcherObject Interface
PostSharp.Patterns.Threading Namespace


IFreezable Interface

Interface implemented by the FreezableAttribute aspect. Defines a Freeze method.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IFreezable : IThreadAware

The IFreezable type exposes the following members.

Properties
 | Name | Description
Public property | ConcurrencyController | Gets the concurrency controller for the current object. (Inherited from IThreadAware.)
Top
Methods
 | Name | Description
Public method | Freeze | Prevents the current object to be modified.
Public method | OnParentControllerChanged | Notifies the object that the effective controller of it's parent has changed. The new parent controller or null. (Inherited from IThreadAware.)
Top
Extension Methods
 | Name | Description
Public Extension Method | AcquireAccess(ObjectAccessLevel) | Overloaded. Acquires access to given object and returns the ConcurrentAccessToken. (Defined by ThreadAwareExtensions.)
Public Extension Method | AcquireAccess(ObjectAccessLevel, ConcurrentAccessToken) | Overloaded. Acquires access for a given object and gets the ConcurrentAccessToken as a reference parameter. (Defined by ThreadAwareExtensions.)
Public Extension Method | AcquireAccessAsync | Asynchronously acquires access for a given object. (Defined by ThreadAwareExtensions.)
Top
Remarks

To determine whether the object has been frozen, use the IsReadOnly property of the ConcurrencyController of this object.

See Also

Reference

PostSharp.Patterns.Threading Namespace

Other Resources

Conceptual: Freezable Threading Model


IFreezable Properties

The IFreezable type exposes the following members.

Properties
 | Name | Description
Public property | ConcurrencyController | Gets the concurrency controller for the current object. (Inherited from IThreadAware.)
Top
See Also

Reference

IFreezable Interface
PostSharp.Patterns.Threading Namespace


IFreezable Methods

The IFreezable type exposes the following members.

Methods
 | Name | Description
Public method | Freeze | Prevents the current object to be modified.
Public method | OnParentControllerChanged | Notifies the object that the effective controller of it's parent has changed. The new parent controller or null. (Inherited from IThreadAware.)
Top
Extension Methods
 | Name | Description
Public Extension Method | AcquireAccess(ObjectAccessLevel) | Overloaded. Acquires access to given object and returns the ConcurrentAccessToken. (Defined by ThreadAwareExtensions.)
Public Extension Method | AcquireAccess(ObjectAccessLevel, ConcurrentAccessToken) | Overloaded. Acquires access for a given object and gets the ConcurrentAccessToken as a reference parameter. (Defined by ThreadAwareExtensions.)
Public Extension Method | AcquireAccessAsync | Asynchronously acquires access for a given object. (Defined by ThreadAwareExtensions.)
Top
See Also

Reference

IFreezable Interface
PostSharp.Patterns.Threading Namespace


IFreezable.Freeze Method

IFreezableFreeze Method

Prevents the current object to be modified.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void Freeze()
See Also

Reference

IFreezable Interface
PostSharp.Patterns.Threading Namespace

Other Resources

Conceptual: Freezable Threading Model


IImmutable Interface

Interface implemented by the ImmutableAttribute aspect.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IImmutable : IThreadAware

The IImmutable type exposes the following members.

Properties
 | Name | Description
Public property | ConcurrencyController | Gets the concurrency controller for the current object. (Inherited from IThreadAware.)
Top
Methods
 | Name | Description
Public method | OnParentControllerChanged | Notifies the object that the effective controller of it's parent has changed. The new parent controller or null. (Inherited from IThreadAware.)
Top
Extension Methods
 | Name | Description
Public Extension Method | AcquireAccess(ObjectAccessLevel) | Overloaded. Acquires access to given object and returns the ConcurrentAccessToken. (Defined by ThreadAwareExtensions.)
Public Extension Method | AcquireAccess(ObjectAccessLevel, ConcurrentAccessToken) | Overloaded. Acquires access for a given object and gets the ConcurrentAccessToken as a reference parameter. (Defined by ThreadAwareExtensions.)
Public Extension Method | AcquireAccessAsync | Asynchronously acquires access for a given object. (Defined by ThreadAwareExtensions.)
Top
See Also

Reference

PostSharp.Patterns.Threading Namespace


IImmutable Properties

The IImmutable type exposes the following members.

Properties
 | Name | Description
Public property | ConcurrencyController | Gets the concurrency controller for the current object. (Inherited from IThreadAware.)
Top
See Also

Reference

IImmutable Interface
PostSharp.Patterns.Threading Namespace


IImmutable Methods

The IImmutable type exposes the following members.

Methods
 | Name | Description
Public method | OnParentControllerChanged | Notifies the object that the effective controller of it's parent has changed. The new parent controller or null. (Inherited from IThreadAware.)
Top
Extension Methods
 | Name | Description
Public Extension Method | AcquireAccess(ObjectAccessLevel) | Overloaded. Acquires access to given object and returns the ConcurrentAccessToken. (Defined by ThreadAwareExtensions.)
Public Extension Method | AcquireAccess(ObjectAccessLevel, ConcurrentAccessToken) | Overloaded. Acquires access for a given object and gets the ConcurrentAccessToken as a reference parameter. (Defined by ThreadAwareExtensions.)
Public Extension Method | AcquireAccessAsync | Asynchronously acquires access for a given object. (Defined by ThreadAwareExtensions.)
Top
See Also

Reference

IImmutable Interface
PostSharp.Patterns.Threading Namespace


ImmutableAttribute Class

Custom attribute that, when applied to a class, implements the ImmutableThreadingModel to this class. The aspect introduces the IImmutable interface into the target class. Immutable objects cannot be modified after the constructor exits.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsTypeLevelAspect
PostSharp.AspectsInstanceLevelAspect
PostSharp.Patterns.ModelAggregatableClientAttribute
PostSharp.Patterns.ThreadingThreadAwareAttribute
PostSharp.Patterns.ThreadingReadOnlyThreadAwareAttribute
PostSharp.Patterns.ThreadingImmutableAttribute

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ImmutableAttribute : ReadOnlyThreadAwareAttribute,
    IImmutable, IThreadAware

The ImmutableAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | ImmutableAttribute | Initializes a new instance of the ImmutableAttribute class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | Instance | Gets the object to which the current aspect has been applied. (Inherited from InstanceLevelAspect.)
Public property | RuntimeVerificationEnabled | Determines whether the code should be verified against the model at runtime. The default value is true for the debug build configuration and false for the release build configuration. (Inherited from ThreadAwareAttribute.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from AggregatableClientAttribute.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from ThreadAwareAttribute.)
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype. (Inherited from InstanceLevelAspect.)
Public method | Finalize | Destructor. (Inherited from ThreadAwareAttribute.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnCloned | Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object. (Inherited from InstanceLevelAspect.)
Public method | OnInstanceConstructed | Executed when the target instance gets fully initialized, i.e. just after all constructors have completed. (Overrides AggregatableClientAttributeOnInstanceConstructed.)
Public method | OnSerializing | Requires read access level to the current object before serialization can proceed. This method will be introduced into the target class. (Inherited from ThreadAwareAttribute.)
Public method | RuntimeInitializeInstance | Initializes the aspect instance. This method is invoked when all system elements of the aspect (like member imports) have completed. (Inherited from ReadOnlyThreadAwareAttribute.)
Top
Extension Methods
 | Name | Description
Public Extension Method | AcquireAccess(ObjectAccessLevel) | Overloaded. Acquires access to given object and returns the ConcurrentAccessToken. (Defined by ThreadAwareExtensions.)
Public Extension Method | AcquireAccess(ObjectAccessLevel, ConcurrentAccessToken) | Overloaded. Acquires access for a given object and gets the ConcurrentAccessToken as a reference parameter. (Defined by ThreadAwareExtensions.)
Public Extension Method | AcquireAccessAsync | Asynchronously acquires access for a given object. (Defined by ThreadAwareExtensions.)
Top
See Also

Reference

PostSharp.Patterns.Threading Namespace

Other Resources

Conceptual: Enumerating Child Objects (Visitor)
Conceptual: Freezable Threading Model
Conceptual: Immutable Threading Model
Conceptual: What's New in PostSharp 4.0
Conceptual: Writing Thread-Safe Code with Threading Models


ImmutableAttribute Constructor

Initializes a new instance of the ImmutableAttribute class

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ImmutableAttribute()
See Also

Reference

ImmutableAttribute Class
PostSharp.Patterns.Threading Namespace


ImmutableAttribute Properties

The ImmutableAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | Instance | Gets the object to which the current aspect has been applied. (Inherited from InstanceLevelAspect.)
Public property | RuntimeVerificationEnabled | Determines whether the code should be verified against the model at runtime. The default value is true for the debug build configuration and false for the release build configuration. (Inherited from ThreadAwareAttribute.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

ImmutableAttribute Class
PostSharp.Patterns.Threading Namespace


ImmutableAttribute Methods

The ImmutableAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from AggregatableClientAttribute.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from ThreadAwareAttribute.)
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype. (Inherited from InstanceLevelAspect.)
Public method | Finalize | Destructor. (Inherited from ThreadAwareAttribute.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnCloned | Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object. (Inherited from InstanceLevelAspect.)
Public method | OnInstanceConstructed | Executed when the target instance gets fully initialized, i.e. just after all constructors have completed. (Overrides AggregatableClientAttributeOnInstanceConstructed.)
Public method | OnSerializing | Requires read access level to the current object before serialization can proceed. This method will be introduced into the target class. (Inherited from ThreadAwareAttribute.)
Public method | RuntimeInitializeInstance | Initializes the aspect instance. This method is invoked when all system elements of the aspect (like member imports) have completed. (Inherited from ReadOnlyThreadAwareAttribute.)
Top
Extension Methods
 | Name | Description
Public Extension Method | AcquireAccess(ObjectAccessLevel) | Overloaded. Acquires access to given object and returns the ConcurrentAccessToken. (Defined by ThreadAwareExtensions.)
Public Extension Method | AcquireAccess(ObjectAccessLevel, ConcurrentAccessToken) | Overloaded. Acquires access for a given object and gets the ConcurrentAccessToken as a reference parameter. (Defined by ThreadAwareExtensions.)
Public Extension Method | AcquireAccessAsync | Asynchronously acquires access for a given object. (Defined by ThreadAwareExtensions.)
Top
See Also

Reference

ImmutableAttribute Class
PostSharp.Patterns.Threading Namespace


ImmutableAttribute.OnInstanceConstructed Method

ImmutableAttributeOnInstanceConstructed Method

Executed when the target instance gets fully initialized, i.e. just after all constructors have completed.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void OnInstanceConstructed()
See Also

Reference

ImmutableAttribute Class
PostSharp.Patterns.Threading Namespace


IThreadAware Interface

Interface implemented by objects that are aware of concurrency. Access to thread-aware objects is controlled by a concurrency controller (IConcurrencyController). Any aspect implementing a threading model (ThreadAwareObjectAttribute) introduces this interface to the target class and ensures that accesses to this class go through the controller.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IThreadAware

The IThreadAware type exposes the following members.

Properties
 | Name | Description
Public property | ConcurrencyController | Gets the concurrency controller for the current object.
Top
Methods
 | Name | Description
Public method | OnParentControllerChanged | Notifies the object that the effective controller of it's parent has changed. The new parent controller or null.
Top
Extension Methods
 | Name | Description
Public Extension Method | AcquireAccess(ObjectAccessLevel) | Overloaded. Acquires access to given object and returns the ConcurrentAccessToken. (Defined by ThreadAwareExtensions.)
Public Extension Method | AcquireAccess(ObjectAccessLevel, ConcurrentAccessToken) | Overloaded. Acquires access for a given object and gets the ConcurrentAccessToken as a reference parameter. (Defined by ThreadAwareExtensions.)
Public Extension Method | AcquireAccessAsync | Asynchronously acquires access for a given object. (Defined by ThreadAwareExtensions.)
Top
Remarks

Thread-aware does not thread-safe. Check the IsSharable property of ConcurrencyController to check if the current object can be shared between different threads.

See Also

Reference

PostSharp.Patterns.Threading Namespace

Other Resources

Conceptual: Freezable Threading Model
Conceptual: Working With Child Collections


IThreadAware Properties

The IThreadAware type exposes the following members.

Properties
 | Name | Description
Public property | ConcurrencyController | Gets the concurrency controller for the current object.
Top
See Also

Reference

IThreadAware Interface
PostSharp.Patterns.Threading Namespace


IThreadAware.ConcurrencyController Property

IThreadAwareConcurrencyController Property

Gets the concurrency controller for the current object.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IConcurrencyController ConcurrencyController { get; }

Property Value

Type: IConcurrencyController
See Also

Reference

IThreadAware Interface
PostSharp.Patterns.Threading Namespace

Other Resources

Conceptual: Freezable Threading Model


IThreadAware Methods

The IThreadAware type exposes the following members.

Methods
 | Name | Description
Public method | OnParentControllerChanged | Notifies the object that the effective controller of it's parent has changed. The new parent controller or null.
Top
Extension Methods
 | Name | Description
Public Extension Method | AcquireAccess(ObjectAccessLevel) | Overloaded. Acquires access to given object and returns the ConcurrentAccessToken. (Defined by ThreadAwareExtensions.)
Public Extension Method | AcquireAccess(ObjectAccessLevel, ConcurrentAccessToken) | Overloaded. Acquires access for a given object and gets the ConcurrentAccessToken as a reference parameter. (Defined by ThreadAwareExtensions.)
Public Extension Method | AcquireAccessAsync | Asynchronously acquires access for a given object. (Defined by ThreadAwareExtensions.)
Top
See Also

Reference

IThreadAware Interface
PostSharp.Patterns.Threading Namespace


IThreadAware.OnParentControllerChanged Method

IThreadAwareOnParentControllerChanged Method

Notifies the object that the effective controller of it's parent has changed. The new parent controller or null.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void OnParentControllerChanged(
    IConcurrencyController parentController
)

Parameters

parentController
Type: PostSharp.Patterns.ThreadingIConcurrencyController
See Also

Reference

IThreadAware Interface
PostSharp.Patterns.Threading Namespace


ObjectReadOnlyException Class

Exception thrown by objects that have the FreezableThreadingModel or ImmutableThreadingModel when an attempt is made to modify the object after it has been made read-only.
Inheritance Hierarchy
SystemObject
SystemException
PostSharp.Patterns.ThreadingObjectReadOnlyException

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public sealed class ObjectReadOnlyException : Exception
Constructors
 | Name | Description
Public method | ObjectReadOnlyException | Initializes a new instance of the ObjectReadOnlyException class with the default error message.
Public method | ObjectReadOnlyException(String) | Initializes a new instance of the ObjectReadOnlyException class with a given error message.
Public method | ObjectReadOnlyException(String, Exception) | Initializes a new instance of the ObjectReadOnlyException class with a given error message and inner exception.
Top
See Also

Reference

PostSharp.Patterns.Threading Namespace

Other Resources

Conceptual: Freezable Threading Model
Conceptual: Immutable Threading Model


ObjectReadOnlyException Constructor

Overload List
 | Name | Description
Public method | ObjectReadOnlyException | Initializes a new instance of the ObjectReadOnlyException class with the default error message.
Public method | ObjectReadOnlyException(String) | Initializes a new instance of the ObjectReadOnlyException class with a given error message.
Public method | ObjectReadOnlyException(String, Exception) | Initializes a new instance of the ObjectReadOnlyException class with a given error message and inner exception.
Top
See Also

Reference

ObjectReadOnlyException Class
PostSharp.Patterns.Threading Namespace


ObjectReadOnlyException Constructor

Initializes a new instance of the ObjectReadOnlyException class with the default error message.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ObjectReadOnlyException()
See Also

Reference

ObjectReadOnlyException Class
ObjectReadOnlyException Overload
PostSharp.Patterns.Threading Namespace


ObjectReadOnlyException Constructor (String)

Initializes a new instance of the ObjectReadOnlyException class with a given error message.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ObjectReadOnlyException(
    string message
)

Parameters

message
Type: SystemString
The error message.
See Also

Reference

ObjectReadOnlyException Class
ObjectReadOnlyException Overload
PostSharp.Patterns.Threading Namespace


ObjectReadOnlyException Constructor (String, Exception)

Initializes a new instance of the ObjectReadOnlyException class with a given error message and inner exception.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ObjectReadOnlyException(
    string message,
    Exception inner
)

Parameters

message
Type: SystemString
The inner message.
inner
Type: SystemException
The exception wrapped by the new ObjectReadOnlyException.
See Also

Reference

ObjectReadOnlyException Class
ObjectReadOnlyException Overload
PostSharp.Patterns.Threading Namespace


PrivateThreadAwareAttribute Class

Custom attribute that, when applied to a class, implement the PrivateThreadingModel into this class, in which the threading model of an object is determined by the parent it is assigned to in a parent-child relationship.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsTypeLevelAspect
PostSharp.AspectsInstanceLevelAspect
PostSharp.Patterns.ModelAggregatableClientAttribute
PostSharp.Patterns.ThreadingThreadAwareAttribute
PostSharp.Patterns.ThreadingPrivateThreadAwareAttribute

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class PrivateThreadAwareAttribute : ThreadAwareAttribute

The PrivateThreadAwareAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | PrivateThreadAwareAttribute | Initializes a new instance of the PrivateThreadAwareAttribute class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | Instance | Gets the object to which the current aspect has been applied. (Inherited from InstanceLevelAspect.)
Public property | RuntimeVerificationEnabled | Determines whether the code should be verified against the model at runtime. The default value is true for the debug build configuration and false for the release build configuration. (Inherited from ThreadAwareAttribute.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from AggregatableClientAttribute.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from ThreadAwareAttribute.)
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype. (Inherited from InstanceLevelAspect.)
Public method | Finalize | Destructor. (Inherited from ThreadAwareAttribute.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnCloned | Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object. (Inherited from InstanceLevelAspect.)
Public method | OnInstanceConstructed | Executed when the target instance gets fully initialized, i.e. just after all constructors have completed. (Inherited from AggregatableClientAttribute.)
Public method | OnSerializing | Requires read access level to the current object before serialization can proceed. This method will be introduced into the target class. (Inherited from ThreadAwareAttribute.)
Top
See Also

Reference

PostSharp.Patterns.Threading Namespace

Other Resources

Conceptual: Actor Threading Model
Conceptual: Synchronized Threading Model
Conceptual: Thread Affine Threading Model


PrivateThreadAwareAttribute Constructor

Initializes a new instance of the PrivateThreadAwareAttribute class

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public PrivateThreadAwareAttribute()
See Also

Reference

PrivateThreadAwareAttribute Class
PostSharp.Patterns.Threading Namespace


PrivateThreadAwareAttribute Properties

The PrivateThreadAwareAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | Instance | Gets the object to which the current aspect has been applied. (Inherited from InstanceLevelAspect.)
Public property | RuntimeVerificationEnabled | Determines whether the code should be verified against the model at runtime. The default value is true for the debug build configuration and false for the release build configuration. (Inherited from ThreadAwareAttribute.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

PrivateThreadAwareAttribute Class
PostSharp.Patterns.Threading Namespace


PrivateThreadAwareAttribute Methods

The PrivateThreadAwareAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from AggregatableClientAttribute.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from ThreadAwareAttribute.)
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype. (Inherited from InstanceLevelAspect.)
Public method | Finalize | Destructor. (Inherited from ThreadAwareAttribute.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnCloned | Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object. (Inherited from InstanceLevelAspect.)
Public method | OnInstanceConstructed | Executed when the target instance gets fully initialized, i.e. just after all constructors have completed. (Inherited from AggregatableClientAttribute.)
Public method | OnSerializing | Requires read access level to the current object before serialization can proceed. This method will be introduced into the target class. (Inherited from ThreadAwareAttribute.)
Top
See Also

Reference

PrivateThreadAwareAttribute Class
PostSharp.Patterns.Threading Namespace


ReaderAttribute Class

Custom attribute that, when applied on a method, specifies that the method requires read access to the object.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.Patterns.ThreadingAccessLevelAttribute
PostSharp.Patterns.ThreadingReaderAttribute

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class ReaderAttribute : AccessLevelAttribute

The ReaderAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | ReaderAttribute | Initializes a new instance of the ReaderAttribute class
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Top
See Also

Reference

PostSharp.Patterns.Threading Namespace
PostSharp.Patterns.ThreadingWriterAttribute
PostSharp.Patterns.ThreadingUpgradeableReaderAttribute
PostSharp.Patterns.ThreadingYielderAttribute

Other Resources

Conceptual: Reader/Writer Synchronized Threading Model


ReaderAttribute Constructor

Initializes a new instance of the ReaderAttribute class

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ReaderAttribute()
See Also

Reference

ReaderAttribute Class
PostSharp.Patterns.Threading Namespace


ReaderAttribute Properties

The ReaderAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Top
See Also

Reference

ReaderAttribute Class
PostSharp.Patterns.Threading Namespace


ReaderWriterSynchronizedAttribute Class

Custom attribute that, when applied on a class, applies the ReaderWriterSynchronizedThreadingModel model to this class and all derived class. Members of this class must then be annotated with attributes specifying the required access level (ReaderAttribute, WriterAttribute, YielderAttribute or UpgradeableReaderAttribute), otherwise build-time and run-time errors are emitted.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsTypeLevelAspect
PostSharp.AspectsInstanceLevelAspect
PostSharp.Patterns.ModelAggregatableClientAttribute
PostSharp.Patterns.ThreadingThreadAwareAttribute
PostSharp.Patterns.ThreadingReaderWriterSynchronizedAttribute

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ReaderWriterSynchronizedAttribute : ThreadAwareAttribute

The ReaderWriterSynchronizedAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | ReaderWriterSynchronizedAttribute | Initializes a new instance of the ReaderWriterSynchronizedAttribute class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | Instance | Gets the object to which the current aspect has been applied. (Inherited from InstanceLevelAspect.)
Public property | RuntimeVerificationEnabled | Determines whether the code should be verified against the model at runtime. The default value is true for the debug build configuration and false for the release build configuration. (Inherited from ThreadAwareAttribute.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from AggregatableClientAttribute.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from ThreadAwareAttribute.)
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype. (Inherited from InstanceLevelAspect.)
Public method | Finalize | Destructor. (Inherited from ThreadAwareAttribute.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnCloned | Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object. (Inherited from InstanceLevelAspect.)
Public method | OnInstanceConstructed | Executed when the target instance gets fully initialized, i.e. just after all constructors have completed. (Inherited from AggregatableClientAttribute.)
Public method | OnSerializing | Requires read access level to the current object before serialization can proceed. This method will be introduced into the target class. (Inherited from ThreadAwareAttribute.)
Top
See Also

Reference

PostSharp.Patterns.Threading Namespace

Other Resources

Conceptual: Opting In and Out From Thread Safety
Conceptual: Reader/Writer Synchronized Threading Model
Conceptual: What's New in PostSharp 3.0
Conceptual: Writing Thread-Safe Code with Threading Models


ReaderWriterSynchronizedAttribute Constructor

Initializes a new instance of the ReaderWriterSynchronizedAttribute class

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ReaderWriterSynchronizedAttribute()
See Also

Reference

ReaderWriterSynchronizedAttribute Class
PostSharp.Patterns.Threading Namespace


ReaderWriterSynchronizedAttribute Properties

The ReaderWriterSynchronizedAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | Instance | Gets the object to which the current aspect has been applied. (Inherited from InstanceLevelAspect.)
Public property | RuntimeVerificationEnabled | Determines whether the code should be verified against the model at runtime. The default value is true for the debug build configuration and false for the release build configuration. (Inherited from ThreadAwareAttribute.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

ReaderWriterSynchronizedAttribute Class
PostSharp.Patterns.Threading Namespace


ReaderWriterSynchronizedAttribute Methods

The ReaderWriterSynchronizedAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from AggregatableClientAttribute.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from ThreadAwareAttribute.)
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype. (Inherited from InstanceLevelAspect.)
Public method | Finalize | Destructor. (Inherited from ThreadAwareAttribute.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnCloned | Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object. (Inherited from InstanceLevelAspect.)
Public method | OnInstanceConstructed | Executed when the target instance gets fully initialized, i.e. just after all constructors have completed. (Inherited from AggregatableClientAttribute.)
Public method | OnSerializing | Requires read access level to the current object before serialization can proceed. This method will be introduced into the target class. (Inherited from ThreadAwareAttribute.)
Top
See Also

Reference

ReaderWriterSynchronizedAttribute Class
PostSharp.Patterns.Threading Namespace


ReadOnlyThreadAwareAttribute Class

Base class for aspects FreezableAttribute and ImmutableAttribute.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsTypeLevelAspect
PostSharp.AspectsInstanceLevelAspect
PostSharp.Patterns.ModelAggregatableClientAttribute
PostSharp.Patterns.ThreadingThreadAwareAttribute
PostSharp.Patterns.ThreadingReadOnlyThreadAwareAttribute
PostSharp.Patterns.ThreadingFreezableAttribute
PostSharp.Patterns.ThreadingImmutableAttribute

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class ReadOnlyThreadAwareAttribute : ThreadAwareAttribute,
    IConcurrencyController

The ReadOnlyThreadAwareAttribute type exposes the following members.

Constructors
 | Name | Description
Protected method | ReadOnlyThreadAwareAttribute | Initializes a new instance of the ReadOnlyThreadAwareAttribute class
Top
Properties
 | Name | Description
Protected property | AppliedToCurrentType | Determines if the current custom attribute instance has been applied to the type of the target instance. This value is false if the custom attribute has been applied to a base type. (Inherited from AggregatableClientAttribute.)
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | InitializationStatus | Gets the current AggregatableClientAttributeAspectInitializationStatus of the current aspect. (Inherited from AggregatableClientAttribute.)
Public property | Instance | Gets the object to which the current aspect has been applied. (Inherited from InstanceLevelAspect.)
Public property | RuntimeVerificationEnabled | Determines whether the code should be verified against the model at runtime. The default value is true for the debug build configuration and false for the release build configuration. (Inherited from ThreadAwareAttribute.)
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Protected method | Advise | Injects the advice into the child object. (Overrides ThreadAwareAttributeAdvise(Object).)
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from AggregatableClientAttribute.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from ThreadAwareAttribute.)
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Inherited from InstanceLevelAspect.)
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype. (Inherited from InstanceLevelAspect.)
Public method | Finalize | Destructor. (Inherited from ThreadAwareAttribute.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Protected method | IsEligibleChild | Determines if an object is eligible to be a child of the target instance of the current aspect. (Inherited from ThreadAwareAttribute.)
Public method | OnCloned | Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object. (Inherited from InstanceLevelAspect.)
Public method | OnInstanceConstructed | Executed when the target instance gets fully initialized, i.e. just after all constructors have completed. (Inherited from AggregatableClientAttribute.)
Public method | OnSerializing | Requires read access level to the current object before serialization can proceed. This method will be introduced into the target class. (Inherited from ThreadAwareAttribute.)
Public method | RuntimeInitializeInstance | Initializes the aspect instance. This method is invoked when all system elements of the aspect (like member imports) have completed. (Overrides ThreadAwareAttribute.RuntimeInitializeInstance.)
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from TypeLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, Type) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from TypeLevelAspect.)
Top
See Also

Reference

PostSharp.Patterns.Threading Namespace


ReadOnlyThreadAwareAttribute Constructor

Initializes a new instance of the ReadOnlyThreadAwareAttribute class

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected ReadOnlyThreadAwareAttribute()
See Also

Reference

ReadOnlyThreadAwareAttribute Class
PostSharp.Patterns.Threading Namespace


ReadOnlyThreadAwareAttribute Properties

The ReadOnlyThreadAwareAttribute type exposes the following members.

Properties
 | Name | Description
Protected property | AppliedToCurrentType | Determines if the current custom attribute instance has been applied to the type of the target instance. This value is false if the custom attribute has been applied to a base type. (Inherited from AggregatableClientAttribute.)
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | InitializationStatus | Gets the current AggregatableClientAttributeAspectInitializationStatus of the current aspect. (Inherited from AggregatableClientAttribute.)
Public property | Instance | Gets the object to which the current aspect has been applied. (Inherited from InstanceLevelAspect.)
Public property | RuntimeVerificationEnabled | Determines whether the code should be verified against the model at runtime. The default value is true for the debug build configuration and false for the release build configuration. (Inherited from ThreadAwareAttribute.)
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

ReadOnlyThreadAwareAttribute Class
PostSharp.Patterns.Threading Namespace


ReadOnlyThreadAwareAttribute Methods

The ReadOnlyThreadAwareAttribute type exposes the following members.

Methods
 | Name | Description
Protected method | Advise | Injects the advice into the child object. (Overrides ThreadAwareAttributeAdvise(Object).)
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from AggregatableClientAttribute.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from ThreadAwareAttribute.)
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Inherited from InstanceLevelAspect.)
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype. (Inherited from InstanceLevelAspect.)
Public method | Finalize | Destructor. (Inherited from ThreadAwareAttribute.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Protected method | IsEligibleChild | Determines if an object is eligible to be a child of the target instance of the current aspect. (Inherited from ThreadAwareAttribute.)
Public method | OnCloned | Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object. (Inherited from InstanceLevelAspect.)
Public method | OnInstanceConstructed | Executed when the target instance gets fully initialized, i.e. just after all constructors have completed. (Inherited from AggregatableClientAttribute.)
Public method | OnSerializing | Requires read access level to the current object before serialization can proceed. This method will be introduced into the target class. (Inherited from ThreadAwareAttribute.)
Public method | RuntimeInitializeInstance | Initializes the aspect instance. This method is invoked when all system elements of the aspect (like member imports) have completed. (Overrides ThreadAwareAttribute.RuntimeInitializeInstance.)
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from TypeLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, Type) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from TypeLevelAspect.)
Top
See Also

Reference

ReadOnlyThreadAwareAttribute Class
PostSharp.Patterns.Threading Namespace


ReadOnlyThreadAwareAttribute.Advise Method

ReadOnlyThreadAwareAttributeAdvise Method

Injects the advice into the child object.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override bool Advise(
    Object obj
)

Parameters

obj
Type: SystemObject

Return Value

Type: Boolean
true if the children of obj have to be advised as well, false otherwise.
See Also

Reference

ReadOnlyThreadAwareAttribute Class
PostSharp.Patterns.Threading Namespace


ReadOnlyThreadAwareAttribute.RuntimeInitializeInstance Method

ReadOnlyThreadAwareAttributeRuntimeInitializeInstance Method

Initializes the aspect instance. This method is invoked when all system elements of the aspect (like member imports) have completed.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void RuntimeInitializeInstance()

Implements

IInstanceScopedAspectRuntimeInitializeInstance
See Also

Reference

ReadOnlyThreadAwareAttribute Class
PostSharp.Patterns.Threading Namespace
PostSharp.Aspects.AdvicesInitializeAspectInstanceAdvice

Other Resources

Conceptual: Initializing Aspects
Conceptual: Understanding Aspect Lifetime and Scope
Conceptual: What's New in PostSharp 4.0


ReentrantAttribute Class

Custom attribute that means that the async method to which it is applied can be safely re-entered on each await statement. In case of lock-based models, it means that the lock is released while awaiting. For the actor model, it means that other methods can be invoked during awaiting.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.Patterns.ThreadingReentrantAttribute

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ReentrantAttribute : MulticastAttribute,
    IValidableAnnotation

The ReentrantAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | ReentrantAttribute | Initializes a new instance of the ReentrantAttribute class
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Top
Methods
 | Name | Description
Public method | CompileTimeValidate | Method invoked at build time to ensure that the aspect has been applied to the right target.
Top
See Also

Reference

PostSharp.Patterns.Threading Namespace

Other Resources

Conceptual: Actor Threading Model


ReentrantAttribute Constructor

Initializes a new instance of the ReentrantAttribute class

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ReentrantAttribute()
See Also

Reference

ReentrantAttribute Class
PostSharp.Patterns.Threading Namespace


ReentrantAttribute Properties

The ReentrantAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Top
See Also

Reference

ReentrantAttribute Class
PostSharp.Patterns.Threading Namespace


ReentrantAttribute Methods

The ReentrantAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeValidate | Method invoked at build time to ensure that the aspect has been applied to the right target.
Top
See Also

Reference

ReentrantAttribute Class
PostSharp.Patterns.Threading Namespace


ReentrantAttribute.CompileTimeValidate Method

ReentrantAttributeCompileTimeValidate Method

Method invoked at build time to ensure that the aspect has been applied to the right target.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool CompileTimeValidate(
    Object target
)

Parameters

target
Type: SystemObject
Target element.

Return Value

Type: Boolean
true if the aspect was applied to an acceptable target, otherwise false.

Implements

IValidableAnnotationCompileTimeValidate(Object)
Remarks
The implementation of this method is expected to emit an error message or an exception of type InvalidAnnotationException in case of error. Only returning false causes the aspect to be silently ignored.
See Also

Reference

ReentrantAttribute Class
PostSharp.Patterns.Threading Namespace


RequiresThreadSafeAttribute Class

Custom attribute that, when applied to a field, property or parameter, checks that the assigned object is thread safe. Otherwise, the assignment results in an ArgumentException/
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsLocationLevelAspect
PostSharp.Patterns.ThreadingRequiresThreadSafeAttribute

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class RequiresThreadSafeAttribute : LocationLevelAspect,
    ILocationValidationAspect<Object>, ILocationValidationAspect, IAspect

The RequiresThreadSafeAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | RequiresThreadSafeAttribute | Initializes a new instance of the RequiresThreadSafeAttribute class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from LocationLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from LocationLevelAspect.)
Public method | CompileTimeValidate(LocationInfo) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from LocationLevelAspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | RuntimeInitialize | Initializes the current aspect. (Overrides LocationLevelAspectRuntimeInitialize(LocationInfo).)
Top
See Also

Reference

PostSharp.Patterns.Threading Namespace


RequiresThreadSafeAttribute Constructor

Initializes a new instance of the RequiresThreadSafeAttribute class

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public RequiresThreadSafeAttribute()
See Also

Reference

RequiresThreadSafeAttribute Class
PostSharp.Patterns.Threading Namespace


RequiresThreadSafeAttribute Properties

The RequiresThreadSafeAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

RequiresThreadSafeAttribute Class
PostSharp.Patterns.Threading Namespace


RequiresThreadSafeAttribute Methods

The RequiresThreadSafeAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from LocationLevelAspect.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from LocationLevelAspect.)
Public method | CompileTimeValidate(LocationInfo) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from LocationLevelAspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | RuntimeInitialize | Initializes the current aspect. (Overrides LocationLevelAspectRuntimeInitialize(LocationInfo).)
Top
See Also

Reference

RequiresThreadSafeAttribute Class
PostSharp.Patterns.Threading Namespace


RequiresThreadSafeAttribute.RuntimeInitialize Method

RequiresThreadSafeAttributeRuntimeInitialize Method

Initializes the current aspect.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void RuntimeInitialize(
    LocationInfo locationInfo
)

Parameters

locationInfo
Type: PostSharp.ReflectionLocationInfo
Location to which the current aspect is applied.

Implements

ILocationLevelAspectRuntimeInitialize(LocationInfo)
See Also

Reference

RequiresThreadSafeAttribute Class
PostSharp.Patterns.Threading Namespace

Other Resources

Conceptual: Initializing Aspects


SynchronizedAttribute Class

Custom attribute that, when applied to a class, implements the SynchronizedThreadingModel into this class. In a synchronized object, only a single thread can access the object at a time. If a second thread needs to access the object while it is in used by a first thread, the second thread has to wait until the first thread completes its access.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsTypeLevelAspect
PostSharp.AspectsInstanceLevelAspect
PostSharp.Patterns.ModelAggregatableClientAttribute
PostSharp.Patterns.ThreadingThreadAwareAttribute
PostSharp.Patterns.ThreadingSynchronizedAttribute

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class SynchronizedAttribute : ThreadAwareAttribute

The SynchronizedAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | SynchronizedAttribute | Initializes a new instance of the SynchronizedAttribute class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | Instance | Gets the object to which the current aspect has been applied. (Inherited from InstanceLevelAspect.)
Public property | RuntimeVerificationEnabled | Determines whether the code should be verified against the model at runtime. The default value is true for the debug build configuration and false for the release build configuration. (Inherited from ThreadAwareAttribute.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from AggregatableClientAttribute.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from ThreadAwareAttribute.)
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype. (Inherited from InstanceLevelAspect.)
Public method | Finalize | Destructor. (Inherited from ThreadAwareAttribute.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnCloned | Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object. (Inherited from InstanceLevelAspect.)
Public method | OnInstanceConstructed | Executed when the target instance gets fully initialized, i.e. just after all constructors have completed. (Inherited from AggregatableClientAttribute.)
Public method | OnSerializing | Requires read access level to the current object before serialization can proceed. This method will be introduced into the target class. (Inherited from ThreadAwareAttribute.)
Top
See Also

Reference

PostSharp.Patterns.Threading Namespace

Other Resources

Conceptual: Opting In and Out From Thread Safety
Conceptual: Synchronized Threading Model
Conceptual: What's New in PostSharp 4.0
Conceptual: Writing Thread-Safe Code with Threading Models


SynchronizedAttribute Constructor

Initializes a new instance of the SynchronizedAttribute class

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SynchronizedAttribute()
See Also

Reference

SynchronizedAttribute Class
PostSharp.Patterns.Threading Namespace


SynchronizedAttribute Properties

The SynchronizedAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | Instance | Gets the object to which the current aspect has been applied. (Inherited from InstanceLevelAspect.)
Public property | RuntimeVerificationEnabled | Determines whether the code should be verified against the model at runtime. The default value is true for the debug build configuration and false for the release build configuration. (Inherited from ThreadAwareAttribute.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

SynchronizedAttribute Class
PostSharp.Patterns.Threading Namespace


SynchronizedAttribute Methods

The SynchronizedAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from AggregatableClientAttribute.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from ThreadAwareAttribute.)
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype. (Inherited from InstanceLevelAspect.)
Public method | Finalize | Destructor. (Inherited from ThreadAwareAttribute.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnCloned | Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object. (Inherited from InstanceLevelAspect.)
Public method | OnInstanceConstructed | Executed when the target instance gets fully initialized, i.e. just after all constructors have completed. (Inherited from AggregatableClientAttribute.)
Public method | OnSerializing | Requires read access level to the current object before serialization can proceed. This method will be introduced into the target class. (Inherited from ThreadAwareAttribute.)
Top
See Also

Reference

SynchronizedAttribute Class
PostSharp.Patterns.Threading Namespace


ThreadAccessException Class

Exception thrown when the calling thread does not have access to the object.
Inheritance Hierarchy
SystemObject
SystemException
PostSharp.Patterns.ThreadingThreadingException
PostSharp.Patterns.ThreadingThreadAccessException

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public class ThreadAccessException : ThreadingException
Constructors
 | Name | Description
Public method | ThreadAccessException | Initializes a new instance of the ThreadAccessException class with the default error message.
Public method | ThreadAccessException(String) | Initializes a new instance of the ThreadAccessException class with a given error message.
Protected method | ThreadAccessException(SerializationInfo, StreamingContext) | Deserialization constructor.
Public method | ThreadAccessException(String, Exception) | Initializes a new instance of the ThreadAccessException class with a given error message and inner exception.
Top
Remarks

This exception is raised when the calling thread accesses the object without going through a public method.

For the ReaderWriterSynchronizedThreadingModel, the exception may mean that a public method was not annotated with an access custom attribute (ReaderAttribute, WriterAttribute and others).

See Also

Reference

PostSharp.Patterns.Threading Namespace

Other Resources

Conceptual: Actor Threading Model
Conceptual: Key Technologies
Conceptual: Reader/Writer Synchronized Threading Model
Conceptual: Synchronized Threading Model
Conceptual: Thread-Unsafe Threading Model


ThreadAccessException Constructor

Overload List
 | Name | Description
Public method | ThreadAccessException | Initializes a new instance of the ThreadAccessException class with the default error message.
Public method | ThreadAccessException(String) | Initializes a new instance of the ThreadAccessException class with a given error message.
Protected method | ThreadAccessException(SerializationInfo, StreamingContext) | Deserialization constructor.
Public method | ThreadAccessException(String, Exception) | Initializes a new instance of the ThreadAccessException class with a given error message and inner exception.
Top
See Also

Reference

ThreadAccessException Class
PostSharp.Patterns.Threading Namespace


ThreadAccessException Constructor

Initializes a new instance of the ThreadAccessException class with the default error message.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ThreadAccessException()
See Also

Reference

ThreadAccessException Class
ThreadAccessException Overload
PostSharp.Patterns.Threading Namespace


ThreadAccessException Constructor (String)

Initializes a new instance of the ThreadAccessException class with a given error message.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ThreadAccessException(
    string message
)

Parameters

message
Type: SystemString
The error message.
See Also

Reference

ThreadAccessException Class
ThreadAccessException Overload
PostSharp.Patterns.Threading Namespace


ThreadAccessException Constructor (SerializationInfo, StreamingContext)

Deserialization constructor.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected ThreadAccessException(
    SerializationInfo info,
    StreamingContext context
)

Parameters

info
Type: System.Runtime.SerializationSerializationInfo
context
Type: System.Runtime.SerializationStreamingContext
See Also

Reference

ThreadAccessException Class
ThreadAccessException Overload
PostSharp.Patterns.Threading Namespace


ThreadAccessException Constructor (String, Exception)

Initializes a new instance of the ThreadAccessException class with a given error message and inner exception.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ThreadAccessException(
    string message,
    Exception inner
)

Parameters

message
Type: SystemString
The error message.
inner
Type: SystemException
The Exception wrapped by the new ThreadAccessException.
See Also

Reference

ThreadAccessException Class
ThreadAccessException Overload
PostSharp.Patterns.Threading Namespace


ThreadAffineAttribute Class

Custom attribute that, when applied on a type, ensures the instances of this type can only be accessed by the thread that created the instance. When a different thread accesses instances of this type, a ThreadMismatchException exception is thrown.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsTypeLevelAspect
PostSharp.AspectsInstanceLevelAspect
PostSharp.Patterns.ModelAggregatableClientAttribute
PostSharp.Patterns.ThreadingThreadAwareAttribute
PostSharp.Patterns.ThreadingThreadAffineAttribute

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ThreadAffineAttribute : ThreadAwareAttribute

The ThreadAffineAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | ThreadAffineAttribute | Initializes a new instance of the ThreadAffineAttribute class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | Instance | Gets the object to which the current aspect has been applied. (Inherited from InstanceLevelAspect.)
Public property | RuntimeVerificationEnabled | Determines whether the code should be verified against the model at runtime. The default value is true for the debug build configuration and false for the release build configuration. (Inherited from ThreadAwareAttribute.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from AggregatableClientAttribute.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from ThreadAwareAttribute.)
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype. (Inherited from InstanceLevelAspect.)
Public method | Finalize | Destructor. (Inherited from ThreadAwareAttribute.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnCloned | Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object. (Inherited from InstanceLevelAspect.)
Public method | OnInstanceConstructed | Executed when the target instance gets fully initialized, i.e. just after all constructors have completed. (Inherited from AggregatableClientAttribute.)
Public method | OnSerializing | Requires read access level to the current object before serialization can proceed. This method will be introduced into the target class. (Inherited from ThreadAwareAttribute.)
Public method | RuntimeInitializeInstance | Initializes the aspect instance. This method is invoked when all system elements of the aspect (like member imports) have completed. (Overrides ThreadAwareAttribute.RuntimeInitializeInstance.)
Top
See Also

Reference

PostSharp.Patterns.Threading Namespace

Other Resources

Conceptual: Thread Affine Threading Model
Conceptual: Writing Thread-Safe Code with Threading Models


ThreadAffineAttribute Constructor

Initializes a new instance of the ThreadAffineAttribute class

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ThreadAffineAttribute()
See Also

Reference

ThreadAffineAttribute Class
PostSharp.Patterns.Threading Namespace


ThreadAffineAttribute Properties

The ThreadAffineAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | Instance | Gets the object to which the current aspect has been applied. (Inherited from InstanceLevelAspect.)
Public property | RuntimeVerificationEnabled | Determines whether the code should be verified against the model at runtime. The default value is true for the debug build configuration and false for the release build configuration. (Inherited from ThreadAwareAttribute.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

ThreadAffineAttribute Class
PostSharp.Patterns.Threading Namespace


ThreadAffineAttribute Methods

The ThreadAffineAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from AggregatableClientAttribute.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from ThreadAwareAttribute.)
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype. (Inherited from InstanceLevelAspect.)
Public method | Finalize | Destructor. (Inherited from ThreadAwareAttribute.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnCloned | Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object. (Inherited from InstanceLevelAspect.)
Public method | OnInstanceConstructed | Executed when the target instance gets fully initialized, i.e. just after all constructors have completed. (Inherited from AggregatableClientAttribute.)
Public method | OnSerializing | Requires read access level to the current object before serialization can proceed. This method will be introduced into the target class. (Inherited from ThreadAwareAttribute.)
Public method | RuntimeInitializeInstance | Initializes the aspect instance. This method is invoked when all system elements of the aspect (like member imports) have completed. (Overrides ThreadAwareAttribute.RuntimeInitializeInstance.)
Top
See Also

Reference

ThreadAffineAttribute Class
PostSharp.Patterns.Threading Namespace


ThreadAffineAttribute.RuntimeInitializeInstance Method

ThreadAffineAttributeRuntimeInitializeInstance Method

Initializes the aspect instance. This method is invoked when all system elements of the aspect (like member imports) have completed.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void RuntimeInitializeInstance()

Implements

IInstanceScopedAspectRuntimeInitializeInstance
See Also

Reference

ThreadAffineAttribute Class
PostSharp.Patterns.Threading Namespace
PostSharp.Aspects.AdvicesInitializeAspectInstanceAdvice

Other Resources

Conceptual: Initializing Aspects
Conceptual: Understanding Aspect Lifetime and Scope
Conceptual: What's New in PostSharp 4.0


ThreadAwareAttribute Class

Base class for all aspects implementing threading models.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsTypeLevelAspect
PostSharp.AspectsInstanceLevelAspect
PostSharp.Patterns.ModelAggregatableClientAttribute
PostSharp.Patterns.ThreadingThreadAwareAttribute
More...

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class ThreadAwareAttribute : AggregatableClientAttribute,
    IThreadAware

The ThreadAwareAttribute type exposes the following members.

Properties
 | Name | Description
Protected property | AppliedToCurrentType | Determines if the current custom attribute instance has been applied to the type of the target instance. This value is false if the custom attribute has been applied to a base type. (Inherited from AggregatableClientAttribute.)
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | InitializationStatus | Gets the current AggregatableClientAttributeAspectInitializationStatus of the current aspect. (Inherited from AggregatableClientAttribute.)
Public property | Instance | Gets the object to which the current aspect has been applied. (Inherited from InstanceLevelAspect.)
Public property | RuntimeVerificationEnabled | Determines whether the code should be verified against the model at runtime. The default value is true for the debug build configuration and false for the release build configuration.
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Protected method | Advise | Injects the advice into the child object. (Overrides AggregatableClientAttributeAdvise(Object).)
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from AggregatableClientAttribute.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Overrides TypeLevelAspectCompileTimeValidate(Type).)
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Inherited from InstanceLevelAspect.)
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype. (Inherited from InstanceLevelAspect.)
Public method | Finalize | Destructor.
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Protected method | IsEligibleChild | Determines if an object is eligible to be a child of the target instance of the current aspect. (Overrides AggregatableClientAttributeIsEligibleChild(Object, ChildInfo).)
Public method | OnCloned | Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object. (Inherited from InstanceLevelAspect.)
Public method | OnInstanceConstructed | Executed when the target instance gets fully initialized, i.e. just after all constructors have completed. (Inherited from AggregatableClientAttribute.)
Public method | OnSerializing | Requires read access level to the current object before serialization can proceed. This method will be introduced into the target class.
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from TypeLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, Type) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from TypeLevelAspect.)
Top
Extension Methods
 | Name | Description
Public Extension Method | AcquireAccess(ObjectAccessLevel) | Overloaded. Acquires access to given object and returns the ConcurrentAccessToken. (Defined by ThreadAwareExtensions.)
Public Extension Method | AcquireAccess(ObjectAccessLevel, ConcurrentAccessToken) | Overloaded. Acquires access for a given object and gets the ConcurrentAccessToken as a reference parameter. (Defined by ThreadAwareExtensions.)
Public Extension Method | AcquireAccessAsync | Asynchronously acquires access for a given object. (Defined by ThreadAwareExtensions.)
Top
See Also

Reference

PostSharp.Patterns.Threading Namespace

Other Resources

Conceptual: Annotating an Object Model for Parent/Child Relationships (Aggregatable)
Conceptual: Enabling and Disabling Runtime Verification
Conceptual: Parent/Child, Visitor and Disposable
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsTypeLevelAspect
PostSharp.AspectsInstanceLevelAspect
PostSharp.Patterns.ModelAggregatableClientAttribute
PostSharp.Patterns.ThreadingThreadAwareAttribute
PostSharp.Patterns.ThreadingActorAttribute
PostSharp.Patterns.ThreadingPrivateThreadAwareAttribute
PostSharp.Patterns.ThreadingReaderWriterSynchronizedAttribute
PostSharp.Patterns.ThreadingReadOnlyThreadAwareAttribute
PostSharp.Patterns.ThreadingSynchronizedAttribute
PostSharp.Patterns.ThreadingThreadAffineAttribute
PostSharp.Patterns.ThreadingThreadUnsafeAttribute


ThreadAwareAttribute Properties

The ThreadAwareAttribute type exposes the following members.

Properties
 | Name | Description
Protected property | AppliedToCurrentType | Determines if the current custom attribute instance has been applied to the type of the target instance. This value is false if the custom attribute has been applied to a base type. (Inherited from AggregatableClientAttribute.)
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Protected property | InitializationStatus | Gets the current AggregatableClientAttributeAspectInitializationStatus of the current aspect. (Inherited from AggregatableClientAttribute.)
Public property | Instance | Gets the object to which the current aspect has been applied. (Inherited from InstanceLevelAspect.)
Public property | RuntimeVerificationEnabled | Determines whether the code should be verified against the model at runtime. The default value is true for the debug build configuration and false for the release build configuration.
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

ThreadAwareAttribute Class
PostSharp.Patterns.Threading Namespace


ThreadAwareAttribute.RuntimeVerificationEnabled Property

ThreadAwareAttributeRuntimeVerificationEnabled Property

Determines whether the code should be verified against the model at runtime. The default value is true for the debug build configuration and false for the release build configuration.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool RuntimeVerificationEnabled { get; set; }

Property Value

Type: Boolean
Remarks

This default value is false if the Optimize compiler setting is enabled, and true if this setting is disabled. The default value can also be modified by setting the PostSharpRuntimeVerificationEnabled MSBuild property, which can be edited from the PostSharp tab of project properties in Visual Studio.

See Also

Reference

ThreadAwareAttribute Class
PostSharp.Patterns.Threading Namespace

Other Resources

Conceptual: Enabling and Disabling Runtime Verification


ThreadAwareAttribute Methods

The ThreadAwareAttribute type exposes the following members.

Methods
 | Name | Description
Protected method | Advise | Injects the advice into the child object. (Overrides AggregatableClientAttributeAdvise(Object).)
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from AggregatableClientAttribute.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Overrides TypeLevelAspectCompileTimeValidate(Type).)
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Inherited from InstanceLevelAspect.)
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype. (Inherited from InstanceLevelAspect.)
Public method | Finalize | Destructor.
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Protected method | IsEligibleChild | Determines if an object is eligible to be a child of the target instance of the current aspect. (Overrides AggregatableClientAttributeIsEligibleChild(Object, ChildInfo).)
Public method | OnCloned | Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object. (Inherited from InstanceLevelAspect.)
Public method | OnInstanceConstructed | Executed when the target instance gets fully initialized, i.e. just after all constructors have completed. (Inherited from AggregatableClientAttribute.)
Public method | OnSerializing | Requires read access level to the current object before serialization can proceed. This method will be introduced into the target class.
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from TypeLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, Type) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from TypeLevelAspect.)
Top
Extension Methods
 | Name | Description
Public Extension Method | AcquireAccess(ObjectAccessLevel) | Overloaded. Acquires access to given object and returns the ConcurrentAccessToken. (Defined by ThreadAwareExtensions.)
Public Extension Method | AcquireAccess(ObjectAccessLevel, ConcurrentAccessToken) | Overloaded. Acquires access for a given object and gets the ConcurrentAccessToken as a reference parameter. (Defined by ThreadAwareExtensions.)
Public Extension Method | AcquireAccessAsync | Asynchronously acquires access for a given object. (Defined by ThreadAwareExtensions.)
Top
See Also

Reference

ThreadAwareAttribute Class
PostSharp.Patterns.Threading Namespace


ThreadAwareAttribute.Advise Method

ThreadAwareAttributeAdvise Method

Injects the advice into the child object.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override bool Advise(
    Object obj
)

Parameters

obj
Type: SystemObject

Return Value

Type: Boolean
true if the children of obj have to be advised as well, false otherwise.
See Also

Reference

ThreadAwareAttribute Class
PostSharp.Patterns.Threading Namespace


ThreadAwareAttribute.CompileTimeValidate Method

ThreadAwareAttributeCompileTimeValidate Method

Overload List
 | Name | Description
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Overrides TypeLevelAspectCompileTimeValidate(Type).)
Top
See Also

Reference

ThreadAwareAttribute Class
PostSharp.Patterns.Threading Namespace


ThreadAwareAttribute.CompileTimeValidate Method (Type)

ThreadAwareAttributeCompileTimeValidate Method (Type)

Method invoked at build time to ensure that the aspect has been applied to the right target.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool CompileTimeValidate(
    Type type
)

Parameters

type
Type: SystemType
Type to which the aspect has been applied

Return Value

Type: Boolean
true if the aspect was applied to an acceptable field, otherwise false.
Remarks
The implementation of this method is expected to emit an error message (see MessageSource) or an exception in case of error. Returning false without emitting an error message or exception causes the aspect to be silently ignored.
See Also

Reference

ThreadAwareAttribute Class
CompileTimeValidate Overload
PostSharp.Patterns.Threading Namespace

Other Resources

Conceptual: Validating Aspects


ThreadAwareAttribute.Finalize Method

ThreadAwareAttributeFinalize Method

Destructor.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Finalize()
See Also

Reference

ThreadAwareAttribute Class
PostSharp.Patterns.Threading Namespace


ThreadAwareAttribute.IsEligibleChild Method

ThreadAwareAttributeIsEligibleChild Method

Determines if an object is eligible to be a child of the target instance of the current aspect.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected override sealed bool IsEligibleChild(
    Object child,
    ChildInfo childInfo
)

Parameters

child
Type: SystemObject
childInfo
Type: PostSharp.Patterns.ModelChildInfo

Return Value

Type: Boolean
true if child is eligible to be a child without injecting any advice, otherwise false. When this method returns false, the aspect will the invoke the Advise(Object) method.
See Also

Reference

ThreadAwareAttribute Class
PostSharp.Patterns.Threading Namespace


ThreadAwareAttribute.OnSerializing Method

ThreadAwareAttributeOnSerializing Method

Requires read access level to the current object before serialization can proceed. This method will be introduced into the target class.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void OnSerializing(
    StreamingContext streamingContext
)

Parameters

streamingContext
Type: System.Runtime.SerializationStreamingContext
Streaming context.
See Also

Reference

ThreadAwareAttribute Class
PostSharp.Patterns.Threading Namespace


ThreadAwareExtensions Class

Provides extension methods to the IThreadAware interface.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.ThreadingThreadAwareExtensions

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static class ThreadAwareExtensions

The ThreadAwareExtensions type exposes the following members.

Methods
Name | Description
AcquireAccess(IThreadAware, ObjectAccessLevel) | Acquires access to given object and returns the ConcurrentAccessToken.
AcquireAccess(IThreadAware, ObjectAccessLevel, ConcurrentAccessToken) | Acquires access for a given object and gets the ConcurrentAccessToken as a reference parameter.
AcquireAccessAsync | Asynchronously acquires access for a given object.
Top
See Also

Reference

PostSharp.Patterns.Threading Namespace


ThreadAwareExtensions Methods

The ThreadAwareExtensions type exposes the following members.

Methods
Name | Description
AcquireAccess(IThreadAware, ObjectAccessLevel) | Acquires access to given object and returns the ConcurrentAccessToken.
AcquireAccess(IThreadAware, ObjectAccessLevel, ConcurrentAccessToken) | Acquires access for a given object and gets the ConcurrentAccessToken as a reference parameter.
AcquireAccessAsync | Asynchronously acquires access for a given object.
Top
See Also

Reference

ThreadAwareExtensions Class
PostSharp.Patterns.Threading Namespace


ThreadAwareExtensions.AcquireAccess Method

ThreadAwareExtensionsAcquireAccess Method

Overload List
Name | Description
AcquireAccess(IThreadAware, ObjectAccessLevel) | Acquires access to given object and returns the ConcurrentAccessToken.
AcquireAccess(IThreadAware, ObjectAccessLevel, ConcurrentAccessToken) | Acquires access for a given object and gets the ConcurrentAccessToken as a reference parameter.
Top
See Also

Reference

ThreadAwareExtensions Class
PostSharp.Patterns.Threading Namespace


ThreadAwareExtensions.AcquireAccess Method (IThreadAware, ObjectAccessLevel)

ThreadAwareExtensionsAcquireAccess Method (IThreadAware, ObjectAccessLevel)

Acquires access to given object and returns the ConcurrentAccessToken.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static ConcurrentAccessToken AcquireAccess(
    this IThreadAware instance,
    ObjectAccessLevel objectAccessLevel
)

Parameters

instance
Type: PostSharp.Patterns.ThreadingIThreadAware
The instance for which access is required.
objectAccessLevel
Type: PostSharp.Patterns.ModelObjectAccessLevel
The level of access required.

Return Value

Type: ConcurrentAccessToken
A ConcurrentAccessToken that should be disposed when access is no longer required.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IThreadAware. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks

This method is guaranteed to acquire the controller of the instance object. Invoking the AcquireAccess(ObjectAccessLevel, ConcurrentAccessToken) method directly does not offer this guarantee, as the controller can be changed between the moment the ConcurrencyController property is retrieved and the moment the AcquireAccess(ObjectAccessLevel, ConcurrentAccessToken) is invoked.

See Also

Reference

ThreadAwareExtensions Class
AcquireAccess Overload
PostSharp.Patterns.Threading Namespace


ThreadAwareExtensions.AcquireAccess Method (IThreadAware, ObjectAccessLevel, ConcurrentAccessToken)

ThreadAwareExtensionsAcquireAccess Method (IThreadAware, ObjectAccessLevel, ConcurrentAccessToken)

Acquires access for a given object and gets the ConcurrentAccessToken as a reference parameter.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void AcquireAccess(
    this IThreadAware instance,
    ObjectAccessLevel objectAccessLevel,
    ref ConcurrentAccessToken concurrentAccessToken
)

Parameters

instance
Type: PostSharp.Patterns.ThreadingIThreadAware
The instance for which access is required.
objectAccessLevel
Type: PostSharp.Patterns.ModelObjectAccessLevel
The level of access required.
concurrentAccessToken
Type: PostSharp.Patterns.ThreadingConcurrentAccessToken
At output, a ConcurrentAccessToken that should be disposed when access is no longer required.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IThreadAware. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks

This method is guaranteed to acquire the controller of the instance object. Invoking the AcquireAccess(ObjectAccessLevel, ConcurrentAccessToken) method directly does not offer this guarantee, as the controller can be changed between the moment the ConcurrencyController property is retrieved and the moment the AcquireAccess(ObjectAccessLevel, ConcurrentAccessToken) is invoked.

See Also

Reference

ThreadAwareExtensions Class
AcquireAccess Overload
PostSharp.Patterns.Threading Namespace


ThreadAwareExtensions.AcquireAccessAsync Method

ThreadAwareExtensionsAcquireAccessAsync Method

Asynchronously acquires access for a given object.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static ConcurrentAccessAwaiter AcquireAccessAsync(
    this IThreadAware instance,
    ObjectAccessLevel objectAccessLevel
)

Parameters

instance
Type: PostSharp.Patterns.ThreadingIThreadAware
The instance for which access is required.
objectAccessLevel
Type: PostSharp.Patterns.ModelObjectAccessLevel
The level of access required.

Return Value

Type: ConcurrentAccessAwaiter
An ConcurrentAccessAwaiter object that can be used for awaiting for access.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IThreadAware. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks

This method is guaranteed to acquire the controller of the instance object. Invoking the AcquireAccessAsync(ObjectAccessLevel) method directly does not offer this guarantee, as the controller can be changed between the moment the ConcurrencyController property is retrieved and the moment the AcquireAccessAsync(ObjectAccessLevel) is invoked.

See Also

Reference

ThreadAwareExtensions Class
PostSharp.Patterns.Threading Namespace


ThreadingException Class

Base class for exceptions thrown by the PostSharp.Patterns.Threading component.
Inheritance Hierarchy
SystemObject
SystemException
PostSharp.Patterns.ThreadingThreadingException
PostSharp.Patterns.ThreadingConcurrentAccessException
PostSharp.Patterns.ThreadingDeadlockException
PostSharp.Patterns.ThreadingThreadAccessException
PostSharp.Patterns.ThreadingThreadMismatchException

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public abstract class ThreadingException : Exception
See Also

Reference

PostSharp.Patterns.Threading Namespace


ThreadingModel Class

Base class for all threading models. Defines properties that describe the characteristics of threading models. All classes derived from ThreadingModel are necessarily singletons.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.ThreadingThreadingModel
More...

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class ThreadingModel

The ThreadingModel type exposes the following members.

Properties
 | Name | Description
Public property | IsBlocking | Determines whether the current ThreadingModel has blocking semantics, i.e. if the threading model may cause the executing thread to be blocked, for instance when waiting for a lock.
Public property | IsThreadSafe | Determines whether the threading model is possibly thread safe.
Top
Methods
 | Name | Description
Public method | ToString | Returns a string that represents the current object. (Overrides ObjectToString.)
Top
See Also

Reference

PostSharp.Patterns.Threading Namespace
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.ThreadingThreadingModel
PostSharp.Patterns.Threading.ModelsActorThreadingModel
PostSharp.Patterns.Threading.ModelsPrivateThreadingModel
PostSharp.Patterns.Threading.ModelsReaderWriterSynchronizedThreadingModel
PostSharp.Patterns.Threading.ModelsReadOnlyThreadingModel
PostSharp.Patterns.Threading.ModelsSynchronizedThreadingModel
PostSharp.Patterns.Threading.ModelsThreadUnsafeThreadingModel


ThreadingModel Properties

The ThreadingModel type exposes the following members.

Properties
 | Name | Description
Public property | IsBlocking | Determines whether the current ThreadingModel has blocking semantics, i.e. if the threading model may cause the executing thread to be blocked, for instance when waiting for a lock.
Public property | IsThreadSafe | Determines whether the threading model is possibly thread safe.
Top
See Also

Reference

ThreadingModel Class
PostSharp.Patterns.Threading Namespace


ThreadingModel.IsBlocking Property

ThreadingModelIsBlocking Property

Determines whether the current ThreadingModel has blocking semantics, i.e. if the threading model may cause the executing thread to be blocked, for instance when waiting for a lock.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract bool IsBlocking { get; }

Property Value

Type: Boolean
See Also

Reference

ThreadingModel Class
PostSharp.Patterns.Threading Namespace


ThreadingModel.IsThreadSafe Property

ThreadingModelIsThreadSafe Property

Determines whether the threading model is possibly thread safe.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract bool IsThreadSafe { get; }

Property Value

Type: Boolean
See Also

Reference

ThreadingModel Class
PostSharp.Patterns.Threading Namespace


ThreadingModel Methods

The ThreadingModel type exposes the following members.

Methods
 | Name | Description
Public method | ToString | Returns a string that represents the current object. (Overrides ObjectToString.)
Top
See Also

Reference

ThreadingModel Class
PostSharp.Patterns.Threading Namespace


ThreadingModel.ToString Method

ThreadingModelToString Method

Returns a string that represents the current object.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override string ToString()

Return Value

Type: String
A string that represents the current object.
See Also

Reference

ThreadingModel Class
PostSharp.Patterns.Threading Namespace


ThreadingPatternsAspectRoles Class

Enumerates the aspect roles (for use with AspectRoleDependencyAttribute) used by the PostSharp.Patterns.Threading component.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.ThreadingThreadingPatternsAspectRoles

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static class ThreadingPatternsAspectRoles

The ThreadingPatternsAspectRoles type exposes the following members.

Fields
Name | Description
ThreadingModel | Role of an aspect that provides a threading model.
Top
See Also

Reference

PostSharp.Patterns.Threading Namespace


ThreadingPatternsAspectRoles Fields

The ThreadingPatternsAspectRoles type exposes the following members.

Fields
Name | Description
ThreadingModel | Role of an aspect that provides a threading model.
Top
See Also

Reference

ThreadingPatternsAspectRoles Class
PostSharp.Patterns.Threading Namespace


ThreadingPatternsAspectRoles.ThreadingModel Field

ThreadingPatternsAspectRolesThreadingModel Field

Role of an aspect that provides a threading model.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const string ThreadingModel = "ThreadingModel"

Field Value

Type: String
See Also

Reference

ThreadingPatternsAspectRoles Class
PostSharp.Patterns.Threading Namespace


ThreadingServices Class

Exposes methods to work with the PostSharp.Patterns.Threading namespace.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.ThreadingThreadingServices

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static class ThreadingServices

The ThreadingServices type exposes the following members.

Methods
Name | Description
WithConcurrencyController | Sets the ambient concurrency controller for the current thread. Until the returned AmbientConcurrencyControllerContext value is disposed, thread-aware objects created in the current thread will be assigned to the given concurrency controller.
Top
Events
Name | Description
DeadlockDetected | Event raised by implementation of the DeadlockDetectionPolicy aspect.
UnhandledException | Event raised by the implementation of the ActorAttribute, DispatchedAttribute and BackgroundAttribute aspects when an unhandled exception is encountered.
Top
See Also

Reference

PostSharp.Patterns.Threading Namespace


ThreadingServices Methods

The ThreadingServices type exposes the following members.

Methods
Name | Description
WithConcurrencyController | Sets the ambient concurrency controller for the current thread. Until the returned AmbientConcurrencyControllerContext value is disposed, thread-aware objects created in the current thread will be assigned to the given concurrency controller.
Top
See Also

Reference

ThreadingServices Class
PostSharp.Patterns.Threading Namespace


ThreadingServices.WithConcurrencyController Method

ThreadingServicesWithConcurrencyController Method

Sets the ambient concurrency controller for the current thread. Until the returned AmbientConcurrencyControllerContext value is disposed, thread-aware objects created in the current thread will be assigned to the given concurrency controller.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static AmbientConcurrencyControllerContext WithConcurrencyController(
    IConcurrencyController concurrencyController
)

Parameters

concurrencyController
Type: PostSharp.Patterns.ThreadingIConcurrencyController
The ambient concurrency controller. Use the ConcurrencyControllerFactory class to create new concurrency controllers.

Return Value

Type: AmbientConcurrencyControllerContext
A IDisposable value representing the ambient concurrency controller context.
Remarks
This method can be used to optimize performance when creating a large tree of thread-aware objects that need to share the same concurrency controller.
See Also

Reference

ThreadingServices Class
PostSharp.Patterns.Threading Namespace

Other Resources

Conceptual: Run-Time Performance of Threading Model


ThreadingServices Events

The ThreadingServices type exposes the following members.

Events
Name | Description
DeadlockDetected | Event raised by implementation of the DeadlockDetectionPolicy aspect.
UnhandledException | Event raised by the implementation of the ActorAttribute, DispatchedAttribute and BackgroundAttribute aspects when an unhandled exception is encountered.
Top
See Also

Reference

ThreadingServices Class
PostSharp.Patterns.Threading Namespace


ThreadingServices.DeadlockDetected Event

ThreadingServicesDeadlockDetected Event

Event raised by implementation of the DeadlockDetectionPolicy aspect.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static event EventHandler<DeadlockDetectedEventArgs> DeadlockDetected

Value

Type: SystemEventHandler DeadlockDetectedEventArgs
See Also

Reference

ThreadingServices Class
PostSharp.Patterns.Threading Namespace


ThreadingServices.UnhandledException Event

ThreadingServicesUnhandledException Event

Event raised by the implementation of the ActorAttribute, DispatchedAttribute and BackgroundAttribute aspects when an unhandled exception is encountered.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static event EventHandler<ThreadingUnhandledExceptionEventArgs> UnhandledException

Value

Type: SystemEventHandler ThreadingUnhandledExceptionEventArgs
See Also

Reference

ThreadingServices Class
PostSharp.Patterns.Threading Namespace


ThreadingUnhandledExceptionEventArgs Class

Arguments of the UnhandledException event.
Inheritance Hierarchy
SystemObject
SystemEventArgs
PostSharp.Patterns.ThreadingThreadingUnhandledExceptionEventArgs

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class ThreadingUnhandledExceptionEventArgs : EventArgs

The ThreadingUnhandledExceptionEventArgs type exposes the following members.

Properties
 | Name | Description
Public property | Exception | Gets the exception.
Public property | IsHandled | Determines whether the exception has been handled. Clients of the UnhandledException event must set this property to true if they handle the exception. Otherwise, the exception will be rethrown.
Public property | IsTaskMethod | Determines whether the exception occurred in a task-like method.
Public property | Method | Gets the method in which the exception occurred.
Public property | ReturnValue | Provides the value to return from the method if the exception has been handled. Clients of the UnhandledException event must set this property to the appropriate value if they set the IsHandled property to true.
Public property | Source | Gets the source component that caught the exception.
Top
See Also

Reference

PostSharp.Patterns.Threading Namespace


ThreadingUnhandledExceptionEventArgs Properties

The ThreadingUnhandledExceptionEventArgs type exposes the following members.

Properties
 | Name | Description
Public property | Exception | Gets the exception.
Public property | IsHandled | Determines whether the exception has been handled. Clients of the UnhandledException event must set this property to true if they handle the exception. Otherwise, the exception will be rethrown.
Public property | IsTaskMethod | Determines whether the exception occurred in a task-like method.
Public property | Method | Gets the method in which the exception occurred.
Public property | ReturnValue | Provides the value to return from the method if the exception has been handled. Clients of the UnhandledException event must set this property to the appropriate value if they set the IsHandled property to true.
Public property | Source | Gets the source component that caught the exception.
Top
See Also

Reference

ThreadingUnhandledExceptionEventArgs Class
PostSharp.Patterns.Threading Namespace


ThreadingUnhandledExceptionEventArgs.Exception Property

ThreadingUnhandledExceptionEventArgsException Property

Gets the exception.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Exception Exception { get; }

Property Value

Type: Exception
See Also

Reference

ThreadingUnhandledExceptionEventArgs Class
PostSharp.Patterns.Threading Namespace


ThreadingUnhandledExceptionEventArgs.IsHandled Property

ThreadingUnhandledExceptionEventArgsIsHandled Property

Determines whether the exception has been handled. Clients of the UnhandledException event must set this property to true if they handle the exception. Otherwise, the exception will be rethrown.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsHandled { get; set; }

Property Value

Type: Boolean
See Also

Reference

ThreadingUnhandledExceptionEventArgs Class
PostSharp.Patterns.Threading Namespace


ThreadingUnhandledExceptionEventArgs.IsTaskMethod Property

ThreadingUnhandledExceptionEventArgsIsTaskMethod Property

Determines whether the exception occurred in a task-like method.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsTaskMethod { get; }

Property Value

Type: Boolean
See Also

Reference

ThreadingUnhandledExceptionEventArgs Class
PostSharp.Patterns.Threading Namespace


ThreadingUnhandledExceptionEventArgs.Method Property

ThreadingUnhandledExceptionEventArgsMethod Property

Gets the method in which the exception occurred.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MethodInfo Method { get; }

Property Value

Type: MethodInfo
See Also

Reference

ThreadingUnhandledExceptionEventArgs Class
PostSharp.Patterns.Threading Namespace


ThreadingUnhandledExceptionEventArgs.ReturnValue Property

ThreadingUnhandledExceptionEventArgsReturnValue Property

Provides the value to return from the method if the exception has been handled. Clients of the UnhandledException event must set this property to the appropriate value if they set the IsHandled property to true.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Object ReturnValue { get; set; }

Property Value

Type: Object
See Also

Reference

ThreadingUnhandledExceptionEventArgs Class
PostSharp.Patterns.Threading Namespace


ThreadingUnhandledExceptionEventArgs.Source Property

ThreadingUnhandledExceptionEventArgsSource Property

Gets the source component that caught the exception.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ThreadingUnhandledExceptionSource Source { get; }

Property Value

Type: ThreadingUnhandledExceptionSource
See Also

Reference

ThreadingUnhandledExceptionEventArgs Class
PostSharp.Patterns.Threading Namespace


ThreadingUnhandledExceptionSource Enumeration

Enumeration of components that can raise the UnhandledException event.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum ThreadingUnhandledExceptionSource
Members
Member name | Value | Description
None | 0 | None.
Background | 1 | BackgroundAttribute.
Dispatch | 2 | DispatchedAttribute or ActorAttribute.
See Also

Reference

PostSharp.Patterns.Threading Namespace


ThreadMismatchException Class

Exception thrown when a thread attempts to access an object that is affined to another thread.
Inheritance Hierarchy
SystemObject
SystemException
PostSharp.Patterns.ThreadingThreadingException
PostSharp.Patterns.ThreadingThreadMismatchException

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public sealed class ThreadMismatchException : ThreadingException
Constructors
 | Name | Description
Public method | ThreadMismatchException | Initializes a new ThreadMismatchException.
Public method | ThreadMismatchException(String) | Initializes a new ThreadMismatchException and sets the error message.
Public method | ThreadMismatchException(String, Exception) | Initializes a new ThreadMismatchException and sets the error message and the inner exception.
Top
See Also

Reference

PostSharp.Patterns.Threading Namespace

Other Resources

Conceptual: Actor Threading Model
Conceptual: Freezable Threading Model
Conceptual: Immutable Threading Model
Conceptual: Thread Affine Threading Model


ThreadMismatchException Constructor

Overload List
 | Name | Description
Public method | ThreadMismatchException | Initializes a new ThreadMismatchException.
Public method | ThreadMismatchException(String) | Initializes a new ThreadMismatchException and sets the error message.
Public method | ThreadMismatchException(String, Exception) | Initializes a new ThreadMismatchException and sets the error message and the inner exception.
Top
See Also

Reference

ThreadMismatchException Class
PostSharp.Patterns.Threading Namespace


ThreadMismatchException Constructor

Initializes a new ThreadMismatchException.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ThreadMismatchException()
See Also

Reference

ThreadMismatchException Class
ThreadMismatchException Overload
PostSharp.Patterns.Threading Namespace


ThreadMismatchException Constructor (String)

Initializes a new ThreadMismatchException and sets the error message.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ThreadMismatchException(
    string message
)

Parameters

message
Type: SystemString
Error message.
See Also

Reference

ThreadMismatchException Class
ThreadMismatchException Overload
PostSharp.Patterns.Threading Namespace


ThreadMismatchException Constructor (String, Exception)

Initializes a new ThreadMismatchException and sets the error message and the inner exception.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ThreadMismatchException(
    string message,
    Exception inner
)

Parameters

message
Type: SystemString
Error message.
inner
Type: SystemException
Inner exception.
See Also

Reference

ThreadMismatchException Class
ThreadMismatchException Overload
PostSharp.Patterns.Threading Namespace


ThreadSafetyPolicy Class

When applied to an assembly, this policy will check for possible concurrency issues.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.ConstraintsConstraint
PostSharp.ConstraintsScalarConstraint
PostSharp.Patterns.ThreadingThreadSafetyPolicy

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ThreadSafetyPolicy : ScalarConstraint

The ThreadSafetyPolicy type exposes the following members.

Constructors
 | Name | Description
Public method | ThreadSafetyPolicy | Initializes a new instance of the ThreadSafetyPolicy class
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Top
Methods
 | Name | Description
Public method | ValidateCode | Validates the element of code to which the constraint is applied. (Overrides ScalarConstraintValidateCode(Object).)
Public method | ValidateConstraint | Validates the fact that the constraint has been applied on a valid element of code. When this method returns false, the constraint is silently ignored. (Inherited from Constraint.)
Top
Remarks

There are following concurrency issues that are recognized by this policy:

  • Type is not thread-safe.
  • Static field is not read-only.
  • Type of static field is not thread-safe.

    • Thread safety of a type is determined by simple immutability analysis, i.e. the type does contain only

    See Also

    Reference

    PostSharp.Patterns.Threading Namespace

    Other Resources

    Conceptual: Detecting Deadlocks at Runtime
    Conceptual: Making a Whole Project or Solution Thread Safe
    Conceptual: What's New in PostSharp 4.2


ThreadSafetyPolicy Constructor

Initializes a new instance of the ThreadSafetyPolicy class

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ThreadSafetyPolicy()
See Also

Reference

ThreadSafetyPolicy Class
PostSharp.Patterns.Threading Namespace


ThreadSafetyPolicy Properties

The ThreadSafetyPolicy type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Top
See Also

Reference

ThreadSafetyPolicy Class
PostSharp.Patterns.Threading Namespace


ThreadSafetyPolicy Methods

The ThreadSafetyPolicy type exposes the following members.

Methods
 | Name | Description
Public method | ValidateCode | Validates the element of code to which the constraint is applied. (Overrides ScalarConstraintValidateCode(Object).)
Public method | ValidateConstraint | Validates the fact that the constraint has been applied on a valid element of code. When this method returns false, the constraint is silently ignored. (Inherited from Constraint.)
Top
See Also

Reference

ThreadSafetyPolicy Class
PostSharp.Patterns.Threading Namespace


ThreadSafetyPolicy.ValidateCode Method

ThreadSafetyPolicyValidateCode Method

Validates the element of code to which the constraint is applied.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void ValidateCode(
    Object target
)

Parameters

target
Type: SystemObject
Element of code to which the constraint is applied (Assembly, Type, MethodInfo, ConstructorInfo, PropertyInfo, EventInfo, FieldInfo, ParameterInfo).

Implements

IScalarConstraintValidateCode(Object)
See Also

Reference

ThreadSafetyPolicy Class
PostSharp.Patterns.Threading Namespace

Other Resources

Conceptual: Developing Custom Architectural Constraints


ThreadUnsafeAttribute Class

Custom attribute that, when applied on a type, ensures that only one thread executes in methods of this type. When more than one thread accesses methods of this type, a ConcurrentAccessException exception is thrown.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsTypeLevelAspect
PostSharp.AspectsInstanceLevelAspect
PostSharp.Patterns.ModelAggregatableClientAttribute
PostSharp.Patterns.ThreadingThreadAwareAttribute
PostSharp.Patterns.ThreadingThreadUnsafeAttribute

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ThreadUnsafeAttribute : ThreadAwareAttribute

The ThreadUnsafeAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | ThreadUnsafeAttribute | Initializes a new ThreadUnsafeAttribute. policy.
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | Instance | Gets the object to which the current aspect has been applied. (Inherited from InstanceLevelAspect.)
Public property | RuntimeVerificationEnabled | Determines whether the code should be verified against the model at runtime. The default value is true for the debug build configuration and false for the release build configuration. (Inherited from ThreadAwareAttribute.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from AggregatableClientAttribute.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from ThreadAwareAttribute.)
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype. (Inherited from InstanceLevelAspect.)
Public method | Finalize | Destructor. (Inherited from ThreadAwareAttribute.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnCloned | Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object. (Inherited from InstanceLevelAspect.)
Public method | OnInstanceConstructed | Executed when the target instance gets fully initialized, i.e. just after all constructors have completed. (Inherited from AggregatableClientAttribute.)
Public method | OnSerializing | Requires read access level to the current object before serialization can proceed. This method will be introduced into the target class. (Inherited from ThreadAwareAttribute.)
Top
See Also

Reference

PostSharp.Patterns.Threading Namespace

Other Resources

Conceptual: Thread-Unsafe Threading Model
Conceptual: What's New in PostSharp 3.0
Conceptual: Writing Thread-Safe Code with Threading Models


ThreadUnsafeAttribute Constructor

Initializes a new ThreadUnsafeAttribute. policy.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ThreadUnsafeAttribute()
See Also

Reference

ThreadUnsafeAttribute Class
PostSharp.Patterns.Threading Namespace


ThreadUnsafeAttribute Properties

The ThreadUnsafeAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | Instance | Gets the object to which the current aspect has been applied. (Inherited from InstanceLevelAspect.)
Public property | RuntimeVerificationEnabled | Determines whether the code should be verified against the model at runtime. The default value is true for the debug build configuration and false for the release build configuration. (Inherited from ThreadAwareAttribute.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

ThreadUnsafeAttribute Class
PostSharp.Patterns.Threading Namespace


ThreadUnsafeAttribute Methods

The ThreadUnsafeAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Inherited from AggregatableClientAttribute.)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from TypeLevelAspect.)
Public method | CompileTimeValidate(Type) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from ThreadAwareAttribute.)
Public method | CreateInstance | Creates a new instance of the aspect based on the current instance, serving as a prototype. (Inherited from InstanceLevelAspect.)
Public method | Finalize | Destructor. (Inherited from ThreadAwareAttribute.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Public method | OnCloned | Method called after the an object enhanced by the current aspect has been cloned using MemberwiseClone. The this parameter refers to the new aspect instance in the cloned object. (Inherited from InstanceLevelAspect.)
Public method | OnInstanceConstructed | Executed when the target instance gets fully initialized, i.e. just after all constructors have completed. (Inherited from AggregatableClientAttribute.)
Public method | OnSerializing | Requires read access level to the current object before serialization can proceed. This method will be introduced into the target class. (Inherited from ThreadAwareAttribute.)
Top
See Also

Reference

ThreadUnsafeAttribute Class
PostSharp.Patterns.Threading Namespace


UpgradeableReaderAttribute Class

Custom attribute that, when applied on a method, specifies that the method requires read and write access to the object, but other threads are allowed to acquire read (but not write) access to the object until a method with the WriterAttribute custom attribute is executed.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.Patterns.ThreadingAccessLevelAttribute
PostSharp.Patterns.ThreadingUpgradeableReaderAttribute

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class UpgradeableReaderAttribute : AccessLevelAttribute

The UpgradeableReaderAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | UpgradeableReaderAttribute | Initializes a new instance of the UpgradeableReaderAttribute class
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Top
See Also

Reference

PostSharp.Patterns.Threading Namespace
PostSharp.Patterns.ThreadingReaderAttribute
PostSharp.Patterns.ThreadingWriterAttribute
PostSharp.Patterns.ThreadingYielderAttribute

Other Resources

Conceptual: Reader/Writer Synchronized Threading Model


UpgradeableReaderAttribute Constructor

Initializes a new instance of the UpgradeableReaderAttribute class

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public UpgradeableReaderAttribute()
See Also

Reference

UpgradeableReaderAttribute Class
PostSharp.Patterns.Threading Namespace


UpgradeableReaderAttribute Properties

The UpgradeableReaderAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Top
See Also

Reference

UpgradeableReaderAttribute Class
PostSharp.Patterns.Threading Namespace


WriterAttribute Class

Custom attribute that, when applied on a method, specifies that the method requires write access to the object.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.Patterns.ThreadingAccessLevelAttribute
PostSharp.Patterns.ThreadingWriterAttribute

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class WriterAttribute : AccessLevelAttribute

The WriterAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | WriterAttribute | Initializes a new instance of the WriterAttribute class
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Top
See Also

Reference

PostSharp.Patterns.Threading Namespace
PostSharp.Patterns.ThreadingReaderAttribute
PostSharp.Patterns.ThreadingUpgradeableReaderAttribute
PostSharp.Patterns.ThreadingYielderAttribute

Other Resources

Conceptual: Reader/Writer Synchronized Threading Model


WriterAttribute Constructor

Initializes a new instance of the WriterAttribute class

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public WriterAttribute()
See Also

Reference

WriterAttribute Class
PostSharp.Patterns.Threading Namespace


WriterAttribute Properties

The WriterAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Top
See Also

Reference

WriterAttribute Class
PostSharp.Patterns.Threading Namespace


YielderAttribute Class

Custom attribute that, when applied on a method, specifies that the method that currently holds write access to the object (see WriterAttribute) allows other threads to read the object during the execution of the target method. This custom attribute is typically used on methods that raise events that must be processed synchronously by other threads.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.Patterns.ThreadingAccessLevelAttribute
PostSharp.Patterns.ThreadingYielderAttribute

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class YielderAttribute : AccessLevelAttribute

The YielderAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | YielderAttribute | Initializes a new instance of the YielderAttribute class
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Top
See Also

Reference

PostSharp.Patterns.Threading Namespace
PostSharp.Patterns.ThreadingReaderAttribute
PostSharp.Patterns.ThreadingWriterAttribute
PostSharp.Patterns.ThreadingUpgradeableReaderAttribute

Other Resources

Conceptual: Reader/Writer Synchronized Threading Model


YielderAttribute Constructor

Initializes a new instance of the YielderAttribute class

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public YielderAttribute()
See Also

Reference

YielderAttribute Class
PostSharp.Patterns.Threading Namespace


YielderAttribute Properties

The YielderAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Top
See Also

Reference

YielderAttribute Class
PostSharp.Patterns.Threading Namespace


PostSharp.Patterns.Threading.Models Namespace

Classes
 | Class | Description
Public class | ActorThreadingModel | The ActorThreadingModel class describes a threading model in which to methods are processed asynchronously from a single thread, suppressing concurrency inside each instance of the actor. To use the ActorThreadingModel, apply the ActorAttribute to a class.
Public class | FreezableThreadingModel | The FreezableThreadingModel class describes a threading model where changes to an object are forbidden after the Freeze method has been called on this object. To use the FreezableThreadingModel, apply the FreezableAttribute custom attribute to a class.
Public class | ImmutableThreadingModel | The ImmutableThreadingModel class describes a threading model where changes to an object are forbidden after completion of the object constructor. To use the ImmutableThreadingModel, apply the ImmutableAttribute custom attribute to a class.
Public class | PrivateThreadingModel | The PrivateThreadingModel class describes a behavior of objects in which their threading model is determined by the parent they are assigned to in a parent-child relationship. Objects with this threading model are considered a private state of their parent object and cannot be accessed from a different object.
Public class | ReaderWriterSynchronizedThreadingModel | The ReaderWriterSynchronizedThreadingModel class describes a threading model where several threads can have concurrent read-only access, but where writing to the object requires exclusive access. To use the ReaderWriterSynchronizedThreadingModel, apply the ReaderWriterSynchronizedAttribute custom attribute to a class.
Public class | ReadOnlyThreadingModel | Base class for FreezableThreadingModel and ImmutableThreadingModel.
Public class | SynchronizedThreadingModel | The SynchronizedThreadingModel class describes a threading model where only a single thread can access the object at a time. To use the SynchronizedThreadingModel, apply the SynchronizedAttribute custom attribute to a class.
Public class | ThreadAffineThreadingModel | The ThreadAffineThreadingModel class describes a threading model where only the thread that created the object has the right to access this object. To use the ThreadAffineThreadingModel, apply the ThreadAffineAttribute custom attribute to a class.
Public class | ThreadUnsafeThreadingModel | The ThreadUnsafeThreadingModel class describes a threading model an object cannot be accessed concurrently by several threads. In case of concurrent access, a ConcurrentAccessException exception will be thrown. The thread-unsafe threading model is not strictly a model, because it cannot be deterministically verified. To use the ThreadAffineThreadingModel, apply the ThreadUnsafeAttribute custom attribute to a class.


ActorThreadingModel Class

The ActorThreadingModel class describes a threading model in which to methods are processed asynchronously from a single thread, suppressing concurrency inside each instance of the actor. To use the ActorThreadingModel, apply the ActorAttribute to a class.

Inheritance Hierarchy
SystemObject
PostSharp.Patterns.ThreadingThreadingModel
PostSharp.Patterns.Threading.ModelsActorThreadingModel

Namespace: PostSharp.Patterns.Threading.Models
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ActorThreadingModel : ThreadingModel

The ActorThreadingModel type exposes the following members.

Properties
 | Name | Description
Public property | IsBlocking | Determines whether the current ThreadingModel has blocking semantics, i.e. if the threading model may cause the executing thread to be blocked, for instance when waiting for a lock. (Overrides ThreadingModelIsBlocking.)
Public property | IsThreadSafe | Determines whether the threading model is possibly thread safe. (Overrides ThreadingModelIsThreadSafe.)
Top
Methods
 | Name | Description
Public method | ToString | Returns a string that represents the current object. (Inherited from ThreadingModel.)
Top
See Also

Reference

PostSharp.Patterns.Threading.Models Namespace


ActorThreadingModel Properties

The ActorThreadingModel type exposes the following members.

Properties
 | Name | Description
Public property | IsBlocking | Determines whether the current ThreadingModel has blocking semantics, i.e. if the threading model may cause the executing thread to be blocked, for instance when waiting for a lock. (Overrides ThreadingModelIsBlocking.)
Public property | IsThreadSafe | Determines whether the threading model is possibly thread safe. (Overrides ThreadingModelIsThreadSafe.)
Top
See Also

Reference

ActorThreadingModel Class
PostSharp.Patterns.Threading.Models Namespace


ActorThreadingModel.IsBlocking Property

ActorThreadingModelIsBlocking Property

Determines whether the current ThreadingModel has blocking semantics, i.e. if the threading model may cause the executing thread to be blocked, for instance when waiting for a lock.

Namespace: PostSharp.Patterns.Threading.Models
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool IsBlocking { get; }

Property Value

Type: Boolean
See Also

Reference

ActorThreadingModel Class
PostSharp.Patterns.Threading.Models Namespace


ActorThreadingModel.IsThreadSafe Property

ActorThreadingModelIsThreadSafe Property

Determines whether the threading model is possibly thread safe.

Namespace: PostSharp.Patterns.Threading.Models
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool IsThreadSafe { get; }

Property Value

Type: Boolean
See Also

Reference

ActorThreadingModel Class
PostSharp.Patterns.Threading.Models Namespace


ActorThreadingModel Methods

The ActorThreadingModel type exposes the following members.

Methods
 | Name | Description
Public method | ToString | Returns a string that represents the current object. (Inherited from ThreadingModel.)
Top
See Also

Reference

ActorThreadingModel Class
PostSharp.Patterns.Threading.Models Namespace


FreezableThreadingModel Class

The FreezableThreadingModel class describes a threading model where changes to an object are forbidden after the Freeze method has been called on this object. To use the FreezableThreadingModel, apply the FreezableAttribute custom attribute to a class.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.ThreadingThreadingModel
PostSharp.Patterns.Threading.ModelsReadOnlyThreadingModel
PostSharp.Patterns.Threading.ModelsFreezableThreadingModel

Namespace: PostSharp.Patterns.Threading.Models
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class FreezableThreadingModel : ReadOnlyThreadingModel

The FreezableThreadingModel type exposes the following members.

Properties
 | Name | Description
Public property | IsBlocking | Determines whether the current ThreadingModel has blocking semantics, i.e. if the threading model may cause the executing thread to be blocked, for instance when waiting for a lock. (Inherited from ReadOnlyThreadingModel.)
Public property | IsThreadSafe | Determines whether the threading model is possibly thread safe. (Inherited from ReadOnlyThreadingModel.)
Top
Methods
 | Name | Description
Public method | ToString | Returns a string that represents the current object. (Inherited from ThreadingModel.)
Top
See Also

Reference

PostSharp.Patterns.Threading.Models Namespace


FreezableThreadingModel Properties

The FreezableThreadingModel type exposes the following members.

Properties
 | Name | Description
Public property | IsBlocking | Determines whether the current ThreadingModel has blocking semantics, i.e. if the threading model may cause the executing thread to be blocked, for instance when waiting for a lock. (Inherited from ReadOnlyThreadingModel.)
Public property | IsThreadSafe | Determines whether the threading model is possibly thread safe. (Inherited from ReadOnlyThreadingModel.)
Top
See Also

Reference

FreezableThreadingModel Class
PostSharp.Patterns.Threading.Models Namespace


FreezableThreadingModel Methods

The FreezableThreadingModel type exposes the following members.

Methods
 | Name | Description
Public method | ToString | Returns a string that represents the current object. (Inherited from ThreadingModel.)
Top
See Also

Reference

FreezableThreadingModel Class
PostSharp.Patterns.Threading.Models Namespace


ImmutableThreadingModel Class

The ImmutableThreadingModel class describes a threading model where changes to an object are forbidden after completion of the object constructor. To use the ImmutableThreadingModel, apply the ImmutableAttribute custom attribute to a class.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.ThreadingThreadingModel
PostSharp.Patterns.Threading.ModelsReadOnlyThreadingModel
PostSharp.Patterns.Threading.ModelsImmutableThreadingModel

Namespace: PostSharp.Patterns.Threading.Models
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ImmutableThreadingModel : ReadOnlyThreadingModel

The ImmutableThreadingModel type exposes the following members.

Properties
 | Name | Description
Public property | IsBlocking | Determines whether the current ThreadingModel has blocking semantics, i.e. if the threading model may cause the executing thread to be blocked, for instance when waiting for a lock. (Inherited from ReadOnlyThreadingModel.)
Public property | IsThreadSafe | Determines whether the threading model is possibly thread safe. (Inherited from ReadOnlyThreadingModel.)
Top
Methods
 | Name | Description
Public method | ToString | Returns a string that represents the current object. (Inherited from ThreadingModel.)
Top
See Also

Reference

PostSharp.Patterns.Threading.Models Namespace


ImmutableThreadingModel Properties

The ImmutableThreadingModel type exposes the following members.

Properties
 | Name | Description
Public property | IsBlocking | Determines whether the current ThreadingModel has blocking semantics, i.e. if the threading model may cause the executing thread to be blocked, for instance when waiting for a lock. (Inherited from ReadOnlyThreadingModel.)
Public property | IsThreadSafe | Determines whether the threading model is possibly thread safe. (Inherited from ReadOnlyThreadingModel.)
Top
See Also

Reference

ImmutableThreadingModel Class
PostSharp.Patterns.Threading.Models Namespace


ImmutableThreadingModel Methods

The ImmutableThreadingModel type exposes the following members.

Methods
 | Name | Description
Public method | ToString | Returns a string that represents the current object. (Inherited from ThreadingModel.)
Top
See Also

Reference

ImmutableThreadingModel Class
PostSharp.Patterns.Threading.Models Namespace


PrivateThreadingModel Class

The PrivateThreadingModel class describes a behavior of objects in which their threading model is determined by the parent they are assigned to in a parent-child relationship. Objects with this threading model are considered a private state of their parent object and cannot be accessed from a different object.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.ThreadingThreadingModel
PostSharp.Patterns.Threading.ModelsPrivateThreadingModel

Namespace: PostSharp.Patterns.Threading.Models
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class PrivateThreadingModel : ThreadingModel

The PrivateThreadingModel type exposes the following members.

Properties
 | Name | Description
Public property | IsBlocking | Determines whether the current ThreadingModel has blocking semantics, i.e. if the threading model may cause the executing thread to be blocked, for instance when waiting for a lock. (Overrides ThreadingModelIsBlocking.)
Public property | IsThreadSafe | Determines whether the threading model is possibly thread safe. (Overrides ThreadingModelIsThreadSafe.)
Top
Methods
 | Name | Description
Public method | ToString | Returns a string that represents the current object. (Inherited from ThreadingModel.)
Top
See Also

Reference

PostSharp.Patterns.Threading.Models Namespace


PrivateThreadingModel Properties

The PrivateThreadingModel type exposes the following members.

Properties
 | Name | Description
Public property | IsBlocking | Determines whether the current ThreadingModel has blocking semantics, i.e. if the threading model may cause the executing thread to be blocked, for instance when waiting for a lock. (Overrides ThreadingModelIsBlocking.)
Public property | IsThreadSafe | Determines whether the threading model is possibly thread safe. (Overrides ThreadingModelIsThreadSafe.)
Top
See Also

Reference

PrivateThreadingModel Class
PostSharp.Patterns.Threading.Models Namespace


PrivateThreadingModel.IsBlocking Property

PrivateThreadingModelIsBlocking Property

Determines whether the current ThreadingModel has blocking semantics, i.e. if the threading model may cause the executing thread to be blocked, for instance when waiting for a lock.

Namespace: PostSharp.Patterns.Threading.Models
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool IsBlocking { get; }

Property Value

Type: Boolean
See Also

Reference

PrivateThreadingModel Class
PostSharp.Patterns.Threading.Models Namespace


PrivateThreadingModel.IsThreadSafe Property

PrivateThreadingModelIsThreadSafe Property

Determines whether the threading model is possibly thread safe.

Namespace: PostSharp.Patterns.Threading.Models
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool IsThreadSafe { get; }

Property Value

Type: Boolean
See Also

Reference

PrivateThreadingModel Class
PostSharp.Patterns.Threading.Models Namespace


PrivateThreadingModel Methods

The PrivateThreadingModel type exposes the following members.

Methods
 | Name | Description
Public method | ToString | Returns a string that represents the current object. (Inherited from ThreadingModel.)
Top
See Also

Reference

PrivateThreadingModel Class
PostSharp.Patterns.Threading.Models Namespace


ReaderWriterSynchronizedThreadingModel Class

The ReaderWriterSynchronizedThreadingModel class describes a threading model where several threads can have concurrent read-only access, but where writing to the object requires exclusive access. To use the ReaderWriterSynchronizedThreadingModel, apply the ReaderWriterSynchronizedAttribute custom attribute to a class.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.ThreadingThreadingModel
PostSharp.Patterns.Threading.ModelsReaderWriterSynchronizedThreadingModel

Namespace: PostSharp.Patterns.Threading.Models
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ReaderWriterSynchronizedThreadingModel : ThreadingModel

The ReaderWriterSynchronizedThreadingModel type exposes the following members.

Properties
 | Name | Description
Public property | IsBlocking | Determines whether the current ThreadingModel has blocking semantics, i.e. if the threading model may cause the executing thread to be blocked, for instance when waiting for a lock. (Overrides ThreadingModelIsBlocking.)
Public property | IsThreadSafe | Determines whether the threading model is possibly thread safe. (Overrides ThreadingModelIsThreadSafe.)
Top
Methods
 | Name | Description
Public method | ToString | Returns a string that represents the current object. (Inherited from ThreadingModel.)
Top
See Also

Reference

PostSharp.Patterns.Threading.Models Namespace


ReaderWriterSynchronizedThreadingModel Properties

The ReaderWriterSynchronizedThreadingModel type exposes the following members.

Properties
 | Name | Description
Public property | IsBlocking | Determines whether the current ThreadingModel has blocking semantics, i.e. if the threading model may cause the executing thread to be blocked, for instance when waiting for a lock. (Overrides ThreadingModelIsBlocking.)
Public property | IsThreadSafe | Determines whether the threading model is possibly thread safe. (Overrides ThreadingModelIsThreadSafe.)
Top
See Also

Reference

ReaderWriterSynchronizedThreadingModel Class
PostSharp.Patterns.Threading.Models Namespace


ReaderWriterSynchronizedThreadingModel.IsBlocking Property

ReaderWriterSynchronizedThreadingModelIsBlocking Property

Determines whether the current ThreadingModel has blocking semantics, i.e. if the threading model may cause the executing thread to be blocked, for instance when waiting for a lock.

Namespace: PostSharp.Patterns.Threading.Models
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool IsBlocking { get; }

Property Value

Type: Boolean
See Also

Reference

ReaderWriterSynchronizedThreadingModel Class
PostSharp.Patterns.Threading.Models Namespace


ReaderWriterSynchronizedThreadingModel.IsThreadSafe Property

ReaderWriterSynchronizedThreadingModelIsThreadSafe Property

Determines whether the threading model is possibly thread safe.

Namespace: PostSharp.Patterns.Threading.Models
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool IsThreadSafe { get; }

Property Value

Type: Boolean
See Also

Reference

ReaderWriterSynchronizedThreadingModel Class
PostSharp.Patterns.Threading.Models Namespace


ReaderWriterSynchronizedThreadingModel Methods

The ReaderWriterSynchronizedThreadingModel type exposes the following members.

Methods
 | Name | Description
Public method | ToString | Returns a string that represents the current object. (Inherited from ThreadingModel.)
Top
See Also

Reference

ReaderWriterSynchronizedThreadingModel Class
PostSharp.Patterns.Threading.Models Namespace


ReadOnlyThreadingModel Class

Base class for FreezableThreadingModel and ImmutableThreadingModel.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.ThreadingThreadingModel
PostSharp.Patterns.Threading.ModelsReadOnlyThreadingModel
PostSharp.Patterns.Threading.ModelsFreezableThreadingModel
PostSharp.Patterns.Threading.ModelsImmutableThreadingModel

Namespace: PostSharp.Patterns.Threading.Models
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class ReadOnlyThreadingModel : ThreadingModel

The ReadOnlyThreadingModel type exposes the following members.

Properties
 | Name | Description
Public property | IsBlocking | Determines whether the current ThreadingModel has blocking semantics, i.e. if the threading model may cause the executing thread to be blocked, for instance when waiting for a lock. (Overrides ThreadingModelIsBlocking.)
Public property | IsThreadSafe | Determines whether the threading model is possibly thread safe. (Overrides ThreadingModelIsThreadSafe.)
Top
Methods
 | Name | Description
Public method | ToString | Returns a string that represents the current object. (Inherited from ThreadingModel.)
Top
See Also

Reference

PostSharp.Patterns.Threading.Models Namespace


ReadOnlyThreadingModel Properties

The ReadOnlyThreadingModel type exposes the following members.

Properties
 | Name | Description
Public property | IsBlocking | Determines whether the current ThreadingModel has blocking semantics, i.e. if the threading model may cause the executing thread to be blocked, for instance when waiting for a lock. (Overrides ThreadingModelIsBlocking.)
Public property | IsThreadSafe | Determines whether the threading model is possibly thread safe. (Overrides ThreadingModelIsThreadSafe.)
Top
See Also

Reference

ReadOnlyThreadingModel Class
PostSharp.Patterns.Threading.Models Namespace


ReadOnlyThreadingModel.IsBlocking Property

ReadOnlyThreadingModelIsBlocking Property

Determines whether the current ThreadingModel has blocking semantics, i.e. if the threading model may cause the executing thread to be blocked, for instance when waiting for a lock.

Namespace: PostSharp.Patterns.Threading.Models
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool IsBlocking { get; }

Property Value

Type: Boolean
See Also

Reference

ReadOnlyThreadingModel Class
PostSharp.Patterns.Threading.Models Namespace


ReadOnlyThreadingModel.IsThreadSafe Property

ReadOnlyThreadingModelIsThreadSafe Property

Determines whether the threading model is possibly thread safe.

Namespace: PostSharp.Patterns.Threading.Models
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool IsThreadSafe { get; }

Property Value

Type: Boolean
See Also

Reference

ReadOnlyThreadingModel Class
PostSharp.Patterns.Threading.Models Namespace


ReadOnlyThreadingModel Methods

The ReadOnlyThreadingModel type exposes the following members.

Methods
 | Name | Description
Public method | ToString | Returns a string that represents the current object. (Inherited from ThreadingModel.)
Top
See Also

Reference

ReadOnlyThreadingModel Class
PostSharp.Patterns.Threading.Models Namespace


SynchronizedThreadingModel Class

The SynchronizedThreadingModel class describes a threading model where only a single thread can access the object at a time. To use the SynchronizedThreadingModel, apply the SynchronizedAttribute custom attribute to a class.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.ThreadingThreadingModel
PostSharp.Patterns.Threading.ModelsSynchronizedThreadingModel

Namespace: PostSharp.Patterns.Threading.Models
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class SynchronizedThreadingModel : ThreadingModel

The SynchronizedThreadingModel type exposes the following members.

Properties
 | Name | Description
Public property | IsBlocking | Determines whether the current ThreadingModel has blocking semantics, i.e. if the threading model may cause the executing thread to be blocked, for instance when waiting for a lock. (Overrides ThreadingModelIsBlocking.)
Public property | IsThreadSafe | Determines whether the threading model is possibly thread safe. (Overrides ThreadingModelIsThreadSafe.)
Top
Methods
 | Name | Description
Public method | ToString | Returns a string that represents the current object. (Inherited from ThreadingModel.)
Top
See Also

Reference

PostSharp.Patterns.Threading.Models Namespace


SynchronizedThreadingModel Properties

The SynchronizedThreadingModel type exposes the following members.

Properties
 | Name | Description
Public property | IsBlocking | Determines whether the current ThreadingModel has blocking semantics, i.e. if the threading model may cause the executing thread to be blocked, for instance when waiting for a lock. (Overrides ThreadingModelIsBlocking.)
Public property | IsThreadSafe | Determines whether the threading model is possibly thread safe. (Overrides ThreadingModelIsThreadSafe.)
Top
See Also

Reference

SynchronizedThreadingModel Class
PostSharp.Patterns.Threading.Models Namespace


SynchronizedThreadingModel.IsBlocking Property

SynchronizedThreadingModelIsBlocking Property

Determines whether the current ThreadingModel has blocking semantics, i.e. if the threading model may cause the executing thread to be blocked, for instance when waiting for a lock.

Namespace: PostSharp.Patterns.Threading.Models
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool IsBlocking { get; }

Property Value

Type: Boolean
See Also

Reference

SynchronizedThreadingModel Class
PostSharp.Patterns.Threading.Models Namespace


SynchronizedThreadingModel.IsThreadSafe Property

SynchronizedThreadingModelIsThreadSafe Property

Determines whether the threading model is possibly thread safe.

Namespace: PostSharp.Patterns.Threading.Models
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool IsThreadSafe { get; }

Property Value

Type: Boolean
See Also

Reference

SynchronizedThreadingModel Class
PostSharp.Patterns.Threading.Models Namespace


SynchronizedThreadingModel Methods

The SynchronizedThreadingModel type exposes the following members.

Methods
 | Name | Description
Public method | ToString | Returns a string that represents the current object. (Inherited from ThreadingModel.)
Top
See Also

Reference

SynchronizedThreadingModel Class
PostSharp.Patterns.Threading.Models Namespace


ThreadAffineThreadingModel Class

The ThreadAffineThreadingModel class describes a threading model where only the thread that created the object has the right to access this object. To use the ThreadAffineThreadingModel, apply the ThreadAffineAttribute custom attribute to a class.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.ThreadingThreadingModel
PostSharp.Patterns.Threading.ModelsThreadUnsafeThreadingModel
PostSharp.Patterns.Threading.ModelsThreadAffineThreadingModel

Namespace: PostSharp.Patterns.Threading.Models
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ThreadAffineThreadingModel : ThreadUnsafeThreadingModel

The ThreadAffineThreadingModel type exposes the following members.

Properties
 | Name | Description
Public property | IsBlocking | Determines whether the current ThreadingModel has blocking semantics, i.e. if the threading model may cause the executing thread to be blocked, for instance when waiting for a lock. (Inherited from ThreadUnsafeThreadingModel.)
Public property | IsThreadSafe | Determines whether the threading model is possibly thread safe. (Inherited from ThreadUnsafeThreadingModel.)
Top
Methods
 | Name | Description
Public method | ToString | Returns a string that represents the current object. (Inherited from ThreadingModel.)
Top
See Also

Reference

PostSharp.Patterns.Threading.Models Namespace


ThreadAffineThreadingModel Properties

The ThreadAffineThreadingModel type exposes the following members.

Properties
 | Name | Description
Public property | IsBlocking | Determines whether the current ThreadingModel has blocking semantics, i.e. if the threading model may cause the executing thread to be blocked, for instance when waiting for a lock. (Inherited from ThreadUnsafeThreadingModel.)
Public property | IsThreadSafe | Determines whether the threading model is possibly thread safe. (Inherited from ThreadUnsafeThreadingModel.)
Top
See Also

Reference

ThreadAffineThreadingModel Class
PostSharp.Patterns.Threading.Models Namespace


ThreadAffineThreadingModel Methods

The ThreadAffineThreadingModel type exposes the following members.

Methods
 | Name | Description
Public method | ToString | Returns a string that represents the current object. (Inherited from ThreadingModel.)
Top
See Also

Reference

ThreadAffineThreadingModel Class
PostSharp.Patterns.Threading.Models Namespace


ThreadUnsafeThreadingModel Class

The ThreadUnsafeThreadingModel class describes a threading model an object cannot be accessed concurrently by several threads. In case of concurrent access, a ConcurrentAccessException exception will be thrown. The thread-unsafe threading model is not strictly a model, because it cannot be deterministically verified. To use the ThreadAffineThreadingModel, apply the ThreadUnsafeAttribute custom attribute to a class.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.ThreadingThreadingModel
PostSharp.Patterns.Threading.ModelsThreadUnsafeThreadingModel
PostSharp.Patterns.Threading.ModelsThreadAffineThreadingModel

Namespace: PostSharp.Patterns.Threading.Models
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class ThreadUnsafeThreadingModel : ThreadingModel

The ThreadUnsafeThreadingModel type exposes the following members.

Properties
 | Name | Description
Public property | IsBlocking | Determines whether the current ThreadingModel has blocking semantics, i.e. if the threading model may cause the executing thread to be blocked, for instance when waiting for a lock. (Overrides ThreadingModelIsBlocking.)
Public property | IsThreadSafe | Determines whether the threading model is possibly thread safe. (Overrides ThreadingModelIsThreadSafe.)
Top
Methods
 | Name | Description
Public method | ToString | Returns a string that represents the current object. (Inherited from ThreadingModel.)
Top
See Also

Reference

PostSharp.Patterns.Threading.Models Namespace


ThreadUnsafeThreadingModel Properties

The ThreadUnsafeThreadingModel type exposes the following members.

Properties
 | Name | Description
Public property | IsBlocking | Determines whether the current ThreadingModel has blocking semantics, i.e. if the threading model may cause the executing thread to be blocked, for instance when waiting for a lock. (Overrides ThreadingModelIsBlocking.)
Public property | IsThreadSafe | Determines whether the threading model is possibly thread safe. (Overrides ThreadingModelIsThreadSafe.)
Top
See Also

Reference

ThreadUnsafeThreadingModel Class
PostSharp.Patterns.Threading.Models Namespace


ThreadUnsafeThreadingModel.IsBlocking Property

ThreadUnsafeThreadingModelIsBlocking Property

Determines whether the current ThreadingModel has blocking semantics, i.e. if the threading model may cause the executing thread to be blocked, for instance when waiting for a lock.

Namespace: PostSharp.Patterns.Threading.Models
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool IsBlocking { get; }

Property Value

Type: Boolean
See Also

Reference

ThreadUnsafeThreadingModel Class
PostSharp.Patterns.Threading.Models Namespace


ThreadUnsafeThreadingModel.IsThreadSafe Property

ThreadUnsafeThreadingModelIsThreadSafe Property

Determines whether the threading model is possibly thread safe.

Namespace: PostSharp.Patterns.Threading.Models
Assembly: PostSharp.Patterns.Threading (in PostSharp.Patterns.Threading.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool IsThreadSafe { get; }

Property Value

Type: Boolean
See Also

Reference

ThreadUnsafeThreadingModel Class
PostSharp.Patterns.Threading.Models Namespace


ThreadUnsafeThreadingModel Methods

The ThreadUnsafeThreadingModel type exposes the following members.

Methods
 | Name | Description
Public method | ToString | Returns a string that represents the current object. (Inherited from ThreadingModel.)
Top
See Also

Reference

ThreadUnsafeThreadingModel Class
PostSharp.Patterns.Threading.Models Namespace


PostSharp.Patterns.Utilities Namespace

Classes
 | Class | Description
Public class | LocalizedTextProvider | Base class for providers of error messages. Implements chain of responsibility between multiple providers.
Public class | ServiceLocator | A basic service locator used by PostSharp Patterns to find global services.
Public class | ServiceRegisteredEventArgs | Arguments of the ServiceRegistered event.


LocalizedTextProvider Class

Base class for providers of error messages. Implements chain of responsibility between multiple providers.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.UtilitiesLocalizedTextProvider
PostSharp.Patterns.ContractsContractLocalizedTextProvider

Namespace: PostSharp.Patterns.Utilities
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class LocalizedTextProvider

The LocalizedTextProvider type exposes the following members.

Constructors
 | Name | Description
Protected method | LocalizedTextProvider | Initializes a new instance of LocalizedTextProvider class.
Top
Methods
 | Name | Description
Public method | FormatString | Formats a string. An implementation would typically invoke Format(String, Object).
Public method | GetMessage | Gets a message declared by the LocalizedTextProvider or the rest of responsibility chain if applicable.
Top
Remarks
Each chain of providers has it's own base class derived from this one, which contains static field Current that points to current provider.
See Also

Reference

PostSharp.Patterns.Utilities Namespace

Other Resources

Conceptual: Localizing Contract Errors


LocalizedTextProvider Constructor

Initializes a new instance of LocalizedTextProvider class.

Namespace: PostSharp.Patterns.Utilities
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected LocalizedTextProvider(
    LocalizedTextProvider next
)

Parameters

next
Type: PostSharp.Patterns.UtilitiesLocalizedTextProvider
Next LocalizedTextProvider in the responsibility chain.
See Also

Reference

LocalizedTextProvider Class
PostSharp.Patterns.Utilities Namespace


LocalizedTextProvider Methods

The LocalizedTextProvider type exposes the following members.

Methods
 | Name | Description
Public method | FormatString | Formats a string. An implementation would typically invoke Format(String, Object).
Public method | GetMessage | Gets a message declared by the LocalizedTextProvider or the rest of responsibility chain if applicable.
Top
See Also

Reference

LocalizedTextProvider Class
PostSharp.Patterns.Utilities Namespace


LocalizedTextProvider.FormatString Method

LocalizedTextProviderFormatString Method

Formats a string. An implementation would typically invoke Format(String, Object).

Namespace: PostSharp.Patterns.Utilities
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual string FormatString(
    string format,
    Object[] arguments
)

Parameters

format
Type: SystemString
Formatting string. Typically (but not necessarily) the string returned by GetMessage(String).
arguments
Type: SystemObject
Arguments.

Return Value

Type: String
The formatted string.
See Also

Reference

LocalizedTextProvider Class
PostSharp.Patterns.Utilities Namespace


LocalizedTextProvider.GetMessage Method

LocalizedTextProviderGetMessage Method

Gets a message declared by the LocalizedTextProvider or the rest of responsibility chain if applicable.

Namespace: PostSharp.Patterns.Utilities
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual string GetMessage(
    string messageId
)

Parameters

messageId
Type: SystemString
Identifier of the message.

Return Value

Type: String
Message represented by messageId. Returning null is not allowed.
Remarks

An implementation must call the base implementation if it does not provide the requested message. The base implementation is responsible to invoke the next provider in the chain of responsibility.

See Also

Reference

LocalizedTextProvider Class
PostSharp.Patterns.Utilities Namespace

Other Resources

Conceptual: Localizing Contract Errors


ServiceLocator Class

A basic service locator used by PostSharp Patterns to find global services.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.UtilitiesServiceLocator

Namespace: PostSharp.Patterns.Utilities
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static class ServiceLocator

The ServiceLocator type exposes the following members.

Methods
Name | Description
GetServiceT | Gets a service implementation.
RegisterServiceT | Registers a service.
Top
Events
Name | Description
ServiceRegistered | Event raised when a new service is registered.
Top
See Also

Reference

PostSharp.Patterns.Utilities Namespace


ServiceLocator Methods

The ServiceLocator type exposes the following members.

Methods
Name | Description
GetServiceT | Gets a service implementation.
RegisterServiceT | Registers a service.
Top
See Also

Reference

ServiceLocator Class
PostSharp.Patterns.Utilities Namespace


ServiceLocator.GetService(T) Method

ServiceLocatorGetServiceT Method

Gets a service implementation.

Namespace: PostSharp.Patterns.Utilities
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static T GetService<T>()
where T : class

Type Parameters

T
Type of the requested service interface.

Return Value

Type: T
An implementation of T, or null if no such service has been registered.
See Also

Reference

ServiceLocator Class
PostSharp.Patterns.Utilities Namespace


ServiceLocator.RegisterService(T) Method

ServiceLocatorRegisterServiceT Method

Registers a service.

Namespace: PostSharp.Patterns.Utilities
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void RegisterService<T>(
    T service
)
where T : class

Parameters

service
Type: T
Service implementation.

Type Parameters

T
Type of the service interface.
See Also

Reference

ServiceLocator Class
PostSharp.Patterns.Utilities Namespace


ServiceLocator Events

The ServiceLocator type exposes the following members.

Events
Name | Description
ServiceRegistered | Event raised when a new service is registered.
Top
See Also

Reference

ServiceLocator Class
PostSharp.Patterns.Utilities Namespace


ServiceLocator.ServiceRegistered Event

ServiceLocatorServiceRegistered Event

Event raised when a new service is registered.

Namespace: PostSharp.Patterns.Utilities
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static event EventHandler<ServiceRegisteredEventArgs> ServiceRegistered

Value

Type: SystemEventHandler ServiceRegisteredEventArgs
See Also

Reference

ServiceLocator Class
PostSharp.Patterns.Utilities Namespace


ServiceRegisteredEventArgs Class

Arguments of the ServiceRegistered event.
Inheritance Hierarchy
SystemObject
SystemEventArgs
PostSharp.Patterns.UtilitiesServiceRegisteredEventArgs

Namespace: PostSharp.Patterns.Utilities
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ServiceRegisteredEventArgs : EventArgs

The ServiceRegisteredEventArgs type exposes the following members.

Properties
 | Name | Description
Public property | ServiceType | Gets the Type of the service interface.
Top
See Also

Reference

PostSharp.Patterns.Utilities Namespace


ServiceRegisteredEventArgs Properties

The ServiceRegisteredEventArgs type exposes the following members.

Properties
 | Name | Description
Public property | ServiceType | Gets the Type of the service interface.
Top
See Also

Reference

ServiceRegisteredEventArgs Class
PostSharp.Patterns.Utilities Namespace


ServiceRegisteredEventArgs.ServiceType Property

ServiceRegisteredEventArgsServiceType Property

Gets the Type of the service interface.

Namespace: PostSharp.Patterns.Utilities
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Type ServiceType { get; }

Property Value

Type: Type
See Also

Reference

ServiceRegisteredEventArgs Class
PostSharp.Patterns.Utilities Namespace


PostSharp.Patterns.Xaml Namespace

Classes
 | Class | Description
Public class | AttachedT | Type of properties that are turned into XAML attached properties by the AttachedPropertyAttribute aspect.
Public class | AttachedPropertyAttribute | Custom attribute that, when applied on a static automatic property and of type AttachedT turns this property into a XAML dependency property of the same name and whose value type is T.
Public class | CommandAttribute | Custom attribute that, when applied on a property of type ICommand named say Foo, automatically create a new command class based on a method named ExecuteFoo and an optional property or method named CanExecuteFoo.
Public class | DependencyPropertyAttribute | Custom attribute that, when applied on an automatic property, turns this property into a XAML dependency property of the same name.
Public class | DependencyPropertyServices | Exposes helper methods that work with the DependencyPropertyAttribute and AttachedPropertyAttribute aspects.


Attached(T) Class

AttachedT Class

Type of properties that are turned into XAML attached properties by the AttachedPropertyAttribute aspect.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.XamlAttachedT

Namespace: PostSharp.Patterns.Xaml
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class Attached<T>

Type Parameters

T
The type of the underlying attached property.

The AttachedT type exposes the following members.

Properties
 | Name | Description
Public property | Item | Gets or sets the value of the current attached property for a given object (see GetValue(DependencyProperty) and SetValue(DependencyProperty, Object)).
Public property | RuntimeProperty | Gets DependencyProperty registered in runtime.
Top
Methods
 | Name | Description
Public method | SetCurrentValue | Sets the value of this attached property for a given object without changing its value source (see SetCurrentValue(DependencyProperty, Object)).
Top
See Also

Reference

PostSharp.Patterns.Xaml Namespace

Other Resources

Conceptual: Attached Property


Attached(T) Properties

AttachedT Properties

The AttachedT generic type exposes the following members.

Properties
 | Name | Description
Public property | Item | Gets or sets the value of the current attached property for a given object (see GetValue(DependencyProperty) and SetValue(DependencyProperty, Object)).
Public property | RuntimeProperty | Gets DependencyProperty registered in runtime.
Top
See Also

Reference

AttachedT Class
PostSharp.Patterns.Xaml Namespace


Attached(T).Item Property

AttachedTItem Property

Gets or sets the value of the current attached property for a given object (see GetValue(DependencyProperty) and SetValue(DependencyProperty, Object)).

Namespace: PostSharp.Patterns.Xaml
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public T this[
    DependencyObject obj
] { get; set; }

Parameters

obj
Type: System.WindowsDependencyObject
The object for which the property is get or set.

Return Value

Type: T
The value of the attached property for obj.
See Also

Reference

AttachedT Class
PostSharp.Patterns.Xaml Namespace


Attached(T).RuntimeProperty Property

AttachedTRuntimeProperty Property

Gets DependencyProperty registered in runtime.

Namespace: PostSharp.Patterns.Xaml
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public DependencyProperty RuntimeProperty { get; }

Property Value

Type: DependencyProperty
See Also

Reference

AttachedT Class
PostSharp.Patterns.Xaml Namespace

Other Resources

Conceptual: Attached Property


Attached(T) Methods

AttachedT Methods

The AttachedT generic type exposes the following members.

Methods
 | Name | Description
Public method | SetCurrentValue | Sets the value of this attached property for a given object without changing its value source (see SetCurrentValue(DependencyProperty, Object)).
Top
See Also

Reference

AttachedT Class
PostSharp.Patterns.Xaml Namespace


Attached(T).SetCurrentValue Method

AttachedTSetCurrentValue Method

Sets the value of this attached property for a given object without changing its value source (see SetCurrentValue(DependencyProperty, Object)).

Namespace: PostSharp.Patterns.Xaml
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void SetCurrentValue(
    DependencyObject obj,
    T value
)

Parameters

obj
Type: System.WindowsDependencyObject
An object for which to set the property value.
value
Type: T
Value to be set.
See Also

Reference

AttachedT Class
PostSharp.Patterns.Xaml Namespace


AttachedPropertyAttribute Class

Custom attribute that, when applied on a static automatic property and of type AttachedT turns this property into a XAML dependency property of the same name and whose value type is T.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsLocationLevelAspect
DependencyPropertyBaseAttribute
PostSharp.Patterns.XamlAttachedPropertyAttribute

Namespace: PostSharp.Patterns.Xaml
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class AttachedPropertyAttribute : DependencyPropertyBaseAttribute

The AttachedPropertyAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | AttachedPropertyAttribute | Initializes a new instance of the AttachedPropertyAttribute class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from LocationLevelAspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Top
Remarks
Supposed the target property is named Foo. If a method named ValidateFoo exists in the class, it will be used to validate the values assigned to this property. If a method named OnFooChanged exists in the class, it will be invoked whenever the property set. If a property named FooProperty exists in the class, it will be assigned to the corresponding DependencyProperty instance. Naming conventions can be overridden by the ValidateValueMethod, PropertyChangedMethod and RegistrationProperty aspect properties.
See Also

Reference

PostSharp.Patterns.Xaml Namespace

Other Resources

Conceptual: Attached Property
Conceptual: XAML


AttachedPropertyAttribute Constructor

Initializes a new instance of the AttachedPropertyAttribute class

Namespace: PostSharp.Patterns.Xaml
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public AttachedPropertyAttribute()
See Also

Reference

AttachedPropertyAttribute Class
PostSharp.Patterns.Xaml Namespace


AttachedPropertyAttribute Properties

The AttachedPropertyAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

AttachedPropertyAttribute Class
PostSharp.Patterns.Xaml Namespace


AttachedPropertyAttribute Methods

The AttachedPropertyAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from LocationLevelAspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Top
See Also

Reference

AttachedPropertyAttribute Class
PostSharp.Patterns.Xaml Namespace


CommandAttribute Class

Custom attribute that, when applied on a property of type ICommand named say Foo, automatically create a new command class based on a method named ExecuteFoo and an optional property or method named CanExecuteFoo.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsLocationLevelAspect
PostSharp.Patterns.XamlCommandAttribute

Namespace: PostSharp.Patterns.Xaml
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class CommandAttribute : LocationLevelAspect,
    IAspectProvider, IAspect, IService

The CommandAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | CommandAttribute | Initializes a new instance of the CommandAttribute class.
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | CanExecuteMethod | Gets or sets the name of the method that is called to determine whether the command can be executed. This method corresponds to the CanExecute(Object) method.
Public property | CanExecuteProperty | Gets or sets the name of the property that is evaluated to determine whether the command can be executed. This property corresponds to the CanExecute(Object) method.
Public property | ExecuteMethod | Gets or sets the name of the method that implements the command logic. This method corresponds to the to the Execute(Object) method. It is called every time the command is invoked.
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Overrides LocationLevelAspectCompileTimeInitialize(LocationInfo, AspectInfo).)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from LocationLevelAspect.)
Public method | CompileTimeValidate(LocationInfo) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from LocationLevelAspect.)
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Inherited from Aspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, LocationInfo) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from LocationLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from LocationLevelAspect.)
Top
Remarks
Default naming conventions can be overridden by setting the ExecuteMethod, CanExecuteMethod or CanExecuteProperty aspect properties.
See Also

Reference

PostSharp.Patterns.Xaml Namespace

Other Resources

Conceptual: Command


CommandAttribute Constructor

Initializes a new instance of the CommandAttribute class.

Namespace: PostSharp.Patterns.Xaml
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public CommandAttribute()
See Also

Reference

CommandAttribute Class
PostSharp.Patterns.Xaml Namespace


CommandAttribute Properties

The CommandAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | CanExecuteMethod | Gets or sets the name of the method that is called to determine whether the command can be executed. This method corresponds to the CanExecute(Object) method.
Public property | CanExecuteProperty | Gets or sets the name of the property that is evaluated to determine whether the command can be executed. This property corresponds to the CanExecute(Object) method.
Public property | ExecuteMethod | Gets or sets the name of the method that implements the command logic. This method corresponds to the to the Execute(Object) method. It is called every time the command is invoked.
Protected property | SerializerType | Gets or sets the Type of the serializer (a type derived from AspectSerializer) used to serialize the aspect instance at build time and deserialize it at runtime. (Inherited from Aspect.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

CommandAttribute Class
PostSharp.Patterns.Xaml Namespace


CommandAttribute.CanExecuteMethod Property

CommandAttributeCanExecuteMethod Property

Gets or sets the name of the method that is called to determine whether the command can be executed. This method corresponds to the CanExecute(Object) method.

Namespace: PostSharp.Patterns.Xaml
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string CanExecuteMethod { get; set; }

Property Value

Type: String
Remarks

The CanExecute method must be declared in the same class as the command property, return a bool value and can have zero or one parameter.

If this property is not set then the default CanExecuteFoo value is used, where Foo is the name of the command.

See Also

Reference

CommandAttribute Class
PostSharp.Patterns.Xaml Namespace

Other Resources

Conceptual: Command


CommandAttribute.CanExecuteProperty Property

CommandAttributeCanExecuteProperty Property

Gets or sets the name of the property that is evaluated to determine whether the command can be executed. This property corresponds to the CanExecute(Object) method.

Namespace: PostSharp.Patterns.Xaml
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string CanExecuteProperty { get; set; }

Property Value

Type: String
Remarks

The CanExecute property must be declared in the same class as the command property and return a bool value.

If this property is not set then the default CanExecuteFoo value is used, where Foo is the name of the command.

See Also

Reference

CommandAttribute Class
PostSharp.Patterns.Xaml Namespace

Other Resources

Conceptual: Command


CommandAttribute.ExecuteMethod Property

CommandAttributeExecuteMethod Property

Gets or sets the name of the method that implements the command logic. This method corresponds to the to the Execute(Object) method. It is called every time the command is invoked.

Namespace: PostSharp.Patterns.Xaml
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string ExecuteMethod { get; set; }

Property Value

Type: String
Remarks

The Execute method must be declared in the same class as the command property and can have zero parameter or one parameter of any type, which becomes the command parameter.

If this property is not set, then the default ExecuteFoo value is used, where Foo is the name of the command.

See Also

Reference

CommandAttribute Class
PostSharp.Patterns.Xaml Namespace


CommandAttribute Methods

The CommandAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeInitialize | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. (Overrides LocationLevelAspectCompileTimeInitialize(LocationInfo, AspectInfo).)
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from LocationLevelAspect.)
Public method | CompileTimeValidate(LocationInfo) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from LocationLevelAspect.)
Protected method | CreateAspectConfiguration | Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type. (Inherited from Aspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, LocationInfo) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from LocationLevelAspect.)
Protected method | SetAspectConfiguration(AspectConfiguration, Object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. (Inherited from LocationLevelAspect.)
Top
See Also

Reference

CommandAttribute Class
PostSharp.Patterns.Xaml Namespace


CommandAttribute.CompileTimeInitialize Method

CommandAttributeCompileTimeInitialize Method

Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.

Namespace: PostSharp.Patterns.Xaml
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void CompileTimeInitialize(
    LocationInfo targetLocation,
    AspectInfo aspectInfo
)

Parameters

targetLocation
Type: PostSharp.ReflectionLocationInfo
Location to which the current aspect is applied
aspectInfo
Type: PostSharp.AspectsAspectInfo
Reserved for future usage.

Implements

ILocationLevelAspectBuildSemanticsCompileTimeInitialize(LocationInfo, AspectInfo)
See Also

Reference

CommandAttribute Class
PostSharp.Patterns.Xaml Namespace

Other Resources

Conceptual: Initializing Aspects


DependencyPropertyAttribute Class

Custom attribute that, when applied on an automatic property, turns this property into a XAML dependency property of the same name.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.AspectsAspect
PostSharp.AspectsLocationLevelAspect
DependencyPropertyBaseAttribute
PostSharp.Patterns.XamlDependencyPropertyAttribute

Namespace: PostSharp.Patterns.Xaml
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class DependencyPropertyAttribute : DependencyPropertyBaseAttribute

The DependencyPropertyAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | DependencyPropertyAttribute | Initializes a new instance of the DependencyPropertyAttribute class
Top
Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
Methods
 | Name | Description
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from LocationLevelAspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Top
Remarks
Suppose the target property is named Foo. If a method named ValidateFoo exists in the class, it will be used to validate the values assigned to this property. If a method named OnFooChanged exists in the class, it will be invoked whenever the property set. If a property named FooProperty exists in the class, it will be assigned to the corresponding DependencyProperty instance. Naming conventions can be overridden by the ValidateValueMethod, PropertyChangedMethod and RegistrationProperty aspect properties.
See Also

Reference

PostSharp.Patterns.Xaml Namespace

Other Resources

Conceptual: Attached Property
Conceptual: Dependency Property
Conceptual: XAML


DependencyPropertyAttribute Constructor

Initializes a new instance of the DependencyPropertyAttribute class

Namespace: PostSharp.Patterns.Xaml
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public DependencyPropertyAttribute()
See Also

Reference

DependencyPropertyAttribute Class
PostSharp.Patterns.Xaml Namespace


DependencyPropertyAttribute Properties

The DependencyPropertyAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AspectPriority | Gets or sets the weaving priority of the aspect. (Inherited from Aspect.)
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Public property | UnsupportedTargetAction | Specifies the action to take when the aspect is applied to an unsupported target element. (Inherited from Aspect.)
Top
See Also

Reference

DependencyPropertyAttribute Class
PostSharp.Patterns.Xaml Namespace


DependencyPropertyAttribute Methods

The DependencyPropertyAttribute type exposes the following members.

Methods
 | Name | Description
Public method | CompileTimeValidate(Object) | Method invoked at build time to ensure that the aspect has been applied to the right target. (Inherited from LocationLevelAspect.)
Public method | GetAspectConfiguration | Method invoked at build tome to get the imperative configuration of the current Aspect. (Inherited from Aspect.)
Top
See Also

Reference

DependencyPropertyAttribute Class
PostSharp.Patterns.Xaml Namespace


DependencyPropertyServices Class

Exposes helper methods that work with the DependencyPropertyAttribute and AttachedPropertyAttribute aspects.
Inheritance Hierarchy
SystemObject
PostSharp.Patterns.XamlDependencyPropertyServices

Namespace: PostSharp.Patterns.Xaml
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static class DependencyPropertyServices
Methods
Name | Description
GetDependencyProperty(Type, String) | Gets the DependencyProperty object associated with a property of a given name for a given type.
GetDependencyPropertyT(ExpressionFuncT) | Gets the DependencyProperty object associated with a property of a given name for a given type. The property name and the property owner type are extracted from the expression argument.
GetDependencyPropertyT, U(ExpressionFuncT, U) | Gets the DependencyProperty object associated with a property of a given name for a given type. The property name and the property owner type are extracted from the expression argument.
Top
See Also

Reference

PostSharp.Patterns.Xaml Namespace

Other Resources

Conceptual: Dependency Property


DependencyPropertyServices Methods

Methods
Name | Description
GetDependencyProperty(Type, String) | Gets the DependencyProperty object associated with a property of a given name for a given type.
GetDependencyPropertyT(ExpressionFuncT) | Gets the DependencyProperty object associated with a property of a given name for a given type. The property name and the property owner type are extracted from the expression argument.
GetDependencyPropertyT, U(ExpressionFuncT, U) | Gets the DependencyProperty object associated with a property of a given name for a given type. The property name and the property owner type are extracted from the expression argument.
Top
See Also

Reference

DependencyPropertyServices Class
PostSharp.Patterns.Xaml Namespace


DependencyPropertyServices.GetDependencyProperty Method

DependencyPropertyServicesGetDependencyProperty Method

Overload List
Name | Description
GetDependencyPropertyT(ExpressionFuncT) | Gets the DependencyProperty object associated with a property of a given name for a given type. The property name and the property owner type are extracted from the expression argument.
GetDependencyPropertyT, U(ExpressionFuncT, U) | Gets the DependencyProperty object associated with a property of a given name for a given type. The property name and the property owner type are extracted from the expression argument.
GetDependencyProperty(Type, String) | Gets the DependencyProperty object associated with a property of a given name for a given type.
Top
See Also

Reference

DependencyPropertyServices Class
PostSharp.Patterns.Xaml Namespace


DependencyPropertyServices.GetDependencyProperty(T) Method (Expression(Func(T)))

DependencyPropertyServicesGetDependencyPropertyT Method (ExpressionFuncT)

Gets the DependencyProperty object associated with a property of a given name for a given type. The property name and the property owner type are extracted from the expression argument.

Namespace: PostSharp.Patterns.Xaml
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static DependencyProperty GetDependencyProperty<T>(
    Expression<Func<T>> expression
)

Parameters

expression
Type: System.Linq.ExpressionsExpression Func T
The lambda expression in the format () => new ClassName().PropertyName.

Type Parameters

T

Return Value

Type: DependencyProperty
The DependencyProperty instance.
See Also

Reference

DependencyPropertyServices Class
GetDependencyProperty Overload
PostSharp.Patterns.Xaml Namespace


DependencyPropertyServices.GetDependencyProperty(T, U) Method (Expression(Func(T, U)))

DependencyPropertyServicesGetDependencyPropertyT, U Method (ExpressionFuncT, U)

Gets the DependencyProperty object associated with a property of a given name for a given type. The property name and the property owner type are extracted from the expression argument.

Namespace: PostSharp.Patterns.Xaml
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static DependencyProperty GetDependencyProperty<T, U>(
    Expression<Func<T, U>> expression
)

Parameters

expression
Type: System.Linq.ExpressionsExpression Func T, U
The lambda expression in the format (ClassName x) => x.PropertyName.

Type Parameters

T
U

Return Value

Type: DependencyProperty
The DependencyProperty instance.
See Also

Reference

DependencyPropertyServices Class
GetDependencyProperty Overload
PostSharp.Patterns.Xaml Namespace


DependencyPropertyServices.GetDependencyProperty Method (Type, String)

DependencyPropertyServicesGetDependencyProperty Method (Type, String)

Gets the DependencyProperty object associated with a property of a given name for a given type.

Namespace: PostSharp.Patterns.Xaml
Assembly: PostSharp.Patterns.Xaml (in PostSharp.Patterns.Xaml.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static DependencyProperty GetDependencyProperty(
    Type type,
    string propertyName
)

Parameters

type
Type: SystemType
The type for which the dependency property was registered.
propertyName
Type: SystemString
The name of the property.

Return Value

Type: DependencyProperty
The DependencyProperty instance.
See Also

Reference

DependencyPropertyServices Class
GetDependencyProperty Overload
PostSharp.Patterns.Xaml Namespace

Other Resources

Conceptual: Dependency Property


PostSharp.Reflection Namespace

The PostSharp.Reflection namespace complements the System.Reflection namespace.
Classes
 | Class | Description
Public class | CustomAttributeInstance | Instance of a custom attribute on a target declaration.
Public class | CustomReflectionBinder | Custom implementation of a reflection Binder that select methods based on exact matches using the ReflectionTypeComparer.
Public class | LocationInfo | Represents a FieldInfo, PropertyInfo or ParameterInfo, which all have the semantics of a location (get value, set value).
Public class | MemberTypeCodeReference | Represents a relationship between a type and a member of this type. A member can be a FieldInfo, PropertyInfo, or ParameterInfo.
Public class | MethodUsageCodeReference | Represents a relationship between a declaration (Type, FieldInfo, MethodInfo or ConstructorInfo) and a method whose instructions (method body) use the declaration.
Public class | ObjectConstruction | Specifies how an object should be constructed, i.e. specifies the constructor to be used, the arguments to be passed to this constructor, and the fields or properties to be set.
Public class | ParameterKindExtensions | Extensions for the ParameterKind class.
Public class | ReflectionExtensions | Provides utility methods to work with the System.Reflection namespace.
Public class | ReflectionHelper | Provides helper methods for work with System.Reflection.
Public class | ReflectionSearch | Set of static methods providing broader access to assembly metadata than the System.Reflection namespace. These methods are only available at build time.
Public class | ReflectionTypeComparer | Comparer of reflection types (Type) based on content, not reference. Supports the unbound generic parameters derived from the [!:GenericArg] class.
Public class | SymbolSequencePoint | Maps a point in IL instructions to location in source code.
Public class | TypeInheritanceCodeReference | Represents a inheritance relationship between two types.
Structures
 | Structure | Description
Public structure | DeclarationIdentifier | Encapsulates a unique identifier of a declaration. The identifier does not contain the kind of declaration. Different declarations of different kinds can have the same identifier.
Public structure | SemanticInfo | Provides information about the semantic of a declaration in the source programming language. For instance an MSIL method can be in C# a property getter, an operator, an anonymous method, and so on.
Interfaces
 | Interface | Description
Public interface | IAssemblyName | Defines the semantics of an assembly name.
Public interface | ICodeReference | Represents a reference between two declarations.
Public interface | IMetadataDispenser | Semantics of service that deserializes metadata objects (i.e. reflection objects) that have been serialized by IMetadataEmitter.
Public interface | IMetadataEmitter | Semantics of a service that allows build-time code to serialize references to metadata objects (i.e. reflection objects) in a way that is compatible with obfuscators. References are deserialized at run-time using IMetadataDispenser.
Public interface | ISourceDocument | Represents a file of source code.
Enumerations
 | Enumeration | Description
Public enumeration | AssemblyProcessorArchitecture | Processor architectures of an assembly.
Public enumeration | CodeReferenceKind | Kinds of code references (ICodeReference).
Public enumeration | LocationKind | Enumerates the kinds of code elements that can be encapsulated by a LocationInfo.
Public enumeration | MethodUsageInstructions | Instructions whose operands can reference a declaration.
Public enumeration | ParameterKind | Enumerates all possible kinds of method parameters. The parameter kind indicates whether the parameter is by ref or by value and its direction.
Public enumeration | ReflectionSearchOptions |
Public enumeration | Semantics | Enumerates the possible semantics of a declaration in the source programming language. For instance an MSIL method can be in C# a property getter, an operator, an anonymous method, and so on.
Public enumeration | StateMachineKind | Enumeration of kinds of state machines.
Public enumeration | Visibility | Visibility of types and type members.


AssemblyProcessorArchitecture Enumeration

Processor architectures of an assembly.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum AssemblyProcessorArchitecture
Members
Member name | Value | Description
None | 0 | None (or not set).
MSIL | 1 | MSIL (platform-neutral).
X86 | 2 | 32-bit x86.
IA64 | 3 | Itanium 64-bit
Amd64 | 4 | 64-bit x86
Arm | 5 | ARM.
NoPlatform | 7 | Reference assembly only (the assembly cannot be executed at run time).
See Also

Reference

PostSharp.Reflection Namespace


CodeReferenceKind Enumeration

Kinds of code references (ICodeReference).

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum CodeReferenceKind
Members
Member name | Value | Description
None | 0 | No code reference.
TypeInheritance | 1 | Type inheritance. The base type is the ReferencedDeclaration; the child type is the ReferencingDeclaration. See TypeInheritanceCodeReference.
MemberType | 2 | Member type (field or property type, method return type, or parameter type). The member type is the ReferencedDeclaration. See MemberTypeCodeReference.
MethodUsage | 16 | Operand of an instruction in a method body. The ReferencingDeclaration is the method. See MethodUsageCodeReference.
See Also

Reference

PostSharp.Reflection Namespace


CustomAttributeInstance Class

Instance of a custom attribute on a target declaration.
Inheritance Hierarchy
SystemObject
PostSharp.ReflectionCustomAttributeInstance

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class CustomAttributeInstance

The CustomAttributeInstance type exposes the following members.

Properties
 | Name | Description
Public property | Attribute | Gets the custom attribute.
Public property | Construction | Gets the ObjectConstruction (including given constructor arguments and named arguments) used to construct the Attribute.
Public property | Target | Gets the declaration on which the custom attribute is defined.
Top
See Also

Reference

PostSharp.Reflection Namespace


CustomAttributeInstance Properties

The CustomAttributeInstance type exposes the following members.

Properties
 | Name | Description
Public property | Attribute | Gets the custom attribute.
Public property | Construction | Gets the ObjectConstruction (including given constructor arguments and named arguments) used to construct the Attribute.
Public property | Target | Gets the declaration on which the custom attribute is defined.
Top
See Also

Reference

CustomAttributeInstance Class
PostSharp.Reflection Namespace


CustomAttributeInstance.Attribute Property

CustomAttributeInstanceAttribute Property

Gets the custom attribute.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Attribute Attribute { get; }

Property Value

Type: Attribute
See Also

Reference

CustomAttributeInstance Class
PostSharp.Reflection Namespace


CustomAttributeInstance.Construction Property

CustomAttributeInstanceConstruction Property

Gets the ObjectConstruction (including given constructor arguments and named arguments) used to construct the Attribute.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ObjectConstruction Construction { get; }

Property Value

Type: ObjectConstruction
See Also

Reference

CustomAttributeInstance Class
PostSharp.Reflection Namespace


CustomAttributeInstance.Target Property

CustomAttributeInstanceTarget Property

Gets the declaration on which the custom attribute is defined.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Object Target { get; }

Property Value

Type: Object
A reflection object: Assembly, Type, MethodInfo, ConstructorInfo, ParameterInfo, PropertyInfo, EventInfo, FieldInfo.
See Also

Reference

CustomAttributeInstance Class
PostSharp.Reflection Namespace


CustomReflectionBinder Class

Custom implementation of a reflection Binder that select methods based on exact matches using the ReflectionTypeComparer.
Inheritance Hierarchy
SystemObject
System.ReflectionBinder
PostSharp.ReflectionCustomReflectionBinder

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class CustomReflectionBinder : Binder

The CustomReflectionBinder type exposes the following members.

Methods
 | Name | Description
Public method | BindToField | Selects a field from the given set of fields, based on the specified criteria. (Overrides BinderBindToField(BindingFlags, FieldInfo, Object, CultureInfo).)
Public method | BindToMethod | Selects a method to invoke from the given set of methods, based on the supplied arguments. (Overrides BinderBindToMethod(BindingFlags, MethodBase, Object, ParameterModifier, CultureInfo, String, Object).)
Public method | ChangeType | Changes the type of the given Object to the given Type. (Overrides BinderChangeType(Object, Type, CultureInfo).)
Public method | ReorderArgumentArray | Upon returning from BindToMethod(BindingFlags, MethodBase, Object, ParameterModifier, CultureInfo, String, Object), restores the args argument to what it was when it came from BindToMethod. (Overrides BinderReorderArgumentArray(Object, Object).)
Public method | SelectMethod | Selects a method from the given set of methods, based on the argument type. (Overrides BinderSelectMethod(BindingFlags, MethodBase, Type, ParameterModifier).)
Public method | SelectProperty | Selects a property from the given set of properties, based on the specified criteria. (Overrides BinderSelectProperty(BindingFlags, PropertyInfo, Type, Type, ParameterModifier).)
Top
Fields
Name | Description
Instance | Singleton instance.
Top
See Also

Reference

PostSharp.Reflection Namespace


CustomReflectionBinder Methods

The CustomReflectionBinder type exposes the following members.

Methods
 | Name | Description
Public method | BindToField | Selects a field from the given set of fields, based on the specified criteria. (Overrides BinderBindToField(BindingFlags, FieldInfo, Object, CultureInfo).)
Public method | BindToMethod | Selects a method to invoke from the given set of methods, based on the supplied arguments. (Overrides BinderBindToMethod(BindingFlags, MethodBase, Object, ParameterModifier, CultureInfo, String, Object).)
Public method | ChangeType | Changes the type of the given Object to the given Type. (Overrides BinderChangeType(Object, Type, CultureInfo).)
Public method | ReorderArgumentArray | Upon returning from BindToMethod(BindingFlags, MethodBase, Object, ParameterModifier, CultureInfo, String, Object), restores the args argument to what it was when it came from BindToMethod. (Overrides BinderReorderArgumentArray(Object, Object).)
Public method | SelectMethod | Selects a method from the given set of methods, based on the argument type. (Overrides BinderSelectMethod(BindingFlags, MethodBase, Type, ParameterModifier).)
Public method | SelectProperty | Selects a property from the given set of properties, based on the specified criteria. (Overrides BinderSelectProperty(BindingFlags, PropertyInfo, Type, Type, ParameterModifier).)
Top
See Also

Reference

CustomReflectionBinder Class
PostSharp.Reflection Namespace


CustomReflectionBinder.BindToField Method

CustomReflectionBinderBindToField Method

Selects a field from the given set of fields, based on the specified criteria.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override FieldInfo BindToField(
    BindingFlags bindingFlags,
    FieldInfo[] match,
    Object value,
    CultureInfo culture
)

Parameters

bindingFlags
Type: System.ReflectionBindingFlags
match
Type: System.ReflectionFieldInfo
The set of fields that are candidates for matching. For example, when a Binder object is used by InvokeMember, this parameter specifies the set of fields that reflection has determined to be possible matches, typically because they have the correct member name. The default implementation provided by DefaultBinder changes the order of this array.
value
Type: SystemObject
The field value used to locate a matching field.
culture
Type: System.GlobalizationCultureInfo
An instance of CultureInfo that is used to control the coercion of data types, in binder implementations that coerce types. If culture is , the CultureInfo for the current thread is used.Note For example, if a binder implementation allows coercion of string values to numeric types, this parameter is necessary to convert a String that represents 1000 to a Double value, because 1000 is represented differently by different cultures. The default binder does not do such string coercions.

Return Value

Type: FieldInfo
The matching field.
Exceptions
Exception | Condition
AmbiguousMatchException | For the default binder, bindingAttr includes SetField, and match contains multiple fields that are equally good matches for value. For example, value contains a MyClass object that implements the IMyClass interface, and match contains a field of type MyClass and a field of type IMyClass.
MissingFieldException | For the default binder, bindingAttr includes SetField, and match contains no fields that can accept value.
NullReferenceException | For the default binder, bindingAttr includes SetField, and match is or an empty array.-or- bindingAttr includes SetField, and value is .
See Also

Reference

CustomReflectionBinder Class
PostSharp.Reflection Namespace


CustomReflectionBinder.BindToMethod Method

CustomReflectionBinderBindToMethod Method

Selects a method to invoke from the given set of methods, based on the supplied arguments.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override MethodBase BindToMethod(
    BindingFlags bindingFlags,
    MethodBase[] match,
    ref Object[] args,
    ParameterModifier[] modifiers,
    CultureInfo culture,
    string[] names,
    out Object state
)

Parameters

bindingFlags
Type: System.ReflectionBindingFlags
match
Type: System.ReflectionMethodBase
The set of methods that are candidates for matching. For example, when a Binder object is used by InvokeMember, this parameter specifies the set of methods that reflection has determined to be possible matches, typically because they have the correct member name. The default implementation provided by DefaultBinder changes the order of this array.
args
Type: SystemObject
The arguments that are passed in. The binder can change the order of the arguments in this array; for example, the default binder changes the order of arguments if the names parameter is used to specify an order other than positional order. If a binder implementation coerces argument types, the types and values of the arguments can be changed as well.
modifiers
Type: System.ReflectionParameterModifier
An array of parameter modifiers that enable binding to work with parameter signatures in which the types have been modified. The default binder implementation does not use this parameter.
culture
Type: System.GlobalizationCultureInfo
An instance of CultureInfo that is used to control the coercion of data types, in binder implementations that coerce types. If culture is , the CultureInfo for the current thread is used. Note For example, if a binder implementation allows coercion of string values to numeric types, this parameter is necessary to convert a String that represents 1000 to a Double value, because 1000 is represented differently by different cultures. The default binder does not do such string coercions.
names
Type: SystemString
The parameter names, if parameter names are to be considered when matching, or if arguments are to be treated as purely positional. For example, parameter names must be used if arguments are not supplied in positional order.
state
Type: SystemObject
After the method returns, state contains a binder-provided object that keeps track of argument reordering. The binder creates this object, and the binder is the sole consumer of this object. If state is not when BindToMethod returns, you must pass state to the ReorderArgumentArray(Object, Object) method if you want to restore args to its original order, for example, so that you can retrieve the values of ref parameters (ByRef parameters in Visual Basic).

Return Value

Type: MethodBase
The matching method.
Exceptions
Exception | Condition
AmbiguousMatchException | For the default binder, match contains multiple methods that are equally good matches for args. For example, args contains a MyClass object that implements the IMyClass interface, and match contains a method that takes MyClass and a method that takes IMyClass.
MissingMethodException | For the default binder, match contains no methods that can accept the arguments supplied in args.
ArgumentException | For the default binder, match is or an empty array.
See Also

Reference

CustomReflectionBinder Class
PostSharp.Reflection Namespace


CustomReflectionBinder.ChangeType Method

CustomReflectionBinderChangeType Method

Changes the type of the given Object to the given Type.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Object ChangeType(
    Object value,
    Type type,
    CultureInfo culture
)

Parameters

value
Type: SystemObject
The object to change into a new Type.
type
Type: SystemType
The new Type that value will become.
culture
Type: System.GlobalizationCultureInfo
An instance of CultureInfo that is used to control the coercion of data types. If culture is , the CultureInfo for the current thread is used.Note For example, this parameter is necessary to convert a String that represents 1000 to a Double value, because 1000 is represented differently by different cultures.

Return Value

Type: Object
An object that contains the given value as the new type.
See Also

Reference

CustomReflectionBinder Class
PostSharp.Reflection Namespace


CustomReflectionBinder.ReorderArgumentArray Method

CustomReflectionBinderReorderArgumentArray Method

Upon returning from BindToMethod(BindingFlags, MethodBase, Object, ParameterModifier, CultureInfo, String, Object), restores the args argument to what it was when it came from BindToMethod.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override void ReorderArgumentArray(
    ref Object[] args,
    Object state
)

Parameters

args
Type: SystemObject
The actual arguments that are passed in. Both the types and values of the arguments can be changed.
state
Type: SystemObject
A binder-provided object that keeps track of argument reordering.
See Also

Reference

CustomReflectionBinder Class
PostSharp.Reflection Namespace


CustomReflectionBinder.SelectMethod Method

CustomReflectionBinderSelectMethod Method

Selects a method from the given set of methods, based on the argument type.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override MethodBase SelectMethod(
    BindingFlags bindingFlags,
    MethodBase[] match,
    Type[] types,
    ParameterModifier[] modifiers
)

Parameters

bindingFlags
Type: System.ReflectionBindingFlags
match
Type: System.ReflectionMethodBase
The set of methods that are candidates for matching. For example, when a Binder object is used by InvokeMember, this parameter specifies the set of methods that reflection has determined to be possible matches, typically because they have the correct member name. The default implementation provided by DefaultBinder changes the order of this array.
types
Type: SystemType
The parameter types used to locate a matching method.
modifiers
Type: System.ReflectionParameterModifier
An array of parameter modifiers that enable binding to work with parameter signatures in which the types have been modified.

Return Value

Type: MethodBase
The matching method, if found; otherwise, .
Exceptions
Exception | Condition
AmbiguousMatchException | For the default binder, match contains multiple methods that are equally good matches for the parameter types described by types. For example, the array in types contains a Type object for MyClass and the array in match contains a method that takes a base class of MyClass and a method that takes an interface that MyClass implements.
ArgumentException | For the default binder, match is or an empty array.-or-An element of types derives from Type, but is not of type RuntimeType.
See Also

Reference

CustomReflectionBinder Class
PostSharp.Reflection Namespace


CustomReflectionBinder.SelectProperty Method

CustomReflectionBinderSelectProperty Method

Selects a property from the given set of properties, based on the specified criteria.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override PropertyInfo SelectProperty(
    BindingFlags bindingFlags,
    PropertyInfo[] match,
    Type returnType,
    Type[] indexes,
    ParameterModifier[] modifiers
)

Parameters

bindingFlags
Type: System.ReflectionBindingFlags
match
Type: System.ReflectionPropertyInfo
The set of properties that are candidates for matching. For example, when a Binder object is used by InvokeMember, this parameter specifies the set of properties that reflection has determined to be possible matches, typically because they have the correct member name. The default implementation provided by DefaultBinder changes the order of this array.
returnType
Type: SystemType
The return value the matching property must have.
indexes
Type: SystemType
The index types of the property being searched for. Used for index properties such as the indexer for a class.
modifiers
Type: System.ReflectionParameterModifier
An array of parameter modifiers that enable binding to work with parameter signatures in which the types have been modified.

Return Value

Type: PropertyInfo
The matching property.
Exceptions
Exception | Condition
AmbiguousMatchException | For the default binder, match contains multiple properties that are equally good matches for returnType and indexes.
ArgumentException | For the default binder, match is or an empty array.
See Also

Reference

CustomReflectionBinder Class
PostSharp.Reflection Namespace


CustomReflectionBinder Fields

The CustomReflectionBinder type exposes the following members.

Fields
Name | Description
Instance | Singleton instance.
Top
See Also

Reference

CustomReflectionBinder Class
PostSharp.Reflection Namespace


CustomReflectionBinder.Instance Field

CustomReflectionBinderInstance Field

Singleton instance.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static readonly CustomReflectionBinder Instance

Field Value

Type: CustomReflectionBinder
See Also

Reference

CustomReflectionBinder Class
PostSharp.Reflection Namespace


DeclarationIdentifier Structure

Encapsulates a unique identifier of a declaration. The identifier does not contain the kind of declaration. Different declarations of different kinds can have the same identifier.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public struct DeclarationIdentifier : IEquatable<DeclarationIdentifier>

The DeclarationIdentifier type exposes the following members.

Properties
 | Name | Description
Public property | AssemblyId | Gets a 29-bit of the name of the assembly containing the declaration represented by the current DeclarationIdentifier.
Public property | IsNull | Determines whether the current DeclarationIdentifier is null.
Public property | MemberIndex | Gets a number that uniquely identifies the member inside its declaring type, for the given member kind.
 | Null | Gets a null instance of the DeclarationIdentifier type/
Public property | TypeIndex | Gets a number that uniquely identifies the type inside its declaring assembly.
Top
Methods
 | Name | Description
Public method | Equals(Object) | Indicates whether this instance and a specified object are equal. (Overrides ValueTypeEquals(Object).)
Public method | Equals(DeclarationIdentifier) | Indicates whether the current object is equal to another object of the same type.
 | GetDeclarationIdentifier | Gets the DeclarationIdentifier for a given declaration.
Public method | GetDeclaringTypeIdentifier | Gets the DeclarationIdentifier that represents the declaring type of the declaration represented by the current DeclarationIdentifier.
Public method | GetHashCode | Returns the hash code for this instance. (Overrides ValueTypeGetHashCode.)
Top
Operators
Name | Description
Equality | Determines whether two instances of the DeclarationIdentifier type are equal.
Inequality | Determines whether two instances of the DeclarationIdentifier type are different.
Top
Fields
Name | Description
MaxMemberIndex | Maximum number of the same kind in the same type supported by the DeclarationIdentifier class.
MaxTypeIndex | Maximum number of types per assembly supported by the DeclarationIdentifier class.
Top
Remarks

The DeclarationIdentifier concept provides an efficient mechanism to correlate data that depend on the target declaration of the advice. Typically, such data can be computed at build time and serialized into the aspect, then consumed at run time. Without the DeclarationIdentifier concept, the data would be stored in a dictionary, for instance Dictionary<MethodInfo,MethodData> where MethodData is a custom class. However, relying on a dictionary has some performance costs. Thanks to the the DeclarationIdentifier concept, data can be stored in an array, because the MemberIndex is guaranteed to be unique in a given type for a given kind of member (for instance, MemberIndex is unique for all methods in the same type). Array lookups are much faster than dictionary lookups and do not rely on reflection, which gives a significant performance benefit.

Note Note

Although the CIL specification allows for up to 2^24 types in the same assembly and 2^24 methods (or other members) in the same type, the DeclarationIdentifier implementation assumes that there will be no more than 2^16 types in the same assembly and 2^16 members of the same kind in the same type. The AssemblyId property to be coded on 32 bits. The AssemblyId is computed by running the MD5 algorithm on the full assembly name. The probability of hash collision is approximately 10^-6 for an application of 100 assemblies and 10^-5 for an application of 1,000 assemblies. Collisions can be avoided by adding the AssemblyIdAttribute custom attribute to one of the assemblies causing a hash collision. Note that hash collisions are not automatically detected by PostSharp. However, you can build a hash collision detection program by looking at the AssemblyIdAttribute custom attribute on all assemblies of your application after PostSharp has been executed.

See Also

Reference

PostSharp.Reflection Namespace


DeclarationIdentifier Properties

The DeclarationIdentifier type exposes the following members.

Properties
 | Name | Description
Public property | AssemblyId | Gets a 29-bit of the name of the assembly containing the declaration represented by the current DeclarationIdentifier.
Public property | IsNull | Determines whether the current DeclarationIdentifier is null.
Public property | MemberIndex | Gets a number that uniquely identifies the member inside its declaring type, for the given member kind.
 | Null | Gets a null instance of the DeclarationIdentifier type/
Public property | TypeIndex | Gets a number that uniquely identifies the type inside its declaring assembly.
Top
See Also

Reference

DeclarationIdentifier Structure
PostSharp.Reflection Namespace


DeclarationIdentifier.AssemblyId Property

DeclarationIdentifierAssemblyId Property

Gets a 29-bit of the name of the assembly containing the declaration represented by the current DeclarationIdentifier.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int AssemblyId { get; }

Property Value

Type: Int32
See Also

Reference

DeclarationIdentifier Structure
PostSharp.Reflection Namespace


DeclarationIdentifier.IsNull Property

DeclarationIdentifierIsNull Property

Determines whether the current DeclarationIdentifier is null.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsNull { get; }

Property Value

Type: Boolean
See Also

Reference

DeclarationIdentifier Structure
PostSharp.Reflection Namespace


DeclarationIdentifier.MemberIndex Property

DeclarationIdentifierMemberIndex Property

Gets a number that uniquely identifies the member inside its declaring type, for the given member kind.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int MemberIndex { get; }

Property Value

Type: Int32
Remarks

The value of this property is guaranteed to be smaller than the total number of methods in the declaring type.

The value is guaranteed to be unique only in the declaring type, not in the set of base types. Numbering of members restarts at 0 for every derived type.

See Also

Reference

DeclarationIdentifier Structure
PostSharp.Reflection Namespace


DeclarationIdentifier.Null Property

DeclarationIdentifierNull Property

Gets a null instance of the DeclarationIdentifier type/

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static DeclarationIdentifier Null { get; }

Property Value

Type: DeclarationIdentifier
See Also

Reference

DeclarationIdentifier Structure
PostSharp.Reflection Namespace
DeclarationIdentifierIsNull


DeclarationIdentifier.TypeIndex Property

DeclarationIdentifierTypeIndex Property

Gets a number that uniquely identifies the type inside its declaring assembly.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int TypeIndex { get; }

Property Value

Type: Int32
See Also

Reference

DeclarationIdentifier Structure
PostSharp.Reflection Namespace


DeclarationIdentifier Methods

The DeclarationIdentifier type exposes the following members.

Methods
 | Name | Description
Public method | Equals(Object) | Indicates whether this instance and a specified object are equal. (Overrides ValueTypeEquals(Object).)
Public method | Equals(DeclarationIdentifier) | Indicates whether the current object is equal to another object of the same type.
 | GetDeclarationIdentifier | Gets the DeclarationIdentifier for a given declaration.
Public method | GetDeclaringTypeIdentifier | Gets the DeclarationIdentifier that represents the declaring type of the declaration represented by the current DeclarationIdentifier.
Public method | GetHashCode | Returns the hash code for this instance. (Overrides ValueTypeGetHashCode.)
Top
See Also

Reference

DeclarationIdentifier Structure
PostSharp.Reflection Namespace


DeclarationIdentifier.Equals Method

DeclarationIdentifierEquals Method

Overload List
 | Name | Description
Public method | Equals(Object) | Indicates whether this instance and a specified object are equal. (Overrides ValueTypeEquals(Object).)
Public method | Equals(DeclarationIdentifier) | Indicates whether the current object is equal to another object of the same type.
Top
See Also

Reference

DeclarationIdentifier Structure
PostSharp.Reflection Namespace


DeclarationIdentifier.Equals Method (Object)

DeclarationIdentifierEquals Method (Object)

Indicates whether this instance and a specified object are equal.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool Equals(
    Object obj
)

Parameters

obj
Type: SystemObject
The object to compare with the current instance.

Return Value

Type: Boolean
true if obj and this instance are the same type and represent the same value; otherwise, false.
See Also

Reference

DeclarationIdentifier Structure
Equals Overload
PostSharp.Reflection Namespace


DeclarationIdentifier.Equals Method (DeclarationIdentifier)

DeclarationIdentifierEquals Method (DeclarationIdentifier)

Indicates whether the current object is equal to another object of the same type.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Equals(
    DeclarationIdentifier other
)

Parameters

other
Type: PostSharp.ReflectionDeclarationIdentifier
An object to compare with this object.

Return Value

Type: Boolean
true if the current object is equal to the other parameter; otherwise, false.

Implements

IEquatableTEquals(T)
See Also

Reference

DeclarationIdentifier Structure
Equals Overload
PostSharp.Reflection Namespace


DeclarationIdentifier.GetDeclarationIdentifier Method

DeclarationIdentifierGetDeclarationIdentifier Method

Gets the DeclarationIdentifier for a given declaration.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static DeclarationIdentifier GetDeclarationIdentifier(
    MemberInfo declaration
)

Parameters

declaration
Type: System.ReflectionMemberInfo
A Type, MethodInfo, ConstructorInfo, FieldInfo, EventInfo or PropertyInfo.

Return Value

Type: DeclarationIdentifier
A DeclarationIdentifier that identifies declaration.
See Also

Reference

DeclarationIdentifier Structure
PostSharp.Reflection Namespace


DeclarationIdentifier.GetDeclaringTypeIdentifier Method

DeclarationIdentifierGetDeclaringTypeIdentifier Method

Gets the DeclarationIdentifier that represents the declaring type of the declaration represented by the current DeclarationIdentifier.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public DeclarationIdentifier GetDeclaringTypeIdentifier()

Return Value

Type: DeclarationIdentifier
The DeclarationIdentifier that represents the declaring type of the declaration represented by the current DeclarationIdentifier. If the current DeclarationIdentifier already represents a type, this method returns the current DeclarationIdentifier.
See Also

Reference

DeclarationIdentifier Structure
PostSharp.Reflection Namespace


DeclarationIdentifier.GetHashCode Method

DeclarationIdentifierGetHashCode Method

Returns the hash code for this instance.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override int GetHashCode()

Return Value

Type: Int32
A 32-bit signed integer that is the hash code for this instance.
See Also

Reference

DeclarationIdentifier Structure
PostSharp.Reflection Namespace


DeclarationIdentifier Operators

The DeclarationIdentifier type exposes the following members.

Operators
Name | Description
Equality | Determines whether two instances of the DeclarationIdentifier type are equal.
Inequality | Determines whether two instances of the DeclarationIdentifier type are different.
Top
See Also

Reference

DeclarationIdentifier Structure
PostSharp.Reflection Namespace


DeclarationIdentifier.Equality Operator

DeclarationIdentifierEquality Operator

Determines whether two instances of the DeclarationIdentifier type are equal.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool operator ==(
    DeclarationIdentifier left,
    DeclarationIdentifier right
)

Parameters

left
Type: PostSharp.ReflectionDeclarationIdentifier
right
Type: PostSharp.ReflectionDeclarationIdentifier

Return Value

Type: Boolean
See Also

Reference

DeclarationIdentifier Structure
PostSharp.Reflection Namespace


DeclarationIdentifier.Inequality Operator

DeclarationIdentifierInequality Operator

Determines whether two instances of the DeclarationIdentifier type are different.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool operator !=(
    DeclarationIdentifier left,
    DeclarationIdentifier right
)

Parameters

left
Type: PostSharp.ReflectionDeclarationIdentifier
right
Type: PostSharp.ReflectionDeclarationIdentifier

Return Value

Type: Boolean
See Also

Reference

DeclarationIdentifier Structure
PostSharp.Reflection Namespace


DeclarationIdentifier Fields

The DeclarationIdentifier type exposes the following members.

Fields
Name | Description
MaxMemberIndex | Maximum number of the same kind in the same type supported by the DeclarationIdentifier class.
MaxTypeIndex | Maximum number of types per assembly supported by the DeclarationIdentifier class.
Top
See Also

Reference

DeclarationIdentifier Structure
PostSharp.Reflection Namespace


DeclarationIdentifier.MaxMemberIndex Field

DeclarationIdentifierMaxMemberIndex Field

Maximum number of the same kind in the same type supported by the DeclarationIdentifier class.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const int MaxMemberIndex = 65535

Field Value

Type: Int32
See Also

Reference

DeclarationIdentifier Structure
PostSharp.Reflection Namespace


DeclarationIdentifier.MaxTypeIndex Field

DeclarationIdentifierMaxTypeIndex Field

Maximum number of types per assembly supported by the DeclarationIdentifier class.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public const int MaxTypeIndex = 65535

Field Value

Type: Int32
See Also

Reference

DeclarationIdentifier Structure
PostSharp.Reflection Namespace


IAssemblyName Interface

Defines the semantics of an assembly name.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IAssemblyName

The IAssemblyName type exposes the following members.

Properties
 | Name | Description
Public property | BindingContext | Gets the BindingContext in which the assembly name is valid.
Public property | Culture | Gets the assembly culture name.
Public property | IsRetargetable | Determines whether the reference is retargetable by the CLR, i.e. can be accommodated by an assembly whose identity does not match the current assembly reference.
Public property | IsStronglyNamed | Determines whether the current assembly (or assembly reference) contains a strong name signature.
Public property | Name | Gets the assembly friendly name.
Public property | ProcessorArchitecture | Gets the processor architecture that the current assembly targets.
Public property | Version | Gets the assembly version.
Top
Methods
 | Name | Description
Public method | GetPublicKey | Gets the assembly public key.
Public method | GetPublicKeyToken | Gets the assembly public key token.
Top
See Also

Reference

PostSharp.Reflection Namespace


IAssemblyName Properties

The IAssemblyName type exposes the following members.

Properties
 | Name | Description
Public property | BindingContext | Gets the BindingContext in which the assembly name is valid.
Public property | Culture | Gets the assembly culture name.
Public property | IsRetargetable | Determines whether the reference is retargetable by the CLR, i.e. can be accommodated by an assembly whose identity does not match the current assembly reference.
Public property | IsStronglyNamed | Determines whether the current assembly (or assembly reference) contains a strong name signature.
Public property | Name | Gets the assembly friendly name.
Public property | ProcessorArchitecture | Gets the processor architecture that the current assembly targets.
Public property | Version | Gets the assembly version.
Top
See Also

Reference

IAssemblyName Interface
PostSharp.Reflection Namespace


IAssemblyName.BindingContext Property

IAssemblyNameBindingContext Property

Gets the BindingContext in which the assembly name is valid.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
BindingContext BindingContext { get; }

Property Value

Type: BindingContext
See Also

Reference

IAssemblyName Interface
PostSharp.Reflection Namespace


IAssemblyName.Culture Property

IAssemblyNameCulture Property

Gets the assembly culture name.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
string Culture { get; }

Property Value

Type: String
The standard assembly culture name, or null if the assembly is culture-neutral.
See Also

Reference

IAssemblyName Interface
PostSharp.Reflection Namespace


IAssemblyName.IsRetargetable Property

IAssemblyNameIsRetargetable Property

Determines whether the reference is retargetable by the CLR, i.e. can be accommodated by an assembly whose identity does not match the current assembly reference.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
bool IsRetargetable { get; }

Property Value

Type: Boolean
See Also

Reference

IAssemblyName Interface
PostSharp.Reflection Namespace


IAssemblyName.IsStronglyNamed Property

IAssemblyNameIsStronglyNamed Property

Determines whether the current assembly (or assembly reference) contains a strong name signature.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
bool IsStronglyNamed { get; }

Property Value

Type: Boolean
See Also

Reference

IAssemblyName Interface
PostSharp.Reflection Namespace


IAssemblyName.Name Property

IAssemblyNameName Property

Gets the assembly friendly name.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
string Name { get; }

Property Value

Type: String
The assembly friendly name.
See Also

Reference

IAssemblyName Interface
PostSharp.Reflection Namespace


IAssemblyName.ProcessorArchitecture Property

IAssemblyNameProcessorArchitecture Property

Gets the processor architecture that the current assembly targets.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
AssemblyProcessorArchitecture ProcessorArchitecture { get; }

Property Value

Type: AssemblyProcessorArchitecture
See Also

Reference

IAssemblyName Interface
PostSharp.Reflection Namespace


IAssemblyName.Version Property

IAssemblyNameVersion Property

Gets the assembly version.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Version Version { get; }

Property Value

Type: Version
A Version.
See Also

Reference

IAssemblyName Interface
PostSharp.Reflection Namespace


IAssemblyName Methods

The IAssemblyName type exposes the following members.

Methods
 | Name | Description
Public method | GetPublicKey | Gets the assembly public key.
Public method | GetPublicKeyToken | Gets the assembly public key token.
Top
See Also

Reference

IAssemblyName Interface
PostSharp.Reflection Namespace


IAssemblyName.GetPublicKey Method

IAssemblyNameGetPublicKey Method

Gets the assembly public key.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
byte[] GetPublicKey()

Field Value

Type: Byte
An array of bytes containing the public key, or null if no public key is specified (for instance if only the public key token is given).

Return Value

Type: Byte
An array of bytes containing the public key, or null if no public key is specified.
See Also

Reference

IAssemblyName Interface
PostSharp.Reflection Namespace


IAssemblyName.GetPublicKeyToken Method

IAssemblyNameGetPublicKeyToken Method

Gets the assembly public key token.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
byte[] GetPublicKeyToken()

Return Value

Type: Byte
An array of bytes containing the public key token, or null if no public key is specified.
See Also

Reference

IAssemblyName Interface
PostSharp.Reflection Namespace


ICodeReference Interface

Represents a reference between two declarations.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ICodeReference

The ICodeReference type exposes the following members.

Properties
 | Name | Description
Public property | ReferencedDeclaration | Gets the declaration referenced by the other.
Public property | ReferenceKind | Gets the kind of code reference.
Public property | ReferencingDeclaration | Gets the declaration referencing the other.
Top
See Also

Reference

PostSharp.Reflection Namespace


ICodeReference Properties

The ICodeReference type exposes the following members.

Properties
 | Name | Description
Public property | ReferencedDeclaration | Gets the declaration referenced by the other.
Public property | ReferenceKind | Gets the kind of code reference.
Public property | ReferencingDeclaration | Gets the declaration referencing the other.
Top
See Also

Reference

ICodeReference Interface
PostSharp.Reflection Namespace


ICodeReference.ReferencedDeclaration Property

ICodeReferenceReferencedDeclaration Property

Gets the declaration referenced by the other.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Object ReferencedDeclaration { get; }

Property Value

Type: Object
See Also

Reference

ICodeReference Interface
PostSharp.Reflection Namespace


ICodeReference.ReferenceKind Property

ICodeReferenceReferenceKind Property

Gets the kind of code reference.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
CodeReferenceKind ReferenceKind { get; }

Property Value

Type: CodeReferenceKind
See Also

Reference

ICodeReference Interface
PostSharp.Reflection Namespace


ICodeReference.ReferencingDeclaration Property

ICodeReferenceReferencingDeclaration Property

Gets the declaration referencing the other.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Object ReferencingDeclaration { get; }

Property Value

Type: Object
See Also

Reference

ICodeReference Interface
PostSharp.Reflection Namespace


IMetadataDispenser Interface

Semantics of service that deserializes metadata objects (i.e. reflection objects) that have been serialized by IMetadataEmitter.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IMetadataDispenser

The IMetadataDispenser type exposes the following members.

Methods
 | Name | Description
Public method | GetMetadata | Gets the reflection object corresponding to the given index.
Top
See Also

Reference

PostSharp.Reflection Namespace


IMetadataDispenser Methods

The IMetadataDispenser type exposes the following members.

Methods
 | Name | Description
Public method | GetMetadata | Gets the reflection object corresponding to the given index.
Top
See Also

Reference

IMetadataDispenser Interface
PostSharp.Reflection Namespace


IMetadataDispenser.GetMetadata Method

IMetadataDispenserGetMetadata Method

Gets the reflection object corresponding to the given index.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Object GetMetadata(
    int index
)

Parameters

index
Type: SystemInt32
Index returned by GetMetadataIndex(Object) at build time.

Return Value

Type: Object
The reflection object corresponding to index.
See Also

Reference

IMetadataDispenser Interface
PostSharp.Reflection Namespace


IMetadataEmitter Interface

Semantics of a service that allows build-time code to serialize references to metadata objects (i.e. reflection objects) in a way that is compatible with obfuscators. References are deserialized at run-time using IMetadataDispenser.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IMetadataEmitter

The IMetadataEmitter type exposes the following members.

Methods
 | Name | Description
Public method | GetMetadataIndex | Gets the index of a serialized metadata reference.
Top
See Also

Reference

PostSharp.Reflection Namespace


IMetadataEmitter Methods

The IMetadataEmitter type exposes the following members.

Methods
 | Name | Description
Public method | GetMetadataIndex | Gets the index of a serialized metadata reference.
Top
See Also

Reference

IMetadataEmitter Interface
PostSharp.Reflection Namespace


IMetadataEmitter.GetMetadataIndex Method

IMetadataEmitterGetMetadataIndex Method

Gets the index of a serialized metadata reference.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
int GetMetadataIndex(
    Object metadata
)

Parameters

metadata
Type: SystemObject
A reflection object.

Return Value

Type: Int32
The index of metadata, to be serialized and deserialized at runtime with GetMetadata(Int32).
See Also

Reference

IMetadataEmitter Interface
PostSharp.Reflection Namespace


ISourceDocument Interface

Represents a file of source code.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ISourceDocument

The ISourceDocument type exposes the following members.

Properties
 | Name | Description
Public property | FileName | Full path of the file.
Public property | Language | Language (Guid according to Microsoft PDB specification).
Top
See Also

Reference

PostSharp.Reflection Namespace


ISourceDocument Properties

The ISourceDocument type exposes the following members.

Properties
 | Name | Description
Public property | FileName | Full path of the file.
Public property | Language | Language (Guid according to Microsoft PDB specification).
Top
See Also

Reference

ISourceDocument Interface
PostSharp.Reflection Namespace


ISourceDocument.FileName Property

ISourceDocumentFileName Property

Full path of the file.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
string FileName { get; }

Property Value

Type: String
See Also

Reference

ISourceDocument Interface
PostSharp.Reflection Namespace


ISourceDocument.Language Property

ISourceDocumentLanguage Property

Language (Guid according to Microsoft PDB specification).

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Guid Language { get; }

Property Value

Type: Guid
Remarks

The language GUID varies according to the kind of PDB file (native or portable).

See Also

Reference

ISourceDocument Interface
PostSharp.Reflection Namespace


LocationInfo Class

Represents a FieldInfo, PropertyInfo or ParameterInfo, which all have the semantics of a location (get value, set value).
Inheritance Hierarchy
SystemObject
PostSharp.ReflectionLocationInfo

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public sealed class LocationInfo : IEquatable<LocationInfo>,
    ISerializable

The LocationInfo type exposes the following members.

Constructors
 | Name | Description
Public method | LocationInfo(FieldInfo) | Initializes a new LocationInfo from a FieldInfo.
Public method | LocationInfo(ParameterInfo) | Initializes a new LocationInfo from a ParameterInfo.
Public method | LocationInfo(PropertyInfo) | Initializes a new LocationInfo from a PropertyInfo.
Top
Properties
 | Name | Description
Public property | DeclaringType | Gets the declaring type of the underlying field, property, parameter, or return value.
Public property | FieldInfo | Gets the underlying FieldInfo, or null if the underlying code element is not a property.
Public property | IsStatic | Determines whether the underlying field or property is static.
Public property | LocationKind | Gets the location kind (Field, Property, Parameter or ReturnValue).
Public property | LocationType | Gets the type of values that can be stored in the location.
Public property | Name | Gets the name of the underlying field, property, parameter, or return value.
Public property | ParameterInfo | Gets the underlying ParameterInfo, or null if the underlying code element is not a property.
Public property | PropertyInfo | Gets the underlying PropertyInfo, or null if the underlying code element is not a property.
Top
Methods
 | Name | Description
Public method | Equals(Object) | Determines whether the specified object is equal to the current object. (Overrides ObjectEquals(Object).)
Public method | Equals(LocationInfo) | Indicates whether the current object is equal to another object of the same type.
Public method | GetHashCode | Serves as the default hash function. (Overrides ObjectGetHashCode.)
Public method | GetValue(Object) | Returns the value of the field or property represented by the current object.
Public method | GetValue(Object, Object) | Returns the value of the field or property represented by the current object with optional index values for indexed properties.
Public method | SetValue(Object, Object) | Sets the value of the field or property represented by the current object to a given value.
Public method | SetValue(Object, Object, Object) | Sets the value of the field or property represented by the current object to a given value with optional index values for indexed properties.
 | ToLocationInfo | Initializes a new LocationInfo from a FieldInfo, PropertyInfo, or ParameterInfo.
 | ToLocationInfoArray(ICollectionFieldInfo) | Converts a collection of FieldInfo into an array of LocationInfo.
 | ToLocationInfoArray(ICollectionParameterInfo) | Converts a collection of ParameterInfo into an array of LocationInfo.
 | ToLocationInfoArray(ICollectionPropertyInfo) | Converts a collection of PropertyInfo into an array of LocationInfo.
Public method | ToString | Returns a string that represents the current object. (Overrides ObjectToString.)
Top
Operators
Name | Description
Equality | Determines whether two instances of LocationInfo represent the same element of code.
Inequality | Determines whether two instances of LocationInfo represent different elements of code.
Top
See Also

Reference

PostSharp.Reflection Namespace

Other Resources

Conceptual: Intercepting Properties and Fields


LocationInfo Constructor

Overload List
 | Name | Description
Public method | LocationInfo(FieldInfo) | Initializes a new LocationInfo from a FieldInfo.
Public method | LocationInfo(ParameterInfo) | Initializes a new LocationInfo from a ParameterInfo.
Public method | LocationInfo(PropertyInfo) | Initializes a new LocationInfo from a PropertyInfo.
Top
See Also

Reference

LocationInfo Class
PostSharp.Reflection Namespace


LocationInfo Constructor (FieldInfo)

Initializes a new LocationInfo from a FieldInfo.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LocationInfo(
    FieldInfo fieldInfo
)

Parameters

fieldInfo
Type: System.ReflectionFieldInfo
The field represented by the LocationInfo.
See Also

Reference

LocationInfo Class
LocationInfo Overload
PostSharp.Reflection Namespace


LocationInfo Constructor (ParameterInfo)

Initializes a new LocationInfo from a ParameterInfo.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LocationInfo(
    ParameterInfo parameterInfo
)

Parameters

parameterInfo
Type: System.ReflectionParameterInfo
The parameter represented by the LocationInfo.
See Also

Reference

LocationInfo Class
LocationInfo Overload
PostSharp.Reflection Namespace


LocationInfo Constructor (PropertyInfo)

Initializes a new LocationInfo from a PropertyInfo.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LocationInfo(
    PropertyInfo propertyInfo
)

Parameters

propertyInfo
Type: System.ReflectionPropertyInfo
The property represented by the LocationInfo.
See Also

Reference

LocationInfo Class
LocationInfo Overload
PostSharp.Reflection Namespace


LocationInfo Properties

The LocationInfo type exposes the following members.

Properties
 | Name | Description
Public property | DeclaringType | Gets the declaring type of the underlying field, property, parameter, or return value.
Public property | FieldInfo | Gets the underlying FieldInfo, or null if the underlying code element is not a property.
Public property | IsStatic | Determines whether the underlying field or property is static.
Public property | LocationKind | Gets the location kind (Field, Property, Parameter or ReturnValue).
Public property | LocationType | Gets the type of values that can be stored in the location.
Public property | Name | Gets the name of the underlying field, property, parameter, or return value.
Public property | ParameterInfo | Gets the underlying ParameterInfo, or null if the underlying code element is not a property.
Public property | PropertyInfo | Gets the underlying PropertyInfo, or null if the underlying code element is not a property.
Top
See Also

Reference

LocationInfo Class
PostSharp.Reflection Namespace


LocationInfo.DeclaringType Property

LocationInfoDeclaringType Property

Gets the declaring type of the underlying field, property, parameter, or return value.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Type DeclaringType { get; }

Property Value

Type: Type
See Also

Reference

LocationInfo Class
PostSharp.Reflection Namespace


LocationInfo.FieldInfo Property

LocationInfoFieldInfo Property

Gets the underlying FieldInfo, or null if the underlying code element is not a property.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public FieldInfo FieldInfo { get; }

Property Value

Type: FieldInfo
See Also

Reference

LocationInfo Class
PostSharp.Reflection Namespace

Other Resources

Conceptual: Intercepting Properties and Fields


LocationInfo.IsStatic Property

LocationInfoIsStatic Property

Determines whether the underlying field or property is static.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsStatic { get; }

Property Value

Type: Boolean
See Also

Reference

LocationInfo Class
PostSharp.Reflection Namespace


LocationInfo.LocationKind Property

LocationInfoLocationKind Property

Gets the location kind (Field, Property, Parameter or ReturnValue).

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public LocationKind LocationKind { get; }

Property Value

Type: LocationKind
See Also

Reference

LocationInfo Class
PostSharp.Reflection Namespace


LocationInfo.LocationType Property

LocationInfoLocationType Property

Gets the type of values that can be stored in the location.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Type LocationType { get; }

Property Value

Type: Type
See Also

Reference

LocationInfo Class
PostSharp.Reflection Namespace


LocationInfo.Name Property

LocationInfoName Property

Gets the name of the underlying field, property, parameter, or return value.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string Name { get; }

Property Value

Type: String
See Also

Reference

LocationInfo Class
PostSharp.Reflection Namespace


LocationInfo.ParameterInfo Property

LocationInfoParameterInfo Property

Gets the underlying ParameterInfo, or null if the underlying code element is not a property.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ParameterInfo ParameterInfo { get; }

Property Value

Type: ParameterInfo
See Also

Reference

LocationInfo Class
PostSharp.Reflection Namespace

Other Resources

Conceptual: Intercepting Properties and Fields


LocationInfo.PropertyInfo Property

LocationInfoPropertyInfo Property

Gets the underlying PropertyInfo, or null if the underlying code element is not a property.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public PropertyInfo PropertyInfo { get; }

Property Value

Type: PropertyInfo
See Also

Reference

LocationInfo Class
PostSharp.Reflection Namespace

Other Resources

Conceptual: Intercepting Properties and Fields


LocationInfo Methods

The LocationInfo type exposes the following members.

Methods
 | Name | Description
Public method | Equals(Object) | Determines whether the specified object is equal to the current object. (Overrides ObjectEquals(Object).)
Public method | Equals(LocationInfo) | Indicates whether the current object is equal to another object of the same type.
Public method | GetHashCode | Serves as the default hash function. (Overrides ObjectGetHashCode.)
Public method | GetValue(Object) | Returns the value of the field or property represented by the current object.
Public method | GetValue(Object, Object) | Returns the value of the field or property represented by the current object with optional index values for indexed properties.
Public method | SetValue(Object, Object) | Sets the value of the field or property represented by the current object to a given value.
Public method | SetValue(Object, Object, Object) | Sets the value of the field or property represented by the current object to a given value with optional index values for indexed properties.
 | ToLocationInfo | Initializes a new LocationInfo from a FieldInfo, PropertyInfo, or ParameterInfo.
 | ToLocationInfoArray(ICollectionFieldInfo) | Converts a collection of FieldInfo into an array of LocationInfo.
 | ToLocationInfoArray(ICollectionParameterInfo) | Converts a collection of ParameterInfo into an array of LocationInfo.
 | ToLocationInfoArray(ICollectionPropertyInfo) | Converts a collection of PropertyInfo into an array of LocationInfo.
Public method | ToString | Returns a string that represents the current object. (Overrides ObjectToString.)
Top
See Also

Reference

LocationInfo Class
PostSharp.Reflection Namespace


LocationInfo.Equals Method

LocationInfoEquals Method

Overload List
 | Name | Description
Public method | Equals(Object) | Determines whether the specified object is equal to the current object. (Overrides ObjectEquals(Object).)
Public method | Equals(LocationInfo) | Indicates whether the current object is equal to another object of the same type.
Top
See Also

Reference

LocationInfo Class
PostSharp.Reflection Namespace


LocationInfo.Equals Method (Object)

LocationInfoEquals Method (Object)

Determines whether the specified object is equal to the current object.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool Equals(
    Object obj
)

Parameters

obj
Type: SystemObject
The object to compare with the current object.

Return Value

Type: Boolean
true if the specified object is equal to the current object; otherwise, false.
See Also

Reference

LocationInfo Class
Equals Overload
PostSharp.Reflection Namespace


LocationInfo.Equals Method (LocationInfo)

LocationInfoEquals Method (LocationInfo)

Indicates whether the current object is equal to another object of the same type.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Equals(
    LocationInfo other
)

Parameters

other
Type: PostSharp.ReflectionLocationInfo
An object to compare with this object.

Return Value

Type: Boolean
true if the current object is equal to the other parameter; otherwise, false.

Implements

IEquatableTEquals(T)
See Also

Reference

LocationInfo Class
Equals Overload
PostSharp.Reflection Namespace


LocationInfo.GetHashCode Method

LocationInfoGetHashCode Method

Serves as the default hash function.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override int GetHashCode()

Return Value

Type: Int32
A hash code for the current object.
See Also

Reference

LocationInfo Class
PostSharp.Reflection Namespace


LocationInfo.GetValue Method

LocationInfoGetValue Method

Overload List
 | Name | Description
Public method | GetValue(Object) | Returns the value of the field or property represented by the current object.
Public method | GetValue(Object, Object) | Returns the value of the field or property represented by the current object with optional index values for indexed properties.
Top
See Also

Reference

LocationInfo Class
PostSharp.Reflection Namespace


LocationInfo.GetValue Method (Object)

LocationInfoGetValue Method (Object)

Returns the value of the field or property represented by the current object.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Object GetValue(
    Object instance
)

Parameters

instance
Type: SystemObject
The object whose field or property value will be returned (null if the field or property is static).

Return Value

Type: Object
The value of the field or property.
See Also

Reference

LocationInfo Class
GetValue Overload
PostSharp.Reflection Namespace


LocationInfo.GetValue Method (Object, Object[])

LocationInfoGetValue Method (Object, Object)

Returns the value of the field or property represented by the current object with optional index values for indexed properties.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Object GetValue(
    Object instance,
    Object[] index
)

Parameters

instance
Type: SystemObject
The object whose field or property value will be returned (null if the field or property is static).
index
Type: SystemObject
Optional index values for indexed properties. null for fields or non-index properties.

Return Value

Type: Object
The value of the field or property.
See Also

Reference

LocationInfo Class
GetValue Overload
PostSharp.Reflection Namespace


LocationInfo.SetValue Method

LocationInfoSetValue Method

Overload List
 | Name | Description
Public method | SetValue(Object, Object) | Sets the value of the field or property represented by the current object to a given value.
Public method | SetValue(Object, Object, Object) | Sets the value of the field or property represented by the current object to a given value with optional index values for indexed properties.
Top
See Also

Reference

LocationInfo Class
PostSharp.Reflection Namespace


LocationInfo.SetValue Method (Object, Object)

LocationInfoSetValue Method (Object, Object)

Sets the value of the field or property represented by the current object to a given value.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void SetValue(
    Object instance,
    Object value
)

Parameters

instance
Type: SystemObject
The object whose field or property value will be changed (null if the field or property is static).
value
Type: SystemObject
New value.
See Also

Reference

LocationInfo Class
SetValue Overload
PostSharp.Reflection Namespace


LocationInfo.SetValue Method (Object, Object, Object[])

LocationInfoSetValue Method (Object, Object, Object)

Sets the value of the field or property represented by the current object to a given value with optional index values for indexed properties.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void SetValue(
    Object instance,
    Object value,
    Object[] index
)

Parameters

instance
Type: SystemObject
The object whose field or property value will be changed (null if the field or property is static).
value
Type: SystemObject
New value.
index
Type: SystemObject
Optional index values for indexed properties. null for fields or non-index properties.
See Also

Reference

LocationInfo Class
SetValue Overload
PostSharp.Reflection Namespace


LocationInfo.ToLocationInfo Method

LocationInfoToLocationInfo Method

Initializes a new LocationInfo from a FieldInfo, PropertyInfo, or ParameterInfo.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static LocationInfo ToLocationInfo(
    Object reflectionInfo
)

Parameters

reflectionInfo
Type: SystemObject

Return Value

Type: LocationInfo
See Also

Reference

LocationInfo Class
PostSharp.Reflection Namespace


LocationInfo.ToLocationInfoArray Method

LocationInfoToLocationInfoArray Method

Overload List
Name | Description
ToLocationInfoArray(ICollectionFieldInfo) | Converts a collection of FieldInfo into an array of LocationInfo.
ToLocationInfoArray(ICollectionParameterInfo) | Converts a collection of ParameterInfo into an array of LocationInfo.
ToLocationInfoArray(ICollectionPropertyInfo) | Converts a collection of PropertyInfo into an array of LocationInfo.
Top
See Also

Reference

LocationInfo Class
PostSharp.Reflection Namespace


LocationInfo.ToLocationInfoArray Method (ICollection(FieldInfo))

LocationInfoToLocationInfoArray Method (ICollectionFieldInfo)

Converts a collection of FieldInfo into an array of LocationInfo.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static LocationInfo[] ToLocationInfoArray(
    ICollection<FieldInfo> fields
)

Parameters

fields
Type: System.Collections.GenericICollection FieldInfo
A collection of FieldInfo.

Return Value

Type: LocationInfo
An array of LocationInfo.
See Also

Reference

LocationInfo Class
ToLocationInfoArray Overload
PostSharp.Reflection Namespace


LocationInfo.ToLocationInfoArray Method (ICollection(ParameterInfo))

LocationInfoToLocationInfoArray Method (ICollectionParameterInfo)

Converts a collection of ParameterInfo into an array of LocationInfo.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static LocationInfo[] ToLocationInfoArray(
    ICollection<ParameterInfo> parameters
)

Parameters

parameters
Type: System.Collections.GenericICollection ParameterInfo
A collection of ParameterInfo.

Return Value

Type: LocationInfo
An array of LocationInfo.
See Also

Reference

LocationInfo Class
ToLocationInfoArray Overload
PostSharp.Reflection Namespace


LocationInfo.ToLocationInfoArray Method (ICollection(PropertyInfo))

LocationInfoToLocationInfoArray Method (ICollectionPropertyInfo)

Converts a collection of PropertyInfo into an array of LocationInfo.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static LocationInfo[] ToLocationInfoArray(
    ICollection<PropertyInfo> properties
)

Parameters

properties
Type: System.Collections.GenericICollection PropertyInfo
A collection of PropertyInfo.

Return Value

Type: LocationInfo
An array of LocationInfo.
See Also

Reference

LocationInfo Class
ToLocationInfoArray Overload
PostSharp.Reflection Namespace


LocationInfo.ToString Method

LocationInfoToString Method

Returns a string that represents the current object.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override string ToString()

Return Value

Type: String
A string that represents the current object.
See Also

Reference

LocationInfo Class
PostSharp.Reflection Namespace


LocationInfo Operators

The LocationInfo type exposes the following members.

Operators
Name | Description
Equality | Determines whether two instances of LocationInfo represent the same element of code.
Inequality | Determines whether two instances of LocationInfo represent different elements of code.
Top
See Also

Reference

LocationInfo Class
PostSharp.Reflection Namespace


LocationInfo.Equality Operator

LocationInfoEquality Operator

Determines whether two instances of LocationInfo represent the same element of code.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool operator ==(
    LocationInfo left,
    LocationInfo right
)

Parameters

left
Type: PostSharp.ReflectionLocationInfo
A LocationInfo.
right
Type: PostSharp.ReflectionLocationInfo
A LocationInfo.

Return Value

Type: Boolean
true if left and right are equal, otherwise false.
See Also

Reference

LocationInfo Class
PostSharp.Reflection Namespace


LocationInfo.Inequality Operator

LocationInfoInequality Operator

Determines whether two instances of LocationInfo represent different elements of code.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool operator !=(
    LocationInfo left,
    LocationInfo right
)

Parameters

left
Type: PostSharp.ReflectionLocationInfo
A LocationInfo.
right
Type: PostSharp.ReflectionLocationInfo
A LocationInfo.

Return Value

Type: Boolean
true if left and right are different, otherwise false.
See Also

Reference

LocationInfo Class
PostSharp.Reflection Namespace


LocationKind Enumeration

Enumerates the kinds of code elements that can be encapsulated by a LocationInfo.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum LocationKind
Members
Member name | Value | Description
Field | 0 | FieldInfo.
Property | 1 | PropertyInfo.
Parameter | 2 | A ParameterInfo representing a parameter (not a ReturnValue).
ReturnValue | 3 | A ParameterInfo representing a return value.
See Also

Reference

PostSharp.Reflection Namespace


MemberTypeCodeReference Class

Represents a relationship between a type and a member of this type. A member can be a FieldInfo, PropertyInfo, or ParameterInfo.
Inheritance Hierarchy
SystemObject
PostSharp.ReflectionMemberTypeCodeReference

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class MemberTypeCodeReference : ICodeReference

The MemberTypeCodeReference type exposes the following members.

Properties
 | Name | Description
Public property | Member | Gets the member (FieldInfo, PropertyInfo, or ParameterInfo).
Public property | Type | Gets the member type.
Top
See Also

Reference

PostSharp.Reflection Namespace


MemberTypeCodeReference Properties

The MemberTypeCodeReference type exposes the following members.

Properties
 | Name | Description
Public property | Member | Gets the member (FieldInfo, PropertyInfo, or ParameterInfo).
Public property | Type | Gets the member type.
Top
See Also

Reference

MemberTypeCodeReference Class
PostSharp.Reflection Namespace


MemberTypeCodeReference.Member Property

MemberTypeCodeReferenceMember Property

Gets the member (FieldInfo, PropertyInfo, or ParameterInfo).

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Object Member { get; }

Property Value

Type: Object
See Also

Reference

MemberTypeCodeReference Class
PostSharp.Reflection Namespace


MemberTypeCodeReference.Type Property

MemberTypeCodeReferenceType Property

Gets the member type.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Type Type { get; }

Property Value

Type: Type
See Also

Reference

MemberTypeCodeReference Class
PostSharp.Reflection Namespace


MethodUsageCodeReference Class

Represents a relationship between a declaration (Type, FieldInfo, MethodInfo or ConstructorInfo) and a method whose instructions (method body) use the declaration.
Inheritance Hierarchy
SystemObject
PostSharp.ReflectionMethodUsageCodeReference

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class MethodUsageCodeReference : ICodeReference

The MethodUsageCodeReference type exposes the following members.

Properties
 | Name | Description
Public property | Instructions | Gets the instructions that reference UsedDeclaration.
Public property | UsedDeclaration | Gets the declaration (Type, MethodInfo or ConstructorInfo) used by the method.
Public property | UsedType | Gets the Type used by the method. If the current object represents a reference to a MethodInfo or ConstructorInfo, this property returns the declaring type of the method or constructor.
Public property | UsingMethod | Gets the method (MethodInfo or ConstructorInfo) whose body uses the declaration.
Top
See Also

Reference

PostSharp.Reflection Namespace


MethodUsageCodeReference Properties

The MethodUsageCodeReference type exposes the following members.

Properties
 | Name | Description
Public property | Instructions | Gets the instructions that reference UsedDeclaration.
Public property | UsedDeclaration | Gets the declaration (Type, MethodInfo or ConstructorInfo) used by the method.
Public property | UsedType | Gets the Type used by the method. If the current object represents a reference to a MethodInfo or ConstructorInfo, this property returns the declaring type of the method or constructor.
Public property | UsingMethod | Gets the method (MethodInfo or ConstructorInfo) whose body uses the declaration.
Top
See Also

Reference

MethodUsageCodeReference Class
PostSharp.Reflection Namespace


MethodUsageCodeReference.Instructions Property

MethodUsageCodeReferenceInstructions Property

Gets the instructions that reference UsedDeclaration.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MethodUsageInstructions Instructions { get; }

Property Value

Type: MethodUsageInstructions
See Also

Reference

MethodUsageCodeReference Class
PostSharp.Reflection Namespace


MethodUsageCodeReference.UsedDeclaration Property

MethodUsageCodeReferenceUsedDeclaration Property

Gets the declaration (Type, MethodInfo or ConstructorInfo) used by the method.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MemberInfo UsedDeclaration { get; }

Property Value

Type: MemberInfo
See Also

Reference

MethodUsageCodeReference Class
PostSharp.Reflection Namespace


MethodUsageCodeReference.UsedType Property

MethodUsageCodeReferenceUsedType Property

Gets the Type used by the method. If the current object represents a reference to a MethodInfo or ConstructorInfo, this property returns the declaring type of the method or constructor.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Type UsedType { get; }

Property Value

Type: Type
See Also

Reference

MethodUsageCodeReference Class
PostSharp.Reflection Namespace


MethodUsageCodeReference.UsingMethod Property

MethodUsageCodeReferenceUsingMethod Property

Gets the method (MethodInfo or ConstructorInfo) whose body uses the declaration.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MethodBase UsingMethod { get; }

Property Value

Type: MethodBase
See Also

Reference

MethodUsageCodeReference Class
PostSharp.Reflection Namespace


MethodUsageInstructions Enumeration

Instructions whose operands can reference a declaration.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[FlagsAttribute]
public enum MethodUsageInstructions
Members
Member name | Value | Description
None | 0 | No instruction.
LoadField | 1 | Get field value.
StoreField | 2 | Set field value.
Call | 4 | Call to a static or sealed method.
CallVirtual | 8 | Call to a virtual method.
NewObject | 16 | Creation of a new instance (invoke the constructor).
LoadFieldAddress | 32 | Get field address.
LoadMetadata | 64 | Load the metadata token (for instance typeof).
LoadMethodAddress | 128 | Load the address of a static or sealed method (delegate instantiation).
LoadMethodAddressVirtual | 256 | Load the address of a virtual method (delegate instantiation).
Cast | 512 | Type casting.
IsInstance | 1024 | "Safe" type casting (as or is in C#).
SizeOf | 2048 | Get the size of a value type (sizeof in C#).
NewArray | 4096 | Create a new array of a type.
See Also

Reference

PostSharp.Reflection Namespace
PostSharp.ReflectionMethodUsageCodeReference


ObjectConstruction Class

Specifies how an object should be constructed, i.e. specifies the constructor to be used, the arguments to be passed to this constructor, and the fields or properties to be set.
Inheritance Hierarchy
SystemObject
PostSharp.ReflectionObjectConstruction

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ObjectConstruction

The ObjectConstruction type exposes the following members.

Constructors
 | Name | Description
Public method | ObjectConstruction(CustomAttributeData) | Initializes a new type-safe ObjectConstruction from a CustomAttributeData
Public method | ObjectConstruction(ConstructorInfo, Object) | Initializes a new type-safe ObjectConstruction from a ConstructorInfo.
Public method | ObjectConstruction(String, Object) | Initializes a new ObjectConstruction by specifying a type name and a list of constructor arguments.
Public method | ObjectConstruction(Type, Object) | Initializes a new ObjectConstruction by specifying a type name and a list of constructor arguments.
Top
Properties
 | Name | Description
Public property | Constructor | Gets the custom attribute constructor.
Public property | ConstructorArguments | Gets the arguments passed to the custom attribute constructor.
Public property | NamedArguments | Gets the collection of named arguments.
Public property | TypeName | Gets the assembly-qualified type name of the object.
Top
See Also

Reference

PostSharp.Reflection Namespace


ObjectConstruction Constructor

Overload List
 | Name | Description
Public method | ObjectConstruction(CustomAttributeData) | Initializes a new type-safe ObjectConstruction from a CustomAttributeData
Public method | ObjectConstruction(ConstructorInfo, Object) | Initializes a new type-safe ObjectConstruction from a ConstructorInfo.
Public method | ObjectConstruction(String, Object) | Initializes a new ObjectConstruction by specifying a type name and a list of constructor arguments.
Public method | ObjectConstruction(Type, Object) | Initializes a new ObjectConstruction by specifying a type name and a list of constructor arguments.
Top
See Also

Reference

ObjectConstruction Class
PostSharp.Reflection Namespace


ObjectConstruction Constructor (CustomAttributeData)

Initializes a new type-safe ObjectConstruction from a CustomAttributeData

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ObjectConstruction(
    CustomAttributeData customAttributeData
)

Parameters

customAttributeData
Type: System.ReflectionCustomAttributeData
A CustomAttributeData
See Also

Reference

ObjectConstruction Class
ObjectConstruction Overload
PostSharp.Reflection Namespace


ObjectConstruction Constructor (ConstructorInfo, Object[])

ObjectConstruction Constructor (ConstructorInfo, Object)

Initializes a new type-safe ObjectConstruction from a ConstructorInfo.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ObjectConstruction(
    ConstructorInfo constructor,
    params Object[] constructorArguments
)

Parameters

constructor
Type: System.ReflectionConstructorInfo
Constructor.
constructorArguments
Type: SystemObject
Arguments passed to the constructor.
See Also

Reference

ObjectConstruction Class
ObjectConstruction Overload
PostSharp.Reflection Namespace


ObjectConstruction Constructor (String, Object[])

ObjectConstruction Constructor (String, Object)

Initializes a new ObjectConstruction by specifying a type name and a list of constructor arguments.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ObjectConstruction(
    string typeName,
    params Object[] constructorArguments
)

Parameters

typeName
Type: SystemString
Name of the object type.
constructorArguments
Type: SystemObject
Arguments passed to the constructor.
See Also

Reference

ObjectConstruction Class
ObjectConstruction Overload
PostSharp.Reflection Namespace


ObjectConstruction Constructor (Type, Object[])

ObjectConstruction Constructor (Type, Object)

Initializes a new ObjectConstruction by specifying a type name and a list of constructor arguments.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ObjectConstruction(
    Type type,
    params Object[] constructorArguments
)

Parameters

type
Type: SystemType
Object type.
constructorArguments
Type: SystemObject
Arguments passed to the constructor.
See Also

Reference

ObjectConstruction Class
ObjectConstruction Overload
PostSharp.Reflection Namespace


ObjectConstruction Properties

The ObjectConstruction type exposes the following members.

Properties
 | Name | Description
Public property | Constructor | Gets the custom attribute constructor.
Public property | ConstructorArguments | Gets the arguments passed to the custom attribute constructor.
Public property | NamedArguments | Gets the collection of named arguments.
Public property | TypeName | Gets the assembly-qualified type name of the object.
Top
See Also

Reference

ObjectConstruction Class
PostSharp.Reflection Namespace


ObjectConstruction.Constructor Property

ObjectConstructionConstructor Property

Gets the custom attribute constructor.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ConstructorInfo Constructor { get; }

Property Value

Type: ConstructorInfo
See Also

Reference

ObjectConstruction Class
PostSharp.Reflection Namespace


ObjectConstruction.ConstructorArguments Property

ObjectConstructionConstructorArguments Property

Gets the arguments passed to the custom attribute constructor.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IList<Object> ConstructorArguments { get; }

Property Value

Type: IList Object
See Also

Reference

ObjectConstruction Class
PostSharp.Reflection Namespace


ObjectConstruction.NamedArguments Property

ObjectConstructionNamedArguments Property

Gets the collection of named arguments.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IDictionary<string, Object> NamedArguments { get; }

Property Value

Type: IDictionary String, Object
Remarks
This collection is a dictionary associating the name of public a field or property of the custom attributes to the value that should be assigned to it.
See Also

Reference

ObjectConstruction Class
PostSharp.Reflection Namespace


ObjectConstruction.TypeName Property

ObjectConstructionTypeName Property

Gets the assembly-qualified type name of the object.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string TypeName { get; }

Property Value

Type: String
See Also

Reference

ObjectConstruction Class
PostSharp.Reflection Namespace


ParameterKind Enumeration

Enumerates all possible kinds of method parameters. The parameter kind indicates whether the parameter is by ref or by value and its direction.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum ParameterKind
Members
Member name | Value | Description
InValue | 0 | Normal (input) parameter.
ByRefIn | 1 | The read-only parameter passed by reference (in parameters since C# 7.2).
ByRefOut | 2 | out parameter.
ByRefInOut | 3 | ref parameter.
ReturnValue | 4 | The return value parameter.
ReturnRef | 5 | The reference return value parameter (ref returns since C# 7.0).
See Also

Reference

PostSharp.Reflection Namespace

Other Resources

Conceptual: Breaking Changes in PostSharp 6.0


ParameterKindExtensions Class

Extensions for the ParameterKind class.
Inheritance Hierarchy
SystemObject
PostSharp.ReflectionParameterKindExtensions

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static class ParameterKindExtensions

The ParameterKindExtensions type exposes the following members.

Methods
Name | Description
IsByRefParameter | Determines whether a parameter of a given ParameterKind is passed by reference (but is not the return parameter).
IsInputParameter | Determines whether a parameter of a given ParameterKind has a meaningful input value.
IsOutputParameter | Determines whether a parameter of a given ParameterKind has a meaningful output value (but is not the return parameter).
IsParameter | Determines whether a parameter is a "real" parameter, and not the return parameter.
IsReturn | Determines whether a parameter of a given ParameterKind represents a return parameter.
Top
See Also

Reference

PostSharp.Reflection Namespace


ParameterKindExtensions Methods

The ParameterKindExtensions type exposes the following members.

Methods
Name | Description
IsByRefParameter | Determines whether a parameter of a given ParameterKind is passed by reference (but is not the return parameter).
IsInputParameter | Determines whether a parameter of a given ParameterKind has a meaningful input value.
IsOutputParameter | Determines whether a parameter of a given ParameterKind has a meaningful output value (but is not the return parameter).
IsParameter | Determines whether a parameter is a "real" parameter, and not the return parameter.
IsReturn | Determines whether a parameter of a given ParameterKind represents a return parameter.
Top
See Also

Reference

ParameterKindExtensions Class
PostSharp.Reflection Namespace


ParameterKindExtensions.IsByRefParameter Method

ParameterKindExtensionsIsByRefParameter Method

Determines whether a parameter of a given ParameterKind is passed by reference (but is not the return parameter).

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool IsByRefParameter(
    this ParameterKind parameterKind
)

Parameters

parameterKind
Type: PostSharp.ReflectionParameterKind

Return Value

Type: Boolean
true if parameterKind equals to ByRefIn, ByRefOut or ByRefInOut, otherwise false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ParameterKind. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

ParameterKindExtensions Class
PostSharp.Reflection Namespace


ParameterKindExtensions.IsInputParameter Method

ParameterKindExtensionsIsInputParameter Method

Determines whether a parameter of a given ParameterKind has a meaningful input value.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool IsInputParameter(
    this ParameterKind parameterKind
)

Parameters

parameterKind
Type: PostSharp.ReflectionParameterKind

Return Value

Type: Boolean
true if parameterKind equals to InValue, ByRefIn or ByRefInOut, otherwise false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ParameterKind. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

ParameterKindExtensions Class
PostSharp.Reflection Namespace


ParameterKindExtensions.IsOutputParameter Method

ParameterKindExtensionsIsOutputParameter Method

Determines whether a parameter of a given ParameterKind has a meaningful output value (but is not the return parameter).

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool IsOutputParameter(
    this ParameterKind parameterKind
)

Parameters

parameterKind
Type: PostSharp.ReflectionParameterKind

Return Value

Type: Boolean
true if parameterKind equals to ByRefOut or ByRefInOut, otherwise false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ParameterKind. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

ParameterKindExtensions Class
PostSharp.Reflection Namespace


ParameterKindExtensions.IsParameter Method

ParameterKindExtensionsIsParameter Method

Determines whether a parameter is a "real" parameter, and not the return parameter.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool IsParameter(
    this ParameterKind parameterKind
)

Parameters

parameterKind
Type: PostSharp.ReflectionParameterKind

Return Value

Type: Boolean
true if parameterKind equals to InValue, ByRefIn, ByRefOut or ByRefInOut, otherwise false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ParameterKind. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

ParameterKindExtensions Class
PostSharp.Reflection Namespace


ParameterKindExtensions.IsReturn Method

ParameterKindExtensionsIsReturn Method

Determines whether a parameter of a given ParameterKind represents a return parameter.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool IsReturn(
    this ParameterKind parameterKind
)

Parameters

parameterKind
Type: PostSharp.ReflectionParameterKind

Return Value

Type: Boolean
true if parameterKind equals to ReturnValue or ReturnRef, otherwise false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ParameterKind. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

ParameterKindExtensions Class
PostSharp.Reflection Namespace


ReflectionExtensions Class

Provides utility methods to work with the System.Reflection namespace.
Inheritance Hierarchy
SystemObject
PostSharp.ReflectionReflectionExtensions

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static class ReflectionExtensions

The ReflectionExtensions type exposes the following members.

Methods
Name | Description
GetAutomaticProperty(FieldInfo) | Gets the PropertyInfo whose a given field is the backing field from the current type or base types.
GetAutomaticProperty(FieldInfo, Boolean) | Gets the PropertyInfo whose a given field is the backing field and specifies whether base types should be considered.
GetBackingField | Gets the backing field of a given property.
GetStateMachineKind | Gets the kind of state machine (typically Async, [!:StateMachineKind.Enumerable] or None) that implements a given method.
GetStateMachinePublicMethod | Gets the public (or kick-off) method given a MoveNext method.
IsAutomaticProperty | Determines whether a given property is an automatic property.
Top
See Also

Reference

PostSharp.Reflection Namespace


ReflectionExtensions Methods

The ReflectionExtensions type exposes the following members.

Methods
Name | Description
GetAutomaticProperty(FieldInfo) | Gets the PropertyInfo whose a given field is the backing field from the current type or base types.
GetAutomaticProperty(FieldInfo, Boolean) | Gets the PropertyInfo whose a given field is the backing field and specifies whether base types should be considered.
GetBackingField | Gets the backing field of a given property.
GetStateMachineKind | Gets the kind of state machine (typically Async, [!:StateMachineKind.Enumerable] or None) that implements a given method.
GetStateMachinePublicMethod | Gets the public (or kick-off) method given a MoveNext method.
IsAutomaticProperty | Determines whether a given property is an automatic property.
Top
See Also

Reference

ReflectionExtensions Class
PostSharp.Reflection Namespace


ReflectionExtensions.GetAutomaticProperty Method

ReflectionExtensionsGetAutomaticProperty Method

Overload List
Name | Description
GetAutomaticProperty(FieldInfo) | Gets the PropertyInfo whose a given field is the backing field from the current type or base types.
GetAutomaticProperty(FieldInfo, Boolean) | Gets the PropertyInfo whose a given field is the backing field and specifies whether base types should be considered.
Top
See Also

Reference

ReflectionExtensions Class
PostSharp.Reflection Namespace


ReflectionExtensions.GetAutomaticProperty Method (FieldInfo)

ReflectionExtensionsGetAutomaticProperty Method (FieldInfo)

Gets the PropertyInfo whose a given field is the backing field from the current type or base types.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static PropertyInfo GetAutomaticProperty(
    this FieldInfo field
)

Parameters

field
Type: System.ReflectionFieldInfo
A field.

Return Value

Type: PropertyInfo
The PropertyInfo representing the property whose field is the backing field, or null if field is not the backing field of an automatic property.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type FieldInfo. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

ReflectionExtensions Class
GetAutomaticProperty Overload
PostSharp.Reflection Namespace


ReflectionExtensions.GetAutomaticProperty Method (FieldInfo, Boolean)

ReflectionExtensionsGetAutomaticProperty Method (FieldInfo, Boolean)

Gets the PropertyInfo whose a given field is the backing field and specifies whether base types should be considered.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static PropertyInfo GetAutomaticProperty(
    this FieldInfo field,
    bool inherit
)

Parameters

field
Type: System.ReflectionFieldInfo
A field.
inherit
Type: SystemBoolean
true if the property should be looked for in the base, otherwise false.

Return Value

Type: PropertyInfo
The PropertyInfo representing the property whose field is the backing field, or null if field is not the backing field of an automatic property.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type FieldInfo. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

ReflectionExtensions Class
GetAutomaticProperty Overload
PostSharp.Reflection Namespace


ReflectionExtensions.GetBackingField Method

ReflectionExtensionsGetBackingField Method

Gets the backing field of a given property.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static FieldInfo GetBackingField(
    this PropertyInfo propertyInfo
)

Parameters

propertyInfo
Type: System.ReflectionPropertyInfo
A property.

Return Value

Type: FieldInfo
The FieldInfo representing the backing field of propertyInfo, or null if propertyInfo is not an automatic property.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type PropertyInfo. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

ReflectionExtensions Class
PostSharp.Reflection Namespace


ReflectionExtensions.GetStateMachineKind Method

ReflectionExtensionsGetStateMachineKind Method

Gets the kind of state machine (typically Async, [!:StateMachineKind.Enumerable] or None) that implements a given method.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static StateMachineKind GetStateMachineKind(
    this MethodInfo method
)

Parameters

method
Type: System.ReflectionMethodInfo
A method.

Return Value

Type: StateMachineKind
A StateMachineKind value, or None if method is not implemented by a state machine.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type MethodInfo. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

ReflectionExtensions Class
PostSharp.Reflection Namespace


ReflectionExtensions.GetStateMachinePublicMethod Method

ReflectionExtensionsGetStateMachinePublicMethod Method

Gets the public (or kick-off) method given a MoveNext method.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static MethodInfo GetStateMachinePublicMethod(
    this MethodInfo method
)

Parameters

method
Type: System.ReflectionMethodInfo
The move next method.

Return Value

Type: MethodInfo
The public (kick-off method) corresponding to method.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type MethodInfo. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

ReflectionExtensions Class
PostSharp.Reflection Namespace


ReflectionExtensions.IsAutomaticProperty Method

ReflectionExtensionsIsAutomaticProperty Method

Determines whether a given property is an automatic property.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool IsAutomaticProperty(
    this PropertyInfo propertyInfo
)

Parameters

propertyInfo
Type: System.ReflectionPropertyInfo
A property.

Return Value

Type: Boolean
true if propertyInfo represents an automatic property, otherwise false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type PropertyInfo. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

ReflectionExtensions Class
PostSharp.Reflection Namespace


ReflectionHelper Class

Provides helper methods for work with System.Reflection.
Inheritance Hierarchy
SystemObject
PostSharp.ReflectionReflectionHelper

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static class ReflectionHelper

The ReflectionHelper type exposes the following members.

Methods
Name | Description
AreInternalsVisibleTo | Determines whether the InternalsVisibleToAttribute attribute relationship exists between two assemblies.
AreInternalsVisibleToCurrentProject | Determines whether the internals of a given assembly are visible to the current project.
GetAssemblyQualifiedTypeName | Gets a properly-escaped assembly-qualified type name from its components.
GetEvent |
GetLocation |
GetProperty(Type, MethodInfo, MethodInfo) |
GetProperty(Type, MethodInfo, MethodInfo, Boolean) |
GetSemanticInfo(MemberInfo) | Gets the SemanticInfo for a given member.
GetSemanticInfo(Type) | Gets the SemanticInfo for a given type.
IsAvailableInTargetFramework(MemberInfo) |
IsAvailableInTargetFramework(Type) |
IsCompilerGenerated(MemberInfo) | Determines whether a MemberInfo is compiler-generated.
IsCompilerGenerated(Type) | Determines whether a Type is compiler-generated.
ParseAssemblyQualifiedTypeName | Parses an escaped assembly-qualified type name into its components.
Top
See Also

Reference

PostSharp.Reflection Namespace


ReflectionHelper Methods

The ReflectionHelper type exposes the following members.

Methods
Name | Description
AreInternalsVisibleTo | Determines whether the InternalsVisibleToAttribute attribute relationship exists between two assemblies.
AreInternalsVisibleToCurrentProject | Determines whether the internals of a given assembly are visible to the current project.
GetAssemblyQualifiedTypeName | Gets a properly-escaped assembly-qualified type name from its components.
GetEvent |
GetLocation |
GetProperty(Type, MethodInfo, MethodInfo) |
GetProperty(Type, MethodInfo, MethodInfo, Boolean) |
GetSemanticInfo(MemberInfo) | Gets the SemanticInfo for a given member.
GetSemanticInfo(Type) | Gets the SemanticInfo for a given type.
IsAvailableInTargetFramework(MemberInfo) |
IsAvailableInTargetFramework(Type) |
IsCompilerGenerated(MemberInfo) | Determines whether a MemberInfo is compiler-generated.
IsCompilerGenerated(Type) | Determines whether a Type is compiler-generated.
ParseAssemblyQualifiedTypeName | Parses an escaped assembly-qualified type name into its components.
Top
See Also

Reference

ReflectionHelper Class
PostSharp.Reflection Namespace


ReflectionHelper.AreInternalsVisibleTo Method

ReflectionHelperAreInternalsVisibleTo Method

Determines whether the InternalsVisibleToAttribute attribute relationship exists between two assemblies.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool AreInternalsVisibleTo(
    this Assembly definingAssembly,
    Assembly referencingAssembly
)

Parameters

definingAssembly
Type: System.ReflectionAssembly
The assembly defining the InternalsVisibleToAttribute attribute.
referencingAssembly
Type: System.ReflectionAssembly
The assembly referenced by the InternalsVisibleToAttribute attribute.

Return Value

Type: Boolean
true if definingAssembly equals referencingAssembly or if definingAssembly contains an InternalsVisibleToAttribute attribute for referencingAssembly, otherwise false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Assembly. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

ReflectionHelper Class
PostSharp.Reflection Namespace


ReflectionHelper.AreInternalsVisibleToCurrentProject Method

ReflectionHelperAreInternalsVisibleToCurrentProject Method

Determines whether the internals of a given assembly are visible to the current project.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool AreInternalsVisibleToCurrentProject(
    this Assembly definingAssembly
)

Parameters

definingAssembly
Type: System.ReflectionAssembly
The assembly containing the internal declaration.

Return Value

Type: Boolean
true if definingAssembly equals the assembly being processed or if definingAssembly contains an InternalsVisibleToAttribute attribute for the assembly being processed, otherwise false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Assembly. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

ReflectionHelper Class
PostSharp.Reflection Namespace


ReflectionHelper.GetAssemblyQualifiedTypeName Method

ReflectionHelperGetAssemblyQualifiedTypeName Method

Gets a properly-escaped assembly-qualified type name from its components.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static string GetAssemblyQualifiedTypeName(
    string typeName,
    string assemblyName
)

Parameters

typeName
Type: SystemString
The type name.
assemblyName
Type: SystemString
The assembly name.

Return Value

Type: String
A string of the form
Copy
TypeName, AssemblyName
, where commas in typeName have been properly escaped.
See Also

Reference

ReflectionHelper Class
PostSharp.Reflection Namespace


ReflectionHelper.GetEvent Method

ReflectionHelperGetEvent Method

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static EventInfo GetEvent(
    Type declaringType,
    MethodInfo addMethod,
    MethodInfo removeMethod,
    MethodInfo raiseMethod
)

Parameters

declaringType
Type: SystemType
addMethod
Type: System.ReflectionMethodInfo
removeMethod
Type: System.ReflectionMethodInfo
raiseMethod
Type: System.ReflectionMethodInfo

Return Value

Type: EventInfo
See Also

Reference

ReflectionHelper Class
PostSharp.Reflection Namespace


ReflectionHelper.GetLocation Method

ReflectionHelperGetLocation Method

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static LocationInfo GetLocation(
    Type declaringType,
    MethodInfo getter,
    MethodInfo setter
)

Parameters

declaringType
Type: SystemType
getter
Type: System.ReflectionMethodInfo
setter
Type: System.ReflectionMethodInfo

Return Value

Type: LocationInfo
See Also

Reference

ReflectionHelper Class
PostSharp.Reflection Namespace


ReflectionHelper.GetProperty Method

ReflectionHelperGetProperty Method

Overload List
Name | Description
GetProperty(Type, MethodInfo, MethodInfo) |
GetProperty(Type, MethodInfo, MethodInfo, Boolean) |
Top
See Also

Reference

ReflectionHelper Class
PostSharp.Reflection Namespace


ReflectionHelper.GetProperty Method (Type, MethodInfo, MethodInfo)

ReflectionHelperGetProperty Method (Type, MethodInfo, MethodInfo)

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static PropertyInfo GetProperty(
    Type declaringType,
    MethodInfo getter,
    MethodInfo setter
)

Parameters

declaringType
Type: SystemType
getter
Type: System.ReflectionMethodInfo
setter
Type: System.ReflectionMethodInfo

Return Value

Type: PropertyInfo
See Also

Reference

ReflectionHelper Class
GetProperty Overload
PostSharp.Reflection Namespace


ReflectionHelper.GetProperty Method (Type, MethodInfo, MethodInfo, Boolean)

ReflectionHelperGetProperty Method (Type, MethodInfo, MethodInfo, Boolean)

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static PropertyInfo GetProperty(
    Type declaringType,
    MethodInfo getter,
    MethodInfo setter,
    bool throwOnMissingMember
)

Parameters

declaringType
Type: SystemType
getter
Type: System.ReflectionMethodInfo
setter
Type: System.ReflectionMethodInfo
throwOnMissingMember
Type: SystemBoolean

Return Value

Type: PropertyInfo
See Also

Reference

ReflectionHelper Class
GetProperty Overload
PostSharp.Reflection Namespace


ReflectionHelper.GetSemanticInfo Method

ReflectionHelperGetSemanticInfo Method

Overload List
Name | Description
GetSemanticInfo(MemberInfo) | Gets the SemanticInfo for a given member.
GetSemanticInfo(Type) | Gets the SemanticInfo for a given type.
Top
See Also

Reference

ReflectionHelper Class
PostSharp.Reflection Namespace


ReflectionHelper.GetSemanticInfo Method (MemberInfo)

ReflectionHelperGetSemanticInfo Method (MemberInfo)

Gets the SemanticInfo for a given member.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static SemanticInfo GetSemanticInfo(
    this MemberInfo member
)

Parameters

member
Type: System.ReflectionMemberInfo
A member.

Return Value

Type: SemanticInfo
The SemanticInfo for member.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type MemberInfo. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

ReflectionHelper Class
GetSemanticInfo Overload
PostSharp.Reflection Namespace


ReflectionHelper.GetSemanticInfo Method (Type)

ReflectionHelperGetSemanticInfo Method (Type)

Gets the SemanticInfo for a given type.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static SemanticInfo GetSemanticInfo(
    this Type type
)

Parameters

type
Type: SystemType
A type.

Return Value

Type: SemanticInfo
The SemanticInfo for type.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Type. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

ReflectionHelper Class
GetSemanticInfo Overload
PostSharp.Reflection Namespace


ReflectionHelper.IsAvailableInTargetFramework Method

ReflectionHelperIsAvailableInTargetFramework Method

Overload List
Name | Description
IsAvailableInTargetFramework(MemberInfo) |
IsAvailableInTargetFramework(Type) |
Top
See Also

Reference

ReflectionHelper Class
PostSharp.Reflection Namespace


ReflectionHelper.IsAvailableInTargetFramework Method (MemberInfo)

ReflectionHelperIsAvailableInTargetFramework Method (MemberInfo)

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool IsAvailableInTargetFramework(
    this MemberInfo memberInfo
)

Parameters

memberInfo
Type: System.ReflectionMemberInfo

Return Value

Type: Boolean

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type MemberInfo. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

ReflectionHelper Class
IsAvailableInTargetFramework Overload
PostSharp.Reflection Namespace


ReflectionHelper.IsAvailableInTargetFramework Method (Type)

ReflectionHelperIsAvailableInTargetFramework Method (Type)

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool IsAvailableInTargetFramework(
    this Type type
)

Parameters

type
Type: SystemType

Return Value

Type: Boolean

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Type. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

ReflectionHelper Class
IsAvailableInTargetFramework Overload
PostSharp.Reflection Namespace


ReflectionHelper.IsCompilerGenerated Method

ReflectionHelperIsCompilerGenerated Method

Overload List
Name | Description
IsCompilerGenerated(MemberInfo) | Determines whether a MemberInfo is compiler-generated.
IsCompilerGenerated(Type) | Determines whether a Type is compiler-generated.
Top
See Also

Reference

ReflectionHelper Class
PostSharp.Reflection Namespace


ReflectionHelper.IsCompilerGenerated Method (MemberInfo)

ReflectionHelperIsCompilerGenerated Method (MemberInfo)

Determines whether a MemberInfo is compiler-generated.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool IsCompilerGenerated(
    this MemberInfo member
)

Parameters

member
Type: System.ReflectionMemberInfo
A MemberInfo.

Return Value

Type: Boolean
true if member is compiler-generated, false if it is hand-coded.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type MemberInfo. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

ReflectionHelper Class
IsCompilerGenerated Overload
PostSharp.Reflection Namespace


ReflectionHelper.IsCompilerGenerated Method (Type)

ReflectionHelperIsCompilerGenerated Method (Type)

Determines whether a Type is compiler-generated.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool IsCompilerGenerated(
    this Type type
)

Parameters

type
Type: SystemType
A Type.

Return Value

Type: Boolean
true if type is compiler-generated, false if it is hand-coded.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Type. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference

ReflectionHelper Class
IsCompilerGenerated Overload
PostSharp.Reflection Namespace


ReflectionHelper.ParseAssemblyQualifiedTypeName Method

ReflectionHelperParseAssemblyQualifiedTypeName Method

Parses an escaped assembly-qualified type name into its components.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static void ParseAssemblyQualifiedTypeName(
    string assemblyQualifiedTypeName,
    out string typeName,
    out string assemblyName
)

Parameters

assemblyQualifiedTypeName
Type: SystemString
The escaped assembly-qualified type name.
typeName
Type: SystemString
The type name.
assemblyName
Type: SystemString
The assembly name.
See Also

Reference

ReflectionHelper Class
PostSharp.Reflection Namespace


ReflectionSearch Class

Set of static methods providing broader access to assembly metadata than the System.Reflection namespace. These methods are only available at build time.
Inheritance Hierarchy
SystemObject
PostSharp.ReflectionReflectionSearch

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static class ReflectionSearch

The ReflectionSearch type exposes the following members.

Methods
Name | Description
GetCustomAttributesOfType(Type) | Gets all custom attributes of a given type in the assembly being currently processed.
GetCustomAttributesOfType(Type, ReflectionSearchOptions) | Gets all custom attributes of a given type in the assembly being currently processed and specifies additional options.
GetCustomAttributesOnTarget(Object) | Gets all custom attributes on a given element of code, including those who have been added indirectly, for instance through MulticastAttribute.
GetCustomAttributesOnTarget(Object, ReflectionSearchOptions) | Gets all custom attributes on a given element of code, including those who have been added indirectly, for instance through MulticastAttribute and specifies additional options.
GetCustomAttributesOnTargetT(Object, ReflectionSearchOptions) | Gets all custom attributes of a given type on a given element of code, including those who have been added indirectly, for instance through MulticastAttribute and specifies additional options.
GetDeclarationsUsedByMethod(MethodBase) | Gets all declarations (Type, FieldInfo, MethodInfo or ConstructorInfo) used by the body of a given method or constructor.
GetDeclarationsUsedByMethod(MethodBase, ReflectionSearchOptions) | Gets all declarations (Type, FieldInfo, MethodInfo or ConstructorInfo) used by the body of a given method or constructor and specifies additional options.
GetDerivedTypes(Type) | Gets the set of types derived from a given class or implementing a given interface.
GetDerivedTypes(Type, ReflectionSearchOptions) | Gets the set of types derived from a given class or implementing a given interface. and specifies additional options.
GetMembersOfType(Type) | Gets all members (FieldInfo, PropertyInfo, or ParameterInfo) of the assembly being processed of a given type.
GetMembersOfType(Type, ReflectionSearchOptions) | Gets all members (FieldInfo, PropertyInfo, or ParameterInfo) of the assembly being processed of a given type and specifies additional options.
GetMethodsUsingDeclaration(MemberInfo) | Gets the set of methods and constructors whose body references a given (Type, FieldInfo, MethodInfo or ConstructorInfo).
GetMethodsUsingDeclaration(MemberInfo, ReflectionSearchOptions) | Gets the set of methods and constructors whose body references a given (Type, FieldInfo, MethodInfo or ConstructorInfo) and specifies whether reflection wrappers should be used instead of runtime reflection objects.
HasCustomAttribute | Determines whether a declaration has a custom attribute of a given type, including those who have been added indirectly, for instance through MulticastAttribute.
Top
Remarks

Note Note
This feature is available only at build time.

See Also

Reference

PostSharp.Reflection Namespace

Other Resources

Conceptual: Developing Custom Architectural Constraints
Conceptual: Key Technologies
Conceptual: Limitations of PostSharp Essentials
Conceptual: Validating Aspect Usage
Conceptual: What's New in PostSharp 2.1


ReflectionSearch Methods

The ReflectionSearch type exposes the following members.

Methods
Name | Description
GetCustomAttributesOfType(Type) | Gets all custom attributes of a given type in the assembly being currently processed.
GetCustomAttributesOfType(Type, ReflectionSearchOptions) | Gets all custom attributes of a given type in the assembly being currently processed and specifies additional options.
GetCustomAttributesOnTarget(Object) | Gets all custom attributes on a given element of code, including those who have been added indirectly, for instance through MulticastAttribute.
GetCustomAttributesOnTarget(Object, ReflectionSearchOptions) | Gets all custom attributes on a given element of code, including those who have been added indirectly, for instance through MulticastAttribute and specifies additional options.
GetCustomAttributesOnTargetT(Object, ReflectionSearchOptions) | Gets all custom attributes of a given type on a given element of code, including those who have been added indirectly, for instance through MulticastAttribute and specifies additional options.
GetDeclarationsUsedByMethod(MethodBase) | Gets all declarations (Type, FieldInfo, MethodInfo or ConstructorInfo) used by the body of a given method or constructor.
GetDeclarationsUsedByMethod(MethodBase, ReflectionSearchOptions) | Gets all declarations (Type, FieldInfo, MethodInfo or ConstructorInfo) used by the body of a given method or constructor and specifies additional options.
GetDerivedTypes(Type) | Gets the set of types derived from a given class or implementing a given interface.
GetDerivedTypes(Type, ReflectionSearchOptions) | Gets the set of types derived from a given class or implementing a given interface. and specifies additional options.
GetMembersOfType(Type) | Gets all members (FieldInfo, PropertyInfo, or ParameterInfo) of the assembly being processed of a given type.
GetMembersOfType(Type, ReflectionSearchOptions) | Gets all members (FieldInfo, PropertyInfo, or ParameterInfo) of the assembly being processed of a given type and specifies additional options.
GetMethodsUsingDeclaration(MemberInfo) | Gets the set of methods and constructors whose body references a given (Type, FieldInfo, MethodInfo or ConstructorInfo).
GetMethodsUsingDeclaration(MemberInfo, ReflectionSearchOptions) | Gets the set of methods and constructors whose body references a given (Type, FieldInfo, MethodInfo or ConstructorInfo) and specifies whether reflection wrappers should be used instead of runtime reflection objects.
HasCustomAttribute | Determines whether a declaration has a custom attribute of a given type, including those who have been added indirectly, for instance through MulticastAttribute.
Top
See Also

Reference

ReflectionSearch Class
PostSharp.Reflection Namespace


ReflectionSearch.GetCustomAttributesOfType Method

ReflectionSearchGetCustomAttributesOfType Method

Overload List
Name | Description
GetCustomAttributesOfType(Type) | Gets all custom attributes of a given type in the assembly being currently processed.
GetCustomAttributesOfType(Type, ReflectionSearchOptions) | Gets all custom attributes of a given type in the assembly being currently processed and specifies additional options.
Top
See Also

Reference

ReflectionSearch Class
PostSharp.Reflection Namespace


ReflectionSearch.GetCustomAttributesOfType Method (Type)

ReflectionSearchGetCustomAttributesOfType Method (Type)

Gets all custom attributes of a given type in the assembly being currently processed.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static CustomAttributeInstance[] GetCustomAttributesOfType(
    Type customAttributeType
)

Parameters

customAttributeType
Type: SystemType
Type of the custom attribute.

Return Value

Type: CustomAttributeInstance
The set of all custom attributes of type customAttributeType defined in the assembly being currently processed.
Remarks

Note Note
This method returns custom attributes from the internal annotation repository of PostSharp. This repository contains more than only custom attributes added in source code. For instance, if you use MulticastAttribute to add a custom attribute to several elements of code in a single line of code, this method will return one custom attribute instance for every target of the MulticastAttribute .

Note Note
This feature is available only at build time.

See Also

Reference

ReflectionSearch Class
GetCustomAttributesOfType Overload
PostSharp.Reflection Namespace


ReflectionSearch.GetCustomAttributesOfType Method (Type, ReflectionSearchOptions)

ReflectionSearchGetCustomAttributesOfType Method (Type, ReflectionSearchOptions)

Gets all custom attributes of a given type in the assembly being currently processed and specifies additional options.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static CustomAttributeInstance[] GetCustomAttributesOfType(
    Type customAttributeType,
    ReflectionSearchOptions options
)

Parameters

customAttributeType
Type: SystemType
Type of the custom attribute.
options
Type: PostSharp.ReflectionReflectionSearchOptions
Any combination of options IncludeDerivedTypes and [!:ReflectionSearchOptions.UseReflectionWrappers].

Return Value

Type: CustomAttributeInstance
The set of all custom attributes of type customAttributeType (or any type derived from customAttributeType, if the option IncludeDerivedTypes is true) defined in the assembly being currently processed.
Remarks

Note Note
This method returns custom attributes from the internal annotation repository of PostSharp. This repository contains more than only custom attributes added in source code. For instance, if you use MulticastAttribute to add a custom attribute to several elements of code in a single line of code, this method will return one custom attribute instance for every target of the MulticastAttribute .

Note Note
This feature is available only at build time.

See Also

Reference

ReflectionSearch Class
GetCustomAttributesOfType Overload
PostSharp.Reflection Namespace


ReflectionSearch.GetCustomAttributesOnTarget Method

ReflectionSearchGetCustomAttributesOnTarget Method

Overload List
Name | Description
GetCustomAttributesOnTarget(Object) | Gets all custom attributes on a given element of code, including those who have been added indirectly, for instance through MulticastAttribute.
GetCustomAttributesOnTarget(Object, ReflectionSearchOptions) | Gets all custom attributes on a given element of code, including those who have been added indirectly, for instance through MulticastAttribute and specifies additional options.
GetCustomAttributesOnTargetT(Object, ReflectionSearchOptions) | Gets all custom attributes of a given type on a given element of code, including those who have been added indirectly, for instance through MulticastAttribute and specifies additional options.
Top
See Also

Reference

ReflectionSearch Class
PostSharp.Reflection Namespace


ReflectionSearch.GetCustomAttributesOnTarget Method (Object)

ReflectionSearchGetCustomAttributesOnTarget Method (Object)

Gets all custom attributes on a given element of code, including those who have been added indirectly, for instance through MulticastAttribute.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static CustomAttributeInstance[] GetCustomAttributesOnTarget(
    Object target
)

Parameters

target
Type: SystemObject
Element of code (Type, MethodInfo, ...) whose custom attributes are requested.

Return Value

Type: CustomAttributeInstance
The set of all custom attributes added, directly or indirectly, to target.
Remarks

Note Note
This method returns custom attributes from the internal annotation repository of PostSharp. This repository contains more than only custom attributes added in source code. For instance, if you use MulticastAttribute to add a custom attribute to several elements of code in a single line of code, this method will return one custom attribute instance for every target of the MulticastAttribute .

Note Note
This feature is available only at build time.

See Also

Reference

ReflectionSearch Class
GetCustomAttributesOnTarget Overload
PostSharp.Reflection Namespace


ReflectionSearch.GetCustomAttributesOnTarget Method (Object, ReflectionSearchOptions)

ReflectionSearchGetCustomAttributesOnTarget Method (Object, ReflectionSearchOptions)

Gets all custom attributes on a given element of code, including those who have been added indirectly, for instance through MulticastAttribute and specifies additional options.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static CustomAttributeInstance[] GetCustomAttributesOnTarget(
    Object target,
    ReflectionSearchOptions options
)

Parameters

target
Type: SystemObject
Element of code (Type, MethodInfo, ...) whose custom attributes are requested.
options
Type: PostSharp.ReflectionReflectionSearchOptions
[!:ReflectionSearchOptions.UseReflectionWrappers] or None.

Return Value

Type: CustomAttributeInstance
The set of all custom attributes added, directly or indirectly, to target.
Remarks

Note Note
This method returns custom attributes from the internal annotation repository of PostSharp. This repository contains more than only custom attributes added in source code. For instance, if you use MulticastAttribute to add a custom attribute to several elements of code in a single line of code, this method will return one custom attribute instance for every target of the MulticastAttribute .

Note Note
This feature is available only at build time.

See Also

Reference

ReflectionSearch Class
GetCustomAttributesOnTarget Overload
PostSharp.Reflection Namespace


ReflectionSearch.GetCustomAttributesOnTarget(T) Method (Object, ReflectionSearchOptions)

ReflectionSearchGetCustomAttributesOnTargetT Method (Object, ReflectionSearchOptions)

Gets all custom attributes of a given type on a given element of code, including those who have been added indirectly, for instance through MulticastAttribute and specifies additional options.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static IList<T> GetCustomAttributesOnTarget<T>(
    Object target,
    ReflectionSearchOptions options = ReflectionSearchOptions.IncludeDerivedTypes
)
where T : Attribute

Parameters

target
Type: SystemObject
Element of code (Type, MethodInfo, ...) whose custom attributes are requested.
options (Optional)
Type: PostSharp.ReflectionReflectionSearchOptions
[!:ReflectionSearchOptions.UseReflectionWrappers] or None.

Type Parameters

T
Type of the custom attribute.

Return Value

Type: IList T
The set of all custom attributes added, directly or indirectly, to target.
Remarks

Note Note
This method returns custom attributes from the internal annotation repository of PostSharp. This repository contains more than only custom attributes added in source code. For instance, if you use MulticastAttribute to add a custom attribute to several elements of code in a single line of code, this method will return one custom attribute instance for every target of the MulticastAttribute .

Note Note
This feature is available only at build time.

See Also

Reference

ReflectionSearch Class
GetCustomAttributesOnTarget Overload
PostSharp.Reflection Namespace


ReflectionSearch.GetDeclarationsUsedByMethod Method

ReflectionSearchGetDeclarationsUsedByMethod Method

Overload List
Name | Description
GetDeclarationsUsedByMethod(MethodBase) | Gets all declarations (Type, FieldInfo, MethodInfo or ConstructorInfo) used by the body of a given method or constructor.
GetDeclarationsUsedByMethod(MethodBase, ReflectionSearchOptions) | Gets all declarations (Type, FieldInfo, MethodInfo or ConstructorInfo) used by the body of a given method or constructor and specifies additional options.
Top
See Also

Reference

ReflectionSearch Class
PostSharp.Reflection Namespace


ReflectionSearch.GetDeclarationsUsedByMethod Method (MethodBase)

ReflectionSearchGetDeclarationsUsedByMethod Method (MethodBase)

Gets all declarations (Type, FieldInfo, MethodInfo or ConstructorInfo) used by the body of a given method or constructor.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static MethodUsageCodeReference[] GetDeclarationsUsedByMethod(
    MethodBase method
)

Parameters

method
Type: System.ReflectionMethodBase
A MethodInfo or ConstructorInfo.

Return Value

Type: MethodUsageCodeReference
An array of MethodUsageCodeReference containing one item for each declaration used by the body of method.
Remarks

Note Note
This feature is available only at build time.

See Also

Reference

ReflectionSearch Class
GetDeclarationsUsedByMethod Overload
PostSharp.Reflection Namespace


ReflectionSearch.GetDeclarationsUsedByMethod Method (MethodBase, ReflectionSearchOptions)

ReflectionSearchGetDeclarationsUsedByMethod Method (MethodBase, ReflectionSearchOptions)

Gets all declarations (Type, FieldInfo, MethodInfo or ConstructorInfo) used by the body of a given method or constructor and specifies additional options.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static MethodUsageCodeReference[] GetDeclarationsUsedByMethod(
    MethodBase method,
    ReflectionSearchOptions options
)

Parameters

method
Type: System.ReflectionMethodBase
A MethodInfo or ConstructorInfo.
options
Type: PostSharp.ReflectionReflectionSearchOptions
[!:ReflectionSearchOptions.UseReflectionWrappers] or None.

Return Value

Type: MethodUsageCodeReference
An array of MethodUsageCodeReference containing one item for each declaration used by the body of method.
Remarks

Note Note

Note Note
This feature is available only at build time.

See Also

Reference

ReflectionSearch Class
GetDeclarationsUsedByMethod Overload
PostSharp.Reflection Namespace


ReflectionSearch.GetDerivedTypes Method

ReflectionSearchGetDerivedTypes Method

Overload List
Name | Description
GetDerivedTypes(Type) | Gets the set of types derived from a given class or implementing a given interface.
GetDerivedTypes(Type, ReflectionSearchOptions) | Gets the set of types derived from a given class or implementing a given interface. and specifies additional options.
Top
See Also

Reference

ReflectionSearch Class
PostSharp.Reflection Namespace


ReflectionSearch.GetDerivedTypes Method (Type)

ReflectionSearchGetDerivedTypes Method (Type)

Gets the set of types derived from a given class or implementing a given interface.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static TypeInheritanceCodeReference[] GetDerivedTypes(
    Type baseType
)

Parameters

baseType
Type: SystemType
A class or interface.

Return Value

Type: TypeInheritanceCodeReference
The set of types derived from or implementing baseType.
Remarks

This method returns only types defined in the assembly being currently processed.

Note Note
This feature is available only at build time.

See Also

Reference

ReflectionSearch Class
GetDerivedTypes Overload
PostSharp.Reflection Namespace


ReflectionSearch.GetDerivedTypes Method (Type, ReflectionSearchOptions)

ReflectionSearchGetDerivedTypes Method (Type, ReflectionSearchOptions)

Gets the set of types derived from a given class or implementing a given interface. and specifies additional options.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static TypeInheritanceCodeReference[] GetDerivedTypes(
    Type baseType,
    ReflectionSearchOptions options
)

Parameters

baseType
Type: SystemType
A class or interface.
options
Type: PostSharp.ReflectionReflectionSearchOptions
Any valid combination of the options [!:ReflectionSearchOptions.UseReflectionWrappers], IncludeTypeElement (partial type match), and IncludeDerivedTypes (deep search). IncludeTypeElement and IncludeDerivedTypes cannot be used together.

Return Value

Type: TypeInheritanceCodeReference
The set of types derived from or implementing baseType.
Remarks

This method returns only types defined in the assembly being currently processed.

Note Note

Note Note
This feature is available only at build time.

See Also

Reference

ReflectionSearch Class
GetDerivedTypes Overload
PostSharp.Reflection Namespace


ReflectionSearch.GetMembersOfType Method

ReflectionSearchGetMembersOfType Method

Overload List
Name | Description
GetMembersOfType(Type) | Gets all members (FieldInfo, PropertyInfo, or ParameterInfo) of the assembly being processed of a given type.
GetMembersOfType(Type, ReflectionSearchOptions) | Gets all members (FieldInfo, PropertyInfo, or ParameterInfo) of the assembly being processed of a given type and specifies additional options.
Top
See Also

Reference

ReflectionSearch Class
PostSharp.Reflection Namespace


ReflectionSearch.GetMembersOfType Method (Type)

ReflectionSearchGetMembersOfType Method (Type)

Gets all members (FieldInfo, PropertyInfo, or ParameterInfo) of the assembly being processed of a given type.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static MemberTypeCodeReference[] GetMembersOfType(
    Type memberType
)

Parameters

memberType
Type: SystemType
Member type.

Return Value

Type: MemberTypeCodeReference
The set of all members of type memberType in the assembly being processed
Remarks

Note Note

Note Note
This feature is available only at build time.

See Also

Reference

ReflectionSearch Class
GetMembersOfType Overload
PostSharp.Reflection Namespace


ReflectionSearch.GetMembersOfType Method (Type, ReflectionSearchOptions)

ReflectionSearchGetMembersOfType Method (Type, ReflectionSearchOptions)

Gets all members (FieldInfo, PropertyInfo, or ParameterInfo) of the assembly being processed of a given type and specifies additional options.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static MemberTypeCodeReference[] GetMembersOfType(
    Type memberType,
    ReflectionSearchOptions options
)

Parameters

memberType
Type: SystemType
Member type.
options
Type: PostSharp.ReflectionReflectionSearchOptions
Any combination of the options [!:ReflectionSearchOptions.UseReflectionWrappers] and IncludeTypeElement (partial type match).

Return Value

Type: MemberTypeCodeReference
The set of all members of type memberType in the assembly being processed
Remarks

Note Note

Note Note
This feature is available only at build time.

See Also

Reference

ReflectionSearch Class
GetMembersOfType Overload
PostSharp.Reflection Namespace


ReflectionSearch.GetMethodsUsingDeclaration Method

ReflectionSearchGetMethodsUsingDeclaration Method

Overload List
Name | Description
GetMethodsUsingDeclaration(MemberInfo) | Gets the set of methods and constructors whose body references a given (Type, FieldInfo, MethodInfo or ConstructorInfo).
GetMethodsUsingDeclaration(MemberInfo, ReflectionSearchOptions) | Gets the set of methods and constructors whose body references a given (Type, FieldInfo, MethodInfo or ConstructorInfo) and specifies whether reflection wrappers should be used instead of runtime reflection objects.
Top
See Also

Reference

ReflectionSearch Class
PostSharp.Reflection Namespace


ReflectionSearch.GetMethodsUsingDeclaration Method (MemberInfo)

ReflectionSearchGetMethodsUsingDeclaration Method (MemberInfo)

Gets the set of methods and constructors whose body references a given (Type, FieldInfo, MethodInfo or ConstructorInfo).

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static MethodUsageCodeReference[] GetMethodsUsingDeclaration(
    MemberInfo declaration
)

Parameters

declaration
Type: System.ReflectionMemberInfo
The Type, FieldInfo, MethodInfo or ConstructorInfo whose references are requested.

Return Value

Type: MethodUsageCodeReference
An array of MethodUsageCodeReference containing one item for each method or constructor whose body references declaration.
Remarks

Note Note
This feature is available only at build time.

See Also

Reference

ReflectionSearch Class
GetMethodsUsingDeclaration Overload
PostSharp.Reflection Namespace


ReflectionSearch.GetMethodsUsingDeclaration Method (MemberInfo, ReflectionSearchOptions)

ReflectionSearchGetMethodsUsingDeclaration Method (MemberInfo, ReflectionSearchOptions)

Gets the set of methods and constructors whose body references a given (Type, FieldInfo, MethodInfo or ConstructorInfo) and specifies whether reflection wrappers should be used instead of runtime reflection objects.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static MethodUsageCodeReference[] GetMethodsUsingDeclaration(
    MemberInfo declaration,
    ReflectionSearchOptions options
)

Parameters

declaration
Type: System.ReflectionMemberInfo
The Type, FieldInfo, MethodInfo or ConstructorInfo whose references are requested.
options
Type: PostSharp.ReflectionReflectionSearchOptions
Any combination of the options [!:ReflectionSearchOptions.UseReflectionWrappers] and IncludeTypeElement (partial type match).

Return Value

Type: MethodUsageCodeReference
An array of MethodUsageCodeReference containing one item for each method or constructor whose body references declaration.
Remarks

Note Note

Note Note
This feature is available only at build time.

See Also

Reference

ReflectionSearch Class
GetMethodsUsingDeclaration Overload
PostSharp.Reflection Namespace


ReflectionSearch.HasCustomAttribute Method

ReflectionSearchHasCustomAttribute Method

Determines whether a declaration has a custom attribute of a given type, including those who have been added indirectly, for instance through MulticastAttribute.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool HasCustomAttribute(
    Object target,
    Type type,
    bool inherit = false
)

Parameters

target
Type: SystemObject
Element of code (Type, MethodInfo, ...) whose custom attributes are requested.
type
Type: SystemType
The type of custom attributes.
inherit (Optional)
Type: SystemBoolean
true to consider custom attributes derived from type, false to consider only custom attributes strictly of type type.

Return Value

Type: Boolean
True if type has a custom attribute of type type, otherwise false.
See Also

Reference

ReflectionSearch Class
PostSharp.Reflection Namespace


ReflectionSearchOptions Enumeration

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[FlagsAttribute]
public enum ReflectionSearchOptions
Members
Member name | Value | Description
None | 0 | No option.
IncludeDerivedTypes | 1 | Include relationships referencing a derived type (instead of exactly that type).
IncludeTypeElement | 2 | Include relationships referencing a type signature including the given type (instead of only the given type).
Remarks
See Also

Reference

PostSharp.Reflection Namespace


ReflectionTypeComparer Class

Comparer of reflection types (Type) based on content, not reference. Supports the unbound generic parameters derived from the [!:GenericArg] class.
Inheritance Hierarchy
SystemObject
PostSharp.ReflectionReflectionTypeComparer

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ReflectionTypeComparer : IEqualityComparer<Type>,
    IEqualityComparer<Type[]>
Methods
 | Name | Description
Public method | Equals(Type, Type) | Determines whether the specified objects are equal.
Public method | Equals(Type, Type) | Determines whether the specified objects are equal.
Public method | GetHashCode(Type) | Returns a hash code for the specified object.
Public method | GetHashCode(Type) | Returns a hash code for the specified object.
 | GetInstance | Gets an instance of ReflectionTypeComparer that does not perform substitution of generic parameters.
 | GetInstance(Type, Type, Type, Type) | Gets an instance of ReflectionTypeComparer that performs substitution of generic parameters.
Top
See Also

Reference

PostSharp.Reflection Namespace


ReflectionTypeComparer Methods

Methods
 | Name | Description
Public method | Equals(Type, Type) | Determines whether the specified objects are equal.
Public method | Equals(Type, Type) | Determines whether the specified objects are equal.
Public method | GetHashCode(Type) | Returns a hash code for the specified object.
Public method | GetHashCode(Type) | Returns a hash code for the specified object.
 | GetInstance | Gets an instance of ReflectionTypeComparer that does not perform substitution of generic parameters.
 | GetInstance(Type, Type, Type, Type) | Gets an instance of ReflectionTypeComparer that performs substitution of generic parameters.
Top
See Also

Reference

ReflectionTypeComparer Class
PostSharp.Reflection Namespace


ReflectionTypeComparer.Equals Method

ReflectionTypeComparerEquals Method

Overload List
 | Name | Description
Public method | Equals(Type, Type) | Determines whether the specified objects are equal.
Public method | Equals(Type, Type) | Determines whether the specified objects are equal.
Top
See Also

Reference

ReflectionTypeComparer Class
PostSharp.Reflection Namespace


ReflectionTypeComparer.Equals Method (Type, Type)

ReflectionTypeComparerEquals Method (Type, Type)

Determines whether the specified objects are equal.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Equals(
    Type x,
    Type y
)

Parameters

x
Type: SystemType
The first object of type T to compare.
y
Type: SystemType
The second object of type T to compare.

Return Value

Type: Boolean
true if the specified objects are equal; otherwise, false.

Implements

IEqualityComparerTEquals(T, T)
See Also

Reference

ReflectionTypeComparer Class
Equals Overload
PostSharp.Reflection Namespace


ReflectionTypeComparer.Equals Method (Type[], Type[])

ReflectionTypeComparerEquals Method (Type, Type)

Determines whether the specified objects are equal.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Equals(
    Type[] x,
    Type[] y
)

Parameters

x
Type: SystemType
The first object of type T to compare.
y
Type: SystemType
The second object of type T to compare.

Return Value

Type: Boolean
true if the specified objects are equal; otherwise, false.

Implements

IEqualityComparerTEquals(T, T)
See Also

Reference

ReflectionTypeComparer Class
Equals Overload
PostSharp.Reflection Namespace


ReflectionTypeComparer.GetHashCode Method

ReflectionTypeComparerGetHashCode Method

Overload List
 | Name | Description
Public method | GetHashCode(Type) | Returns a hash code for the specified object.
Public method | GetHashCode(Type) | Returns a hash code for the specified object.
Top
See Also

Reference

ReflectionTypeComparer Class
PostSharp.Reflection Namespace


ReflectionTypeComparer.GetHashCode Method (Type)

ReflectionTypeComparerGetHashCode Method (Type)

Returns a hash code for the specified object.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int GetHashCode(
    Type obj
)

Parameters

obj
Type: SystemType
The Object for which a hash code is to be returned.

Return Value

Type: Int32
A hash code for the specified object.

Implements

IEqualityComparerTGetHashCode(T)
Exceptions
Exception | Condition
ArgumentNullException | The type of obj is a reference type and obj is null.
See Also

Reference

ReflectionTypeComparer Class
GetHashCode Overload
PostSharp.Reflection Namespace


ReflectionTypeComparer.GetHashCode Method (Type[])

ReflectionTypeComparerGetHashCode Method (Type)

Returns a hash code for the specified object.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int GetHashCode(
    Type[] types
)

Parameters

types
Type: SystemType

Return Value

Type: Int32
A hash code for the specified object.

Implements

IEqualityComparerTGetHashCode(T)
Exceptions
Exception | Condition
ArgumentNullException | The type of obj is a reference type and obj is null.
See Also

Reference

ReflectionTypeComparer Class
GetHashCode Overload
PostSharp.Reflection Namespace


ReflectionTypeComparer.GetInstance Method

ReflectionTypeComparerGetInstance Method

Overload List
Name | Description
GetInstance | Gets an instance of ReflectionTypeComparer that does not perform substitution of generic parameters.
GetInstance(Type, Type, Type, Type) | Gets an instance of ReflectionTypeComparer that performs substitution of generic parameters.
Top
See Also

Reference

ReflectionTypeComparer Class
PostSharp.Reflection Namespace


ReflectionTypeComparer.GetInstance Method

ReflectionTypeComparerGetInstance Method

Gets an instance of ReflectionTypeComparer that does not perform substitution of generic parameters.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static ReflectionTypeComparer GetInstance()

Return Value

Type: ReflectionTypeComparer
An instance of ReflectionTypeComparer.
See Also

Reference

ReflectionTypeComparer Class
GetInstance Overload
PostSharp.Reflection Namespace


ReflectionTypeComparer.GetInstance Method (Type[], Type[], Type[], Type[])

ReflectionTypeComparerGetInstance Method (Type, Type, Type, Type)

Gets an instance of ReflectionTypeComparer that performs substitution of generic parameters.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static ReflectionTypeComparer GetInstance(
    Type[] leftGenericTypeParameters,
    Type[] leftGenericMethodParameters,
    Type[] rightGenericTypeParameters,
    Type[] rightGenericMethodParameters
)

Parameters

leftGenericTypeParameters
Type: SystemType
Array of types to be substituted to the generic type parameters of the left member.
leftGenericMethodParameters
Type: SystemType
Array of types to be substituted to the generic method parameters of the left member.
rightGenericTypeParameters
Type: SystemType
Array of types to be substituted to the generic type parameters of the right member.
rightGenericMethodParameters
Type: SystemType
Array of types to be substituted to the generic method parameters of the right member.

Return Value

Type: ReflectionTypeComparer
An instance of ReflectionTypeComparer.
See Also

Reference

ReflectionTypeComparer Class
GetInstance Overload
PostSharp.Reflection Namespace


SemanticInfo Structure

Provides information about the semantic of a declaration in the source programming language. For instance an MSIL method can be in C# a property getter, an operator, an anonymous method, and so on.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public struct SemanticInfo

The SemanticInfo type exposes the following members.

Properties
 | Name | Description
Public property | DisplayName | Gets a human-readable description of the Semantic property.
Public property | IsCompilerGenerated | Determines whether the declaration is compiler-generated.
Public property | IsSelectable | Determines whether the declaration can be safely selected in a pointcut using the standard System.Reflection API.
Public property | Semantic | Gets the semantic of the MSIL method in the source language.
Top
See Also

Reference

PostSharp.Reflection Namespace


SemanticInfo Properties

The SemanticInfo type exposes the following members.

Properties
 | Name | Description
Public property | DisplayName | Gets a human-readable description of the Semantic property.
Public property | IsCompilerGenerated | Determines whether the declaration is compiler-generated.
Public property | IsSelectable | Determines whether the declaration can be safely selected in a pointcut using the standard System.Reflection API.
Public property | Semantic | Gets the semantic of the MSIL method in the source language.
Top
See Also

Reference

SemanticInfo Structure
PostSharp.Reflection Namespace


SemanticInfo.DisplayName Property

SemanticInfoDisplayName Property

Gets a human-readable description of the Semantic property.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string DisplayName { get; }

Property Value

Type: String
See Also

Reference

SemanticInfo Structure
PostSharp.Reflection Namespace


SemanticInfo.IsCompilerGenerated Property

SemanticInfoIsCompilerGenerated Property

Determines whether the declaration is compiler-generated.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsCompilerGenerated { get; }

Property Value

Type: Boolean
See Also

Reference

SemanticInfo Structure
PostSharp.Reflection Namespace


SemanticInfo.IsSelectable Property

SemanticInfoIsSelectable Property

Determines whether the declaration can be safely selected in a pointcut using the standard System.Reflection API.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsSelectable { get; }

Property Value

Type: Boolean
Remarks
This property is false for declarations such as anonymous methods or local functions because their MSIL implementation can move from one type to another because of a mere change of the method body in C#. It is also false for implementation details such as anonymous method cache fields, or closure types, which should never be advised.
See Also

Reference

SemanticInfo Structure
PostSharp.Reflection Namespace


SemanticInfo.Semantic Property

SemanticInfoSemantic Property

Gets the semantic of the MSIL method in the source language.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Semantics Semantic { get; }

Property Value

Type: Semantics
See Also

Reference

SemanticInfo Structure
PostSharp.Reflection Namespace


Semantics Enumeration

Enumerates the possible semantics of a declaration in the source programming language. For instance an MSIL method can be in C# a property getter, an operator, an anonymous method, and so on.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[FlagsAttribute]
public enum Semantics
Members
Member name | Value | Description
InstanceConstructor | 1 | Explicitly-defined instance constructor.
StaticConstructor | 2 | Static constructor.
DefaultConstructor | 4194304 | Default instance constructor (compiler-implemented).
Event | 1 | Normal event.
OtherCompilerGeneratedEvent | 2 | Any compiler-generated event that does not have another semantic in the current enumeration.
EventAdder | 4 | Event adder.
EventRemover | 8 | Event remover.
EventRaiser | 65536 | Event raiser (does not exist in C#).
AnyEventAccessor | 65548 | Event adder, remover, or raiser.
PropertyGetter | 16 | Property getter.
PropertySetter | 32 | Property setter.
AnyPropertyAccessor | 48 | Property getter or setter.
Operator | 64 | Operator (unary, binary, implicit, or explicit).
AnonymousMethod | 128 | Anonymous method.
LocalFunction | 256 | Local function.
Method | 512 | Normal method.
OtherCompilerGeneratedMethod | 1048576 | Any compiler-generated method that does not have another semantic in the current enumeration.
Finalizer | 8192 | Finalizer.
OtherSpecialMethod | 131072 | Any special method (with either the SpecialName or RTSpecialName set) that does not have a semantic in the current enumeration.
OtherCompilerGeneratedField | 2097152 | Any compiler-generated field that does not have another semantic in the current enumeration.
Field | 1024 | Normal field.
PropertyBackingField | 262144 | Field backing an automatic property.
EventBackingField | 524288 | Field backing an automatic event.
AnonymousMethodCacheField | 2048 | Compiler-generated field used as a cache for anonymous methods.
Property | 4096 | Normal property.
OtherCompilerGeneratedProperty | -2147483648 | Any compiler-generated property that does not have another semantic in the current enumeration.
Type | 8388608 | Normal type.
ComClass | 16384 | VB COM Class.
CompilerGeneratedTypeMember | 32768 | Any member of a compiler-generated type.
CompilerGeneratedMethodParameter | 16777216 | Any parameter of a compiler-generated method.
Parameter | 33554432 | Parameter.
OtherDeclaration | 67108864 | Any declaration not represented in this enumeration.
CodeContractsField | 134217728 | Field supporting Code Contracts.
AsyncStateMachineType | 268435456 | Type implementing an async state machine.
IteratorStateMachineType | 536870912 | Type implementing an iterator state machine.
OtherCompilerGeneratedType | 1073741824 | Any compiler-generated type that does not have another semantic in the current enumeration.
See Also

Reference

PostSharp.Reflection Namespace


StateMachineKind Enumeration

Enumeration of kinds of state machines.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum StateMachineKind
Members
Member name | Value | Description
None | 0 | The method is not implemented by a state machine.
Iterator | 1 | Iterator method.
Async | 2 | Async method.
See Also

Reference

PostSharp.Reflection Namespace
ReflectionExtensionsGetStateMachineKind(MethodInfo)


SymbolSequencePoint Class

Maps a point in IL instructions to location in source code.
Inheritance Hierarchy
SystemObject
PostSharp.ReflectionSymbolSequencePoint

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class SymbolSequencePoint : IComparable<SymbolSequencePoint>,
    IEquatable<SymbolSequencePoint>

The SymbolSequencePoint type exposes the following members.

Properties
 | Name | Description
Public property | EndColumn | Gets the end column in the source file.
Public property | EndLine | Gets the end line in the source file.
Public property | IsHidden | Determines whether the current symbol means that the associated instructions have no source code.
Public property | IsSpecial | Determines whether the current symbol is a special, non-standard, defined by PostSharp and supported by PostSharp Tools for Visual Studio.
Public property | SourceDocument | Document (file of source code) containing the current sequence point.
Public property | StartColumn | Gets the start column in the source file.
Public property | StartLine | Gets the start line in the source file.
Top
Methods
 | Name | Description
Public method | Equals(Object) | Determines whether the specified object is equal to the current object. (Overrides ObjectEquals(Object).)
Public method | Equals(SymbolSequencePoint) | Indicates whether the current object is equal to another object of the same type.
Public method | GetHashCode | Serves as the default hash function. (Overrides ObjectGetHashCode.)
Public method | ToString | Returns a string that represents the current object. (Overrides ObjectToString.)
Top
Operators
Name | Description
Equality | Determines whether two sequence points are equal.
Inequality | Determines whether two sequence points are different.
Top
Fields
Name | Description
Hidden | Gets a symbol meaning that the associated instructions have no source code.
Top
Remarks
This class implements the IComparableT interface. This allows sorting sequence points according to their IL offsets and performing binary searches in sorted arrays.
See Also

Reference

PostSharp.Reflection Namespace


SymbolSequencePoint Properties

The SymbolSequencePoint type exposes the following members.

Properties
 | Name | Description
Public property | EndColumn | Gets the end column in the source file.
Public property | EndLine | Gets the end line in the source file.
Public property | IsHidden | Determines whether the current symbol means that the associated instructions have no source code.
Public property | IsSpecial | Determines whether the current symbol is a special, non-standard, defined by PostSharp and supported by PostSharp Tools for Visual Studio.
Public property | SourceDocument | Document (file of source code) containing the current sequence point.
Public property | StartColumn | Gets the start column in the source file.
Public property | StartLine | Gets the start line in the source file.
Top
See Also

Reference

SymbolSequencePoint Class
PostSharp.Reflection Namespace


SymbolSequencePoint.EndColumn Property

SymbolSequencePointEndColumn Property

Gets the end column in the source file.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int EndColumn { get; }

Property Value

Type: Int32
See Also

Reference

SymbolSequencePoint Class
PostSharp.Reflection Namespace


SymbolSequencePoint.EndLine Property

SymbolSequencePointEndLine Property

Gets the end line in the source file.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int EndLine { get; }

Property Value

Type: Int32
See Also

Reference

SymbolSequencePoint Class
PostSharp.Reflection Namespace


SymbolSequencePoint.IsHidden Property

SymbolSequencePointIsHidden Property

Determines whether the current symbol means that the associated instructions have no source code.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsHidden { get; }

Property Value

Type: Boolean
See Also

Reference

SymbolSequencePoint Class
PostSharp.Reflection Namespace


SymbolSequencePoint.IsSpecial Property

SymbolSequencePointIsSpecial Property

Determines whether the current symbol is a special, non-standard, defined by PostSharp and supported by PostSharp Tools for Visual Studio.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsSpecial { get; }

Property Value

Type: Boolean
See Also

Reference

SymbolSequencePoint Class
PostSharp.Reflection Namespace


SymbolSequencePoint.SourceDocument Property

SymbolSequencePointSourceDocument Property

Document (file of source code) containing the current sequence point.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ISourceDocument SourceDocument { get; }

Property Value

Type: ISourceDocument
See Also

Reference

SymbolSequencePoint Class
PostSharp.Reflection Namespace


SymbolSequencePoint.StartColumn Property

SymbolSequencePointStartColumn Property

Gets the start column in the source file.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int StartColumn { get; }

Property Value

Type: Int32
See Also

Reference

SymbolSequencePoint Class
PostSharp.Reflection Namespace


SymbolSequencePoint.StartLine Property

SymbolSequencePointStartLine Property

Gets the start line in the source file.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public int StartLine { get; }

Property Value

Type: Int32
See Also

Reference

SymbolSequencePoint Class
PostSharp.Reflection Namespace


SymbolSequencePoint Methods

The SymbolSequencePoint type exposes the following members.

Methods
 | Name | Description
Public method | Equals(Object) | Determines whether the specified object is equal to the current object. (Overrides ObjectEquals(Object).)
Public method | Equals(SymbolSequencePoint) | Indicates whether the current object is equal to another object of the same type.
Public method | GetHashCode | Serves as the default hash function. (Overrides ObjectGetHashCode.)
Public method | ToString | Returns a string that represents the current object. (Overrides ObjectToString.)
Top
See Also

Reference

SymbolSequencePoint Class
PostSharp.Reflection Namespace


SymbolSequencePoint.Equals Method

SymbolSequencePointEquals Method

Overload List
 | Name | Description
Public method | Equals(Object) | Determines whether the specified object is equal to the current object. (Overrides ObjectEquals(Object).)
Public method | Equals(SymbolSequencePoint) | Indicates whether the current object is equal to another object of the same type.
Top
See Also

Reference

SymbolSequencePoint Class
PostSharp.Reflection Namespace


SymbolSequencePoint.Equals Method (Object)

SymbolSequencePointEquals Method (Object)

Determines whether the specified object is equal to the current object.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool Equals(
    Object obj
)

Parameters

obj
Type: SystemObject
The object to compare with the current object.

Return Value

Type: Boolean
true if the specified object is equal to the current object; otherwise, false.
See Also

Reference

SymbolSequencePoint Class
Equals Overload
PostSharp.Reflection Namespace


SymbolSequencePoint.Equals Method (SymbolSequencePoint)

SymbolSequencePointEquals Method (SymbolSequencePoint)

Indicates whether the current object is equal to another object of the same type.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Equals(
    SymbolSequencePoint other
)

Parameters

other
Type: PostSharp.ReflectionSymbolSequencePoint
An object to compare with this object.

Return Value

Type: Boolean
true if the current object is equal to the other parameter; otherwise, false.

Implements

IEquatableTEquals(T)
See Also

Reference

SymbolSequencePoint Class
Equals Overload
PostSharp.Reflection Namespace


SymbolSequencePoint.GetHashCode Method

SymbolSequencePointGetHashCode Method

Serves as the default hash function.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override int GetHashCode()

Return Value

Type: Int32
A hash code for the current object.
See Also

Reference

SymbolSequencePoint Class
PostSharp.Reflection Namespace


SymbolSequencePoint.ToString Method

SymbolSequencePointToString Method

Returns a string that represents the current object.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override string ToString()

Return Value

Type: String
A string that represents the current object.
See Also

Reference

SymbolSequencePoint Class
PostSharp.Reflection Namespace


SymbolSequencePoint Operators

The SymbolSequencePoint type exposes the following members.

Operators
Name | Description
Equality | Determines whether two sequence points are equal.
Inequality | Determines whether two sequence points are different.
Top
See Also

Reference

SymbolSequencePoint Class
PostSharp.Reflection Namespace


SymbolSequencePoint.Equality Operator

SymbolSequencePointEquality Operator

Determines whether two sequence points are equal.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool operator ==(
    SymbolSequencePoint left,
    SymbolSequencePoint right
)

Parameters

left
Type: PostSharp.ReflectionSymbolSequencePoint
A SymbolSequencePoint.
right
Type: PostSharp.ReflectionSymbolSequencePoint
A SymbolSequencePoint.

Return Value

Type: Boolean
true if both sequence points are equal, otherwise false.
See Also

Reference

SymbolSequencePoint Class
PostSharp.Reflection Namespace


SymbolSequencePoint.Inequality Operator

SymbolSequencePointInequality Operator

Determines whether two sequence points are different.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static bool operator !=(
    SymbolSequencePoint left,
    SymbolSequencePoint right
)

Parameters

left
Type: PostSharp.ReflectionSymbolSequencePoint
A SymbolSequencePoint.
right
Type: PostSharp.ReflectionSymbolSequencePoint
A SymbolSequencePoint.

Return Value

Type: Boolean
true if both sequence points are different, otherwise false.
See Also

Reference

SymbolSequencePoint Class
PostSharp.Reflection Namespace


SymbolSequencePoint Fields

The SymbolSequencePoint type exposes the following members.

Fields
Name | Description
Hidden | Gets a symbol meaning that the associated instructions have no source code.
Top
See Also

Reference

SymbolSequencePoint Class
PostSharp.Reflection Namespace


SymbolSequencePoint.Hidden Field

SymbolSequencePointHidden Field

Gets a symbol meaning that the associated instructions have no source code.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static readonly SymbolSequencePoint Hidden

Field Value

Type: SymbolSequencePoint
See Also

Reference

SymbolSequencePoint Class
PostSharp.Reflection Namespace


TypeInheritanceCodeReference Class

Represents a inheritance relationship between two types.
Inheritance Hierarchy
SystemObject
PostSharp.ReflectionTypeInheritanceCodeReference

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class TypeInheritanceCodeReference : ICodeReference

The TypeInheritanceCodeReference type exposes the following members.

Properties
 | Name | Description
Public property | BaseType | Gets the base type. If the base type is a generic type, this property contains a generic type instance.
Public property | DerivedType | Gets the derived type.
Top
See Also

Reference

PostSharp.Reflection Namespace


TypeInheritanceCodeReference Properties

The TypeInheritanceCodeReference type exposes the following members.

Properties
 | Name | Description
Public property | BaseType | Gets the base type. If the base type is a generic type, this property contains a generic type instance.
Public property | DerivedType | Gets the derived type.
Top
See Also

Reference

TypeInheritanceCodeReference Class
PostSharp.Reflection Namespace


TypeInheritanceCodeReference.BaseType Property

TypeInheritanceCodeReferenceBaseType Property

Gets the base type. If the base type is a generic type, this property contains a generic type instance.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Type BaseType { get; }

Property Value

Type: Type
See Also

Reference

TypeInheritanceCodeReference Class
PostSharp.Reflection Namespace


TypeInheritanceCodeReference.DerivedType Property

TypeInheritanceCodeReferenceDerivedType Property

Gets the derived type.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Type DerivedType { get; }

Property Value

Type: Type
See Also

Reference

TypeInheritanceCodeReference Class
PostSharp.Reflection Namespace


Visibility Enumeration

Visibility of types and type members.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum Visibility
Members
Member name | Value | Description
Public | 0 | Public.
Family | 1 | Family (protected).
Assembly | 2 | Assembly (internal).
FamilyOrAssembly | 3 | Family or assembly (protected internal).
FamilyAndAssembly | 4 | Family and assembly (no C# equivalent: protected types inside the current assembly).
Private | 5 | Private.
See Also

Reference

PostSharp.Reflection Namespace


PostSharp.Reflection.MethodBody Namespace

Classes
 | Class | Description
Public class | MethodBodyFormatter | Formats an IMethodBodyElement to a textual representation, for debugging purposes.
Public class | MethodBodyVisitor | Abstract implementation of a visitor of method bodies (IMethodBody and IExpression).
Structures
 | Structure | Description
Public structure | LocalVariableAssignment | Represents the assignment of a local variable to an expression.
Interfaces
 | Interface | Description
Public interface | IAddressOfExpression | Expression that takes the address of the operand. Equivalent to the C# operator &.
Public interface | IBinaryExpression | Expression that has two operands, Left and Right.
Public interface | IBlockExpression | Block containing other blocks or instructions.
Public interface | IConditionalExpression | Conditional expression, corresponding to the if keyword in C#.
Public interface | IConstantExpression | Expression representing a build-time constant.
Public interface | ICopyBufferExpression | Expression equivalent to the [!:OpCodes.Cpblk] instruction.
Public interface | IExceptionHandler | Represents an exception handler (either catch, finally or filter) attached to a block.
Public interface | IExpression | Represents an expression or an instruction.
Public interface | IFieldExpression | Expression that represents a field.
Public interface | IGotoExpression | Unconditional branching instruction.
Public interface | IInitBufferExpression | Expression equivalent to the [!:OpCodes.Initblk] instruction.
Public interface | ILocalVariable | Expression that represents a local variable.
Public interface | ILocalVariableExpression | Expression that represents a local variable.
Public interface | IMetadataExpression | Expression that depends on a metadata declaration. This expression is used when compiling the typeof, sizeof or default keywords of C#, among others.
Public interface | IMethodBody | Represents the body of a method.
Public interface | IMethodBodyElement | Represents an element of the syntax tree representing a method body.
Public interface | IMethodBodyService | Service that exposes the method GetMethodBody(MethodBase, MethodBodyAbstractionLevel), which allows to decompile a method and get a AST representation.
Public interface | IMethodCallExpression | Expression representing a method call.
Public interface | IMethodPointerExpression | Expression that represents a C-like pointer to a method.
Public interface | INewArrayExpression | Expression that returns a new array.
Public interface | INewObjectExpression | Expression that creates a new object by invoking a constructor.
Public interface | IParameterExpression | Expression that represents a method parameter.
Public interface | ISequenceExpression | Sequence of instructions.
Public interface | IStatementExpression | Represents a statement. A statement is the root of an expression tree.
Public interface | ISwitchExpression | Expression that represent a switch (conditional statement with multiple branches).
Public interface | IUnaryExpression | Represents an expression with a single operand.
Public interface | IValueOfExpression | Expression that returns the value stored at an address. Equivalent to the C# keyword *.
Public interface | IZeroaryExpression | Expression with no operand.
Enumerations
 | Enumeration | Description
Public enumeration | AddressAlignment | Enumeration of address alignments for access to unmanaged memory represented by ICopyBufferExpression, IFieldExpression or IValueOfExpression.
Public enumeration | ExceptionHandlerKind | Kinds of IExceptionHandler.
Public enumeration | MethodBodyAbstractionLevel | Enumerates the level of abstraction and the level of details produced by the AST decompiler.
Public enumeration | MethodBodyElementKind | Enumeration of kinds of syntax elements (IMethodBodyElement).


AddressAlignment Enumeration

Enumeration of address alignments for access to unmanaged memory represented by ICopyBufferExpression, IFieldExpression or IValueOfExpression.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum AddressAlignment
Members
Member name | Value | Description
Default | 0 | Default alignment (machine word).
Unaligned1 | 1 | 1-byte alignment.
Unaligned2 | 2 | 2-byte alignment.
Unaligned4 | 3 | 4-byte alignment.
See Also

Reference

PostSharp.Reflection.MethodBody Namespace


ExceptionHandlerKind Enumeration

Kinds of IExceptionHandler.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum ExceptionHandlerKind
Members
Member name | Value | Description
None | 0 | Not an exception handler.
Catch | 1 | Catch without filter.
Filter | 2 | Filter with catch block.
Finally | 3 | Finally.
See Also

Reference

PostSharp.Reflection.MethodBody Namespace


IAddressOfExpression Interface

Expression that takes the address of the operand. Equivalent to the C# operator &.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IAddressOfExpression : IUnaryExpression,
    IExpression, IMethodBodyElement

The IAddressOfExpression type exposes the following members.

Properties
 | Name | Description
Public property | IsReadOnly | Determines whether the returned pointer is a read-only pointer.
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Public property | Value | Operand of the unary expression. (Inherited from IUnaryExpression.)
Top
See Also

Reference

PostSharp.Reflection.MethodBody Namespace


IAddressOfExpression Properties

The IAddressOfExpression type exposes the following members.

Properties
 | Name | Description
Public property | IsReadOnly | Determines whether the returned pointer is a read-only pointer.
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Public property | Value | Operand of the unary expression. (Inherited from IUnaryExpression.)
Top
See Also

Reference

IAddressOfExpression Interface
PostSharp.Reflection.MethodBody Namespace


IAddressOfExpression.IsReadOnly Property

IAddressOfExpressionIsReadOnly Property

Determines whether the returned pointer is a read-only pointer.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
bool IsReadOnly { get; }

Property Value

Type: Boolean
See Also

Reference

IAddressOfExpression Interface
PostSharp.Reflection.MethodBody Namespace


IBinaryExpression Interface

Expression that has two operands, Left and Right.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IBinaryExpression : IExpression,
    IMethodBodyElement

The IBinaryExpression type exposes the following members.

Properties
 | Name | Description
Public property | Left | Gets the left operand.
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Public property | Right | Gets the right operand.
Top
See Also

Reference

PostSharp.Reflection.MethodBody Namespace


IBinaryExpression Properties

The IBinaryExpression type exposes the following members.

Properties
 | Name | Description
Public property | Left | Gets the left operand.
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Public property | Right | Gets the right operand.
Top
See Also

Reference

IBinaryExpression Interface
PostSharp.Reflection.MethodBody Namespace


IBinaryExpression.Left Property

IBinaryExpressionLeft Property

Gets the left operand.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IExpression Left { get; }

Property Value

Type: IExpression
See Also

Reference

IBinaryExpression Interface
PostSharp.Reflection.MethodBody Namespace


IBinaryExpression.Right Property

IBinaryExpressionRight Property

Gets the right operand.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IExpression Right { get; }

Property Value

Type: IExpression
See Also

Reference

IBinaryExpression Interface
PostSharp.Reflection.MethodBody Namespace


IBlockExpression Interface

Block containing other blocks or instructions.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IBlockExpression : IExpression,
    IMethodBodyElement

The IBlockExpression type exposes the following members.

Properties
 | Name | Description
Public property | ExceptionHandlerKind |
Public property | ExceptionHandlers | Gets the collection of exception handlers that protect the block, in which the current block is in the try role.
Public property | Items | Gets the collection of items in the block.
Public property | Label | Gets a string that uniquely identifies the block (inside the current method body) as a possible branching target.
Public property | LocalVariables | Gets the collection of local variables defined for the current block.
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentExceptionHandler | Gets the parent exception handler in the current block is in the Catch, Filter or Finally role.
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Top
Remarks

A block typically contains other blocks or instructions. Blocks that contain instructions also implement the ISequenceExpression interface.

See Also

Reference

PostSharp.Reflection.MethodBody Namespace

Other Resources

Conceptual: Breaking Changes in PostSharp 6.0


IBlockExpression Properties

The IBlockExpression type exposes the following members.

Properties
 | Name | Description
Public property | ExceptionHandlerKind |
Public property | ExceptionHandlers | Gets the collection of exception handlers that protect the block, in which the current block is in the try role.
Public property | Items | Gets the collection of items in the block.
Public property | Label | Gets a string that uniquely identifies the block (inside the current method body) as a possible branching target.
Public property | LocalVariables | Gets the collection of local variables defined for the current block.
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentExceptionHandler | Gets the parent exception handler in the current block is in the Catch, Filter or Finally role.
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Top
See Also

Reference

IBlockExpression Interface
PostSharp.Reflection.MethodBody Namespace


IBlockExpression.ExceptionHandlerKind Property

IBlockExpressionExceptionHandlerKind Property

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
ExceptionHandlerKind ExceptionHandlerKind { get; }

Property Value

Type: ExceptionHandlerKind
See Also

Reference

IBlockExpression Interface
PostSharp.Reflection.MethodBody Namespace


IBlockExpression.ExceptionHandlers Property

IBlockExpressionExceptionHandlers Property

Gets the collection of exception handlers that protect the block, in which the current block is in the try role.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IReadOnlyLinkedList<IExceptionHandler> ExceptionHandlers { get; }

Property Value

Type: IReadOnlyLinkedList IExceptionHandler
See Also

Reference

IBlockExpression Interface
PostSharp.Reflection.MethodBody Namespace


IBlockExpression.Items Property

IBlockExpressionItems Property

Gets the collection of items in the block.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IReadOnlyLinkedList<IExpression> Items { get; }

Property Value

Type: IReadOnlyLinkedList IExpression
See Also

Reference

IBlockExpression Interface
PostSharp.Reflection.MethodBody Namespace


IBlockExpression.Label Property

IBlockExpressionLabel Property

Gets a string that uniquely identifies the block (inside the current method body) as a possible branching target.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
string Label { get; }

Property Value

Type: String
See Also

Reference

IBlockExpression Interface
PostSharp.Reflection.MethodBody Namespace


IBlockExpression.LocalVariables Property

IBlockExpressionLocalVariables Property

Gets the collection of local variables defined for the current block.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IList<ILocalVariable> LocalVariables { get; }

Property Value

Type: IList ILocalVariable
See Also

Reference

IBlockExpression Interface
PostSharp.Reflection.MethodBody Namespace


IBlockExpression.ParentExceptionHandler Property

IBlockExpressionParentExceptionHandler Property

Gets the parent exception handler in the current block is in the Catch, Filter or Finally role.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IExceptionHandler ParentExceptionHandler { get; }

Property Value

Type: IExceptionHandler
See Also

Reference

IBlockExpression Interface
PostSharp.Reflection.MethodBody Namespace


IConditionalExpression Interface

Conditional expression, corresponding to the if keyword in C#.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IConditionalExpression : IExpression,
    IMethodBodyElement

The IConditionalExpression type exposes the following members.

Properties
 | Name | Description
Public property | Condition | Gets the condition expression (the return type does not need to be bool. Zero and null values are considered false).
Public property | IfFalse | Gets the expression executed when Condition evaluates to false, zero, or null.
Public property | IfTrue | Gets the expression executed when Condition evaluates to true or a non-null and non-zero vale.
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Top
See Also

Reference

PostSharp.Reflection.MethodBody Namespace


IConditionalExpression Properties

The IConditionalExpression type exposes the following members.

Properties
 | Name | Description
Public property | Condition | Gets the condition expression (the return type does not need to be bool. Zero and null values are considered false).
Public property | IfFalse | Gets the expression executed when Condition evaluates to false, zero, or null.
Public property | IfTrue | Gets the expression executed when Condition evaluates to true or a non-null and non-zero vale.
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Top
See Also

Reference

IConditionalExpression Interface
PostSharp.Reflection.MethodBody Namespace


IConditionalExpression.Condition Property

IConditionalExpressionCondition Property

Gets the condition expression (the return type does not need to be bool. Zero and null values are considered false).

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IExpression Condition { get; }

Property Value

Type: IExpression
See Also

Reference

IConditionalExpression Interface
PostSharp.Reflection.MethodBody Namespace


IConditionalExpression.IfFalse Property

IConditionalExpressionIfFalse Property

Gets the expression executed when Condition evaluates to false, zero, or null.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IExpression IfFalse { get; }

Property Value

Type: IExpression
See Also

Reference

IConditionalExpression Interface
PostSharp.Reflection.MethodBody Namespace


IConditionalExpression.IfTrue Property

IConditionalExpressionIfTrue Property

Gets the expression executed when Condition evaluates to true or a non-null and non-zero vale.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IExpression IfTrue { get; }

Property Value

Type: IExpression
See Also

Reference

IConditionalExpression Interface
PostSharp.Reflection.MethodBody Namespace


IConstantExpression Interface

Expression representing a build-time constant.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IConstantExpression : IExpression,
    IMethodBodyElement

The IConstantExpression type exposes the following members.

Properties
 | Name | Description
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Public property | Value | Gets the constant value.
Top
See Also

Reference

PostSharp.Reflection.MethodBody Namespace


IConstantExpression Properties

The IConstantExpression type exposes the following members.

Properties
 | Name | Description
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Public property | Value | Gets the constant value.
Top
See Also

Reference

IConstantExpression Interface
PostSharp.Reflection.MethodBody Namespace


IConstantExpression.Value Property

IConstantExpressionValue Property

Gets the constant value.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Object Value { get; }

Property Value

Type: Object
See Also

Reference

IConstantExpression Interface
PostSharp.Reflection.MethodBody Namespace


ICopyBufferExpression Interface

Expression equivalent to the [!:OpCodes.Cpblk] instruction.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ICopyBufferExpression : IExpression,
    IMethodBodyElement

The ICopyBufferExpression type exposes the following members.

Properties
 | Name | Description
Public property | Alignment | Gets the alignment of source and destination buffers.
Public property | Destination | Gets the destination address.
Public property | IsVolatile | Determines whether the buffers can be modified from a different thread.
Public property | Length | Gets the number of bytes to be copied.
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Public property | Source | Gets the source address.
Top
Remarks

This expression type has no equivalent in C#.

See Also

Reference

PostSharp.Reflection.MethodBody Namespace


ICopyBufferExpression Properties

The ICopyBufferExpression type exposes the following members.

Properties
 | Name | Description
Public property | Alignment | Gets the alignment of source and destination buffers.
Public property | Destination | Gets the destination address.
Public property | IsVolatile | Determines whether the buffers can be modified from a different thread.
Public property | Length | Gets the number of bytes to be copied.
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Public property | Source | Gets the source address.
Top
See Also

Reference

ICopyBufferExpression Interface
PostSharp.Reflection.MethodBody Namespace


ICopyBufferExpression.Alignment Property

ICopyBufferExpressionAlignment Property

Gets the alignment of source and destination buffers.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
AddressAlignment Alignment { get; }

Property Value

Type: AddressAlignment
See Also

Reference

ICopyBufferExpression Interface
PostSharp.Reflection.MethodBody Namespace


ICopyBufferExpression.Destination Property

ICopyBufferExpressionDestination Property

Gets the destination address.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IExpression Destination { get; }

Property Value

Type: IExpression
See Also

Reference

ICopyBufferExpression Interface
PostSharp.Reflection.MethodBody Namespace


ICopyBufferExpression.IsVolatile Property

ICopyBufferExpressionIsVolatile Property

Determines whether the buffers can be modified from a different thread.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
bool IsVolatile { get; }

Property Value

Type: Boolean
See Also

Reference

ICopyBufferExpression Interface
PostSharp.Reflection.MethodBody Namespace


ICopyBufferExpression.Length Property

ICopyBufferExpressionLength Property

Gets the number of bytes to be copied.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IExpression Length { get; }

Property Value

Type: IExpression
See Also

Reference

ICopyBufferExpression Interface
PostSharp.Reflection.MethodBody Namespace


ICopyBufferExpression.Source Property

ICopyBufferExpressionSource Property

Gets the source address.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IExpression Source { get; }

Property Value

Type: IExpression
See Also

Reference

ICopyBufferExpression Interface
PostSharp.Reflection.MethodBody Namespace


IExceptionHandler Interface

Represents an exception handler (either catch, finally or filter) attached to a block.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IExceptionHandler

The IExceptionHandler type exposes the following members.

Properties
 | Name | Description
Public property | ExceptionHandlerKind | Gets the kind of exception handling clause.
Public property | ExceptionType | Gets the type of handled exception, or null if all exceptions are handled.
Public property | FilterBlock | Gets the exception filtering block, or null if all exceptions are handled.
Public property | FilterLocalVariable | Gets the local variable containing the exception in the FilterBlock.
Public property | HandlerBlock | Gets the exception handling block.
Public property | HandlerLocalVariable | Gets the local variable containing the exception in the HandlerBlock.
Public property | TryBlock | Gets the try block.
Top
See Also

Reference

PostSharp.Reflection.MethodBody Namespace


IExceptionHandler Properties

The IExceptionHandler type exposes the following members.

Properties
 | Name | Description
Public property | ExceptionHandlerKind | Gets the kind of exception handling clause.
Public property | ExceptionType | Gets the type of handled exception, or null if all exceptions are handled.
Public property | FilterBlock | Gets the exception filtering block, or null if all exceptions are handled.
Public property | FilterLocalVariable | Gets the local variable containing the exception in the FilterBlock.
Public property | HandlerBlock | Gets the exception handling block.
Public property | HandlerLocalVariable | Gets the local variable containing the exception in the HandlerBlock.
Public property | TryBlock | Gets the try block.
Top
See Also

Reference

IExceptionHandler Interface
PostSharp.Reflection.MethodBody Namespace


IExceptionHandler.ExceptionHandlerKind Property

IExceptionHandlerExceptionHandlerKind Property

Gets the kind of exception handling clause.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
ExceptionHandlerKind ExceptionHandlerKind { get; }

Property Value

Type: ExceptionHandlerKind
See Also

Reference

IExceptionHandler Interface
PostSharp.Reflection.MethodBody Namespace


IExceptionHandler.ExceptionType Property

IExceptionHandlerExceptionType Property

Gets the type of handled exception, or null if all exceptions are handled.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Type ExceptionType { get; }

Property Value

Type: Type
See Also

Reference

IExceptionHandler Interface
PostSharp.Reflection.MethodBody Namespace


IExceptionHandler.FilterBlock Property

IExceptionHandlerFilterBlock Property

Gets the exception filtering block, or null if all exceptions are handled.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IBlockExpression FilterBlock { get; }

Property Value

Type: IBlockExpression
See Also

Reference

IExceptionHandler Interface
PostSharp.Reflection.MethodBody Namespace


IExceptionHandler.FilterLocalVariable Property

IExceptionHandlerFilterLocalVariable Property

Gets the local variable containing the exception in the FilterBlock.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
ILocalVariable FilterLocalVariable { get; }

Property Value

Type: ILocalVariable
See Also

Reference

IExceptionHandler Interface
PostSharp.Reflection.MethodBody Namespace


IExceptionHandler.HandlerBlock Property

IExceptionHandlerHandlerBlock Property

Gets the exception handling block.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IBlockExpression HandlerBlock { get; }

Property Value

Type: IBlockExpression
See Also

Reference

IExceptionHandler Interface
PostSharp.Reflection.MethodBody Namespace


IExceptionHandler.HandlerLocalVariable Property

IExceptionHandlerHandlerLocalVariable Property

Gets the local variable containing the exception in the HandlerBlock.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
ILocalVariable HandlerLocalVariable { get; }

Property Value

Type: ILocalVariable
See Also

Reference

IExceptionHandler Interface
PostSharp.Reflection.MethodBody Namespace


IExceptionHandler.TryBlock Property

IExceptionHandlerTryBlock Property

Gets the try block.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IBlockExpression TryBlock { get; }

Property Value

Type: IBlockExpression
See Also

Reference

IExceptionHandler Interface
PostSharp.Reflection.MethodBody Namespace


IExpression Interface

Represents an expression or an instruction.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IExpression : IMethodBodyElement

The IExpression type exposes the following members.

Properties
 | Name | Description
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction).
Top
See Also

Reference

PostSharp.Reflection.MethodBody Namespace


IExpression Properties

The IExpression type exposes the following members.

Properties
 | Name | Description
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction).
Top
See Also

Reference

IExpression Interface
PostSharp.Reflection.MethodBody Namespace


IExpression.ReturnType Property

IExpressionReturnType Property

Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction).

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Type ReturnType { get; }

Property Value

Type: Type
See Also

Reference

IExpression Interface
PostSharp.Reflection.MethodBody Namespace


IFieldExpression Interface

Expression that represents a field.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IFieldExpression : IExpression,
    IMethodBodyElement

The IFieldExpression type exposes the following members.

Properties
 | Name | Description
Public property | Alignment | Gets the field alignment.
Public property | Field | Gets the field.
Public property | Instance | Gets the object containing the field, or null if the field is static.
Public property | IsVolatile | Determine whether the field is can be written by a different thread than the current one.
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Top
See Also

Reference

PostSharp.Reflection.MethodBody Namespace


IFieldExpression Properties

The IFieldExpression type exposes the following members.

Properties
 | Name | Description
Public property | Alignment | Gets the field alignment.
Public property | Field | Gets the field.
Public property | Instance | Gets the object containing the field, or null if the field is static.
Public property | IsVolatile | Determine whether the field is can be written by a different thread than the current one.
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Top
See Also

Reference

IFieldExpression Interface
PostSharp.Reflection.MethodBody Namespace


IFieldExpression.Alignment Property

IFieldExpressionAlignment Property

Gets the field alignment.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
AddressAlignment Alignment { get; }

Property Value

Type: AddressAlignment
See Also

Reference

IFieldExpression Interface
PostSharp.Reflection.MethodBody Namespace


IFieldExpression.Field Property

IFieldExpressionField Property

Gets the field.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
FieldInfo Field { get; }

Property Value

Type: FieldInfo
See Also

Reference

IFieldExpression Interface
PostSharp.Reflection.MethodBody Namespace


IFieldExpression.Instance Property

IFieldExpressionInstance Property

Gets the object containing the field, or null if the field is static.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IExpression Instance { get; }

Property Value

Type: IExpression
See Also

Reference

IFieldExpression Interface
PostSharp.Reflection.MethodBody Namespace


IFieldExpression.IsVolatile Property

IFieldExpressionIsVolatile Property

Determine whether the field is can be written by a different thread than the current one.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
bool IsVolatile { get; }

Property Value

Type: Boolean
See Also

Reference

IFieldExpression Interface
PostSharp.Reflection.MethodBody Namespace


IGotoExpression Interface

Unconditional branching instruction.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IGotoExpression : IExpression,
    IMethodBodyElement

The IGotoExpression type exposes the following members.

Properties
 | Name | Description
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Public property | Target | Instruction block that must receive control.
Top
See Also

Reference

PostSharp.Reflection.MethodBody Namespace


IGotoExpression Properties

The IGotoExpression type exposes the following members.

Properties
 | Name | Description
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Public property | Target | Instruction block that must receive control.
Top
See Also

Reference

IGotoExpression Interface
PostSharp.Reflection.MethodBody Namespace


IGotoExpression.Target Property

IGotoExpressionTarget Property

Instruction block that must receive control.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IBlockExpression Target { get; }

Property Value

Type: IBlockExpression
See Also

Reference

IGotoExpression Interface
PostSharp.Reflection.MethodBody Namespace


IInitBufferExpression Interface

Expression equivalent to the [!:OpCodes.Initblk] instruction.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IInitBufferExpression : IExpression,
    IMethodBodyElement

The IInitBufferExpression type exposes the following members.

Properties
 | Name | Description
Public property | Alignment | Gets the alignment of the buffers.
Public property | Buffer | Gets the address of the buffer to be initialized.
Public property | IsVolatile | Determines whether the buffers can be modified from a different thread.
Public property | Length | Gets the number of bytes to be initialized.
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Top
Remarks

This expression type has no equivalent in C#.

See Also

Reference

PostSharp.Reflection.MethodBody Namespace


IInitBufferExpression Properties

The IInitBufferExpression type exposes the following members.

Properties
 | Name | Description
Public property | Alignment | Gets the alignment of the buffers.
Public property | Buffer | Gets the address of the buffer to be initialized.
Public property | IsVolatile | Determines whether the buffers can be modified from a different thread.
Public property | Length | Gets the number of bytes to be initialized.
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Top
See Also

Reference

IInitBufferExpression Interface
PostSharp.Reflection.MethodBody Namespace


IInitBufferExpression.Alignment Property

IInitBufferExpressionAlignment Property

Gets the alignment of the buffers.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
AddressAlignment Alignment { get; }

Property Value

Type: AddressAlignment
See Also

Reference

IInitBufferExpression Interface
PostSharp.Reflection.MethodBody Namespace


IInitBufferExpression.Buffer Property

IInitBufferExpressionBuffer Property

Gets the address of the buffer to be initialized.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IExpression Buffer { get; }

Property Value

Type: IExpression
See Also

Reference

IInitBufferExpression Interface
PostSharp.Reflection.MethodBody Namespace


IInitBufferExpression.IsVolatile Property

IInitBufferExpressionIsVolatile Property

Determines whether the buffers can be modified from a different thread.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
bool IsVolatile { get; }

Property Value

Type: Boolean
See Also

Reference

IInitBufferExpression Interface
PostSharp.Reflection.MethodBody Namespace


IInitBufferExpression.Length Property

IInitBufferExpressionLength Property

Gets the number of bytes to be initialized.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IExpression Length { get; }

Property Value

Type: IExpression
See Also

Reference

IInitBufferExpression Interface
PostSharp.Reflection.MethodBody Namespace


ILocalVariable Interface

Expression that represents a local variable.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ILocalVariable : IMethodBodyElement

The ILocalVariable type exposes the following members.

Properties
 | Name | Description
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | Name | Gets the name of the local variable.
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | Slot | Gets the ordinal of the local variable.
Public property | VariableType | Gets the type of the local variable.
Top
Remarks

There are three kind of local variable, but consumers of this class should be oblivious to these kinds: local variables defined in user code, local variables introduced by the compiler, and pseudo-variables introduced by the AST decompiler to emulate the stack.

See Also

Reference

PostSharp.Reflection.MethodBody Namespace


ILocalVariable Properties

The ILocalVariable type exposes the following members.

Properties
 | Name | Description
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | Name | Gets the name of the local variable.
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | Slot | Gets the ordinal of the local variable.
Public property | VariableType | Gets the type of the local variable.
Top
See Also

Reference

ILocalVariable Interface
PostSharp.Reflection.MethodBody Namespace


ILocalVariable.Name Property

ILocalVariableName Property

Gets the name of the local variable.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
string Name { get; }

Property Value

Type: String
See Also

Reference

ILocalVariable Interface
PostSharp.Reflection.MethodBody Namespace


ILocalVariable.Slot Property

ILocalVariableSlot Property

Gets the ordinal of the local variable.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Nullable<int> Slot { get; }

Property Value

Type: Nullable Int32
Remarks
Several local variables may be assigned the same slot if they are used in different scopes.
See Also

Reference

ILocalVariable Interface
PostSharp.Reflection.MethodBody Namespace


ILocalVariable.VariableType Property

ILocalVariableVariableType Property

Gets the type of the local variable.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Type VariableType { get; }

Property Value

Type: Type
See Also

Reference

ILocalVariable Interface
PostSharp.Reflection.MethodBody Namespace


ILocalVariableExpression Interface

Expression that represents a local variable.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ILocalVariableExpression : IExpression,
    IMethodBodyElement

The ILocalVariableExpression type exposes the following members.

Properties
 | Name | Description
Public property | LocalVariable | Gets the local variable.
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Public property | TrivialValue | Gets the value of the ILocalVariable at this specific point of the program execution, in case this value can be determined trivially.
Top
Methods
 | Name | Description
Public method | GetPossibleAssignments | Returns an array of all possible assignments of the ILocalVariable at this specific point of the program execution.
Top
See Also

Reference

PostSharp.Reflection.MethodBody Namespace


ILocalVariableExpression Properties

The ILocalVariableExpression type exposes the following members.

Properties
 | Name | Description
Public property | LocalVariable | Gets the local variable.
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Public property | TrivialValue | Gets the value of the ILocalVariable at this specific point of the program execution, in case this value can be determined trivially.
Top
See Also

Reference

ILocalVariableExpression Interface
PostSharp.Reflection.MethodBody Namespace


ILocalVariableExpression.LocalVariable Property

ILocalVariableExpressionLocalVariable Property

Gets the local variable.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
ILocalVariable LocalVariable { get; }

Property Value

Type: ILocalVariable
See Also

Reference

ILocalVariableExpression Interface
PostSharp.Reflection.MethodBody Namespace


ILocalVariableExpression.TrivialValue Property

ILocalVariableExpressionTrivialValue Property

Gets the value of the ILocalVariable at this specific point of the program execution, in case this value can be determined trivially.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IExpression TrivialValue { get; }

Property Value

Type: IExpression
Remarks

If the value cannot be determined in a trivial way, it is possible to perform a non-trivial data flow analysis by using the GetPossibleAssignments method.

See Also

Reference

ILocalVariableExpression Interface
PostSharp.Reflection.MethodBody Namespace


ILocalVariableExpression Methods

The ILocalVariableExpression type exposes the following members.

Methods
 | Name | Description
Public method | GetPossibleAssignments | Returns an array of all possible assignments of the ILocalVariable at this specific point of the program execution.
Top
See Also

Reference

ILocalVariableExpression Interface
PostSharp.Reflection.MethodBody Namespace


ILocalVariableExpression.GetPossibleAssignments Method

ILocalVariableExpressionGetPossibleAssignments Method

Returns an array of all possible assignments of the ILocalVariable at this specific point of the program execution.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IList<IExpression> GetPossibleAssignments()

Return Value

Type: IList IExpression
List of possible assignments.
Remarks

The result list contains either assignment expressions (IBinaryExpression) or IAddressOfExpression when the address of the variable is passed to a method through a reference argument.

Result of this method is cached.

See Also

Reference

ILocalVariableExpression Interface
PostSharp.Reflection.MethodBody Namespace


IMetadataExpression Interface

Expression that depends on a metadata declaration. This expression is used when compiling the typeof, sizeof or default keywords of C#, among others.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IMetadataExpression : IExpression,
    IMethodBodyElement

The IMetadataExpression type exposes the following members.

Properties
 | Name | Description
Public property | Declaration | Gets the declaration (Type, FieldInfo, MethodInfo, ConstructorInfo).
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Top
See Also

Reference

PostSharp.Reflection.MethodBody Namespace


IMetadataExpression Properties

The IMetadataExpression type exposes the following members.

Properties
 | Name | Description
Public property | Declaration | Gets the declaration (Type, FieldInfo, MethodInfo, ConstructorInfo).
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Top
See Also

Reference

IMetadataExpression Interface
PostSharp.Reflection.MethodBody Namespace


IMetadataExpression.Declaration Property

IMetadataExpressionDeclaration Property

Gets the declaration (Type, FieldInfo, MethodInfo, ConstructorInfo).

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
MemberInfo Declaration { get; }

Property Value

Type: MemberInfo
See Also

Reference

IMetadataExpression Interface
PostSharp.Reflection.MethodBody Namespace


IMethodBody Interface

Represents the body of a method.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IMethodBody : IMethodBodyElement

The IMethodBody type exposes the following members.

Properties
 | Name | Description
Public property | Method | Gets the method whose body is represented by the current object.
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | RootBlock | Gets the root instruction block of the method.
Top
See Also

Reference

PostSharp.Reflection.MethodBody Namespace


IMethodBody Properties

The IMethodBody type exposes the following members.

Properties
 | Name | Description
Public property | Method | Gets the method whose body is represented by the current object.
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | RootBlock | Gets the root instruction block of the method.
Top
See Also

Reference

IMethodBody Interface
PostSharp.Reflection.MethodBody Namespace


IMethodBody.Method Property

IMethodBodyMethod Property

Gets the method whose body is represented by the current object.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
MethodBase Method { get; }

Property Value

Type: MethodBase
See Also

Reference

IMethodBody Interface
PostSharp.Reflection.MethodBody Namespace


IMethodBody.RootBlock Property

IMethodBodyRootBlock Property

Gets the root instruction block of the method.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IBlockExpression RootBlock { get; }

Property Value

Type: IBlockExpression
See Also

Reference

IMethodBody Interface
PostSharp.Reflection.MethodBody Namespace


IMethodBodyElement Interface

Represents an element of the syntax tree representing a method body.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IMethodBodyElement

The IMethodBodyElement type exposes the following members.

Properties
 | Name | Description
Public property | MethodBodyElementKind | Gets the kind of syntax element.
Public property | ParentElement | Gets the parent element in the tree.
Public property | ParentMethodBody | Gets the parent method body.
Top
See Also

Reference

PostSharp.Reflection.MethodBody Namespace


IMethodBodyElement Properties

The IMethodBodyElement type exposes the following members.

Properties
 | Name | Description
Public property | MethodBodyElementKind | Gets the kind of syntax element.
Public property | ParentElement | Gets the parent element in the tree.
Public property | ParentMethodBody | Gets the parent method body.
Top
See Also

Reference

IMethodBodyElement Interface
PostSharp.Reflection.MethodBody Namespace


IMethodBodyElement.MethodBodyElementKind Property

IMethodBodyElementMethodBodyElementKind Property

Gets the kind of syntax element.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
MethodBodyElementKind MethodBodyElementKind { get; }

Property Value

Type: MethodBodyElementKind
See Also

Reference

IMethodBodyElement Interface
PostSharp.Reflection.MethodBody Namespace


IMethodBodyElement.ParentElement Property

IMethodBodyElementParentElement Property

Gets the parent element in the tree.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IMethodBodyElement ParentElement { get; }

Property Value

Type: IMethodBodyElement
See Also

Reference

IMethodBodyElement Interface
PostSharp.Reflection.MethodBody Namespace


IMethodBodyElement.ParentMethodBody Property

IMethodBodyElementParentMethodBody Property

Gets the parent method body.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IMethodBody ParentMethodBody { get; }

Property Value

Type: IMethodBody
See Also

Reference

IMethodBodyElement Interface
PostSharp.Reflection.MethodBody Namespace


IMethodBodyService Interface

Service that exposes the method GetMethodBody(MethodBase, MethodBodyAbstractionLevel), which allows to decompile a method and get a AST representation.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IMethodBodyService : IService

The IMethodBodyService type exposes the following members.

Methods
 | Name | Description
Public method | GetMethodBody | Decompiles a method and gets an AST representation of it.
Top
Remarks
See Also

Reference

PostSharp.Reflection.MethodBody Namespace


IMethodBodyService Methods

The IMethodBodyService type exposes the following members.

Methods
 | Name | Description
Public method | GetMethodBody | Decompiles a method and gets an AST representation of it.
Top
See Also

Reference

IMethodBodyService Interface
PostSharp.Reflection.MethodBody Namespace


IMethodBodyService.GetMethodBody Method

IMethodBodyServiceGetMethodBody Method

Decompiles a method and gets an AST representation of it.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IMethodBody GetMethodBody(
    MethodBase method,
    MethodBodyAbstractionLevel abstractionLevel
)

Parameters

method
Type: System.ReflectionMethodBase
The method to decompile.
abstractionLevel
Type: PostSharp.Reflection.MethodBodyMethodBodyAbstractionLevel
The required level of abstraction and detail.

Return Value

Type: IMethodBody
AST representing the method at the required level of abstraction and detail.
See Also

Reference

IMethodBodyService Interface
PostSharp.Reflection.MethodBody Namespace


IMethodCallExpression Interface

Expression representing a method call.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IMethodCallExpression : IExpression,
    IMethodBodyElement

The IMethodCallExpression type exposes the following members.

Properties
 | Name | Description
Public property | Arguments | Gets the method arguments.
Public property | ConstrainedType | Gets the type to which the virtual method call is constrained to (see Constrained).
Public property | Instance | Gets the instance on which the method is called, or null if the method is static.
Public property | IsTail | Determines whether the call is a tail call (see Tailcall).
Public property | IsVirtual | Determines whether the call is a virtual call.
Public property | Method | Gets the called method.
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Top
See Also

Reference

PostSharp.Reflection.MethodBody Namespace


IMethodCallExpression Properties

The IMethodCallExpression type exposes the following members.

Properties
 | Name | Description
Public property | Arguments | Gets the method arguments.
Public property | ConstrainedType | Gets the type to which the virtual method call is constrained to (see Constrained).
Public property | Instance | Gets the instance on which the method is called, or null if the method is static.
Public property | IsTail | Determines whether the call is a tail call (see Tailcall).
Public property | IsVirtual | Determines whether the call is a virtual call.
Public property | Method | Gets the called method.
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Top
See Also

Reference

IMethodCallExpression Interface
PostSharp.Reflection.MethodBody Namespace


IMethodCallExpression.Arguments Property

IMethodCallExpressionArguments Property

Gets the method arguments.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IList<IExpression> Arguments { get; }

Property Value

Type: IList IExpression
See Also

Reference

IMethodCallExpression Interface
PostSharp.Reflection.MethodBody Namespace


IMethodCallExpression.ConstrainedType Property

IMethodCallExpressionConstrainedType Property

Gets the type to which the virtual method call is constrained to (see Constrained).

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Type ConstrainedType { get; }

Property Value

Type: Type
See Also

Reference

IMethodCallExpression Interface
PostSharp.Reflection.MethodBody Namespace


IMethodCallExpression.Instance Property

IMethodCallExpressionInstance Property

Gets the instance on which the method is called, or null if the method is static.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IExpression Instance { get; }

Property Value

Type: IExpression
See Also

Reference

IMethodCallExpression Interface
PostSharp.Reflection.MethodBody Namespace


IMethodCallExpression.IsTail Property

IMethodCallExpressionIsTail Property

Determines whether the call is a tail call (see Tailcall).

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
bool IsTail { get; }

Property Value

Type: Boolean
See Also

Reference

IMethodCallExpression Interface
PostSharp.Reflection.MethodBody Namespace


IMethodCallExpression.IsVirtual Property

IMethodCallExpressionIsVirtual Property

Determines whether the call is a virtual call.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
bool IsVirtual { get; }

Property Value

Type: Boolean
See Also

Reference

IMethodCallExpression Interface
PostSharp.Reflection.MethodBody Namespace


IMethodCallExpression.Method Property

IMethodCallExpressionMethod Property

Gets the called method.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
MethodBase Method { get; }

Property Value

Type: MethodBase
See Also

Reference

IMethodCallExpression Interface
PostSharp.Reflection.MethodBody Namespace


IMethodPointerExpression Interface

Expression that represents a C-like pointer to a method.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IMethodPointerExpression : IExpression,
    IMethodBodyElement

The IMethodPointerExpression type exposes the following members.

Properties
 | Name | Description
Public property | Instance | Gets the instance on which the method is defined, or null if the method is static.
Public property | Method | Gets the method.
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Top
See Also

Reference

PostSharp.Reflection.MethodBody Namespace


IMethodPointerExpression Properties

The IMethodPointerExpression type exposes the following members.

Properties
 | Name | Description
Public property | Instance | Gets the instance on which the method is defined, or null if the method is static.
Public property | Method | Gets the method.
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Top
See Also

Reference

IMethodPointerExpression Interface
PostSharp.Reflection.MethodBody Namespace


IMethodPointerExpression.Instance Property

IMethodPointerExpressionInstance Property

Gets the instance on which the method is defined, or null if the method is static.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IExpression Instance { get; }

Property Value

Type: IExpression
See Also

Reference

IMethodPointerExpression Interface
PostSharp.Reflection.MethodBody Namespace


IMethodPointerExpression.Method Property

IMethodPointerExpressionMethod Property

Gets the method.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
MethodBase Method { get; }

Property Value

Type: MethodBase
See Also

Reference

IMethodPointerExpression Interface
PostSharp.Reflection.MethodBody Namespace


INewArrayExpression Interface

Expression that returns a new array.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface INewArrayExpression : IExpression,
    IMethodBodyElement

The INewArrayExpression type exposes the following members.

Properties
 | Name | Description
Public property | ElementType | Gets the type of elements of the array.
Public property | Length | Gets the number of elements in the array.
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Top
See Also

Reference

PostSharp.Reflection.MethodBody Namespace


INewArrayExpression Properties

The INewArrayExpression type exposes the following members.

Properties
 | Name | Description
Public property | ElementType | Gets the type of elements of the array.
Public property | Length | Gets the number of elements in the array.
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Top
See Also

Reference

INewArrayExpression Interface
PostSharp.Reflection.MethodBody Namespace


INewArrayExpression.ElementType Property

INewArrayExpressionElementType Property

Gets the type of elements of the array.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Type ElementType { get; }

Property Value

Type: Type
See Also

Reference

INewArrayExpression Interface
PostSharp.Reflection.MethodBody Namespace


INewArrayExpression.Length Property

INewArrayExpressionLength Property

Gets the number of elements in the array.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IExpression Length { get; }

Property Value

Type: IExpression
See Also

Reference

INewArrayExpression Interface
PostSharp.Reflection.MethodBody Namespace


INewObjectExpression Interface

Expression that creates a new object by invoking a constructor.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface INewObjectExpression : IExpression,
    IMethodBodyElement

The INewObjectExpression type exposes the following members.

Properties
 | Name | Description
Public property | Arguments | Gets the arguments passed to the constructor.
Public property | Constructor | Gets the constructor.
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Top
See Also

Reference

PostSharp.Reflection.MethodBody Namespace


INewObjectExpression Properties

The INewObjectExpression type exposes the following members.

Properties
 | Name | Description
Public property | Arguments | Gets the arguments passed to the constructor.
Public property | Constructor | Gets the constructor.
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Top
See Also

Reference

INewObjectExpression Interface
PostSharp.Reflection.MethodBody Namespace


INewObjectExpression.Arguments Property

INewObjectExpressionArguments Property

Gets the arguments passed to the constructor.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IList<IExpression> Arguments { get; }

Property Value

Type: IList IExpression
See Also

Reference

INewObjectExpression Interface
PostSharp.Reflection.MethodBody Namespace


INewObjectExpression.Constructor Property

INewObjectExpressionConstructor Property

Gets the constructor.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
ConstructorInfo Constructor { get; }

Property Value

Type: ConstructorInfo
See Also

Reference

INewObjectExpression Interface
PostSharp.Reflection.MethodBody Namespace


IParameterExpression Interface

Expression that represents a method parameter.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IParameterExpression : IExpression,
    IMethodBodyElement

The IParameterExpression type exposes the following members.

Properties
 | Name | Description
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | Parameter | Gets the parameter.
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Top
See Also

Reference

PostSharp.Reflection.MethodBody Namespace


IParameterExpression Properties

The IParameterExpression type exposes the following members.

Properties
 | Name | Description
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | Parameter | Gets the parameter.
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Top
See Also

Reference

IParameterExpression Interface
PostSharp.Reflection.MethodBody Namespace


IParameterExpression.Parameter Property

IParameterExpressionParameter Property

Gets the parameter.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
ParameterInfo Parameter { get; }

Property Value

Type: ParameterInfo
See Also

Reference

IParameterExpression Interface
PostSharp.Reflection.MethodBody Namespace


ISequenceExpression Interface

Sequence of instructions.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ISequenceExpression : IBlockExpression,
    IExpression, IMethodBodyElement

The ISequenceExpression type exposes the following members.

Properties
 | Name | Description
Public property | ExceptionHandlerKind | (Inherited from IBlockExpression.)
Public property | ExceptionHandlers | Gets the collection of exception handlers that protect the block, in which the current block is in the try role. (Inherited from IBlockExpression.)
Public property | Items | Gets the collection of items in the block. (Inherited from IBlockExpression.)
Public property | Label | Gets a string that uniquely identifies the block (inside the current method body) as a possible branching target. (Inherited from IBlockExpression.)
Public property | LocalVariableAssignments | Gets the list of local variables that the current sequence assigns, and the value to which the local variable is assigned when the current sequence is fully executed.
Public property | LocalVariables | Gets the collection of local variables defined for the current block. (Inherited from IBlockExpression.)
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentExceptionHandler | Gets the parent exception handler in the current block is in the Catch, Filter or Finally role. (Inherited from IBlockExpression.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | Predecessors | Gets the list of sequences that can branch to the current sequence.
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Public property | Successors | Gets the list of sequences to which the current sequence branch.
Top
See Also

Reference

PostSharp.Reflection.MethodBody Namespace


ISequenceExpression Properties

The ISequenceExpression type exposes the following members.

Properties
 | Name | Description
Public property | ExceptionHandlerKind | (Inherited from IBlockExpression.)
Public property | ExceptionHandlers | Gets the collection of exception handlers that protect the block, in which the current block is in the try role. (Inherited from IBlockExpression.)
Public property | Items | Gets the collection of items in the block. (Inherited from IBlockExpression.)
Public property | Label | Gets a string that uniquely identifies the block (inside the current method body) as a possible branching target. (Inherited from IBlockExpression.)
Public property | LocalVariableAssignments | Gets the list of local variables that the current sequence assigns, and the value to which the local variable is assigned when the current sequence is fully executed.
Public property | LocalVariables | Gets the collection of local variables defined for the current block. (Inherited from IBlockExpression.)
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentExceptionHandler | Gets the parent exception handler in the current block is in the Catch, Filter or Finally role. (Inherited from IBlockExpression.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | Predecessors | Gets the list of sequences that can branch to the current sequence.
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Public property | Successors | Gets the list of sequences to which the current sequence branch.
Top
See Also

Reference

ISequenceExpression Interface
PostSharp.Reflection.MethodBody Namespace


ISequenceExpression.LocalVariableAssignments Property

ISequenceExpressionLocalVariableAssignments Property

Gets the list of local variables that the current sequence assigns, and the value to which the local variable is assigned when the current sequence is fully executed.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
ReadOnlySinglyLinkedList<LocalVariableAssignment> LocalVariableAssignments { get; }

Property Value

Type: ReadOnlySinglyLinkedList LocalVariableAssignment
See Also

Reference

ISequenceExpression Interface
PostSharp.Reflection.MethodBody Namespace


ISequenceExpression.Predecessors Property

ISequenceExpressionPredecessors Property

Gets the list of sequences that can branch to the current sequence.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
ReadOnlySinglyLinkedList<ISequenceExpression> Predecessors { get; }

Property Value

Type: ReadOnlySinglyLinkedList ISequenceExpression
See Also

Reference

ISequenceExpression Interface
PostSharp.Reflection.MethodBody Namespace


ISequenceExpression.Successors Property

ISequenceExpressionSuccessors Property

Gets the list of sequences to which the current sequence branch.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
ReadOnlySinglyLinkedList<ISequenceExpression> Successors { get; }

Property Value

Type: ReadOnlySinglyLinkedList ISequenceExpression
See Also

Reference

ISequenceExpression Interface
PostSharp.Reflection.MethodBody Namespace


IStatementExpression Interface

Represents a statement. A statement is the root of an expression tree.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IStatementExpression : IExpression,
    IMethodBodyElement

The IStatementExpression type exposes the following members.

Properties
 | Name | Description
Public property | Expression | Expression evaluated by the statement.
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | NextSibling | Gets a next sibling of the current expression within IBlockExpression.
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | PreviousSibling | Gets a previous sibling of the current expression within IBlockExpression.
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Top
See Also

Reference

PostSharp.Reflection.MethodBody Namespace


IStatementExpression Properties

The IStatementExpression type exposes the following members.

Properties
 | Name | Description
Public property | Expression | Expression evaluated by the statement.
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | NextSibling | Gets a next sibling of the current expression within IBlockExpression.
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | PreviousSibling | Gets a previous sibling of the current expression within IBlockExpression.
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Top
See Also

Reference

IStatementExpression Interface
PostSharp.Reflection.MethodBody Namespace


IStatementExpression.Expression Property

IStatementExpressionExpression Property

Expression evaluated by the statement.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IExpression Expression { get; }

Property Value

Type: IExpression
See Also

Reference

IStatementExpression Interface
PostSharp.Reflection.MethodBody Namespace


IStatementExpression.NextSibling Property

IStatementExpressionNextSibling Property

Gets a next sibling of the current expression within IBlockExpression.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IStatementExpression NextSibling { get; }

Property Value

Type: IStatementExpression
See Also

Reference

IStatementExpression Interface
PostSharp.Reflection.MethodBody Namespace


IStatementExpression.PreviousSibling Property

IStatementExpressionPreviousSibling Property

Gets a previous sibling of the current expression within IBlockExpression.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IStatementExpression PreviousSibling { get; }

Property Value

Type: IStatementExpression
See Also

Reference

IStatementExpression Interface
PostSharp.Reflection.MethodBody Namespace


ISwitchExpression Interface

Expression that represent a switch (conditional statement with multiple branches).

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ISwitchExpression : IExpression,
    IMethodBodyElement

The ISwitchExpression type exposes the following members.

Properties
 | Name | Description
Public property | Condition | Gets the condition expression.
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Public property | Targets | Gets the list of target blocks.
Top
Remarks

This interface represents the MSIL switch statement, not the C# statement. The main difference is that switch cases have no value: the value of a switch case is equal to its position in the list of Targets.

See Also

Reference

PostSharp.Reflection.MethodBody Namespace


ISwitchExpression Properties

The ISwitchExpression type exposes the following members.

Properties
 | Name | Description
Public property | Condition | Gets the condition expression.
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Public property | Targets | Gets the list of target blocks.
Top
See Also

Reference

ISwitchExpression Interface
PostSharp.Reflection.MethodBody Namespace


ISwitchExpression.Condition Property

ISwitchExpressionCondition Property

Gets the condition expression.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IExpression Condition { get; }

Property Value

Type: IExpression
See Also

Reference

ISwitchExpression Interface
PostSharp.Reflection.MethodBody Namespace


ISwitchExpression.Targets Property

ISwitchExpressionTargets Property

Gets the list of target blocks.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IList<IExpression> Targets { get; }

Property Value

Type: IList IExpression
See Also

Reference

ISwitchExpression Interface
PostSharp.Reflection.MethodBody Namespace


IUnaryExpression Interface

Represents an expression with a single operand.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IUnaryExpression : IExpression,
    IMethodBodyElement

The IUnaryExpression type exposes the following members.

Properties
 | Name | Description
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Public property | Value | Operand of the unary expression.
Top
See Also

Reference

PostSharp.Reflection.MethodBody Namespace


IUnaryExpression Properties

The IUnaryExpression type exposes the following members.

Properties
 | Name | Description
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Public property | Value | Operand of the unary expression.
Top
See Also

Reference

IUnaryExpression Interface
PostSharp.Reflection.MethodBody Namespace


IUnaryExpression.Value Property

IUnaryExpressionValue Property

Operand of the unary expression.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IExpression Value { get; }

Property Value

Type: IExpression
See Also

Reference

IUnaryExpression Interface
PostSharp.Reflection.MethodBody Namespace


IValueOfExpression Interface

Expression that returns the value stored at an address. Equivalent to the C# keyword *.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IValueOfExpression : IUnaryExpression,
    IExpression, IMethodBodyElement

The IValueOfExpression type exposes the following members.

Properties
 | Name | Description
Public property | Alignment | Gets the alignment of the value at the address.
Public property | IsVolatile | Determines whether if the location at the address is volatile, i.e. if it can be changed by a different thread than the current one.
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Public property | Value | Operand of the unary expression. (Inherited from IUnaryExpression.)
Top
See Also

Reference

PostSharp.Reflection.MethodBody Namespace


IValueOfExpression Properties

The IValueOfExpression type exposes the following members.

Properties
 | Name | Description
Public property | Alignment | Gets the alignment of the value at the address.
Public property | IsVolatile | Determines whether if the location at the address is volatile, i.e. if it can be changed by a different thread than the current one.
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Public property | Value | Operand of the unary expression. (Inherited from IUnaryExpression.)
Top
See Also

Reference

IValueOfExpression Interface
PostSharp.Reflection.MethodBody Namespace


IValueOfExpression.Alignment Property

IValueOfExpressionAlignment Property

Gets the alignment of the value at the address.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
AddressAlignment Alignment { get; }

Property Value

Type: AddressAlignment
See Also

Reference

IValueOfExpression Interface
PostSharp.Reflection.MethodBody Namespace


IValueOfExpression.IsVolatile Property

IValueOfExpressionIsVolatile Property

Determines whether if the location at the address is volatile, i.e. if it can be changed by a different thread than the current one.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
bool IsVolatile { get; }

Property Value

Type: Boolean
See Also

Reference

IValueOfExpression Interface
PostSharp.Reflection.MethodBody Namespace


IZeroaryExpression Interface

Expression with no operand.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IZeroaryExpression : IExpression,
    IMethodBodyElement

The IZeroaryExpression type exposes the following members.

Properties
 | Name | Description
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Top
See Also

Reference

PostSharp.Reflection.MethodBody Namespace


IZeroaryExpression Properties

The IZeroaryExpression type exposes the following members.

Properties
 | Name | Description
Public property | MethodBodyElementKind | Gets the kind of syntax element. (Inherited from IMethodBodyElement.)
Public property | ParentElement | Gets the parent element in the tree. (Inherited from IMethodBodyElement.)
Public property | ParentMethodBody | Gets the parent method body. (Inherited from IMethodBodyElement.)
Public property | ReturnType | Gets the type of the return value of the current expression, or Void if the expression does not return anything (i.e. for pure instructions, for instance a goto or throw instruction). (Inherited from IExpression.)
Top
See Also

Reference

IZeroaryExpression Interface
PostSharp.Reflection.MethodBody Namespace


LocalVariableAssignment Structure

Represents the assignment of a local variable to an expression.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public struct LocalVariableAssignment

The LocalVariableAssignment type exposes the following members.

Properties
 | Name | Description
Public property | Expression | Gets the expression to which the local variable is being assigned.
Public property | LocalVariable | Gets the local variable being assigned.
Top
See Also

Reference

PostSharp.Reflection.MethodBody Namespace


LocalVariableAssignment Properties

The LocalVariableAssignment type exposes the following members.

Properties
 | Name | Description
Public property | Expression | Gets the expression to which the local variable is being assigned.
Public property | LocalVariable | Gets the local variable being assigned.
Top
See Also

Reference

LocalVariableAssignment Structure
PostSharp.Reflection.MethodBody Namespace


LocalVariableAssignment.Expression Property

LocalVariableAssignmentExpression Property

Gets the expression to which the local variable is being assigned.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IExpression Expression { get; }

Property Value

Type: IExpression
See Also

Reference

LocalVariableAssignment Structure
PostSharp.Reflection.MethodBody Namespace


LocalVariableAssignment.LocalVariable Property

LocalVariableAssignmentLocalVariable Property

Gets the local variable being assigned.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ILocalVariable LocalVariable { get; }

Property Value

Type: ILocalVariable
See Also

Reference

LocalVariableAssignment Structure
PostSharp.Reflection.MethodBody Namespace


MethodBodyAbstractionLevel Enumeration

Enumerates the level of abstraction and the level of details produced by the AST decompiler.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum MethodBodyAbstractionLevel
Members
Member name | Value | Description
Structure | 0 | Returns only the block structure (exception handlers).
ExpressionTree | 1 | Returns the expression tree.
See Also

Reference

PostSharp.Reflection.MethodBody Namespace


MethodBodyElementKind Enumeration

Enumeration of kinds of syntax elements (IMethodBodyElement).

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public enum MethodBodyElementKind
Members
Member name | Value | Description
Add | 0 | Addition (IBinaryExpression).
AddChecked | 1 | Addition with overflow checking (IBinaryExpression).
And | 2 | Bitwise And (IBinaryExpression).
ArrayIndex | 3 | Element of an array (IBinaryExpression where Left is the array and Right is the index).
ArrayLength | 4 | Length of an array (IUnaryExpression).
Assign | 5 | Assignment (IBinaryExpression).
Goto | 6 | Unconditional branch (IGotoExpression).
Variable | 7 | Local variable expression (ILocalVariableExpression).
Conditional | 8 | Conditional expression (IConditionalExpression).
Cast | 9 | Cast (IUnaryExpression where ReturnType is the destination type).
Divide | 10 | Division (IBinaryExpression).
LessThan | 11 | Less than (IBinaryExpression).
LessThanOrEqual | 12 | Less than or equal (IBinaryExpression).
Modulo | 13 | Modulo (IBinaryExpression).
MultiplyChecked | 14 | Multiply with overflow checking (IBinaryExpression).
Multiply | 15 | Multiply (IBinaryExpression).
GreaterThan | 16 | Greater than (IBinaryExpression).
GreaterThanOrEqual | 17 | Greater than (IBinaryExpression).
Substract | 18 | Substract (IBinaryExpression).
SubstractChecked | 19 | Substract with overflow checking (IBinaryExpression).
Parameter | 20 | Parameter (IParameterExpression).
This | 21 | Current object (this keyword in C#, IZeroaryExpression).
AddressOf | 22 | Referencing operator (& in C#, see IUnaryExpression).
Constant | 23 | Constant (IConstantExpression).
Equal | 24 | Equal (IBinaryExpression).
Not | 25 | Logical negation (IUnaryExpression).
Different | 26 | Different (IBinaryExpression).
ValueOf | 27 | Dereferencing operator (* in C#, see IUnaryExpression).
Or | 28 | Bitwise Or (IBinaryExpression).
Xor | 29 | Bitwise And (IBinaryExpression).
ShiftLeft | 30 | Bitwise shift to left (IBinaryExpression).
ShiftRight | 31 | Bitwise shit to right (IBinaryExpression).
Negate | 32 | Bitwise negation (IUnaryExpression).
SafeCast | 33 | Safe cast (IUnaryExpression where ReturnType is the destination type).
Unbox | 34 | Unbox (IUnaryExpression).
Throw | 35 | Throw exception (IUnaryExpression).
Field | 36 | Field (IFieldExpression).
Box | 37 | Box (IUnaryExpression).
NewArray | 38 | Create new array (INewArrayExpression).
TypedReferenceValue | 39 | Get value of typed reference (IUnaryExpression).
CheckFinite | 40 | Check that the value is finite (IUnaryExpression).
MakeTypedReference | 41 | Make typed reference (IUnaryExpression).
ArgumentList | 42 | Get argument list (IZeroaryExpression).
MethodPointer | 43 | Get pointer of method (IMethodPointerExpression).
LocalAlloc | 44 | Allocate on local stack (IUnaryExpression).
DefaultValue | 45 | Default value for given type (IMetadataExpression).
CopyBuffer | 46 | Copy buffer (ICopyBufferExpression).
InitBuffer | 47 | Initialize buffer (IInitBufferExpression).
LoadToken | 48 | Load metadata token (IMetadataExpression).
SizeOf | 49 | Size of type (IMetadataExpression).
TypedReferenceType | 50 | Get type of typed reference (IUnaryExpression).
ConvertChecked | 51 | Convert to integral type with overflow check (IUnaryExpression).
Convert | 52 | Convert to integral type (IUnaryExpression).
MethodCall | 53 | Method call (IMethodCallExpression).
Return | 54 | Return (IUnaryExpression).
NewObject | 55 | Creates new object (INewObjectExpression).
Switch | 56 | Switch (ISwitchExpression).
Block | 57 | Instruction block (IBlockExpression).
MethodBody | 58 | Method body (IMethodBody).
LocalVariableDefinition | 59 | Local variable definition (ILocalVariable).
Statement | 60 | Statement (IStatementExpression).
Rethrow | 61 | Re-throw exception (IZeroaryExpression).
See Also

Reference

PostSharp.Reflection.MethodBody Namespace


MethodBodyFormatter Class

Formats an IMethodBodyElement to a textual representation, for debugging purposes.
Inheritance Hierarchy
SystemObject
PostSharp.Reflection.MethodBodyMethodBodyVisitor
PostSharp.Reflection.MethodBodyMethodBodyFormatter

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class MethodBodyFormatter : MethodBodyVisitor

The MethodBodyFormatter type exposes the following members.

Constructors
 | Name | Description
Public method | MethodBodyFormatter | Initializes a new MethodBodyFormatter.
Top
Methods
 | Name | Description
Public method | VisitAddressOfExpression | Visits an expression of type IAddressOfExpression and, recursively, all children elements. (Inherited from MethodBodyVisitor.)
Public method | VisitBinaryExpression | Visits an expression of type IBinaryExpression and, recursively, all children elements. (Overrides MethodBodyVisitorVisitBinaryExpression(IBinaryExpression).)
Public method | VisitBlockExpression | Visits an instruction block and, recursively, all syntax nodes. (Overrides MethodBodyVisitorVisitBlockExpression(IBlockExpression).)
Public method | VisitConditionalExpression | Visits an expression of type IUnaryExpression and, recursively, all children elements. (Overrides MethodBodyVisitorVisitConditionalExpression(IConditionalExpression).)
Public method | VisitConstantExpression | Visits an expression of type IGotoExpression. (Overrides MethodBodyVisitorVisitConstantExpression(IConstantExpression).)
Public method | VisitCopyBufferExpression | Visits an expression of type ICopyBufferExpression and, recursively, all children elements. (Overrides MethodBodyVisitorVisitCopyBufferExpression(ICopyBufferExpression).)
Public method | VisitFieldExpression | Visits an expression of type IFieldExpression. (Overrides MethodBodyVisitorVisitFieldExpression(IFieldExpression).)
Public method | VisitGotoExpression | Visits an expression of type IGotoExpression. (Overrides MethodBodyVisitorVisitGotoExpression(IGotoExpression).)
Public method | VisitInitBufferExpression | Visits an expression of type IInitBufferExpression and, recursively, all children elements. (Overrides MethodBodyVisitorVisitInitBufferExpression(IInitBufferExpression).)
Public method | VisitLocalVariable | Visits a local variable definition. (Inherited from MethodBodyVisitor.)
Public method | VisitMetadataExpression | Visits an expression of type IMetadataExpression. (Overrides MethodBodyVisitorVisitMetadataExpression(IMetadataExpression).)
Public method | VisitMethodBody | Visits a method body and, recursively, all syntax nodes. (Inherited from MethodBodyVisitor.)
Public method | VisitMethodCallExpression | Visits an expression of type IMethodCallExpression and, recursively, all children elements. (Overrides MethodBodyVisitorVisitMethodCallExpression(IMethodCallExpression).)
Public method | VisitMethodPointerExpression | Visits an expression of type IMethodPointerExpression and, recursively, all children elements. (Inherited from MethodBodyVisitor.)
Public method | VisitNewArrayExpression | Visits an expression of type INewArrayExpression and, recursively, all children elements. (Overrides MethodBodyVisitorVisitNewArrayExpression(INewArrayExpression).)
Public method | VisitNewObjectExpression | Visits an expression of type INewObjectExpression and, recursively, all children elements. (Inherited from MethodBodyVisitor.)
Public method | VisitParameterExpression | Visits an expression of type IParameterExpression. (Overrides MethodBodyVisitorVisitParameterExpression(IParameterExpression).)
Public method | VisitStatementExpression | Visits an instruction block and, recursively, all syntax nodes. (Inherited from MethodBodyVisitor.)
Public method | VisitSwitchExpression | Visits an expression of type ISwitchExpression and, recursively, all children elements. (Overrides MethodBodyVisitorVisitSwitchExpression(ISwitchExpression).)
Public method | VisitSyntaxElement | Visits a syntax element and, recursively, all children elements. (Inherited from MethodBodyVisitor.)
Public method | VisitUnaryExpression | Visits an expression of type IUnaryExpression and, recursively, all children elements. (Overrides MethodBodyVisitorVisitUnaryExpression(IUnaryExpression).)
Public method | VisitValueOfExpression | Visits an expression of type IValueOfExpression and, recursively, all children elements. (Inherited from MethodBodyVisitor.)
Public method | VisitVariableExpression | Visits an expression of type ILocalVariableExpression. (Overrides MethodBodyVisitorVisitVariableExpression(ILocalVariableExpression).)
Public method | VisitZeroaryExpression | Visits an expression of type IZeroaryExpression. (Overrides MethodBodyVisitorVisitZeroaryExpression(IZeroaryExpression).)
Top
See Also

Reference

PostSharp.Reflection.MethodBody Namespace


MethodBodyFormatter Constructor

Initializes a new MethodBodyFormatter.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public MethodBodyFormatter(
    TextWriter writer
)

Parameters

writer
Type: System.IOTextWriter
A TextWriter where the textual representation will be written.
See Also

Reference

MethodBodyFormatter Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyFormatter Methods

The MethodBodyFormatter type exposes the following members.

Methods
 | Name | Description
Public method | VisitAddressOfExpression | Visits an expression of type IAddressOfExpression and, recursively, all children elements. (Inherited from MethodBodyVisitor.)
Public method | VisitBinaryExpression | Visits an expression of type IBinaryExpression and, recursively, all children elements. (Overrides MethodBodyVisitorVisitBinaryExpression(IBinaryExpression).)
Public method | VisitBlockExpression | Visits an instruction block and, recursively, all syntax nodes. (Overrides MethodBodyVisitorVisitBlockExpression(IBlockExpression).)
Public method | VisitConditionalExpression | Visits an expression of type IUnaryExpression and, recursively, all children elements. (Overrides MethodBodyVisitorVisitConditionalExpression(IConditionalExpression).)
Public method | VisitConstantExpression | Visits an expression of type IGotoExpression. (Overrides MethodBodyVisitorVisitConstantExpression(IConstantExpression).)
Public method | VisitCopyBufferExpression | Visits an expression of type ICopyBufferExpression and, recursively, all children elements. (Overrides MethodBodyVisitorVisitCopyBufferExpression(ICopyBufferExpression).)
Public method | VisitFieldExpression | Visits an expression of type IFieldExpression. (Overrides MethodBodyVisitorVisitFieldExpression(IFieldExpression).)
Public method | VisitGotoExpression | Visits an expression of type IGotoExpression. (Overrides MethodBodyVisitorVisitGotoExpression(IGotoExpression).)
Public method | VisitInitBufferExpression | Visits an expression of type IInitBufferExpression and, recursively, all children elements. (Overrides MethodBodyVisitorVisitInitBufferExpression(IInitBufferExpression).)
Public method | VisitLocalVariable | Visits a local variable definition. (Inherited from MethodBodyVisitor.)
Public method | VisitMetadataExpression | Visits an expression of type IMetadataExpression. (Overrides MethodBodyVisitorVisitMetadataExpression(IMetadataExpression).)
Public method | VisitMethodBody | Visits a method body and, recursively, all syntax nodes. (Inherited from MethodBodyVisitor.)
Public method | VisitMethodCallExpression | Visits an expression of type IMethodCallExpression and, recursively, all children elements. (Overrides MethodBodyVisitorVisitMethodCallExpression(IMethodCallExpression).)
Public method | VisitMethodPointerExpression | Visits an expression of type IMethodPointerExpression and, recursively, all children elements. (Inherited from MethodBodyVisitor.)
Public method | VisitNewArrayExpression | Visits an expression of type INewArrayExpression and, recursively, all children elements. (Overrides MethodBodyVisitorVisitNewArrayExpression(INewArrayExpression).)
Public method | VisitNewObjectExpression | Visits an expression of type INewObjectExpression and, recursively, all children elements. (Inherited from MethodBodyVisitor.)
Public method | VisitParameterExpression | Visits an expression of type IParameterExpression. (Overrides MethodBodyVisitorVisitParameterExpression(IParameterExpression).)
Public method | VisitStatementExpression | Visits an instruction block and, recursively, all syntax nodes. (Inherited from MethodBodyVisitor.)
Public method | VisitSwitchExpression | Visits an expression of type ISwitchExpression and, recursively, all children elements. (Overrides MethodBodyVisitorVisitSwitchExpression(ISwitchExpression).)
Public method | VisitSyntaxElement | Visits a syntax element and, recursively, all children elements. (Inherited from MethodBodyVisitor.)
Public method | VisitUnaryExpression | Visits an expression of type IUnaryExpression and, recursively, all children elements. (Overrides MethodBodyVisitorVisitUnaryExpression(IUnaryExpression).)
Public method | VisitValueOfExpression | Visits an expression of type IValueOfExpression and, recursively, all children elements. (Inherited from MethodBodyVisitor.)
Public method | VisitVariableExpression | Visits an expression of type ILocalVariableExpression. (Overrides MethodBodyVisitorVisitVariableExpression(ILocalVariableExpression).)
Public method | VisitZeroaryExpression | Visits an expression of type IZeroaryExpression. (Overrides MethodBodyVisitorVisitZeroaryExpression(IZeroaryExpression).)
Top
See Also

Reference

MethodBodyFormatter Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyFormatter.VisitBinaryExpression Method

MethodBodyFormatterVisitBinaryExpression Method

Visits an expression of type IBinaryExpression and, recursively, all children elements.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Object VisitBinaryExpression(
    IBinaryExpression expression
)

Parameters

expression
Type: PostSharp.Reflection.MethodBodyIBinaryExpression
The element to be visited.

Return Value

Type: Object
See Also

Reference

MethodBodyFormatter Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyFormatter.VisitBlockExpression Method

MethodBodyFormatterVisitBlockExpression Method

Visits an instruction block and, recursively, all syntax nodes.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Object VisitBlockExpression(
    IBlockExpression instructionBlock
)

Parameters

instructionBlock
Type: PostSharp.Reflection.MethodBodyIBlockExpression
The method body to be visited.

Return Value

Type: Object
instructionBlock, unless the override returns something else.
See Also

Reference

MethodBodyFormatter Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyFormatter.VisitConditionalExpression Method

MethodBodyFormatterVisitConditionalExpression Method

Visits an expression of type IUnaryExpression and, recursively, all children elements.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Object VisitConditionalExpression(
    IConditionalExpression expression
)

Parameters

expression
Type: PostSharp.Reflection.MethodBodyIConditionalExpression
The element to be visited.

Return Value

Type: Object
See Also

Reference

MethodBodyFormatter Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyFormatter.VisitConstantExpression Method

MethodBodyFormatterVisitConstantExpression Method

Visits an expression of type IGotoExpression.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Object VisitConstantExpression(
    IConstantExpression expression
)

Parameters

expression
Type: PostSharp.Reflection.MethodBodyIConstantExpression
The element to be visited.

Return Value

Type: Object
See Also

Reference

MethodBodyFormatter Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyFormatter.VisitCopyBufferExpression Method

MethodBodyFormatterVisitCopyBufferExpression Method

Visits an expression of type ICopyBufferExpression and, recursively, all children elements.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Object VisitCopyBufferExpression(
    ICopyBufferExpression expression
)

Parameters

expression
Type: PostSharp.Reflection.MethodBodyICopyBufferExpression
The element to be visited.

Return Value

Type: Object
See Also

Reference

MethodBodyFormatter Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyFormatter.VisitFieldExpression Method

MethodBodyFormatterVisitFieldExpression Method

Visits an expression of type IFieldExpression.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Object VisitFieldExpression(
    IFieldExpression expression
)

Parameters

expression
Type: PostSharp.Reflection.MethodBodyIFieldExpression
The element to be visited.

Return Value

Type: Object
See Also

Reference

MethodBodyFormatter Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyFormatter.VisitGotoExpression Method

MethodBodyFormatterVisitGotoExpression Method

Visits an expression of type IGotoExpression.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Object VisitGotoExpression(
    IGotoExpression expression
)

Parameters

expression
Type: PostSharp.Reflection.MethodBodyIGotoExpression
The element to be visited.

Return Value

Type: Object
expression, unless the override returns something else.
See Also

Reference

MethodBodyFormatter Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyFormatter.VisitInitBufferExpression Method

MethodBodyFormatterVisitInitBufferExpression Method

Visits an expression of type IInitBufferExpression and, recursively, all children elements.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Object VisitInitBufferExpression(
    IInitBufferExpression expression
)

Parameters

expression
Type: PostSharp.Reflection.MethodBodyIInitBufferExpression
The element to be visited.

Return Value

Type: Object
expression, unless the override returns something else.
See Also

Reference

MethodBodyFormatter Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyFormatter.VisitMetadataExpression Method

MethodBodyFormatterVisitMetadataExpression Method

Visits an expression of type IMetadataExpression.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Object VisitMetadataExpression(
    IMetadataExpression expression
)

Parameters

expression
Type: PostSharp.Reflection.MethodBodyIMetadataExpression
The element to be visited.

Return Value

Type: Object
expression, unless the override returns something else.
See Also

Reference

MethodBodyFormatter Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyFormatter.VisitMethodCallExpression Method

MethodBodyFormatterVisitMethodCallExpression Method

Visits an expression of type IMethodCallExpression and, recursively, all children elements.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Object VisitMethodCallExpression(
    IMethodCallExpression expression
)

Parameters

expression
Type: PostSharp.Reflection.MethodBodyIMethodCallExpression
The element to be visited.

Return Value

Type: Object
expression, unless the override returns something else.
See Also

Reference

MethodBodyFormatter Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyFormatter.VisitNewArrayExpression Method

MethodBodyFormatterVisitNewArrayExpression Method

Visits an expression of type INewArrayExpression and, recursively, all children elements.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Object VisitNewArrayExpression(
    INewArrayExpression expression
)

Parameters

expression
Type: PostSharp.Reflection.MethodBodyINewArrayExpression
The element to be visited.

Return Value

Type: Object
expression, unless the override returns something else.
See Also

Reference

MethodBodyFormatter Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyFormatter.VisitParameterExpression Method

MethodBodyFormatterVisitParameterExpression Method

Visits an expression of type IParameterExpression.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Object VisitParameterExpression(
    IParameterExpression expression
)

Parameters

expression
Type: PostSharp.Reflection.MethodBodyIParameterExpression
The element to be visited.

Return Value

Type: Object
expression, unless the override returns something else.
See Also

Reference

MethodBodyFormatter Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyFormatter.VisitSwitchExpression Method

MethodBodyFormatterVisitSwitchExpression Method

Visits an expression of type ISwitchExpression and, recursively, all children elements.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Object VisitSwitchExpression(
    ISwitchExpression expression
)

Parameters

expression
Type: PostSharp.Reflection.MethodBodyISwitchExpression
The element to be visited.

Return Value

Type: Object
expression, unless the override returns something else.
See Also

Reference

MethodBodyFormatter Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyFormatter.VisitUnaryExpression Method

MethodBodyFormatterVisitUnaryExpression Method

Visits an expression of type IUnaryExpression and, recursively, all children elements.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Object VisitUnaryExpression(
    IUnaryExpression expression
)

Parameters

expression
Type: PostSharp.Reflection.MethodBodyIUnaryExpression
The element to be visited.

Return Value

Type: Object
See Also

Reference

MethodBodyFormatter Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyFormatter.VisitVariableExpression Method

MethodBodyFormatterVisitVariableExpression Method

Visits an expression of type ILocalVariableExpression.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Object VisitVariableExpression(
    ILocalVariableExpression expression
)

Parameters

expression
Type: PostSharp.Reflection.MethodBodyILocalVariableExpression
The element to be visited.

Return Value

Type: Object
expression, unless the override returns something else.
See Also

Reference

MethodBodyFormatter Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyFormatter.VisitZeroaryExpression Method

MethodBodyFormatterVisitZeroaryExpression Method

Visits an expression of type IZeroaryExpression.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override Object VisitZeroaryExpression(
    IZeroaryExpression expression
)

Parameters

expression
Type: PostSharp.Reflection.MethodBodyIZeroaryExpression
The element to be visited.

Return Value

Type: Object
expression, unless the override returns something else.
See Also

Reference

MethodBodyFormatter Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyVisitor Class

Abstract implementation of a visitor of method bodies (IMethodBody and IExpression).
Inheritance Hierarchy
SystemObject
PostSharp.Reflection.MethodBodyMethodBodyVisitor
PostSharp.Reflection.MethodBodyMethodBodyFormatter

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class MethodBodyVisitor

The MethodBodyVisitor type exposes the following members.

Constructors
 | Name | Description
Protected method | MethodBodyVisitor | Initializes a new instance of the MethodBodyVisitor class
Top
Methods
 | Name | Description
Public method | VisitAddressOfExpression | Visits an expression of type IAddressOfExpression and, recursively, all children elements.
Public method | VisitBinaryExpression | Visits an expression of type IBinaryExpression and, recursively, all children elements.
Public method | VisitBlockExpression | Visits an instruction block and, recursively, all syntax nodes.
Public method | VisitConditionalExpression | Visits an expression of type IUnaryExpression and, recursively, all children elements.
Public method | VisitConstantExpression | Visits an expression of type IGotoExpression.
Public method | VisitCopyBufferExpression | Visits an expression of type ICopyBufferExpression and, recursively, all children elements.
Public method | VisitFieldExpression | Visits an expression of type IFieldExpression.
Public method | VisitGotoExpression | Visits an expression of type IGotoExpression.
Public method | VisitInitBufferExpression | Visits an expression of type IInitBufferExpression and, recursively, all children elements.
Public method | VisitLocalVariable | Visits a local variable definition.
Public method | VisitMetadataExpression | Visits an expression of type IMetadataExpression.
Public method | VisitMethodBody | Visits a method body and, recursively, all syntax nodes.
Public method | VisitMethodCallExpression | Visits an expression of type IMethodCallExpression and, recursively, all children elements.
Public method | VisitMethodPointerExpression | Visits an expression of type IMethodPointerExpression and, recursively, all children elements.
Public method | VisitNewArrayExpression | Visits an expression of type INewArrayExpression and, recursively, all children elements.
Public method | VisitNewObjectExpression | Visits an expression of type INewObjectExpression and, recursively, all children elements.
Public method | VisitParameterExpression | Visits an expression of type IParameterExpression.
Public method | VisitStatementExpression | Visits an instruction block and, recursively, all syntax nodes.
Public method | VisitSwitchExpression | Visits an expression of type ISwitchExpression and, recursively, all children elements.
Public method | VisitSyntaxElement | Visits a syntax element and, recursively, all children elements.
Public method | VisitUnaryExpression | Visits an expression of type IUnaryExpression and, recursively, all children elements.
Public method | VisitValueOfExpression | Visits an expression of type IValueOfExpression and, recursively, all children elements.
Public method | VisitVariableExpression | Visits an expression of type ILocalVariableExpression.
Public method | VisitZeroaryExpression | Visits an expression of type IZeroaryExpression.
Top
Remarks

This class provides an abstract implementation, which only ensures that the proper visiting method gets called for every node of the tree, without any other effect. Concrete implementations typically override specific visiting methods, and call the base implementation to ensure that children nodes are being processed too.

See Also

Reference

PostSharp.Reflection.MethodBody Namespace

Other Resources

Conceptual: Breaking Changes in PostSharp 6.0


MethodBodyVisitor Constructor

Initializes a new instance of the MethodBodyVisitor class

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected MethodBodyVisitor()
See Also

Reference

MethodBodyVisitor Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyVisitor Methods

The MethodBodyVisitor type exposes the following members.

Methods
 | Name | Description
Public method | VisitAddressOfExpression | Visits an expression of type IAddressOfExpression and, recursively, all children elements.
Public method | VisitBinaryExpression | Visits an expression of type IBinaryExpression and, recursively, all children elements.
Public method | VisitBlockExpression | Visits an instruction block and, recursively, all syntax nodes.
Public method | VisitConditionalExpression | Visits an expression of type IUnaryExpression and, recursively, all children elements.
Public method | VisitConstantExpression | Visits an expression of type IGotoExpression.
Public method | VisitCopyBufferExpression | Visits an expression of type ICopyBufferExpression and, recursively, all children elements.
Public method | VisitFieldExpression | Visits an expression of type IFieldExpression.
Public method | VisitGotoExpression | Visits an expression of type IGotoExpression.
Public method | VisitInitBufferExpression | Visits an expression of type IInitBufferExpression and, recursively, all children elements.
Public method | VisitLocalVariable | Visits a local variable definition.
Public method | VisitMetadataExpression | Visits an expression of type IMetadataExpression.
Public method | VisitMethodBody | Visits a method body and, recursively, all syntax nodes.
Public method | VisitMethodCallExpression | Visits an expression of type IMethodCallExpression and, recursively, all children elements.
Public method | VisitMethodPointerExpression | Visits an expression of type IMethodPointerExpression and, recursively, all children elements.
Public method | VisitNewArrayExpression | Visits an expression of type INewArrayExpression and, recursively, all children elements.
Public method | VisitNewObjectExpression | Visits an expression of type INewObjectExpression and, recursively, all children elements.
Public method | VisitParameterExpression | Visits an expression of type IParameterExpression.
Public method | VisitStatementExpression | Visits an instruction block and, recursively, all syntax nodes.
Public method | VisitSwitchExpression | Visits an expression of type ISwitchExpression and, recursively, all children elements.
Public method | VisitSyntaxElement | Visits a syntax element and, recursively, all children elements.
Public method | VisitUnaryExpression | Visits an expression of type IUnaryExpression and, recursively, all children elements.
Public method | VisitValueOfExpression | Visits an expression of type IValueOfExpression and, recursively, all children elements.
Public method | VisitVariableExpression | Visits an expression of type ILocalVariableExpression.
Public method | VisitZeroaryExpression | Visits an expression of type IZeroaryExpression.
Top
See Also

Reference

MethodBodyVisitor Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyVisitor.VisitAddressOfExpression Method

MethodBodyVisitorVisitAddressOfExpression Method

Visits an expression of type IAddressOfExpression and, recursively, all children elements.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual Object VisitAddressOfExpression(
    IAddressOfExpression expression
)

Parameters

expression
Type: PostSharp.Reflection.MethodBodyIAddressOfExpression
The element to be visited.

Return Value

Type: Object
expression, unless the override returns something else.
See Also

Reference

MethodBodyVisitor Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyVisitor.VisitBinaryExpression Method

MethodBodyVisitorVisitBinaryExpression Method

Visits an expression of type IBinaryExpression and, recursively, all children elements.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual Object VisitBinaryExpression(
    IBinaryExpression expression
)

Parameters

expression
Type: PostSharp.Reflection.MethodBodyIBinaryExpression
The element to be visited.

Return Value

Type: Object
See Also

Reference

MethodBodyVisitor Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyVisitor.VisitBlockExpression Method

MethodBodyVisitorVisitBlockExpression Method

Visits an instruction block and, recursively, all syntax nodes.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual Object VisitBlockExpression(
    IBlockExpression instructionBlock
)

Parameters

instructionBlock
Type: PostSharp.Reflection.MethodBodyIBlockExpression
The method body to be visited.

Return Value

Type: Object
instructionBlock, unless the override returns something else.
See Also

Reference

MethodBodyVisitor Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyVisitor.VisitConditionalExpression Method

MethodBodyVisitorVisitConditionalExpression Method

Visits an expression of type IUnaryExpression and, recursively, all children elements.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual Object VisitConditionalExpression(
    IConditionalExpression expression
)

Parameters

expression
Type: PostSharp.Reflection.MethodBodyIConditionalExpression
The element to be visited.

Return Value

Type: Object
See Also

Reference

MethodBodyVisitor Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyVisitor.VisitConstantExpression Method

MethodBodyVisitorVisitConstantExpression Method

Visits an expression of type IGotoExpression.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual Object VisitConstantExpression(
    IConstantExpression expression
)

Parameters

expression
Type: PostSharp.Reflection.MethodBodyIConstantExpression
The element to be visited.

Return Value

Type: Object
See Also

Reference

MethodBodyVisitor Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyVisitor.VisitCopyBufferExpression Method

MethodBodyVisitorVisitCopyBufferExpression Method

Visits an expression of type ICopyBufferExpression and, recursively, all children elements.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual Object VisitCopyBufferExpression(
    ICopyBufferExpression expression
)

Parameters

expression
Type: PostSharp.Reflection.MethodBodyICopyBufferExpression
The element to be visited.

Return Value

Type: Object
See Also

Reference

MethodBodyVisitor Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyVisitor.VisitFieldExpression Method

MethodBodyVisitorVisitFieldExpression Method

Visits an expression of type IFieldExpression.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual Object VisitFieldExpression(
    IFieldExpression expression
)

Parameters

expression
Type: PostSharp.Reflection.MethodBodyIFieldExpression
The element to be visited.

Return Value

Type: Object
See Also

Reference

MethodBodyVisitor Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyVisitor.VisitGotoExpression Method

MethodBodyVisitorVisitGotoExpression Method

Visits an expression of type IGotoExpression.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual Object VisitGotoExpression(
    IGotoExpression expression
)

Parameters

expression
Type: PostSharp.Reflection.MethodBodyIGotoExpression
The element to be visited.

Return Value

Type: Object
expression, unless the override returns something else.
See Also

Reference

MethodBodyVisitor Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyVisitor.VisitInitBufferExpression Method

MethodBodyVisitorVisitInitBufferExpression Method

Visits an expression of type IInitBufferExpression and, recursively, all children elements.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual Object VisitInitBufferExpression(
    IInitBufferExpression expression
)

Parameters

expression
Type: PostSharp.Reflection.MethodBodyIInitBufferExpression
The element to be visited.

Return Value

Type: Object
expression, unless the override returns something else.
See Also

Reference

MethodBodyVisitor Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyVisitor.VisitLocalVariable Method

MethodBodyVisitorVisitLocalVariable Method

Visits a local variable definition.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual Object VisitLocalVariable(
    ILocalVariable localVariable
)

Parameters

localVariable
Type: PostSharp.Reflection.MethodBodyILocalVariable
The local variable to be visited.

Return Value

Type: Object
localVariable, unless the override returns something else.
See Also

Reference

MethodBodyVisitor Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyVisitor.VisitMetadataExpression Method

MethodBodyVisitorVisitMetadataExpression Method

Visits an expression of type IMetadataExpression.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual Object VisitMetadataExpression(
    IMetadataExpression expression
)

Parameters

expression
Type: PostSharp.Reflection.MethodBodyIMetadataExpression
The element to be visited.

Return Value

Type: Object
expression, unless the override returns something else.
See Also

Reference

MethodBodyVisitor Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyVisitor.VisitMethodBody Method

MethodBodyVisitorVisitMethodBody Method

Visits a method body and, recursively, all syntax nodes.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual Object VisitMethodBody(
    IMethodBody methodBody
)

Parameters

methodBody
Type: PostSharp.Reflection.MethodBodyIMethodBody
The method body to be visited.

Return Value

Type: Object
methodBody, unless the override returns something else.
See Also

Reference

MethodBodyVisitor Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyVisitor.VisitMethodCallExpression Method

MethodBodyVisitorVisitMethodCallExpression Method

Visits an expression of type IMethodCallExpression and, recursively, all children elements.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual Object VisitMethodCallExpression(
    IMethodCallExpression expression
)

Parameters

expression
Type: PostSharp.Reflection.MethodBodyIMethodCallExpression
The element to be visited.

Return Value

Type: Object
expression, unless the override returns something else.
See Also

Reference

MethodBodyVisitor Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyVisitor.VisitMethodPointerExpression Method

MethodBodyVisitorVisitMethodPointerExpression Method

Visits an expression of type IMethodPointerExpression and, recursively, all children elements.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual Object VisitMethodPointerExpression(
    IMethodPointerExpression expression
)

Parameters

expression
Type: PostSharp.Reflection.MethodBodyIMethodPointerExpression
The element to be visited.

Return Value

Type: Object
expression, unless the override returns something else.
See Also

Reference

MethodBodyVisitor Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyVisitor.VisitNewArrayExpression Method

MethodBodyVisitorVisitNewArrayExpression Method

Visits an expression of type INewArrayExpression and, recursively, all children elements.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual Object VisitNewArrayExpression(
    INewArrayExpression expression
)

Parameters

expression
Type: PostSharp.Reflection.MethodBodyINewArrayExpression
The element to be visited.

Return Value

Type: Object
expression, unless the override returns something else.
See Also

Reference

MethodBodyVisitor Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyVisitor.VisitNewObjectExpression Method

MethodBodyVisitorVisitNewObjectExpression Method

Visits an expression of type INewObjectExpression and, recursively, all children elements.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual Object VisitNewObjectExpression(
    INewObjectExpression expression
)

Parameters

expression
Type: PostSharp.Reflection.MethodBodyINewObjectExpression
The element to be visited.

Return Value

Type: Object
expression, unless the override returns something else.
See Also

Reference

MethodBodyVisitor Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyVisitor.VisitParameterExpression Method

MethodBodyVisitorVisitParameterExpression Method

Visits an expression of type IParameterExpression.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual Object VisitParameterExpression(
    IParameterExpression expression
)

Parameters

expression
Type: PostSharp.Reflection.MethodBodyIParameterExpression
The element to be visited.

Return Value

Type: Object
expression, unless the override returns something else.
See Also

Reference

MethodBodyVisitor Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyVisitor.VisitStatementExpression Method

MethodBodyVisitorVisitStatementExpression Method

Visits an instruction block and, recursively, all syntax nodes.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual Object VisitStatementExpression(
    IStatementExpression statementExpression
)

Parameters

statementExpression
Type: PostSharp.Reflection.MethodBodyIStatementExpression
The statement to be visited.

Return Value

Type: Object
statementExpression, unless the override returns something else.
See Also

Reference

MethodBodyVisitor Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyVisitor.VisitSwitchExpression Method

MethodBodyVisitorVisitSwitchExpression Method

Visits an expression of type ISwitchExpression and, recursively, all children elements.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual Object VisitSwitchExpression(
    ISwitchExpression expression
)

Parameters

expression
Type: PostSharp.Reflection.MethodBodyISwitchExpression
The element to be visited.

Return Value

Type: Object
expression, unless the override returns something else.
See Also

Reference

MethodBodyVisitor Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyVisitor.VisitSyntaxElement Method

MethodBodyVisitorVisitSyntaxElement Method

Visits a syntax element and, recursively, all children elements.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual Object VisitSyntaxElement(
    IMethodBodyElement syntaxElement
)

Parameters

syntaxElement
Type: PostSharp.Reflection.MethodBodyIMethodBodyElement
The element to be visited.

Return Value

Type: Object
syntaxElement, unless the override returns something else.
See Also

Reference

MethodBodyVisitor Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyVisitor.VisitUnaryExpression Method

MethodBodyVisitorVisitUnaryExpression Method

Visits an expression of type IUnaryExpression and, recursively, all children elements.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual Object VisitUnaryExpression(
    IUnaryExpression expression
)

Parameters

expression
Type: PostSharp.Reflection.MethodBodyIUnaryExpression
The element to be visited.

Return Value

Type: Object
See Also

Reference

MethodBodyVisitor Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyVisitor.VisitValueOfExpression Method

MethodBodyVisitorVisitValueOfExpression Method

Visits an expression of type IValueOfExpression and, recursively, all children elements.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual Object VisitValueOfExpression(
    IValueOfExpression expression
)

Parameters

expression
Type: PostSharp.Reflection.MethodBodyIValueOfExpression
The element to be visited.

Return Value

Type: Object
expression, unless the override returns something else.
See Also

Reference

MethodBodyVisitor Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyVisitor.VisitVariableExpression Method

MethodBodyVisitorVisitVariableExpression Method

Visits an expression of type ILocalVariableExpression.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual Object VisitVariableExpression(
    ILocalVariableExpression expression
)

Parameters

expression
Type: PostSharp.Reflection.MethodBodyILocalVariableExpression
The element to be visited.

Return Value

Type: Object
expression, unless the override returns something else.
See Also

Reference

MethodBodyVisitor Class
PostSharp.Reflection.MethodBody Namespace


MethodBodyVisitor.VisitZeroaryExpression Method

MethodBodyVisitorVisitZeroaryExpression Method

Visits an expression of type IZeroaryExpression.

Namespace: PostSharp.Reflection.MethodBody
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual Object VisitZeroaryExpression(
    IZeroaryExpression expression
)

Parameters

expression
Type: PostSharp.Reflection.MethodBodyIZeroaryExpression
The element to be visited.

Return Value

Type: Object
expression, unless the override returns something else.
See Also

Reference

MethodBodyVisitor Class
PostSharp.Reflection.MethodBody Namespace


PostSharp.Serialization Namespace

The PostSharp.Serialization namespace implements a portable serializer.
Classes
 | Class | Description
Public class | ActivatorProvider | Provides instances of classes implementing the IActivator interface. You should not use this class in user code.
Public class | ActivatorSecurityToken | Security token passed to the CreateInstance(Type, ActivatorSecurityToken) method of the IActivator interface.
Public class | ActivatorTypeAttribute | Custom attribute that, when applied to an assembly, points to a type in the assembly implementing IActivator.
Public class | ImportSerializerAttribute | Custom attribute that, when applied to a serializable type, specifies that the serializer of this type has a dependency on another serializer. The custom attribute can be applied at assembly level; it then applies to all serializable types in this assembly.
Public class | PNonSerializedAttribute | Custom attribute that, when applied to a field of a class annotated with PSerializableAttribute, specifies that this field should not be serialized.
Public class | PortableFormatter | A serializer designed to serialize the internal structure of types with support for cyclic object graphs. The PortableFormatter is very similar in function and design to the BinaryFormatter, but is supported on most platforms and does not require full trust. Both formatters have similar usage: SerializableAttribute is replaced by PSerializableAttribute and NonSerializedAttribute by PNonSerializedAttribute.
Public class | PortableSerializationBinder | Binds types to names and names to types. Used by the PortableFormatter.
Public class | PortableSerializationException | Exception thrown by the PortableFormatter.
Public class | PSerializableAttribute | Custom attribute that, when applied to a type, causes PostSharp to generate a serializer for use by the PortableFormatter.
Public class | ReferenceTypeSerializer | Base serializer for all reference types.
Public class | SerializationServices | Provides some utility method for the current namespace.
Public class | SerializerAttribute | Custom attribute that, when applied to a type, specifies its serializer for use by the PortableFormatter.
Public class | SerializerFactoryProvider | Provides instances of the ISerializerFactory interface for object types that have been previously registered using AddSerializer(Type, Type).
Public class | ValueTypeSerializerT | Base serializer for all value types.
Structures
 | Structure | Description
Public structure | DottedString | Encapsulates dotted strings such as namespaces and type names, so their serialization by PortableFormatter can be optimized.
Interfaces
 | Interface | Description
Public interface | IActivator | Exposes a method CreateInstance(Type, ActivatorSecurityToken), which allows to create an instance of a type using the Activator facility.
Public interface | IArgumentsReader | Provides read access to the collection of deserialized arguments.
Public interface | IArgumentsWriter | Provides write access to a collection of arguments that need to be serialized.
Public interface | ISerializationCallback | Interface that can be implemented by serializable classes. It defines methods OnDeserialized and OnSerializing called during serialization.
Public interface | ISerializer | Defines the semantics of an object serializer.
Public interface | ISerializerDiscoverer | Exposes a method that allows implementations of the interface to discover serializer types for each type being serialized.
Public interface | ISerializerFactory | Defines a method CreateSerializer(Type), which creates instances of the ISerializer interface for given object types.
Public interface | ISerializerFactoryProvider | Provides instances of the ISerializerFactory interface given the object type.


ActivatorProvider Class

Provides instances of classes implementing the IActivator interface. You should not use this class in user code.
Inheritance Hierarchy
SystemObject
PostSharp.SerializationActivatorProvider

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ActivatorProvider

The ActivatorProvider type exposes the following members.

Methods
 | Name | Description
Public method | GetActivator | Gets an instance of a given class implementing the IActivator interface.
Top
See Also

Reference

PostSharp.Serialization Namespace


ActivatorProvider Methods

The ActivatorProvider type exposes the following members.

Methods
 | Name | Description
Public method | GetActivator | Gets an instance of a given class implementing the IActivator interface.
Top
See Also

Reference

ActivatorProvider Class
PostSharp.Serialization Namespace


ActivatorProvider.GetActivator Method

ActivatorProviderGetActivator Method

Gets an instance of a given class implementing the IActivator interface.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IActivator GetActivator(
    Type type
)

Parameters

type
Type: SystemType
A type implementing the IActivator interface.

Return Value

Type: IActivator
An instance of type type.
See Also

Reference

ActivatorProvider Class
PostSharp.Serialization Namespace


ActivatorSecurityToken Class

Security token passed to the CreateInstance(Type, ActivatorSecurityToken) method of the IActivator interface.
Inheritance Hierarchy
SystemObject
PostSharp.SerializationActivatorSecurityToken

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ActivatorSecurityToken
See Also

Reference

PostSharp.Serialization Namespace


ActivatorTypeAttribute Class

Custom attribute that, when applied to an assembly, points to a type in the assembly implementing IActivator.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.SerializationActivatorTypeAttribute

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ActivatorTypeAttribute : Attribute

The ActivatorTypeAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | ActivatorTypeAttribute | Initializes a new ActivatorTypeAttribute.
Top
Properties
 | Name | Description
Public property | ActivatorType | Gets the activator type.
Top
See Also

Reference

PostSharp.Serialization Namespace


ActivatorTypeAttribute Constructor

Initializes a new ActivatorTypeAttribute.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ActivatorTypeAttribute(
    Type activatorType
)

Parameters

activatorType
Type: SystemType
A type derived from IActivator in the current assembly. This type must be public and have a default constructor.
See Also

Reference

ActivatorTypeAttribute Class
PostSharp.Serialization Namespace


ActivatorTypeAttribute Properties

The ActivatorTypeAttribute type exposes the following members.

Properties
 | Name | Description
Public property | ActivatorType | Gets the activator type.
Top
See Also

Reference

ActivatorTypeAttribute Class
PostSharp.Serialization Namespace


ActivatorTypeAttribute.ActivatorType Property

ActivatorTypeAttributeActivatorType Property

Gets the activator type.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Type ActivatorType { get; }

Property Value

Type: Type
See Also

Reference

ActivatorTypeAttribute Class
PostSharp.Serialization Namespace


DottedString Structure

Encapsulates dotted strings such as namespaces and type names, so their serialization by PortableFormatter can be optimized.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public struct DottedString : IEquatable<DottedString>

The DottedString type exposes the following members.

Constructors
 | Name | Description
Public method | DottedString | Initializes a new DottedString.
Top
Properties
 | Name | Description
Public property | IsNull | Determines whether the current DottedString represents a null string.
Public property | Value | Gets the string encapsulated by the current DottedString.
Top
Methods
 | Name | Description
Public method | Equals(Object) | Indicates whether this instance and a specified object are equal. (Overrides ValueTypeEquals(Object).)
Public method | Equals(DottedString) | Determines whether the currentDottedString is equal to another one.
Public method | GetHashCode | Returns the hash code for this instance. (Overrides ValueTypeGetHashCode.)
Public method | ToString | Returns the fully qualified type name of this instance. (Overrides ValueTypeToString.)
Top
Operators
Name | Description
(String to DottedString) | Converts a String into a DottedString.
(DottedString to String) | Converts a DottedString into a String.
Top
Fields
Name | Description
Null | Gets an instance of DottedString representing a null string.
Top
See Also

Reference

PostSharp.Serialization Namespace


DottedString Constructor

Initializes a new DottedString.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public DottedString(
    string value
)

Parameters

value
Type: SystemString
Value.
See Also

Reference

DottedString Structure
PostSharp.Serialization Namespace


DottedString Properties

The DottedString type exposes the following members.

Properties
 | Name | Description
Public property | IsNull | Determines whether the current DottedString represents a null string.
Public property | Value | Gets the string encapsulated by the current DottedString.
Top
See Also

Reference

DottedString Structure
PostSharp.Serialization Namespace


DottedString.IsNull Property

DottedStringIsNull Property

Determines whether the current DottedString represents a null string.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool IsNull { get; }

Property Value

Type: Boolean
See Also

Reference

DottedString Structure
PostSharp.Serialization Namespace


DottedString.Value Property

DottedStringValue Property

Gets the string encapsulated by the current DottedString.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public string Value { get; }

Property Value

Type: String
See Also

Reference

DottedString Structure
PostSharp.Serialization Namespace


DottedString Methods

The DottedString type exposes the following members.

Methods
 | Name | Description
Public method | Equals(Object) | Indicates whether this instance and a specified object are equal. (Overrides ValueTypeEquals(Object).)
Public method | Equals(DottedString) | Determines whether the currentDottedString is equal to another one.
Public method | GetHashCode | Returns the hash code for this instance. (Overrides ValueTypeGetHashCode.)
Public method | ToString | Returns the fully qualified type name of this instance. (Overrides ValueTypeToString.)
Top
See Also

Reference

DottedString Structure
PostSharp.Serialization Namespace


DottedString.Equals Method

DottedStringEquals Method

Overload List
 | Name | Description
Public method | Equals(Object) | Indicates whether this instance and a specified object are equal. (Overrides ValueTypeEquals(Object).)
Public method | Equals(DottedString) | Determines whether the currentDottedString is equal to another one.
Top
See Also

Reference

DottedString Structure
PostSharp.Serialization Namespace


DottedString.Equals Method (Object)

DottedStringEquals Method (Object)

Indicates whether this instance and a specified object are equal.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override bool Equals(
    Object obj
)

Parameters

obj
Type: SystemObject
The object to compare with the current instance.

Return Value

Type: Boolean
true if obj and this instance are the same type and represent the same value; otherwise, false.
See Also

Reference

DottedString Structure
Equals Overload
PostSharp.Serialization Namespace


DottedString.Equals Method (DottedString)

DottedStringEquals Method (DottedString)

Determines whether the currentDottedString is equal to another one.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public bool Equals(
    DottedString other
)

Parameters

other
Type: PostSharp.SerializationDottedString
Another DottedString.

Return Value

Type: Boolean
true if the current DottedString equals other, otherwise false.

Implements

IEquatableTEquals(T)
See Also

Reference

DottedString Structure
Equals Overload
PostSharp.Serialization Namespace


DottedString.GetHashCode Method

DottedStringGetHashCode Method

Returns the hash code for this instance.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override int GetHashCode()

Return Value

Type: Int32
A 32-bit signed integer that is the hash code for this instance.
See Also

Reference

DottedString Structure
PostSharp.Serialization Namespace


DottedString.ToString Method

DottedStringToString Method

Returns the fully qualified type name of this instance.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public override string ToString()

Return Value

Type: String
A String containing a fully qualified type name.
See Also

Reference

DottedString Structure
PostSharp.Serialization Namespace


DottedString Type Conversions

Operators
Name | Description
(String to DottedString) | Converts a String into a DottedString.
(DottedString to String) | Converts a DottedString into a String.
Top
See Also

Reference

DottedString Structure
PostSharp.Serialization Namespace


DottedString Implicit Conversion Operators

DottedString Conversion Operators

Overload List
Name | Description
(String to DottedString) | Converts a String into a DottedString.
(DottedString to String) | Converts a DottedString into a String.
Top
See Also

Reference

DottedString Structure
PostSharp.Serialization Namespace


DottedString Implicit Conversion (String to DottedString)

DottedString Conversion (String to DottedString)

Converts a String into a DottedString.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static implicit operator DottedString (
    string str
)

Parameters

str
Type: SystemString
A String.

Return Value

Type: DottedString
A DottedString encapsulating str.
See Also

Reference

DottedString Structure
Overload
PostSharp.Serialization Namespace


DottedString Implicit Conversion (DottedString to String)

DottedString Conversion (DottedString to String)

Converts a DottedString into a String.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static implicit operator string (
    DottedString dottedString
)

Parameters

dottedString
Type: PostSharp.SerializationDottedString
A DottedString.

Return Value

Type: String
The String encapsulated by dottedString.
See Also

Reference

DottedString Structure
Overload
PostSharp.Serialization Namespace


DottedString Fields

The DottedString type exposes the following members.

Fields
Name | Description
Null | Gets an instance of DottedString representing a null string.
Top
See Also

Reference

DottedString Structure
PostSharp.Serialization Namespace


DottedString.Null Field

DottedStringNull Field

Gets an instance of DottedString representing a null string.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static readonly DottedString Null

Field Value

Type: DottedString
See Also

Reference

DottedString Structure
PostSharp.Serialization Namespace


IActivator Interface

Exposes a method CreateInstance(Type, ActivatorSecurityToken), which allows to create an instance of a type using the Activator facility.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IActivator

The IActivator type exposes the following members.

Methods
 | Name | Description
Public method | CreateInstance | Creates an instance of a give type.
Top
Remarks

PostSharp generates implementations of this interface in each assembly that contains serializable classes. It allows to create objects in the security context of this assembly (instead of from the security context of PostSharp.dll).

See Also

Reference

PostSharp.Serialization Namespace


IActivator Methods

The IActivator type exposes the following members.

Methods
 | Name | Description
Public method | CreateInstance | Creates an instance of a give type.
Top
See Also

Reference

IActivator Interface
PostSharp.Serialization Namespace


IActivator.CreateInstance Method

IActivatorCreateInstance Method

Creates an instance of a give type.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Object CreateInstance(
    Type objectType,
    ActivatorSecurityToken securityToken
)

Parameters

objectType
Type: SystemType
Type of object whose an instance is requested.
securityToken
Type: PostSharp.SerializationActivatorSecurityToken
A security token.

Return Value

Type: Object
A new instance of type objectType.
Remarks

For security reasons, implementations should throw an exception or return null if securityToken is nuill.

See Also

Reference

IActivator Interface
PostSharp.Serialization Namespace

Other Resources

Conceptual: Introducing Interfaces, Methods, Properties and Events into Existing Classes


IArgumentsReader Interface

Provides read access to the collection of deserialized arguments.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IArgumentsReader

The IArgumentsReader type exposes the following members.

Properties
 | Name | Description
Public property | MetadataDispenser | When deserializing PostSharp aspects, gets the IMetadataDispenser corresponding to the MetadataEmitter used at build time.
Top
Methods
 | Name | Description
Public method | GetValueT | Reads a value from the collection, and throws an exception if the value does not exist.
Public method | TryGetValueT | Attempts to read a value from the collection, and does not throw an exception if the value does not exist.
Top
See Also

Reference

PostSharp.Serialization Namespace


IArgumentsReader Properties

The IArgumentsReader type exposes the following members.

Properties
 | Name | Description
Public property | MetadataDispenser | When deserializing PostSharp aspects, gets the IMetadataDispenser corresponding to the MetadataEmitter used at build time.
Top
See Also

Reference

IArgumentsReader Interface
PostSharp.Serialization Namespace


IArgumentsReader.MetadataDispenser Property

IArgumentsReaderMetadataDispenser Property

When deserializing PostSharp aspects, gets the IMetadataDispenser corresponding to the MetadataEmitter used at build time.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IMetadataDispenser MetadataDispenser { get; }

Property Value

Type: IMetadataDispenser
See Also

Reference

IArgumentsReader Interface
PostSharp.Serialization Namespace


IArgumentsReader Methods

The IArgumentsReader type exposes the following members.

Methods
 | Name | Description
Public method | GetValueT | Reads a value from the collection, and throws an exception if the value does not exist.
Public method | TryGetValueT | Attempts to read a value from the collection, and does not throw an exception if the value does not exist.
Top
See Also

Reference

IArgumentsReader Interface
PostSharp.Serialization Namespace


IArgumentsReader.GetValue(T) Method

IArgumentsReaderGetValueT Method

Reads a value from the collection, and throws an exception if the value does not exist.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
T GetValue<T>(
    string name,
    string scope = null
)

Parameters

name
Type: SystemString
Argument name.
scope (Optional)
Type: SystemString
An optional prefix of name, similar to a namespace.

Type Parameters

T
Value type.

Return Value

Type: T
The value of the argument named name in the given optional scope.
See Also

Reference

IArgumentsReader Interface
PostSharp.Serialization Namespace


IArgumentsReader.TryGetValue(T) Method

IArgumentsReaderTryGetValueT Method

Attempts to read a value from the collection, and does not throw an exception if the value does not exist.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
bool TryGetValue<T>(
    string name,
    out T value,
    string scope = null
)

Parameters

name
Type: SystemString
Argument name.
value
Type: T
At output, set to the value of the argument named name in the given optional scope.
scope (Optional)
Type: SystemString
An optional prefix of name, similar to a namespace.

Type Parameters

T
Value type.

Return Value

Type: Boolean
true if the value is defined, otherwise false.
See Also

Reference

IArgumentsReader Interface
PostSharp.Serialization Namespace


IArgumentsWriter Interface

Provides write access to a collection of arguments that need to be serialized.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface IArgumentsWriter

The IArgumentsWriter type exposes the following members.

Properties
 | Name | Description
Public property | MetadataEmitter | When serializing PostSharp access, gets a facility that can be used to serialize metadata (System.Reflection) objects as MSIL, therefore making them transparent to obfuscation.
Top
Methods
 | Name | Description
Public method | SetValue | Sets the value of an argument.
Top
See Also

Reference

PostSharp.Serialization Namespace


IArgumentsWriter Properties

The IArgumentsWriter type exposes the following members.

Properties
 | Name | Description
Public property | MetadataEmitter | When serializing PostSharp access, gets a facility that can be used to serialize metadata (System.Reflection) objects as MSIL, therefore making them transparent to obfuscation.
Top
See Also

Reference

IArgumentsWriter Interface
PostSharp.Serialization Namespace


IArgumentsWriter.MetadataEmitter Property

IArgumentsWriterMetadataEmitter Property

When serializing PostSharp access, gets a facility that can be used to serialize metadata (System.Reflection) objects as MSIL, therefore making them transparent to obfuscation.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
IMetadataEmitter MetadataEmitter { get; }

Property Value

Type: IMetadataEmitter
See Also

Reference

IArgumentsWriter Interface
PostSharp.Serialization Namespace


IArgumentsWriter Methods

The IArgumentsWriter type exposes the following members.

Methods
 | Name | Description
Public method | SetValue | Sets the value of an argument.
Top
See Also

Reference

IArgumentsWriter Interface
PostSharp.Serialization Namespace


IArgumentsWriter.SetValue Method

IArgumentsWriterSetValue Method

Sets the value of an argument.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void SetValue(
    string name,
    Object value,
    string scope = null
)

Parameters

name
Type: SystemString
Argument name.
value
Type: SystemObject
Argument value. The value can be null or must be serializable.
scope (Optional)
Type: SystemString
An optional prefix of name, similar to a namespace.
See Also

Reference

IArgumentsWriter Interface
PostSharp.Serialization Namespace


ImportSerializerAttribute Class

Custom attribute that, when applied to a serializable type, specifies that the serializer of this type has a dependency on another serializer. The custom attribute can be applied at assembly level; it then applies to all serializable types in this assembly.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.SerializationImportSerializerAttribute

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class ImportSerializerAttribute : Attribute

The ImportSerializerAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | ImportSerializerAttribute | Initializes a new ImportSerializerAttribute.
Top
Properties
 | Name | Description
Public property | ObjectType | Gets the type of the object to be made serializable
Public property | SerializerType | Gets the serializer type.
Top
Remarks

This custom attribute is useful to add serializers to types of third-party assemblies. For types whose source code you can modify, it is preferable to use PSerializableAttribute or SerializerAttribute.

See Also

Reference

PostSharp.Serialization Namespace


ImportSerializerAttribute Constructor

Initializes a new ImportSerializerAttribute.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ImportSerializerAttribute(
    Type objectType,
    Type serializerType
)

Parameters

objectType
Type: SystemType
Type of the object to be made serializable.
serializerType
Type: SystemType
Serializer type. This type must implement ISerializer or ISerializerFactory, and must have a public default constructor. If serializerType is a generic type, if must have the same number of generic type parameters as objectType, and have a compatible set of constraints.
See Also

Reference

ImportSerializerAttribute Class
PostSharp.Serialization Namespace
PostSharp.SerializationSerializerAttribute


ImportSerializerAttribute Properties

The ImportSerializerAttribute type exposes the following members.

Properties
 | Name | Description
Public property | ObjectType | Gets the type of the object to be made serializable
Public property | SerializerType | Gets the serializer type.
Top
See Also

Reference

ImportSerializerAttribute Class
PostSharp.Serialization Namespace


ImportSerializerAttribute.ObjectType Property

ImportSerializerAttributeObjectType Property

Gets the type of the object to be made serializable

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Type ObjectType { get; }

Property Value

Type: Type
See Also

Reference

ImportSerializerAttribute Class
PostSharp.Serialization Namespace


ImportSerializerAttribute.SerializerType Property

ImportSerializerAttributeSerializerType Property

Gets the serializer type.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Type SerializerType { get; }

Property Value

Type: Type
Remarks
This type must implement ISerializer or ISerializerFactory, and must have a public default constructor. If SerializerType is a generic type, if must have the same number of generic type parameters as ObjectType, and have a compatible set of constraints.
See Also

Reference

ImportSerializerAttribute Class
PostSharp.Serialization Namespace


ISerializationCallback Interface

Interface that can be implemented by serializable classes. It defines methods OnDeserialized and OnSerializing called during serialization.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ISerializationCallback

The ISerializationCallback type exposes the following members.

Methods
 | Name | Description
Public method | OnDeserialized | Method called after the object has been deserialized.
Public method | OnSerializing | Method called before the object is being serialized.
Top
See Also

Reference

PostSharp.Serialization Namespace


ISerializationCallback Methods

The ISerializationCallback type exposes the following members.

Methods
 | Name | Description
Public method | OnDeserialized | Method called after the object has been deserialized.
Public method | OnSerializing | Method called before the object is being serialized.
Top
See Also

Reference

ISerializationCallback Interface
PostSharp.Serialization Namespace


ISerializationCallback.OnDeserialized Method

ISerializationCallbackOnDeserialized Method

Method called after the object has been deserialized.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void OnDeserialized()
See Also

Reference

ISerializationCallback Interface
PostSharp.Serialization Namespace


ISerializationCallback.OnSerializing Method

ISerializationCallbackOnSerializing Method

Method called before the object is being serialized.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void OnSerializing()
See Also

Reference

ISerializationCallback Interface
PostSharp.Serialization Namespace


ISerializer Interface

Defines the semantics of an object serializer.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ISerializer

The ISerializer type exposes the following members.

Properties
 | Name | Description
Public property | IsTwoPhase | Determines whether DeserializeFields(Object, IArgumentsReader) should be invoked during deserialization. The value is false if CreateInstance(Type, IArgumentsReader) return fully created object, true otherwise.
Top
Methods
 | Name | Description
Public method | Convert | Converts a value into a given target type.
Public method | CreateInstance | Creates an instance of the given type.
Public method | DeserializeFields | Completes the second phase of deserialization by setting fields and other properties.
Public method | SerializeObject | Serializes an object
Top
See Also

Reference

PostSharp.Serialization Namespace


ISerializer Properties

The ISerializer type exposes the following members.

Properties
 | Name | Description
Public property | IsTwoPhase | Determines whether DeserializeFields(Object, IArgumentsReader) should be invoked during deserialization. The value is false if CreateInstance(Type, IArgumentsReader) return fully created object, true otherwise.
Top
See Also

Reference

ISerializer Interface
PostSharp.Serialization Namespace


ISerializer.IsTwoPhase Property

ISerializerIsTwoPhase Property

Determines whether DeserializeFields(Object, IArgumentsReader) should be invoked during deserialization. The value is false if CreateInstance(Type, IArgumentsReader) return fully created object, true otherwise.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
bool IsTwoPhase { get; }

Property Value

Type: Boolean
See Also

Reference

ISerializer Interface
PostSharp.Serialization Namespace


ISerializer Methods

The ISerializer type exposes the following members.

Methods
 | Name | Description
Public method | Convert | Converts a value into a given target type.
Public method | CreateInstance | Creates an instance of the given type.
Public method | DeserializeFields | Completes the second phase of deserialization by setting fields and other properties.
Public method | SerializeObject | Serializes an object
Top
See Also

Reference

ISerializer Interface
PostSharp.Serialization Namespace


ISerializer.Convert Method

ISerializerConvert Method

Converts a value into a given target type.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Object Convert(
    Object value,
    Type targetType
)

Parameters

value
Type: SystemObject
Value to be converted.
targetType
Type: SystemType
target type.

Return Value

Type: Object
The value converted to targetType.
Remarks

This method allows for additional flexibility if the serialization-time type is not equal to the deserialization-time. The current method is invoked at deserialization time to perform the conversion.

See Also

Reference

ISerializer Interface
PostSharp.Serialization Namespace


ISerializer.CreateInstance Method

ISerializerCreateInstance Method

Creates an instance of the given type.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Object CreateInstance(
    Type type,
    IArgumentsReader constructorArguments
)

Parameters

type
Type: SystemType
Type of the instance to be created.
constructorArguments
Type: PostSharp.SerializationIArgumentsReader
Gives access to arguments required to create the instance.

Return Value

Type: Object
An instance of type type initialized using constructorArguments.
Remarks

This method is invoked during deserialization. If IsTwoPhase is true, the DeserializeFields(Object, IArgumentsReader) method is called later to complete deserialization.

See Also

Reference

ISerializer Interface
PostSharp.Serialization Namespace


ISerializer.DeserializeFields Method

ISerializerDeserializeFields Method

Completes the second phase of deserialization by setting fields and other properties.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void DeserializeFields(
    ref Object obj,
    IArgumentsReader initializationArguments
)

Parameters

obj
Type: SystemObject
The object being deserialized.
initializationArguments
Type: PostSharp.SerializationIArgumentsReader
Gives access to field values.
Remarks

This method is only invoked if IsTwoPhase is true.

See Also

Reference

ISerializer Interface
PostSharp.Serialization Namespace


ISerializer.SerializeObject Method

ISerializerSerializeObject Method

Serializes an object

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void SerializeObject(
    Object obj,
    IArgumentsWriter constructorArguments,
    IArgumentsWriter initializationArguments
)

Parameters

obj
Type: SystemObject
constructorArguments
Type: PostSharp.SerializationIArgumentsWriter
Gives access to arguments that will be passed to the CreateInstance(Type, IArgumentsReader) method during deserialization.
initializationArguments
Type: PostSharp.SerializationIArgumentsWriter
Gives access to arguments that will be passed to the DeserializeFields(Object, IArgumentsReader) method during deserialization.
See Also

Reference

ISerializer Interface
PostSharp.Serialization Namespace


ISerializerDiscoverer Interface

Exposes a method that allows implementations of the interface to discover serializer types for each type being serialized.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ISerializerDiscoverer

The ISerializerDiscoverer type exposes the following members.

Methods
 | Name | Description
Public method | DiscoverSerializers | Invoked by once for every type that needs to be serialized, before is invoked.
Top
Remarks
Only implementations of may implement this interface.
See Also

Reference

PostSharp.Serialization Namespace
ISerializerDiscovererDiscoverSerializers(Type)
PostSharp.SerializationISerializerFactoryProvider
PostSharp.SerializationISerializerFactoryProvider
PostSharp.SerializationISerializerFactoryProvider


ISerializerDiscoverer Methods

The ISerializerDiscoverer type exposes the following members.

Methods
 | Name | Description
Public method | DiscoverSerializers | Invoked by once for every type that needs to be serialized, before is invoked.
Top
See Also

Reference

ISerializerDiscoverer Interface
PostSharp.Serialization Namespace


ISerializerDiscoverer.DiscoverSerializers Method

ISerializerDiscovererDiscoverSerializers Method

Invoked by once for every type that needs to be serialized, before is invoked.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
void DiscoverSerializers(
    Type objectType
)

Parameters

objectType
Type: SystemType
Type being serialized.
See Also

Reference

ISerializerDiscoverer Interface
PostSharp.Serialization Namespace
PostSharp.SerializationPortableFormatter
ISerializerFactoryProviderGetSurrogateType(Type)


ISerializerFactory Interface

Defines a method CreateSerializer(Type), which creates instances of the ISerializer interface for given object types.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ISerializerFactory

The ISerializerFactory type exposes the following members.

Methods
 | Name | Description
Public method | CreateSerializer | Creates an instance of the ISerializer interface for a given object type.
Top
See Also

Reference

PostSharp.Serialization Namespace


ISerializerFactory Methods

The ISerializerFactory type exposes the following members.

Methods
 | Name | Description
Public method | CreateSerializer | Creates an instance of the ISerializer interface for a given object type.
Top
See Also

Reference

ISerializerFactory Interface
PostSharp.Serialization Namespace


ISerializerFactory.CreateSerializer Method

ISerializerFactoryCreateSerializer Method

Creates an instance of the ISerializer interface for a given object type.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
ISerializer CreateSerializer(
    Type objectType
)

Parameters

objectType
Type: SystemType
Type of object being serialized or deserialized.

Return Value

Type: ISerializer
A new instance implementing the ISerializer interface.
See Also

Reference

ISerializerFactory Interface
PostSharp.Serialization Namespace


ISerializerFactoryProvider Interface

Provides instances of the ISerializerFactory interface given the object type.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public interface ISerializerFactoryProvider

The ISerializerFactoryProvider type exposes the following members.

Properties
 | Name | Description
Public property | NextProvider | Gets the next provider in the chain.
Top
Methods
 | Name | Description
Public method | GetSerializerFactory | Gets the instance of ISerializerFactory
Public method | GetSurrogateType | Gets the surrogate type for a given object type.
Top
See Also

Reference

PostSharp.Serialization Namespace
PostSharp.SerializationISerializerDiscoverer


ISerializerFactoryProvider Properties

The ISerializerFactoryProvider type exposes the following members.

Properties
 | Name | Description
Public property | NextProvider | Gets the next provider in the chain.
Top
See Also

Reference

ISerializerFactoryProvider Interface
PostSharp.Serialization Namespace


ISerializerFactoryProvider.NextProvider Property

ISerializerFactoryProviderNextProvider Property

Gets the next provider in the chain.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
ISerializerFactoryProvider NextProvider { get; }

Property Value

Type: ISerializerFactoryProvider
See Also

Reference

ISerializerFactoryProvider Interface
PostSharp.Serialization Namespace


ISerializerFactoryProvider Methods

The ISerializerFactoryProvider type exposes the following members.

Methods
 | Name | Description
Public method | GetSerializerFactory | Gets the instance of ISerializerFactory
Public method | GetSurrogateType | Gets the surrogate type for a given object type.
Top
See Also

Reference

ISerializerFactoryProvider Interface
PostSharp.Serialization Namespace


ISerializerFactoryProvider.GetSerializerFactory Method

ISerializerFactoryProviderGetSerializerFactory Method

Gets the instance of ISerializerFactory

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
ISerializerFactory GetSerializerFactory(
    Type objectType
)

Parameters

objectType
Type: SystemType
Type of object being serialized or deserialized. If a surrogate type has been specified during serialization, this parameter is set to the surrogate type during deserialization.

Return Value

Type: ISerializerFactory
An instance of ISerializerFactory able to serialize or deserialize objectType, or null if there is no known serializer factory for this object.
Remarks

It is not the responsibility of this class to call the next provider (NextProvider).

See Also

Reference

ISerializerFactoryProvider Interface
PostSharp.Serialization Namespace


ISerializerFactoryProvider.GetSurrogateType Method

ISerializerFactoryProviderGetSurrogateType Method

Gets the surrogate type for a given object type.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
Type GetSurrogateType(
    Type objectType
)

Parameters

objectType
Type: SystemType
Type of the object being serialized.

Return Value

Type: Type
The surrogate type for objectType, or null (or objectType) is objectType does not require a surrogate type.
Remarks

This method is called only during serialization. The surrogate type is the type whose name will be serialized; therefore, it will also be the type that will be deserialized.

It is not the responsibility of this class to call the next provider (NextProvider).

See Also

Reference

ISerializerFactoryProvider Interface
PostSharp.Serialization Namespace


PNonSerializedAttribute Class

Custom attribute that, when applied to a field of a class annotated with PSerializableAttribute, specifies that this field should not be serialized.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.SerializationPNonSerializedAttribute

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class PNonSerializedAttribute : Attribute

The PNonSerializedAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | PNonSerializedAttribute | Initializes a new instance of the PNonSerializedAttribute class
Top
See Also

Reference

PostSharp.Serialization Namespace

Other Resources

Conceptual: Understanding Aspect Serialization


PNonSerializedAttribute Constructor

Initializes a new instance of the PNonSerializedAttribute class

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public PNonSerializedAttribute()
See Also

Reference

PNonSerializedAttribute Class
PostSharp.Serialization Namespace


PortableFormatter Class

A serializer designed to serialize the internal structure of types with support for cyclic object graphs. The PortableFormatter is very similar in function and design to the BinaryFormatter, but is supported on most platforms and does not require full trust. Both formatters have similar usage: SerializableAttribute is replaced by PSerializableAttribute and NonSerializedAttribute by PNonSerializedAttribute.
Inheritance Hierarchy
SystemObject
PostSharp.SerializationPortableFormatter

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class PortableFormatter

The PortableFormatter type exposes the following members.

Constructors
 | Name | Description
Public method | PortableFormatter | Initializes a new PortableFormatter.
Public method | PortableFormatter(PortableSerializationBinder, ISerializerFactoryProvider) | Initializes a new PortableFormatter.
Top
Properties
 | Name | Description
 | DefaultBinder | Gets the default PortableSerializationBinder that is used by a PortableFormatter to bind types to/from type names if no PortableSerializationBinder is specified.
Public property | MetadataDispenser | When deserializing PostSharp aspects, gets the IMetadataDispenser corresponding to the MetadataEmitter used at build time.
Public property | MetadataEmitter | When serializing PostSharp access, gets or sets a facility that can be used to serialize metadata (System.Reflection) objects as MSIL, therefore making them transparent to obfuscation.
Top
Methods
 | Name | Description
Public method | Deserialize | Deserializes a stream.
Public method | Serialize | Serializes an object (and the complete graph whose this object is the root) into a Stream.
Top
See Also

Reference

PostSharp.Serialization Namespace

Other Resources

Conceptual: Understanding Aspect Serialization
Conceptual: What's New in PostSharp 3.0


PortableFormatter Constructor

Overload List
 | Name | Description
Public method | PortableFormatter | Initializes a new PortableFormatter.
Public method | PortableFormatter(PortableSerializationBinder, ISerializerFactoryProvider) | Initializes a new PortableFormatter.
Top
See Also

Reference

PortableFormatter Class
PostSharp.Serialization Namespace


PortableFormatter Constructor

Initializes a new PortableFormatter.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public PortableFormatter()
See Also

Reference

PortableFormatter Class
PortableFormatter Overload
PostSharp.Serialization Namespace


PortableFormatter Constructor (PortableSerializationBinder, ISerializerFactoryProvider)

Initializes a new PortableFormatter.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public PortableFormatter(
    PortableSerializationBinder binder,
    ISerializerFactoryProvider serializerProvider
)

Parameters

binder
Type: PostSharp.SerializationPortableSerializationBinder
A PortableSerializationBinder customizing bindings between types and type names, or null to use the default implementation.
serializerProvider
Type: PostSharp.SerializationISerializerFactoryProvider
A custom implementation of ISerializerFactoryProvider, or null to use the default implementation.
See Also

Reference

PortableFormatter Class
PortableFormatter Overload
PostSharp.Serialization Namespace


PortableFormatter Properties

The PortableFormatter type exposes the following members.

Properties
 | Name | Description
 | DefaultBinder | Gets the default PortableSerializationBinder that is used by a PortableFormatter to bind types to/from type names if no PortableSerializationBinder is specified.
Public property | MetadataDispenser | When deserializing PostSharp aspects, gets the IMetadataDispenser corresponding to the MetadataEmitter used at build time.
Public property | MetadataEmitter | When serializing PostSharp access, gets or sets a facility that can be used to serialize metadata (System.Reflection) objects as MSIL, therefore making them transparent to obfuscation.
Top
See Also

Reference

PortableFormatter Class
PostSharp.Serialization Namespace


PortableFormatter.DefaultBinder Property

PortableFormatterDefaultBinder Property

Gets the default PortableSerializationBinder that is used by a PortableFormatter to bind types to/from type names if no PortableSerializationBinder is specified.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static PortableSerializationBinder DefaultBinder { get; set; }

Property Value

Type: PortableSerializationBinder
See Also

Reference

PortableFormatter Class
PostSharp.Serialization Namespace


PortableFormatter.MetadataDispenser Property

PortableFormatterMetadataDispenser Property

When deserializing PostSharp aspects, gets the IMetadataDispenser corresponding to the MetadataEmitter used at build time.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IMetadataDispenser MetadataDispenser { get; set; }

Property Value

Type: IMetadataDispenser
See Also

Reference

PortableFormatter Class
PostSharp.Serialization Namespace


PortableFormatter.MetadataEmitter Property

PortableFormatterMetadataEmitter Property

When serializing PostSharp access, gets or sets a facility that can be used to serialize metadata (System.Reflection) objects as MSIL, therefore making them transparent to obfuscation.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public IMetadataEmitter MetadataEmitter { get; set; }

Property Value

Type: IMetadataEmitter
See Also

Reference

PortableFormatter Class
PostSharp.Serialization Namespace


PortableFormatter Methods

The PortableFormatter type exposes the following members.

Methods
 | Name | Description
Public method | Deserialize | Deserializes a stream.
Public method | Serialize | Serializes an object (and the complete graph whose this object is the root) into a Stream.
Top
See Also

Reference

PortableFormatter Class
PostSharp.Serialization Namespace


PortableFormatter.Deserialize Method

PortableFormatterDeserialize Method

Deserializes a stream.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Object Deserialize(
    Stream stream
)

Parameters

stream
Type: System.IOStream
A Stream containing a serialized object graph.

Return Value

Type: Object
The root object of the object graph serialized in stream.
See Also

Reference

PortableFormatter Class
PostSharp.Serialization Namespace


PortableFormatter.Serialize Method

PortableFormatterSerialize Method

Serializes an object (and the complete graph whose this object is the root) into a Stream.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void Serialize(
    Object obj,
    Stream stream
)

Parameters

obj
Type: SystemObject
The object to serialize.
stream
Type: System.IOStream
The stream where obj needs to be serialized.
See Also

Reference

PortableFormatter Class
PostSharp.Serialization Namespace


PortableSerializationBinder Class

Binds types to names and names to types. Used by the PortableFormatter.
Inheritance Hierarchy
SystemObject
PostSharp.SerializationPortableSerializationBinder

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class PortableSerializationBinder

The PortableSerializationBinder type exposes the following members.

Constructors
 | Name | Description
Public method | PortableSerializationBinder | Initializes a new instance of the PortableSerializationBinder class.
Top
Methods
 | Name | Description
Public method | BindToName | Gets the name and the assembly name of a given Type.
Public method | BindToType | Gets a Type given a type name and an assembly name.
Top
See Also

Reference

PostSharp.Serialization Namespace


PortableSerializationBinder Constructor

Initializes a new instance of the PortableSerializationBinder class.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public PortableSerializationBinder()
See Also

Reference

PortableSerializationBinder Class
PostSharp.Serialization Namespace


PortableSerializationBinder Methods

The PortableSerializationBinder type exposes the following members.

Methods
 | Name | Description
Public method | BindToName | Gets the name and the assembly name of a given Type.
Public method | BindToType | Gets a Type given a type name and an assembly name.
Top
See Also

Reference

PortableSerializationBinder Class
PostSharp.Serialization Namespace


PortableSerializationBinder.BindToName Method

PortableSerializationBinderBindToName Method

Gets the name and the assembly name of a given Type.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual void BindToName(
    Type type,
    out string typeName,
    out string assemblyName
)

Parameters

type
Type: SystemType
The Type.
typeName
Type: SystemString
At output, the name of type.
assemblyName
Type: SystemString
At output, the name of assemblyName.
See Also

Reference

PortableSerializationBinder Class
PostSharp.Serialization Namespace


PortableSerializationBinder.BindToType Method

PortableSerializationBinderBindToType Method

Gets a Type given a type name and an assembly name.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual Type BindToType(
    string typeName,
    string assemblyName
)

Parameters

typeName
Type: SystemString
The type name.
assemblyName
Type: SystemString
The assembly name.

Return Value

Type: Type
The required Type.
See Also

Reference

PortableSerializationBinder Class
PostSharp.Serialization Namespace


PortableSerializationException Class

Exception thrown by the PortableFormatter.
Inheritance Hierarchy
SystemObject
SystemException
PostSharp.SerializationPortableSerializationException

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
[SerializableAttribute]
public class PortableSerializationException : Exception
Constructors
 | Name | Description
Public method | PortableSerializationException | Initializes a new PortableSerializationException.
Public method | PortableSerializationException(String) | Initializes a new PortableSerializationException and specifies the message.
Protected method | PortableSerializationException(SerializationInfo, StreamingContext) | Deserialization constructor.
Public method | PortableSerializationException(String, Exception) | Initializes a new PortableSerializationException and specifies the message and inner exception.
Top
See Also

Reference

PostSharp.Serialization Namespace


PortableSerializationException Constructor

Overload List
 | Name | Description
Public method | PortableSerializationException | Initializes a new PortableSerializationException.
Public method | PortableSerializationException(String) | Initializes a new PortableSerializationException and specifies the message.
Protected method | PortableSerializationException(SerializationInfo, StreamingContext) | Deserialization constructor.
Public method | PortableSerializationException(String, Exception) | Initializes a new PortableSerializationException and specifies the message and inner exception.
Top
See Also

Reference

PortableSerializationException Class
PostSharp.Serialization Namespace


PortableSerializationException Constructor

Initializes a new PortableSerializationException.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public PortableSerializationException()
See Also

Reference

PortableSerializationException Class
PortableSerializationException Overload
PostSharp.Serialization Namespace


PortableSerializationException Constructor (String)

Initializes a new PortableSerializationException and specifies the message.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public PortableSerializationException(
    string message
)

Parameters

message
Type: SystemString
Message.
See Also

Reference

PortableSerializationException Class
PortableSerializationException Overload
PostSharp.Serialization Namespace


PortableSerializationException Constructor (SerializationInfo, StreamingContext)

Deserialization constructor.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected PortableSerializationException(
    SerializationInfo info,
    StreamingContext context
)

Parameters

info
Type: System.Runtime.SerializationSerializationInfo
context
Type: System.Runtime.SerializationStreamingContext
See Also

Reference

PortableSerializationException Class
PortableSerializationException Overload
PostSharp.Serialization Namespace


PortableSerializationException Constructor (String, Exception)

Initializes a new PortableSerializationException and specifies the message and inner exception.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public PortableSerializationException(
    string message,
    Exception inner
)

Parameters

message
Type: SystemString
Message.
inner
Type: SystemException
Inner exception.
See Also

Reference

PortableSerializationException Class
PortableSerializationException Overload
PostSharp.Serialization Namespace


PSerializableAttribute Class

Custom attribute that, when applied to a type, causes PostSharp to generate a serializer for use by the PortableFormatter.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.ExtensibilityMulticastAttribute
PostSharp.SerializationPSerializableAttribute

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class PSerializableAttribute : MulticastAttribute,
    IAspect

The PSerializableAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | PSerializableAttribute | Initializes a new instance of the PSerializableAttribute class
Top
Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Top
Remarks

Fields that should not be serialized must be annotated with PNonSerializedAttribute.

This class inherits from MulticastAttribute, so it is possible to use multicasting to add this aspect to several classes using a single line, or to add this aspect to derived classes through inheritance.

See Also

Reference

PostSharp.Serialization Namespace
PostSharp.SerializationPortableFormatter

Other Resources

Conceptual: Handling Exceptions
Conceptual: Injecting Behaviors Before and After Method Execution
Conceptual: Intercepting Events
Conceptual: Intercepting Methods
Conceptual: Intercepting Properties and Fields
Conceptual: Introducing Interfaces, Methods, Properties and Events into Existing Classes
Conceptual: Semantic Advising of Iterator and Async Methods
Conceptual: Understanding Aspect Lifetime and Scope
Conceptual: Understanding Aspect Serialization
Conceptual: Upgrading from a Previous Version of PostSharp


PSerializableAttribute Constructor

Initializes a new instance of the PSerializableAttribute class

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public PSerializableAttribute()
See Also

Reference

PSerializableAttribute Class
PostSharp.Serialization Namespace


PSerializableAttribute Properties

The PSerializableAttribute type exposes the following members.

Properties
 | Name | Description
Public property | AttributeExclude | If true, indicates that this attribute removes all other instances of the same attribute type from the set of elements defined by the current instance. (Inherited from MulticastAttribute.)
Public property | AttributeInheritance | Determines whether this attribute is inherited (Inherited from MulticastAttribute.)
Public property | AttributePriority | Gets or sets the priority of the current attribute in case that multiple instances are defined on the same element (lower values are processed before). (Inherited from MulticastAttribute.)
Public property | AttributeReplace | Determines whether this attribute replaces other attributes found on the target declarations. (Inherited from MulticastAttribute.)
Public property | AttributeTargetAssemblies | Gets or sets the assemblies to which the current attribute apply. (Inherited from MulticastAttribute.)
Public property | AttributeTargetElements | Gets or sets the kind of elements to which this custom attributes applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies, when the member is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetExternalTypeAttributes | Gets or sets the visibilities of types to which this attribute applies, when this type is external to the current module. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMemberAttributes | Gets or sets the visibilities, scopes, virtualities, and implementation of members to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetMembers | Gets or sets the expression specifying to which members this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameterAttributes | Gets or sets the passing style (by value, out or ref) of parameters to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetParameters | Gets or sets the expression specifying to which parameters this instance applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypeAttributes | Gets or sets the visibilities of types to which this attribute applies. (Inherited from MulticastAttribute.)
Public property | AttributeTargetTypes | Gets or sets the expression specifying to which types this instance applies. (Inherited from MulticastAttribute.)
Top
See Also

Reference

PSerializableAttribute Class
PostSharp.Serialization Namespace


ReferenceTypeSerializer Class

Base serializer for all reference types.
Inheritance Hierarchy
SystemObject
PostSharp.SerializationReferenceTypeSerializer

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class ReferenceTypeSerializer : ISerializer

The ReferenceTypeSerializer type exposes the following members.

Constructors
 | Name | Description
Protected method | ReferenceTypeSerializer | Initializes a new instance of the ReferenceTypeSerializer class
Top
Methods
 | Name | Description
Public method | Convert | Converts a value into a given target type.
Public method | CreateInstance | Creates an instance of the given type.
Public method | DeserializeFields | Completes the second phase of deserialization by setting fields and other properties.
Public method | SerializeObject | Serializes an object
Top
Remarks
This type is intentionally non-generic because it is intended to be derived several times, making strong typing less convenient.
See Also

Reference

PostSharp.Serialization Namespace


ReferenceTypeSerializer Constructor

Initializes a new instance of the ReferenceTypeSerializer class

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected ReferenceTypeSerializer()
See Also

Reference

ReferenceTypeSerializer Class
PostSharp.Serialization Namespace


ReferenceTypeSerializer Methods

The ReferenceTypeSerializer type exposes the following members.

Methods
 | Name | Description
Public method | Convert | Converts a value into a given target type.
Public method | CreateInstance | Creates an instance of the given type.
Public method | DeserializeFields | Completes the second phase of deserialization by setting fields and other properties.
Public method | SerializeObject | Serializes an object
Top
See Also

Reference

ReferenceTypeSerializer Class
PostSharp.Serialization Namespace


ReferenceTypeSerializer.Convert Method

ReferenceTypeSerializerConvert Method

Converts a value into a given target type.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual Object Convert(
    Object value,
    Type targetType
)

Parameters

value
Type: SystemObject
Value to be converted.
targetType
Type: SystemType
target type.

Return Value

Type: Object
The value converted to targetType.

Implements

ISerializerConvert(Object, Type)
Remarks

This method allows for additional flexibility if the serialization-time type is not equal to the deserialization-time. The current method is invoked at deserialization time to perform the conversion.

See Also

Reference

ReferenceTypeSerializer Class
PostSharp.Serialization Namespace


ReferenceTypeSerializer.CreateInstance Method

ReferenceTypeSerializerCreateInstance Method

Creates an instance of the given type.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract Object CreateInstance(
    Type type,
    IArgumentsReader constructorArguments
)

Parameters

type
Type: SystemType
Type of the instance to be created.
constructorArguments
Type: PostSharp.SerializationIArgumentsReader
Gives access to arguments required to create the instance.

Return Value

Type: Object
An instance of type type initialized using constructorArguments.

Implements

ISerializerCreateInstance(Type, IArgumentsReader)
See Also

Reference

ReferenceTypeSerializer Class
PostSharp.Serialization Namespace


ReferenceTypeSerializer.DeserializeFields Method

ReferenceTypeSerializerDeserializeFields Method

Completes the second phase of deserialization by setting fields and other properties.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract void DeserializeFields(
    Object obj,
    IArgumentsReader initializationArguments
)

Parameters

obj
Type: SystemObject
The object being deserialized.
initializationArguments
Type: PostSharp.SerializationIArgumentsReader
Gives access to field values.
See Also

Reference

ReferenceTypeSerializer Class
PostSharp.Serialization Namespace


ReferenceTypeSerializer.SerializeObject Method

ReferenceTypeSerializerSerializeObject Method

Serializes an object

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract void SerializeObject(
    Object obj,
    IArgumentsWriter constructorArguments,
    IArgumentsWriter initializationArguments
)

Parameters

obj
Type: SystemObject
constructorArguments
Type: PostSharp.SerializationIArgumentsWriter
Gives access to arguments that will be passed to the CreateInstance(Type, IArgumentsReader) method during deserialization.
initializationArguments
Type: PostSharp.SerializationIArgumentsWriter
Gives access to arguments that will be passed to the DeserializeFields(Object, IArgumentsReader) method during deserialization.
See Also

Reference

ReferenceTypeSerializer Class
PostSharp.Serialization Namespace


SerializationServices Class

Provides some utility method for the current namespace.
Inheritance Hierarchy
SystemObject
PostSharp.SerializationSerializationServices

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static class SerializationServices
Methods
Name | Description
GetSerializationException(MemberInfo) | Checks whether a given MethodInfo, ConstructorInfo, FieldInfo, PropertyInfo, EventInfo or Type can be safely serialized.
GetSerializationException(ParameterInfo) | Checks whether a given ParameterInfo can be safely serialized.
GetSerializationException(LocationInfo) | Checks whether a given LocationInfo can be safely serialized.
Top
See Also

Reference

PostSharp.Serialization Namespace


SerializationServices Methods

Methods
Name | Description
GetSerializationException(MemberInfo) | Checks whether a given MethodInfo, ConstructorInfo, FieldInfo, PropertyInfo, EventInfo or Type can be safely serialized.
GetSerializationException(ParameterInfo) | Checks whether a given ParameterInfo can be safely serialized.
GetSerializationException(LocationInfo) | Checks whether a given LocationInfo can be safely serialized.
Top
See Also

Reference

SerializationServices Class
PostSharp.Serialization Namespace


SerializationServices.GetSerializationException Method

SerializationServicesGetSerializationException Method

Overload List
Name | Description
GetSerializationException(MemberInfo) | Checks whether a given MethodInfo, ConstructorInfo, FieldInfo, PropertyInfo, EventInfo or Type can be safely serialized.
GetSerializationException(ParameterInfo) | Checks whether a given ParameterInfo can be safely serialized.
GetSerializationException(LocationInfo) | Checks whether a given LocationInfo can be safely serialized.
Top
See Also

Reference

SerializationServices Class
PostSharp.Serialization Namespace


SerializationServices.GetSerializationException Method (MemberInfo)

SerializationServicesGetSerializationException Method (MemberInfo)

Checks whether a given MethodInfo, ConstructorInfo, FieldInfo, PropertyInfo, EventInfo or Type can be safely serialized.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static PortableSerializationException GetSerializationException(
    MemberInfo memberInfo
)

Parameters

memberInfo
Type: System.ReflectionMemberInfo
The declaration to be serialized.

Return Value

Type: PortableSerializationException
null if memberInfo can be safely serialized, otherwise an exception where the text describes the reason why the declaration is not serializable.
See Also

Reference

SerializationServices Class
GetSerializationException Overload
PostSharp.Serialization Namespace


SerializationServices.GetSerializationException Method (ParameterInfo)

SerializationServicesGetSerializationException Method (ParameterInfo)

Checks whether a given ParameterInfo can be safely serialized.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static PortableSerializationException GetSerializationException(
    ParameterInfo parameterInfo
)

Parameters

parameterInfo
Type: System.ReflectionParameterInfo
The declaration to be serialized.

Return Value

Type: PortableSerializationException
null if parameterInfo can be safely serialized, otherwise an exception where the text describes the reason why the declaration is not serializable.
See Also

Reference

SerializationServices Class
GetSerializationException Overload
PostSharp.Serialization Namespace


SerializationServices.GetSerializationException Method (LocationInfo)

SerializationServicesGetSerializationException Method (LocationInfo)

Checks whether a given LocationInfo can be safely serialized.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static PortableSerializationException GetSerializationException(
    LocationInfo locationInfo
)

Parameters

locationInfo
Type: PostSharp.ReflectionLocationInfo
The declaration to be serialized.

Return Value

Type: PortableSerializationException
null if locationInfo can be safely serialized, otherwise an exception where the text describes the reason why the declaration is not serializable.
See Also

Reference

SerializationServices Class
GetSerializationException Overload
PostSharp.Serialization Namespace


SerializerAttribute Class

Custom attribute that, when applied to a type, specifies its serializer for use by the PortableFormatter.
Inheritance Hierarchy
SystemObject
SystemAttribute
PostSharp.SerializationSerializerAttribute

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public sealed class SerializerAttribute : Attribute

The SerializerAttribute type exposes the following members.

Constructors
 | Name | Description
Public method | SerializerAttribute | Initializes a new SerializerAttribute.
Top
Properties
 | Name | Description
Public property | SerializerType | Gets the serializer type.
Top
Remarks

The use of the SerializerAttribute is optional if the serializer of a type is a nested class of that class named Serializer.

Windows Phone 7.0 does not allow to assign generic types to parameters of custom attributes.

See Also

Reference

PostSharp.Serialization Namespace
PostSharp.SerializationImportSerializerAttribute


SerializerAttribute Constructor

Initializes a new SerializerAttribute.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SerializerAttribute(
    Type serializerType
)

Parameters

serializerType
Type: SystemType
Serializer type. This type must implement ISerializer or ISerializerFactory, and must have a public default constructor. If serializerType is a generic type, if must have the same number of generic type parameters as the target type, and have a compatible set of constraints.
See Also

Reference

SerializerAttribute Class
PostSharp.Serialization Namespace


SerializerAttribute Properties

The SerializerAttribute type exposes the following members.

Properties
 | Name | Description
Public property | SerializerType | Gets the serializer type.
Top
See Also

Reference

SerializerAttribute Class
PostSharp.Serialization Namespace


SerializerAttribute.SerializerType Property

SerializerAttributeSerializerType Property

Gets the serializer type.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public Type SerializerType { get; }

Property Value

Type: Type
Remarks
This type must implement ISerializer or ISerializerFactory, and must have a public default constructor. If SerializerType is a generic type, if must have the same number of generic type parameters as the target type, and have a compatible set of constraints.
See Also

Reference

SerializerAttribute Class
PostSharp.Serialization Namespace


SerializerFactoryProvider Class

Provides instances of the ISerializerFactory interface for object types that have been previously registered using AddSerializer(Type, Type).
Inheritance Hierarchy
SystemObject
PostSharp.SerializationSerializerFactoryProvider

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public class SerializerFactoryProvider : ISerializerFactoryProvider

The SerializerFactoryProvider type exposes the following members.

Constructors
 | Name | Description
Public method | SerializerFactoryProvider | Initializes a new SerializerFactoryProvider.
Top
Properties
 | Name | Description
Public property | NextProvider | Gets the next provider in the chain.
Top
Methods
 | Name | Description
Public method | AddSerializer(Type, Type) | Maps an object type to a serializer type.
Public method | AddSerializerObjectType, SerializerType | Maps an object type to a serializer type (using generic type parameters).
Public method | GetSerializerFactory | Gets the instance of ISerializerFactory
Public method | GetSurrogateType | Gets the surrogate type for a given object type.
Public method | MakeReadOnly | Forbids further changes in the current SerializerFactoryProvider.
Top
Fields
Name | Description
BuiltIn | Gets the SerializerFactoryProvider instance that supports built-in types.
Top
See Also

Reference

PostSharp.Serialization Namespace


SerializerFactoryProvider Constructor

Initializes a new SerializerFactoryProvider.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public SerializerFactoryProvider(
    ISerializerFactoryProvider nextProvider,
    ActivatorProvider activatorProvider
)

Parameters

nextProvider
Type: PostSharp.SerializationISerializerFactoryProvider
The next provider in the chain, or null if there is none.
activatorProvider
Type: PostSharp.SerializationActivatorProvider
See Also

Reference

SerializerFactoryProvider Class
PostSharp.Serialization Namespace


SerializerFactoryProvider Properties

The SerializerFactoryProvider type exposes the following members.

Properties
 | Name | Description
Public property | NextProvider | Gets the next provider in the chain.
Top
See Also

Reference

SerializerFactoryProvider Class
PostSharp.Serialization Namespace


SerializerFactoryProvider.NextProvider Property

SerializerFactoryProviderNextProvider Property

Gets the next provider in the chain.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public ISerializerFactoryProvider NextProvider { get; }

Property Value

Type: ISerializerFactoryProvider

Implements

ISerializerFactoryProviderNextProvider
See Also

Reference

SerializerFactoryProvider Class
PostSharp.Serialization Namespace


SerializerFactoryProvider Methods

The SerializerFactoryProvider type exposes the following members.

Methods
 | Name | Description
Public method | AddSerializer(Type, Type) | Maps an object type to a serializer type.
Public method | AddSerializerObjectType, SerializerType | Maps an object type to a serializer type (using generic type parameters).
Public method | GetSerializerFactory | Gets the instance of ISerializerFactory
Public method | GetSurrogateType | Gets the surrogate type for a given object type.
Public method | MakeReadOnly | Forbids further changes in the current SerializerFactoryProvider.
Top
See Also

Reference

SerializerFactoryProvider Class
PostSharp.Serialization Namespace


SerializerFactoryProvider.AddSerializer Method

SerializerFactoryProviderAddSerializer Method

Overload List
 | Name | Description
Public method | AddSerializerObjectType, SerializerType | Maps an object type to a serializer type (using generic type parameters).
Public method | AddSerializer(Type, Type) | Maps an object type to a serializer type.
Top
See Also

Reference

SerializerFactoryProvider Class
PostSharp.Serialization Namespace


SerializerFactoryProvider.AddSerializer(ObjectType, SerializerType) Method

SerializerFactoryProviderAddSerializerObjectType, SerializerType Method

Maps an object type to a serializer type (using generic type parameters).

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void AddSerializer<ObjectType, SerializerType>()
where SerializerType : new(), ISerializer

Type Parameters

ObjectType
Type of the serialized object.
SerializerType
Type of the serializer.
See Also

Reference

SerializerFactoryProvider Class
AddSerializer Overload
PostSharp.Serialization Namespace


SerializerFactoryProvider.AddSerializer Method (Type, Type)

SerializerFactoryProviderAddSerializer Method (Type, Type)

Maps an object type to a serializer type.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void AddSerializer(
    Type objectType,
    Type serializerType
)

Parameters

objectType
Type: SystemType
Type of the serialized object.
serializerType
Type: SystemType
Type of the serializer (must be derived from ISerializer).
See Also

Reference

SerializerFactoryProvider Class
AddSerializer Overload
PostSharp.Serialization Namespace


SerializerFactoryProvider.GetSerializerFactory Method

SerializerFactoryProviderGetSerializerFactory Method

Gets the instance of ISerializerFactory

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual ISerializerFactory GetSerializerFactory(
    Type objectType
)

Parameters

objectType
Type: SystemType
Type of object being serialized or deserialized. If a surrogate type has been specified during serialization, this parameter is set to the surrogate type during deserialization.

Return Value

Type: ISerializerFactory
An instance of ISerializerFactory able to serialize or deserialize objectType, or null if there is no known serializer factory for this object.

Implements

ISerializerFactoryProviderGetSerializerFactory(Type)
Remarks

It is not the responsibility of this class to call the next provider (NextProvider).

See Also

Reference

SerializerFactoryProvider Class
PostSharp.Serialization Namespace


SerializerFactoryProvider.GetSurrogateType Method

SerializerFactoryProviderGetSurrogateType Method

Gets the surrogate type for a given object type.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual Type GetSurrogateType(
    Type objectType
)

Parameters

objectType
Type: SystemType
Type of the object being serialized.

Return Value

Type: Type
The surrogate type for objectType, or null (or objectType) is objectType does not require a surrogate type.

Implements

ISerializerFactoryProviderGetSurrogateType(Type)
Remarks

This method is called only during serialization. The surrogate type is the type whose name will be serialized; therefore, it will also be the type that will be deserialized.

It is not the responsibility of this class to call the next provider (NextProvider).

See Also

Reference

SerializerFactoryProvider Class
PostSharp.Serialization Namespace


SerializerFactoryProvider.MakeReadOnly Method

SerializerFactoryProviderMakeReadOnly Method

Forbids further changes in the current SerializerFactoryProvider.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public void MakeReadOnly()
See Also

Reference

SerializerFactoryProvider Class
PostSharp.Serialization Namespace


SerializerFactoryProvider Fields

The SerializerFactoryProvider type exposes the following members.

Fields
Name | Description
BuiltIn | Gets the SerializerFactoryProvider instance that supports built-in types.
Top
See Also

Reference

SerializerFactoryProvider Class
PostSharp.Serialization Namespace


SerializerFactoryProvider.BuiltIn Field

SerializerFactoryProviderBuiltIn Field

Gets the SerializerFactoryProvider instance that supports built-in types.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public static readonly SerializerFactoryProvider BuiltIn

Field Value

Type: SerializerFactoryProvider
See Also

Reference

SerializerFactoryProvider Class
PostSharp.Serialization Namespace


ValueTypeSerializer(T) Class

ValueTypeSerializerT Class

Base serializer for all value types.
Inheritance Hierarchy
SystemObject
PostSharp.SerializationValueTypeSerializerT

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract class ValueTypeSerializer<T> : ISerializer
where T : struct, new()

Type Parameters

T

The ValueTypeSerializerT type exposes the following members.

Constructors
 | Name | Description
Protected method | ValueTypeSerializerT | Initializes a new instance of the ValueTypeSerializerT class
Top
Methods
 | Name | Description
Public method | Convert | Converts a value into a given target type.
Public method | DeserializeObject | Creates an instance of the given type.
Public method | SerializeObject | Serializes an object
Top
See Also

Reference

PostSharp.Serialization Namespace


ValueTypeSerializer(T) Constructor

ValueTypeSerializerT Constructor

Initializes a new instance of the ValueTypeSerializerT class

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
protected ValueTypeSerializer()
See Also

Reference

ValueTypeSerializerT Class
PostSharp.Serialization Namespace


ValueTypeSerializer(T) Methods

ValueTypeSerializerT Methods

The ValueTypeSerializerT generic type exposes the following members.

Methods
 | Name | Description
Public method | Convert | Converts a value into a given target type.
Public method | DeserializeObject | Creates an instance of the given type.
Public method | SerializeObject | Serializes an object
Top
See Also

Reference

ValueTypeSerializerT Class
PostSharp.Serialization Namespace


ValueTypeSerializer(T).Convert Method

ValueTypeSerializerTConvert Method

Converts a value into a given target type.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public virtual Object Convert(
    Object value,
    Type targetType
)

Parameters

value
Type: SystemObject
Value to be converted.
targetType
Type: SystemType
target type.

Return Value

Type: Object
The value converted to targetType.

Implements

ISerializerConvert(Object, Type)
Remarks

This method allows for additional flexibility if the serialization-time type is not equal to the deserialization-time. The current method is invoked at deserialization time to perform the conversion.

See Also

Reference

ValueTypeSerializerT Class
PostSharp.Serialization Namespace


ValueTypeSerializer(T).DeserializeObject Method

ValueTypeSerializerTDeserializeObject Method

Creates an instance of the given type.

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract T DeserializeObject(
    IArgumentsReader constructorArguments
)

Parameters

constructorArguments
Type: PostSharp.SerializationIArgumentsReader
Gives access to arguments required to create the instance.

Return Value

Type: T
An instance of type T initialized using constructorArguments.
See Also

Reference

ValueTypeSerializerT Class
PostSharp.Serialization Namespace


ValueTypeSerializer(T).SerializeObject Method

ValueTypeSerializerTSerializeObject Method

Serializes an object

Namespace: PostSharp.Serialization
Assembly: PostSharp (in PostSharp.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
Copy
public abstract void SerializeObject(
    T obj,
    IArgumentsWriter constructorArguments
)

Parameters

obj
Type: T
constructorArguments
Type: PostSharp.SerializationIArgumentsWriter
Gives access to arguments that will be passed to the DeserializeObject(IArgumentsReader) method during deserialization.
See Also

Reference

ValueTypeSerializerT Class
PostSharp.Serialization Namespace


Reducing Build Time

Although we're working hard at PostSharp to provide fast builds by default, there are a few actions you can take to further improve the performance of your build.

Chapter | Description
Enabling Solution-Wide Build | This section describes how to decrease build time by enabling whole-solution build.


Installing PostSharp Unattended

PostSharp is composed of a user interface (PostSharp Tools for Visual Studio) and build components (NuGet packages). NuGet packages are usually checked into source control or retrieved from a package repository at build time (see Restoring Packages at Build Time), so its deployment does not require additional automation. The user interface is typically installed by each user. It does not require administrative privileges.

Caution note Caution

The PostSharp user interface requires NuGet Package Manager 2.2, which is not installed by default with Visual Studio. Installing NuGet requires administrative privileges on the local machine.

You can install PostSharp automatically for a large number of users using a script.

To install PostSharp on a machine:

  1. Ensure that NuGet 2.2 is installed. Your script will need to look for a file named NuGet.Core.dll under the following directories. The search should include up to 2 levels of subdirectories.

    • C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensions for Visual Studio 2010.

    • C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions for Visual Studio 2012.

  2. If NuGet 2.2 is not installed, install it with the command line VsixInstaller.exe /q NuGet.Tools.vsix. This command requires administrative privileges on the local machine. The current version of NuGet.Tools.vsix can be downloaded from Visual Studio Gallery. Note that PostSharp is tested with versions that are current at the time of writing. If you need to be able to restore a working development environment several years from now, it is a good idea to archive a version of NuGet that is known to work with your version of PostSharp.

  3. Execute command line VsixInstaller.exe /q PostSharp-VERSION.vsix. The file can be downloaded from Visual Studio Gallery. Exit codes other than 0 or 1001 should be considered as errors.

  4. Install the license key or the license server URL in the registry key HKEY_CURRENT_USER\Software\SharpCrafters\PostSharp 3, registry value LicenseKey (type REG_SZ).

This procedure can be automated by the following PowerShell 2.0 script:

Copy
# TODO: Set the right value for the following variables
$postsharpFile = "PostSharp-3.0.14-beta.vsix"   # Replace with the proper version number and add the full path.
$nugetFile = "NuGet.Tools.vsix"                 # Add the full path.
$license = "XXXX-XXXXXXXXXXXXXXXXXXXXXXXXX"     # Replace by your license key or license server URL.

$installNuget = $false

# Check NuGet in Visual Studio 2010.
if ( Test-Path "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" )
{

    $vsixInstaller = "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\VsixInstaller.exe"

    $nugetVs10Path = dir "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensions" -Include "NuGet.Core.dll" -Recurse | select -First 1

    if ( $nugetVs10Path -eq $null )
    {
        $installNuget = $true
    }
    else
    {
        $nugetVs10Version = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($nugetVs10Path)
        Write-Host "Detected NuGet" $nugetVs10Version.FileVersion "for Visual Studio 2010."
        if ( $nugetVs10Version.FileMajorPart -lt 2 -or $nugetVs10Version.FileMinorPart -lt 1 )
        {
            $installNuget = $true;
        }
    }
}

# Check NuGet in Visual Studio 2012.
if ( Test-Path "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe" )
{

    $vsixInstaller = "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\VsixInstaller.exe"
    $nugetVs11Path = dir "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions" -Include "NuGet.Core.dll" -Recurse | select -First 1

    if ( $nugetVs11Path -eq $null )
    {
        $installNuget = $true
    }
    else
    {
        $nugetVs11Version = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($nugetVs10Path)
        Write-Host "Detected NuGet"  $nugetVs11Version.FileVersion "for Visual Studio 2012."
        if ( $nugetVs11Version.FileMajorPart -lt 2 -or $nugetVs11Version.FileMinorPart -lt 1 )
        {
            $installNuget = $true;
        }
    }
}

if ( -not ( Test-Path $vsixInstaller) )
{
    Write-Host "Cannot find " $vsixInstaller
    exit
}

# Install NuGet
if ( $installNuget )
{
    Write-Host "Installing NuGet"
    $process = Start-Process -FilePath  $vsixInstaller -ArgumentList @("/q", $nugetFile) -Wait -Verb runas  -PassThru
    if ( $process.ExitCode -ne 0 -and $process.ExitCode -ne 1001)
    {
        Write-Host "Error: VsixInstaller exited with code" $process.ExitCode -ForegroundColor Red
    }
}

# Install PostSharp
Write-Host "Installing PostSharp"
$process = Start-Process -FilePath $vsixInstaller -ArgumentList @("/q", $postsharpFile) -Wait -PassThru
if ( $process.ExitCode -ne 0 -and $process.ExitCode -ne 1001)
{
    Write-Host "Error: VsixInstaller exited with code" $process.ExitCode -ForegroundColor Red
}

# Install the license key
Write-Host "Installing the license key"
$regPath = "HKCU:\Software\SharpCrafters\PostSharp 3"

if ( -not ( Test-Path $regPath ) )
{
    New-Item -Path $regPath | Out-Null
}

Set-ItemProperty -Path $regPath -Name "LicenseKey" -Value $license

Write-Host "Done"


Enabling Solution-Wide Build

Important note Important

This feature is temporarily disabled.

By default, PostSharp processes each project in its own AppDomain. The overhead of creating a new AppDomain for each project is quite large: not the new AppDomain has to be loaded, but all assembly references need to be loaded and indexed over and over again.

This overhead can be dramatically reduced by enabling solution-wide build. When this option is enabled, PostSharp will reuse the AppDomains as much as possible. By enabling solution-wide build, you can make PostSharp 1.5 to 2 times faster.

This topic contains the following sections:

  • Differences of solution-wide build
  • Enabling solution-wide build
Differences of solution-wide build

Before you enable solution-wide build, you should check that your custom aspects do not depend on characteristics that differ between the default (project-wide) build and the solution-wide build. These differences are the following:

  • Static variables are shared between several projects instead of being local to a single project. Make sure that the build-time logic of your aspect does not store information in static fields. Replace static fields with accesses to PostSharpEnvironment.CurrentProject.StateStore, which provides a project-scoped state store. See IProjectStateStore and IStateStore for details.

  • When you reflect dependent assemblies using System.Reflection, you may randomly get the pre-PostSharp or post-PostSharp binary assembly. Do not rely on the fact that you get any of these variants of the assembly.

  • Assembly binding redirections are computed for the whole solution (or sub-solution) instead of the sole project. For a specific project, it can happen that you will get a higher version of a reference assembly in solution-wide build than in project-wide build.

Caution note Caution

The set of projects processed in the same AppDomain and the order of processing should be considered random.

Enabling solution-wide build
Caution note Caution

Solution-wide build is an experimental feature. If it does not work for you, please report the issue to PostSharp support and disable the feature.

To enable solution-wide build for a solution:

  1. In Solution Explorer, right-click on the solution node, and select Properties.

  2. Select the PostSharp tab under Common Properties.

  3. Check the check box Enable solution-wide build optimizations.

    The PostSharp property page in the Visual Studio solution properties dialog.
    Solution Wide Build

As a result, PostSharp will attempt to reuse AppDomains when building this solution from Visual Studio. The setting is stored in a file named MySolution.pssln in the same directory as MySolution.sln.

Note Note

Solution-wide build only works when the build is triggered by Visual Studio. Command-line builds are not affected.

Tip Tip

PostSharp needs to create at least one AppDomain per specific version of the target framework. To optimize the AppDomain reuse and therefore build time, make sure to consolidate the target framework versions of your projects.