CKTIS / C#
System.Collections.Generic.SortedSet: практическа справка
System.Collections.Generic.SortedSet: практическа справка: SortedSet<T> поддържа уникални елементи в реда, определен от comparer.
Версия: .NET API; verified on .NET 10.0.14
Синтаксис
System.Collections.Generic.SortedSet /* select a documented member or constructor */SortedSet поддържа уникални елементи в реда, определен от comparer.
Използвайте го за подредени множества и заявки по диапазон, които изискват подредено членство.
Уникалността се определя от Compare с резултат нула, а изменяемото състояние за подредба нарушава структурата.
Min и Max връщат зададената от API стойност за празно множество; GetViewBetween изисква валиден диапазон.
Пълната програма действително използва System.Collections.Generic.SortedSet; точният очакван stdout е 1,2,3.
Примери
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 set = new SortedSet<int> { 3, 1, 2 };
Console.WriteLine(string.Join(",", set));
Резултат
1,2,3
Пълната програма действително използва `System.Collections.Generic.SortedSet`; точният очакван stdout е `1,2,3`.