Answer the question
In order to leave comments, you need to log in
How to call a class from another C# project?
Hello!
I have a project (Test), I created several more projects inside one solution (TestA, TestB)
TestA, TestB are WPF application modules with an interface (UserControl) and a viewmodel for them.
I want to call the VM from the TestA module in the main Test application and load the usercontrol in Test, but
when I initialize the viewmodel from the TestA module (CurrentVM = new TestAVM()) in the call method,
I get an error.
TestAVM is not available due to its security level.
If you open the TestAVM class and add the public modifier, the error disappears, but then such problems begin inside the module, as a result, almost all classes inside the module have to be made public.
How to implement it correctly? I know that you can use prism and so on, but I want to try to figure it out myself.
The project structure is
--Test
----Models
----View
----ViewModels
--TestA
----Models
----View
----ViewModels
--TestB
----Models
--- -View
----ViewModels
Answer the question
In order to leave comments, you need to log in
stackoverflow.com/questions/4871369/python-error-a...
mikegrouchy.com/blog/2012/05/be-pythonic-__init__p...
https://docs.python.org/3/tutorial/modules. html
__init__.py
More accurately, your EasyTables directories are not modules, they are packages. The file easyTables.py is a module.
Python does not automatically import subpackages or modules. You have to explicitly do it, or "cheat" by adding import statements in the initializers.
TestAVM is not available due to its security level.
, but then such problems begin inside the module, as a result, almost all classes inside the module have to be made public.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question