Validating CSV headers against an expected list
Move the data column validation into a function

bool invalidDataColumns(string[] headers) {
    int[] numbers = headers.Skip(2).Select(s =&gt; int.TryParse(s, out var n) ? n : 0).ToArray();
    return !(numbers[0] == 1 &amp;&amp; numbers.Zip(numbers.Skip(1), (previous, current) =&gt; current - previous).All(diff =&gt; diff == 1));
}


And call it within the if condition.

//...

if (!string.Equals(headers[0], "Marker", StringComparison.InvariantCultureIgnoreCase)
    || (!string.Equals(headers[1], "Category", StringComparison.InvariantCultureIgnoreCase))
    || invalidDataColumns(headers)
    ) {
    throw new Exception("Invalid file format. Please use template (MarkerTemplate.csv).");
}

//...


The condition could be reduced further by moving the entire thing into its own function as well

bool invalidHeaders(string[] headers) {
    return !string.Equals(headers[0], "Marker", StringComparison.InvariantCultureIgnoreCase)
        || (!string.Equals(headers[1], "Category", StringComparison.InvariantCultureIgnoreCase))
        || invalidDataColumns(headers);
}


which now simplifies the code to

//...

if (invalidHeaders(headers)) {
    throw new Exception("Invalid file format. Please use template (MarkerTemplate.csv).");
}

//...


Unit test used to verify expected behavior

[TestClass]
public class InvalidDataColumnsTests {
    [TestMethod]
    [DataRow("Marker,Category,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15", false)]
    [DataRow("Marker,Category,1,2,3,4,5,6,7,8,9,10", false)]
    [DataRow("Marker,Category,1,2,3,4,5", false)]
    [DataRow("Marker,Category,x,2,3,4,5,6,7,8,9,10", true)]
    [DataRow("Category,1,2,3,4,5", true)]
    public void Should_Validate_Columns(string headerLine, bool expected) {
        //string headerLine = "Marker,Category,1,2,3,4,5,6,7,8,9,10";
        string[] headers = headerLine.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
        invalidHeaders(headers).Should().Be(expected);

        ////Example Use case
        //if (invalidHeaders(headers)) {
        //    throw new Exception("Invalid file format. Please use template (MarkerTemplate.csv).");
        //}
    }

    bool invalidHeaders(string[] headers) {
        return !string.Equals(headers[0], "Marker", StringComparison.InvariantCultureIgnoreCase)
            || (!string.Equals(headers[1], "Category", StringComparison.InvariantCultureIgnoreCase))
            || invalidDataColumns(headers);
    }

    bool invalidDataColumns(string[] headers) {
        int[] numbers = headers.Skip(2).Select(s =&gt; int.TryParse(s, out var n) ? n : 0).ToArray();
        return !(numbers[0] == 1 &amp;&amp; numbers.Zip(numbers.Skip(1), (previous, current) =&gt; current - previous).All(diff =&gt; diff == 1));
    }
}