https://github.com/jasonbock/autodeconstruct
A library that automatically adds support for object deconstruction in C#.
https://github.com/jasonbock/autodeconstruct
Last synced: 8 months ago
JSON representation
A library that automatically adds support for object deconstruction in C#.
- Host: GitHub
- URL: https://github.com/jasonbock/autodeconstruct
- Owner: JasonBock
- License: mit
- Created: 2021-11-29T14:44:14.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-02-04T20:16:09.000Z (almost 3 years ago)
- Last Synced: 2024-10-04T02:53:41.934Z (about 1 year ago)
- Language: C#
- Size: 79.1 KB
- Stars: 34
- Watchers: 3
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: changelog.md
- License: LICENSE
Awesome Lists containing this project
- RSCG_Examples - https://github.com/jasonbock/autodeconstruct
README
# AutoDeconstruct
A library that automatically adds support for object deconstruction in C#.
## Getting Started
First, reference the `AutoDeconstruct` [NuGet package](https://www.nuget.org/packages/AutoDeconstruct).
Then, add `[AutoDeconstuct]` to a type so you can deconstruct it:
```c#
using AutoDeconstruct;
[AutoDeconstruct]
public sealed class Person
{
public uint Age { get; set; }
public required string Name { get; set; }
}
var person = new Person { Age = 22, Name = "Joe" };
var (age, name) = person;
```
Read [the overview document](https://github.com/JasonBock/AutoDeconstruct/blob/main/docs/Overview.md) for further details.
### Prerequisites
The Rocks package targets .NET Standard 2.0 for host flexibility.