Extension method replacing elements from an IEnumerable collection
Why didn't Microsoft include this in the .NET framework?


Probably because it can be realized in one line with Select:

source.Select(x =&gt; x.Equals(oldValue) ? newValue : x)


or with 2 lines as extension method if the function is needed frequently.

public static IEnumerable&lt;T&gt; Replace&lt;T&gt;(this IEnumerable&lt;T&gt; source, T oldValue, T newValue)
    =&gt; source.Select(x =&gt; x.Equals(oldValue) ? newValue : x)


That's the nice thing of enumerable methods. There are just some discrete methods available, but those can be parameterized / combined to realize the most use cases. I really like the compactness and elegance of the LINQ API :).