-
Notifications
You must be signed in to change notification settings - Fork 731
Closed
Labels
api-approvedAPI was approved, it can be implementedAPI was approved, it can be implemented
Description
Background and motivation
A shortcut to options.Excluding(mi => mi.Type == typeof(TimeSpan));
API Proposal
public abstract class SelfReferenceEquivalencyAssertionOptions<TSelf> : IEquivalencyOptions
where TSelf : SelfReferenceEquivalencyAssertionOptions<TSelf>
{
public TSelf Excluding<TMember>()
{
}
}Also supports excluding all members whose type is assignable to IMyInterface
options.Excluding<IMyInterface>();
And excludeing all members whose type is a closed generic of Nullable<T>, i.e. it excludes int?, double?, etc.
options.Excluding(typeof(Nullable<>))
API Usage
Instead of options.Excluding(mi => mi.Type == typeof(TimeSpan));, you can do options.Excluding<TimeSpan>()
Alternative Designs
Maybe name it ExcludingMembersOfType<T>
Risks
No response
Are you willing to help with a proof-of-concept (as PR in that or a separate repo) first and as pull-request later on?
No
Copilot
Metadata
Metadata
Assignees
Labels
api-approvedAPI was approved, it can be implementedAPI was approved, it can be implemented