privatelike 0.0.1
See the version list below for details.
dotnet add package privatelike --version 0.0.1
NuGet\Install-Package privatelike -Version 0.0.1
<PackageReference Include="privatelike" Version="0.0.1"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add privatelike --version 0.0.1
#r "nuget: privatelike, 0.0.1"
// Install privatelike as a Cake Addin #addin nuget:?package=privatelike&version=0.0.1 // Install privatelike as a Cake Tool #tool nuget:?package=privatelike&version=0.0.1
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 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.
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.