DeepCopy
Simple & efficient library for deep copying .NET objects
Install / Use
/learn @ReubenBond/DeepCopyREADME
DeepCopy
Simple & efficient library for deep copying .NET objects
Described in this blog post: https://reubenbond.github.io/posts/codegen-2-il-boogaloo
Installation:
Install via NuGet:
PM> Install-Package DeepCopy
Usage:
// Add a using directive for DeepCopy.
var poco = new Poco();
var original = new[] { poco, poco };
var result = DeepCopier.Copy(original);
// The result is a copy of the original.
Assert.NotSame(original, result);
// Because both elements in the original array point to the same object,
// both elements in the copied array also point to the same object.
Assert.Same(result[0], result[1]);
Optionally, classes can be marked using the [Immutable] attribute to tell DeepCopy to skip copying them and return them unmodified.
Object can also be wrapped in Immutable<T> using Immutable.Create(value).
The majority of this project was adapted from dotnet/orleans.
PR's welcome!
Related Skills
node-connect
346.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
107.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
346.8kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
346.8kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
