C#

TimeoutStream and .NET Standard 2.0

TimeoutStream and .NET Standard 2.0

One of the open-source frameworks attempting to support the .NET Standard 2.0 is the Accord.NET framework. As the .NET Standard is only an API specification and not a specification of implementation, certain differences will be found between the full .NET framwork and e.g. .NET Core 2.0 which honors the .NET Standard 2.0.

Mutli-threaded pipeline in C#

Mutli-threaded pipeline in C#

As the processors of today's computers are getting increasingly more powerful and with the raise of multi-core processors, multi-threading is becoming increasingly more important for CPU intensive tasks.

Although not all tasks are suitable for execution in complete parallel, as the input-output order of data is crucial and it may consist of a series of operations which need to be executed sequentially, most tasks can be split into smaller isolated chunks of operations.

This is where a pipeline pattern, or pipes and filters pattern, is useful.

Seekable FTP file stream in C#

Seekable FTP file stream in C#

Certain types of files are dependent on metadata stored within the file itself to be read before the file can be used for anything. One of these file types is the ZIP archive format.

A ZIP-file stores a data directory at the end of the file specifying metadata for the contained files and therefore the data directory is required to be read before attempting to read or extract any of the contained files.

For solving the challenge, I wrapped an FtpWebRequest instance in an implementation inheriting from Stream, as a SeekableFtpFileStream, and thereby allowing the implementation to close and reopen connections with an offset to skip to file offsets of interest on FTP.

Indexed enumerator using C# 7 and ValueTuple

Indexed enumerator using C# 7 and ValueTuple

One of the new exciting features of C# 7 is the introduction of the struct- and instance field-based ValueTuple. Due to changed inner workings of a ValueTuple compared to the classic Tuple, deconstructors and syntactic sugar in Visual Studio, tuples have become a delight to use without compromising the readability of code.