RhoMicro.CodeAnalysis.CopyToGenerator
24.1.0
Prefix Reserved
dotnet add package RhoMicro.CodeAnalysis.CopyToGenerator --version 24.1.0
NuGet\Install-Package RhoMicro.CodeAnalysis.CopyToGenerator -Version 24.1.0
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="24.1.0"> <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="24.1.0" />
<PackageReference Include="RhoMicro.CodeAnalysis.CopyToGenerator"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
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 24.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: RhoMicro.CodeAnalysis.CopyToGenerator, 24.1.0"
#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@24.1.0
#: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=24.1.0
#tool nuget:?package=RhoMicro.CodeAnalysis.CopyToGenerator&version=24.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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>orIReadOnlyList<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.
-
.NETStandard 2.0
- Microsoft.CodeAnalysis.CSharp (>= 4.12.0)
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 |
|---|---|---|
| 24.1.0 | 91 | 1/26/2026 |
| 24.0.0 | 93 | 1/22/2026 |
| 23.2.2 | 98 | 1/4/2026 |
| 23.2.1 | 92 | 1/4/2026 |
| 23.1.0 | 162 | 12/21/2025 |
| 23.0.0 | 156 | 12/21/2025 |
| 22.0.3 | 210 | 8/20/2025 |
| 22.0.2 | 200 | 8/20/2025 |
| 22.0.1 | 171 | 7/12/2025 |
| 21.1.2 | 209 | 6/25/2025 |
| 21.1.0 | 207 | 6/25/2025 |
| 21.0.6 | 201 | 6/24/2025 |
| 20.1.5 | 246 | 5/22/2025 |
| 20.1.4 | 188 | 5/17/2025 |
| 20.1.2 | 216 | 5/11/2025 |
| 20.0.0 | 555 | 3/26/2025 |
| 19.5.0 | 581 | 3/25/2025 |
| 19.4.0 | 244 | 3/17/2025 |
| 19.3.0 | 222 | 3/17/2025 |
| 19.2.0 | 226 | 3/17/2025 |
Loading failed