C# ArrayList GetHashCode

Description

ArrayList GetHashCode serves as the default hash function.

Syntax

ArrayList.GetHashCode has the following syntax.


public virtual int GetHashCode()

Returns

ArrayList.GetHashCode method returns A hash code for the current object.

Example


using System;/*from   w w  w  . jav  a  2  s .c  o m*/
using System.Collections;

class MainClass
{
  static void Main(string[] args)
  {
    ArrayList a = new ArrayList(10);
    int x = 0;

    a.Add( ++x);
    a.Add( ++x);
        
        Console.WriteLine(a.GetHashCode());
  }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Collections »




ArrayList
BitArray
Comparer
Hashtable
Queue
SortedList
Stack