Is Equals for two objects - CSharp System

CSharp examples for System:Object

Description

Is Equals for two objects

Demo Code


using System;// w  ww. j ava  2s. com

public class Main{
        /// <summary>
        /// 
        /// </summary>
        /// <param name="expectedValue"></param>
        /// <param name="actualValue"></param>
        /// <param name="message"></param>
        public static void IsEquals(Object expectedValue, Object actualValue, string message)
        {
            if (!actualValue.Equals(expectedValue))
                throw new AssertionFailedException("Expected " + expectedValue + " but encountered "
                            + actualValue + (message != null ? ": " + message : String.Empty));            
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="expectedValue"></param>
        /// <param name="actualValue"></param>
       
        public static void IsEquals(Object expectedValue, Object actualValue)
        {
            IsEquals(expectedValue, actualValue, null);
        }
}

Related Tutorials