Get the byte array from a string using default encoding

   
 
//http://tinyerp.codeplex.com/
//GNU Library General Public License (LGPL)
//-----------------------------------------------------------------------
// <copyright file="SysUtil.cs" company="Pyramid Consulting">
//     Copyright (c) Pyramid Consulting. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;

namespace Bamboo.Core.Common
{
    public class SysUtil
    {
        /// <summary>
        /// get the byte array from a string using default encoding
        /// </summary>
        /// <param name="strData">source string</param>
        /// <returns>converted array</returns>
        public static byte[] StringToBytes(String strData)
        {
            return System.Text.Encoding.GetEncoding(0).GetBytes(strData);
        }
    }
}

   
     


This entry was posted in File Stream. Bookmark the permalink.