浏览代码

Implemented IEquatable

/namespace
Thomas 7 年前
当前提交
34dfab9b
共有 1 个文件被更改,包括 28 次插入2 次删除
  1. 30
      ScriptableRenderPipeline/Core/Volume/VolumeParameter.cs

30
ScriptableRenderPipeline/Core/Volume/VolumeParameter.cs


using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;

}
[Serializable, DebuggerDisplay(k_DebuggerDisplay)]
public class VolumeParameter<T> : VolumeParameter
public class VolumeParameter<T> : VolumeParameter, IEquatable<VolumeParameter<T>>
{
[SerializeField]
protected T m_Value;

public static bool operator ==(VolumeParameter<T> lhs, T rhs)
{
return lhs.value.Equals(rhs);
return lhs != null && lhs.value != null && lhs.value.Equals(rhs);
}
public bool Equals(VolumeParameter<T> other)
{
if (ReferenceEquals(null, other))
return false;
if (ReferenceEquals(this, other))
return true;
return EqualityComparer<T>.Default.Equals(m_Value, other.m_Value);
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj))
return false;
if (ReferenceEquals(this, obj))
return true;
if (obj.GetType() != GetType())
return false;
return Equals((VolumeParameter<T>)obj);
}
//

正在加载...
取消
保存