RhoMicro.CodeAnalysis.CopyToGenerator 15.1.3

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

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

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
15.1.7 109 7/15/2024
15.1.6 94 6/11/2024
15.1.5 160 3/26/2024
15.1.4 137 3/26/2024
15.1.3 151 3/11/2024
15.1.2 134 3/8/2024
15.1.1 170 3/4/2024
15.1.0 122 2/28/2024
15.0.1 168 2/22/2024
15.0.0 163 2/20/2024
14.0.5 126 2/19/2024
14.0.4 148 2/19/2024
14.0.3 127 2/19/2024
14.0.2 148 2/15/2024
14.0.0 140 2/15/2024
14.0.0-alpha.30 52 2/15/2024
14.0.0-alpha.29 52 2/15/2024
14.0.0-alpha.28 52 2/15/2024
14.0.0-alpha.27 50 2/15/2024
14.0.0-alpha.26 57 2/15/2024
14.0.0-alpha.25 52 2/15/2024
14.0.0-alpha.24 50 2/15/2024
14.0.0-alpha.22 54 2/15/2024
14.0.0-alpha.20 56 2/15/2024
8.0.3 277 12/11/2023
8.0.2 179 12/11/2023
8.0.0 157 12/11/2023
2.0.0 178 11/29/2023