title: XML writer and Memory Stream c#
body: <p>I am creating a file using XmlWriter, <code>XmlWriter writer = XmlWriter.Create(fileName);</code> it is creating a file and then i have one more function which i am calling  <code>private void EncryptFile(string inputFile, string outputFile)</code> which takes 2 string input and outpulfile and in the end i have two files one is encrypted and one is not. I just want one encrypted file but foor my encrypt function it takes inputfile which is created by XmlWriter. Is there any way i can create memorystream and pass that into my function instead of creating a inputfile.
    my encrypt function</p>
  
  <pre><code>private void EncryptFile (string inputFile, string outputFile)
              string password = @"fdds"; // Your Key Here
              UnicodeEncoding UE = new UnicodeEncoding();
  
              byte[] key = UE.GetBytes(password);
              string cryptFile = outputFile;
              FileStream fsCrypt = new FileStream(cryptFile, FileMode.Create);
  
              RijndaelManaged RMCrypto = new RijndaelManaged();
  
  
              CryptoStream cs = new CryptoStream(fsCrypt,RMCrypto.CreateEncryptor(key,key),CryptoStreamMode.Write);
  
              FileStream fsIn = new FileStream(inputFile, FileMode.Open);
  
              int data;
              while ((data = fsIn.ReadByte()) != -1)
                  cs.WriteByte((byte)data);
              cs.FlushFinalBlock();
              fsIn.Close();
              cs.Close();
              fsCrypt.Close();
          }
      }      
  </code></pre>