Microsoft.Azure.Commands.Insights.Utilities.ValidateUri C# (CSharp) Method

ValidateUri() public static method

Checks if the given string represents a valid uri
public static ValidateUri ( string uri, string argName = "Uri" ) : void
uri string The string representing a uri
argName string The name of the argument to report as invalid
return void
        public static void ValidateUri(string uri, string argName = "Uri")
        {
            Uri tempUri;
            if (!Uri.TryCreate(uri, UriKind.RelativeOrAbsolute, out tempUri))
            {
                throw new ArgumentException(string.Format("Invalid {0}: {1}", argName, uri));
            }
        }