Skip to content

Instantly share code, notes, and snippets.

View markusjohnsson's full-sized avatar

Markus Johnsson markusjohnsson

  • Infviz AB
  • Sweden
View GitHub Profile
@markusjohnsson
markusjohnsson / gist:6013785
Last active December 19, 2015 20:29
LINQ meta operator. Wraps each element in a meta object also containing the index in the sequence and whether the element is first and if it is last in the sequence.
public class MetaElement<T>
{
public MetaElement(T value, bool isLast, bool isFirst, int index)
{
this.Value = value;
this.IsLast = isLast;
this.IsFirst = isFirst;
this.Index = index;
}
public int Index { get; private set; }
@markusjohnsson
markusjohnsson / gist:5486979
Created April 30, 2013 06:41
Creates an observable that, when subscribed to, will subscribe to the underlying observable, but will not dispose that subscription when its own subscription is disposed.
using System;
using System.Reactive;
using System.Reactive.Linq;
namespace RxFireAndForget
{
public static class RxExtensions
{
/// <summary>
/// Creates an observable that, when subscribed to, will subscribe to the underlying observable,