-
-
Notifications
You must be signed in to change notification settings - Fork 17
Added == and != operator overloads to IpAddress
#310
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
Added == and != operator overloads to IpAddress
#310
Conversation
MrCSharp22
left a comment
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.
Great improvement. Looks good to me. Thank you!
|
Interestingly, we are ahead of .NET!! 🤩 |
== and != operator overloads== and != operator overloads to IpAddress
|
On Sonarcloud bug: I get their point and it makes sense. Looking at the code, there is no major calculation going on with generating the hashcode, so we're probably good with dropping the _hash field and simple compute the hash when needed. |
I can't see the error now because workflow is re-running but I assume it was something along the lines of "non-readonly field used in GetHashCode" as Resharper gave me the same warning. I was copying the pattern I saw in the .NET full implementation here. They are doing slightly more work but I think this is also a case of "maximum optimization" as no work is better than some work in a method like That being said I don't have any objections to removing the field and calculating every time so I'll leave it up to you. |
- Also rename params to match .NET implementation.
|
That's exactly the same complain, yes. |
Ellerbach
left a comment
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.
Stupid question: who will this play with the larger PR opened by @AdrianSoundy which also touches this?
Shall we wait a bit for the larger one to go and then have this one?
@josesimoes , any thoughts as well? (I know you want to add as well on this one)
Not stupid at all! It makes sense to have #309 merged first as the merge into this one will be smoother, if not automatic. |
|
@CoryCharlton |
|
@AdrianSoundy @josesimoes I merged in the latest changes and think we should be good to go with this. There were several other changes Resharper was recommending to me (switching to var, auto properties, naming [ie: scopeid to scopeId], etc.) but I left them out to not make this change more complicated than it needs to be. |
|
@CoryCharlton you did well. PRs need to be atomic. Not good adding other changes, even tiny/random fixes, code style improvements, etc. |
nanoFramework.System.Net/NetworkInformation/NetworkInterface.cs
Outdated
Show resolved
Hide resolved
josesimoes
left a comment
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.
LGTM. Thanks for this improvement.
|
@CoryCharlton I think there is an issue. IPAddress ip = default
if( ip == default)
{
// Should be true but it's not!
}IPAddress ip = null
if( ip == null)
{
// Should be true but it's not!
} |
|
@Ellerbach I'll take a look in a bit, should be a simple fix. In the meantime using the |
|
@josesimoes / @Ellerbach fixed in #311 |
Description
Added
==and!=operator overloadsMotivation and Context
There is existing code that does not use the Equals method so this will fix that.
How Has This Been Tested?
On device
Screenshots
Types of changes
Checklist: