奇怪的using

奇怪的using

    今天在整理Class Library ,把硬盘里面好几G的code,好好的整理下,方便自己使用也可以给公司的同志们共享。
看了个类非常奇怪的的情况,一直都在用using,可是到现在还没搞清楚 using xxx ; 放在 namespace xx  {  里面和外面有什么不同,刚刚在博客园搜索了下还是没找到答案。

        // The Write method actually does the filtering.
        /// <summary>
        /// 输出转换后的编码
        /// </summary>
        /// <param name="buffer"></param>
        /// <param name="offset"></param>
        /// <param name="count"></param>
        public override void Write(byte[] buffer, int offset, int count)
        {
            Encoding e = Encoding.GetEncoding(936);
            string str = e.GetString(buffer, offset, count);
            for (int i = 0; i < str.Length; i++)
            {
                int j = _sGB.IndexOf(str[i]);
                if (j != -1) str = str.Replace(_sGB[j], _tGB[j]);
            }
            e = Encoding.GetEncoding(System.Web.HttpContext.Current.Response.Charset);
            _sink.Write(e.GetBytes(str), 0, e.GetByteCount(str));

        }

  Encoding 类 是在 System.Text.Encoding 中包含的可是将using放外面就无法找到  Encoding类,自动提示也失效,放到namespace里面即可正常使用!

奇怪的问题?? 继续找答案,先把这个放着!

原文地址:https://www.cnblogs.com/scotoma/p/1138334.html