fix: Eliminates List allocations in various places. (#2158)
This commit is contained in:
parent
6f64cddd0b
commit
4836bff5eb
23 changed files with 263 additions and 200 deletions
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using ModernUO.Serialization;
|
||||
using Server.Collections;
|
||||
using Server.Multis;
|
||||
|
||||
namespace Server.Items;
|
||||
|
|
@ -102,15 +102,15 @@ public partial class StrongBox : BaseContainer, IChoppable
|
|||
public Container ConvertToStandardContainer()
|
||||
{
|
||||
var metalBox = new MetalBox();
|
||||
var subItems = new List<Item>(Items);
|
||||
using var subItems = PooledRefList<Item>.Create(Items.Count);
|
||||
subItems.AddRange(Items);
|
||||
|
||||
foreach (var subItem in subItems)
|
||||
for (var i = 0; i < subItems.Count; i++)
|
||||
{
|
||||
metalBox.AddItem(subItem);
|
||||
metalBox.AddItem(subItems[i]);
|
||||
}
|
||||
|
||||
Delete();
|
||||
|
||||
return metalBox;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue