Results 1 to 5 of 5

Thread: [RESOLVED] Simple example of creating an Enumerable

  1. #1

    Thread Starter
    Hyperactive Member wornways's Avatar
    Join Date
    Mar 2010
    Posts
    261

    Resolved [RESOLVED] Simple example of creating an Enumerable

    I think I understand from a previous post that an Enumerable is that allows me to do stuff like:

    MyFunction("somestring", MyEnum.MeaningfulName)

    Where the function does something, and the MyEnum contains a series of numeric designators assigned to meaningful names. The function then decides what to do based on those meaningful names.

    I'd like to to create my own Enumerable (MyEnum) with my own series of designations. But I can't find a simple example of how to do this online. Everything I find is overcomplicated and blown out of proportion so badly that I can't begin to decipher from all the noise how I'd go about just doing what I want--which is really basic.

    I just need to know the basic syntax involved in defining an enumerable. I already know how to use it once it's defined.
    In an effort to abolish the writing of "Spaghetti Code",
    some fools got together and invented Spaghetti Syntax.

  2. #2

    Thread Starter
    Hyperactive Member wornways's Avatar
    Join Date
    Mar 2010
    Posts
    261

    Re: [RESOLVED] Simple example of creating an Enumerable

    Never mind! I got it. What I couldn't find on the net I found in one of my useless books. Amazing!
    In an effort to abolish the writing of "Spaghetti Code",
    some fools got together and invented Spaghetti Syntax.

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [RESOLVED] Simple example of creating an Enumerable

    That's an "enumeration", not an "enumerable". If you're talking about the thread that I think you are then that was explained more than once. An enumerable is something that implements the IEnumerable interface and can therefore be looped over using a For Each loop. Maybe you're not talking about the thread I thought you were because it also shows how to declare an enumeration. Actually no, it looks like you were talking about that thread because you posted to it. Maybe you should have read it more carefully.

    http://www.vbforums.com/showthread.p...ht=enumeration

    Post #3 explains what an enumeration is and how to declare one, as does at least one other post later on, which I know because I posted it.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    Hyperactive Member wornways's Avatar
    Join Date
    Mar 2010
    Posts
    261

    Re: [RESOLVED] Simple example of creating an Enumerable

    Quote Originally Posted by jmcilhinney View Post
    That's an "enumeration", not an "enumerable". If you're talking about the thread that I think you are then that was explained more than once. An enumerable is something that implements the IEnumerable interface and can therefore be looped over using a For Each loop. Maybe you're not talking about the thread I thought you were because it also shows how to declare an enumeration. Actually no, it looks like you were talking about that thread because you posted to it. Maybe you should have read it more carefully.

    http://www.vbforums.com/showthread.p...ht=enumeration

    Post #3 explains what an enumeration is and how to declare one, as does at least one other post later on, which I know because I posted it.
    I should have reread that post. Anyway, what I'm using is declared as "Enum". It's pretty interesting. I really like this particular structure. It's uses are endless.
    In an effort to abolish the writing of "Spaghetti Code",
    some fools got together and invented Spaghetti Syntax.

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [RESOLVED] Simple example of creating an Enumerable

    They are pretty handy little b*ggers.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width