Mit List kann man unter UWP ein einfaches Array von
Strings oder Werten bilden
List<String>
list_Test = new List<String>();
//<
fill >
list_Test.Add("B");
list_Test.Add("A");
list_Test.Add("C");
list_Test.Add("C");
//</
fill >
//<
check exist >
if
(list_Test.Contains("A")==false )
{ list_Test.Add("A"); }
if
(list_Test.Contains("B") == false)
{ list_Test.Add("B"); }
//<
check exist >
//<
sort order >
list_Test.Sort();
//</ sort order >
|
Man kann die Liste mit Liste.Sort() einfach und schnell
sortieren lassen
Mit Liste.Contains(suchtext) kann man prüfen ob ein Wert
schon vorhanden ist.
if
(list_Test.Contains("A")==false )
{
list_Test.Add("A"); }
|
NICHT in UWP Settings:
Was man leider nicht kann, ist das List-Array in die
Settings zu speichern. Denn der Typ ist nicht serialisierbar.
NICHT:
//--< In Settings >--
Windows.Storage.ApplicationData.Current.LocalSettings.Values["List_Used_Folders"] = list_Test;
//< load >
List<String> list_from_Settings =
Windows.Storage.ApplicationData.Current.LocalSettings.Values["List_Used_Folders"] as List<String>;
//</ load >
|
Ansonsten kommt der Fehler
Error trying to serialize the value to be
written to the application data store'
System.Runtime.InteropServices.COMException
HResult=0x8007065E
Message=Daten mit diesem Typ werden
nicht unterstützt.
|