Skip to content

Commit 2096bce

Browse files
committed
Reformat XmlDoc style so that it is now heavily optimized for the end result.
Legibility in the code itself is no longer taken into account, just move the cursor over an item in the Visual Studio editor.
1 parent 931596c commit 2096bce

1 file changed

Lines changed: 26 additions & 85 deletions

File tree

src/AlphaNumericComparer.cs

Lines changed: 26 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -9,68 +9,37 @@
99
using System.Runtime.Serialization;
1010
using System.Security;
1111

12-
/// <summary>
13-
/// Defines a method that performs the string transformation for the comparer.
14-
/// </summary>
12+
/// <summary>Defines a method that performs the string transformation for the comparer.</summary>
1513
public interface IStringObjectComparer : IComparer
1614
{
17-
/// <summary>
18-
/// Retrieves the string of the object that is used for comparison.
19-
/// </summary>
20-
/// <param name="value">
21-
/// The object to compare.
22-
/// </param>
15+
/// <summary>Retrieves the string of the object that is used for comparison.</summary>
16+
/// <param name="value">The object to compare.</param>
2317
string GetString(object value);
2418
}
2519

2620
/// <inheritdoc cref="IStringObjectComparer"/>
27-
/// <typeparam name="T">
28-
/// The type to be compared or which contains the string to be compared.
29-
/// </typeparam>
21+
/// <typeparam name="T">The type to be compared or which contains the string to be compared.</typeparam>
3022
public interface IStringObjectComparer<in T> : IStringObjectComparer, IComparer<T> { }
3123

32-
/// <summary>
33-
/// Provides a base class for alphanumeric comparison.
34-
/// </summary>
35-
/// <remarks>
36-
/// Although this type can be serialized, but <see cref="ISerializable"/> is
37-
/// missing as this led to conflicts in some cases where it was no longer
38-
/// possible to use this class as <see cref="IComparer"/>.
39-
/// </remarks>
24+
/// <summary>Provides a base class for alphanumeric comparison.</summary>
25+
/// <remarks>Although this type can be serialized, but <see cref="ISerializable"/> is missing as this led to conflicts in some cases where it was no longer possible to use this class as <see cref="IComparer"/>.</remarks>
4026
[Serializable]
4127
public class AlphaNumericComparer : IStringObjectComparer
4228
{
43-
/// <summary>
44-
/// Gets the value that determines whether the order is descended.
45-
/// </summary>
29+
/// <summary>Gets the value that determines whether the order is descended.</summary>
4630
protected bool Descended { get; }
4731

48-
/// <summary>
49-
/// Initializes a new instance of the <see cref="AlphaNumericComparer"/> class.
50-
/// A parameter specifies whether the order is descended.
51-
/// </summary>
52-
/// <param name="descended">
53-
/// <see langword="true"/> to enable the descending order; otherwise,
54-
/// <see langword="false"/>.
55-
/// </param>
32+
/// <summary>Initializes a new instance of the <see cref="AlphaNumericComparer"/> class. A parameter specifies whether the order is descended.</summary>
33+
/// <param name="descended"><see langword="true"/> to enable the descending order; otherwise, <see langword="false"/>.</param>
5634
public AlphaNumericComparer(bool descended) =>
5735
Descended = descended;
5836

59-
/// <summary>
60-
/// Initializes a new instance of the <see cref="AlphaNumericComparer"/> class.
61-
/// </summary>
37+
/// <summary>Initializes a new instance of the <see cref="AlphaNumericComparer"/> class.</summary>
6238
public AlphaNumericComparer() : this(false) { }
6339

64-
/// <summary>
65-
/// Initializes a new instance of the <see cref="AlphaNumericComparer"/> class
66-
/// with serialized data.
67-
/// </summary>
68-
/// <param name="info">
69-
/// The object that holds the serialized object data.
70-
/// </param>
71-
/// <param name="context">
72-
/// The contextual information about the source or destination.
73-
/// </param>
40+
/// <summary>Initializes a new instance of the <see cref="AlphaNumericComparer"/> class with serialized data.</summary>
41+
/// <param name="info">The object that holds the serialized object data.</param>
42+
/// <param name="context">The contextual information about the source or destination.</param>
7443
protected AlphaNumericComparer(SerializationInfo info, StreamingContext context)
7544
{
7645
if (info == null)
@@ -101,15 +70,9 @@ public virtual int Compare(object x, object y)
10170
return Compare(s1, s2);
10271
}
10372

104-
/// <summary>
105-
/// Sets the <see cref="SerializationInfo"/> object for this instance.
106-
/// </summary>
107-
/// <param name="info">
108-
/// The object that holds the serialized object data.
109-
/// </param>
110-
/// <param name="context">
111-
/// The contextual information about the source or destination.
112-
/// </param>
73+
/// <summary>Sets the <see cref="SerializationInfo"/> object for this instance.</summary>
74+
/// <param name="info">The object that holds the serialized object data.</param>
75+
/// <param name="context">The contextual information about the source or destination.</param>
11376
[SecurityCritical]
11477
public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
11578
{
@@ -118,15 +81,7 @@ public virtual void GetObjectData(SerializationInfo info, StreamingContext conte
11881
info.AddValue(nameof(Descended), Descended);
11982
}
12083

121-
/// <remarks>
122-
/// The first thing to try is to use <paramref name="value"/> as a string,
123-
/// which should work with all <see cref="IEnumerable"/>&lt;<see cref="char"/>
124-
/// &gt; types. If <paramref name="value"/> is not a string type, however, a
125-
/// check is made to see whether <paramref name="value"/> has a public string
126-
/// field called <see langword="Text"/> or <see langword="Name"/> that can be
127-
/// used for comparison. If the <see langword="Text"/> field is found, it will
128-
/// be used, even if it contains an empty string.
129-
/// </remarks>
84+
/// <remarks>The first thing to try is to use <paramref name="value"/> as a string, which should work with all <see cref="IEnumerable"/>&lt;<see cref="char"/> &gt; types. If <paramref name="value"/> is not a string type, however, a check is made to see whether <paramref name="value"/> has a public string field called <see langword="Text"/> or <see langword="Name"/> that can be used for comparison. If the <see langword="Text"/> field is found, it will be used, even if it contains an empty string.</remarks>
13085
/// <inheritdoc/>
13186
public virtual string GetString(object value)
13287
{
@@ -163,23 +118,18 @@ public virtual string GetString(object value)
163118
public new virtual int GetHashCode() =>
164119
GetType().GetHashCode();
165120

166-
/// <summary>
167-
/// Compare two specified strings and returns an integer that indicates their
168-
/// relative position in the sort order.
169-
/// </summary>
170-
/// <param name="x">
171-
/// The first string to compare.
172-
/// </param>
173-
/// <param name="y">
174-
/// The second string to compare.
175-
/// </param>
121+
/// <summary>Compare two specified strings and returns an integer that indicates their relative position in the sort order.</summary>
122+
/// <param name="x">The first string to compare.</param>
123+
/// <param name="y">The second string to compare.</param>
176124
/// <inheritdoc cref="Compare(object, object)"/>
177125
protected int Compare(string x, string y)
178126
{
179127
var s1 = !Descended ? x : y;
180128
var s2 = !Descended ? y : x;
129+
if (s1 == s2)
130+
return 0;
181131
if (s1 == null)
182-
return s2 == null ? 0 : -1;
132+
return -1;
183133
if (s2 == null)
184134
return 1;
185135
var i1 = 0;
@@ -219,23 +169,14 @@ private static string GetChunk(string str, ref int i)
219169
[Serializable]
220170
public class AlphaNumericComparer<T> : AlphaNumericComparer, IStringObjectComparer<T>
221171
{
222-
/// <summary>
223-
/// Initializes a new instance of the <see cref="AlphaNumericComparer{T}"/>
224-
/// class. A parameter specifies whether the order is descended.
225-
/// </summary>
172+
/// <summary>Initializes a new instance of the <see cref="AlphaNumericComparer{T}"/> class. A parameter specifies whether the order is descended.</summary>
226173
/// <inheritdoc cref="AlphaNumericComparer(bool)"/>
227174
public AlphaNumericComparer(bool descended) : base(descended) { }
228175

229-
/// <summary>
230-
/// Initializes a new instance of the <see cref="AlphaNumericComparer{T}"/>
231-
/// class.
232-
/// </summary>
176+
/// <summary>Initializes a new instance of the <see cref="AlphaNumericComparer{T}"/> class.</summary>
233177
public AlphaNumericComparer() : base(false) { }
234178

235-
/// <summary>
236-
/// Initializes a new instance of the <see cref="AlphaNumericComparer{T}"/>
237-
/// class with serialized data.
238-
/// </summary>
179+
/// <summary>Initializes a new instance of the <see cref="AlphaNumericComparer{T}"/> class with serialized data.</summary>
239180
/// <inheritdoc cref="AlphaNumericComparer(SerializationInfo, StreamingContext)"/>
240181
protected AlphaNumericComparer(SerializationInfo info, StreamingContext context) : base(info, context) { }
241182

0 commit comments

Comments
 (0)