();
23 |
24 | list.Add(5124);
25 | list.Add(232);
26 | list.Add(161636);
27 | list.Add(34);
28 |
29 | list.Sort();
30 |
31 | for (int i = 0; i < list.Count; i++)
32 | {
33 | MessageBox.Show("List 的第 " + i + " 個資料是: " + list[i]);
34 | }
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/class-41-50/Class49/Demo/Demo/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace Demo
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// 應用程式的主要進入點。
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new Form1());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/class-41-50/Class49/Demo/Demo/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 組件的一般資訊是由下列的屬性集控制。
6 | // 變更這些屬性的值即可修改組件的相關
7 | // 資訊。
8 | [assembly: AssemblyTitle("Demo")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Demo")]
13 | [assembly: AssemblyCopyright("Copyright © 2020")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // 將 ComVisible 設為 false 可對 COM 元件隱藏
18 | // 組件中的類型。若必須從 COM 存取此組件中的類型,
19 | // 的類型,請在該類型上將 ComVisible 屬性設定為 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 下列 GUID 為專案公開 (Expose) 至 COM 時所要使用的 typelib ID
23 | [assembly: Guid("8755ce51-a2ba-4096-b309-fb2da2782c78")]
24 |
25 | // 組件的版本資訊由下列四個值所組成:
26 | //
27 | // 主要版本
28 | // 次要版本
29 | // 組建編號
30 | // 修訂編號
31 | //
32 | // 您可以指定所有的值,也可以使用 '*' 將組建和修訂編號
33 | // 設為預設,如下所示:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/class-41-50/Class49/Demo/Demo/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 這段程式碼是由工具產生的。
4 | // 執行階段版本:4.0.30319.42000
5 | //
6 | // 變更這個檔案可能會導致不正確的行為,而且如果已重新產生
7 | // 程式碼,則會遺失變更。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Demo.Properties
12 | {
13 |
14 |
15 | ///
16 | /// 用於查詢當地語系化字串等的強類型資源類別
17 | ///
18 | // 這個類別是自動產生的,是利用 StronglyTypedResourceBuilder
19 | // 類別透過 ResGen 或 Visual Studio 這類工具產生。
20 | // 若要加入或移除成員,請編輯您的 .ResX 檔,然後重新執行 ResGen
21 | // (利用 /str 選項),或重建您的 VS 專案。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// 傳回這個類別使用的快取的 ResourceManager 執行個體。
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Demo.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// 覆寫目前執行緒的 CurrentUICulture 屬性,對象是所有
56 | /// 使用這個強類型資源類別的資源查閱。
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/class-41-50/Class49/Demo/Demo/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Demo.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/class-41-50/Class49/Demo/Demo/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/class-41-50/Class50/Demo/Demo.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.30011.22
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Demo", "Demo\Demo.csproj", "{8755CE51-A2BA-4096-B309-FB2DA2782C78}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {8755CE51-A2BA-4096-B309-FB2DA2782C78}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {8755CE51-A2BA-4096-B309-FB2DA2782C78}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {8755CE51-A2BA-4096-B309-FB2DA2782C78}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {8755CE51-A2BA-4096-B309-FB2DA2782C78}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {9E4190A2-AED0-4FCE-B304-428BE48849F1}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/class-41-50/Class50/Demo/Demo/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/class-41-50/Class50/Demo/Demo/Building.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Demo
8 | {
9 | class Building
10 | {
11 | List
people = new List
();
12 |
13 | public void Add(P person)
14 | {
15 | people.Add(person);
16 | }
17 |
18 | public override String ToString()
19 | {
20 | String output = "這棟大樓裡有:\r\n";
21 |
22 | for (int i = 0; i < people.Count; i++)
23 | {
24 | output += people[i].ToString() + "\r\n";
25 | }
26 |
27 | return output;
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/class-41-50/Class50/Demo/Demo/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Demo
2 | {
3 | partial class Form1
4 | {
5 | ///
6 | /// 設計工具所需的變數。
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// 清除任何使用中的資源。
12 | ///
13 | /// 如果應該處置受控資源則為 true,否則為 false。
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form 設計工具產生的程式碼
24 |
25 | ///
26 | /// 此為設計工具支援所需的方法 - 請勿使用程式碼編輯器修改
27 | /// 這個方法的內容。
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.button1 = new System.Windows.Forms.Button();
32 | this.SuspendLayout();
33 | //
34 | // button1
35 | //
36 | this.button1.Font = new System.Drawing.Font("微軟正黑體", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
37 | this.button1.Location = new System.Drawing.Point(60, 51);
38 | this.button1.Name = "button1";
39 | this.button1.Size = new System.Drawing.Size(174, 70);
40 | this.button1.TabIndex = 0;
41 | this.button1.Text = "按我按我~";
42 | this.button1.UseVisualStyleBackColor = true;
43 | this.button1.Click += new System.EventHandler(this.button1_Click);
44 | //
45 | // Form1
46 | //
47 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
48 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
49 | this.ClientSize = new System.Drawing.Size(307, 188);
50 | this.Controls.Add(this.button1);
51 | this.Name = "Form1";
52 | this.Text = "Form1";
53 | this.ResumeLayout(false);
54 |
55 | }
56 |
57 | #endregion
58 |
59 | private System.Windows.Forms.Button button1;
60 | }
61 | }
62 |
63 |
--------------------------------------------------------------------------------
/class-41-50/Class50/Demo/Demo/Form1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace Demo
12 | {
13 | public partial class Form1 : Form
14 | {
15 | public Form1()
16 | {
17 | InitializeComponent();
18 | }
19 |
20 | private void button1_Click(object sender, EventArgs e)
21 | {
22 | Building b = new Building();
23 |
24 | b.Add(new Worker("小山貓"));
25 | b.Add(new Worker("大山貓"));
26 |
27 | b.Add(new Resident("哈哈"));
28 |
29 | MessageBox.Show(b.ToString());
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/class-41-50/Class50/Demo/Demo/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace Demo
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// 應用程式的主要進入點。
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new Form1());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/class-41-50/Class50/Demo/Demo/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 組件的一般資訊是由下列的屬性集控制。
6 | // 變更這些屬性的值即可修改組件的相關
7 | // 資訊。
8 | [assembly: AssemblyTitle("Demo")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Demo")]
13 | [assembly: AssemblyCopyright("Copyright © 2020")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // 將 ComVisible 設為 false 可對 COM 元件隱藏
18 | // 組件中的類型。若必須從 COM 存取此組件中的類型,
19 | // 的類型,請在該類型上將 ComVisible 屬性設定為 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 下列 GUID 為專案公開 (Expose) 至 COM 時所要使用的 typelib ID
23 | [assembly: Guid("8755ce51-a2ba-4096-b309-fb2da2782c78")]
24 |
25 | // 組件的版本資訊由下列四個值所組成:
26 | //
27 | // 主要版本
28 | // 次要版本
29 | // 組建編號
30 | // 修訂編號
31 | //
32 | // 您可以指定所有的值,也可以使用 '*' 將組建和修訂編號
33 | // 設為預設,如下所示:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/class-41-50/Class50/Demo/Demo/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 這段程式碼是由工具產生的。
4 | // 執行階段版本:4.0.30319.42000
5 | //
6 | // 變更這個檔案可能會導致不正確的行為,而且如果已重新產生
7 | // 程式碼,則會遺失變更。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Demo.Properties
12 | {
13 |
14 |
15 | ///
16 | /// 用於查詢當地語系化字串等的強類型資源類別
17 | ///
18 | // 這個類別是自動產生的,是利用 StronglyTypedResourceBuilder
19 | // 類別透過 ResGen 或 Visual Studio 這類工具產生。
20 | // 若要加入或移除成員,請編輯您的 .ResX 檔,然後重新執行 ResGen
21 | // (利用 /str 選項),或重建您的 VS 專案。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// 傳回這個類別使用的快取的 ResourceManager 執行個體。
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Demo.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// 覆寫目前執行緒的 CurrentUICulture 屬性,對象是所有
56 | /// 使用這個強類型資源類別的資源查閱。
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/class-41-50/Class50/Demo/Demo/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Demo.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/class-41-50/Class50/Demo/Demo/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/class-41-50/Class50/Demo/Demo/Resident.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Demo
8 | {
9 | class Resident
10 | {
11 | private String name;
12 |
13 | public Resident(String name)
14 | {
15 | this.name = name;
16 | }
17 |
18 | public override String ToString()
19 | {
20 | return "住戶 " + name;
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/class-41-50/Class50/Demo/Demo/Worker.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Demo
8 | {
9 | class Worker
10 | {
11 | private String name;
12 |
13 | public Worker(String name)
14 | {
15 | this.name = name;
16 | }
17 |
18 | public override String ToString()
19 | {
20 | return "辦公人士 " + name;
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------