Created
April 24, 2015 16:50
-
-
Save Echooff3/60d44fb3774a2a4375af to your computer and use it in GitHub Desktop.
C# Tuple List
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Found this on stack. Credit to the guy that wrote it! | |
public class TupleList<T1, T2> : List<Tuple<T1, T2>> | |
{ | |
public void Add( T1 item, T2 item2 ) | |
{ | |
Add( new Tuple<T1, T2>( item, item2 ) ); | |
} | |
} | |
/* | |
var groceryList = new TupleList<int, string> | |
{ | |
{ 1, "kiwi" }, | |
{ 5, "apples" }, | |
{ 3, "potatoes" }, | |
{ 1, "tomato" } | |
}; | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment