tags:

views:

40

answers:

2

Hi,

I'm trying to find an alternative to List<Tuple<Grid, TabItem, int, string, int>>..., since I need to be able to modify the integers' values or string's value.

I say "alternative" because I don't think it's possible to modify any values in a tuple. I don't want to delete it and create it again with different values.

A: 

You should probably make a list of structs where you name each of the tuple elements:

struct mytype {
    Grid mygrid;
    TabItem myitem;
    int myint;
    // etc
}

Then use List<mytype>. Of course you should replace all those names with something more meaningful.

recursive
+3  A: 

It looks like you should just create your own class to hold these properties, then you can enforce whatever behavior you want. Tuples are mostly just for simple bundling of objects (usually temporarily). If you want an object to hold all these things, be editiable for certain properties (but not others?) then you should just write a class for it.

class BagOfthings
{
    public Grid Grid {get; private set;}
    public TabItem TabItem {get; private set;}
    public int id {get; private set;}
    public String label {get; set;}
    public int index {get; set;}
}

obviously you should pick variables names that make sense :)

luke