CKTIS / C#
System.Collections.Generic.IEnumerable: referencia práctica
System.Collections.Generic.IEnumerable: referencia práctica: IEnumerable<T> describe una secuencia sin garantizar tamaño, indexación, almacenamiento ni repetibilidad.
Versión: .NET API; verified on .NET 10.0.14
Sintaxis
System.Collections.Generic.IEnumerable /* select a documented member or constructor */IEnumerable describe una secuencia sin garantizar tamaño, indexación, almacenamiento ni repetibilidad.
Úsalo como contrato mínimo de lectura para consumir elementos sucesivos.
Volver a enumerar puede repetir trabajo costoso, producir datos distintos o no estar permitido por un origen de un solo uso.
Un origen puede ser vacío, infinito o de un solo uso y los errores suelen aparecer solo al ejecutar MoveNext.
El programa completo usa realmente System.Collections.Generic.IEnumerable; su stdout esperado exacto es 5.
Ejemplos
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;
IEnumerable<int> values = new[] { 2, 3 };
Console.WriteLine(values.Sum());
Resultado
5
El programa completo usa realmente `System.Collections.Generic.IEnumerable`; su stdout esperado exacto es `5`.