Skip to content

2A5F/Coplt.RAII

Repository files navigation

Coplt.RAII

.NET Nuget

Disable copying of structures

Currently, dispose check is not supported,
it is recommended to use jetbrains [MustDisposeResource]

Example

using Coplt.RAII;

[RAII]
public struct Foo
{
    // Any method, usually using Copy and Move
    public Foo Copy() => default;
    public Foo Move() => default;
}

var a = new Foo();

var b = a.Copy(); // ok
var b = a.Move(); // ok

var b = a; // err
// Error RAII0001: Copying RAII struct Foo is not allowed, try calling a method that returns Foo to get a copy

Todo

  • EqualsValueClauseSyntax
  • ArgumentSyntax
  • other expr

Releases

No releases published

Packages

No packages published

Languages