/// <summary> /// Initialize properties /// </summary> /// <param name="address">IP Address</param> /// <param name="prefixLength">Length of prefix</param> /// <param name="validate">If true it will validate route prefix</param> private void Init(IPAddress address, ushort prefixLength, bool validate) { var length = BigInteger.Pow( 2, address.AddressFamily == AddressFamily.InterNetwork ? (32 - prefixLength) : (128 - prefixLength)); this.StartIp = address; this.PrefixMaskWidth = prefixLength; this.StartOfPrefixBigInt = address.BigUIntFromIpAddress(); this.EndOfPrefixBigInt = this.StartOfPrefixBigInt + (length - 1); // Validate if true if (validate) { this.IsValid(this.StartOfPrefixBigInt, this.PrefixMaskWidth, address.AddressFamily); } }