You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// <summary>Escapes characters that are invalid in XML comments.</summary>
31
+
privatestaticstringEscapeXmlComment(stringtext)
32
+
{
33
+
if(!string.IsNullOrEmpty(text))
34
+
{
35
+
StringBuildersb=new(text.Length);
36
+
foreach(charcintext)
37
+
{
38
+
switch((int)c)
39
+
{
40
+
// Escape XML entities.
41
+
case'&':sb.Append("&");break;
42
+
case'<':sb.Append("<");break;
43
+
case'>':sb.Append(">");break;
44
+
45
+
// Propagate all other valid XML characters as-is. Control chars are considered invalid.
46
+
case(>=0x20 and <=0x7F) or (>=0xA0 and <=0xD7FF) or (>=0xE000 and <=0xFFFD):sb.Append(c);break;
47
+
48
+
// Use Unicode escape sequences for everything else.
49
+
default:sb.Append($"\\u{(int)c:X4}");break;
50
+
}
51
+
}
52
+
53
+
text=sb.ToString();
54
+
}
55
+
56
+
returntext;
57
+
}
32
58
33
59
/// <summary>Emits the definition of the partial method. This method just delegates to the property cache on the generated Regex-derived type.</summary>
0 commit comments