public override bool Equals(object obj) { if (this == obj) { return(true); } if (obj is TypeDescriptor) { TypeDescriptor td = (TypeDescriptor)obj; if (_sample != null && _sample == td._sample) { return(true); } if (td.IsComplete != td.IsComplete) { return(false); } if (!CILType.Equals(td.CILType)) { return(false); } if (IsArtificial != td.IsArtificial) { return(false); } if (IsStatic != td.IsStatic) { return(false); } if (IsUnconstrained != td.IsUnconstrained) { return(false); } int start = IsUnconstrained ? 1 : 0; for (int i = start; i < TypeParams.Length; i++) { if (!object.Equals(TypeParams[i], td.TypeParams[i])) { return(false); } } TypeDescriptor[] mydeps = GetDependentTypes(); TypeDescriptor[] hisdeps = td.GetDependentTypes(); if (mydeps.Length != hisdeps.Length) { return(false); } for (int i = 0; i < mydeps.Length; i++) { if (!object.Equals(mydeps[i], hisdeps[i])) { return(false); } } return(true); } else { return(false); } }