System.IO.StreamWriter.WriteLineAsync C# (CSharp) Method

WriteLineAsync() public method

public WriteLineAsync ( ) : System.Threading.Tasks.Task
return System.Threading.Tasks.Task
        public override Task WriteLineAsync()
        {
            // If we have been inherited into a subclass, the following implementation could be incorrect
            // since it does not call through to Write() which a subclass might have overridden.  
            // To be safe we will only use this implementation in cases where we know it is safe to do so,
            // and delegate to our base class (which will call into Write) when we are not sure.
            if (GetType() != typeof(StreamWriter))
            {
                return base.WriteLineAsync();
            }

            if (_stream == null)
            {
                throw new ObjectDisposedException(null, SR.ObjectDisposed_WriterClosed);
            }

            CheckAsyncTaskInProgress();

            Task task = WriteAsyncInternal(this, null, 0, 0, _charBuffer, _charPos, _charLen, CoreNewLine, _autoFlush, appendNewLine: true);
            _asyncWriteTask = task;

            return task;
        }

Same methods

StreamWriter::WriteLineAsync ( char value ) : System.Threading.Tasks.Task
StreamWriter::WriteLineAsync ( char buffer, int index, int count ) : System.Threading.Tasks.Task
StreamWriter::WriteLineAsync ( string value ) : System.Threading.Tasks.Task

Usage Example

Beispiel #1
0
        public static async Task ReadOutChannels(XmlTvReader reader, StreamWriter resultsFileStream)
        {
            var channels = reader.GetChannels().Distinct().ToList();

            resultsFileStream.Write(EntityExtensions.GetHeader("Channels"));

            foreach (var channel in channels)
            {
                System.Console.WriteLine("Retrieved Channel: {0} - {1}", channel.Id, channel.DisplayName);
                resultsFileStream.Write(channel.GetChannelDetail());
            }

            var totalProgrammeCount = 0;

            resultsFileStream.Write("\r\n");
            foreach (var channel in channels)
            {
                System.Console.WriteLine("Processing Channel: {0}", channel.DisplayName);

                resultsFileStream.Write(EntityExtensions.GetHeader("Programs for " + channel.DisplayName));
                var channelProgrammeCount = await ReadOutChannelProgrammes(reader, channel, resultsFileStream);

                totalProgrammeCount += channelProgrammeCount;
                await resultsFileStream.WriteLineAsync(String.Format("Total Programmes for {1}: {0}", channelProgrammeCount, channel.DisplayName));
            }

            await resultsFileStream.WriteLineAsync(String.Format("Total Programmes: {0}", totalProgrammeCount));
        }
All Usage Examples Of System.IO.StreamWriter::WriteLineAsync