Skip to content

Commit

Permalink
Simplify CheckIsReserved in IriHelper (dotnet#32340)
Browse files Browse the repository at this point in the history
* Simplify CheckIsReserved in IriHelper

* Simplify CheckIsReserved further
  • Loading branch information
MihaZupan authored Feb 18, 2020
1 parent b00f349 commit 106eebd
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/libraries/System.Private.Uri/src/System/IriHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,12 @@ internal static bool CheckIriUnicodeRange(char highSurr, char lowSurr, out bool
//
internal static bool CheckIsReserved(char ch, UriComponents component)
{
if ((component != UriComponents.Scheme) &&
(component != UriComponents.UserInfo) &&
(component != UriComponents.Host) &&
(component != UriComponents.Port) &&
(component != UriComponents.Path) &&
(component != UriComponents.Query) &&
(component != UriComponents.Fragment)
)
if ((UriComponents.AbsoluteUri & component) == 0)
{
return (component == (UriComponents)0) ? UriHelper.IsGenDelim(ch) : false;
return component == 0 && UriHelper.IsGenDelim(ch);
}

return UriHelper.RFC3986ReservedMarks.IndexOf(ch) >= 0;
return UriHelper.RFC3986ReservedMarks.Contains(ch);
}

//
Expand Down

0 comments on commit 106eebd

Please sign in to comment.