internal int keyOfCorrectAnsver() { foreach (KeyValuePair <int, string> answer in optionalAnswers) { if (MSSQLConnector.IsCorrectAnswer(this.id, answer.Key)) { return(answer.Key); } } throw new MissingFieldException("This question doesn't bind to any correct ansver."); }
static void Main(string[] args) { try { MSSQLConnector.BuildConnection("string", "string", "string", "string"); sqlState = building; Console.WriteLine("Connection was succesfully built."); sqlState = succeed; } catch (InvalidOperationException ex) { Console.WriteLine(ex.Message); sqlState = failed; } Console.ReadKey(); }