RhoMicro.CodeAnalysis.CopyToGenerator 22.0.2

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package RhoMicro.CodeAnalysis.CopyToGenerator --version 22.0.2
                    
NuGet\Install-Package RhoMicro.CodeAnalysis.CopyToGenerator -Version 22.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="RhoMicro.CodeAnalysis.CopyToGenerator" Version="22.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.
<PackageVersion Include="RhoMicro.CodeAnalysis.CopyToGenerator" Version="22.0.2" />
                    
Directory.Packages.props
<PackageReference Include="RhoMicro.CodeAnalysis.CopyToGenerator">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add RhoMicro.CodeAnalysis.CopyToGenerator --version 22.0.2
                    
#r "nuget: RhoMicro.CodeAnalysis.CopyToGenerator, 22.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.
#:package RhoMicro.CodeAnalysis.CopyToGenerator@22.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=RhoMicro.CodeAnalysis.CopyToGenerator&version=22.0.2
                    
Install as a Cake Addin
#tool nuget:?package=RhoMicro.CodeAnalysis.CopyToGenerator&version=22.0.2
                    
Install as a Cake Tool

RhoMicro.CopyTo

This source code generator for C# generates a CopyTo method for copying the contents of public get/set properties from one instance to another.

How To Use

Annotate your type with the GenerateCopyTo Attribute found in the RhoMicro.CodeAnalysis.CopyToGenerator namespace:

using RhoMicro.GenerateCopyToGenerator;

[GenerateCopyTo]
partial class MyType
{
    public String Prop1 { get; set; }
    public Int32 Prop2 { get; set; }
}

The generator will generate a partial implementation like this:

partial class MyType
{
    public void CopyTo(MyType target)
    {
        target.Prop1 = Prop1;
        target.Prop2 = Prop2;
    }
}

Features And Restrictions

The generator is able to copy:

  • other copyable types
  • instances of List<T>, IEnumerable<T>, ICollection<T>, IList<T>, IReadOnlyCollection<T> or IReadOnlyList<T> whose item type is also copyable
  • using assignment for all other properties

The generator is limited to:

  • public read/write properties
  • reference types
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

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
22.0.3 170 8/20/2025
22.0.2 167 8/20/2025
22.0.1 142 7/12/2025
21.1.2 178 6/25/2025
21.1.0 178 6/25/2025
21.0.6 172 6/24/2025
20.1.5 211 5/22/2025
20.1.4 161 5/17/2025
20.1.2 187 5/11/2025
20.0.0 526 3/26/2025
19.5.0 550 3/25/2025
19.4.0 213 3/17/2025
19.3.0 197 3/17/2025
19.2.0 196 3/17/2025
19.1.0 224 3/9/2025
19.0.2 246 3/9/2025
19.0.1 203 3/8/2025
19.0.0 205 3/8/2025
18.0.3 150 3/2/2025
18.0.2 141 3/2/2025
18.0.1 147 3/2/2025
17.1.3 149 1/24/2025
17.1.2 161 12/30/2024
17.1.1 142 12/30/2024
17.1.0 153 12/30/2024
17.0.2 175 12/24/2024
16.1.2 166 12/22/2024
16.1.1 155 12/21/2024
16.1.0 191 12/20/2024
16.0.4 175 12/18/2024
16.0.3 158 12/18/2024
16.0.0 144 12/18/2024
15.3.4 155 12/7/2024
15.3.3 159 12/7/2024
15.3.2 179 12/7/2024
15.3.1 166 12/7/2024
15.3.0 166 12/6/2024
15.2.4 160 12/6/2024
15.2.3 154 12/6/2024
15.1.7 188 7/15/2024
15.1.6 195 6/11/2024
15.1.5 224 3/26/2024
15.1.4 199 3/26/2024
15.1.3 247 3/11/2024
15.1.2 220 3/8/2024
15.1.1 240 3/4/2024
15.1.0 183 2/28/2024
15.0.1 261 2/22/2024
15.0.0 243 2/20/2024
14.0.5 196 2/19/2024
14.0.4 221 2/19/2024
14.0.3 196 2/19/2024
14.0.2 220 2/15/2024
14.0.0 212 2/15/2024
14.0.0-alpha.30 79 2/15/2024
14.0.0-alpha.29 104 2/15/2024
14.0.0-alpha.28 96 2/15/2024
14.0.0-alpha.27 76 2/15/2024
14.0.0-alpha.26 92 2/15/2024
14.0.0-alpha.25 83 2/15/2024
14.0.0-alpha.24 102 2/15/2024
14.0.0-alpha.22 89 2/15/2024
14.0.0-alpha.20 83 2/15/2024
8.0.3 338 12/11/2023
8.0.2 241 12/11/2023
8.0.0 216 12/11/2023
2.0.0 259 11/29/2023