using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { private static string _vsPath = @"D:\work\1222\storeInformation\Ericsson-CAT01R04-290512.xml"; private static Ericsson3G3G vEricsson3G3G = new Ericsson3G3G(); static void Main(string[] args) { vEricsson3G3G.OnCompleted = GetResult; vEricsson3G3G.ParseStart(FileStreamCreator.CreateFileStream(_vsPath), EnumStructOrData.Structure); Console.WriteLine("Over"); Console.Read(); } private static void GetResult() { Console.WriteLine("Result:{0}", Result.LstDataTable.Count); vEricsson3G3G.OnCompleted = GetResultData; #region Test Command vEricsson3G3G.ParseStart(FileStreamCreator.CreateFileStream(_vsPath), EnumStructOrData.DetailData); #endregion } private static void GetResultData() { Console.WriteLine("DataResult:{0}", Result.LstDataTable.Count); } } public class Test { public static string Source ="vsDataEthernetSwitchModule"; } }
这里很容易出问题。
vEricsson3G3G.OnCompleted+= GetResult;
vEricsson3G3G.OnCompleted+= GetResult;
这样两次调用实际上构成了一个循环。