summaryrefslogtreecommitdiff
path: root/src/mscorlib/src/System/Reflection/Emit/MethodToken.cs
blob: 76b7279f30c0545b11e14796047144b02abbcfae (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

/*============================================================
**
** 
** 
**
**
** Purpose: Represents a Method to the ILGenerator class.
**
** 
===========================================================*/
namespace System.Reflection.Emit {
    
    using System;
    using System.Reflection;

    [Serializable]
    public struct MethodToken
    {
        public static readonly MethodToken Empty = new MethodToken();
        internal int m_method;
            
        internal MethodToken(int str) {
            m_method=str;
        }
    
        public int Token {
            get { return m_method; }
        }
        
        public override int GetHashCode()
        {
            return m_method;
        }

        public override bool Equals(Object obj)
        {
            if (obj is MethodToken)
                return Equals((MethodToken)obj);
            else
                return false;
        }
        
        public bool Equals(MethodToken obj)
        {
            return obj.m_method == m_method;
        }
        
        public static bool operator ==(MethodToken a, MethodToken b)
        {
            return a.Equals(b);
        }
        
        public static bool operator !=(MethodToken a, MethodToken b)
        {
            return !(a == b);
        }
        
    }
}