Is there idiomatic C# equivalent to C's comma operator?

I know this as Fluent.

A Fluent example of a List.Add using Extension Methods

static List<T> MyAdd<T>(this List<T> list, T element)
{
    list.Add(element);
    return list;
}

I know that this thread is very old, but I want to append the following information for future users:

There isn't currently such an operator. During the C# 6 development cycle a semicolon operator was added, as:

int square = (int x = int.Parse(Console.ReadLine()); Console.WriteLine(x - 2); x * x);

which can be translated as follows:

int square = compiler_generated_Function();

[MethodImpl(MethodImplOptions.AggressiveInlining)]
private int compiler_generated_Function()
{
    int x = int.Parse(Console.ReadLine());

    Console.WriteLine(x - 2);

    return x * x;
}

However, this feature was dropped before the final C# release.


This is what Concat http://msdn.microsoft.com/en-us/library/vstudio/bb302894%28v=vs.100%29.aspx is for. Just wrap a single item in an array. Functional code should not mutate the original data. If performance is a concern, and this isn't good enough, then you'll no longer be using the functional paradigm.

((accum, data) => accum.Concat(new[]{data}))