private bool Equals(SST other) { var areBothNonPartial = string.IsNullOrEmpty(PartialClassIdentifier) && string.IsNullOrEmpty(other.PartialClassIdentifier); var pciEq = areBothNonPartial || string.Equals(PartialClassIdentifier, other.PartialClassIdentifier); return(EnclosingType.Equals(other.EnclosingType) && pciEq && Fields.Equals(other.Fields) && Properties.Equals(other.Properties) && Methods.Equals(other.Methods) && Events.Equals(other.Events) && Delegates.Equals(other.Delegates)); }
public override int GetHashCode() { unchecked { var hashCode = EnclosingType.GetHashCode(); if (!string.IsNullOrEmpty(PartialClassIdentifier)) { hashCode = (hashCode * 397) ^ PartialClassIdentifier.GetHashCode(); } hashCode = (hashCode * 397) ^ Fields.GetHashCode(); hashCode = (hashCode * 397) ^ Properties.GetHashCode(); hashCode = (hashCode * 397) ^ Methods.GetHashCode(); hashCode = (hashCode * 397) ^ Events.GetHashCode(); hashCode = (hashCode * 397) ^ Delegates.GetHashCode(); return(hashCode); } }
/// <summary> /// Initializes a new instance of the <see cref = "AnonymousMethodInfo" /> class. /// </summary> /// <param name = "anonymousMethod">An anonymous method.</param> public AnonymousMethodInfo(MethodInfo anonymousMethod) { if (anonymousMethod == null) { throw new ArgumentNullException(nameof(anonymousMethod)); } this.anonymousMethod = anonymousMethod; var declaringType = this.anonymousMethod.DeclaringType; var methodName = this.anonymousMethod.Name; var indexOfGt = methodName.IndexOf(">", StringComparison.OrdinalIgnoreCase); if (indexOfGt < 0) { EnclosingType = declaringType; EnclosingMethodName = this.anonymousMethod.Name; return; } EnclosingMethodName = methodName.Substring(0, indexOfGt).TrimStart('<'); if (declaringType.IsCompilerGenerated() && (declaringType ?.DeclaringType ?.IsGenericTypeDefinition ?? false)) { EnclosingType = declaringType .DeclaringType ?.MakeGenericType(declaringType.GenericTypeArguments); } else { EnclosingType = declaringType; } while (EnclosingType?.DeclaringType != null && EnclosingType.IsCompilerGenerated()) { EnclosingType = EnclosingType.DeclaringType; } }
public override string ToString() { return(EnclosingType.ToString(false) + "." + Method.ToString()); }