Class StringExtensions
- Namespace
- Cuemon.Extensions.IO
- Assembly
- Cuemon.Extensions.IO.dll
Extension methods for the String class.
public static class StringExtensions
- Inheritance
-
StringExtensions
Methods
ToStream(String, Action<EncodingOptions>)
Converts the specified value
to a Stream.
public static Stream ToStream(this string value, Action<EncodingOptions> setup = null)
Parameters
value
StringThe String to extend.
setup
Action<EncodingOptions>The EncodingOptions which may be configured.
Returns
Remarks
IEncodingOptions will be initialized with DefaultPreambleSequence and DefaultEncoding.
Exceptions
- ArgumentNullException
value
cannot be null.- InvalidEnumArgumentException
setup
was initialized with an invalid Preamble.
ToStreamAsync(String, Action<AsyncEncodingOptions>)
Converts the specified value
to a Stream.
public static Task<Stream> ToStreamAsync(this string value, Action<AsyncEncodingOptions> setup = null)
Parameters
value
StringThe String to extend.
setup
Action<AsyncEncodingOptions>The AsyncEncodingOptions which may be configured.
Returns
- Task<Stream>
A task that represents the asynchronous operation. The task result contains a Stream containing the result of the specified
value
.
Remarks
IEncodingOptions will be initialized with DefaultPreambleSequence and DefaultEncoding.
Exceptions
- ArgumentNullException
value
cannot be null.- InvalidEnumArgumentException
setup
was initialized with an invalid Preamble.
ToTextReader(String)
Converts the specified value
to a TextReader object.
public static TextReader ToTextReader(this string value)
Parameters
Returns
- TextReader
A TextReader initialized with
value
.