diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2017-06-15 17:32:04 +0200 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2017-06-15 17:32:04 +0200 |
| commit | 1fdbaaf4ae209e26ef8767ae13ebb9aa9d1f79c7 (patch) | |
| tree | 5586932c635ca68a67bddcb83918b74ecad79758 /src/GraphicObjects/GraphicObject.cs | |
| parent | 570f6f9b7c9ed25adf618b02f5cfe0f1b3e9afe7 (diff) | |
Revert "replace foreach loops with for ones"
This reverts commit 1c3263454961eb207a01b67c51d0acf88376d522.
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 46b4c31b..0db8fb54 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); - EventInfo[] eis = thisType.GetEvents(BindingFlags.Public | BindingFlags.Instance); - for (int i = 0; i < eis.Length; i++) { + + foreach (EventInfo ei in thisType.GetEvents(BindingFlags.Public | BindingFlags.Instance)) { string expression; - if (!getDefaultEvent(eis[i], styling, out expression)) + if (!getDefaultEvent(ei, 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, eis[i].Name);//push event name + il.Emit (OpCodes.Ldstr, ei.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, eis[i].EventHandlerType); - il.Emit (OpCodes.Callvirt, eis[i].AddMethod); + il.Emit (OpCodes.Castclass, ei.EventHandlerType); + il.Emit (OpCodes.Callvirt, ei.AddMethod); }else Debug.WriteLine("error in styling, event not handled : " + trimed); } |