You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
usingSystem;usingSystem.Linq;varhashCodeAttributes=typeof(RR).GetMethod("GetHashCode").GetCustomAttributes(inherit:true);// prints: "System.Runtime.CompilerServices.CompilerGeneratedAttribute"// It prints "No attributes" if `inherit: true` is changed to `false`.Console.WriteLine(hashCodeAttributes.Length==0?"No attributes":hashCodeAttributes.Single());recordR{}recordRR:R{publicoverrideintGetHashCode(){return0;}}
I think that's okay. CompilerGeneratedAttribute has Inherited=true, so when using the GetCustomAttributes API with inherit: true option, it will show up.
[System.AttributeUsage(System.AttributeTargets.All, Inherited=true)]
public sealed class CompilerGeneratedAttribute : Attribute
Is this behavior okay? @jcouv
The text was updated successfully, but these errors were encountered: