Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8525613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:02:02+00:00 2026-06-11T08:02:02+00:00

Is there a type in the .NET Framework that will compare two operators and

  • 0

Is there a type in the .NET Framework that will compare two operators and determine if one has lower precedence than another? For the time being, I’ve implemented a function in the form of IComparer<ExpressionType>, for the operators I am interested in, and by using the operator category chart for the C# language.

The implementation is trivial, and of general use for compiler/interpreter implementers, leading me to think that a general utility function exists. Alternatively, it would also be trivial to implement such a comparer if a library function exists to get the ordinal of a given operator.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T08:02:04+00:00Added an answer on June 11, 2026 at 8:02 am

    No, there isn’t, and you’ve mentioned why (emphasis mine):

    I’ve implemented a function in the form of IComparer<ExpressionType>,
    for the operators I am interested in, and by using the operator
    category chart for the C# language.

    Operator overloading precedence is a language-specific detail. The Base Class Libraries (BCL) and the CLR are language-agnostic, they support many languages, all of which can provide their own order for operator precedence.

    And even if they offered a method to be used in any language to indicate what the operator overload precedence would be, what happens when you write code in language A (with precedence PA) and then consume it with language B (with precedence PB)?

    You would get inconsistent results.

    This is why it’s determined on the language level, and not on the BCL/CLR level; there’s just no possible way to do it consistently across languages, and it might not even make sense if they could or tried given that you can access the library from multiple languages.

    If you are going to implement such a thing, I recommend that you include a language identifier and make sure that comparisons of operator precedence are tied to the language. That’s the only way to guarantee consistent results when the method/library is used across all languages.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Question Is there a mechanism in the .NET Framework to hide one custom Type
I am developing a Windows Mobile 6.5 (.NET Compact Framework 3.5) app that will
There's a standard pattern for events in .NET - they use a delegate type
Why in Boolean type there are two fields with the same value? internal const
Is there a certain type of SQL field that acts as a sequential number
Is there a data type in eVC++ that is the equivalent of __int64 ?
.Net framework contains a great class named Convert that allows conversion between simple types,
ASP.NET For each appSetting I use, I want to specify a value that will
Is there some open source code already written out there somewhere that will accept
I have a product admin web site that has been generated using ASP.NET Dynamic

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.