public static void Operations(string csv, string line_name, bool all = false) { var engine = new FileHelperAsyncEngine <OperationCounterCSV>(); using (engine.BeginReadString(csv)) { // This wont display anything, we have dropped it foreach (var err in engine.ErrorManager.Errors) { Console.WriteLine(); Console.WriteLine("Error on Line number: {0}", err.LineNumber); Console.WriteLine("Record causing the problem: {0}", err.RecordString); Console.WriteLine("Complete exception information: {0}", err.ExceptionInfo.ToString()); } // The engine is IEnumerable foreach (OperationCounterCSV cust in engine) { if (cust.Name == line_name || all) { Console.WriteLine(cust.Name + " (<- " + cust.Caller + ") CNOT count avg " + cust.CNOTAverage + " (variance " + cust.CNOTVariance + ")"); Console.WriteLine(cust.Name + " (<- " + cust.Caller + ") Clifford count avg " + cust.QubitCliffordAverage + " (variance " + cust.QubitCliffordVariance + ")"); Console.WriteLine(cust.Name + " (<- " + cust.Caller + ") T count avg " + cust.TAverage + " (variance " + cust.TVariance + ")"); Console.WriteLine(cust.Name + " (<- " + cust.Caller + ") R count avg " + cust.RAverage + " (variance " + cust.RVariance + ")"); Console.WriteLine(cust.Name + " (<- " + cust.Caller + ") Measure count avg " + cust.MeasureAverage + " (variance " + cust.MeasureVariance + ")"); } } } }
public static void Main(string[] args) { var type = typeof(Record); var defaultDelimiter = ","; var aName = type.Assembly.GetName(); var ab = AppDomain.CurrentDomain.DefineDynamicAssembly(aName, AssemblyBuilderAccess.Run); var mb = ab.DefineDynamicModule(aName.Name); var tb = mb.DefineType(type.Name + "Proxy", TypeAttributes.Public, type); var attrCtorParams = new Type[] { typeof(string) }; var attrCtorInfo = typeof(DelimitedRecordAttribute).GetConstructor(attrCtorParams); var attrBuilder = new CustomAttributeBuilder(attrCtorInfo, new object[] { defaultDelimiter }); tb.SetCustomAttribute(attrBuilder); var newType = tb.CreateType(); var engine = new FileHelperAsyncEngine(newType); //var options = engine.Options as DelimitedRecordOptions; //options.Delimiter = "|"; // you can still change delimiter if you need to string src = "abc,JohnDoe"; using (engine.BeginReadString(src)) { var enumerator = (engine as IEnumerable <object>).GetEnumerator(); enumerator.MoveNext(); var currentRecord = enumerator.Current as Record; Assert.AreEqual("abc", currentRecord.Id); Assert.AreEqual("JohnDoe", currentRecord.Name); } Console.ReadKey(); }
public void AsyncFieldIndex1() { var engine = new FileHelperAsyncEngine(typeof (SampleType)); var sw = new StringWriter(); engine.BeginWriteStream(sw); engine[0] = new DateTime(2003, 2, 1); engine[1] = "B"; engine[2] = 18; engine.WriteNextValues(); engine.Close(); engine.BeginReadString(sw.GetStringBuilder().ToString()); engine.ReadNext(); Assert.AreEqual(new DateTime(2003, 2, 1), engine[0]); Assert.AreEqual("B", engine[1]); Assert.AreEqual(18, engine[2]); Assert.AreEqual(new DateTime(2003, 2, 1), engine.LastRecordValues[0]); Assert.AreEqual("B", engine.LastRecordValues[1]); Assert.AreEqual(18, engine.LastRecordValues[2]); engine.ReadNext(); Assert.IsNull(engine.LastRecord); Assert.IsNull(engine.LastRecordValues); }
public static void Width(string csv, string line_name, bool all = false) { var engine = new FileHelperAsyncEngine <WidthCounterCSV>(); using (engine.BeginReadString(csv)) { // This wont display anything, we have dropped it foreach (var err in engine.ErrorManager.Errors) { Console.WriteLine(); Console.WriteLine("Error on Line number: {0}", err.LineNumber); Console.WriteLine("Record causing the problem: {0}", err.RecordString); Console.WriteLine("Complete exception information: {0}", err.ExceptionInfo.ToString()); } // The engine is IEnumerable foreach (WidthCounterCSV cust in engine) { if (cust.Name == line_name || all) { Console.WriteLine(cust.Name + " (<- " + cust.Caller + ") initial width avg " + cust.InputWidthAverage + " (variance " + cust.InputWidthVariance + ")"); Console.WriteLine(cust.Name + " (<- " + cust.Caller + ") extra width avg " + cust.ExtraWidthAverage + " (variance " + cust.ExtraWidthVariance + ")"); Console.WriteLine(cust.Name + " (<- " + cust.Caller + ") return width avg " + cust.ReturnWidthAverage + " (variance " + cust.ReturnWidthVariance + ")"); Console.WriteLine(cust.Name + " (<- " + cust.Caller + ") borrowed width avg " + cust.BorrowedWidthAverage + " (variance " + cust.BorrowedWidthVariance + ")"); } } } }
public void AsyncFieldIndex1() { var engine = new FileHelperAsyncEngine(typeof(SampleType)); var sw = new StringWriter(); engine.BeginWriteStream(sw); engine[0] = new DateTime(2003, 2, 1); engine[1] = "B"; engine[2] = 18; engine.WriteNextValues(); engine.Close(); engine.BeginReadString(sw.GetStringBuilder().ToString()); engine.ReadNext(); Assert.AreEqual(new DateTime(2003, 2, 1), engine[0]); Assert.AreEqual("B", engine[1]); Assert.AreEqual(18, engine[2]); Assert.AreEqual(new DateTime(2003, 2, 1), engine.LastRecordValues[0]); Assert.AreEqual("B", engine.LastRecordValues[1]); Assert.AreEqual(18, engine.LastRecordValues[2]); engine.ReadNext(); Assert.IsNull(engine.LastRecord); Assert.IsNull(engine.LastRecordValues); }
public void BeginWriteWhileReading() { FileHelperAsyncEngine eng = new FileHelperAsyncEngine(typeof(SampleType)); eng.BeginReadString("jejjeje"); Assert.Throws <BadUsageException>(() => eng.BeginWriteFile(@"c:\tempfile.tmp")); }
public void BeginWriteWhileReading() { FileHelperAsyncEngine eng = new FileHelperAsyncEngine(typeof(SampleType)); eng.BeginReadString("jejjeje"); var filename = TestCommon.GetTempFile("TempWrite.txt"); Assert.Throws<BadUsageException>(() => eng.BeginWriteFile(filename)); }
public static string CSV(Dictionary <string, string> csv, string line_name, bool display_header = false, string comment = "", bool all = false, string suffix = "") { string results = string.Empty; // print results if (display_header) { results += "operation, CNOT count, 1-qubit Clifford count, T count, R count, M count, T depth, initial width, extra width, comment, \n"; } results += $"{Environment.NewLine}{line_name}{suffix}, "; var countEngine = new FileHelperAsyncEngine <OperationCounterCSV>(); using (countEngine.BeginReadString(csv[MetricsCountersNames.primitiveOperationsCounter])) { // The engine is IEnumerable foreach (OperationCounterCSV cust in countEngine) { if (cust.Name == line_name || all) { results += $"{cust.CNOTAverage}, {cust.QubitCliffordAverage}, {cust.TAverage}, {cust.RAverage}, {cust.MeasureAverage}, "; } } } var depthEngine = new FileHelperAsyncEngine <DepthCounterCSV>(); using (depthEngine.BeginReadString(csv[MetricsCountersNames.depthCounter])) { // The engine is IEnumerable foreach (DepthCounterCSV cust in depthEngine) { if (cust.Name == line_name || all) { results += $"{cust.DepthAverage}, "; } } } var widthEngine = new FileHelperAsyncEngine <WidthCounterCSV>(); using (widthEngine.BeginReadString(csv[MetricsCountersNames.widthCounter])) { // The engine is IEnumerable foreach (WidthCounterCSV cust in widthEngine) { if (cust.Name == line_name || all) { results += $"{cust.InputWidthAverage}, {cust.ExtraWidthAverage}, "; } } } results += $"{comment}, "; return(results); }
public void BeginWriteWhileReading() { var eng = new FileHelperAsyncEngine(typeof(SampleType)); eng.BeginReadString("jejjeje"); var filename = TestCommon.GetTempFile("TempWrite.txt"); Assert.Throws <BadUsageException>(() => eng.BeginWriteFile(filename)); }
public void LoadFromXML() { ClassBuilder cb = ClassBuilder.LoadFromXml(TestCommon.GetPath("Dynamic", "VendorImport.xml")); Type t = cb.CreateRecordClass(); // this line generates an error in the FH library using (var engine = new FileHelperAsyncEngine(t)) { engine.BeginReadString(""); while (engine.ReadNext() != null) {} } }
public void AsyncFieldIndexBad5() { var engine = new FileHelperAsyncEngine(typeof(SampleType)); engine.BeginReadString(data); while (engine.ReadNext() != null) { } engine.Close(); Assert.Throws <BadUsageException>(() => { object val = engine[2]; }); }
public void AsyncFieldIndexBad1() { var engine = new FileHelperAsyncEngine(typeof (SampleType)); engine.BeginReadString(data); while (engine.ReadNext() != null) { Assert.Throws<IndexOutOfRangeException>(() => { object val = engine[10]; }); } engine.Close(); }
public void LoadFromXML() { ClassBuilder cb = ClassBuilder.LoadFromXml(TestCommon.GetPath("Dynamic", "VendorImport.xml")); Type t = cb.CreateRecordClass(); // this line generates an error in the FH library using (var engine = new FileHelperAsyncEngine(t)) { engine.BeginReadString(""); while (engine.ReadNext() != null) { } } }
public void AsyncFieldIndex3() { var engine = new FileHelperAsyncEngine(typeof (SampleType)); engine.BeginReadString(data); while (engine.ReadNext() != null) { Assert.AreEqual(engine["Field1"], engine.LastRecordValues[0]); Assert.AreEqual(engine["Field2"], engine.LastRecordValues[1]); Assert.AreEqual(engine["Field3"], engine.LastRecordValues[2]); } engine.Close(); }
public void MoreCallsToMoveNext1() { var engine = new FileHelperAsyncEngine<Record>(); string src = "first,line\nabc,JohnDoe"; using (engine.BeginReadString(src)) { var enumerator = (engine as IEnumerable<Record>).GetEnumerator(); enumerator.MoveNext(); enumerator.MoveNext(); enumerator.MoveNext(); enumerator.MoveNext(); } }
public void AsyncFieldIndexBad1() { FileHelperAsyncEngine engine = new FileHelperAsyncEngine(typeof(SampleType)); engine.BeginReadString(data); while (engine.ReadNext() != null) { Assert.Throws <IndexOutOfRangeException>(() => { object val = engine[10]; }); } engine.Close(); }
public void MoreCallsToMoveNext1() { var engine = new FileHelperAsyncEngine <Record>(); string src = "first,line\nabc,JohnDoe"; using (engine.BeginReadString(src)) { var enumerator = (engine as IEnumerable <Record>).GetEnumerator(); enumerator.MoveNext(); enumerator.MoveNext(); enumerator.MoveNext(); enumerator.MoveNext(); } }
public void AsyncFieldIndex4() { var engine = new FileHelperAsyncEngine(typeof (SampleType)); engine.BeginReadString(data); Assert.AreEqual(3, engine.Options.FieldCount); while (engine.ReadNext() != null) { for (int i = 0; i < engine.Options.FieldCount; i++) Assert.IsNotNull(engine[i]); } engine.Close(); }
public void AsyncFieldIndex3() { var engine = new FileHelperAsyncEngine(typeof(SampleType)); engine.BeginReadString(data); while (engine.ReadNext() != null) { Assert.AreEqual(engine["Field1"], engine.LastRecordValues[0]); Assert.AreEqual(engine["Field2"], engine.LastRecordValues[1]); Assert.AreEqual(engine["Field3"], engine.LastRecordValues[2]); } engine.Close(); }
public List <CountryStage> ImportCountiesStage(string source) { var result = new List <CountryStage>(); var engine = new FileHelperAsyncEngine <CountryStage>(); using (engine.BeginReadString(source)) { foreach (CountryStage countryStage in engine) { result.Add(countryStage); } } return(result); }
/// <summary> /// Run a single timing test with data provided. /// Will display statistics to the windows grid /// </summary> /// <param name="records">number of record to process</param> /// <param name="data">Data to process</param> private void RunTest(int records, string data) { ListViewItem item = new ListViewItem("Test " + (pb.Position + 1).ToString()); item.SubItems.Add(records.ToString()); //item.SubItems[0].Font = new Font(lstView.Font, FontStyle.Bold); item.SubItems.Add((data.Length / 1024).ToString() + " Kb"); lstView.Items.Add(item); Application.DoEvents(); GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); long start1 = DateTime.Now.Ticks; mEngine.ReadString(data); long end1 = DateTime.Now.Ticks; TimeSpan span1, span2; span1 = new TimeSpan(end1 - start1); item.SubItems.Add(string.Format("{0:F4}", span1.TotalSeconds) + " sec"); Application.DoEvents(); GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); long start2 = DateTime.Now.Ticks; mAsyncEngine.BeginReadString(data); while (mAsyncEngine.ReadNext() != null) { } long end2 = DateTime.Now.Ticks; span2 = new TimeSpan(end2 - start2); item.SubItems.Add(string.Format("{0:F4}", span2.TotalSeconds) + " sec"); Application.DoEvents(); }
/// <summary> /// Run the Async engine with a vertical bar file /// </summary> private void cmdRun_Click(object sender, EventArgs e) { txtOut.Text = string.Empty; var engine = new FileHelperAsyncEngine<CustomersVerticalBar>(); engine.BeginReadString(TestData.mCustomersTest); // The Async engines are IEnumerable foreach(CustomersVerticalBar cust in engine) { // your code here txtOut.Text += cust.CustomerID + " - " + cust.ContactTitle + Environment.NewLine; } engine.Close(); }
/// <summary> /// Run the Async engine with a vertical bar file /// </summary> private void cmdRun_Click(object sender, EventArgs e) { txtOut.Text = string.Empty; var engine = new FileHelperAsyncEngine <CustomersVerticalBar>(); engine.BeginReadString(TestData.mCustomersTest); // The Async engines are IEnumerable foreach (CustomersVerticalBar cust in engine) { // your code here txtOut.Text += cust.CustomerID + " - " + cust.ContactTitle + Environment.NewLine; } engine.Close(); }
public void AsyncFieldIndex1() { var engine = new FileHelperAsyncEngine(typeof (SampleType)); engine.BeginReadString(data); foreach (SampleType rec in engine) { Assert.AreEqual(rec.Field1, engine[0]); Assert.AreEqual(rec.Field2, engine[1]); Assert.AreEqual(rec.Field3, engine[2]); Assert.AreEqual(rec.Field1, engine["Field1"]); Assert.AreEqual(rec.Field2, engine["Field2"]); Assert.AreEqual(rec.Field3, engine["Field3"]); } engine.Close(); }
static void Main(string[] args) { var engine = new FileHelperAsyncEngine <Record>(); var options = engine.Options as DelimitedRecordOptions; options.Delimiter = "|"; // change the delimiter to vertical bar // test string src = "abc|JohnDoe"; using (engine.BeginReadString(src)) { var enumerator = (engine as IEnumerable <Record>).GetEnumerator(); enumerator.MoveNext(); Assert.AreEqual("abc", enumerator.Current.Id); Assert.AreEqual("JohnDoe", enumerator.Current.Name); } Console.ReadKey(); }
public void ChangeLineInEvent() { string input = "\n\n\n"; engine = new FileHelperAsyncEngine<SampleType>(); engine.BeforeReadRecord += new BeforeReadHandler<SampleType>(BeforeEventChange); engine.BeginReadString(input); SampleType[] res = (SampleType[]) engine.ReadNexts(3); Assert.AreEqual(3, res.Length); Assert.AreEqual(new DateTime(1314, 12, 11), res[0].Field1); Assert.AreEqual("901", res[0].Field2); Assert.AreEqual(234, res[0].Field3); Assert.AreEqual(new DateTime(1314, 12, 11), res[1].Field1); Assert.AreEqual("901", res[2].Field2); Assert.AreEqual(234, res[2].Field3); }
public void AsyncFieldIndex4() { var engine = new FileHelperAsyncEngine(typeof(SampleType)); engine.BeginReadString(data); Assert.AreEqual(3, engine.Options.FieldCount); while (engine.ReadNext() != null) { for (int i = 0; i < engine.Options.FieldCount; i++) { Assert.IsNotNull(engine[i]); } } engine.Close(); }
private void RunTestAsync() { long start = DateTime.Now.Ticks; FileHelperAsyncEngine engine = new FileHelperAsyncEngine(typeof(OrdersVerticalBar)); engine.BeginReadString(mSourceString); while (engine.ReadNext() != null) { } long end = DateTime.Now.Ticks; TimeSpan span = new TimeSpan(end - start); lblTimeAsync.Text = Math.Round(span.TotalSeconds, 4).ToString() + " sec."; Application.DoEvents(); }
public void AsyncFieldIndex1() { var engine = new FileHelperAsyncEngine(typeof(SampleType)); engine.BeginReadString(data); foreach (SampleType rec in engine) { Assert.AreEqual(rec.Field1, engine[0]); Assert.AreEqual(rec.Field2, engine[1]); Assert.AreEqual(rec.Field3, engine[2]); Assert.AreEqual(rec.Field1, engine["Field1"]); Assert.AreEqual(rec.Field2, engine["Field2"]); Assert.AreEqual(rec.Field3, engine["Field3"]); } engine.Close(); }
public void ChangeLineInEvent() { string input = "\n\n\n"; engine = new FileHelperAsyncEngine(typeof(SampleType)); engine.BeforeReadRecord += new BeforeReadRecordHandler(BeforeEventChange); engine.BeginReadString(input); SampleType[] res = (SampleType[])engine.ReadNexts(3); Assert.AreEqual(3, res.Length); Assert.AreEqual(new DateTime(1314, 12, 11), res[0].Field1); Assert.AreEqual("901", res[0].Field2); Assert.AreEqual(234, res[0].Field3); Assert.AreEqual(new DateTime(1314, 12, 11), res[1].Field1); Assert.AreEqual("901", res[2].Field2); Assert.AreEqual(234, res[2].Field3); }
public void ChangeLineInEvent() { var input = "\n\n\n"; mEngine = new FileHelperAsyncEngine <SampleType>(); mEngine.BeforeReadRecord += BeforeEventChange; mEngine.BeginReadString(input); var res = mEngine.ReadNexts(3); Assert.AreEqual(3, res.Length); Assert.AreEqual(new DateTime(1314, 12, 11), res[0].Field1); Assert.AreEqual("901", res[0].Field2); Assert.AreEqual(234, res[0].Field3); Assert.AreEqual(new DateTime(1314, 12, 11), res[1].Field1); Assert.AreEqual("901", res[2].Field2); Assert.AreEqual(234, res[2].Field3); }
public void BeginReadWhileWriting() { var eng = new FileHelperAsyncEngine(typeof(SampleType)); var filename = TestCommon.GetTempFile("TempWrite.txt"); Assert.Throws <BadUsageException>(() => { try { eng.BeginWriteFile(filename); eng.BeginReadString("jejjeje"); } finally { eng.Close(); if (File.Exists(filename)) { File.Delete(filename); } } }); }
public void BeginReadWhileWriting() { FileHelperAsyncEngine eng = new FileHelperAsyncEngine(typeof(SampleType)); Assert.Throws <BadUsageException>(() => { try { eng.BeginWriteFile(@"c:\tempfile.tmp"); eng.BeginReadString("jejjeje"); } finally { eng.Close(); if (File.Exists(@"c:\tempfile.tmp")) { File.Delete(@"c:\tempfile.tmp"); } } }); }
public void BeginReadWhileWriting() { FileHelperAsyncEngine eng = new FileHelperAsyncEngine(typeof(SampleType)); var filename = TestCommon.GetTempFile("TempWrite.txt"); Assert.Throws<BadUsageException>(() => { try { eng.BeginWriteFile(filename); eng.BeginReadString("jejjeje"); } finally { eng.Close(); if (File.Exists(filename)) File.Delete(filename); } }); }
public static void ProcessSim <Qop>(QCTraceSimulator sim, string comment = "", bool full_depth = false, string suffix = "") { if (!full_depth) { DisplayCSV.CSV(sim.ToCSV(), typeof(Qop).FullName, false, comment, false, suffix); } else { // full depth only var depthEngine = new FileHelperAsyncEngine <DepthCounterCSV>(); using (depthEngine.BeginReadString(sim.ToCSV()[MetricsCountersNames.depthCounter])) { // The engine is IEnumerable foreach (DepthCounterCSV cust in depthEngine) { if (cust.Name == typeof(Qop).FullName) { Console.Write($"{cust.DepthAverage}"); } } } } }
public void ReadAsyncFieldIndex() { string data = "11121314901234\n" + "10111314012345\n" + "11101314123456\n" + "10101314234567\n"; asyncEngine = new FileHelperAsyncEngine(typeof(SampleType)); asyncEngine.BeginReadString(data); foreach (SampleType rec in asyncEngine) { Assert.AreEqual(rec.Field1, asyncEngine[0]); Assert.AreEqual(rec.Field2, asyncEngine[1]); Assert.AreEqual(rec.Field3, asyncEngine[2]); Assert.AreEqual(rec.Field1, asyncEngine["Field1"]); Assert.AreEqual(rec.Field2, asyncEngine["Field2"]); Assert.AreEqual(rec.Field3, asyncEngine["Field3"]); } asyncEngine.Close(); }
public void ReadAsyncFieldIndex() { string data = "11121314901234" + Environment.NewLine + "10111314012345" + Environment.NewLine + "11101314123456" + Environment.NewLine + "10101314234567" + Environment.NewLine; var asyncEngine = new FileHelperAsyncEngine <SampleType>(); asyncEngine.BeginReadString(data); foreach (var rec in asyncEngine) { Assert.AreEqual(rec.Field1, asyncEngine[0]); Assert.AreEqual(rec.Field2, asyncEngine[1]); Assert.AreEqual(rec.Field3, asyncEngine[2]); Assert.AreEqual(rec.Field1, asyncEngine["Field1"]); Assert.AreEqual(rec.Field2, asyncEngine["Field2"]); Assert.AreEqual(rec.Field3, asyncEngine["Field3"]); } asyncEngine.Close(); }
public void NullString2() { var engine2 = new FileHelperAsyncEngine <SampleType>(); engine2.BeginReadString(null); }
public void NullString2() { engine2 = new FileHelperAsyncEngine(typeof(SampleType)); engine2.BeginReadString(null); }
private void RunTestAsync() { long start = DateTime.Now.Ticks; FileHelperAsyncEngine engine = new FileHelperAsyncEngine(typeof (OrdersVerticalBar)); engine.BeginReadString(mSourceString); while (engine.ReadNext() != null) { } long end = DateTime.Now.Ticks; TimeSpan span = new TimeSpan(end - start); lblTimeAsync.Text = Math.Round(span.TotalSeconds, 4).ToString() + " sec."; Application.DoEvents(); }
public void NullString2() { engine2 = new FileHelperAsyncEngine(typeof (SampleType)); engine2.BeginReadString(null); }
public void AsyncFieldIndexBad5() { FileHelperAsyncEngine engine = new FileHelperAsyncEngine(typeof(SampleType)); engine.BeginReadString(data); while(engine.ReadNext() != null) { } engine.Close(); Assert.Throws<BadUsageException>(() => { object val = engine[2]; }); }
public void NullString2() { var engine2 = new FileHelperAsyncEngine<SampleType>(); engine2.BeginReadString(null); }
public void ReadAsyncFieldIndex() { string data = "11121314901234" + Environment.NewLine + "10111314012345" + Environment.NewLine + "11101314123456" + Environment.NewLine + "10101314234567" + Environment.NewLine; var asyncEngine = new FileHelperAsyncEngine<SampleType>(); asyncEngine.BeginReadString(data); foreach (var rec in asyncEngine) { Assert.AreEqual(rec.Field1, asyncEngine[0]); Assert.AreEqual(rec.Field2, asyncEngine[1]); Assert.AreEqual(rec.Field3, asyncEngine[2]); Assert.AreEqual(rec.Field1, asyncEngine["Field1"]); Assert.AreEqual(rec.Field2, asyncEngine["Field2"]); Assert.AreEqual(rec.Field3, asyncEngine["Field3"]); } asyncEngine.Close(); }
public void ReadAsyncFieldIndex() { string data = "11121314901234\n" + "10111314012345\n" + "11101314123456\n" + "10101314234567\n" ; asyncEngine = new FileHelperAsyncEngine(typeof(SampleType)); asyncEngine.BeginReadString(data); foreach (SampleType rec in asyncEngine) { Assert.AreEqual(rec.Field1, asyncEngine[0]); Assert.AreEqual(rec.Field2, asyncEngine[1]); Assert.AreEqual(rec.Field3, asyncEngine[2]); Assert.AreEqual(rec.Field1, asyncEngine["Field1"]); Assert.AreEqual(rec.Field2, asyncEngine["Field2"]); Assert.AreEqual(rec.Field3, asyncEngine["Field3"]); } asyncEngine.Close(); }