public static T[] ToArray(IEnumerable <T> collection) { using (ScratchList <T> scratchList = new ScratchList <T>()) { List <T> objList = scratchList.Value; objList.AddRange(collection); return(objList.ToArray()); } }
private LayoutEntry[] ParseLayout(string layout) { using (ScratchList <LayoutEntry> scratchList = new ScratchList <LayoutEntry>()) { List <LayoutEntry> layoutEntryList = scratchList.Value; int startIndex1 = 0; int num; while ((num = layout.IndexOf('{', startIndex1)) >= 0) { int startIndex2 = num + 1; startIndex1 = layout.IndexOf('}', startIndex2); layoutEntryList.Add(new LayoutEntry(layout.Substring(startIndex2, startIndex1 - startIndex2).Trim())); } return(layoutEntryList.ToArray()); } }
public Item[] FindItems(IItemValidator validator) { return(ScratchList <Item> .ToArray(this.GetItems(validator))); }
public static Item[] FindItems(Predicate <Item> validator) { return(ScratchList <Item> .ToArray(World.GetItems(validator))); }