本文整理汇总了C#中System.Collections.ArrayList.GetEnumerator方法的典型用法代码示例。如果您正苦于以下问题:C# ArrayList.GetEnumerator方法的具体用法?C# ArrayList.GetEnumerator怎么用?C# ArrayList.GetEnumerator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.ArrayList
的用法示例。
在下文中一共展示了ArrayList.GetEnumerator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessFromStringOrderList
public void ProcessFromStringOrderList(string text1)
{
IEnumerator enumerator = null;
ArrayList list = new ArrayList();
string str = "";
if (text1.Contains("\r\n"))
{
list = CommonFunction.SeperateStringBySymbol(text1, "\r\n");
}
else
{
list.Add(text1);
}
try
{
enumerator = list.GetEnumerator();
while (enumerator.MoveNext())
{
str = Conversions.ToString(enumerator.Current);
this.ProcessFromStringOrder(str);
}
}
finally
{
if (enumerator is IDisposable)
{
(enumerator as IDisposable).Dispose();
}
}
}
示例2: Delete
protected virtual void Delete(ITestableReplicationProviderInside provider)
{
ArrayList toDelete = new ArrayList();
IEnumerator rr = provider.GetStoredObjects(typeof(R0)).GetEnumerator();
while (rr.MoveNext())
{
object o = rr.Current;
IReflectClass claxx = ReplicationReflector().ForObject(o);
SetFieldsToNull(o, claxx);
toDelete.Add(o);
}
object commitObject = null;
for (IEnumerator iterator = toDelete.GetEnumerator(); iterator.MoveNext(); )
{
object o = iterator.Current;
//System.out.println("o = " + o);
provider.Delete(o);
commitObject = o;
}
if (commitObject != null)
{
provider.Commit();
}
else
{
provider.Commit();
}
}
示例3: GetEnumValue
private IEnumerator GetEnumValue(string sEnum)
{
if(sEnum == null || sEnum.Trim().Length == 0)
return null;
ArrayList list = new ArrayList();
string sRes = sEnum.Trim();
int startIndex=0;
int i= 0;
while(i != -1)
{
i= sRes.IndexOf(',', startIndex);
if(i != -1)
{
list.Add(sRes.Substring(startIndex, i - startIndex));
startIndex = i+1;
if(startIndex == sRes.Length)
break;
}
else list.Add(sRes.Substring(startIndex));
}
return list.GetEnumerator();
}
示例4: TestUnCancelledTraversalWithStartingPointInTheTree
public virtual void TestUnCancelledTraversalWithStartingPointInTheTree()
{
IList actual = new ArrayList();
var tree = CreateTree();
Tree.Traverse(tree, new TreeInt(6), new _ICancellableVisitor4_66(actual));
IteratorAssert.AreEqual(CreateList(6).GetEnumerator(), actual.GetEnumerator());
}
示例5: parseLines
private AccNode parseLines(ArrayList accLines)
{
AccNode parent = null;
IEnumerator it = accLines.GetEnumerator();
AccNode an = BuildNode(parent, ref it, 0);
return an;
}
示例6: removeDelegate
//
// handlers management
//
#region mark TouchDispatcher - Helpers
bool removeDelegate(System.Object del, ArrayList fromQueue)
{
System.Object handlerToRemove = null;
var enumerator = fromQueue.GetEnumerator();
while (enumerator.MoveNext()) {
System.Object handlerOrDelegate = enumerator.Current;
if( handlerOrDelegate is CCTouchHandler ) {
// it is a handler
if (del == ((CCTouchHandler)handlerOrDelegate).delegate_) {
handlerToRemove = handlerOrDelegate;
break;
}
} else {
// it is a delegate
if (del == handlerOrDelegate) {
handlerToRemove = handlerOrDelegate;
break;
}
}
}
if( handlerToRemove!=null ) {
fromQueue.Remove(handlerToRemove);
return true;
}
return false;
}
示例7: calculateMatchRate
//return how closely an input string resembles a single memory entry
//break because dont want to count same word re-occurences
protected int calculateMatchRate(ArrayList input, ArrayList memory)
{
int matchRate = 0;
string cc = "";
string bb = "";
IEnumerator i = input.GetEnumerator();
while(i.MoveNext())
{
cc = (string)i.Current;
cc = cc.ToLower();
IEnumerator m = memory.GetEnumerator();
while(m.MoveNext())
{
bb = (string)m.Current;
bb = bb.ToLower();
if(cc == bb)
{
matchRate++; break;
}
}
}
return matchRate;
}
示例8: Main
static void Main(string[] args)
{
// Create an ArrayList
ArrayList al = new ArrayList();
// Add some elements
al.Add("foo");
al.Add(3.7);
al.Add(5);
al.Add(false);
// List them
Console.WriteLine("Count={0}",al.Count);
for(int i = 0; i < al.Count; i++)
Console.WriteLine("al[{0}]={1}", i, al[i]);
// Remove the element at index 1
al.RemoveAt(1);
// List them
Console.WriteLine("Count={0}",al.Count);
for(int i = 0; i < al.Count; i++)
Console.WriteLine("al[{0}]={1}", i, al[i]);
IEnumerator ie = al.GetEnumerator();
while(ie.MoveNext())
Console.WriteLine(ie.Current);
}
示例9: handleUpdate
void handleUpdate(UpdateSet update) {
ArrayList vmUpdates = new ArrayList();
ArrayList hostUpdates = new ArrayList();
PropertyFilterUpdate[] pfus = update.filterSet;
for(int pfui=0; pfui<pfus.Length; ++ pfui) {
ObjectUpdate[] ous = pfus[pfui].objectSet;
for(int oui=0; oui<ous.Length; ++oui) {
if(ous[oui].obj.type.Equals("VirtualMachine")) {
vmUpdates.Add(ous[oui]);
} else if(ous[oui].obj.type.Equals("HostSystem")) {
hostUpdates.Add(ous[oui]);
}
}
}
if(vmUpdates.Count > 0) {
Console.WriteLine("Virtual Machine updates:");
for (IEnumerator vmi = vmUpdates.GetEnumerator(); vmi.MoveNext(); )
{
handleObjectUpdate((ObjectUpdate)vmi.Current);
}
}
if(hostUpdates.Count > 0) {
Console.WriteLine("Host updates:");
for (IEnumerator vmi = hostUpdates.GetEnumerator(); vmi.MoveNext(); )
{
handleObjectUpdate((ObjectUpdate)vmi.Current);
}
}
}
示例10: Main
static void Main()
{
//Start DB Connection
Database.init();
Database.AddLog("Starting Up");
//Is this the first run?
if (Database.GetSetting("FirstRun", "YAMS") != "true") YAMS.Util.FirstRun();
Database.SaveSetting("AdminPassword", "password");
Database.AddLog("Reading minecraft servers!", "app", "debug");
MySqlDataReader readerServers = Database.GetServers();
ArrayList ServerIDs = new ArrayList();
while (readerServers.Read())
{
int ServerID = Convert.ToInt32(readerServers.GetString("ServerID"));
ServerIDs.Add(ServerID);
}
readerServers.Close();
System.Collections.IEnumerator enu = ServerIDs.GetEnumerator();
while (enu.MoveNext())
{
int ServerID = Convert.ToInt32(enu.Current);
MCServer myServer = new MCServer(ServerID);
Core.Servers.Add(ServerID, myServer);
}
//Start Webserver
WebServer.Init();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new frmMain());
}
示例11: CFArrayFromManageArrayList
public static IntPtr CFArrayFromManageArrayList(ArrayList arrySrc)
{
if (arrySrc == null)
{
return IntPtr.Zero;
}
IntPtr theArray = CFArrayCreateMutable(kCFAllocatorDefault, arrySrc.Count, kCFTypeArrayCallBacks);
IEnumerator enumerator = arrySrc.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
object current = enumerator.Current;
if (current != null)
{
CFArrayAppendValue(theArray, CFTypeFromManagedType(current));
}
}
}
finally
{
IDisposable disposable = enumerator as IDisposable;
if (disposable != null)
{
disposable.Dispose();
}
}
return theArray;
}
示例12: getMissingFilesForWidget
private ArrayList getMissingFilesForWidget(LinkedList<FileInfo> filesCurWidget, ArrayList files)
{
IEnumerator ienumf = filesCurWidget.GetEnumerator();
ArrayList missingFiles = new ArrayList();
bool found = false;
while (ienumf.MoveNext())
{
FileInfo finfo = (FileInfo)ienumf.Current;
found = false;
IEnumerator ienuml = files.GetEnumerator();
while (ienuml.MoveNext())
{
string localPath = (string)ienuml.Current;
if (localPath == Utils.normalizePathname(finfo.localPath))
{
found = true;
break;
}
}
if ( !found )
{
missingFiles.Add(finfo.localPath);
}
}
return missingFiles;
}
示例13: calculateMatchRate
//return how closely an input string resembles a single memory entry
protected int calculateMatchRate(ArrayList input, ArrayList memory)
{
int matchRate = 0;
IEnumerator i = input.GetEnumerator();
IEnumerator m = memory.GetEnumerator();
while(i.MoveNext())
{
while(m.MoveNext())
{
SortedList isNewWord = new SortedList();
string cc = (string)i.Current;
string bb = (string)m.Current;
cc.ToLower();
bb.ToLower();
//mehrfachwertung für ein wort vermeiden z.b. eine 3 für 3x "ich"
if(!isNewWord.Contains(bb))
{
isNewWord.Add(bb, bb);
if(cc == bb)
{
matchRate++;
}
}
isNewWord.Clear();
}
}
return matchRate;
}
示例14: SearchAgent
public SearchAgent(Problem p, Search search)
{
actionList = search.search(p);
actionIterator = actionList.GetEnumerator();
searchMetrics = search.getMetrics();
}
示例15: GameState
public GameState(Game game_i)
{
game = game_i;
playerList = game.Players.GetEnumerator();
playerList.MoveNext();
currentPlayer = (Gpremacy.Player)playerList.Current;
//previousTerritory = null;
//arrowOn = false;
commandList = new ArrayList();
networkCommands = new Queue();
states = new ArrayList();
states.Add(new Orig_Play1Upkeep(game));
states.Add(new Orig_Play2Sell(game));
states.Add(new Orig_Play3Attack(game));
states.Add(new Orig_Play4Move(game));
states.Add(new Orig_Play5Build(game));
states.Add(new Orig_Play6Prospect(game));
stateList = states.GetEnumerator();
stateList.MoveNext();
currentState = (Gpremacy.State)stateList.Current;
stateList.MoveNext();
nextState = (Gpremacy.State)stateList.Current;
turnNumber = 1;
//nextPlayer();
//nextState();
GLib.Timeout.Add (1000, new GLib.TimeoutHandler (NetworkExecuteRun));
}