Phonon
Phonon

Reputation: 12737

Where to keep a structure: class, module or none?

This is purely a coding practice question concerning VB.NET structures. Where do you keep one?

As an example, I've created a structure for the simple purpose of keeping information organized, I'd like this structure to be stand-alone, not belonging to any class so I wouldn't have to access it through SomeClass.MyStructure but rather simply MyStructure. So, do I keep it in a separate class and import it into my namespace? Do I keep it in a module (Static class, essentially)? Do I just make a separate VB.NET code file and place is there (I would like it to live in a separate file). Just to clarify, I need this structure to be accesses by the whole application, not just a single class.

What do you usually do in such cases?

Upvotes: 3

Views: 1680

Answers (1)

Henk Holterman
Henk Holterman

Reputation: 273264

A structure is a Type, much like a Class.

So Yes, put it in a separate file. Then it will be 'in a namespace', the project-default one.

Upvotes: 2

Related Questions