Skip to content

Commit 4f3efc6

Browse files
committed
replace arraylist with list<string>, remove unnecessary casts and iteration
1 parent 557ee98 commit 4f3efc6

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/Speller.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,16 +177,15 @@ internal ITextPointer GetNextSpellingErrorPosition(ITextPointer position, Logica
177177
// for an error range.
178178
// This method actually runs the speller on the specified text,
179179
// re-evaluating the error from scratch.
180-
internal IList GetSuggestionsForError(SpellingError error)
180+
internal List<string> GetSuggestionsForError(SpellingError error)
181181
{
182182
ITextPointer contextStart;
183183
ITextPointer contextEnd;
184184
ITextPointer contentStart;
185185
ITextPointer contentEnd;
186186
TextMap textMap;
187-
ArrayList suggestions;
188187

189-
suggestions = new ArrayList(1);
188+
List<string> suggestions = new();
190189

191190
//
192191
// IMPORTANT!!
@@ -915,7 +914,7 @@ private bool ScanErrorTextSegment(SpellerInteropBase.ISpellerSegment textSegment
915914
{
916915
if (textSegment.SubSegments.Count == 0)
917916
{
918-
ArrayList suggestions = (ArrayList)data.Data;
917+
List<string> suggestions = (List<string>)data.Data;
919918
if(textSegment.Suggestions.Count > 0)
920919
{
921920
foreach(string suggestion in textSegment.Suggestions)

src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/SpellerError.cs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,7 @@ public void IgnoreAll()
9494
/// </remarks>
9595
public IEnumerable<string> Suggestions
9696
{
97-
get
98-
{
99-
IList suggestions = _speller.GetSuggestionsForError(this);
100-
101-
for (int i=0; i<suggestions.Count; i++)
102-
{
103-
yield return (string)suggestions[i];
104-
}
105-
}
97+
get => _speller.GetSuggestionsForError(this);
10698
}
10799

108100
#endregion Public Properties

0 commit comments

Comments
 (0)