C# Container Class
- by Jamie
I'm building a game in c# which allows you to script your own level, although I have come across a bit of a thought.
I have a base class called "World" as an object.
This was made with a simple:
class World {
However, when the user is scripting their level, all of the game objects will be contained in the world object. I want them to be able to do something on the lines of:
World.ParentObjectName.ParentObjectProperty = "abc";
I know that the System.Windows.Forms.Panel and other classes are like containers and can have objects in them and be accessed in that kind of way... my question is how can I make a class which is like a container in which I can add objects to, and then access them with a World.ObjectName
I have tried class World : System.Collections.CollectionBase, but with this method, I have to keep typing World.Item("ObjectName")
Can anyone help?
Thanks!