Skip to content
Snippets Groups Projects
Commit 082f3935 authored by N4873's avatar N4873
Browse files

added 22 with photo

parent 45d78237
Branches master
No related tags found
Loading

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29709.97
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "T22Rajapinta", "T22Rajapinta\T22Rajapinta.csproj", "{70979165-716D-4E8B-8989-D649341B1AC2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{70979165-716D-4E8B-8989-D649341B1AC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{70979165-716D-4E8B-8989-D649341B1AC2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{70979165-716D-4E8B-8989-D649341B1AC2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{70979165-716D-4E8B-8989-D649341B1AC2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4190F58C-9319-4060-B978-4BC5F77BA2D2}
EndGlobalSection
EndGlobal
using System;
using System.Collections.Generic;
namespace T22Rajapinta
{
public interface ICanMakeNote
{
string MakeNote(string txt);
}
public interface ICanShowVideo
{
void ShowVideo(string url);
}
public class Device
{
public string Manufacturer { get; set; }
}
public class Tablet : Device, ICanMakeNote, ICanShowVideo
{
public string CPU { get; set; }
public void ShowVideo(string url)
{
}
public string MakeNote(string textToSave)
{
return "Your text is saved to harddisk successfully";
}
}
public class Paper : ICanMakeNote
{
public string Size { get; set; }
public string MakeNote(string txt)
{
return $"Sinun muistiinpanosi {txt} on kirjoitettu kauniilla käsialalla paperille";
}
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Testataan rajapintaa");
Tablet ipad = new Tablet();
Console.WriteLine("Anna muistiinpano");
string txt = Console.ReadLine();
Console.WriteLine(ipad.MakeNote(txt));
Paper papperi = new Paper();
Console.WriteLine(papperi.MakeNote(txt));
List<ICanMakeNote> canMakeNotes = new List<ICanMakeNote>();
canMakeNotes.Add(ipad);
canMakeNotes.Add(papperi);
Console.WriteLine("Anna toinen muistiinpano");
txt = Console.ReadLine();
foreach (var item in canMakeNotes)
{
TeeMuistiinpano(item, txt);
}
}
static void TeeMuistiinpano(ICanMakeNote väline, string teksti)
{
Console.WriteLine(väline.MakeNote(teksti));
}
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
</Project>
T22Rajapinta/T22Rajapinta/T22Rajapinta.png

72.8 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment