Hello again, it's me again, I have another problem,
see you I have two lists which happen to be in the same list, and infact the thing is that I would like to sort one of the two lists (sublist in quotes) but here I do not know how to do it,
the code looks like this
see you I have two lists which happen to be in the same list, and infact the thing is that I would like to sort one of the two lists (sublist in quotes) but here I do not know how to do it,
the code looks like this
C#:
private static List<Bidule> BubbleSortDiagnostics(Bidule[] element) // Bidule[] element
{
int cnt = element.Length;
bool sorted = false;
while (!sorted)
{
sorted = true;
for (int i = 0; i < cnt - 1; i++)
{
if (string.Compare(element[i].DisplayName.ToString(), element[i + 1].DisplayName.ToString()) > 0) // Si l'élément [i] est plus petit que l'élément[i+1] et supérieur à 0 effectuer :
{
Bidule t = element[i];
element[i] = element[i + 1];
element[i + 1] = t;
sorted = false;
}
}
cnt -= 1;
}
return element.ToList();
public List<Bidule> InstrumentElements
{
get
{
if (_instrumentElements == null)
if (FrameworkController.Instance.Instrument.Configuration != null)
{
_instrumentElements = FrameworkController.Instance.Instrument.Configuration.AllNestedItems.OfType<Bidule>().ToList();
_instrumentElements.ForEach(element => Console.WriteLine(InstrumentElements));
var toto = from element in _instrumentElements
orderby element ascending
select _instrumentElements;
List<Bidule> Trcg3list = new List<Bidule>();
List<Bidule> Restlist = new List<Bidule>();
foreach (Bidule element in _instrumentElements)
{
if (element.DisplayName.ToString().Contains("MF Trcg3"))
{
Trcg3list.Add(element);
}
else
{
Restlist.Add(element);
}
}
List<Bidule> listOfLists = new List<Bidule>();
_instrumentElements.Clear();
_instrumentElements.AddRange(Restlist);
_instrumentElements.AddRange(Trcg3list);
//BubbleSort(_instrumentElements.ToArray());
Trcg3list.Sort(); // Trie la liste Trcg3
Restlist.Sort(); // Trie la liste du reste
Restlist = BubbleSortDiagnostics(Trcg3list.ToArray());
Trcg3list = BubbleSortDiagnostics(Trcg3list.ToArray());
//_instrumentElements = BubbleSortDiagnostics(_instrumentElements.ToArray());
//_instrumentElements = BubbleSortDiagnostics(Trcg3list.ToArray());
DoPropertyChanged(SelectedItemPropertyName);
DoPropertyChanged(InstrumentElementsPropertyName);
}
return _instrumentElements;
}
}