This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Movie | |
{ | |
public string Id { get; set; } | |
public string Title { get; set; } | |
public int Stars { get; set; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BuildScript : DefaultBuildScript | |
{ | |
[SolutionFileName] | |
public string SolutionFileName => "source/MyApp.sln"; | |
[BuildConfiguration] | |
public string BuildConfiguration { get; set; } = "Release"; // Debug or Release | |
protected override void ConfigureBuildProperties(IBuildPropertiesContext context) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface ILogger | |
{ | |
// 這是原本我們熟悉的、沒有實作的介面方法。 | |
void Log(string msg) | |
// 此方法提供了預設實作。C# 8 以後才能這樣寫。 | |
void Error(Exception ex); | |
{ | |
// 保存或輸出錯誤訊息。 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using FlubuCore.Context; | |
using FlubuCore.Context.Attributes.BuildProperties; | |
using FlubuCore.IO; | |
using FlubuCore.Scripting; | |
using FlubuCore.Tasks.Attributes; | |
using FlubuCore.Tasks.Versioning; | |
namespace build | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using FlubuCore.Context; | |
using FlubuCore.Context.Attributes.BuildProperties; | |
using FlubuCore.IO; | |
using FlubuCore.Scripting; | |
using FlubuCore.Tasks.Attributes; | |
using FlubuCore.Tasks.Versioning; | |
// 注意:需要 FlubuCore v5.1.8 或更新的版本。 | |
namespace _Build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ItemGroup> | |
<PackageReference Include="Nuke.Common" Version="0.24.7" /> | |
<PackageDownload Include="GitVersion.Tool" Version="[5.1.1]" /> | |
</ItemGroup> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 舊版 Program.cs 的 Main 函式: | |
[STAThread] | |
static void Main() | |
{ | |
Application.EnableVisualStyles(); | |
Application.SetCompatibleTextRenderingDefault(false); | |
Application.Run(new MainForm()); | |
} | |
// 新版 Program.cs 的 Main 函式: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop"> | |
<PropertyGroup> | |
<OutputType>WinExe</OutputType> | |
<TargetFramework>netcoreapp3.1</TargetFramework> | |
<UseWindowsForms>true</UseWindowsForms> | |
<RootNamespace>EasyBrailleEdit</RootNamespace> | |
<AssemblyName>EasyBrailleEdit</AssemblyName> | |
</PropertyGroup> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#nullable enable // 啟用 nullable 語法和警告 | |
string? str1 = null; | |
#nullable disable // 關閉 nullable 語法和警告 | |
string str2 = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project> | |
<PropertyGroup> | |
<Nullable>enable</Nullable> | |
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild> | |
<RunAnalyzersDuringLiveAnalysis>true</RunAnalyzersDuringLiveAnalysis> | |
</PropertyGroup> | |
</Project> |