.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> Visual Studio >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

All the Array are equal.

Posted By:laptop charles       Posted Date: August 13, 2010    Points: 10    Category: Visual Studio    URL: http://www.dotnetspark.com  

Display all the array or equal...
 

*All array elements are equal or not.
using System;

class Program
{
    static void Main()
    {
        int[] a1 = new int[] { 1, 2, 3 };
        int[] a2 = { 1, 2, 3 };          
        var a3 = new int[] { 1, 2, 3 };  

        int[] a4 = new int[3];           
        a4[0] = 1;
        a4[1] = 2;
        a4[2] = 3;

        if (a1[0] == a2[0] &&
            a1[0] == a3[0] &&
            a1[0] == a4[0])
        {
            Console.WriteLine("First elements are the same");
        }
    }
}

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend