Example Usage

You can get a good idea of the usage from the sample project for the desktop.

LinqToStdf.StdfFile is the primary starting point. In the simplest scenario, just create a new one for the path and query over the results of GetRecords():
            var stdf = new StdfFile(path);

            //silly query
            var query = from r in stdf.GetRecords()
                        select r;

            Console.WriteLine("There were {0} records!", query.Count());

Use OfExactType to get only certain records
            var testTimes = from prr in stdf.GetRecords().OfExactType<Prr>()
                            let testTime = prr.TestTime
                            where testTime != null
                            select testTime.Value / 1000.0;

Use the extension methods to query the structure of the file:
            //Get PTR results from failing parts grouped by test number
            var results = from prr in stdf.GetRecords().OfExactType<Prr>()
                          where prr.Failed ?? false
                          from ptr in prr.GetChildRecords().OfExactType<Ptr>()
                          let result = ptr.Result
                          where result != null
                          group result.Value by ptr.TestNumber into g
                          select new { TestNumber = g.Key, Results = g };

Experiment! If you can't figure out how to do something, start a discussion in the "Discussions" tab above and get help.

Last edited May 24, 2008 at 5:45 AM by marklio, version 4


No comments yet.