Skip to main content
Journey Uncommon Logo
JourneyUncommon
easyC#foreach and iteratorsSingle-choice MCQ

Inside a foreach over a List<string>, can you reassign the loop variable to change the underlying list element?

var items = new List<string> { "a", "b" }; foreach (var item in items) { item = item.ToUpper(); }