Results 1 to 3 of 3

Thread: [RESOLVED] Multidimension Structure array? Multidimension Array List? HELP

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2017
    Posts
    4

    Resolved [RESOLVED] Multidimension Structure array? Multidimension Array List? HELP

    I am looking for direction here. I have a file that could have 500 lines to 10000+ lines of data. Its structured like C# (Example below). I need to know how I can find the first line that is the name of the function then the opening bracket to the closed bracket. It can have multiple opening and closing brackets in the middle of the first one and inside of those, I need that data loaded into an array. I have built structure arrays in the past but I think I need a different array… List of T? I will have to size the arrays differently while reading the function. I have an example below of how I need to structure the data. I need something that can sort and be read quickly.

    Function Name
    UserName=”” time=””/* date */
    {
    Param1=””
    Param2=””
    }
    Definition Name=”” Cat=””
    UserName=”” time=””/* date */
    {
    Desc=””
    FBD1=””
    {
    Param1=””
    Param2=””
    }
    FBD2=””
    {
    Param1=””Name:  Capture.PNG
Views: 1149
Size:  6.6 KB
    Param2=””
    Param2=””
    }
    EXP1 Name=””
    }

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,102

    Re: Multidimension Structure array? Multidimension Array List? HELP

    Looks to me like you need a class with a name that means function. Of course, you can't use function as the class name, because that would be a reserved word. So, you might call it funcObject....which suggests FunkyObject. It looks like this can have a name property, a date property, and a dictionary(of string,something) for the parameters, where the key is the parameter name and the value is the parameter value. If the parameters are all the same type, that would be better, as my "something" would be the type. If the parameters are all different types, you might use a Dictionary(of string, object), but that would get ugly. Knowing more about the parameter types would be better. If you really don't know, then the class might have some additional members, including perhaps a second dictionary(of string,type) to track what types the parameters are.

    It looks like the definition part is just a few more properties for the class.

    The point is that you will want a class to hold the data, and it looks like that class will have lots of interesting parts. A class is like a structure, so you'd be familiar with that, but a structure should only be used if you have just a few, simple, member variables. This won't be a few, and they won't be simple types, so a class is correct.

    A List is just an array that can change size efficiently, so you DO want a List for this.
    My usual boring signature: Nothing

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

    Re: Multidimension Structure array? Multidimension Array List? HELP

    Quote Originally Posted by Shaggy Hiker View Post
    Of course, you can't use function as the class name, because that would be a reserved word.
    You can use a reserved word as an identifier if you simply wrap it in brackets. That should be generally avoided though, and a name like FunctionDefinition might be more appropriate.
    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

Tags for this Thread

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