strconv in c#???

Posted on 2007-08-07
Medium Priority
Last Modified: 2013-11-05
I am trying to migrate the following code...

    str = StrConv(bytes, vbUnicode)

to c#...

any ideas?
Question by:rodmjay
LVL 22

Accepted Solution

JimBrandley earned 1000 total points
ID: 19649919
I think this is what you need. It converts a byte array to a string.

string s = ASCIIEncoding.ASCII.GetString(bytes);
LVL 13

Assisted Solution

iHadi earned 1000 total points
ID: 19650010
Hi rodmjay

if you want to treat your byte array as unicode you can use the following code:
string str = System.Text.Encoding.Unicode.GetString(bytes);

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question