惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Help Net Security
博客园 - Franky
GbyAI
GbyAI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
爱范儿
爱范儿
IT之家
IT之家
酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
博客园_首页
MongoDB | Blog
MongoDB | Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recent Announcements
Recent Announcements
Scott Helme
Scott Helme
有赞技术团队
有赞技术团队
M
MIT News - Artificial intelligence
C
CERT Recently Published Vulnerability Notes
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Jina AI
Jina AI
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
L
LangChain Blog
L
LINUX DO - 最新话题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
H
Hacker News: Front Page
MyScale Blog
MyScale Blog
P
Palo Alto Networks Blog
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
AI
AI
T
Troy Hunt's Blog
Microsoft Azure Blog
Microsoft Azure Blog
阮一峰的网络日志
阮一峰的网络日志
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
S
Secure Thoughts
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
人人都是产品经理
人人都是产品经理
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
S
Security @ Cisco Blogs
Cloudbric
Cloudbric
E
Exploit-DB.com RSS Feed
Attack and Defense Labs
Attack and Defense Labs

博客园 - 妖居

ASP.NET MVC Tips #2 - 令人混乱的Get、Post、Return View和Return Redirect ASP.NET MVC Tips #1 - 支持上传文件的ModelBinder How to migrate MsSql database to MySql Windows Workflow Foundation 使用小例 使用异步委托解决Windows Application应用Duplex Service时出现的Deadlock问题 字节数组、数值和十六进制字符串的转换 表格化固定长、CSV文件编辑器工具 iMatrixitor 发布 Getting Started With LINQ in Visual Basic (翻译 + 评论) 使用接口实现附带插件功能的程序 两个简单方法加速DataGridView 使用.NET自带的功能制作简单的注册码 《Introducing Visual Basic 2005》中看到的一些VB2005的新特性 VB.NET函数的返回值问题(从CSDN论坛一个问题想到的) Add-in and Automation Development In VB.NET 2003 (Finished) Add-in and Automation Development In VB.NET 2003 (8) 模拟IE地址栏的TextBox小控件 Add-in and Automation Development in VB.NET 2003 (6-7) 在WinXP环境下显示XP风格的控件 Add-in and Automation Development In VB.NET 2003 (5)
不是说“Peek 不会更改 StreamReader 的当前位置”么。MS骗人的!
妖居 · 2005-09-27 · via 博客园 - 妖居

在MSDN里面看到关于StreamReader.Peek 方法的解释,备注里面说
Peek 不会更改 StreamReader 的当前位置。如果当前没有更多的可用字符,则返回值为 -1。

但是假设C:\CMSG.LOG文件一行内容超过1024字节后,运行下面的程序就会发现Peek之后,
Position变成了1024了。但是此后如果再运行Peek就没有问题了,Position不会改变。
难道MSDN说的是错的???

代码:
        Dim fs As New IO.FileStream("C:\CMSG.LOG", IO.FileMode.Open, IO.FileAccess.Read)
        Dim sr As New IO.StreamReader(fs, System.Text.Encoding.GetEncoding(System.Globalization.CultureInfo.CurrentCulture.TextInfo.ANSICodePage))
        MsgBox("Position before peek: " & sr.BaseStream.Position)
        sr.Peek()
        MsgBox("Position after peek: " & sr.BaseStream.Position)
        sr.Close()
        fs.Close()

To dudu:这个问题我在CSDN上面问了,但是没有人回。暂借首页问一下。