Skip to content
Snippets Groups Projects
Commit 2b1d8440 authored by Uwe Wienkop's avatar Uwe Wienkop
Browse files

2020-06-05

parent 277e418a
No related branches found
No related tags found
No related merge requests found
Showing
with 117 additions and 0 deletions
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
File moved
File added
No preview for this file type
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>_07KeyValueList</RootNamespace>
</PropertyGroup>
</Project>
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Text;
namespace _07KeyValueList
{
class KeyValuePaar<K, V> : IComparable<KeyValuePaar<K, V>>
where K : IComparable<K>
{
public K key;
public V val;
public KeyValuePaar(K key, V val) { this.key = key; this.val = val; }
public int CompareTo(KeyValuePaar<K, V> other)
=> key.CompareTo(other.key);
public override string ToString() => $"{key}: {val}";
}
}
using System;
using System.Collections.Generic;
// Modifizieren/Erweitern Sie die KeyValue Klassen bzw. das Main()-Programm
// derart, dass Sie eine weitergehende Kalenderverwaltung realisieren. In
// Main erstellen Sie bitte eine Menü mit Auswahl:
// 1 - Termin eintragen (tt.mm.jjjj|Thema|Projekt|Teilnehmer)
// 2 - Monatstermine auflisten; Eingabe Monat mm
// 3 - Jahrestermine auflisten
// 4 - Alle Termine eines Projekts im Monat mm; Eingabe mm|Projektname
namespace _07KeyValueList
{
class Termin
{
public string was;
public string wer;
public Termin(string was, string wer) { this.was = was;this.wer = wer; }
public override string ToString() => $"Termin: {was} mit {wer}";
}
class Program
{
static void Main(string[] args)
{
KeyValueListe<string, int> kvListe = new KeyValueListe<string, int>();
kvListe["Wienkop"] = 1614;
kvListe["Otsa"] = 1855;
kvListe.Print();
Console.WriteLine("-----------");
kvListe["Otsa"] = 9999;
kvListe.Print();
Console.WriteLine("-----------");
KeyValueListe<string, Termin> termine = new KeyValueListe<string, Termin>();
termine["Wienkop"] = new Termin("IT-Proj", "Digitale Visitenkarte");
termine.Print();
//foreach (var item in termine)
//{
// Console.WriteLine(item.val);
//}
List<Termin> termineMi = new List<Termin>();
termineMi.Add(new Termin("08:00 Prog2-Vorlesung", "Gruppe-Wienkop"));
termineMi.Add(new Termin ("09:45 Dig Bildbearbeitung","MA-MIN"));
List<Termin> termineDi = new List<Termin>();
termineDi.Add(new Termin("08:00 Prog2-Übung", "Gruppe-Wienkop"));
termineDi.Add(new Termin("09:45 Prog2-Vorlesung", "Gruppe-Wienkop"));
termineDi.Add(new Termin("11:30 Mitarbeiterbesprechung","Jobbörse"));
KeyValueListe<string, List<Termin>> terminverwaltung = new KeyValueListe<string, List<Termin>>();
terminverwaltung["03.06.2020"] = termineMi;
terminverwaltung["02.06.2020"] = termineDi;
foreach (var tag in terminverwaltung)
{
Console.WriteLine($"\nTermine am {tag.key}:");
foreach (var item in tag.val)
{
Console.WriteLine(item);
}
}
}
}
}
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v3.1",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v3.1": {
"07KeyValueList/1.0.0": {
"runtime": {
"07KeyValueList.dll": {}
}
}
}
},
"libraries": {
"07KeyValueList/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}
\ No newline at end of file
File added
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment