tags:

views:

101

answers:

1

Is there a one-line easy linq expression to just get everything from a simple array except the first element?

        for (int i = 1; i <= contents.Length - 1; i++)
            Message += contents[i];

I just wanted to see if it was easier to condense.

+16  A: 

Yes, Enumerable.Skip does what you want:

contents.Skip(1)

However, the result is an IEnumerable<T>, if you want to get an array use:

contents.Skip(1).ToArray()
LBushkin