Convert a string to a Byte Array in UTF8 encoding.
//-----------------------------------------------------------------------
// <copyright file="Utilities.cs" company="Beemway">
// Copyright (c) Beemway. All rights reserved.
// </copyright>
// <license>
// Microsoft Public License (Ms-PL http://opensource.org/licenses/ms-pl.html).
// Contributors may add their own copyright notice above.
// </license>
//-----------------------------------------------------------------------
using System;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using System.Xml.Serialization;
namespace LinkedIn.Utility
{
/// <summary>
/// A utilities class
/// </summary>
publicstaticclass Utilities
{
/// <summary>
/// Convert a string to a Byte Array in UTF8 encoding.
/// </summary>
/// <param name="value">The xml string to convert.</param>
/// <returns>A byte Array of the string.</returns>
publicstaticbyte[] StringToUTF8ByteArray(string value)
{
UTF8Encoding encoding = new UTF8Encoding();
byte[] byteArray = encoding.GetBytes(value);
return byteArray;
}
}
}