Thank you for clarification. I think you need to create two classes:
class Axe
{
private double x = .0;
private double y = .0;
private double z = .0;
public Axe(double _x, double _y, double _z)
{
x = _x;
y = _y;
z = _z;
}
public double X
{
get{return x;}
set{x = value;}
}
public double Y
{
get{return y;}
set{y = value;}
}
public double Z
{
get{return z;}
set{z = value;}
}
}
class MyData
{
private string aName = string.Empty;
private List<Axe> axes = new List<Axe>();
public MyData(string _name, List<Axe> _axes)
{
aName = _name;
axes = _axes;
}
public string Name
{
get{return aName;}
set {aName = value;}
}
public List<Axe> Axes
{
get{return axes;}
set{axes = value;}
}
}
As you can see, the first one (
Axe
) is used to store single
X
,
Y
and
Z
values. The second one (
MyData
) is a holder for single name
Suj01:RIAS
and list of
Axe
's ;)
Usage:
List<MyData> datas = new List<MyData>
{
new MyData("Suj01:RIAS", new List<Axe>{new Axe(.22, 5.12, 2.33), new Axe(8.22, 15.12, 22.33), new Axe(4.22, 9.12, 9.33)}),
new MyData("Suj02:RIAS", new List<Axe>{new Axe(.11, 5.32, 2.55), new Axe(8.11, 15.32, 22.55), new Axe(4.11, 9.32, 9.55)})
};
[EDIT]
Imagine, that now you're able to get statistical data via using
Linq[
^] queries, for example:
var qry = from d in datas
select new
{
Name = d.Name,
AvgX = d.Axes.Average(a=>a.X).ToString("#0.00"),
AvgY = d.Axes.Average(a=>a.Y).ToString("#0.00"),
AvgZ = d.Axes.Average(a=>a.Z).ToString("#0.00"),
SumX = d.Axes.Sum(a=>a.X).ToString("#0.00"),
SumY = d.Axes.Sum(a=>a.Y).ToString("#0.00"),
SumZ = d.Axes.Sum(a=>a.Z).ToString("#0.00"),
Total = d.Axes.Sum(a=>a.X+a.Y+a.Z).ToString("#0.00")
};
Result:
Name AvgX AvgY AvgZ SumX SumY SumZ Total
Suj01:RIAS 4.22 9.79 11.33 12.66 29.36 33.99 76.01
Suj02:RIAS 4.11 9.99 11.55 12.33 29.96 34.65 76.94
[/EDIT]
I'd sugest to read this:
Walkthrough: Creating Your Own Collection Class[
^]
Note that i'm not sure i understand you correctly, but i hope that my answer will be good point to start discuss about OOP programming.