An iterator is a section of code that returns an ordered sequence of values of the same type.
An iterator can be used as the body of a method, an operator, or a get accessor.
The iterator code uses the yield return statement to return each element in turn. yield break ends the iteration.
Multiple iterators can be implemented on a class. Each iterator must have a unique name just like any class member, and can be invoked by client code in a foreach statement as follows: foreach(int x in SampleClass.Iterator2){}.
The return type of an iterator must be IEnumerable, IEnumerator, IEnumerable(Of T), or IEnumerator(Of T).
Iterators are the basis for the deferred execution behavior in LINQ queries.
Avoid using inline CSS styling. Generate the markup with the appropriate tags, e.g. use h1 to h6 tags to specify a heading, use a fieldset tag to enclose a form, use a label tag for control labels. This also makes the page semantically correct. Specify all the styling in an external CSS file. This will also help in easily changing the look and feel of the application.The points discussed above are some pointers in having a maintainable and loose coupled components in our web sites. The following are the general advantages in having loose coupled components in web or in that case any application.
Wrong<div style="font-size: 18px; font-weight: bold; color: Black; margin: 5px 0;">This is a top level heading</div><div style="font-size: 12px; font-weight: bold; color: Black; margin: 5px 0;">This is a sub heading</div>RightMarkupLikewise, Instead of specifying JavaScript inline in the tags, bind scripts dynamically to the HTML elements. JavaScript frameworks like jQuery are very useful in writing unobtrusive scripts.<h1>This is a top level heading</h1><h2>This is a sub heading</h2>CSSh1{font-size: 18px; font-weight: bold; color: Black; margin: 5px 0;}h2{font-size: 12px; font-weight: bold; color: Black; margin: 5px 0;}
Wrong
<input type="text" id="yourName" />
<a onclick="alert('Welcome!' + getElementById('yourName').value);">Click Me!</a>
Right
<input type="text" id="yourName" />
<a id="aClickMe">Click Me!</a>
<script type="text/javascript">
$("#aClickMe").click(function(){
alert("Welcome!" + $("#yourName").val());
});
</script>
Finally I have started with my own blog, where I can share my adventures in coding and also my spiritual quest. Writing is a form of expression with which I am most comfortable.
I have been a keen coder since my school days. I have worked on technologies like visual basic, java and now .net. The journey so far has been enriching. I see this platform as an opportunity where I can share the knowledge that I have accumulated. I am sure it will also help me in sharpening my knowledge further.
I am looking forward for your response to make the journey ahead a great learning experience.
P.S.: To all my friends who were regularly pinging my domain with a hope that I might have finally found sometime to setup this website. Sorry folks for the delay but I have finally setup my home in the second world. ;)