-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
72 additions
and
16 deletions.
There are no files selected for viewing
16 changes: 0 additions & 16 deletions
16
src/core-taggeds-optional/Optional/Optional.T/Optional.T.Contains.cs
This file was deleted.
Oops, something went wrong.
48 changes: 48 additions & 0 deletions
48
src/core-taggeds-optional/Optional/Optional.T/Optional.T.Equality.Contains.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace System; | ||
|
||
partial struct Optional<T> | ||
{ | ||
// TODO: Add the tests and open the methods/operators | ||
|
||
internal bool Contains(T value, IEqualityComparer<T>? comparer) | ||
=> | ||
InnerContains(value, comparer ?? EqualityComparer<T>.Default); | ||
|
||
internal bool Contains(T value) | ||
=> | ||
InnerContains(value, EqualityComparer<T>.Default); | ||
|
||
internal static bool Equals(Optional<T> left, T right, IEqualityComparer<T>? comparer) | ||
=> | ||
left.Contains(right, comparer); | ||
|
||
internal static bool Equals(Optional<T> left, T right) | ||
=> | ||
left.Contains(right); | ||
|
||
//public static bool operator ==(Optional<T> left, T right) | ||
// => | ||
// left.Contains(right); | ||
|
||
//public static bool operator !=(Optional<T> left, T right) | ||
// => | ||
// left.Contains(right) is not true; | ||
|
||
internal static bool Equals(T left, Optional<T> right, IEqualityComparer<T>? comparer) | ||
=> | ||
right.Contains(left, comparer); | ||
|
||
internal static bool Equals(T left, Optional<T> right) | ||
=> | ||
right.Contains(left); | ||
|
||
//public static bool operator ==(T left, Optional<T> right) | ||
// => | ||
// right.Contains(left); | ||
|
||
//public static bool operator !=(T left, Optional<T> right) | ||
// => | ||
// right.Contains(left) is not true; | ||
} |
24 changes: 24 additions & 0 deletions
24
src/core-taggeds-optional/Optional/Optional/Optional.Equality.Contains.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace System; | ||
|
||
partial class Optional | ||
{ | ||
// TODO: Add the tests and open the methods | ||
|
||
internal static bool Equals<T>(Optional<T> left, T right, IEqualityComparer<T>? comparer) | ||
=> | ||
left.Contains(right, comparer); | ||
|
||
internal static bool Equals<T>(Optional<T> left, T right) | ||
=> | ||
left.Contains(right); | ||
|
||
internal static bool Equals<T>(T left, Optional<T> right, IEqualityComparer<T>? comparer) | ||
=> | ||
right.Contains(left, comparer); | ||
|
||
internal static bool Equals<T>(T left, Optional<T> right) | ||
=> | ||
right.Contains(left); | ||
} |