Table of Contents

Arguments Class

Definition

Namespace
Cuemon.Collections.Generic
Assemblies
Cuemon.Kernel.dll
Source
src/Cuemon.Kernel/Collections/Generic/Arguments.cs

Provides static helper methods for wrapping, projecting, and concatenating arguments as arrays and enumerable sequences.

public static class Arguments
Inheritance
Arguments

Examples

The following example demonstrates how to use the Arguments class to create arrays and enumerables from argument lists. It shows array concatenation, single-element yielding, and object-based overloads.

// Program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using Cuemon.Collections.Generic;

int[] first = Arguments.ToArrayOf(1, 2, 3);
int[] second = Arguments.ToArrayOf(4, 5, 6);

// Concat two arrays
int[] combined = Arguments.Concat(first, second);
Console.WriteLine(string.Join(", ", combined));

// Yield a single element
IEnumerable<int> yielded = Arguments.Yield(42);
Console.WriteLine(yielded.First());

// Convert to IEnumerable
IEnumerable<string> enumerable = Arguments.ToEnumerableOf("a", "b", "c");
Console.WriteLine(string.Concat(enumerable));

// Object overloads
object[] objs = Arguments.ToArray(1, "two", 3.0);
IEnumerable<object> objEnumerable = Arguments.ToEnumerable(true, false);

Methods

Name Description
Concat<T>(T[], T[])

Concatenates two arrays.

ToArray(params object[])

Returns the specified arguments as an array of Object.

ToArrayOf<T>(params T[])

Returns the specified arguments as an array of T.

ToEnumerable(params object[])

Returns the specified arguments as an IEnumerable<T> of Object.

ToEnumerableOf<T>(params T[])

Returns the specified arguments as an IEnumerable<T>.

Yield<T>(T)

Returns an IEnumerable<T> with the specified arg as the only element.