using System.Collections.Generic;
public static void Main()
string input = "Net Sales,COGS";
string[] values = { "Net Sales", "COGS", "COGS%", "Gross Profit", "GP%", "Quantity" };
var result = FilterArray(values, input.Split(','));
result.FilteredArray.Dump();
result.IndexesOfRemainingElements.Dump();
static Result FilterArray(string[] array, string[] input)
var remainingElements = array.Where(i => !input.Contains(i)).ToArray();
return new Result(remainingElements,
remainingElements.Select(i => Array.IndexOf(array, i)).ToList());
public readonly string[] FilteredArray;
public readonly List<int> IndexesOfRemainingElements;
public Result(string[] filteredArray, List<int> indexesOfRemainingElements)
FilteredArray = filteredArray;
IndexesOfRemainingElements = indexesOfRemainingElements;