CKTIS / C#
System.IO.StringReader: praktična referenca
System.IO.StringReader: praktična referenca: StringReader izlaže postojeći niz preko ugovora TextReader.
Verzija: .NET API; verified on .NET 10.0.14
Sintaksa
System.IO.StringReader /* select a documented member or constructor */StringReader izlaže postojeći niz preko ugovora TextReader.
Koristite ga za analizatore koji očekuju TextReader bez stvaranja privremene datoteke.
ReadLine uklanja razdjelnik, Dispose završava uporabu i cijeli izvorni tekst već je u memoriji.
ReadLine nakon kraja vraća null. Završni razdjelnik završava prethodni redak i ne stvara dodatni prazan redak; početni ili uzastopni razdjelnici mogu stvoriti prazan redak.
Cijeli program doista koristi System.IO.StringReader; točno očekivani stdout jest first.
Primjeri
using System;
using System.Buffers;
using System.Collections.Concurrent;
using System.Collections.Frozen;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Channels;
using System.Threading.Tasks;
using Number = System.Int32;
using var reader = new StringReader("first\nsecond");
Console.WriteLine(reader.ReadLine());
Rezultat
first
Cijeli program doista koristi `System.IO.StringReader`; točno očekivani stdout jest `first`.