blob: a3c7e505d45a194a71e10e4772198cfb5bd4cf32 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
// Compiler options: -checked
using System;
internal sealed class Alpha
{
public Alpha (string value)
{
m_name = value;
}
public override int GetHashCode ()
{
return int.MaxValue & m_name.GetHashCode ();
}
private string m_name;
}
internal sealed class Beta
{
public Beta (string value)
{
m_address = value;
}
public override int GetHashCode ()
{
return int.MaxValue & m_address.GetHashCode ();
}
private string m_address;
}
internal static class Program
{
private static int Main ()
{
var a = new { First = new Alpha ("joe bob"), Second = new Beta ("main street") };
Console.WriteLine ("hash = {0}", a.GetHashCode ());
return 0;
}
}
|