class inside module in VB .net

Hi guys
Is it ok for me to define a class inside a module
I don't want create another class because
I am only defining properties(e.g Name, Value)
Thanks!


Answer this question

class inside module in VB .net

  • Steele

    Sorry for the vague question..
    I think your reply just answers my question( Structure instead of class)..
    Thanks guys!

  • Tinamus

    Thanks.So it is ok for me to declare my structure inside a module then right
  • Ricky A Jones

    First of all - do you really know what a class is First you say "is it ok for me to define a class", then you say "I don't want to create another class"...

    A class is a class regardless of where it is defined.

    And, as stated in another reply, a class with only properties and no methods could (should ) be implemented as a struct ("Type") instead.


  • sylvanascent

    You'd want to create a struct then if all you want are a bunch of properties/variables.  Furthermore, you can combine classes into one .cs/.vb file to maintain a more concise file base. 

  • Hand-E-Food

    I'm not 100% sure.  I use c#, and I don't really have modules to work with.  I do know that it's considered bad form though.  I'd suggest just making it in another file. Modules are used mainly for globally used functions and variables.  It's a bit out of place.

  • class inside module in VB .net