/// <summary>
        /// 将 HGlobalCache 中的内容写入到流中。
        /// </summary>
        /// <param name="hGCache">HGlobalCache</param>
        /// <param name="stream">流</param>
        /// <param name="encoding">编码</param>
        public static void WriteTo(this HGlobalCache <char> hGCache, Stream stream, Encoding encoding)
        {
            var hGBytes = BytesPool.Rent();

            hGCache.WriteTo(hGBytes, encoding);

            hGBytes.WriteTo(stream);

            BytesPool.Return(hGBytes);
        }
        /// <summary>
        /// 使用指定哈希算法类型和编码类型计算字符缓存的哈希值。以十六进制字符串返回。
        /// </summary>
        /// <typeparam name="THashAlgorithm">哈希算法类型</typeparam>
        /// <param name="hGCache">字符缓存</param>
        /// <param name="encoding">指定编码</param>
        /// <returns>返回 Hash 值的十六进制字符串</returns>
        public static string ComputeHash <THashAlgorithm>(this HGlobalCache <char> hGCache, Encoding encoding) where THashAlgorithm : HashAlgorithm
        {
            var hGBytes = BytesPool.Rent();

            hGCache.WriteTo(hGBytes, encoding);

            var result = ComputeHash <THashAlgorithm>(hGBytes);

            BytesPool.Return(hGBytes);

            return(result);
        }