public static int LastIndexOf <T>(UnsafeList *list, T item) where T : unmanaged, IEquatable <T> { UDebug.Assert(list != null); UDebug.Assert(list->_items.Ptr != null); UDebug.Assert(typeof(T).TypeHandle.Value == list->_typeHandle); return(UnsafeBuffer.LastIndexOf(list->_items, item, list->_count - 1, list->_count)); }
public static bool Contains <T>(UnsafeStack *stack, T item) where T : unmanaged, IEquatable <T> { UDebug.Assert(stack != null); UDebug.Assert(stack->_items.Ptr != null); UDebug.Assert(typeof(T).TypeHandle.Value == stack->_typeHandle); int count = stack->_count; if (count == 0) { return(false); } return(UnsafeBuffer.LastIndexOf(stack->_items, item, count - 1, count) != -1); }