I know both assemblies and namespaces contain classes and methods but what is the difference between references (assemblies) and namespaces?
They’re pretty much unrelated.
You can think of an assembly as more or less just a pile of classes that you are bringing into your project.
Namespaces are just a way to section off class names so that they don’t overlap with one another. System.Random and UnityEngine.Random for example are both called “Random”, but they can be used together because they have different namespaces.
By convention, a lot of assemblies put their classes into a few related namespaces, but this is just a convention and not related to the way assemblies work at all. It’s possible for two classes from different assemblies to have the same namespace. A namespace doesn’t really “contain” anything. It’s more just an extended part of the class name.
2 Likes
