Skip to content
This repository has been archived by the owner on Feb 8, 2023. It is now read-only.

postsharp/Metalama.Open.Virtuosity

Repository files navigation

Metalama.Open.Virtuosity

Allows you to make all target methods virtual without adding the virtual keyword to every one of them.

This is a Metalama aspect. It modifies your code during compilation by using source weaving.

CI badge

Example

Your code:

class A 
{
  public void M1() { }
  protected void M2() { }
  private void M3() { }
}

What gets compiled:

class A 
{
  public virtual void M1() { }
  protected virtual void M2() { }
  private void M3() { }
}

Installation

  1. Install the NuGet package: dotnet add package Metalama.Open.Virtuosity.

  2. Apply the aspect to the project by adding the following attribute to some C# file:

    [assembly: Metalama.Open.Virtuosity.VirtuosityAspect]

How to use

By annotating an assembly with [VirtuosityAspect], you make all methods virtual (except those that can't be virtual, like static and private methods and methods on structs).

For more details, see Details.

About

A Metalama weaver that makes all methods virtual.

Resources

License

Stars

Watchers

Forks

Packages

No packages published