|
-
July 16th, 2009, 01:02 PM
#17
Re: construct array out of string
 Originally Posted by BigEd781
Well, that is just the method to get the value. You can use it to create a dictionary.
Would be counter productive to create a dictionary like this because he would need to know the all the values ahead of time. I suppose you could use the dictionary as a caching mechanism though and just save the result in a dictionary and only resort to the GetValue() if no entry is in the dictionary... Something like this.
Code:
public String GetCachedValue(String name)
{
if(!dictionary.ContainsKey(name))
dictionary[name] = GetValue(name);
return dictionary[name];
}
 Originally Posted by memeloo
and why not something like this?
In the original problem it was stated that the fields present in the string would be different depending on what he was trying to do. So we needed a solution that was a little more generic and worked with any string of name/value pairs.
Last edited by monalin; July 16th, 2009 at 01:09 PM.
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
|