本文整理汇总了C#中System.Collections.ArrayList.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# ArrayList.Clone方法的具体用法?C# ArrayList.Clone怎么用?C# ArrayList.Clone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.ArrayList
的用法示例。
在下文中一共展示了ArrayList.Clone方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Gfa
public Gfa(ArrayList X, int S, int S0, ArrayList F, ArrayList[,] I)
{
setType(TYPE.Gfa);
this.X = (ArrayList)X.Clone();
if (!X.Contains(EPSILON))
this.X.Add(EPSILON);
this.Read = (ArrayList)X.Clone();
this.S = S;
this.S0 = S0;
this.F = (ArrayList)F.Clone();
InitI(I);
}
示例2: Membership
/// <summary>
/// Constructor: Initialises with the specified initial members
/// </summary>
/// <param name="initial_members">Initial members of the membership</param>
public Membership(ArrayList initial_members)
{
members=new ArrayList();
if(initial_members != null)
members = (ArrayList)initial_members.Clone();
members = ArrayList.Synchronized(members);
}
示例3: filterExceptions
public void filterExceptions(int filterLength)
{
ArrayList cleanedWhiteList = new ArrayList();
for (int i = 0; i < WhiteList.Count; i++)
{
bool contained = false;
String exception = WhiteList[i].ToString();
if (exception.Length > filterLength)
{
exception = exception.Substring(0, filterLength);
}
for (int x = 0; x < cleanedWhiteList.Count; x++)
{
if (cleanedWhiteList[x].ToString().StartsWith(exception))
{
contained = true;
}
}
if (!contained)
{
cleanedWhiteList.Add(WhiteList[i]);
}
}
WhiteList = (ArrayList)cleanedWhiteList.Clone();
cleanedWhiteList.Clear();
cleanedWhiteList = null;
}
示例4: BusinessChange_Load
private void BusinessChange_Load(object sender, EventArgs e)
{
beList = (ArrayList)this.Tag;
origin=(ArrayList)beList.Clone();
user = ((BusinessEmployee)beList[0]).EmployeeId;
dept = user.Kdid;
business = ((BusinessEmployee)beList[0]).BusinessId;
foreach (BusinessEmployee be in beList)
{
ListViewItem item = new ListViewItem();
item.Text = be.EmployeeId.KuName;
item.Tag = be;
listView1.Items.Add(item);
}
IList udList=getUserByDept(dept);
foreach (WkTUser ud in udList)
{
ListViewItem item = new ListViewItem();
item.Text = ud.KuName;
item.Tag = ud;
listView2.Items.Add(item);
}
}
示例5: ThreadFunc
private void ThreadFunc()
{
ArrayList sockets = new ArrayList(2);
sockets.Add(mClientSocket);
sockets.Add(mServerSocket);
while (mRunning)
{
IList readsockets = (IList)sockets.Clone();
Socket.Select(readsockets, null, null, 1000000);
foreach (Socket s in readsockets)
{
int length = 0;
try
{
length = s.Receive(mBuffer);
} catch { }
if (length == 0)
{
mRunning = false;
if (ProxyDisconnected != null) ProxyDisconnected(this);
break;
}
Socket dest = (s == mServerSocket) ? mClientSocket : mServerSocket;
dest.Send(mBuffer, length, SocketFlags.None);
}
}
}
示例6: PivotCommand
public PivotCommand(ArrayList objects, float X, float Y, float Z)
{
this.objects =(ArrayList)objects.Clone();
this.X = X;
this.Y = Y;
this.Z = Z;
pivotPoints = new ArrayList();
}
示例7: BinaryPriorityQueue
protected BinaryPriorityQueue(ArrayList Core, IComparer Comp, bool Copy)
{
if(Copy)
InnerList = Core.Clone() as ArrayList;
else
InnerList = Core;
Comparer = Comp;
}
示例8: TestGetItems
public void TestGetItems()
{
//--------------------------------------------------------------------------
// Variable definitions.
//--------------------------------------------------------------------------
ArrayList arrList = null;
//
// Construct array list.
//
arrList = new ArrayList();
// Add items to the lists.
for (int ii = 0; ii < strHeroes.Length; ++ii)
{
arrList.Add(strHeroes[ii]);
}
// Verify items added to list.
Assert.Equal(strHeroes.Length, arrList.Count);
//Adapter, GetRange, Synchronized, ReadOnly returns a slightly different version of
//BinarySearch, Following variable cotains each one of these types of array lists
ArrayList[] arrayListTypes = {
(ArrayList)arrList.Clone(),
(ArrayList)ArrayList.Adapter(arrList).Clone(),
(ArrayList)ArrayList.FixedSize(arrList).Clone(),
(ArrayList)ArrayList.ReadOnly(arrList).Clone(),
(ArrayList)arrList.GetRange(0, arrList.Count).Clone(),
(ArrayList)ArrayList.Synchronized(arrList).Clone()};
foreach (ArrayList arrayListType in arrayListTypes)
{
arrList = arrayListType;
//
// [] Verify get method.
//
// Search and verify selected items.
for (int ii = 0; ii < strHeroes.Length; ++ii)
{
// Verify get.
Assert.Equal(0, ((string)arrList[ii]).CompareTo(strHeroes[ii]));
}
//
// [] Invalid Index.
//
Assert.Throws<ArgumentOutOfRangeException>(() =>
{
string str = (string)arrList[(int)arrList.Count];
});
Assert.Throws<ArgumentOutOfRangeException>(() =>
{
string str = (string)arrList[-1];
});
}
}
示例9: Grammer
/// <summary>
/// initialisation de la grammaire
/// </summary>
/// <param name="X">l'alphabet</param>
/// <param name="V">les variables</param>
/// <param name="S">l'axiome</param>
public Grammer(ArrayList X, ArrayList V, char S)
{
this.X = (ArrayList)X.Clone();
this.V = V;
this.S = S;
this.P = new ArrayList[V.Count];
for (int i = 0; i < V.Count; i++)
P[i] = new ArrayList();
}
示例10: PGfa
public PGfa(ArrayList X, int S)
{
setType(TYPE.PGfa);
if (!X.Contains(EPSILON))
this.X.Add(EPSILON);
this.X = (ArrayList)X.Clone();
this.S = S;
InitI();
}
示例11: DataAffinity
/// <summary>
/// Constructor
/// </summary>
/// <param name="groups"></param>
/// <param name="strict"></param>
public DataAffinity(ArrayList groups, bool strict)
{
if (groups != null)
{
_groups = (ArrayList) groups.Clone();
_groups.Sort();
}
_strict = strict;
}
示例12: Recombine
public ArrayList Recombine(ArrayList maleGenes, ArrayList femaleGenes)
{
ArrayList Child = maleGenes.Clone() as ArrayList;
bool usingMale = true;
for (int i = 0; i < maleGenes.Count; i++)
{
Child[i] = usingMale ? ((IGene)maleGenes[i]).Clone() : Child[i] = ((IGene)femaleGenes[i]).Clone();
if (i % GenesPerCrossover == 0) usingMale = !usingMale;
}
return Child;
}
示例13: EqualsCollection
public void EqualsCollection()
{
ArrayList value1 = new ArrayList();
value1.Add(10);
value1.Add(20);
ArrayList value2 = (ArrayList) value1.Clone();
TypedValue t1 = new TypedValue(NHibernateUtil.Int32, value1, EntityMode.Poco);
TypedValue t2 = new TypedValue(NHibernateUtil.Int32, value2, EntityMode.Poco);
Assert.IsTrue(t1.Equals(t2));
}
示例14: RArray
public RArray(NetRuby rb, ArrayList a, bool clone) :
base(rb, rb.cArray)
{
if (clone)
{
// but it creates only a shallow copy.
ptr = (ArrayList)a.Clone();
}
else
{
ptr = a;
}
}
示例15: ItemsNotInCache
/**
* Takes an array of items and returns an new array of any that are
* NOT currently in cache.
*/
public ArrayList ItemsNotInCache(ArrayList items)
{
// First build a list of "new" items to add to cache
if (!HasDataFromServer) {
return items.Clone () as ArrayList;
}
var batch = new ArrayList ();
for (int i=0; i<items.Count; i++)
if (!Has ((items [i] as string)))
batch.Add (items [i]);
return batch;
}