privatelike 0.0.2

This package has a SemVer 2.0.0 package version: 0.0.2+9410c0179e880cb5a679196890df5625e95fad06.
dotnet add package privatelike --version 0.0.2
NuGet\Install-Package privatelike -Version 0.0.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="privatelike" Version="0.0.2">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add privatelike --version 0.0.2
#r "nuget: privatelike, 0.0.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install privatelike as a Cake Addin
#addin nuget:?package=privatelike&version=0.0.2

// Install privatelike as a Cake Tool
#tool nuget:?package=privatelike&version=0.0.2

What is it? 🚀

privatelike provides an attribute, generator and analyzer to declare "private-like" types in C# (internal but producing errors if not used as if they were declared as private). This can be used to still enforce the same acessibility as using the private keyword in scenarios where types actually still need to be accessible from elsewhere in the assembly. For instance, this is the case for some source generators (eg. the COM generators, or the ones from ComputeSharp). Using the [privatelike] attribute can make things simpler in this scenario: the source generators can just suppress the errors, but the rest of the code will not, and should avoid referencing these types incorrectly.

How to use it 📖

Simply declare a type as follows:

[privatelike] partial struct MyPrivateLikeType
{  
}

The type will end up using internal, but referencing it from a place where it would've been an error if it had been using private will result in an error as well.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.0.2 138 12/17/2023
0.0.1 53 12/17/2023