You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Starting in 2.0.0, you can also declare the attribute at the assembly level:
126
+
Starting in 2.0.0, you can also use `[TargetAutoDeconstruct]` at the assembly level:
126
127
127
128
```c#
128
129
usingAutoDeconstruct;
129
130
130
-
[assembly: AutoDeconstruct(typeof(Person))]
131
+
[assembly: TargetAutoDeconstruct(typeof(Person))]
131
132
132
133
namespaceModels;
133
134
@@ -148,7 +149,7 @@ You can target other types from other assemblies if you'd like:
148
149
usingAutoDeconstruct;
149
150
usingSystem;
150
151
151
-
[assembly: AutoDeconstruct(typeof(Guid))]
152
+
[assembly: TargetAutoDeconstruct(typeof(Guid))]
152
153
153
154
// ...
154
155
varid=Guid.NewGuid();
@@ -158,4 +159,40 @@ var (variant, version) = id;
158
159
Take care in creating deconstructors to types you don't own. For example, in the case of `Guid`, getting just the `Variant` and `Version` values aren't extremely helpful.
159
160
160
161
> [!WARNING]
161
-
> If you add `[AutoDeconstruct]` to a type, and use `[TargetAutoDeconstruct]` targeting that same type, you will get a compilation error as a duplicate extension method will be made.
162
+
> If you add `[AutoDeconstruct]` to a type, and use `[TargetAutoDeconstruct]` targeting that same type, you will get a compilation error as a duplicate extension method will be made.
163
+
164
+
### Filtering Properties
165
+
166
+
Starting with 3.0.0, AutoDeconstruct lets you specify properties that you want to either include or exclude in the generated `Deconstruct()` method. This is useful if you are inheriting from a type that has numerous properties that you do not want for deconstruction. Here's how it works (note that this also works with `[TargetAutoDeconstruct]`):
0 commit comments