Created
January 11, 2011 22:49
-
-
Save jakl/775323 to your computer and use it in GitHub Desktop.
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace kompiler | |
{ | |
class fda | |
{ | |
public enum state | |
{ | |
/* 0*/ | |
INIT = 0, ACCEPTCHAR, ACCEPTNUM, ETC | |
}; | |
/* Doesn't compile; No overload for method 'Add' takes '1' arguments */ | |
Dictionary<char, Dictionary<state, state>> students = new Dictionary<char, Dictionary<state, state>>() | |
{ | |
{ 'l', new Dictionary <state, state> () { | |
state.INIT, state.INIT } | |
}, | |
{ 'd', new Dictionary<state, state>(){ | |
state.INIT, state.INIT } | |
}, | |
{ '"', new Dictionary<state, state>(){ | |
state.INIT, state.INIT } | |
} | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There needs to be an extra set of {} around each of the { state, state }
Now the Dictionary declaration looks like this
Dictionary<char, Dictionary<state, state>> students = new Dictionary<char, Dictionary<state, state>>()
{
{ 'l', new Dictionary <state, state> () {
{state.INIT, state.INIT}
}
},
{ 'd', new Dictionary<state, state>(){
{ state.INIT, state.INIT }
}
},
{ '"', new Dictionary<state, state>(){
{ state.INIT, state.INIT }
}
}
};