15
Visual Studio 2015 Update1 CTP と CSI とと @OPCDIARY http://opcdiary.net h t t p : / / o p c d i a r y . n e t 1

Visual studio 2015 update1 ctpとcsi

Embed Size (px)

Citation preview

Page 1: Visual studio 2015 update1 ctpとcsi

http://opcdiary.net1

Visual Studio 2015 Update1 CTPとCSI石坂@OPCDIARY http://opcdiary.net

Page 2: Visual studio 2015 update1 ctpとcsi

http://opcdiary.net2自己紹介

伊豆の函南町から来ました。 牛乳と西瓜が有名

プラント向けシステムの SEです。 最近までよく上越に仕事で来ていました。 今年は富山のお仕事です。 続きはWEBで

http://opcdiary.net

Page 3: Visual studio 2015 update1 ctpとcsi

http://opcdiary.net3VisualStudio 2015

Update1CTP 10/9(JPT)にリリースされました

バグ修正&機能追加 Windows Store向けコンパイルオプション (/BigObj)の追加 C# Interactive Window

C#の REPL環境 VSOでのプルリクエストが Team Explorerで作成可能に など

Page 4: Visual studio 2015 update1 ctpとcsi

http://opcdiary.net4C# Interactive Window

VisualStudio 2015内のサブウインドウ C#の REPL(Read–eval–print loop)環境

C#のコードをスクリプトとして実行できる C#のコードを対話的に実行できる 外部のアセンブリを参照可能 外部のスクリプトを読み込むことも可能 インテリセンスが使える Windowの中で awaitをちゃんと待つ IEnumerableの中身は表示してくれる イミディエイトウインドウのようにすぐに IDEやデバッガの操作ができる訳ではなさそう 基本的にコードの確認用か?

Page 5: Visual studio 2015 update1 ctpとcsi

http://opcdiary.net5

DemoC# INTERACTIVE WINDOW

Page 6: Visual studio 2015 update1 ctpとcsi

http://opcdiary.net6対話環境のコマンド

C#のディレクティブを使って実現している #help

ヘルプ #r

アセンブリへのリファレンスの追加 #r "path/MyAssembly.dll“ #r "System.Collections.Generic“

#load スクリプト (.csx)の読込

#clear or #cls 画面消去

#reset 対話環境のリセット

•#r "path/MyAssembly.dll"

Page 7: Visual studio 2015 update1 ctpとcsi

http://opcdiary.net7CSIコマンド

VS2015の開発者用コンソールから起動する事が出来る インテリセンス等も無いのでつらい まだ使えるって言う感じのツールにはなっていない

Page 8: Visual studio 2015 update1 ctpとcsi

http://opcdiary.net8

DemoCSIコマンド

Page 9: Visual studio 2015 update1 ctpとcsi

http://opcdiary.net9

コード例

Page 10: Visual studio 2015 update1 ctpとcsi

http://opcdiary.net10Linq

> using System.Collections.Generic; > List<int> mylist = new List<int> { 4, 7, 2, 5, 0, 6 }; mylist List<int>(6) { 4, 7, 2, 5, 0, 6 } > mylist.Where(x => x % 2 == 0) Enumerable.WhereListIterator<int> { 4, 2, 0, 6 } > mylist.Average() 4 >

Page 11: Visual studio 2015 update1 ctpとcsi

http://opcdiary.net11async/await

> using System.Threading.Tasks; > async Task<DateTime> CountToAsync(int num = 10) . { . for (int i = 0; i < num; i++) . { . await Task.Delay(TimeSpan.FromSeconds(1)); . } . . return DateTime.Now; . } > await CountToAsync() [10/7/2015 2:38:24 PM] >

Page 12: Visual studio 2015 update1 ctpとcsi

http://opcdiary.net12その他

トップレベルに設定した変数は全て public扱い 変数の中身を見たいときには、変数名をタイプしてリターン

Page 13: Visual studio 2015 update1 ctpとcsi

http://opcdiary.net13CSharpInteractive.rsp

VSで Interactive Window起動時に読み込まれている設定ファイル 以下のアセンブリが読み込まれるように設定されている

System System.Core Microsoft.CSharp System.Data System.Data.DataSetExtensions System.Xml System.Xml.Linq

Page 14: Visual studio 2015 update1 ctpとcsi

http://opcdiary.net14SeedUsings.csx

CSharpInteractive.rspから呼び出される CSスクリプト 以下がその内容

using System;using System.Collections.Generic;using System.Linq;using System.Text;

Page 15: Visual studio 2015 update1 ctpとcsi

http://opcdiary.net15参考資料

Interactive Window - GitHub Roslyn Wiki page https://github.com/dotnet/roslyn/wiki/Interactive-

Window