开发者

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 m开发者_高级运维ake 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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜