Commit c7c71518 authored by Uwe Wienkop's avatar Uwe Wienkop

2020-06-29a

parent eafac147
using System;
using System.Collections;
using System.Security.Cryptography;
using System.Collections.Generic;
namespace _02VerketteteListe_2
{
class StringListe
class StringListe : IEnumerable
{
// Die Klasse Element ist nun eine *private* Klasse der Klasse StringListe
// Die Methoden von StringListe dürfen auf private Member zugreifen
......@@ -105,7 +106,7 @@ namespace _02VerketteteListe_2
}
}
public IEnumerator GetEnumerator()
{
{
for (Element item = anf; item != null; item = item.next)
{
yield return item.name; // Merken dieser Ausführungsposition
......@@ -114,7 +115,7 @@ namespace _02VerketteteListe_2
// an der gespeicherten Pos. weitergemacht.
}
}
public IEnumerable Filter(string pattern)
public IEnumerable<string> MeinFilter(string pattern)
{
for (Element item = anf; item != null; item = item.next)
{
......@@ -259,31 +260,42 @@ namespace _02VerketteteListe_2
static void Main(string[] args)
{
StringListe l1 = new StringListe();
StringListe l2 = new StringListe();
l1.AddSorted("Emil ");
l1.AddSorted("Anton");
l1.AddSorted("Berta");
l1.AddSorted("Claudia");
l1.AddSorted("Dieter");
l1.Print();
l1 = l1.Reverse();
Console.WriteLine("==================");
l1.Print();
Console.WriteLine("==================");
#region weg
//l1.Print();
//l1 = l1.Reverse();
//Console.WriteLine("==================");
//l1.Print();
//Console.WriteLine("==================");
Console.WriteLine(l1[3]);
Console.WriteLine("==================");
//l1.DeleteFirst();
//l1.DeleteLast();
//l1.DeleteNth(1);
//Console.WriteLine(l1[3]);
//Console.WriteLine("==================");
////l1.DeleteFirst();
////l1.DeleteLast();
////l1.DeleteNth(1);
////l1.Print();
//l1.AddBeforeNth(2, "Bodo");
//l1.Print();
l1.AddBeforeNth(2, "Bodo");
l1.Print();
foreach (string item in l1.Filter("er"))
#endregion
foreach (var item in l1.MeinFilter("er"))
{
Console.WriteLine($"foreach: {item}");
}
//var res = from w in l1
// where w.Length < 6
// orderby w descending
// select new { OrgName = w, GrossName = w.ToUpper(), Länge = w.Length };
//foreach (var r in res)
//{
// Console.WriteLine(r);
//}
}
}
}
......@@ -118,7 +118,7 @@ namespace _06GenericList
public delegate bool MyFilter1(T daten); // Typpar. T wird vom äußeren Class<T> genommen
public delegate bool MyFilter2<V>(V daten); // Typpar. V zunächst noch offen und wird dann
// bei der Verwendung in Filter auf MyFilter2<T> gesetzt ~ Predicate<T>
public IEnumerable<T> Filter(Predicate<T> myTest) // string => bool, x => x.Contains("er")
public IEnumerable<T> Filter(MyFilter1 myTest) // string => bool, x => x.Contains("er")
{
for (Element item = anf; item != null; item = item.next)
{
......
......@@ -51,8 +51,9 @@ namespace _06GenericList
sl.AddSorted("Emil");
sl.AddSorted("Anton");
sl.AddSorted("Berta");
sl.AddSorted("Bertram");
sl.AddSorted("Dieter");
foreach (var item in sl.Filter(x=>x.Contains("er")))
foreach (var item in sl.Filter(x=>x.StartsWith("Ber")))
{
Console.WriteLine(item);
}
......
......@@ -37,9 +37,9 @@ namespace _08DelegateIntro
funkt = MeinQuadrieren;
funkt = Math.Sin;
funkt = delegate (double a) { return 3 * a; };
funkt = b => 4 * b;
funkt += Math.Sin;
funkt += delegate (double a) { return 3 * a; };
funkt += b => 4 * b;
Wertetabelle2(1, 3);
}
}
......
......@@ -10,3 +10,4 @@ C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\10 LINQ_Intro\obj\Debug\netco
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\10 LINQ_Intro\obj\Debug\netcoreapp3.1\10 LINQ_Intro.dll
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\10 LINQ_Intro\obj\Debug\netcoreapp3.1\10 LINQ_Intro.pdb
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\10 LINQ_Intro\obj\Debug\netcoreapp3.1\10 LINQ_Intro.genruntimeconfig.cache
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\10 LINQ_Intro\obj\Debug\netcoreapp3.1\10 LINQ_Intro.csprojAssemblyReference.cache
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>_10_RefDelegate</RootNamespace>
</PropertyGroup>
</Project>
using System;
namespace _10_RefDelegate
{
class Program
{
delegate void MyFunction(ref double x);
static MyFunction funkt;
static void MeinQuadrieren(ref double xx)
{
Console.WriteLine("Mein Quadrieren");
xx = xx * xx;
}
static void ZweiX(ref double x)
{
Console.WriteLine("ZweiX");
x = 2 * x;
}
static void Plus1(ref double x)
{
Console.WriteLine("Plus1");
x = 1 + x;
}
static void Main()
{
funkt += MeinQuadrieren;
funkt += ZweiX;
funkt += MeinQuadrieren;
funkt += Plus1;
double a = 2; // Annahme: a liegt bei #100.000
funkt(ref a); // übergibt eine Ref. auf die Variable a
// (Speicheradresse, wo der Wert von a abgelegt ist, hier #100.000)
Console.WriteLine(a);
}
}
}
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v3.1",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v3.1": {
"10 RefDelegate/1.0.0": {
"runtime": {
"10 RefDelegate.dll": {}
}
}
}
},
"libraries": {
"10 RefDelegate/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\\10 RefDelegate\\10 RefDelegate.csproj": {}
},
"projects": {
"C:\\Users\\wienkop\\source\\repos\\prog2-ss2020-wienkop\\10 RefDelegate\\10 RefDelegate.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "C:\\Users\\wienkop\\source\\repos\\prog2-ss2020-wienkop\\10 RefDelegate\\10 RefDelegate.csproj",
"projectName": "10 RefDelegate",
"projectPath": "C:\\Users\\wienkop\\source\\repos\\prog2-ss2020-wienkop\\10 RefDelegate\\10 RefDelegate.csproj",
"packagesPath": "C:\\Users\\wienkop\\.nuget\\packages\\",
"outputPath": "C:\\Users\\wienkop\\source\\repos\\prog2-ss2020-wienkop\\10 RefDelegate\\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.301\\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.6.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
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v3.1", FrameworkDisplayName = "")]
//------------------------------------------------------------------------------
// <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("10 RefDelegate")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("10 RefDelegate")]
[assembly: System.Reflection.AssemblyTitleAttribute("10 RefDelegate")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Von der MSBuild WriteCodeFragment-Klasse generiert.
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\10 RefDelegate\bin\Debug\netcoreapp3.1\10 RefDelegate.exe
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\10 RefDelegate\bin\Debug\netcoreapp3.1\10 RefDelegate.deps.json
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\10 RefDelegate\bin\Debug\netcoreapp3.1\10 RefDelegate.runtimeconfig.json
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\10 RefDelegate\bin\Debug\netcoreapp3.1\10 RefDelegate.runtimeconfig.dev.json
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\10 RefDelegate\bin\Debug\netcoreapp3.1\10 RefDelegate.dll
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\10 RefDelegate\bin\Debug\netcoreapp3.1\10 RefDelegate.pdb
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\10 RefDelegate\obj\Debug\netcoreapp3.1\10 RefDelegate.AssemblyInfoInputs.cache
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\10 RefDelegate\obj\Debug\netcoreapp3.1\10 RefDelegate.AssemblyInfo.cs
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\10 RefDelegate\obj\Debug\netcoreapp3.1\10 RefDelegate.csproj.CoreCompileInputs.cache
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\10 RefDelegate\obj\Debug\netcoreapp3.1\10 RefDelegate.dll
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\10 RefDelegate\obj\Debug\netcoreapp3.1\10 RefDelegate.pdb
C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\10 RefDelegate\obj\Debug\netcoreapp3.1\10 RefDelegate.genruntimeconfig.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\\10 RefDelegate\\10 RefDelegate.csproj",
"projectName": "10 RefDelegate",
"projectPath": "C:\\Users\\wienkop\\source\\repos\\prog2-ss2020-wienkop\\10 RefDelegate\\10 RefDelegate.csproj",
"packagesPath": "C:\\Users\\wienkop\\.nuget\\packages\\",
"outputPath": "C:\\Users\\wienkop\\source\\repos\\prog2-ss2020-wienkop\\10 RefDelegate\\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.301\\RuntimeIdentifierGraph.json"
}
}
}
}
\ No newline at end of file
{
"version": 2,
"dgSpecHash": "eRuQHmMgZcorGGqL/GdjfuhESCHnho/c8cpuzOcprxLDE4cmTkD4fjUMwN4CMXWxiYKkPjxowwhzsCgih7oYBw==",
"success": true,
"projectFilePath": "C:\\Users\\wienkop\\source\\repos\\prog2-ss2020-wienkop\\10 RefDelegate\\10 RefDelegate.csproj",
"expectedPackageFiles": [],
"logs": []
}
\ No newline at end of file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>_11_UebgMoTransformator</RootNamespace>
</PropertyGroup>
</Project>
using System;
namespace _11_UebgMoTransformator
{
/* Schreiben Sie in Anlehnung an ApplyAll einen generischen Feld-Transformator, der Felder eines
* beliebigen Typs nehmen und jeweils das Feld und die Feldelemente verändern kann. Dabei können mehrere
* Operationen aneinander gekettet werden. Das Feld kann dabei auch in seiner Anzahl vergrößert oder
* verkleinert werden.
*/
class Program
{
delegate T MeineFkt<T>(T x);
static T[] ApplyAll<T>(MeineFkt<T> fkt, params T[] werte)
{
T[] erg = new T[werte.Length];
Console.Write("APPLY ALL: ");
for (int i = 0; i < werte.Length; i++)
{
erg[i] = fkt(werte[i]);
Console.Write($"{erg[i]} ");
}
Console.WriteLine();
return erg;
}
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
// Anton, Berta, Claudia, Dieter --->
// ANTON, BERTA, CLAUDIA, DIETER --->
// ANTON&BERTA, CLAUDIA&DIETER
}
}
}
{
"format": 1,
"restore": {
"C:\\Users\\wienkop\\source\\repos\\prog2-ss2020-wienkop\\11 UebgMoTransformator\\11 UebgMoTransformator.csproj": {}
},
"projects": {
"C:\\Users\\wienkop\\source\\repos\\prog2-ss2020-wienkop\\11 UebgMoTransformator\\11 UebgMoTransformator.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "C:\\Users\\wienkop\\source\\repos\\prog2-ss2020-wienkop\\11 UebgMoTransformator\\11 UebgMoTransformator.csproj",
"projectName": "11 UebgMoTransformator",
"projectPath": "C:\\Users\\wienkop\\source\\repos\\prog2-ss2020-wienkop\\11 UebgMoTransformator\\11 UebgMoTransformator.csproj",
"packagesPath": "C:\\Users\\wienkop\\.nuget\\packages\\",
"outputPath": "C:\\Users\\wienkop\\source\\repos\\prog2-ss2020-wienkop\\11 UebgMoTransformator\\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.301\\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.6.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
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v3.1", FrameworkDisplayName = "")]
//------------------------------------------------------------------------------
// <auto-generated>
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:4.0.30319.42000
//