Exemplo n.º 1
0
        public void ParseIPAddress()
        {
            var testAddress = settings.Value.TestAddress;
            var testCount   = settings.Value.TestCount;

            var ip = IPv4.ParseIP(testAddress);

            Console.WriteLine($"Test: {IPv4.ConvertToBitString(ip)} {IPv4.ConvertToString(ip)} [ParseIPAddress address:{testAddress}]");

            var sw = Stopwatch.StartNew();

            for (int i = 0; i < testCount; i++)
            {
                _ = IPv4.ParseIP(testAddress);
            }
            Console.WriteLine($" - {sw.ElapsedMilliseconds} ms");
        }
Exemplo n.º 2
0
        public void ParsePrefix()
        {
            var testPrefix = settings.Value.TestPrefix;
            var testCount  = settings.Value.TestCount;

            IPv4Prefix x = IPv4Prefix.Parse(testPrefix);

            Console.WriteLine($"Test: {IPv4.ConvertToBitString(x.IP)} {x.ToString()} [ParsePrefix prefix:{testPrefix}]");

            var sw = Stopwatch.StartNew();

            for (int i = 0; i < testCount; i++)
            {
                _ = IPv4.ParsePrefix(testPrefix);
            }
            Console.WriteLine($" - {sw.ElapsedMilliseconds} ms");
        }