diff --git a/src/System.Runtime.Extensions/ref/System.Runtime.Extensions.cs b/src/System.Runtime.Extensions/ref/System.Runtime.Extensions.cs
index 6d4e39e614b0..d5d8c1d14ec4 100644
--- a/src/System.Runtime.Extensions/ref/System.Runtime.Extensions.cs
+++ b/src/System.Runtime.Extensions/ref/System.Runtime.Extensions.cs
@@ -1532,7 +1532,9 @@ namespace System.Net
public static partial class WebUtility
{
public static string HtmlDecode(string value) { throw null; }
+ public static void HtmlDecode(string value, System.IO.TextWriter output) { }
public static string HtmlEncode(string value) { throw null; }
+ public static void HtmlEncode(string value, System.IO.TextWriter output) { }
public static string UrlDecode(string encodedValue) { throw null; }
public static byte[] UrlDecodeToBytes(byte[] encodedValue, int offset, int count) { throw null; }
public static string UrlEncode(string value) { throw null; }
diff --git a/src/System.Runtime.Extensions/src/System/Net/WebUtility.cs b/src/System.Runtime.Extensions/src/System/Net/WebUtility.cs
index 3f69ab0aca0f..96ec4c6e92cb 100644
--- a/src/System.Runtime.Extensions/src/System/Net/WebUtility.cs
+++ b/src/System.Runtime.Extensions/src/System/Net/WebUtility.cs
@@ -33,7 +33,7 @@ public static class WebUtility
public static string HtmlEncode(string value)
{
- if (String.IsNullOrEmpty(value))
+ if (string.IsNullOrEmpty(value))
{
return value;
}
@@ -50,6 +50,11 @@ public static string HtmlEncode(string value)
return StringBuilderCache.GetStringAndRelease(sb);
}
+ public static void HtmlEncode(string value, TextWriter output)
+ {
+ output.Write(HtmlEncode(value));
+ }
+
private static unsafe void HtmlEncode(string value, int index, StringBuilder output)
{
Debug.Assert(value != null);
@@ -138,7 +143,7 @@ private static unsafe void HtmlEncode(string value, int index, StringBuilder out
public static string HtmlDecode(string value)
{
- if (String.IsNullOrEmpty(value))
+ if (string.IsNullOrEmpty(value))
{
return value;
}
@@ -154,6 +159,11 @@ public static string HtmlDecode(string value)
return StringBuilderCache.GetStringAndRelease(sb);
}
+ public static void HtmlDecode(string value, TextWriter output)
+ {
+ output.Write(HtmlDecode(value));
+ }
+
[SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "System.UInt16.TryParse(System.String,System.Globalization.NumberStyles,System.IFormatProvider,System.UInt16@)", Justification = "UInt16.TryParse guarantees that result is zero if the parse fails.")]
private static void HtmlDecode(string value, StringBuilder output)
{
diff --git a/src/System.Runtime.Extensions/tests/System.Runtime.Extensions.Tests.csproj b/src/System.Runtime.Extensions/tests/System.Runtime.Extensions.Tests.csproj
index 598d3eb832f4..048b3eb09aab 100644
--- a/src/System.Runtime.Extensions/tests/System.Runtime.Extensions.Tests.csproj
+++ b/src/System.Runtime.Extensions/tests/System.Runtime.Extensions.Tests.csproj
@@ -43,6 +43,7 @@
+
Common\System\Runtime\Serialization\Formatters\BinaryFormatterHelpers.cs
diff --git a/src/System.Runtime.Extensions/tests/System/Net/WebUtility.cs b/src/System.Runtime.Extensions/tests/System/Net/WebUtility.cs
index da8df3199d9a..6948b14aa844 100644
--- a/src/System.Runtime.Extensions/tests/System/Net/WebUtility.cs
+++ b/src/System.Runtime.Extensions/tests/System/Net/WebUtility.cs
@@ -4,12 +4,14 @@
using System.Collections.Generic;
using System.Diagnostics;
+using System.Globalization;
+using System.IO;
using System.Text;
using Xunit;
namespace System.Net.Tests
{
- public class WebUtilityTests
+ public partial class WebUtilityTests
{
// HtmlEncode + HtmlDecode
public static IEnumerable