Repository navigation
5.0.0 — thread-safe IPNetwork2
Highlights
IPNetwork2 is safe to share between threads
The address, family and CIDR now live in one immutable snapshot behind a single reference. Assigning Value replaces the whole network in one store, so a concurrent reader always observes a network that was actually assigned, never a mix of the old and the new one. Every single call (ToString, Contains, CompareTo, Network, Broadcast, FirstUsable, LastUsable, Usable, WildcardMask, ...) reports one coherent network.
The memoized broadcast address and hash code live on that snapshot too, so they are invalidated together with the network they describe.
Shared blocks can no longer be rewritten
The IANA_* blocks and the UniqueLocalAddress ULA prefixes used to hand out process-wide instances. Since Value is publicly settable, any caller could change what the library considers reserved or ULA. They now return a copy that shares the immutable snapshot.
Collection fixes
IPNetworkCollectionhands out an enumerator of its own perGetEnumerator()call. A second, nested or concurrent enumeration no longer disturbs another one.IPNetworkCollectionandIPAddressCollectionreject negative indexes.
Breaking changes
GetHashCodefollowsValue, as theEquals/GetHashCodecontract requires. A network mutated after being added to aDictionaryor aHashSetcan no longer be found there.UniqueLocalAddress.UlaLocallyAssigned,UlaCentrallyAssignedandUlaRangeare properties instead ofstatic readonlyfields. Source compatible, but code compiled against 4.x must be recompiled.IANA_*and the ULA properties return a new instance on every call, soReferenceEqualsbetween two calls no longer holds. UseEquals.AssemblyVersionis now5.0.0.0(it had been left at3.2.0.0).
Full changelog: 4.3.0...5.0.0