Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Enumeration
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { //This is true for any enumeation //it doesnt matter if use for(int idx...; ++idx) or for each //Changing of enumeator will throw exception public class EnumerationRemove { List<int> AwesomeList = new List<int>() {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; public void MyAwesomeListUpdateMethod(){ List<int> SafeListAccordingToMe = AwesomeList; int LetBeitemToRemove = 4; foreach(var item in SafeListAccordingToMe){ if(item == LetBeitemToRemove) UpdateWithNoProblemAccordingToMe(item); } } private void UpdateWithNoProblemAccordingToMe(int item){ AwesomeList.Remove(item); } } public class Program { public static void Main(string[] args) { EnumerationRemove test = new EnumerationRemove(); test.MyAwesomeListUpdateMethod(); } } }
run
|
edit
|
history
|
help
0
How do I calculate someone's age in C#?
practice
Pramod
ProtectedUse
England premiere league results last season
3
asdxcscd
FirstNonRepeatCharOfString
Ashraf
asxsadaxsdf