string to byte array

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Keith

    string to byte array

    Is there a simple way to convert a string to a byte array
    with out having to iterate through the whole string?
  • Thomas Scheidegger [MVP]

    #2
    Re: string to byte array

    System.Text.Enc oding.Default.G etBytes( "Hello" )



    --
    Thomas Scheidegger - MVP .NET - 'NETMaster'
    http://www.cetus-links.org/oo_dotnet.html - http://dnetmaster.net/


    Comment

    • Jon Skeet

      #3
      Re: string to byte array

      Keith <keithm@inozsof tware.com> wrote:[color=blue]
      > Is there a simple way to convert a string to a byte array
      > with out having to iterate through the whole string?[/color]

      Use Encoding.GetByt es with an appropriate encoding. See
      http://www.pobox.com/~skeet/csharp/unicode.html for more information.

      --
      Jon Skeet - <skeet@pobox.co m>
      Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

      If replying to the group, please do not mail me too

      Comment

      Working...