Updates referencesource to .NET 4.7
[mono.git] / mcs / class / referencesource / mscorlib / system / reflection / emit / propertytoken.cs
1 // ==++==
2 // 
3 //   Copyright (c) Microsoft Corporation.  All rights reserved.
4 // 
5 // ==--==
6 /*============================================================
7 **
8 ** Class:  PropertyToken
9 ** 
10 ** <OWNER>Microsoft</OWNER>
11 **
12 **
13 ** Propertybuilder is for client to define properties for a class
14 **
15 ** 
16 ===========================================================*/
17 namespace System.Reflection.Emit {
18     
19     using System;
20     using System.Reflection;
21     using System.Security.Permissions;
22
23     [Serializable]
24     [System.Runtime.InteropServices.ComVisible(true)]
25     public struct PropertyToken {
26     
27         public static readonly PropertyToken Empty = new PropertyToken();
28
29         internal int m_property;
30
31         internal PropertyToken(int str) {
32             m_property=str;
33         }
34     
35         public int Token {
36             get { return m_property; }
37         }
38         
39         // Satisfy value class requirements
40         public override int GetHashCode()
41         {
42             return m_property;
43         }
44
45         // Satisfy value class requirements
46         public override bool Equals(Object obj)
47         {
48             if (obj is PropertyToken)
49                 return Equals((PropertyToken)obj);
50             else
51                 return false;
52         }
53         
54         public bool Equals(PropertyToken obj)
55         {
56             return obj.m_property == m_property;
57         }
58     
59         public static bool operator ==(PropertyToken a, PropertyToken b)
60         {
61             return a.Equals(b);
62         }
63         
64         public static bool operator !=(PropertyToken a, PropertyToken b)
65         {
66             return !(a == b);
67         }
68         
69     }
70
71
72 }