RhoMicro.CodeAnalysis.CopyToGenerator 22.0.1

Prefix Reserved
dotnet add package RhoMicro.CodeAnalysis.CopyToGenerator --version 22.0.1
                    
NuGet\Install-Package RhoMicro.CodeAnalysis.CopyToGenerator -Version 22.0.1
                    
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.1">
  <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.1" />
                    
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.1
                    
#r "nuget: RhoMicro.CodeAnalysis.CopyToGenerator, 22.0.1"
                    
#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.1
                    
#: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.1
                    
Install as a Cake Addin
#tool nuget:?package=RhoMicro.CodeAnalysis.CopyToGenerator&version=22.0.1
                    
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 99 7/12/2025
21.1.2 140 6/25/2025
21.1.0 139 6/25/2025
21.0.6 134 6/24/2025
20.1.5 158 5/22/2025
20.1.4 121 5/17/2025
20.1.2 149 5/11/2025
20.0.0 487 3/26/2025
19.5.0 502 3/25/2025
19.4.0 163 3/17/2025
19.3.0 157 3/17/2025
19.2.0 157 3/17/2025
19.1.0 188 3/9/2025
19.0.2 190 3/9/2025
19.0.1 150 3/8/2025
19.0.0 162 3/8/2025
18.0.3 112 3/2/2025
18.0.2 105 3/2/2025
18.0.1 114 3/2/2025
17.1.3 114 1/24/2025
17.1.2 125 12/30/2024
17.1.1 106 12/30/2024
17.1.0 118 12/30/2024
17.0.2 127 12/24/2024
16.1.2 119 12/22/2024
16.1.1 119 12/21/2024
16.1.0 141 12/20/2024
16.0.4 127 12/18/2024
16.0.3 123 12/18/2024
16.0.0 109 12/18/2024
15.3.4 119 12/7/2024
15.3.3 122 12/7/2024
15.3.2 130 12/7/2024
15.3.1 129 12/7/2024
15.3.0 131 12/6/2024
15.2.4 120 12/6/2024
15.2.3 120 12/6/2024
15.1.7 155 7/15/2024
15.1.6 146 6/11/2024
15.1.5 189 3/26/2024
15.1.4 166 3/26/2024
15.1.3 195 3/11/2024
15.1.2 174 3/8/2024
15.1.1 204 3/4/2024
15.1.0 151 2/28/2024
15.0.1 211 2/22/2024
15.0.0 211 2/20/2024
14.0.5 163 2/19/2024
14.0.4 184 2/19/2024
14.0.3 161 2/19/2024
14.0.2 185 2/15/2024
14.0.0 178 2/15/2024
14.0.0-alpha.30 71 2/15/2024
14.0.0-alpha.29 80 2/15/2024
14.0.0-alpha.28 74 2/15/2024
14.0.0-alpha.27 68 2/15/2024
14.0.0-alpha.26 82 2/15/2024
14.0.0-alpha.25 76 2/15/2024
14.0.0-alpha.24 83 2/15/2024
14.0.0-alpha.22 79 2/15/2024
14.0.0-alpha.20 77 2/15/2024
8.0.3 304 12/11/2023
8.0.2 207 12/11/2023
8.0.0 183 12/11/2023
2.0.0 211 11/29/2023