示例#1
0
            /// <summary>
            /// Special equality function because IStructuralEquatable.Equals is not allowed to throw.
            /// </summary>
            public bool __eq__(object other)
            {
                weakcallableproxy wrp = other as weakcallableproxy;

                if (wrp != null)
                {
                    return(GetObject().Equals(wrp.GetObject()));
                }

                return(PythonOps.EqualRetBool(_context, GetObject(), other));
            }
示例#2
0
            bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer)
            {
                object obj;

                if (!TryGetObject(out obj))
                {
                    obj = null;
                }

                weakcallableproxy wrp = other as weakcallableproxy;

                if (wrp != null)
                {
                    object otherObj;
                    if (!TryGetObject(out otherObj))
                    {
                        otherObj = null;
                    }

                    return(comparer.Equals(obj, otherObj));
                }

                return(comparer.Equals(obj, other));
            }