How to split an array to 2 arrays with odd and even indices respectively? [duplicate]
问题 This question already has answers here : Getting odd/even part of a sequence with LINQ (7 answers) Closed 3 years ago . How to split an array to 2 arrays with odd and even indices respectively? For example int[] a = new int[]{1, 3, 7, 8}; then get two arrays a1: {1, 7} a2: {3, 8} 回答1: Simple using the overload of Where than contains the index which: Filters a sequence of values based on a predicate. Each element's index is used in the logic of the predicate function. int[] a = new int[] { 1,