RhoMicro.CodeAnalysis.CopyToGenerator 20.1.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 20.1.2
                    
NuGet\Install-Package RhoMicro.CodeAnalysis.CopyToGenerator -Version 20.1.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="20.1.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="20.1.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 20.1.2
                    
#r "nuget: RhoMicro.CodeAnalysis.CopyToGenerator, 20.1.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@20.1.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=20.1.2
                    
Install as a Cake Addin
#tool nuget:?package=RhoMicro.CodeAnalysis.CopyToGenerator&version=20.1.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.1 34 7/12/2025
21.1.2 134 6/25/2025
21.1.0 134 6/25/2025
21.0.6 130 6/24/2025
20.1.5 152 5/22/2025
20.1.4 118 5/17/2025
20.1.2 145 5/11/2025
20.0.0 483 3/26/2025
19.5.0 498 3/25/2025
19.4.0 157 3/17/2025
19.3.0 154 3/17/2025
19.2.0 154 3/17/2025
19.1.0 185 3/9/2025
19.0.2 185 3/9/2025
19.0.1 144 3/8/2025
19.0.0 159 3/8/2025
18.0.3 109 3/2/2025
18.0.2 102 3/2/2025
18.0.1 111 3/2/2025
17.1.3 112 1/24/2025
17.1.2 123 12/30/2024
17.1.1 103 12/30/2024
17.1.0 116 12/30/2024
17.0.2 121 12/24/2024
16.1.2 116 12/22/2024
16.1.1 115 12/21/2024
16.1.0 138 12/20/2024
16.0.4 124 12/18/2024
16.0.3 121 12/18/2024
16.0.0 107 12/18/2024
15.3.4 116 12/7/2024
15.3.3 120 12/7/2024
15.3.2 126 12/7/2024
15.3.1 127 12/7/2024
15.3.0 129 12/6/2024
15.2.4 118 12/6/2024
15.2.3 118 12/6/2024
15.1.7 153 7/15/2024
15.1.6 142 6/11/2024
15.1.5 187 3/26/2024
15.1.4 164 3/26/2024
15.1.3 191 3/11/2024
15.1.2 171 3/8/2024
15.1.1 202 3/4/2024
15.1.0 149 2/28/2024
15.0.1 208 2/22/2024
15.0.0 209 2/20/2024
14.0.5 160 2/19/2024
14.0.4 182 2/19/2024
14.0.3 159 2/19/2024
14.0.2 183 2/15/2024
14.0.0 171 2/15/2024
14.0.0-alpha.30 69 2/15/2024
14.0.0-alpha.29 78 2/15/2024
14.0.0-alpha.28 70 2/15/2024
14.0.0-alpha.27 66 2/15/2024
14.0.0-alpha.26 80 2/15/2024
14.0.0-alpha.25 73 2/15/2024
14.0.0-alpha.24 81 2/15/2024
14.0.0-alpha.22 77 2/15/2024
14.0.0-alpha.20 75 2/15/2024
8.0.3 302 12/11/2023
8.0.2 205 12/11/2023
8.0.0 181 12/11/2023
2.0.0 208 11/29/2023