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
I have a couple of questions that I would be happy if you like to answer, I can probably figure out the answers myself, but if you have the time and opportunity to answer, I would prefer that.
This looks a bit strange, should it be like this?
public static bool operator <(MXRecord record1, MXRecord record2)
{
if (record1.Preference > record2.Preference) return false;
return false;
}
public static bool operator >(MXRecord record1, MXRecord record2)
{
if (record1.Preference < record2.Preference) return false;
return false;
}
Maybe 'other' never can be null, but if, what should the return be, or is it better to throw in such an unusual case?
public int CompareTo(object? other)
{
var mxOther = other as MXRecord;
// we want to be able to sort them by preference
if (mxOther?.Preference < Preference) return 1;
if (mxOther?.Preference > Preference) return -1;
// order mail servers of same preference by name
return -string.CompareOrdinal(mxOther?.DomainName, DomainName);
}
How sure can one be that 'Record' never becomes null? Could there be an appropriate default value?
The problem finally ends here: Parallel.ForEach(res.Answers, answer => bag.Add(answer.Record));
One can force a not null and tell there's not gonna be any nulls, but does one know that for a fact?
The text was updated successfully, but these errors were encountered:
I have a couple of questions that I would be happy if you like to answer, I can probably figure out the answers myself, but if you have the time and opportunity to answer, I would prefer that.
How sure can one be that 'Record' never becomes null? Could there be an appropriate default value?
The problem finally ends here:
Parallel.ForEach(res.Answers, answer => bag.Add(answer.Record));
One can force a not null and tell there's not gonna be any nulls, but does one know that for a fact?
The text was updated successfully, but these errors were encountered: