public static string ByteToString(Object byteObject)
{
string returnString;
byte[] byteValue;
try
{
if (byteObject.GetType().ToString() == "System.Byte[]")
{
byteValue = (byte[])byteObject;
System.Text.ASCIIEncoding asciiEncoding = new System.Text.ASCIIEncoding();
returnString = asciiEncoding.GetString(byteValue);
}
else
returnString = byteObject.ToString();
}
catch (BaseException ex)
{
throw ex;
}
return returnString;
}
{
string returnString;
byte[] byteValue;
try
{
if (byteObject.GetType().ToString() == "System.Byte[]")
{
byteValue = (byte[])byteObject;
System.Text.ASCIIEncoding asciiEncoding = new System.Text.ASCIIEncoding();
returnString = asciiEncoding.GetString(byteValue);
}
else
returnString = byteObject.ToString();
}
catch (BaseException ex)
{
throw ex;
}
return returnString;
}
No comments:
Post a Comment