Commit 7d67247b authored by Uwe Wienkop's avatar Uwe Wienkop

2020-04-28

parent b3b46733
using System;
using Microsoft.VisualBasic;
using System;
namespace _02_UebgDi_Klassse_TimeOpOverloading
{
class Time
{
int time;
public Time(int a, int b)
{
time = a * 60 + b;
}
public Time(int fromMins) { time = fromMins; }
public Time(string s)
{
string[] d = s.Split(':');
time = Convert.ToInt32(d[0]) * 60 + Convert.ToInt32(d[1]);
}
public static Time operator +(Time a, TimeSpan b)
=> new Time(a.time + b.TotalMins);
public static Time operator +(TimeSpan b, Time a)
=> new Time(a.time + b.TotalMins);
public static implicit operator Time(string s) => new Time(s);
public static TimeSpan operator -(Time t1, Time t2) => new TimeSpan(t1.time - t2.time);
public override string ToString() => $"{time / 60}:{time % 60}";
public static bool operator true(Time t) => t.time < 60 * 12;
public static bool operator false(Time t) => t.time >= 60 * 12;
public static bool operator ==(Time t1, Time t2) => t1.time == t2.time;
public static bool operator !=(Time t1, Time t2) => t1.time != t2.time;
}
class TimeSpan
{
int timeSpan;
public TimeSpan(int fromMins) { timeSpan = fromMins; }
public static implicit operator TimeSpan(string s)
{
string[] d = s.Split(':');
TimeSpan t = new TimeSpan (Convert.ToInt32( d[0]) * 60 + Convert.ToInt32( d[1]));
return t;
}
public static implicit operator TimeSpan(int x) =>new TimeSpan(x);
public int TotalMins { get => timeSpan; }
public override string ToString() => $"{timeSpan / 60}:{timeSpan % 60}";
}
class Program
{
static void Main(string[] args)
{
Time t1 = new Time(9, 45);
Time t2 = t1 + "1:30" + 15;
Time t1 = new Time("9:45");
// Klasse Time, Konstruktor(int, int)
Time t2 = 15 + t1 ; // t1.Add("1:30")
// Time.op+(Time, string) string(impl.)->TimeSpan, int(impl.)->TimeSpan | Time.op+(Time, TimeSpan)
Time t3 = "11:30";
// string(impl.)->Time
TimeSpan ts1 = t2 - t1;
// op-(Time,Time)
Console.WriteLine(t2);
// ToString
Console.WriteLine(ts1.TotalMins);
// get-Property
Console.WriteLine(ts1);
if (t2)
Console.WriteLine("Guten Morgen");
......
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v3.1",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v3.1": {
"02 UebgDi Klassse TimeOpOverloading/1.0.0": {
"runtime": {
"02 UebgDi Klassse TimeOpOverloading.dll": {}
}
}
}
},
"libraries": {
"02 UebgDi Klassse TimeOpOverloading/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}
\ No newline at end of file
{
"runtimeOptions": {
"additionalProbingPaths": [
"C:\\Users\\wienkop\\.dotnet\\store\\|arch|\\|tfm|",
"C:\\Users\\wienkop\\.nuget\\packages"
]
}
}
\ No newline at end of file
{
"runtimeOptions": {
"tfm": "netcoreapp3.1",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "3.1.0"
}
}
}
\ No newline at end of file
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\02 UebgDi Klassse TimeOpOverloading\bin\Debug\netcoreapp3.1\02 UebgDi Klassse TimeOpOverloading.exe
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\02 UebgDi Klassse TimeOpOverloading\bin\Debug\netcoreapp3.1\02 UebgDi Klassse TimeOpOverloading.deps.json
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\02 UebgDi Klassse TimeOpOverloading\bin\Debug\netcoreapp3.1\02 UebgDi Klassse TimeOpOverloading.runtimeconfig.json
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\02 UebgDi Klassse TimeOpOverloading\bin\Debug\netcoreapp3.1\02 UebgDi Klassse TimeOpOverloading.runtimeconfig.dev.json
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\02 UebgDi Klassse TimeOpOverloading\bin\Debug\netcoreapp3.1\02 UebgDi Klassse TimeOpOverloading.dll
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\02 UebgDi Klassse TimeOpOverloading\bin\Debug\netcoreapp3.1\02 UebgDi Klassse TimeOpOverloading.pdb
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\02 UebgDi Klassse TimeOpOverloading\obj\Debug\netcoreapp3.1\02 UebgDi Klassse TimeOpOverloading.csprojAssemblyReference.cache
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\02 UebgDi Klassse TimeOpOverloading\obj\Debug\netcoreapp3.1\02 UebgDi Klassse TimeOpOverloading.csproj.CoreCompileInputs.cache
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\02 UebgDi Klassse TimeOpOverloading\obj\Debug\netcoreapp3.1\02 UebgDi Klassse TimeOpOverloading.AssemblyInfoInputs.cache
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\02 UebgDi Klassse TimeOpOverloading\obj\Debug\netcoreapp3.1\02 UebgDi Klassse TimeOpOverloading.AssemblyInfo.cs
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\02 UebgDi Klassse TimeOpOverloading\obj\Debug\netcoreapp3.1\02 UebgDi Klassse TimeOpOverloading.dll
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\02 UebgDi Klassse TimeOpOverloading\obj\Debug\netcoreapp3.1\02 UebgDi Klassse TimeOpOverloading.pdb
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\02 UebgDi Klassse TimeOpOverloading\obj\Debug\netcoreapp3.1\02 UebgDi Klassse TimeOpOverloading.genruntimeconfig.cache
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>_02VerketteteListe</RootNamespace>
</PropertyGroup>
</Project>
using System;
namespace _02VerketteteListe
{
class Element
{
public string name;
public Element(string name) { this.name = name; }
public Element next;
}
class Program
{
static void Main(string[] args)
{
#region Intro
//Element p1 = new Element("Anton");
//Element p2 = new Element("Berta");
//p1.next = p2;
//p2 = new Element("Claudia");
//p1.next.next = p2;
#endregion
Element anf = new Element("Anton");
Element ende = anf;
ende.next = new Element("Berta");
ende = ende.next;
for (int i = 1; i <= 10; i++)
{
ende.next = new Element("Claudia-"+i.ToString());
ende = ende.next;
}
anf = anf.next;
for (Element tmp = anf; tmp != null; tmp = tmp.next)
{
Console.WriteLine(tmp.name);
}
bool gefunden = false;
for (Element tmp=anf; tmp!=null; tmp=tmp.next)
{
if (tmp.name == "Claudia-9")
{
gefunden = true;
break;
}
}
if (gefunden)
Console.WriteLine("Element wurde gefunden");
else
Console.WriteLine("Kommt in der Liste nicht vor!");
}
}
}
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v3.1",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v3.1": {
"02VerketteteListe/1.0.0": {
"runtime": {
"02VerketteteListe.dll": {}
}
}
}
},
"libraries": {
"02VerketteteListe/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}
\ No newline at end of file
{
"runtimeOptions": {
"additionalProbingPaths": [
"C:\\Users\\wienkop\\.dotnet\\store\\|arch|\\|tfm|",
"C:\\Users\\wienkop\\.nuget\\packages"
]
}
}
\ No newline at end of file
{
"runtimeOptions": {
"tfm": "netcoreapp3.1",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "3.1.0"
}
}
}
\ No newline at end of file
{
"format": 1,
"restore": {
"C:\\Users\\wienkop\\source\\repos\\prog2-ss2020-wienkop\\02VerketteteListe\\02VerketteteListe-1Intro.csproj": {}
},
"projects": {
"C:\\Users\\wienkop\\source\\repos\\prog2-ss2020-wienkop\\02VerketteteListe\\02VerketteteListe-1Intro.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "C:\\Users\\wienkop\\source\\repos\\prog2-ss2020-wienkop\\02VerketteteListe\\02VerketteteListe-1Intro.csproj",
"projectName": "02VerketteteListe-1Intro",
"projectPath": "C:\\Users\\wienkop\\source\\repos\\prog2-ss2020-wienkop\\02VerketteteListe\\02VerketteteListe-1Intro.csproj",
"packagesPath": "C:\\Users\\wienkop\\.nuget\\packages\\",
"outputPath": "C:\\Users\\wienkop\\source\\repos\\prog2-ss2020-wienkop\\02VerketteteListe\\obj\\",
"projectStyle": "PackageReference",
"configFilePaths": [
"C:\\Users\\wienkop\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"netcoreapp3.1"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"netcoreapp3.1": {
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"netcoreapp3.1": {
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
}
}
}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\wienkop\.nuget\packages\</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">5.5.0</NuGetToolVersion>
</PropertyGroup>
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
</Project>
\ No newline at end of file
{
"format": 1,
"restore": {
"C:\\Users\\wienkop\\source\\repos\\prog2-ss2020-wienkop\\02VerketteteListe\\02VerketteteListe.csproj": {}
},
"projects": {
"C:\\Users\\wienkop\\source\\repos\\prog2-ss2020-wienkop\\02VerketteteListe\\02VerketteteListe.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "C:\\Users\\wienkop\\source\\repos\\prog2-ss2020-wienkop\\02VerketteteListe\\02VerketteteListe.csproj",
"projectName": "02VerketteteListe",
"projectPath": "C:\\Users\\wienkop\\source\\repos\\prog2-ss2020-wienkop\\02VerketteteListe\\02VerketteteListe.csproj",
"packagesPath": "C:\\Users\\wienkop\\.nuget\\packages\\",
"outputPath": "C:\\Users\\wienkop\\source\\repos\\prog2-ss2020-wienkop\\02VerketteteListe\\obj\\",
"projectStyle": "PackageReference",
"configFilePaths": [
"C:\\Users\\wienkop\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"netcoreapp3.1"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"netcoreapp3.1": {
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"netcoreapp3.1": {
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
}
}
}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\wienkop\.nuget\packages\</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">5.5.0</NuGetToolVersion>
</PropertyGroup>
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
</Project>
\ No newline at end of file
//------------------------------------------------------------------------------
// <auto-generated>
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:4.0.30319.42000
//
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("02VerketteteListe-1Intro")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("02VerketteteListe-1Intro")]
[assembly: System.Reflection.AssemblyTitleAttribute("02VerketteteListe-1Intro")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Von der MSBuild WriteCodeFragment-Klasse generiert.
//------------------------------------------------------------------------------
// <auto-generated>
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:4.0.30319.42000
//
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("02VerketteteListe")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("02VerketteteListe")]
[assembly: System.Reflection.AssemblyTitleAttribute("02VerketteteListe")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Von der MSBuild WriteCodeFragment-Klasse generiert.
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\02VerketteteListe\bin\Debug\netcoreapp3.1\02VerketteteListe.exe
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\02VerketteteListe\bin\Debug\netcoreapp3.1\02VerketteteListe.deps.json
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\02VerketteteListe\bin\Debug\netcoreapp3.1\02VerketteteListe.runtimeconfig.json
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\02VerketteteListe\bin\Debug\netcoreapp3.1\02VerketteteListe.runtimeconfig.dev.json
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\02VerketteteListe\bin\Debug\netcoreapp3.1\02VerketteteListe.dll
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\02VerketteteListe\bin\Debug\netcoreapp3.1\02VerketteteListe.pdb
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\02VerketteteListe\obj\Debug\netcoreapp3.1\02VerketteteListe.csproj.CoreCompileInputs.cache
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\02VerketteteListe\obj\Debug\netcoreapp3.1\02VerketteteListe.AssemblyInfoInputs.cache
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\02VerketteteListe\obj\Debug\netcoreapp3.1\02VerketteteListe.AssemblyInfo.cs
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\02VerketteteListe\obj\Debug\netcoreapp3.1\02VerketteteListe.dll
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\02VerketteteListe\obj\Debug\netcoreapp3.1\02VerketteteListe.pdb
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\02VerketteteListe\obj\Debug\netcoreapp3.1\02VerketteteListe.genruntimeconfig.cache
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\02VerketteteListe\obj\Debug\netcoreapp3.1\02VerketteteListe.csprojAssemblyReference.cache
{
"version": 3,
"targets": {
".NETCoreApp,Version=v3.1": {}
},
"libraries": {},
"projectFileDependencyGroups": {
".NETCoreApp,Version=v3.1": []
},
"packageFolders": {
"C:\\Users\\wienkop\\.nuget\\packages\\": {}
},
"project": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "C:\\Users\\wienkop\\source\\repos\\prog2-ss2020-wienkop\\02VerketteteListe\\02VerketteteListe-1Intro.csproj",
"projectName": "02VerketteteListe-1Intro",
"projectPath": "C:\\Users\\wienkop\\source\\repos\\prog2-ss2020-wienkop\\02VerketteteListe\\02VerketteteListe-1Intro.csproj",
"packagesPath": "C:\\Users\\wienkop\\.nuget\\packages\\",
"outputPath": "C:\\Users\\wienkop\\source\\repos\\prog2-ss2020-wienkop\\02VerketteteListe\\obj\\",
"projectStyle": "PackageReference",
"configFilePaths": [
"C:\\Users\\wienkop\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"netcoreapp3.1"