C# ArrayList中的gethashcode方法 示例
namespace ConsoleApplication6 { class Program { static void Main(string[] args) { //create the arraylist named days ArrayList days = new ArrayList(); //add the elements in the arraylist var a = days.Add("Sunday"); var b = days.Add("Monday"); var c = a | b; //perform or operation between a and b index values var d = a & b; //perform add opeartion between a and b index values var e = a ^ b; //perform Xor operation days.Add("Tuesday"); days.Add("Wednesday"); days.Add("Thusday"); days.Add("Friday"); days.Add("Saturday"); Console.WriteLine("The hashcode of varaible a is:" + a.GetHashCode()); Console.WriteLine("The hashcode of varaible b is:" + b.GetHashCode()); Console.WriteLine("The hashcode of varaible c is:" + c.GetHashCode()); Console.WriteLine("The hashcode of varaible d is:" + d.GetHashCode()); Console.WriteLine("The hashcode of varaible e is:" + d.GetHashCode()); } } }
ArrayList的GethashCode方法用作特定类型的哈希函数. GethashCode方法返回变量的哈希码和我们执行的操作。
日期:2020-04-11 22:50:31 来源:oir作者:oir