Checking a Model's function's return value and setting values to a View member I have a WinForms project that uses the Passive View MVP pattern. In the Presenter of one of my Views I have a function that gets questions and from its Model. But I want to make sure these collections are not empty so that I can inform the user when they are. Right now my code seems very ugly and I wonder if anyone has any tips to make it shorter/better. Thank you.

public void InitializeInterview(object sender, EventArgs e)
    {
        List&lt;List&lt;string&gt;&gt; questionList = new List&lt;List&lt;string&gt;&gt;();
        List&lt;List&lt;string&gt;&gt; maturityAnswerList = new List&lt;List&lt;string&gt;&gt;();
        List&lt;List&lt;string&gt;&gt; complianceAnswerList = new List&lt;List&lt;string&gt;&gt;();

        questionList = _model.GetQuestions();
        maturityAnswerList = _model.GetMaturityAnswers();
        complianceAnswerList = _model.GetComplianceAnswers();

        if (questionList != null &amp;&amp; questionList.Any())
        {
            _view.Questions = questionList;
        }
        else
        {
            _view.Message("No questions have been found, please add a new question standard");
            _view.CloseView();
        }
        if (maturityAnswerList != null &amp;&amp; maturityAnswerList.Any())
        {
            _view.MaturityAnswers = maturityAnswerList;
        }
        else
        {
            _view.Message("No maturity answers have been found, please add a new maturity standard");
            _view.CloseView();
        }
        if (complianceAnswerList != null &amp;&amp; complianceAnswerList.Any())
        {
            _view.ComplianceAnswers = complianceAnswerList;
        }
        else
        {
            _view.Message("No compliance answers have been found, please add a new compliance standard");
            _view.CloseView();
        }

    }
Don't call List&lt;T&gt; "somethingList" -- e.g. if they are questions, call it questions, not questionList.



Why do you do List&lt;List&lt;string&gt;&gt; questionList = new List&lt;List&lt;string&gt;&gt;(); if the next step is questionList = _model.GetQuestions();? Instead don't bother with the initialization and just assign it directly: var questionList = _model.GetQuestions();



List&lt;List&lt;string&gt;&gt; is a warning sign to me that your design is probably flawed, and when I look at the context -- a list of questions and a separate list of answers -- I fear that your code has far worse issues than the reason for this question.



Is there a reason you're doing this in an "outdated" technology like WinForms when WPF etc. exists? There is a strong link between data and UI in this method, which is a frequent issue with WinForms; if this was WPF you could implement MVVM to separate those concerns.