I have a set of API endpoints where the URL is not standardized, so I could either get api/auth or api/auth/ (may or may not end with /). I'm 'registering' the endpoint, plus the HTTP Method that comes in, so I can exclude certain endpoints from having to authenticate.I've written this piece of code, which has a lot of repetition. Any thoughts? Private _ExemptEndpoints As New List(Of Tuple(Of String, Method))Public Sub RegisterAuthExemptEndpoint(endpoint As String, method As Method) Implements IRestAuthenticator.RegisterAuthExemptEndpoint    Dim endpoints As New List(Of Tuple(Of String, Method))    Dim allMethods As Boolean = False    If method = Nothing Then allMethods = True    Dim ep1    Dim ep2    If Not endpoint.EndsWith(/) Then        ep1 = endpoint        ep2 = endpoint + /    Else        ep1 = endpoint.Remove(endpoint.Length - 1, 1)        ep2 = endpoint    End If    If allMethods Then        _ExemptEndpoints.Add(Tuple.[New](Of String, Method)(ep1, method.GET))        _ExemptEndpoints.Add(Tuple.[New](Of String, Method)(ep1, method.POST))        _ExemptEndpoints.Add(Tuple.[New](Of String, Method)(ep1, method.PUT))        _ExemptEndpoints.Add(Tuple.[New](Of String, Method)(ep1, method.DELETE))        _ExemptEndpoints.Add(Tuple.[New](Of String, Method)(ep2, method.GET))        _ExemptEndpoints.Add(Tuple.[New](Of String, Method)(ep2, method.POST))        _ExemptEndpoints.Add(Tuple.[New](Of String, Method)(ep2, method.PUT))        _ExemptEndpoints.Add(Tuple.[New](Of String, Method)(ep2, method.DELETE))    Else        _ExemptEndpoints.Add(Tuple.[New](Of String, Method)(ep1, method))        _ExemptEndpoints.Add(Tuple.[New](Of String, Method)(ep2, method))    End IfEnd Sub
Registering endpoints and HTTP method for exemption of authentication
.net;vb.net;url
The endpoints list doesn't seem to be used. Also, enable Option Explicit On.You could have a list of method instead.Dim methodToAdd As New List(Of Method)If method = Nothing Then    ' This list could be stored    methodToAdd.Add(Method.GET)    methodToAdd.Add(Method.POST)    methodToAdd.Add(Method.PUT)    methodToAdd.Add(Method.DELETE)Else    methodToAdd.Add(method)End IfDim ep1, ep2 As StringIf Not endpoint.EndsWith(/) Then    ep1 = endpoint    ep2 = endpoint + /Else    ep1 = endpoint.Remove(endpoint.Length - 1, 1)    ep2 = endpointEnd IfFor Each m As Method In methodToAdd    _ExemptEndpoints.Add(Tuple.[New](Of String, Method)(ep1, m))    _ExemptEndpoints.Add(Tuple.[New](Of String, Method)(ep2, m))Next