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

Popular posts from this blog

c# - HttpResponseMessage System.InvalidOperationException -

sql - Postgresql error: "failed to find conversion function from unknown to text" -