• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

lduchosal / ipnetwork / 960

15 May 2026 07:18AM UTC coverage: 0.0% (-94.1%) from 94.053%
960

Pull #411

appveyor

web-flow
Merge ef6b054ce into 4cec191ae
Pull Request #411: Bump MSTest.TestFramework from 4.2.2 to 4.2.3

0 of 2438 relevant lines covered (0.0%)

0.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/System.Net.IPNetwork/CidrClassLess.cs
1
// <copyright file="CidrClassLess.cs" company="IPNetwork">
2
// Copyright (c) IPNetwork. All rights reserved.
3
// </copyright>
4

5
namespace System.Net;
6

7
using System.Net.Sockets;
8

9
/// <summary>
10
/// Try to guess a CIDR in a ClassLess way: ipv4 = 32, ipv6 = 128.
11
/// </summary>
12
public sealed class CidrClassLess : ICidrGuess
13
{
14
    /// <summary>
15
    ///
16
    /// IPV4 : 32
17
    /// IPV6 : 128.
18
    ///
19
    /// </summary>
20
    /// <param name="ip">A string representing an IPAddress that will be used to guess CIDR.</param>
21
    /// <param name="cidr">A byte representing the netmask in cidr format (/24).</param>
22
    /// <returns>true if ip was converted successfully; otherwise, false.</returns>
23
    public bool TryGuessCidr(string? ip, out byte cidr)
24
    {
×
25
        if (!IPAddress.TryParse($"{ip}", out IPAddress? ipaddress))
×
26
        {
×
27
            cidr = 0;
×
28
            return false;
×
29
        }
30

31
        if (ipaddress.AddressFamily == AddressFamily.InterNetworkV6)
×
32
        {
×
33
            cidr = 128;
×
34
            return true;
×
35
        }
36

37
        cidr = 32;
×
38
        return true;
×
39
    }
×
40
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc