Avoid a boxing allocation in UriBuilder.ToString
authorJames Ko <jamesqko@gmail.com>
Mon, 4 Jul 2016 04:31:17 +0000 (00:31 -0400)
committerGitHub <noreply@github.com>
Mon, 4 Jul 2016 04:31:17 +0000 (00:31 -0400)
Commit migrated from https://github.com/dotnet/corefx/commit/7b2d47dfb6a735280aca8f3eca3008586a0dc359

src/libraries/System.Private.Uri/src/System/UriBuilder.cs

index 761c67b..a84f33c 100644 (file)
@@ -416,7 +416,7 @@ namespace System
                     + ((_password.Length > 0) ? (":" + _password) : string.Empty)
                     + ((_username.Length > 0) ? "@" : string.Empty)
                     + _host
-                    + (((_port != -1) && (_host.Length > 0)) ? (":" + _port) : string.Empty)
+                    + (((_port != -1) && (_host.Length > 0)) ? (":" + _port.ToString()) : string.Empty)
                     + (((_host.Length > 0) && (_path.Length != 0) && (_path[0] != '/')) ? "/" : string.Empty) + _path
                     + _query
                     + _fragment;