Closed matteogarato closed 12 months ago
@matteogarato It is intended. Because the rangeD2
is overlapping in the rangeD1
, but the rangeD2
doesn't contain the rangeD1
.
Does that make sense?
yes it make sense, but logically D2 contains a part of D1 so the contains should return true in my opinion, i propose the edit of Contains like this:
public bool Contains(IPAddressRange range)
{
var rangeBegin = range.Begin.ToUInt32();
var rangeEnd = range.End.ToUInt32();
return Begin <= rangeBegin && rangeEnd <= End || rangeBegin <= Begin && End <= rangeEnd;
}
it's not a big problem, in my code now i added:
rangeD2.Contains(rangeD1) || rangeD1.Contains(rangeD2)
to get around the problem
using the documentation:
BUT
Is it intended behavior or a bug?