0
我可以提高此代碼的性能,我試圖從字符串列表(_authorizedBks)中搜索字典列表(tr)。有沒有更好的方式在C#中編寫代碼或在.NET中支持語言?如何提高此代碼的性能?
for (int i = tr.Count - 1; i >= 0; i--)
{
if (tr[i].ContainsKey("BK") && !_authorizedBks.Contains(tr[i]["BK"], StringComparer.CurrentCultureIgnoreCase))
{
removedBks.Add(tr[i]);
}
}
// where tr is List<Dictionary<string, string>>
// _authorizedBks is List<string>
// removedBks is List<Dictionary<string, string>>
確保您構建authorizedBks用正確的IComparer,雖然。 –
此代碼是Web服務的一部分,並且可能有用於此Web服務的C++或Java客戶端,那麼Hashtable可串行化並可由C++或Java客戶端使用? – user2736702
@ user2736702是的。 –