Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use syntactic sugar for special operator methods #141

Open
Rekkonnect opened this issue Mar 10, 2021 · 5 comments
Open

Use syntactic sugar for special operator methods #141

Rekkonnect opened this issue Mar 10, 2021 · 5 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@Rekkonnect
Copy link

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
Copy link
Owner

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

@praeclarum praeclarum added enhancement New feature or request good first issue Good for newcomers labels May 27, 2021
@TylerBrinkley
Copy link
Contributor

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
Copy link
Author

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

@praeclarum
Copy link
Owner

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
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants