//if item exists in the collection, return A tuple with // false, and the index of the existed item in the collection. if (collection.Contains(item)) { result = Tuple.Create(false, collection.IndexOf(item)); } // if item doesn"t exist in the collection, add the item and return // a tuple with true and the index of the inserted item. else { collection.Add(item); result = Tuple.Create(true, collection.Count - 1); }