Skip to content

Commit f825db3

Browse files
committed
Deprecated StringExtensions.AsFormat extension
1 parent 014f940 commit f825db3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Microsoft.Toolkit/Extensions/StringExtensions.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5+
using System;
56
using System.Diagnostics.CodeAnalysis;
67
using System.Globalization;
78
using System.Net;
@@ -38,17 +39,17 @@ public static class StringExtensions
3839
/// <summary>
3940
/// Regular expression for removing comments from HTML.
4041
/// </summary>
41-
private static readonly Regex RemoveHtmlCommentsRegex = new Regex("<!--.*?-->", RegexOptions.Singleline);
42+
private static readonly Regex RemoveHtmlCommentsRegex = new("<!--.*?-->", RegexOptions.Singleline);
4243

4344
/// <summary>
4445
/// Regular expression for removing scripts from HTML.
4546
/// </summary>
46-
private static readonly Regex RemoveHtmlScriptsRegex = new Regex(@"(?s)<script.*?(/>|</script>)", RegexOptions.Singleline | RegexOptions.IgnoreCase);
47+
private static readonly Regex RemoveHtmlScriptsRegex = new(@"(?s)<script.*?(/>|</script>)", RegexOptions.Singleline | RegexOptions.IgnoreCase);
4748

4849
/// <summary>
4950
/// Regular expression for removing styles from HTML.
5051
/// </summary>
51-
private static readonly Regex RemoveHtmlStylesRegex = new Regex(@"(?s)<style.*?(/>|</style>)", RegexOptions.Singleline | RegexOptions.IgnoreCase);
52+
private static readonly Regex RemoveHtmlStylesRegex = new(@"(?s)<style.*?(/>|</style>)", RegexOptions.Singleline | RegexOptions.IgnoreCase);
5253

5354
/// <summary>
5455
/// Determines whether a string is a valid email address.
@@ -145,6 +146,7 @@ public static string FixHtml(this string html)
145146
/// <param name="format">The format of the string being linked.</param>
146147
/// <param name="args">The object which will receive the linked String.</param>
147148
/// <returns>Truncated string.</returns>
149+
[Obsolete("This method will be removed in a future version of the Toolkit. Use the native C# string interpolation syntax instead, see: https://docs.microsoft.com/dotnet/csharp/language-reference/tokens/interpolated")]
148150
public static string AsFormat(this string format, params object[] args) => string.Format(format, args);
149151

150152
/// <summary>

0 commit comments

Comments
 (0)