Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. CodeDom question

CodeDom question

Scheduled Pinned Locked Moved C#
tutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Pablo Hernandez Valdes
    wrote on last edited by
    #1

    hello: I'm trying to generate code using the CodeDom, and I need to know how to get an expression from an assign statement. I'm using CodeBinaryOperatorExpression but I get the generated code within parenthesis, for example: ( a = 0 ); I'd like to know if I can get the code without parenthesis using the previous class or someone else. Thanks Pablo Hernandez Valdes

    D 1 Reply Last reply
    0
    • P Pablo Hernandez Valdes

      hello: I'm trying to generate code using the CodeDom, and I need to know how to get an expression from an assign statement. I'm using CodeBinaryOperatorExpression but I get the generated code within parenthesis, for example: ( a = 0 ); I'd like to know if I can get the code without parenthesis using the previous class or someone else. Thanks Pablo Hernandez Valdes

      D Offline
      D Offline
      Dustin Metzgar
      wrote on last edited by
      #2

      CodeBinaryOperatorExpression is always going to use the parentheses. This way it can always be safe with order of operations. You can't really remove the parentheses using CodeBinaryOperatorExpression. What you may want to try, if you can, is to use a CodeSnippetExpression. If the expression will work in all the languages you're generating, then you're fine. Otherwise, you have to live with the parentheses.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups