B
B
Bur-Burito2016-09-13 10:53:50
C++ / C#
Bur-Burito, 2016-09-13 10:53:50

How to make a hidden method visible to another assembly in C#?

I want to create a unit test for the method, so I need to make it open for the project with tests. But at the same time, I would like to leave it hidden for the rest. Is there a way to do this? I suspect there must be some attributes.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Anatoliy Mikhailov, 2016-09-13
@Bur-Burito

As an option, you can try to make an overloaded public method with directives

#if(DEBUG)
public string GetMyAwesomeString(string anotherOne){
    return _getMyAwesomeString(anotherOne);
}
#endif

Accordingly, it will no longer be in the release.

P
Peter, 2016-09-13
@petermzg

Friendly Builds

R
Roman, 2016-09-13
@yarosroman

Reflection.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question