111
This commit is contained in:
11
cs5/5_6/5_6.csproj
Normal file
11
cs5/5_6/5_6.csproj
Normal file
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<RootNamespace>_5_6</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
25
cs5/5_6/5_6.sln
Normal file
25
cs5/5_6/5_6.sln
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.14.36616.10 d17.14
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "5_6", "5_6.csproj", "{93E19541-FEF3-4004-878B-615610904002}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{93E19541-FEF3-4004-878B-615610904002}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{93E19541-FEF3-4004-878B-615610904002}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{93E19541-FEF3-4004-878B-615610904002}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{93E19541-FEF3-4004-878B-615610904002}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {49161CD3-DF8F-4571-A2D5-DDDC82BFFCC2}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
61
cs5/5_6/Program.cs
Normal file
61
cs5/5_6/Program.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
namespace _5_6
|
||||
{
|
||||
public interface ICDPlayer
|
||||
{
|
||||
void Play();
|
||||
void Stop();
|
||||
void PreviousTrack();
|
||||
void NextTrack();
|
||||
int CurrentTrack
|
||||
{
|
||||
get;
|
||||
}
|
||||
}
|
||||
public class CDPlayer : ICDPlayer
|
||||
{
|
||||
private int currentTrack = 0;
|
||||
public void Play()
|
||||
{
|
||||
Console.WriteLine("启动CD。。。");
|
||||
}
|
||||
public void Stop()
|
||||
{
|
||||
Console.WriteLine("停止播放CD。。。");
|
||||
}
|
||||
public void PreviousTrack()
|
||||
{
|
||||
if (currentTrack > 0)
|
||||
{
|
||||
currentTrack--;
|
||||
}
|
||||
Console.WriteLine("上一音轨:");
|
||||
}
|
||||
public void NextTrack()
|
||||
{
|
||||
Console.WriteLine("下一音轨:");
|
||||
currentTrack++;
|
||||
}
|
||||
public int CurrentTrack
|
||||
{
|
||||
get
|
||||
{
|
||||
return currentTrack;
|
||||
}
|
||||
}
|
||||
}
|
||||
public class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
CDPlayer mycd = new CDPlayer();
|
||||
mycd.Play();
|
||||
Console.WriteLine("当前音轨:" + mycd.CurrentTrack);
|
||||
mycd.NextTrack();
|
||||
Console.WriteLine("当前音轨:" + mycd.CurrentTrack);
|
||||
mycd.PreviousTrack();
|
||||
Console.WriteLine("当前音轨:" + mycd.CurrentTrack);
|
||||
mycd.Stop();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user