CKTIS / C#
filtering and transformations: praktična referenca
filtering and transformations: praktična referenca: Filtriranje zadržava odabrane elemente, a transformacija stvara novi oblik podataka.
Verzija: C# language and .NET 10 reference runtime
Sintaksa
// filtering transformationsFiltriranje zadržava odabrane elemente, a transformacija stvara novi oblik podataka.
Sastavite Where i Select u čitljiv cjevovod i materijalizirajte samo na potrebnoj granici.
Selektori s nuspojavama izvode se pri svakoj enumeraciji.
Prazan izvor daje prazan rezultat, a iznimka predikata zaustavlja cjevovod.
Cijeli program doista koristi filtering and transformations; točno očekivani stdout jest 4,6.
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;
var result = new[] { 1, 2, 3 }.Where(value => value > 1).Select(value => value * 2); Console.WriteLine(string.Join(",", result));
Rezultat
4,6
Cijeli program doista koristi `filtering and transformations`; točno očekivani stdout jest `4,6`.