当前位置:首页 » 软件开发
开发技术指南» 文章正文
    引言: MemoryStream As we alrea
 

 

    摘要: 在 visual basic .net 中选择文件 i/o 选项 cat francis visual studio team microsoft corporation 2002 年 4 月 摘要:本文是针对 visual basic 程序员而写的,他们可能会搞不清 visual basic .net 中的多种文件 i/o 访问方法。可用的方法包括 visual basic......
    摘要: 使用 visual basic .net 访问注册表 摘要:本文介绍如何使用 visual basic® .net 的内置函数 deletesetting、getallsettings、getsetting 和 savesetting,以及公共语言运行时的 registry 和 registrykey 类来访问注册表。其中详细说明了所需的权限、何时使用注册表编辑器,以及......


ExploringtheSystem.IOnamespace(2)
memorystream as we already saw in the diagram, this class derives from the stream base class and it is primarily used to read and write bytes of data from memory. the amount of memory buffer allocated for storing the data is determined by the value we pass to one of the many overloaded constructors of this class. the default size is 256 bytes. the capacity property allows us to determine the amount of data the memory stream can hold, after which it will have to do reallocation of its buffer. since it is a read/write property, we can also set this property to shrink the size of the memory stream to the desired size. to determine the amount of data that is currently held in the memory stream, we can use the read-only length property. let us consider a simple example to see the memorystream class in action: private void page_load(object sender, system.eventargs e) {    // put user code to initialize the page here    memorystream memstream = new memorystream();    streamwriter writer = new streamwriter(memstream);    writer.writeline("this line is written to the memory stream");    writer.flush();    byte[] arraybyte;    //convert the stream into a byte array    arraybyte = memstream.toarray();    response.write ("capacity = " + memstream.capacity.tostring() +  "<br>");    response.write ("lengh = " + memstream.length.tostring() +  "<br>");    response.write ("canread = " + memstream.canread.tostring()+  "<br>");    response.write ("canseek = " + memstream.canseek.tostring()+  "<br>");    response.write ("canwrite = " + memstream.canwrite.tostring()+  "<br>");    writer.close(); } in the above code, once we create an instance of the memo
...   下一页
    摘要: 把握vb.net中的流(stream) (三) 文件操作具体实例 在这一部分,你将找到更多常用的文件操作的代码实例。最常用、最基本的操作就是把text写入文件和读回来。现在的应用程序通常不用二进制文件作存储简单的变量,而用它来存储对象,对象集合以及其他机器代码。下面,将看到具体操作的例子。 读写文本文件 为了把text保存到文件,创建一个基于filestream的strea......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE