mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-13 11:44:57 +00:00
32 lines
543 B
C#
32 lines
543 B
C#
using System;
|
|
|
|
namespace ICD.Common.Utils
|
|
{
|
|
public static class UriUtils
|
|
{
|
|
/// <summary>
|
|
/// Attempts to parse the given URI string into a System.Uri instance.
|
|
/// </summary>
|
|
/// <param name="uri"></param>
|
|
/// <param name="output"></param>
|
|
/// <returns></returns>
|
|
public static bool TryParse(string uri, out Uri output)
|
|
{
|
|
output = null;
|
|
|
|
if (string.IsNullOrEmpty(uri))
|
|
return false;
|
|
|
|
try
|
|
{
|
|
output = new Uri(uri);
|
|
return true;
|
|
}
|
|
catch (UriFormatException)
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|