本文整理汇总了C#中System.Collections.ArrayList.AddRange方法的典型用法代码示例。如果您正苦于以下问题:C# ArrayList.AddRange方法的具体用法?C# ArrayList.AddRange怎么用?C# ArrayList.AddRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.ArrayList
的用法示例。
在下文中一共展示了ArrayList.AddRange方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
ArrayList list = new ArrayList();
list.Add(true);
list.Add(1);
list.Add("张三");
list.AddRange(new int[] { 1, 2, 3, 4, 5 });
list.AddRange(list);
//list.Clear();//清空所有元素
//list.Remove(true);//删除单个元素
//list.RemoveAt(0);//根据下标删除元素
//list.RemoveRange(0, 3);
//list.Sort();//升序排列
//list.Reverse();//反转
//list.Insert(1, "插入的");
//list.InsertRange(0, new string[] { "zs", "ls" });
//bool b=list.Contains(1);
//Console.WriteLine(b);
list.Add("wisdom");
if (!list.Contains("wisdom"))
{
list.Add("wisdom");
}
else
{
Console.WriteLine("已经有这个屌丝啦");
}
for (int i = 0; i < list.Count; i++)
{
Console.WriteLine(list[i]);
}
Console.ReadKey();
}
示例2: Append
/**
* Appends two lists of results.
*
* @param l1 the first list.
* @param l2 the second list.
* @return the appended list.
*/
internal static List Append(List l1, List l2)
{
var result = new ArrayList(l1.list.Count + l2.list.Count);
result.AddRange(l1.list);
result.AddRange(l2.list);
return new List(result);
}
示例3: ArrayList
public static Mnozina operator + (Mnozina a, Mnozina b)
{
ArrayList c = new ArrayList();
c.AddRange(a.seznam);
c.AddRange(b.seznam);
return new Mnozina(c);
}
示例4: setCBItems
public static void setCBItems(vdUsr.vdComboBox cbo, ICollection col1, ICollection col2, Type converter, object selected, object objDefault)
{
ArrayList al = new ArrayList(col1.Count + col2.Count);
al.AddRange(col1);
al.AddRange(col2);
setCBItems(cbo, al, converter, selected, objDefault);
}
示例5: ExecuteAll
public bool ExecuteAll(Course c, List<CourseDetail> cdList,List<CoursePicture> plist)
{
ArrayList list = new ArrayList();
try
{
int course_id = GetCourseId(c);
//獲得操作Course表的sql語句
List<string> listStr = GetSqlByCourseDetail(cdList, course_id);
//獲取操作圖片的sql語句
List<string> plistStr = GetSqlByPicture(plist, course_id);
if (listStr.Count != 0)
{
list.AddRange(listStr);
}
if (plistStr.Count != 0)
{
list.AddRange(plistStr);
}
if (list.Count != 0)
{
return _courseImpl.SaveAll(list);
}
else
{
return true;
}
}
catch (Exception ex)
{
throw new Exception("CourseMgr-->SaveAll" + ex.Message,ex);
}
}
示例6: ImportComComponent
internal bool ImportComComponent(string path, OutputMessageCollection outputMessages, string outputDisplayName)
{
ComImporter importer = new ComImporter(path, outputMessages, outputDisplayName);
if (importer.Success)
{
ArrayList list = new ArrayList();
if (this.typeLibs != null)
{
list.AddRange(this.typeLibs);
}
if (importer.TypeLib != null)
{
list.Add(importer.TypeLib);
}
this.typeLibs = (TypeLib[]) list.ToArray(typeof(TypeLib));
list.Clear();
if (this.comClasses != null)
{
list.AddRange(this.comClasses);
}
if (importer.ComClasses != null)
{
list.AddRange(importer.ComClasses);
}
this.comClasses = (ComClass[]) list.ToArray(typeof(ComClass));
}
return importer.Success;
}
示例7: GetAllEOSData
public ArrayList GetAllEOSData()
{
ArrayList arr = new ArrayList();
arr.AddRange(_liveSweepUnitOutputs);
arr.AddRange(_doneSweepUnitOutputs);
return arr;
}
示例8: calcLaserEnds
public void calcLaserEnds()
{
ArrayList toIterate = new ArrayList();
toIterate.AddRange(Game1.miscObjects);
toIterate.AddRange(Game1.solidTiles);
laserEnds[0] = 0;
laserEnds[1] = 999999;
laserEnds[2] = 0;
laserEnds[3] = 999999;
foreach (Object m in toIterate)
{
if ((m != this) && (m.getX() == x) && (m.blocksProjectiles()) && (m.getSolid() == true))
{
//calc laser end points
if ((m.getY() > y) && (m.getY() < laserEnds[3]))
laserEnds[3] = m.getY() - 32;
if ((m.getY() < y) && (m.getY() > laserEnds[2]))
laserEnds[2] = m.getY() + 32;
}
if ((m != this) && (m.getY() == y) && (m.blocksProjectiles()) && (m.getSolid() == true))
{
//calc laser end points
if ((m.getX() > x) && (m.getX() < laserEnds[1]))
laserEnds[1] = m.getX() - 32;
if ((m.getX() < x) && (m.getX() > laserEnds[0]))
laserEnds[0] = m.getX() + 32;
}
}
}
示例9: TestCases
protected override Type[] TestCases()
{
if (!Directory.Exists(Db4oLibrarian.LibraryPath()))
{
TestPlatform.GetStdErr().WriteLine("DISABLED: " + GetType());
return new Type[] { };
}
ArrayList list = new ArrayList();
list.AddRange(base.TestCases());
Type[] netTypes = new Type[] {
typeof(SimplestPossibleHandlerUpdateTestCase),
typeof(GenericListVersionUpdateTestCase),
typeof(GenericDictionaryVersionUpdateTestCase),
typeof(DateTimeHandlerUpdateTestCase),
typeof(DateTimeOffsetHandlerUpdateTestCase),
typeof(IndexedDateTimeUpdateTestCase),
typeof(DecimalHandlerUpdateTestCase),
typeof(EnumHandlerUpdateTestCase),
typeof(GUIDHandlerUpdateTestCase),
typeof(HashtableUpdateTestCase),
typeof(NestedStructHandlerUpdateTestCase),
typeof(SByteHandlerUpdateTestCase),
typeof(StructHandlerUpdateTestCase),
typeof(UIntHandlerUpdateTestCase),
typeof(ULongHandlerUpdateTestCase),
typeof(UShortHandlerUpdateTestCase),
};
list.AddRange(netTypes);
return (Type[]) list.ToArray(typeof(Type));
}
示例10: GetHouses
public static ArrayList GetHouses( Mobile owner )
{
ArrayList list = new ArrayList();
Account acct = owner.Account as Account;
if ( acct == null )
{
list.AddRange( BaseHouse.GetHouses( owner ) );
}
else
{
for ( int i = 0; i < acct.Length; ++i )
{
Mobile mob = acct[i];
if ( mob != null )
list.AddRange( BaseHouse.GetHouses( mob ) );
}
}
list.Sort( HouseComparer.Instance );
return list;
}
示例11: GetAllMementos
/// <summary>
/// Retrieves an array of all InstanceMemento's stored by this MementoSource
/// </summary>
/// <returns></returns>
public InstanceMemento[] GetAllMementos()
{
var list = new ArrayList();
list.AddRange(fetchInternalMementos());
list.AddRange(_externalMementos.Values);
return (InstanceMemento[]) list.ToArray(typeof (InstanceMemento));
}
示例12: GetNetworkComputers
public static ArrayList GetNetworkComputers()
{
//TODO: need to convert this to a dict possibly? currently there can be duplicates
ArrayList ar = new ArrayList();
ar.AddRange(GetNetworkWin32Api());
ar.AddRange(GetNetworkDirectoryServices());
return ar;
}
示例13: GetAllEOSData
public ArrayList GetAllEOSData()
{
ArrayList arr = new ArrayList();
arr.AddRange(_liveEOSOutput);
arr.AddRange(_doneEOSOutput);
arr.AddRange(_rLiveEOSOutput);
arr.AddRange(_rDoneEOSOutput);
return arr;
}
示例14: CreateAll
public IList CreateAll()
{
var list = new ArrayList();
list.AddRange(countryBuilder.BuildAll());
list.AddRange(cityBuilder.BuildAll());
return list;
}
示例15: Search
public ICollection Search(String text, int projectId)
{
var result = new ArrayList();
result.AddRange(GetProjects(text, projectId));
result.AddRange(GetMilestones(text, projectId));
result.AddRange(GetTasks(text, projectId));
result.AddRange(GetMessages(text, projectId));
return result;
}