After cleaning code up just a bit it can be like this (cleaner to read/understand imho):
void Update () { ItemContainer container = SingletonMB<StationContent>.Instance.GetContainer(); title.text = string.Format( "Items {0:0} / {1:0}" , container.CapacityUsed , container.Capacity ); sectionLines.RemoveAllLines(); int numContainerItems = container.Items.Count; for( int i=0 ; i<numContainerItems ; i++ ) { ItemStack itemStack = container.Items[i]; string identifier = itemStack.Type.ToString(); string text = string.Format( "{0} {1:##}" , identifier , itemStack.Amount ); sectionLines.Set( identifier , text ); } }
Note that 'string.Format()' is slightly better than '"strA"+"strB"'
Also System.Text.StringBuilder would be better (string.Format uses it internally).