예제 #1
0
        public static string FromByteArray(ByteArray obj)
        {
            if (obj == null)
                return null;

            var bytes = obj.ToArray();
            if (bytes.Length < 16)
                return null;

            var ret = new StringBuilder();
            for (int i = 0; i < bytes.Length; i++)
            {
                if (i == 4 || i == 6 || i == 8 || i == 10)
                {
                    ret.Append('-');
                }
                ret.AppendFormat("{0:X2}", bytes[i]);
            }

            return ret.ToString();
        }
예제 #2
0
        /// <summary>
        /// Converts the value of the specified ByteArray to its equivalent byte array representation.
        /// </summary>
        /// <param name="value">A ByteArray object.</param>
        /// <returns>The equivalent byte array representation.</returns>
        
        public static Byte[] ToByteArray(ByteArray value)
        {
            if (value == null) return null;

            return value.ToArray();
        }