c# - Know when first and last loop in foreach -
is there way find out when i'm @ first , last loop on foreach?
foreach(string str in list){ if(str.isfirst(list) == true){...} if(str.islast(list) == true){...} }
^ this?
for (int = 0; < list.length; i++) { if (i == 0) { // first iteration } if (i >= list.length - 1) { // last iteration } }
Comments
Post a Comment