Coppier 1.0.0
dotnet add package Coppier --version 1.0.0
NuGet\Install-Package Coppier -Version 1.0.0
<PackageReference Include="Coppier" Version="1.0.0" />
paket add Coppier --version 1.0.0
#r "nuget: Coppier, 1.0.0"
// Install Coppier as a Cake Addin
#addin nuget:?package=Coppier&version=1.0.0
// Install Coppier as a Cake Tool
#tool nuget:?package=Coppier&version=1.0.0
Coppier
Introduction
This library provides utility methods for copying or cloning objects in C#. Whether you need a shallow copy or a deep copy, this library aims to simplify the process.
- Coppier helps you copy data from one object structure to another.
- It’s useful when decoupling your application into different layers or modules.
- Coppier supports conventions and handles complex mapping scenarios.
- Consider using it to simplify data copying between models
Installation
Using NuGet Package Manager:
- Open your project in Visual Studio.
- Go to Tools > NuGet Package Manager > Manage NuGet Packages for Solution.
- Search for "Coppier" and install it.
Manual Installation:
- Download the Coppier library from NuGet.
- Add the reference to your project.
Approach
An approach is to use AutoMapper, a library designed to solve the complex problem of mapping one object to another. It can be used for deep copying as well. First, install the AutoMapper NuGet package. Then, create a mapping configuration and use it to copy properties from one object to another.
Example
//two different object .
public class CopyFrom
{
public string Property1 { get; set; }
public int Property2 { get; set; }
public int Property3 { get; set; }
}
public class CopyTo
{
public string Property1 { get; set; }
public int Property2 { get; set; }
}
// Copy from one object to another
IClassMapper mapper = new ClassMapper();
CopyTo copyToObject = mapper.Convert<CopyFrom, CopyTo>(copyFromObject);
Contributing
Feel free to contribute to this library by submitting pull requests or reporting issues on the GitHub repository.
License
This library is released under the MIT License. See the LICENSE file for details.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- No dependencies.
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 |
---|---|---|
1.0.0 | 91 | 4/27/2024 |