C# Class Utilities.IO.Extensions.FileInfoExtensions

Extension methods for System.IO.FileInfo
Mostra file Open project: feanz/Utilities

Public Methods

Method Description
Append ( this file, byte content ) : FileInfo

Appends a byte array to a file

Append ( this file, string content, Encoding encodingUsing = null ) : FileInfo

Appends a string to a file

CompareTo ( this file1, FileInfo file2 ) : bool

Compares two files against one another

FileNameNoExtension ( this file ) : string

Get the file name of the current file without extension

Read ( this file ) : string

Reads a file to the end as a string

ReadBinary ( this file ) : byte[]

Reads a file to the end and returns a binary array

Save ( this file, byte content ) : FileInfo

Saves a byte array to a file

Save ( this file, string content, Encoding encodingUsing = null ) : FileInfo

Saves a string to a file

SaveAsync ( this file, byte content, AsyncCallback callBack, object stateObject ) : FileInfo

Saves a byte array to a file (asynchronously)

SaveAsync ( this file, string content, AsyncCallback callBack, object stateObject, Encoding encodingUsing = null ) : FileInfo

Saves a string to a file (asynchronously)

SetAttributes ( this file, FileAttributes attributes ) : FileInfo

Sets the attributes of a file

Method Details

Append() public static method

Appends a byte array to a file
public static Append ( this file, byte content ) : FileInfo
file this File to append to
content byte Content to append to the file
return System.IO.FileInfo

Append() public static method

Appends a string to a file
public static Append ( this file, string content, Encoding encodingUsing = null ) : FileInfo
file this File to append to
content string Content to save to the file
encodingUsing System.Text.Encoding The type of encoding the string is using (defaults to ASCII)
return System.IO.FileInfo

CompareTo() public static method

Compares two files against one another
public static CompareTo ( this file1, FileInfo file2 ) : bool
file1 this First file
file2 System.IO.FileInfo Second file
return bool

FileNameNoExtension() public static method

Get the file name of the current file without extension
public static FileNameNoExtension ( this file ) : string
file this Current file info
return string

Read() public static method

Reads a file to the end as a string
public static Read ( this file ) : string
file this File to read
return string

ReadBinary() public static method

Reads a file to the end and returns a binary array
public static ReadBinary ( this file ) : byte[]
file this File to open
return byte[]

Save() public static method

Saves a byte array to a file
public static Save ( this file, byte content ) : FileInfo
file this File to save to
content byte Content to save to the file
return System.IO.FileInfo

Save() public static method

Saves a string to a file
public static Save ( this file, string content, Encoding encodingUsing = null ) : FileInfo
file this File to save to
content string Content to save to the file
encodingUsing System.Text.Encoding Encoding that the content is using (defaults to ASCII)
return System.IO.FileInfo

SaveAsync() public static method

Saves a byte array to a file (asynchronously)
public static SaveAsync ( this file, byte content, AsyncCallback callBack, object stateObject ) : FileInfo
file this File to save to
content byte Content to save to the file
callBack AsyncCallback Call back function
stateObject object State object
return System.IO.FileInfo

SaveAsync() public static method

Saves a string to a file (asynchronously)
public static SaveAsync ( this file, string content, AsyncCallback callBack, object stateObject, Encoding encodingUsing = null ) : FileInfo
file this File to save to
content string Content to save to the file
callBack AsyncCallback Call back function
stateObject object State object
encodingUsing System.Text.Encoding Encoding that the content is using (defaults to UTF8)
return System.IO.FileInfo

SetAttributes() public static method

Sets the attributes of a file
public static SetAttributes ( this file, FileAttributes attributes ) : FileInfo
file this File
attributes FileAttributes Attributes to set
return System.IO.FileInfo