RhoMicro.CodeAnalysis.CopyToGenerator 15.1.7

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

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

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 113 7/15/2024
15.1.6 96 6/11/2024
15.1.5 162 3/26/2024
15.1.4 139 3/26/2024
15.1.3 155 3/11/2024
15.1.2 136 3/8/2024
15.1.1 174 3/4/2024
15.1.0 124 2/28/2024
15.0.1 172 2/22/2024
15.0.0 165 2/20/2024
14.0.5 128 2/19/2024
14.0.4 150 2/19/2024
14.0.3 129 2/19/2024
14.0.2 150 2/15/2024
14.0.0 142 2/15/2024
14.0.0-alpha.30 54 2/15/2024
14.0.0-alpha.29 54 2/15/2024
14.0.0-alpha.28 54 2/15/2024
14.0.0-alpha.27 52 2/15/2024
14.0.0-alpha.26 59 2/15/2024
14.0.0-alpha.25 54 2/15/2024
14.0.0-alpha.24 52 2/15/2024
14.0.0-alpha.22 56 2/15/2024
14.0.0-alpha.20 58 2/15/2024
8.0.3 279 12/11/2023
8.0.2 181 12/11/2023
8.0.0 159 12/11/2023
2.0.0 180 11/29/2023