Compare Boolean Object - CSharp System

CSharp examples for System:Boolean

Description

Compare Boolean Object

Demo Code


using Microsoft.SharePoint;
using System.Text;
using System.Linq;
using System.Globalization;
using System.Data;
using System.Collections.Generic;
using System.Collections;
using System;/* www .  j ava2  s .co m*/

public class Main{
        public static bool CompareBooleanObject(object x, object y)
        {
            if (ReferenceEquals(x, y))
            {
                return true;
            }

            if (!(x is bool) || !(y is bool))
            {
                return false;
            }

            return (bool) x == (bool) y;
        }
}

Related Tutorials