ReSharper Web Help

ReSharper | Live Templates | Surround Templates | Predefined | ASP.NET | C#

ASP.NET

C#

Template name Description
foreach

Purpose
Puts a selection into a foreach statement block.

<% foreach ($TYPE$ $VARIABLE$ in $COLLECTION$) { %>
$SELECTION$
$END$<%}%>

Before expansion
Reference__Options__Templates__Surround_With_Templates__Predefined__ASP.NET__CSharp__foreach__before.png
After expansion
Reference__Options__Templates__Surround_With_Templates__Predefined__ASP.NET__CSharp__foreach__after.png

Parameters

  • TYPE - type to cast the array elements to.
  • VARIABLE - iterator variable.
  • COLLECTION - instance to iterate over.
  • SELECTION - selected code.
  • END - position of the caret after applying the template.

See Also

Reference