Get all elements but the first from an array

前端 未结 2 706
小鲜肉
小鲜肉 2020-12-08 18:01

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+         


        
2条回答
  •  臣服心动
    2020-12-08 18:35

    The following would be equivalent to your for loop:

    foreach (var item in contents.Skip(1))
        Message += item;
    

提交回复
热议问题