By using this site, you agree to the Privacy Policy and Terms of Use.
Accept
World of SoftwareWorld of SoftwareWorld of Software
  • News
  • Software
  • Mobile
  • Computing
  • Gaming
  • Videos
  • More
    • Gadget
    • Web Stories
    • Trending
    • Press Release
Search
  • Privacy
  • Terms
  • Advertise
  • Contact
Copyright © All Rights Reserved. World of Software.
Reading: New in .NET 10.0 (29): Check IP addresses with IPAddress.IsValid()
Share
Sign In
Notification Show More
Font ResizerAa
World of SoftwareWorld of Software
Font ResizerAa
  • Software
  • Mobile
  • Computing
  • Gadget
  • Gaming
  • Videos
Search
  • News
  • Software
  • Mobile
  • Computing
  • Gaming
  • Videos
  • More
    • Gadget
    • Web Stories
    • Trending
    • Press Release
Have an existing account? Sign In
Follow US
  • Privacy
  • Terms
  • Advertise
  • Contact
Copyright © All Rights Reserved. World of Software.
World of Software > Software > New in .NET 10.0 (29): Check IP addresses with IPAddress.IsValid()
Software

New in .NET 10.0 (29): Check IP addresses with IPAddress.IsValid()

News Room
Last updated: 2026/06/26 at 3:23 AM
News Room Published 26 June 2026
Share
New in .NET 10.0 (29): Check IP addresses with IPAddress.IsValid()
SHARE

There is a class for checking IP addresses System.Net.IPAddress the static method has been around since the .NET Framework 2.0 TryParse()which extracts an IP address from a string.

Read more after the ad

The Dotnet Doctor – Holger Schwichtenberg

Dr. Holger Schwichtenberg is the technical director of the expert network www.IT-Visions.de, which, with 53 renowned experts, supports numerous medium-sized and large companies through consulting and training as well as with software development. Through his appearances at numerous national and international conferences as well as more than 90 specialist books and more than 1,500 specialist articles, Holger Schwichtenberg is one of the best-known experts for .NET and web technologies in Germany.

Since .NET Core 2.1 the extraction is also from the type ReadOnlySpan possible. The return value is a boolvalue and the extracted IP address is in the form of an instance of the class IPAddress as out-Parameters supplied. If you just want to check whether the IP address is correct, you write IPAddress.TryParse(eingabe, out _).

In .NET 10.0, Microsoft now provides in the static method IsValid() another test variant with less internal effort. The following code compares IsValid() with TryParse():


/// 
/// IsValid mit ReadOnlySpan oder ReadOnlySpan als Alternative zu IPAddress.TryParse(span, out _)
/// 
public void Run()
{
 CUI.Demo("IPAddress.IsValid()");

 string IP1 = "192.168.1.0"; // gültige IPv4-Adresse
 CUI.H2(IP1);

 // --- Alt
 var valid1 = IPAddress.TryParse(IP1, out _);
 Console.WriteLine("TryParse: " + valid1); // true

 // --- Neu
 System.Console.WriteLine("IsValid: " + System.Net.IPAddress.IsValid(IP1)); // true

 string IP2 = "192.168.256.1"; // ungültige IPv4-Adresse
 CUI.H2(IP2);

 // --- Alt
 var valid2 = IPAddress.TryParse(IP2, out _);
 Console.WriteLine("TryParse: " + valid2); // false

 // --- Neu
 System.Console.WriteLine("IsValid: " + System.Net.IPAddress.IsValid(IP2)); // false
}



The code uses the old and new methods to check IP addresses for validity (Fig. 1).

The code uses the old and new methods to check IP addresses for validity (Fig. 1).

The code uses the old and new methods to check IP addresses for validity (Fig. 1).

To do this, Microsoft is now simply returning a previously internal method TargetHostNameHelper.IsValidAddress() to the outside world, as can be seen from the issue on GitHub.

Read more after the ad


IsValid() is more performant than TryParse() and requires no memory (Fig. 2).

IsValid() is more performant than TryParse() and requires no memory (Fig. 2).

IsValid() is more performant than TryParse() and requires no memory (Fig. 2).

(Bild: Microsoft)


betterCode() .NET 11.0

betterCode() .NET 11.0

(Image: King / stock.adobe.com)

This is new in .NET 11.0: Dr. Holger Schwichtenberg and other experts will present the changes for developers at the betterCode() .NET 11.0 online conference on November 17, 2026. Discounted blind bird tickets are available until the program is published.


(rme)



Unfortunately, this link is no longer valid.

Links to gifted items will be invalid if they are older than 7 days or have been accessed too often.


You need a heise+ package to read this article. Try it now for a week without obligation – without obligation!

Sign Up For Daily Newsletter

Be keep up! Get the latest breaking news delivered straight to your inbox.
By signing up, you agree to our Terms of Use and acknowledge the data practices in our Privacy Policy. You may unsubscribe at any time.
Share This Article
Facebook Twitter Email Print
Share
What do you think?
Love0
Sad0
Happy0
Sleepy0
Angry0
Dead0
Wink0
Previous Article Every year a veterinarian, a jurist, a psychoanalyst and a gardener meet. They are the secret owners of rearmament in Europe Every year a veterinarian, a jurist, a psychoanalyst and a gardener meet. They are the secret owners of rearmament in Europe
Next Article Using Visual Studio Code with local LLM – here’s how Using Visual Studio Code with local LLM – here’s how
Leave a comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Stay Connected

248.1k Like
69.1k Follow
134k Pin
54.3k Follow

Latest News

Google Wallet and Ticketmaster introduce new kinds of tickets
Google Wallet and Ticketmaster introduce new kinds of tickets
Mobile
From Donna to Britta: How a coach organizes her business with over 20 AI agents
From Donna to Britta: How a coach organizes her business with over 20 AI agents
Gadget
Using Visual Studio Code with local LLM – here’s how
Using Visual Studio Code with local LLM – here’s how
News
Every year a veterinarian, a jurist, a psychoanalyst and a gardener meet. They are the secret owners of rearmament in Europe
Every year a veterinarian, a jurist, a psychoanalyst and a gardener meet. They are the secret owners of rearmament in Europe
Gaming

You Might also Like

Xbox: Microsoft increases console prices worldwide on August 1st
Software

Xbox: Microsoft increases console prices worldwide on August 1st

4 Min Read
Australian children use social networks despite the ban
Software

Australian children use social networks despite the ban

6 Min Read
Mars rover Perseverance: Photographed from space on the occasion of the marathon distance
Software

Mars rover Perseverance: Photographed from space on the occasion of the marathon distance

3 Min Read
“GTA 6”: Fraud with supposed “Early Access”
Software

“GTA 6”: Fraud with supposed “Early Access”

2 Min Read
//

World of Software is your one-stop website for the latest tech news and updates, follow us now to get the news that matters to you.

Quick Link

  • Privacy Policy
  • Terms of use
  • Advertise
  • Contact

Topics

  • Computing
  • Software
  • Press Release
  • Trending

Sign Up for Our Newsletter

Subscribe to our newsletter to get our newest articles instantly!

World of SoftwareWorld of Software
Follow US
Copyright © All Rights Reserved. World of Software.
Welcome Back!

Sign in to your account

Lost your password?