Casting from an abstract collection to a concrete implementation is bad practice. It makes your code fragile because it becomes more difficult to change which implementation you are using at a later date.

Consider using the abstract collection's methods and remove the cast.

The example shows casting from an IEnumerable<string> to a List<string>. This should be avoided where possible.

  • C# Corner, C# Interface Based Development.