Friday, March 19, 2010

System.Uri constructor makes the host lower-case

I stumbled upon this cool property of the System.Uri class today; the .NET Framework's Uri class knows that DNS names are case-insensitive. If you pass a string to a Uri constructor with mixed or upper case letters, the constructor will make the DNS/host part of the string lower-case.


Uri uri = new Uri("");
will print: ""

will print: "FoO"

No comments:

Post a Comment