Editorconfig Guide

Generate your .editorconfig file with ease.

Prefer foreach explicit cast in source

dotnet-style-prefer-foreach-explicit-cast-in-source

Default value:

when_strongly_typed

Possible values:

  • always
  • when_strongly_typed

Examples

always
var list = new List<object>();
foreach (string item in list) { }
when_strongly_typed
var list = new List<object>();
foreach (string item in list.Cast<string>()) { }