System.IO.BinaryWriter.Close C# (CSharp) Method

Close() public method

Override Dispose(bool) instead of Close(). This API exists for compatibility purposes.
public Close ( ) : void
return void
        public virtual void Close()
        {
            Dispose(true);
        }

Usage Example

Example #1
1
 //解密
 public string Decrypt(string m,string key)
 {
     string msg = null;
     string[] array = m.Split('~');
     int length = array.Length;
     byte[] by = new byte[length];
     for (int i = 0; i < length;i++ )
     {
         int l = int.Parse(array[i]);
         byte[] k = System.BitConverter.GetBytes(l);
         by[i] = k[0];
     }
     try
     {
         FileStream aFile = new FileStream("2.txt", FileMode.Create);
         BinaryWriter sw = new BinaryWriter(aFile);
         sw.Write(by);
         sw.Close();
         aFile.Close();
     }
     catch (IOException e){}
     test.DES_Decrypt("2.txt", key, "3.txt");
     try
     {
         FileStream file = new FileStream("3.txt", FileMode.Open);
         StreamReader read = new StreamReader(file);
         msg=read.ReadToEnd();
         read.Close();
         file.Close();
     }
     catch (IOException) { }
     return msg;
 }
All Usage Examples Of System.IO.BinaryWriter::Close