Baza wiedzyCentrum egzaminacyjne
PLPolski
Wybierz język13

CKTIS / C#

strings and text: odniesienie praktyczne

strings and text: odniesienie praktyczne: Napisy .NET są niezmiennymi sekwencjami jednostek UTF-16.

Wersja: C# language and .NET 10 reference runtime

Składnia

// strings

Napisy .NET są niezmiennymi sekwencjami jednostek UTF-16.

Wybieraj jawne porównanie, kulturę, normalizację i kodowanie na granicach.

Length nie liczy grafemów, a częste konkatenacje mogą alokować.

Null, pusty, whitespace, surrogate i łączone znaki są różnymi przypadkami.

Kompletny program rzeczywiście używa strings and text; oczekiwany stdout to dokładnie HELLO, ADA!.

Przykłady

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;

var name = "Ada"; Console.WriteLine($"Hello, {name}!".ToUpperInvariant());

Wynik

HELLO, ADA!

Kompletny program rzeczywiście używa `strings and text`; oczekiwany stdout to dokładnie `HELLO, ADA!`.

Źródła