Int32EqualityComparer.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / ndp / fx / src / DataWeb / Server / System / Data / Services / Int32EqualityComparer.cs / 1 / Int32EqualityComparer.cs

                            //---------------------------------------------------------------------- 
// 
//      Copyright (c) Microsoft Corporation.  All rights reserved.
// 
//  
//      Non-default-based implementation of IEqualityComparer<int>.
//  
// 
// @owner  [....]
//--------------------------------------------------------------------- 

namespace System.Data.Services
{
    using System.Collections.Generic; 

    /// This class implements IEqualityComparer for System.In32. 
    ///  
    /// Using this class rather than EqualityComparer<T>.Default
    /// saves from JIT'ing it in each AppDomain. 
    /// 
    internal class Int32EqualityComparer : IEqualityComparer
    {
        /// Empty constructor. 
        internal Int32EqualityComparer()
        { 
        } 

        /// Checks whether two numbers are equal. 
        /// First number.Second number.
        /// true if x equals y; false otherwise.
        public bool Equals(int x, int y)
        { 
            return x == y;
        } 
 
        /// Gets a hash code for the specified number.
        /// Value. 
        /// The hash code for the specified value.
        public int GetHashCode(int obj)
        {
            return obj; 
        }
    } 
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//---------------------------------------------------------------------- 
// 
//      Copyright (c) Microsoft Corporation.  All rights reserved.
// 
//  
//      Non-default-based implementation of IEqualityComparer<int>.
//  
// 
// @owner  [....]
//--------------------------------------------------------------------- 

namespace System.Data.Services
{
    using System.Collections.Generic; 

    /// This class implements IEqualityComparer for System.In32. 
    ///  
    /// Using this class rather than EqualityComparer<T>.Default
    /// saves from JIT'ing it in each AppDomain. 
    /// 
    internal class Int32EqualityComparer : IEqualityComparer
    {
        /// Empty constructor. 
        internal Int32EqualityComparer()
        { 
        } 

        /// Checks whether two numbers are equal. 
        /// First number.Second number.
        /// true if x equals y; false otherwise.
        public bool Equals(int x, int y)
        { 
            return x == y;
        } 
 
        /// Gets a hash code for the specified number.
        /// Value. 
        /// The hash code for the specified value.
        public int GetHashCode(int obj)
        {
            return obj; 
        }
    } 
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK