/// <summary> /// Enumerates the frequency-dependent network parameter data from the specified <see cref="TextReader"/>. /// </summary> /// <param name="reader">The <see cref="TextReader"/> to read network data from.</param> /// <returns>All the network data loaded from the reader.</returns> /// <remarks>Unlike <see cref="ReadAllData(TextReader)"/>, this method returns an enumerable sequence of <see cref="FrequencyParametersPair"/> objects which are /// loaded into memory one at a time. This is useful when using LINQ queries (such as limiting the number of frequencies to load) or passing the sequence /// to a collection to initialize. This avoids creating the whole collection in memory.</remarks> /// <exception cref="ArgumentNullException"><paramref name="reader"/> is null.</exception> /// <exception cref="InvalidDataException">Invalid data or format in <paramref name="reader"/>.</exception> public static IEnumerable <FrequencyParametersPair> ReadData(TextReader reader) { using TouchstoneReader tsReader = TouchstoneReader.Create(reader); while (tsReader.Read() is FrequencyParametersPair pair) { yield return(pair); } }