I
ibiza
Hi All,
I am creating a C# Windows Forms application,
here is my problem :
in my main form, I have this variable : List<List<cBar>> bars;
I will save you the initialization and loading phases of this, but at
the end, this variable contains well, a list of list of bars. For the
sake of the example, let's say a bar is simply an int, so that
variable would roughly be equivalent to a jagged 2-d array of
integers.
bars[0] = { 1, 4, 7, 8, 9 }
bars[1] = {6, 3, 5 }
bars[2] = { 2, 6, 8, 9, 8, 7}
....
I also have a usercontroler on the form. Again for simplicity's sake,
let's say it simply prints all the bars (ints)
For now, as I am still testing, I hardcoded one such list of bars in
the user control and it works great.
So the next step is to integrate the user control in the form so that
when I select a List of bars from the main form ( let's say bars[0] ),
the user control uses it and prints it.
My main concern now : I do not want to pass a List<cBar> by value
parameter to the user control. I want of course to pass a reference of
the list instead, to avoid the tedious process of copying all the data
in the list.
So, for now, when I select a list, I use the following :
userControl.LoadData( bars[selectedList] );
I need to pass a reference to the user control instead of copying the
whole list, how do I do?
Hope this is clear enough,
thanks to all who help!
I am creating a C# Windows Forms application,
here is my problem :
in my main form, I have this variable : List<List<cBar>> bars;
I will save you the initialization and loading phases of this, but at
the end, this variable contains well, a list of list of bars. For the
sake of the example, let's say a bar is simply an int, so that
variable would roughly be equivalent to a jagged 2-d array of
integers.
bars[0] = { 1, 4, 7, 8, 9 }
bars[1] = {6, 3, 5 }
bars[2] = { 2, 6, 8, 9, 8, 7}
....
I also have a usercontroler on the form. Again for simplicity's sake,
let's say it simply prints all the bars (ints)
For now, as I am still testing, I hardcoded one such list of bars in
the user control and it works great.
So the next step is to integrate the user control in the form so that
when I select a List of bars from the main form ( let's say bars[0] ),
the user control uses it and prints it.
My main concern now : I do not want to pass a List<cBar> by value
parameter to the user control. I want of course to pass a reference of
the list instead, to avoid the tedious process of copying all the data
in the list.
So, for now, when I select a list, I use the following :
userControl.LoadData( bars[selectedList] );
I need to pass a reference to the user control instead of copying the
whole list, how do I do?
Hope this is clear enough,
thanks to all who help!