|
-
Nov 2nd, 2017, 09:56 AM
#1
Thread Starter
New Member
[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=””
Param2=””
Param2=””
}
EXP1 Name=””
}
-
Nov 2nd, 2017, 11:05 AM
#2
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
 
-
Nov 3rd, 2017, 11:34 PM
#3
Re: Multidimension Structure array? Multidimension Array List? HELP
 Originally Posted by Shaggy Hiker
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.
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|