Summarize Multidimensional Array in C# -
i trying find best (quickest) way summarize multidimensional array passed object.
for example if have object[,] data
contains data similar to:
john,utah,huntsville,0120152,60 john,utah,huntsville,06122013,40 dallin,maryland,citytown,10202012,30 aaron,connecticut, harbourville,12122017,100 dallin,maryland,citytown,04232011,8 aaron,virginia,georgetown,02212013,200
this passed object defined following:
string name, string state, string city, list<int> date, list<double> total
so representation of data like:
dallin,maryland,citytown 04232011, 8 10202012, 30 john,utah,huntsville, 0120152, 60 06122013,40
i know fetch distinct items each column use , if statments, being new programming , having extremely large dataset bit worried how long take. , being multidimensional array makes difficult sort. on how approach problem appreciated.
do have have data in multidimensional array? if, example, structured data follows:
public class activity { public int activitydate { get; get; } public double activitytotal { get; set; } } public class person { public string name { get; set; } public string state { get; set; } public string city { get; set; } public list<activity> { get; set; } }
data entry type of structure should relatively easy, , have added benefit of simple sorting, summarization, etc via linq.
when "large" dataset... how large large?
edit:
fair enough... didn't realize didn't control how data loaded object.
that said, maybe domain object this:
public class person { public string name { get; set; } public string state { get; set; } public string city { get; set; } public list<int> date { get; set; } public list<double> total { get; set; } }
and extremely rough example of how convert data
object class. note has absolutely nothing in way of error trapping or type validation:
list<person> p = new list<person>(); (int = 0; < data.length; i++) { p.add(new person() { name = (string)data[i, 0], state = (string)data[i, 1], city = (string)data[i, 2], date = (list<int>)data[i, 3], total = (list<double>)data[i, 4] }); }
Comments
Post a Comment