Monday, April 20, 2020

Performance List.Remove(T) Method is an O(n) operation

List.Remove(T) Method

If type T implements the IEquatable generic interface, the equality comparer is the Equals method of that interface; otherwise, the default equality comparer is Object.Equals.
This method performs a linear search; therefore, this method is an O(n) operation, where n is Count.

No comments :