Tedd.ReadOnlyStructGenerator 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Tedd.ReadOnlyStructGenerator --version 1.0.0                
NuGet\Install-Package Tedd.ReadOnlyStructGenerator -Version 1.0.0                
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="Tedd.ReadOnlyStructGenerator" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Tedd.ReadOnlyStructGenerator --version 1.0.0                
#r "nuget: Tedd.ReadOnlyStructGenerator, 1.0.0"                
#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 Tedd.ReadOnlyStructGenerator as a Cake Addin
#addin nuget:?package=Tedd.ReadOnlyStructGenerator&version=1.0.0

// Install Tedd.ReadOnlyStructGenerator as a Cake Tool
#tool nuget:?package=Tedd.ReadOnlyStructGenerator&version=1.0.0                

Tedd.ReadOnlyStructGenerator

.NET Source Generator for duplicating structs to read-only copies.

Adding [GenerateReadOnlyStruct] to a struct like this

[GenerateReadOnlyStruct]
public struct Test
{
    public float X;
    public float Y;
    public float Z;
}

will inject this code into your project

public readonly struct ReadOnlyTest
{
    public readonly float X;
    public readonly float Y;
    public readonly float Z;
    public ReadOnlyTest(Test value)
    {
        X = value.X;
        Y = value.Y;
        Z = value.Z;
    }
    
	public ReadOnlyTest(float x, float y, float z)
	{
    	this.X = x;
	    this.Y = y;
	    this.Z = z;
	}
}
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
1.0.6 1,034 12/30/2022
1.0.5 1,014 12/30/2022
1.0.4 1,057 12/28/2022
1.0.3 1,081 12/27/2022
1.0.1 1,129 12/27/2022
1.0.0 941 12/26/2022

Initial release.