C# FileInfo Decrypt

Description

FileInfo Decrypt Decrypts a file that was encrypted by the current account using the Encrypt method.

Syntax

FileInfo.Decrypt has the following syntax.


[ComVisibleAttribute(false)]
public void Decrypt()

Returns

FileInfo.Decrypt method returns

Example

The following code example uses the Encrypt method and the Decrypt method to encrypt a file and then decrypt it.


using System;//from w  ww  .  j ava 2s .  co m
using System.IO;
using System.Security.AccessControl;

class FileExample
{
    public static void Main()
    {
        string FileName = @"c:\MyTest.txt";
        FileInfo fInfo = new FileInfo(FileName);
        if (!fInfo.Exists)
        {
            fInfo.Create();
        }
        fInfo.Encrypt();
        fInfo.Decrypt();

    }
}




















Home »
  C# Tutorial »
    System.IO »




BinaryReader
BinaryWriter
Directory
DirectoryInfo
DriveInfo
File
FileInfo
FileStream
MemoryStream
Path
StreamReader
StreamWriter
StringReader
StringWriter