C# Unreachable code detected
问题 I'm getting a "Unreachable code detected" message in Visual Studio at the point i++ in my code below. Can you spot what I've done wrong? try { RegistryKey OurKey = Registry.CurrentUser; OurKey.CreateSubKey("Software\\Resources\\Shared"); OurKey = OurKey.OpenSubKey("Software\\Resources\\Shared", true); for (int i = 0; i < cmbPaths.Items.Count; i++) //<---- problem with i { OurKey.SetValue("paths" + i, cmbPaths.Items[i]); break; } } 回答1: The problem is that this actually isn't a loop. You don't