Skip to content

Instantly share code, notes, and snippets.

@maslevx
maslevx / CustomFormatConverter.cs
Created June 21, 2015 04:21
filehelpers field converter
public sealed class CustomFormatConverter<T> : ConverterBase where T : IFormattable
{
private string _formatString;
private IFormatProvider _formatProvider;
private Type _objType;
#region constructors
public CustomFormatConverter(string Format)
: this(Format, null)
{ }
/// <summary>
/// Provides extension methods for executing sequences of async operations.
/// Items flow into the resulting sequence as they complete, with the specified limit of operations executing concurrently
/// </summary>
public static class AsyncOpLinqExtension
{
/// <summary>
/// executes <paramref name="action"/> over each element of <paramref name="source"/>
/// </summary>
/// <typeparam name="TSource">type of input sequence</typeparam>
public static IEnumerable<byte[]> LazyReadBinaryFile(string fileName, int recordLen)
{
byte[] buffer = new byte[recordLen];
using (var stream = File.OpenRead(fileName))
{
long remaining = stream.Length;
int read = 0;
while (remaining > 0)
{
@maslevx
maslevx / StringSplitEnumerator.cs
Last active August 29, 2015 14:23
string stuff
/// <summary>
/// Adds more memory-friendly IEnumerable versions of String.Split()
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public static class StringSplitExtensions
{
/// <summary>
/// Returns a string array that contains the substrings in this instance that are delimited by elements of a specified Unicode character array.
/// </summary>
/// <param name="separator"></param>