Friday, 14 August 2015

Uri.TryCreate C#

Came across a strange problem at work yesterday:

was returning true.

On further investigation strings such as "foo:bar" will also return true. It seems a colon separating a few characters is enough to satisfy TryCreate's criteria of a valid URI being contained in the string. I assume colons are related to the username:password prefixes some URIs contain, but I would have assumed that in itself would not be enough.

Anyone know why this would be the case?

No comments:

Post a Comment