Click or drag to resize

FileReadToEnd Method

Function to Read an entire file and return it as a string

Namespace: Crestron.SimplSharp.CrestronIO
Assembly: SimplSharpHelperInterface (in SimplSharpHelperInterface.dll) Version: 2.21.121
Syntax
C#
public static string ReadToEnd(
	string fileToRead,
	Encoding stringEncoding
)

Parameters

fileToRead  String
File to open for reading.
stringEncoding  Encoding
Encoding used to convert the file to a string.

Return Value

String
The contents of the file according to the Encoding passed in.
Exceptions
ExceptionCondition
InvalidDirectoryLocationExceptionInvalid destination directory.
IOExceptionFile System error while attempting to open the stream.
DirectoryNotFoundExceptionInvalid directory location.
FileNotFoundExceptionThe file passed does not exist.
PathTooLongExceptionPath is great than 248 characters.
SecurityExceptionThe user does not have the required permissions.

Version Information

.NET

Supported in: 6.0

.NET Compact Framework

Supported in: 3.5
See Also