public static string ToBase64String (byte[] inArray, int offset, int length, Base64FormattingOptions options)
{
if (inArray == null)
throw new ArgumentNullException ("inArray");
if (offset < 0 || length < 0)
throw new ArgumentOutOfRangeException ("offset < 0 || length < 0");
// avoid integer overflow
if (offset > inArray.Length - length)
throw new ArgumentOutOfRangeException ("offset + length > array.Length");
if (length == 0)
return String.Empty;
if (options == Base64FormattingOptions.InsertLineBreaks)
return ToBase64StringBuilderWithLine (inArray, offset, length).ToString ();
else
return Encoding.ASCII.GetString (ToBase64Transform.InternalTransformFinalBlock (inArray, offset, length));
}