Skip to content

Instantly share code, notes, and snippets.

@MarcBruins
Created December 16, 2018 12:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MarcBruins/208a523748c51d904cc95f19f16197a2 to your computer and use it in GitHub Desktop.
Save MarcBruins/208a523748c51d904cc95f19f16197a2 to your computer and use it in GitHub Desktop.
Return value for uri trailing slash
public static Uri EnsureTrailingSlash(Uri uri)
{
return new Uri(uri.ToString() + "/");
}
//OR
public static Uri EnsureTrailingSlash(Uri? uri)
{
if(uri == null)
return null;
return new Uri(uri.ToString() + "/");
}
@prodehghan
Copy link

In second method, did you mean:

public static Uri? ...

?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment