With BencharkDot net, this benchmark creates a list of 10,000 strings then tests either OfType<T>
or Cast<T>
Here's the benchmark code:
/// <summary>
/// Want to check what is faster OfType or Cast when a enurable all has the same items
/// </summary>
[Config(typeof(Config))]
public class LinqCastBenchmarks