WriteByte() public method

public WriteByte ( byte value ) : void
value byte
return void
Esempio n. 1
0
 public override void WriteByte(byte value)
 {
     AssertInvariants();
     Contracts.Check(!_disposed, "Stream already disposed");
     if (IsMemory && _memStream.Position >= _overflowBoundary)
     {
         EnsureOverflow();
     }
     MyStream.WriteByte(value);
     AssertInvariants();
 }
        static void Main(string[] args)
        {
            DirectoryInfo MyRoot = new DirectoryInfo(@"c:\projects");

            DirectoryInfo[] MySub;
            DirectoryInfo   TheFolder = null;

            FileInfo[] MyFiles;
            FileInfo   TheFile = null;
            FileStream MyStream;

            MyRoot.CreateSubdirectory("MyFolder");
            MySub = MyRoot.GetDirectories();
            foreach (DirectoryInfo D in MySub)
            {
                if (D.Name == "MyFolder")
                {
                    TheFolder = D;
                }
            }

            MyFiles = TheFolder.GetFiles();
            foreach (FileInfo F in MyFiles)
            {
                if (F.Name == "Testing.txt")
                {
                    TheFile  = F;
                    MyStream = TheFile.Open(FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite);

                    int  i = 0;
                    byte b = 0;

                    while (i != 000)
                    {
                        MyStream.WriteByte(b);
                        i++;
                        b++;
                    }
                }
            }

            TheFile.Delete();
            TheFolder.Delete();
        }