Contract.Requires(completeURL.IsUri()); // Error: Contract.Requires(completeURL != null)
Can I do this without Contract.Assume()?
I mean something like this:
[Pure]
[DefinitelyNotANullStringAfterThatMethod]
public static bool IsUri(this string str)
{
return Uri.IsWellFormedUriString(str, UriKind.Absolute);
}
[Pure]
public static bool IsUri(this string str)
{
Contract.Ensures(!Contract.Result<bool>() || str != null); // by Dan Bryant
return Uri.IsWellFormedUriString(str, UriKind.Absolute);
}
Maybe?