Skip to content

Instantly share code, notes, and snippets.

@Quantumplation
Forked from martindevans/example.cs
Created November 11, 2015 03:42
Show Gist options
  • Save Quantumplation/c2335d60d18b7b0520eb to your computer and use it in GitHub Desktop.
Save Quantumplation/c2335d60d18b7b0520eb to your computer and use it in GitHub Desktop.
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"
value.Substring(0, 5);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment