示例#1
0
 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());
     }
 }
示例#2
0
 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());
     }
 }
示例#3
0
 public Item[] FindItems(IItemValidator validator)
 {
     return(ScratchList <Item> .ToArray(this.GetItems(validator)));
 }
示例#4
0
 public static Item[] FindItems(Predicate <Item> validator)
 {
     return(ScratchList <Item> .ToArray(World.GetItems(validator)));
 }