Skip to content

Instantly share code, notes, and snippets.

@martindevans
Created November 11, 2015 03:37

Revisions

  1. martindevans created this gist Nov 11, 2015.
    12 changes: 12 additions & 0 deletions example.cs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    struct Key
    : KeyTrait<ValueType>
    // ^ ^ Type of the value this key supplies
    // | Implement a trait indicating this is a key

    {
    }

    //usage
    Key k = whatever(); //Get a key object
    var value = dict.get(k);
    // ^ Type of "value" is whatever the associated type "ValueType" is for the type "Key"