您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

73 行
2.0 KiB

using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using Unity.UIWidgets.foundation;
namespace UIWidgetsSample
{
public abstract class EquatableMixin: IEquatable<EquatableMixin> {
/// {@macro equatable_props}
private List<object> props
{
get;
}
/// {@macro equatable_stringify}
// ignore: avoid_returning_null
bool? stringify
{
get
{
return null;
}
}
public static bool operator ==(EquatableMixin left,EquatableMixin right) {
return Equals(left, right) && Equals(left.props, right.props);
}
public static bool operator !=(EquatableMixin left, EquatableMixin right)
{
return !(left == right);
}
//@override int get hashCode => runtimeType.hashCode ^ mapPropsToHashCode(props);
public override string ToString() {
switch (stringify) {
case true:
return EquatableUtils.mapPropsToString(this.GetType(), props);
case false:
return this.GetType().ToString();
default:
return EquatableConfig.stringify == true
? EquatableUtils.mapPropsToString(this.GetType(), props)
: this.GetType().ToString();
}
}
public bool Equals(EquatableMixin other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return Equals(props, other.props);
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != this.GetType()) return false;
return Equals((EquatableMixin) obj);
}
public override int GetHashCode()
{
return (props != null ? props.GetHashCode() : 0);
}
}
}