中易网

在c#中filestream如何运用seek语句啊。详解

答案:1  悬赏:60  
解决时间 2021-01-19 00:13
在c#中filestream如何运用seek语句啊。详解
最佳答案
这个方法就是将FileStream流当前的位置进行重新设置。
其中有两个参数,第一个参数long offset,相对于第二个参的偏移量
第二个参数 SeekOrigin origin,这个参数是相对哪里,其中有枚举:开始位置、当前位置、未尾位置

// 摘要:
// Provides the fields that represent reference points in streams for seeking.
[Serializable]
[ComVisible(true)]
public enum SeekOrigin
{
// 摘要:
// Specifies the beginning of a stream.
Begin = 0,
//
// 摘要:
// Specifies the current position within a stream.
Current = 1,
//
// 摘要:
// Specifies the end of a stream.
End = 2,
}

//
// 摘要:
// Sets the current position of this stream to the given value.
//
// 参数:
// offset:
// The point relative to origin from which to begin seeking.
//
// origin:
// Specifies the beginning, the end, or the current position as a reference
// point for origin, using a value of type System.IO.SeekOrigin.
//
// 返回结果:
// The new position in the stream.
//
// 异常:
// System.IO.IOException:
// An I/O error occurs.
//
// System.NotSupportedException:
// The stream does not support seeking, such as if the FileStream is constructed
// from a pipe or console output.
//
// System.ArgumentException:
// Attempted seeking before the beginning of the stream.
//
// System.ObjectDisposedException:
// Methods were called after the stream was closed.
public override long Seek(long offset, SeekOrigin origin);
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
f开头的英文舞曲歌曲名字
迪迪龙青少儿英语徐汇分校地址在什么地方,我
华为荣耀九玩游戏卡吗
乐清地名怎么读啊
天天向上张家辉和吴彦祖那期,然后汪涵拿手机
高台县第一中学地址在什么地方,我要处理点事
东阳初中今年的分数线
长青灯饰城地址好找么,我有些事要过去
新绛县 和绛县有什么区别?
西安火车站晚上十点之后都有那路公交车
英雄联盟上单艾克怎么打伤害
富隆保理网上理财被骗 已报警 因害怕富隆保理
谁知道这个娃是谁
孜然吃多了好吗 多吃孜然对身体有什么好处
晚上11点到1点,与1点到3点。是什么器官工作
推荐资讯
有一部不算老的电影 讲述宇航员去到一个新的
这条鱼是什么鱼,今天在河里炸的。
含有危和将的成语
厦门苹果sm售后维修店在哪里?该怎么去了?
大家认为虹猫的爹爹是个怎样的人?(指性格)
想问一下,e茶e卷这家奶茶店怎么样?
uc里面订阅了的大鱼号怎么删掉?
有一厚8米软粘土层,其压缩量是多少
古代“苑子”、“院子”、“园子”是什么意思
为什么我的CAD中B键是复制,w是矩形命令?
电脑怎么会被雷击?
怎么购买铁矿石
手机登qq时,显示手机磁盘不足,清理后重新登
刺客的套装怎么选啊?