using System.Collections.Generic;
private static List<string> myList = new List<string> {"a","b","c","d","e","f","g","h"};
public static void Main()
private static void MyFunction(string listItem, string anotherListItem)
bool betweenTwoItems = false;
foreach(var item in myList)
if(item == listItem || item == anotherListItem)
betweenTwoItems = !betweenTwoItems;