Znalostní bázeCentrum zkoušek
CSČeština
Vybrat jazyk13

CKTIS / C#

input output and serialization: praktická reference

input output and serialization: praktická reference: I/O spojuje program se soubory, konzolí, sítí nebo proudy a obvykle může selhat.

Verze: C# language and .NET 10 reference runtime

Syntaxe

// io

I/O spojuje program se soubory, konzolí, sítí nebo proudy a obvykle může selhat.

Pro čekání použijte async a pro vlastnictví prostředků using nebo await using.

Nepředpokládejte, že jedno volání přečte vše nebo že cesta zůstane po kontrole dostupná.

Kódování, oprávnění, timeout, zrušení a částečný zápis vyžadují obsluhu.

Úplný program skutečně používá input output and serialization; přesně očekávaný stdout je value=7.

Příklady

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 writer = new StringWriter(CultureInfo.InvariantCulture); writer.WriteLine("value=7"); using var reader = new StringReader(writer.ToString()); Console.WriteLine(reader.ReadLine());

Výsledek

value=7

Úplný program skutečně používá `input output and serialization`; přesně očekávaný stdout je `value=7`.

Zdroje