The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,230 other followers

Nick Craver on Twitter: “I see a lot of MyEnum.Member.ToString() in code reviews across various projects – instead you should use: nameof(MyEnum.Member)”

Posted by jpluimers on 2020/06/25

I love nameof (and wish many more languages had a similar feature), but since it got introduced so late in the C# language, there is still a lot of old idiom going around. Luckily most of that are not string literals, but you see the occasional reminder to get rid of that cruft: [WayBack] Nick Craver on Twitter: “I see a lot of MyEnum.Member.ToString() in code reviews across various projects – instead you should use: nameof(MyEnum.Member)”.

Luckily, there is a Roslyn analyser for it: [WayBack] Andy Edinborough on Twitter: “Roslynator: https://t.co/3LDUG9WRvE… “.

[WayBack] GitHub – JosefPihrt/Roslynator: A collection of 190+ analyzers and 190+ refactorings for C#, powered by Roslyn.

[WayBack] Antão Almada on Twitter: “I use Enums.NET https://t.co/YaIZWpYVxJ… “ which is a cool library that I’ve used a lot:

[WayBack] GitHub – TylerBrinkley/Enums.NET: Enums.NET is a high-performance type-safe .NET enum utility library

–jeroen

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

 
%d bloggers like this: