mardi 27 janvier 2015

C# - else steatment not triggering [on hold]

I have been creating a parser, in my parser I have the following function:



private object GetValue(Class Class, Method Method = null)
{

if (Token.IsOperator(Reader.Peek().Value))
{
string Peek = Reader.Peek().Value;
Reader.Read();
return new Operator() { Value = Peek };
}
else if (Method != null && Method.ConstainsLocal(Reader.Peek().Value))
{
string Peek = Reader.Peek().Value;
Reader.Read();
return Method.GetLocal(Peek);
}
else
{
string peek = Reader.Peek().Value;
Reader.Read();
return peek;
}

throw new Exception();

}


It's calling the exception, not the else statement, why?


Aucun commentaire:

Enregistrer un commentaire