jeudi 9 mars 2017

C#: How can I instantiate a List of private inner class?

everybody. I'm doing unit-testing now, while I have a problem I can not solve it by my own. The problem is listed below:

public class A {
    private class B{ }
    private List<B> list = new List<B>;
}

I want to test whether list[i] is null or not? Now I can use Reflection to get the list, But the question is how can I add a instance of B into the list? Thanks for your help!





Aucun commentaire:

Enregistrer un commentaire