Skip to content

File

Summary

Represents a file.

Remarks

You can use this as a parameter type to get direct read and write access to a file.

Signature

1
public abstract interface File

Namespace

cAlgo.API

Methods

Exists

Summary

Returns True if File exists otherwise False.

Signature

1
public abstract bool Exists()

Return Value

bool

WriteAllBytes

Summary

Overwrites file content with passed bytes.

Signature

1
public abstract void WriteAllBytes(byte[] bytes)

Parameters

Name Type Description
bytes byte[] Bytes to write

Return Value

void

WriteBytes

Summary

Writes a chunk of data to file specific position.

Signature

1
public abstract void WriteBytes(byte[] bytes, int offset, int count)

Parameters

Name Type Description
bytes byte[] Bytes to write
offset int File byte offset
count int Count of bytes to write

Return Value

void

WriteAllText (2)

WriteAllText (1 of 2)

Summary

Overwrites file content with passed text content.

Signature

1
public abstract void WriteAllText(string contents)

Parameters

Name Type Description
contents string The string to write to the file.

Return Value

void

WriteAllText (2 of 2)

Summary

Overwrites file content with passed text content that has a specified encoding.

Signature

1
public abstract void WriteAllText(string contents, EncodingType encodingType)

Parameters

Name Type Description
contents string The string to write to the file.
encodingType EncodingType Encoding type

Return Value

void

ReadLines (2)

ReadLines (1 of 2)

Summary

Reads the lines of file.

Signature

1
public abstract string[] ReadLines()

Return Value

string[]

ReadLines (2 of 2)

Summary

Reads the lines of file that has a specified encoding.

Signature

1
public abstract string[] ReadLines(EncodingType encodingType)

Parameters

Name Type Description
encodingType EncodingType Encoding type

Return Value

string[]

ReadAllText (2)

ReadAllText (1 of 2)

Summary

Reads all the text in the file.

Signature

1
public abstract string ReadAllText()

Return Value

string

ReadAllText (2 of 2)

Summary

Reads all the text in the file that has a specified encoding.

Signature

1
public abstract string ReadAllText(EncodingType encodingType)

Parameters

Name Type Description
encodingType EncodingType Encoding type

Return Value

string

ReadAllBytes

Summary

Reads the contents of the file into a byte array.

Signature

1
public abstract byte[] ReadAllBytes()

Return Value

byte[]

ReadBytes

Summary

Reads a sequence of bytes from the file.

Signature

1
public abstract byte[] ReadBytes(int offset, int count)

Parameters

Name Type Description
offset int File byte offset
count int Count of bytes to read

Return Value

byte[]

AppendAllText (2)

AppendAllText (1 of 2)

Summary

Append text to file.

Signature

1
public abstract void AppendAllText(string contents)

Parameters

Name Type Description
contents string The string to append to the file.

Return Value

void

AppendAllText (2 of 2)

Summary

Appends text to file that has a specified encoding.

Signature

1
public abstract void AppendAllText(string contents, EncodingType encodingType)

Parameters

Name Type Description
contents string The string to append to the file.
encodingType EncodingType Encoding type

Return Value

void

AppendAllLines (2)

AppendAllLines (1 of 2)

Summary

Appends lines to file.

Signature

1
public abstract void AppendAllLines(string[] contents)

Parameters

Name Type Description
contents string[] The string lines to append to the file.

Return Value

void

AppendAllLines (2 of 2)

Summary

Appends lines to file that has a specified encoding.

Signature

1
public abstract void AppendAllLines(string[] contents, EncodingType encodingType)

Parameters

Name Type Description
contents string[] The string lines to append to the file.
encodingType EncodingType Encoding type

Return Value

void

Properties

Name

Summary

Gets file name without path.

Signature

1
public abstract string Name {get;}

Return Value

string

Extension

Summary

Gets the extension part of the file name, including the leading dot '.' even if it is the entire file name, or an empty string if no extension is present.

Signature

1
public abstract string Extension {get;}

Return Value

string

Size

Summary

Gets file size in bytes.

Signature

1
public abstract long Size {get;}

Return Value

long

CreationTime

Summary

Gets the creation time of the file.

Signature

1
public abstract DateTime CreationTime {get;}

Return Value

DateTime

LastAccessTime

Summary

Gets the time the current file was last accessed.

Signature

1
public abstract DateTime LastAccessTime {get;}

Return Value

DateTime

LastWriteTime

Summary

Gets the time when the current file was last written to.

Signature

1
public abstract DateTime LastWriteTime {get;}

Return Value

DateTime