-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/identification #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
22f4ebe
b36907d
5895fd3
a9cf41f
29d0405
fddf54f
195492c
5922df0
440b7c6
b09393b
b0057c2
47a1c63
d6ac42d
95b0345
f852bcc
030e9c9
f0435ed
cee067e
c4f8bc9
a2d7da5
3e995cd
bc626b0
24b80be
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -162,13 +162,13 @@ public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator() | |
| public override int GetHashCode() | ||
| { | ||
| #if NETSTANDARD2_0_OR_GREATER || NET6_0_OR_GREATER | ||
| if (this.inner == null) | ||
| if (this.Count == 0) | ||
| { | ||
| return 0; | ||
| } | ||
|
|
||
| var hashCode = default(HashCode); | ||
| foreach (var pair in this.inner) | ||
| foreach (var pair in this.inner!) | ||
| { | ||
| hashCode.Add(pair.Key); | ||
| hashCode.Add(pair.Value); | ||
|
|
@@ -186,7 +186,7 @@ static int CombineHashCode(int hashCode1, int hashcode2) | |
| } | ||
| } | ||
|
|
||
| return this.inner == default ? 0 : Equality.Equality.GetItemsHashCode(this.inner.Select(x => CombineHashCode(x.Key?.GetHashCode() ?? 0, x.Value?.GetHashCode() ?? 0))); | ||
| return this.Count == 0 ? 0 : Equality.Equality.GetItemsHashCode(this.inner!.Select(x => CombineHashCode(x.Key?.GetHashCode() ?? 0, x.Value?.GetHashCode() ?? 0))); | ||
|
|
||
| #endif | ||
| } | ||
|
|
@@ -198,6 +198,11 @@ static int CombineHashCode(int hashCode1, int hashcode2) | |
| /// <returns><c>true</c>, if the values are equal otherwise false.</returns> | ||
| public bool Equals(ValueDictionary<TKey, TValue> other) | ||
| { | ||
| if (this.Count == 0 && other.Count == 0) | ||
| { | ||
| return true; | ||
|
Comment on lines
199
to
+203
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @copilot apply changes based on this feedback
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Already fixed in d6ac42d — |
||
| } | ||
|
|
||
| if (this.inner == null) | ||
| { | ||
| if (other.inner == null) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -133,20 +133,20 @@ public IEnumerator<TItem> GetEnumerator() | |
| public override int GetHashCode() | ||
| { | ||
| #if NETSTANDARD2_0_OR_GREATER || NET6_0_OR_GREATER | ||
| if (this.inner == null) | ||
| if (this.Count == 0) | ||
| { | ||
| return 0; | ||
| } | ||
|
|
||
| var hashCode = default(HashCode); | ||
| foreach (var item in this.inner) | ||
| foreach (var item in this.inner!) | ||
| { | ||
| hashCode.Add(item?.GetHashCode() ?? 0); | ||
| } | ||
|
|
||
| return hashCode.ToHashCode(); | ||
| #else | ||
| return this.inner == default ? 0 : Equality.Equality.GetItemsHashCode(this.inner.Select(x => x?.GetHashCode() ?? 0)); | ||
| return this.Count == 0 ? 0 : Equality.Equality.GetItemsHashCode(this.inner!.Select(x => x?.GetHashCode() ?? 0)); | ||
|
|
||
| #endif | ||
| } | ||
|
|
@@ -158,6 +158,11 @@ public override int GetHashCode() | |
| /// <returns><c>true</c>, if the values are equal otherwise false.</returns> | ||
| public bool Equals(ValueList<TItem> other) | ||
| { | ||
| if (this.Count == 0 && other.Count == 0) | ||
| { | ||
| return true; | ||
|
Comment on lines
159
to
+163
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @copilot apply changes based on this feedback
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in d6ac42d. Updated |
||
| } | ||
|
|
||
| if (this.inner == null) | ||
| { | ||
| if (other.inner == null) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot apply changes based on this feedback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already fixed in d6ac42d —
GetHashCode()forValueArraynow returns0whenCount == 0, consistent with the equality rule.