public QuestionBase()
 {
     questions = new List<QuestionBase>();
     _form = null;
     _parent = null;
     _title = "default Titlte";
 }
 public AnswerBase AddAnswerFor( QuestionBase question)
 {
     AnswerBase answer = question.GetAnswerInstance(this);
     if( _answers.ContainsKey(question))
         _answers[question] = answer;
     else
         _answers.Add(question, answer);
     return answer;
 }
 public QuestionBase(string title, QuestionBase parent = null)
 {
     if( String.IsNullOrEmpty( title ) )
         throw new ArgumentException( "title", "title MUST NOT be NULL or EMPTY!" );
     questions = new List<QuestionBase>();
     _form = null;
     _parent = parent;
     _title = title;
 }
 public AnswerBase FindAnswer(QuestionBase question)
 {
     return _answers.ContainsKey(question)? _answers[question]:null;
 }
 public SectionQuestion(string title,QuestionBase parent=null)
     : base(title,parent)
 {
 }
 public void RemoveQuestion( QuestionBase question )
 {
     if( question == null )
         throw new ArgumentNullException( "question", "question MUST NOT be NULL!" );
     if( !Contains( question ) )
         throw new ArgumentException( "question", "question CANNOT BE REMOVED as it DOES NOT EXIST" );
     question.Parent = null;
 }
 public bool Contains( QuestionBase question )
 {
     if( question == null )
         throw new ArgumentNullException( "question", "question MUST NOT be NULL!" );
     if( question.Parent == null )
         return false;
     else if( question.Parent != this)
         return this.Contains( question.Parent );
     else
         return true;
 }
 public void AddNewQuestion( QuestionBase question )
 {
     if( question == null )
         throw new ArgumentNullException( "question", "question MUST NOT be NULL!" );
     if( Contains( question ) )
         throw new ArgumentException( "question", "question CANNOT be ADDED as it ALREADY EXISTS!" );
     question.Parent = this;
 }