FastList.Remove C# (CSharp) Метод

Remove() публичный Метод

public Remove ( item ) : bool
Результат bool
    public bool Remove(T item) {
        if (array != null) {
            for (int i = 0; i < size; i++) {
                if (item.Equals(array[i])) { //found it, push everything up
                    size--;
                    for (int j = i; j < size; j++) {
                        array[j] = array[j+1];
                    }
                    array[size] = default(T);
                    return true;
                }
            }
        }
        return false;
    }

Usage Example

Пример #1
0
        void ReplacePathManager()
        {
            if (Singleton <PathManager> .instance as CustomPathManager != null)
            {
                return;
            }

            // Change PathManager to CustomPathManager
            FieldInfo         sInstance           = typeof(ColossalFramework.Singleton <PathManager>).GetFieldByName("sInstance");
            PathManager       originalPathManager = ColossalFramework.Singleton <PathManager> .instance;
            CustomPathManager customPathManager   = originalPathManager.gameObject.AddComponent <CustomPathManager>();

            customPathManager.SetOriginalValues(originalPathManager);

            // change the new instance in the singleton
            sInstance.SetValue(null, customPathManager);

            // change the manager in the SimulationManager
            FastList <ISimulationManager> managers = (FastList <ISimulationManager>) typeof(SimulationManager).GetFieldByName("m_managers").GetValue(null);

            managers.Remove(originalPathManager);
            managers.Add(customPathManager);

            // Destroy in 10 seconds to give time to all references to update to the new manager without crashing
            GameObject.Destroy(originalPathManager, 10f);
        }
All Usage Examples Of FastList::Remove