How to make large "in" queries in C# for an indexed field in MSSQL?
select id from table where field in (gigantic list of ordered longs)

Queries with long IN lists are slow, as they are parsed and compiled each call.
Either pass the list as a JSON array:
select id from table where field in (select value from openjson(@values))

Or use a Table-Valued Parameter or bulk load a temp table with the values. Ensure there is an index or primary key. The OPENJSON method will likely be slower, but the upside is that it works with all client drivers.  TVP and Bulk Insert are not always available except in .NET and Java.