Zu den Grundlagen gehört das Sortieren von Aufzählungen. .NET bietet hier für Aufzählungsklassen (List, Array,…) die Methode Sort. Mit scalare Datentypen (int, double, decimal, guid, string) funktioniert das auch, ohne das man groß was tun muss. 1 2 3 4 5 6 7 8 9 //Beispiel List<T> List<string> values = new List<string> { "mario", "anna", "paul", [...]
Read the rest of this entry »Archive for the 'CSharp' Category
Sorting Tuple List – C# Quicky
Wie man eine Liste von Tuples sortiert, zeigt folgendes CodeSnippet: 1 2 3 4 5 6 7 8 List<Tuple<int, string>> tupleList = new List<Tuple<int, string>>(); tupleList.Add(new Tuple<int, string>(37, "Mario")); tupleList.Add(new Tuple<int, string>(36, "Anna")); tupleList.Add(new Tuple<int, string>(5, "Paul")); tupleList.Sort((age, name) => age.Item1.CompareTo(name.Item1)); tupleList.ForEach(c => Console.WriteLine(c)); Viel Spass beim entwickeln : )
Read the rest of this entry »Bing API Beispiel – C# Quicky
Am folgenden Beispiel möchte ich zeigen, wie man die Bing Api verwendet. Vorerst muss man sich im Bing Developer Center einen API Key registrieren. Das geht recht einfach und ist schnell erledigt. Nun fügt man seinem Projekt eine ServiceReferenz über folgender URL hinzu: http://api.bing.net/search.wsdl?AppID=YourAppId&Version=2.2 YourAppId muss mit dem Key ersetzt werden. Der nachfolgende Code zeigt [...]
Read the rest of this entry »DelegateCommand – Visual Studio Snippet
Folgendes Snippet erstellt bei der Eingabe von vmc <tab> ein MVVM Command (DelegateCommand). 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 #region Command: MyBtnClickCommand private DelegateCommand _MyBtnClickCommand; public ICommand MyBtnClickCommand { get { if (_MyBtnClickCommand == [...]
Read the rest of this entry »






