There are several ways to instantiate a class in C #.
The usual way is to simply use new :
MyType myInstance = new MyType();
To dynamically create objects based on their name, for example, Activator.Createinstance() works, but you need to know the assembly where this class is defined so that you can correctly create this instance.
However, especially if you are just starting out, I would not do this. C # is a statically typed language, which means that type resolution is performed at compile time.
Also, consider that the IDE, Visual Studio, will help you a lot, as it can scan files in your project and know the type of each member that you enter into your code.
Static type languages ββhelp to avoid the exact problems that arise in purely dynamic languages: they force you to be consistent, because you have to be explicit in your declaration (although C # with the var keyword can help a lot in preventing this usually required verbosity )
So, the whole point is to make sure that you declare all types that you will need in your application.
If you need a specific member of a class to receive data from several other classes, you can use inheritance to create a base class that others inherit some behavior or use Interfaces to describe common members for different types. Each has its own advantages and disadvantages .
If you are working with C # just by experimenting, I would recommend getting LINQpad . This can help you experiment while learning.
I would also stay away from anything that was not canonical: first understand the idiomatic C # before going too deep, trying to make stuff at runtime.
One area you can explore is the dynamic type. It's not as flexible as what you expect from a truly dynamic language, but it is a way to deal with type uncertainty.
However, it has a performance flaw and should be avoided if you want to use Intellisense in Visual Studio and want to use the usual type checking that the IDE and the compiler can provide.