.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> File Operation >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Convert byte array to string in C#

Posted By:Pankaj Mishra       Posted Date: August 06, 2008    Points: 10    Category: File Operation    URL: http://www.dotnetspark.com  

Convert byte array to string in C# is very easy. Below is the sample function to do so
 

This code sample shows how to convert Byte Array to string //function to convert byte array to string

in C# sample

//function to convert byte array to string 
public static string ConvertByteArrayToString(byte[] byteArray)
{
          return (new UnicodeEncoding()).GetString(byteArray);
}

And in Vb.net sample method

'function to convert byte array to string 
Public Shared Function ConvertByteArrayToString(ByVal byteArray As Byte()) As String
    Return (New UnicodeEncoding()).GetString(byteArray)
End Function


     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend