I've inherited an old program with a data structure
that is basically image reading (x,y, and a few properties). it works ok but i have to do a major expansion/refactor now, so i want to address some issues with my knowledge now
public struct DataSet
{
public double X;
public double Y;
public double A;
public double B;
public double C;
}
List<List<DataSet>> RasterSet = List<List<DataSet>>();
//create the structure from the image file using X,Y,A,B,C
sublist = new List<DataSet>();
RasterSet.Add(sublist);
the question is, i've always assumed through my reading that passing a big struct
around is expensive, so i've been making the struct
and RasterSet
list as public static
. I'd really rather fix this, but i don't know how.
I'm ONLY using the RasterSet List<List<Struct>>
; the whole reason for the struct is that is how the image software i'm talking to gives me it's data.
Even better would be to understand if there is a way to keep the "structure" (X,Y,A,B,C) without the struct
(reference rather than value) but i have no idea how or if.
i'm lacking in experience here, but the reading on struct is very focused on the old chestnut "when to use a struct" and not a lot of practical examples (i don't need what is a struct and when to use it advice please).
> being passed as a reference (like a normal List, and therefore the same cost?).
– ferday Mar 31 '17 at 04:51