Skip to content

Commit 8b20afb

Browse files
authored
Merge pull request #9221 from h3xds1nz/replace-arraylist-with-generic-list
Replace ArrayList in InputLanguageSource with fixed-size array, reduce allocations
2 parents ce09c88 + c80e4de commit 8b20afb

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/InputLanguageManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ public IEnumerable AvailableInputLanguages
287287
return null;
288288
}
289289

290-
return (IEnumerable)_source.InputLanguageList;
290+
return _source.InputLanguageList;
291291
}
292292
}
293293

src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/InputLanguageSource.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,8 @@ public IEnumerable InputLanguageList
130130
EnsureInputProcessorProfile();
131131

132132
if (_ipp == null)
133-
{
134-
ArrayList al = new ArrayList();
135-
al.Add(CurrentInputLanguage);
136-
return al;
137-
}
133+
return new CultureInfo[1] { CurrentInputLanguage };
134+
138135
return _ipp.InputLanguageList;
139136
}
140137
}

0 commit comments

Comments
 (0)