Skip to content

Instantly share code, notes, and snippets.

public class Indexer
{
private Dictionary<string, List<string>> terms =
new Dictionary<string, List<string>>(StringComparer.OrdinalIgnoreCase);
private Dictionary<string, List<string>> itemsByTerm =
new Dictionary<string, List<string>>();
public void Index(string docId, string text)
{
// First check to see if we already have anything for this docId
@SpencerLynn
SpencerLynn / Swictionary.cs
Last active August 29, 2015 14:04
Switch Statement Alternative
using System;
using System.Collections.Generic;
using System.Linq;
public class Swictionary<TKey, TValue>
{
readonly Dictionary<Predicate<TKey>, TValue> Cases;
TValue Default;
public Swictionary(TValue @default)