public static SizedList <TSource> RemoveItemsOfType <TSource, TCast>(this SizedList <TSource> sizedList) where TSource : Il2CppSystem.Object where TCast : Il2CppSystem.Object { if (!HasItemsOfType <TSource, TCast>(sizedList)) { return(sizedList); } int numRemoved = 0; List <TSource> arrayList = sizedList.ToList(); for (int i = 0; i < sizedList.Count; i++) { TSource item = sizedList[i]; if (item is null || !item.IsType <TCast>()) { continue; } arrayList.RemoveAt(i - numRemoved); numRemoved++; } return(arrayList.ToSizedList()); }
public static SizedList <TSource> RemoveItem <TSource, TCast>(this SizedList <TSource> sizedList, TCast itemToRemove) where TSource : Il2CppSystem.Object where TCast : Il2CppSystem.Object { if (!HasItemsOfType <TSource, TCast>(sizedList)) { return(sizedList); } List <TSource> arrayList = sizedList.ToList(); for (int i = 0; i < sizedList.Count; i++) { TSource item = sizedList[i]; if (item is null || !item.Equals(itemToRemove.TryCast <TCast>())) { continue; } arrayList.RemoveAt(i); break; } return(arrayList.ToSizedList()); }