There is no way to tell how many records will be coming in...the max amount is 300
I am using the serialPort's datareceived event to grab the string...I have an idea how I think I can get what I want:
1) take the long string and spilt it at each '\r\n' to make a 1-d array**
2) count the number of elements in that array (to get number of records for 2-d array initializing)
3) get a 2-d array [numOfRecords, 4]
4) spilt each element of the 1-d array at each ',' and put into the new 2-d array
**where I got stuck (don't know how many records...can't set size of array...now, i am lost).
if anyone has a good idea how I can do this...or any suggestions, it would be much appreciated.
Thanks!
(PS. I would post my code...but it's a big load of crap that doesn't work...i'm ashamed)
changing your structure into 4 generic lists and coupling them with indices would be an offer.
I agree that using a dynamic class (such as List<T>) would be a good way to go, but would almost definately go in the opposite direction
Code:
class ARecord
{
public string Part1 {get; set;}
public string Part2 {get; set;}
public string Part3 {get; set;}
}
class MyData : List<ARecord> {}
MUCH easier to work with...
Code:
var foo = from myData where p.Part1.Contains("Foo") select p;
ps: I think the word you meant was either "option" or "alternative."..
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!) 2008, 2009 In theory, there is no difference between theory and paractice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
Bookmarks