本文整理汇总了C#中Dictionary.MoveNext方法的典型用法代码示例。如果您正苦于以下问题:C# Dictionary.MoveNext方法的具体用法?C# Dictionary.MoveNext怎么用?C# Dictionary.MoveNext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dictionary
的用法示例。
在下文中一共展示了Dictionary.MoveNext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PosTest1
public bool PosTest1()
{
bool retVal = true;
TestLibrary.TestFramework.BeginScenario("PosTest1:Invoke the MoveNext method in Dictionary ValueCollection Enumerator");
try
{
Dictionary<string, string> dic = new Dictionary<string, string>();
dic.Add("1", "test1");
Dictionary<string, string>.ValueCollection.Enumerator ValEnumer1 = new Dictionary<string, string>.ValueCollection(dic).GetEnumerator();
if (ValEnumer1.Current != null || ValEnumer1.MoveNext() != true)
{
TestLibrary.TestFramework.LogError("001.1", "The ExpectResult is not the ActualResult");
retVal = false;
}
if (ValEnumer1.MoveNext())
{
TestLibrary.TestFramework.LogError("001.2", "The method MoveNext should return false but it did not");
}
ValEnumer1.Dispose();
}
catch (Exception e)
{
TestLibrary.TestFramework.LogError("002", "Unexpect exception:" + e);
retVal = false;
}
return retVal;
}
示例2: JSONStructIterator
public JSONStructIterator(JSONEntry oEntry)
{
m_object = oEntry.getObject();
m_enumStruct = m_object.GetEnumerator();
if (m_enumStruct.MoveNext())
m_strCurKey = m_enumStruct.Current.Key;
}
示例3: BuildBoostList
public static float[] BuildBoostList(IEnumerable<string> valArray, IDictionary<string, float> boostMap)
{
var valArray2 = new List<string>(valArray.Count());
// NOTE: we must loop through the list in order to make it format
// the values so it can match the formatted values in the boostMap.
foreach (var item in valArray)
{
valArray2.Add(item);
}
float[] boostList = new float[valArray2.Count];
Arrays.Fill(boostList, 1.0f);
if (boostMap != null && boostMap.Count > 0)
{
Dictionary<string, float>.Enumerator iter = new Dictionary<string, float>(boostMap).GetEnumerator();
while (iter.MoveNext())
{
KeyValuePair<string, float> entry = iter.Current;
int index = valArray2.IndexOf(entry.Key);
if (index >= 0)
{
float fval = entry.Value;
if (fval >= 0)
{
boostList[index] = fval;
}
}
}
}
return boostList;
}
示例4: PosTest2
public bool PosTest2()
{
bool retVal = true;
TestLibrary.TestFramework.BeginScenario("PosTest2:Return the property Current in Dictionary KeyCollection Enumerator 2");
try
{
Dictionary<string, string> dic = new Dictionary<string, string>();
dic.Add("1", "test1");
Dictionary<string, string>.KeyCollection.Enumerator keyEnumer = new Dictionary<string, string>.KeyCollection(dic).GetEnumerator();
while (keyEnumer.MoveNext())
{
if (keyEnumer.Current != "1")
{
TestLibrary.TestFramework.LogError("003", "the ExpectResult is not the ActualResult");
retVal = false;
}
}
keyEnumer.Dispose();
}
catch (Exception e)
{
TestLibrary.TestFramework.LogError("004", "Unexpect exception:" + e);
retVal = false;
}
return retVal;
}
示例5: ShowSensorSelectionWindow
public static void ShowSensorSelectionWindow(Vector2 nSize, Rect nPosition, VRPNDataObject nInFront)
{
size = nSize;
pos = nPosition;
inFront = nInFront;
sensors = VRPNEditEditor.Instance.GetSensors(inFront.dataName, inFront.originalDataTime, inFront.dataDevice);
disabledSensors = VRPNEditEditor.Instance.GetDisabledSensors(inFront.dataName, inFront.originalDataTime, inFront.dataDevice);
states = new bool[sensors.Count];
sensorsE = sensors.GetEnumerator();
//Initial sensors state
int numSensor = 0;
while (sensorsE.MoveNext())
{
int test;
if (disabledSensors.TryGetValue(sensorsE.Current.Key, out test))
{
states[numSensor] = false;
}
else
{
states[numSensor] = true;
}
numSensor++;
}
VRPNSensorSelectionWindow window = VRPNSensorSelectionWindow.CreateInstance<VRPNSensorSelectionWindow>();
window.ShowAsDropDown(pos, size);
}
示例6: SetAllActive
public void SetAllActive(bool active)
{
enumerator = taskDic.GetEnumerator();
while(enumerator.MoveNext())
{
GameTask task = enumerator.Current.Value;
task.Active = active;
}
}
示例7: Update
public void Update(float deltaTime)
{
enumerator = taskDic.GetEnumerator();
while(enumerator.MoveNext())
{
GameTask task = enumerator.Current.Value;
if (task.Active)
{
task.Timer += deltaTime;
if (task.Delay <= 0f)
{
task.Callback();
}
else if (task.Timer > task.Delay)
{
task.Timer = 0f;
task.Callback();
}
}
}
}
示例8: NegTest1
public bool NegTest1()
{
bool retVal = true;
TestLibrary.TestFramework.BeginScenario("NegTest1:The collection was modified after the enumerator was created");
try
{
Dictionary<string, string> dic = new Dictionary<string, string>();
dic.Add("1", "test1");
Dictionary<string, string>.ValueCollection.Enumerator ValEnumer = new Dictionary<string, string>.ValueCollection(dic).GetEnumerator();
dic.Add("2", "test2");
bool boolVal = ValEnumer.MoveNext();
TestLibrary.TestFramework.LogError("N001", "The collection was modified after the enumerator was created but not throw exception");
retVal = false;
}
catch (InvalidOperationException) { }
catch (Exception e)
{
TestLibrary.TestFramework.LogError("N002", "Unexpect exception:" + e);
retVal = false;
}
return retVal;
}
示例9: GetFirst
public bool GetFirst(out KeyValuePair<int, string> item)
{
item = new KeyValuePair<int, string>();
if (playList.Count == 0)
return false;
enumerator = playList.GetEnumerator();
if (enumerator.MoveNext())
{
item = enumerator.Current;
return true;
}
else
{
return false;
}
}
示例10: reset
public void reset()
{
m_enumStruct = m_object.GetEnumerator();
if (m_enumStruct.MoveNext())
m_strCurKey = m_enumStruct.Current.Key;
}
示例11: LoadBoardList
private static void LoadBoardList()
{
BoardsPaths = new Dictionary<string, string>();
DirectoryInfo di = new DirectoryInfo("Maps");
FileInfo[] rgFiles = di.GetFiles("*.xml");
XmlDocument document;
foreach (FileInfo fi in rgFiles)
{
document = new XmlDocument();
document.Load(fi.FullName);
String name = document.DocumentElement.GetAttribute("name");
BoardsPaths.Add(name, fi.FullName);
}
String key = String.Empty;
if (loaded)
{
key = enumerator.Current.Key;
}
enumerator = BoardsPaths.GetEnumerator();
enumerator.MoveNext();
if (loaded)
{
bool endReached = false;
while ((enumerator.Current.Key != key || endReached) && !(enumerator.Current.Key != key && endReached))
{
endReached = !enumerator.MoveNext();
}
if (enumerator.Current.Key != key && endReached)
{
enumerator = BoardsPaths.GetEnumerator();
enumerator.MoveNext();
}
}
loaded = true;
}
示例12: MoveEnumerator
static void MoveEnumerator()
{
if (!enumerator.MoveNext())
{
enumerator = BoardsPaths.GetEnumerator();
enumerator.MoveNext();
}
}
示例13: PlayFrame
public void PlayFrame()
{
if (start)
{
keystates[Settings.controls["MoveLeft"]] = false;
keystates[Settings.controls["MoveRight"]] = false;
keystates[Settings.controls["Jump"]] = false;
keystates[Settings.controls["Slide"]] = false;
keystates[Settings.controls["Box"]] = false;
time = 0;
start = false;
enumerator = events.GetEnumerator();
enumerator.MoveNext();
}
if (enumerator.Current.Key == time)
{
foreach (string s in enumerator.Current.Value)
{
string[] split = s.Split(' ');
Keys key = Settings.controls[split[1]];
keystates[key] = split[0] == "press";
}
enumerator.MoveNext();
}
if (time % 60 == 0)
{
if (recallibrater.Count > time / 60)
{
Game1.currentRoom.Runner.position = recallibrater[time / 60].Item1;
Game1.currentRoom.Runner.velocity = recallibrater[time / 60].Item2;
}
}
time++;
}
示例14: ReadAndExecuteCommand
public void ReadAndExecuteCommand(String InputString)
{
// Read and execute commend
#region Check if valid command
//has to be done via split, because irony doesn't recognize whitespaces,
//so "dfgfkgdfgkfd" could be detected as the command "df" with an
//strange parameter
if (!IsQuit && ValidCommandFromInputString(InputString))
{
#endregion
#region Prepare Command Execution
_Scanner = GraphCLICompiler.Scanner;
_CompilerContext = new CompilerContext(GraphCLICompiler);
_SourceFile = new SourceFile(InputString, "Source");
_Scanner.Prepare(_CompilerContext, _SourceFile);
_CompilerContext.Tokens.Clear();
_TokenStream = _Scanner.BeginNonDetermisticScan();
AstNode ExecutionTree = null;
ExecutionTree = GraphCLICompiler.Parser.ParseNonDeterministic(_CompilerContext, _TokenStream);
#region Checkt if valid command is complete
if (ExecutionTree == null)
{
MarkWrongOption(InputString, GraphCLICompiler.Parser.GetCorrectElements(_CompilerContext, _TokenStream));
}
else
{
//Carry on, the command is valid and complete
#endregion
ExtractOptionsFromTree(ExecutionTree);
#endregion
if (Commands[CurrentCommand].CLI_Output == CLI_Output.Standard)
WriteLine();
#region Handle Command Execution
//try
//{
Stopwatch sw = new Stopwatch();
sw.Start();
// TODO: what's this doing here?
//if (Parameters.Count > 0)
//{
#region Execute command...
if (_GraphDSSharp != null || CurrentCommand.Equals("MKFS") || CurrentCommand.Equals("MOUNT") || CurrentCommand.Equals("QUIT") || CurrentCommand.Equals("EXIT") || CurrentCommand.Equals("USEHISTORY") || CurrentCommand.Equals("SAVEHISTORY"))
{
Commands[CurrentCommand].Execute(_GraphDSSharp, ref CurrentPath, Parameters, InputString);
//if (CommandCategory.Equals(CLICommandCategory.CLIStandardCommand))
//{
#region Handle Quit and History
switch (CurrentCommand.ToUpper())
{
case "QUIT":
IsQuit = true;
break;
case "EXIT":
IsQuit = true;
break;
case "USEHISTORY":
//lets move to the right parameter
ParameterEnum = Parameters.GetEnumerator();
ParameterEnum.MoveNext();
ParameterEnum.MoveNext();
switch (ParameterEnum.Current.Key)
{
case "default":
LoadStandardHistory = true;
if (!HistoryFileName.Length.Equals(0))
SaveHistory(HistoryFileName, SthMountedList);
//.........这里部分代码省略.........
示例15: OnGUI
public void OnGUI()
{
scrollPosition = GUI.BeginScrollView(new Rect(0, 0, this.position.width, this.position.height), scrollPosition, new Rect(0, 0, this.position.width - scrollSize, labelsHeigth * (states.Length + 2)));
//Sensors Label
GUIStyle styleLabel = new GUIStyle(GUI.skin.label);
styleLabel.alignment = TextAnchor.MiddleCenter;
styleLabel.fontStyle = FontStyle.Bold;
GUI.Label(new Rect(0, 0, this.position.width - scrollSize, labelsHeigth), "Sensors", styleLabel);
//Sensors list
sensorsE = sensors.GetEnumerator();
int numSensor = 0;
while (sensorsE.MoveNext())
{
states[numSensor] = EditorGUI.ToggleLeft(new Rect(0, labelsHeigth * (numSensor + 1), this.position.width - scrollSize, labelsHeigth), "Sensor " + sensorsE.Current.Key + ":", states[numSensor]);
numSensor++;
}
sensorsE = sensors.GetEnumerator();
//Apply button
if (GUI.Button(new Rect(0, labelsHeigth * (states.Length + 1), this.position.width - scrollSize, labelsHeigth), "Apply"))
{
numSensor = 0;
while (sensorsE.MoveNext())
{
if (states[numSensor])
{
VRPNEditEditor.Instance.EnableTrackerSensor(inFront.dataName, inFront.originalDataTime, inFront.dataDevice, sensorsE.Current.Key);
}
else
{
VRPNEditEditor.Instance.DisableTrackerSensor(inFront.dataName, inFront.originalDataTime, inFront.dataDevice, sensorsE.Current.Key);
}
numSensor++;
}
this.Close();
}
GUI.EndScrollView();
}