diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2017-06-14 02:14:48 +0200 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2017-06-14 02:14:48 +0200 |
| commit | 570f6f9b7c9ed25adf618b02f5cfe0f1b3e9afe7 (patch) | |
| tree | d5ef230605ab9265653f8f63f29cdbf60cc239b7 /src/GraphicObjects/GraphicObject.cs | |
| parent | 3ef8807774c91df0cd0bb5a82f9137882b77c611 (diff) | |
replace foreach loops with for ones
Diffstat (limited to 'src/GraphicObjects/GraphicObject.cs')
| -rw-r--r-- | src/GraphicObjects/GraphicObject.cs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index 0db8fb54..46b4c31b 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -719,10 +719,10 @@ namespace Crow //set local GraphicObject to root object passed as 1st argument il.Emit (OpCodes.Ldarg_0); il.Emit (OpCodes.Stloc_0); - - foreach (EventInfo ei in thisType.GetEvents(BindingFlags.Public | BindingFlags.Instance)) { + EventInfo[] eis = thisType.GetEvents(BindingFlags.Public | BindingFlags.Instance); + for (int i = 0; i < eis.Length; i++) { string expression; - if (!getDefaultEvent(ei, styling, out expression)) + if (!getDefaultEvent(eis[i], styling, out expression)) continue; //TODO:dynEventHandler could be cached somewhere, maybe a style instanciator class holding the styling delegate and bound to it. foreach (string exp in CompilerServices.splitOnSemiColumnOutsideAccolades(expression)) { @@ -733,15 +733,15 @@ namespace Crow //push eventInfo as 1st arg of compile il.Emit (OpCodes.Ldloc_0); il.Emit (OpCodes.Call, CompilerServices.miGetType); - il.Emit (OpCodes.Ldstr, ei.Name);//push event name + il.Emit (OpCodes.Ldstr, eis[i].Name);//push event name il.Emit (OpCodes.Call, CompilerServices.miGetEvent); //push expression as 2nd arg of compile il.Emit (OpCodes.Ldstr, trimed.Substring (1, trimed.Length - 2)); //push null as 3rd arg, currentNode, not known when instanciing il.Emit (OpCodes.Ldnull); il.Emit (OpCodes.Callvirt, CompilerServices.miCompileDynEventHandler); - il.Emit (OpCodes.Castclass, ei.EventHandlerType); - il.Emit (OpCodes.Callvirt, ei.AddMethod); + il.Emit (OpCodes.Castclass, eis[i].EventHandlerType); + il.Emit (OpCodes.Callvirt, eis[i].AddMethod); }else Debug.WriteLine("error in styling, event not handled : " + trimed); } |