S
semedao
Hi,
I want to implement list of key-values that can be sort by 2 ways.
let's say that in the first step I wanted to make SortList based on Key = int index that cannot change and Value is another SortedList like this:
class OtherSortedList : SortedList
{
.....
int GetTotalAmountOfAllItems()....
}
I want to be able to sort the first SortedList based on the integer index , but also based on the OtherSortedList.GetTotalAmountOfAllItems() value
if I will put the OtherSortedList as the TValue than how can I Sort it ?
So , i consider to make a new class that will be the TKey of the SortedList
class MyKey
{
int Index;
"OtherSortedList" m_List;
}
and than to be able to sort once based on the index integer , and once based on the OtherSortedList.GetTotalAmountOfAllItems()
using some IComparer implementation
the problem is that the OtherSortedList is changing all time , elements will be add and remove (but not the index field that stay the same after initialization)
and "Keys must be immutable as long as they are used as keys in the SortedDictionary "
http://msdn2.microsoft.com/en-us/library/f7fta44c.aspx
(the same in SortedList)
Any ideas ?
thanks
I want to implement list of key-values that can be sort by 2 ways.
let's say that in the first step I wanted to make SortList based on Key = int index that cannot change and Value is another SortedList like this:
class OtherSortedList : SortedList
{
.....
int GetTotalAmountOfAllItems()....
}
I want to be able to sort the first SortedList based on the integer index , but also based on the OtherSortedList.GetTotalAmountOfAllItems() value
if I will put the OtherSortedList as the TValue than how can I Sort it ?
So , i consider to make a new class that will be the TKey of the SortedList
class MyKey
{
int Index;
"OtherSortedList" m_List;
}
and than to be able to sort once based on the index integer , and once based on the OtherSortedList.GetTotalAmountOfAllItems()
using some IComparer implementation
the problem is that the OtherSortedList is changing all time , elements will be add and remove (but not the index field that stay the same after initialization)
and "Keys must be immutable as long as they are used as keys in the SortedDictionary "
http://msdn2.microsoft.com/en-us/library/f7fta44c.aspx
(the same in SortedList)
Any ideas ?
thanks