praeclarum / FuGetGallery

An alternative web UI for browsing nuget packages
https://www.fuget.org
MIT License
683 stars 121 forks source link

Use syntactic sugar for special operator methods #141

Open Rekkonnect opened 3 years ago

Rekkonnect commented 3 years ago

Special methods like operators, implicit or explicit type conversion methods are displayed as op_XXX.

For example, a class that implements the + operator will have its method displayed as op_Addition.

The exact special names that could be detected and replaced are certainly documented somewhere.

praeclarum commented 3 years ago

Here is the list of overload names from the framework design guidelines: https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/operator-overloads

TylerBrinkley commented 3 years ago

Here's a good example of a type implementing many of these operators. http://fuget.org/packages/Genumerics/1.0.3/lib/netcoreapp3.0/Genumerics.dll/Genumerics/Number%601

Rekkonnect commented 3 years ago

There is a class that I believe is publicly available, containing the names of several special symbols, which is this.

praeclarum commented 3 years ago

Hey @TylerBrinkley, great library! I’ll get this fixed up.

@AlFasGD Thanks for the reference. Somewhere inside ILSpy is this table too. But it shouldn’t be hard for me to just write it out by hand.

Rekkonnect commented 3 years ago

It's not about it being hard to use a reference, it's about good practice. After all, those are constants that are well-defined by the compiler itself, handed over to you publicly.