RhoMicro.CodeAnalysis.CopyToGenerator 15.1.5

dotnet add package RhoMicro.CodeAnalysis.CopyToGenerator --version 15.1.5
NuGet\Install-Package RhoMicro.CodeAnalysis.CopyToGenerator -Version 15.1.5
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.5">
  <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.5
#r "nuget: RhoMicro.CodeAnalysis.CopyToGenerator, 15.1.5"
#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.5

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

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.5 105 3/26/2024
15.1.4 83 3/26/2024
15.1.3 93 3/11/2024
15.1.2 77 3/8/2024
15.1.1 108 3/4/2024
15.1.0 68 2/28/2024
15.0.1 117 2/22/2024
15.0.0 115 2/20/2024
14.0.5 73 2/19/2024
14.0.4 97 2/19/2024
14.0.3 75 2/19/2024
14.0.2 99 2/15/2024
14.0.0 90 2/15/2024
14.0.0-alpha.30 41 2/15/2024
14.0.0-alpha.29 40 2/15/2024
14.0.0-alpha.28 41 2/15/2024
14.0.0-alpha.27 39 2/15/2024
14.0.0-alpha.26 45 2/15/2024
14.0.0-alpha.25 42 2/15/2024
14.0.0-alpha.24 41 2/15/2024
14.0.0-alpha.22 43 2/15/2024
14.0.0-alpha.20 44 2/15/2024
8.0.3 227 12/11/2023
8.0.2 130 12/11/2023
8.0.0 108 12/11/2023
2.0.0 127 11/29/2023