There is a ‘forr’ code snippet for reverse ‘for’ loop

Couple of days back we have discussed about one of the hidden and very useful code snippet, ‘propfull – for property and backing field’. Today you will learn another interesting code snippet ‘forr’. Yes, you read it correctly ! ‘forr’ . You must be familiar with ‘for’ code snippet  that generates basic for-loop structure.  Where as, ‘forr’ generates the reverse for-loop .

For an instance if you type   “for”  and then press TAB key twice, a default for-loop will be generated as shown in below. The default loop will have an ‘index’ – i and a max length variable defined as ‘length’

for_codesnippet

Now, in the case of ‘reverse for-loop’, you can use ‘forr’. That will generate a reverse for-loop as shown below, where you will find a similar index and length variable as general for-loop but in decreasing manner.

forr_reversefor_codesnippet

Hope you will use it going forward.

DON'T MISS OUT!
Subscribe To Newsletter For your Daily Development Tips and Tricks  

 Best Tips & Tricks on Microsoft Technology Platform 

Invalid email address
We promise not to spam you. You can unsubscribe at any time.
Abhijit Jana

Abhijit runs the Daily .NET Tips. He started this site with a vision to have a single knowledge base of .NET tips and tricks and share post that can quickly help any developers . He is a Former Microsoft ASP.NET MVP, CodeProject MVP, Mentor, Speaker, Author, Technology Evangelist and presently working as a .NET Consultant. He blogs at http://abhijitjana.net , you can follow him @AbhijitJana . He is the author of book Kinect for Windows SDK Programming Guide.