Sat Jul 13 15:08:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
[mono.git] / mcs / class / corlib / System.Reflection.Emit / PropertyToken.cs
1 // PropertyToken.cs
2 //
3 // (C) 2001 Ximian, Inc.  http://www.ximian.com
4
5
6 namespace System.Reflection.Emit {
7
8
9         /// <summary>
10         ///  Represents the Token returned by the metadata to represent a Property.
11         /// </summary>
12         [Serializable]
13         public struct PropertyToken {
14
15                 internal int tokValue;
16
17                 public static readonly PropertyToken Empty;
18
19
20                 static PropertyToken ()
21                 {
22                         Empty = new PropertyToken ();
23                 }
24
25
26                 internal PropertyToken (int val)
27                 {
28                         tokValue = val;
29                 }
30
31
32
33                 /// <summary>
34                 /// </summary>
35                 public override bool Equals (object obj)
36                 {
37                         bool res = obj is PropertyToken;
38
39                         if (res) {
40                                 PropertyToken that = (PropertyToken) obj;
41                                 res = (this.tokValue == that.tokValue);
42                         }
43
44                         return res;
45                 }
46
47
48                 /// <summary>
49                 ///  Tests whether the given object is an instance of
50                 ///  PropertyToken and has the same token value.
51                 /// </summary>
52                 public override int GetHashCode ()
53                 {
54                         return tokValue;
55                 }
56
57
58                 /// <summary>
59                 ///  Returns the metadata token for this Property.
60                 /// </summary>
61                 public int Token {
62                         get {
63                                 return tokValue;
64                         }
65                 }
66
67         }
68
69 }
70