Make it clearer. In the above example, ValueRange is my class, not C # one.
I wonder if there is a way to avoid type declaration twice.
int k;
ValueType m;
In this declaration, the type "int" is declared twice. But it seems to me superfluous. If, for example, I want to change type k, I would have to change both declarations. I knew about Activator.CreateInstance, but it doesn’t look beautiful to me! Too complicated !! But if there is no better solution, I will stick to it
source
share