-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed as not planned
Labels
api-suggestionEarly API idea and discussion, it is NOT ready for implementationEarly API idea and discussion, it is NOT ready for implementationarea-System.Netneeds-author-actionAn issue or pull request that requires more info or actions from the author.An issue or pull request that requires more info or actions from the author.
Milestone
Description
Background and Motivation
From #42840
A weird workaround is used for mask testing. Masking should be exposed as a direct concept for ip addresses.
Proposed API
namespace System.Net
{
public class IPAddress
{
+ public bool IsMask(IPAddress address, int maskLength);
}
}Usage Examples
var mask = IPAddress.Parse("192.168.0.0");
var address = IPAddress.Parse("192.168.1.1");
Assert.True(mask.IsMask(address, 16));Alternative Designs
Expose a separated IPAddressMask type? Then mask length doesn't needed to be passed in every call.
Risks
Is storing masks violating the IPAddress type? If so, an IPAddressMask type should be appropriate.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
api-suggestionEarly API idea and discussion, it is NOT ready for implementationEarly API idea and discussion, it is NOT ready for implementationarea-System.Netneeds-author-actionAn issue or pull request that requires more info or actions from the author.An issue or pull request that requires more info or actions from the author.