本文整理汇总了C#中TextReader.ReadLineAsync方法的典型用法代码示例。如果您正苦于以下问题:C# TextReader.ReadLineAsync方法的具体用法?C# TextReader.ReadLineAsync怎么用?C# TextReader.ReadLineAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextReader
的用法示例。
在下文中一共展示了TextReader.ReadLineAsync方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadOne
private static TripConstraint ReadOne(TextReader reader, int destination)
{
var line = reader.ReadLineAsync().Result;
var parts = line.Split(' ');
var departureTimeMinutes = parts[0].ToMinutes();
var maxAllowableDepartureTimeMinutes = parts[1].ToMinutes();
return new TripConstraint(destination, departureTimeMinutes, maxAllowableDepartureTimeMinutes);
}
示例2: ReadAll
public static IEnumerable<Patron> ReadAll(TextReader reader)
{
var line = reader.ReadLineAsync().Result;
var count = line.ParseInteger();
var result = new List<Patron>();
while (count-- > 0)
{
var patron = ReadOne(reader);
// Accounting for an error in the input file.
if (patron == null) break;
result.Add(patron);
}
return result;
}
示例3: Read
public static Frequencies Read(TextReader reader)
{
var line = reader.ReadLineAsync().Result;
var count = line.ParseInteger();
return ReadAll(reader, count, new Frequencies());
}
示例4: ReadStopIntervalMinutes
private static IEnumerable<int> ReadStopIntervalMinutes(TextReader reader)
{
var line = reader.ReadLineAsync().Result;
// TODO: may verify count with array length.
var count = line.ParseInteger();
line = reader.ReadLineAsync().Result;
return from x in line.Split(' ') select x.ParseInteger();
}