Know the loops…

Posted by Satyen Pandya | Posted in .Net | Posted on 19-05-2011

0

Normally, we use loops for repeating few lines of codes to achieve some definitive task. As far as good programming is concern, we are advised not to use goto statements. But internally, compiler generates the goto statements for the loop we have written.
In this post we see how different loops (While, For and Foreach) converted after compilation.

(1) while

The while statement executes a statement or a block of statements until a specified expression evaluates to false.

Example

class WhileTest
{
    static void Main()
    {
        int n = 1;
        while (n < 6)
        {
            Console.WriteLine("Current value of n is {0}", n);
            n++;
        }
    }
}
/*
    Output:
    Current value of n is 1
    Current value of n is 2
    Current value of n is 3
    Current value of n is 4
    Current value of n is 5
 */

Multiple Inheritance in C#

Posted by Satyen Pandya | Posted in .Net | Posted on 23-04-2011

0

Can interfaces help us achieve the multiple inheritance in C# ? Let us see how it works…
I think an example would be in helpful to understand the concept.
Let us assume we have three classes which are defined as follows:

Related Posts Plugin for WordPress, Blogger...