開発環境
- OS: Windows 10 Pro
- IDE(統合開発環境): Visual Studio Community 2017
Head First C# ―頭とからだで覚えるC#の基本 (Andrew Stellman (著)、Jennifer Greene (著)、佐藤 嘉一 (監修, 監修)、木下 哲也 (翻訳)、オライリージャパン)の2章(あくまでコードである - 内部では)、コードマグネット(p. 74)を取り組んでみる。
コード
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; using Windows.Foundation; using Windows.Foundation.Collections; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls.Primitives; using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Navigation; using Windows.UI.Popups; // MessageDialog // 空白ページの項目テンプレートについては、https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x411 を参照してください namespace App { /// <summary> /// それ自体で使用できる空白ページまたはフレーム内に移動できる空白ページ。 /// </summary> public sealed partial class MainPage : Page { public MainPage() { this.InitializeComponent(); MyClass myClass = new MyClass(); myClass.DoSomethingAsync(); } } class MyClass { public async void DoSomethingAsync() { string result = ""; int x = 3; while (x > 0) { if (x > 2) { result += "a"; } x -= 1; result += "-"; if (x == 2) { result += "b c"; } if (x == 1) { result += "d"; x -= 1; } } MessageDialog md = new MessageDialog(result); await md.ShowAsync(); } } }
0 コメント:
コメントを投稿