Skip to content

Change check NotInheritedAttribute - #4668

Merged
rpetrusha merged 4 commits into
dotnet:masterfrom
AlexandrTsvetkov:patch-1
Mar 20, 2018
Merged

rpetrusha merged 4 commits into
dotnet:masterfrom
AlexandrTsvetkov:patch-1

Conversation

@AlexandrTsvetkov

Copy link
Copy Markdown

Change check InheritedAttribute for classes BaseB and DerivedB to check NotInheritedAttribute

Change check InheritedAttribute for classes BaseB and DerivedB to check NotInheritedAttribute
@JRAlexander JRAlexander added the ✨ 1st-time docs contributor! Indicates PRs from new contributors to the docs repository label Mar 15, 2018

@rpetrusha rpetrusha left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you , @AlexandrTsvetkov, for contributing to the dotnet/docs repo and for correcting what I suspect was a copy-and-paste error in the code example. There's also a Visual Basic example in dotnet/docs/samples/snippets/visualbasic/VS_Snippets_CLR_System/System.AttributeUsageAttribute.Inherited/vb. Would you mind fixing that as well? Or if you prefer, we can make the changes for you.

typeB.GetCustomAttributes(typeof(InheritedAttribute), true).Length > 0);
Console.WriteLine("DerivedB has NotInherited attribute: {0}",
typeB.GetCustomAttributes(typeof(NotInheritedAttribute), true).Length > 0);
MethodInfo memberB = typeB.GetMethod("MethodB");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to use nameof operator here: MethodInfo memberB = typeB.GetMethod(nameof(DerivedB.MethodB));

In line 40, I suggest the same change to MethodInfo memberA = typeA.GetMethod("MethodA");

@dnfclas

dnfclas commented Mar 19, 2018 •

Copy link
Copy Markdown

CLA assistant check
All CLA requirements met.

@AlexandrTsvetkov

Copy link
Copy Markdown
Author

Thank you for your suggestion @rpetrusha . Unfortunately, I don't use Visual Basic and it will be much more better, if you fix it by yourself.

Found and updated while added the VB version
Also, switch to using interpolated strings.

@BillWagner BillWagner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this @AlexandrTsvetkov We do appreciate the work.

@rpetrusha I made the VB updates, and also switched the C# code to use interpolated strings.

@rpetrusha

Copy link
Copy Markdown
Contributor

Thanks again for opening this issue and correcting the C# code, @AlexandrTsvetkov, and thanks for correcting the VB code, @BillWagner. We'll merge your PR now. The changes should appear live on docs.microsoft.com in the next day or two.

@rpetrusha
rpetrusha merged commit 7fe06d6 into dotnet:master Mar 20, 2018
@AlexandrTsvetkov
AlexandrTsvetkov deleted the patch-1 branch June 5, 2019 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ 1st-time docs contributor! Indicates PRs from new contributors to the docs repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants