Results 1 to 2 of 2

Thread: Convert byte[] to string

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2004
    Posts
    97

    Convert byte[] to string

    Hello Everybody:

    Can any body help me /show me how to convert byte[] to string

    Pls guide...

    Rahil


    public string Send(string sendobject)

    {

    Object objData = txtClient.Text;
    byte[] byData = System.Text.Encoding.ASCII.GetBytes (objData.ToString ());
    m_socWorker.Send (byData);
    sendobject= byData ;
    return sendobject;


    }

  2. #2
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    you should use .GetString on the encoding to convert a byte array to a string, eg:
    VB Code:
    1. [COLOR=blue]string[/COLOR] s = System.Text.Encoding.ASCII.GetString(byData);
    2.  
    3. [COLOR=blue]return[/COLOR] s
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width