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
  1. Home
  2. General Programming
  3. C#
  4. equivalent

equivalent

Scheduled Pinned Locked Moved C#
csharpquestion
11 Posts 4 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.
  • G genieabdo

    hi what is the equivalent of this code in c# this code is in VB6 Chr$(Asc("0") thanks

    A Offline
    A Offline
    Abhinav S
    wrote on last edited by
    #2

    Try Convert.ToChar(6);. The output is a unicode value.

    1 Reply Last reply
    0
    • G genieabdo

      hi what is the equivalent of this code in c# this code is in VB6 Chr$(Asc("0") thanks

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #3

      Apart from lacking a parenthesis, it does not make much sense; Asc() returns a number holding the ASCII value, which is 48 for a zero; and Chr$() does the inverse, it returns the ASCII character equivalent of a numeric value. So they cancel each other, it simply means "0" In C# we use different delimiters for string literals and character literals, so you may want a simple '0' :)

      Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


      I only read formatted code with indentation, so please use PRE tags for code snippets.


      I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).


      G 1 Reply Last reply
      0
      • L Luc Pattyn

        Apart from lacking a parenthesis, it does not make much sense; Asc() returns a number holding the ASCII value, which is 48 for a zero; and Chr$() does the inverse, it returns the ASCII character equivalent of a numeric value. So they cancel each other, it simply means "0" In C# we use different delimiters for string literals and character literals, so you may want a simple '0' :)

        Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


        I only read formatted code with indentation, so please use PRE tags for code snippets.


        I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).


        G Offline
        G Offline
        genieabdo
        wrote on last edited by
        #4

        i want convert eny caractere in ascii the 0 is a exemple so if there is some code to calc ascci please send it to me i need it now

        L 1 Reply Last reply
        0
        • G genieabdo

          hi what is the equivalent of this code in c# this code is in VB6 Chr$(Asc("0") thanks

          P Offline
          P Offline
          PIEBALDconsult
          wrote on last edited by
          #5

          There is no equivalent; C# developers are smart enought not to write anything as silly as that. :-D

          G L 2 Replies Last reply
          0
          • G genieabdo

            i want convert eny caractere in ascii the 0 is a exemple so if there is some code to calc ascci please send it to me i need it now

            L Offline
            L Offline
            Luc Pattyn
            wrote on last edited by
            #6

            in .NET an ASCII character is just a character, the first 128 Unicode characters ARE the ASCII characters. So

            'a'
            "a"[0]
            (char)97

            are all the same lower-case a, as they are

            a character literal
            the way to get the first character of a string
            a number cast to a character

            If you don't understand the fundamentals, go buy a book and study it. If you have an overall problem, tell us about the problem rather than asking a detail question on what probably isn't even the right detail. :)

            Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


            I only read formatted code with indentation, so please use PRE tags for code snippets.


            I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).


            1 Reply Last reply
            0
            • P PIEBALDconsult

              There is no equivalent; C# developers are smart enought not to write anything as silly as that. :-D

              G Offline
              G Offline
              genieabdo
              wrote on last edited by
              #7

              thank you it's like that when sharing information has a beginning researcher in c # thank you very much

              1 Reply Last reply
              0
              • P PIEBALDconsult

                There is no equivalent; C# developers are smart enought not to write anything as silly as that. :-D

                L Offline
                L Offline
                Luc Pattyn
                wrote on last edited by
                #8

                Sure, however you should allow some slack for VB coders trying to spit out some C#. How about

                char ascee='0';
                char uniquode=Encoding.UTF8.GetChars(Encoding.ASCII.GetBytes(new char[]{ascee}))[0];

                :)

                Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


                I only read formatted code with indentation, so please use PRE tags for code snippets.


                I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).


                G P 2 Replies Last reply
                0
                • L Luc Pattyn

                  Sure, however you should allow some slack for VB coders trying to spit out some C#. How about

                  char ascee='0';
                  char uniquode=Encoding.UTF8.GetChars(Encoding.ASCII.GetBytes(new char[]{ascee}))[0];

                  :)

                  Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


                  I only read formatted code with indentation, so please use PRE tags for code snippets.


                  I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).


                  G Offline
                  G Offline
                  genieabdo
                  wrote on last edited by
                  #9

                  the out result is the same of first value of ascee no chage ??? :thumbsup:

                  1 Reply Last reply
                  0
                  • L Luc Pattyn

                    Sure, however you should allow some slack for VB coders trying to spit out some C#. How about

                    char ascee='0';
                    char uniquode=Encoding.UTF8.GetChars(Encoding.ASCII.GetBytes(new char[]{ascee}))[0];

                    :)

                    Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


                    I only read formatted code with indentation, so please use PRE tags for code snippets.


                    I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).


                    P Offline
                    P Offline
                    PIEBALDconsult
                    wrote on last edited by
                    #10

                    Luc Pattyn wrote:

                    allow some slack for VB coders

                    They made their sty they can wallow in it. :-D

                    L 1 Reply Last reply
                    0
                    • P PIEBALDconsult

                      Luc Pattyn wrote:

                      allow some slack for VB coders

                      They made their sty they can wallow in it. :-D

                      L Offline
                      L Offline
                      Luc Pattyn
                      wrote on last edited by
                      #11

                      sig material it is. :thumbsup:

                      Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


                      I only read formatted code with indentation, so please use PRE tags for code snippets.


                      I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).


                      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