RhoMicro.CodeAnalysis.CopyToGenerator 16.0.4

There is a newer version of this package available.
See the version list below for details.
dotnet add package RhoMicro.CodeAnalysis.CopyToGenerator --version 16.0.4                
NuGet\Install-Package RhoMicro.CodeAnalysis.CopyToGenerator -Version 16.0.4                
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="16.0.4">
  <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.
paket add RhoMicro.CodeAnalysis.CopyToGenerator --version 16.0.4                
#r "nuget: RhoMicro.CodeAnalysis.CopyToGenerator, 16.0.4"                
#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 RhoMicro.CodeAnalysis.CopyToGenerator as a Cake Addin
#addin nuget:?package=RhoMicro.CodeAnalysis.CopyToGenerator&version=16.0.4

// Install RhoMicro.CodeAnalysis.CopyToGenerator as a Cake Tool
#tool nuget:?package=RhoMicro.CodeAnalysis.CopyToGenerator&version=16.0.4                

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
17.0.2 59 12/24/2024
16.1.2 67 12/22/2024
16.1.1 71 12/21/2024
16.1.0 66 12/20/2024
16.0.4 68 12/18/2024
16.0.3 76 12/18/2024
16.0.0 64 12/18/2024
15.3.4 71 12/7/2024
15.3.3 77 12/7/2024
15.3.2 81 12/7/2024
15.3.1 87 12/7/2024
15.3.0 91 12/6/2024
15.2.4 75 12/6/2024
15.2.3 77 12/6/2024
15.1.7 123 7/15/2024
15.1.6 101 6/11/2024
15.1.5 165 3/26/2024
15.1.4 142 3/26/2024
15.1.3 158 3/11/2024
15.1.2 143 3/8/2024
15.1.1 179 3/4/2024
15.1.0 127 2/28/2024
15.0.1 175 2/22/2024
15.0.0 168 2/20/2024
14.0.5 131 2/19/2024
14.0.4 153 2/19/2024
14.0.3 132 2/19/2024
14.0.2 153 2/15/2024
14.0.0 145 2/15/2024
14.0.0-alpha.30 55 2/15/2024
14.0.0-alpha.29 55 2/15/2024
14.0.0-alpha.28 55 2/15/2024
14.0.0-alpha.27 53 2/15/2024
14.0.0-alpha.26 62 2/15/2024
14.0.0-alpha.25 55 2/15/2024
14.0.0-alpha.24 53 2/15/2024
14.0.0-alpha.22 59 2/15/2024
14.0.0-alpha.20 59 2/15/2024
8.0.3 282 12/11/2023
8.0.2 184 12/11/2023
8.0.0 162 12/11/2023
2.0.0 183 11/29/2023