Download free for 30 days
Sign in
Upload
Language (EN)
Support
Business
Mobile
Social Media
Marketing
Technology
Art & Photos
Career
Design
Education
Presentations & Public Speaking
Government & Nonprofit
Healthcare
Internet
Law
Leadership & Management
Automotive
Engineering
Software
Recruiting & HR
Retail
Sales
Services
Science
Small Business & Entrepreneurship
Food
Environment
Economy & Finance
Data & Analytics
Investor Relations
Sports
Spiritual
News & Politics
Travel
Self Improvement
Real Estate
Entertainment & Humor
Health & Medicine
Devices & Hardware
Lifestyle
Change Language
Language
English
Español
Português
Français
Deutsche
Cancel
Save
EN
TT
Uploaded by
tat tt
PDF, PPTX
108 views
Visual Studioのデザイン時T4テキストテンプレートをほんの少し理解した.pdf
Visual Studioのデザイン時T4テキストテンプレートについて説明した資料です。
Engineering
◦
Read more
0
Save
Share
Embed
Embed presentation
Download
Download as PDF, PPTX
1
/ 13
2
/ 13
3
/ 13
4
/ 13
5
/ 13
6
/ 13
7
/ 13
8
/ 13
9
/ 13
10
/ 13
11
/ 13
12
/ 13
13
/ 13
More Related Content
PDF
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
by
OECD Directorate for Financial and Enterprise Affairs
PDF
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
by
SocialHRCamp
PDF
Storytelling For The Web: Integrate Storytelling in your Design Process
by
Chiara Aliotta
PDF
2024 State of Marketing Report – by Hubspot
by
Marius Sescu
PDF
2024 Trend Updates: What Really Works In SEO & Content Marketing
by
Search Engine Journal
PDF
Everything You Need To Know About ChatGPT
by
Expeed Software
PDF
Product Design Trends in 2024 | Teenage Engineerings
by
Pixeldarts
PDF
How Race, Age and Gender Shape Attitudes Towards Mental Health
by
ThinkNow
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
by
OECD Directorate for Financial and Enterprise Affairs
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
by
SocialHRCamp
Storytelling For The Web: Integrate Storytelling in your Design Process
by
Chiara Aliotta
2024 State of Marketing Report – by Hubspot
by
Marius Sescu
2024 Trend Updates: What Really Works In SEO & Content Marketing
by
Search Engine Journal
Everything You Need To Know About ChatGPT
by
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
by
Pixeldarts
How Race, Age and Gender Shape Attitudes Towards Mental Health
by
ThinkNow
Featured
PDF
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
by
marketingartwork
PDF
Skeleton Culture Code
by
Skeleton Technologies
PDF
PEPSICO Presentation to CAGNY Conference Feb 2024
by
Neil Kimberley
PDF
Content Methodology: A Best Practices Report (Webinar)
by
contently
PPTX
How to Prepare For a Successful Job Search for 2024
by
Albert Qian
PDF
Social Media Marketing Trends 2024 // The Global Indie Insights
by
Kurio // The Social Media Age(ncy)
PDF
Trends In Paid Search: Navigating The Digital Landscape In 2024
by
Search Engine Journal
PDF
5 Public speaking tips from TED - Visualized summary
by
SpeakerHub
PDF
ChatGPT and the Future of Work - Clark Boyd
by
Clark Boyd
PDF
Getting into the tech field. what next
by
Tessa Mero
PDF
Google's Just Not That Into You: Understanding Core Updates & Search Intent
by
Lily Ray
PDF
How to have difficult conversations
by
Rajiv Jayarajah, MAppComm, ACC
PDF
Introduction to Data Science
by
Christy Abraham Joy
PDF
Time Management & Productivity - Best Practices
by
Vit Horky
PDF
The six step guide to practical project management
by
MindGenius
PDF
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
by
RachelPearson36
PDF
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
by
Applitools
PDF
12 Ways to Increase Your Influence at Work
by
GetSmarter
PDF
ChatGPT webinar slides
by
Alireza Esmikhani
PDF
More than Just Lines on a Map: Best Practices for U.S Bike Routes
by
Project for Public Spaces & National Center for Biking and Walking
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
by
marketingartwork
Skeleton Culture Code
by
Skeleton Technologies
PEPSICO Presentation to CAGNY Conference Feb 2024
by
Neil Kimberley
Content Methodology: A Best Practices Report (Webinar)
by
contently
How to Prepare For a Successful Job Search for 2024
by
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
by
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
by
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
by
SpeakerHub
ChatGPT and the Future of Work - Clark Boyd
by
Clark Boyd
Getting into the tech field. what next
by
Tessa Mero
Google's Just Not That Into You: Understanding Core Updates & Search Intent
by
Lily Ray
How to have difficult conversations
by
Rajiv Jayarajah, MAppComm, ACC
Introduction to Data Science
by
Christy Abraham Joy
Time Management & Productivity - Best Practices
by
Vit Horky
The six step guide to practical project management
by
MindGenius
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
by
RachelPearson36
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
by
Applitools
12 Ways to Increase Your Influence at Work
by
GetSmarter
ChatGPT webinar slides
by
Alireza Esmikhani
More than Just Lines on a Map: Best Practices for U.S Bike Routes
by
Project for Public Spaces & National Center for Biking and Walking
Visual Studioのデザイン時T4テキストテンプレートをほんの少し理解した.pdf
1.
Visual Studioのデザイン時T4テキスト テンプレートをほんの少し理解した 2022/8/25 tat_tt
2.
自己紹介 名前:tat_tt (たっと) 年齢:27歳(社会人5年目) 業務:C#を使ったデスクトップアプリ開発
3.
目次 • 背景 • 本日お話しすること •
デザイン時T4テンプレートの概要 • 便利に使える場面と使い方 • まとめ
4.
背景 末尾の数字だけが変わるような複数のフィール ドやプロパティをコメントも合わせて、手動で 実装するのが面倒 調べてみると、デザイン時T4テンプレートを使 うと楽できそう 実際に使ってみて得た知見を今日は共有
5.
本日お話しすること 以下2点が話題 • デザイン時T4テンプレートの概要 • 便利に使える場面
6.
Visual Studioのプロジェクト デザイン時T4テンプレートの概要(1) T4テキストテンプレートファイルを使って、テ キストファイルをビルド時に自動生成する仕組 み T4テキスト テンプレートファイル (.tt) ビルド時 テキストファイル (.txt, .csなど) 自動生成
7.
ディレクティブ:出力ファイルの設定やコントロールブロック向けの設定 <#@ import namespace="System"
#> <#@ output extension=“.cs” #> テキストブロック:出力ファイルに直接挿入されるテキスト public class Sample { // ・・・ } コントロールブロック:テキストを生成するためのプログラムコード <# for(int i = 0; i < 4; i++) { Write(i + ", "); } Write("4"); #> デザイン時T4テンプレートの概要(2) T4テキストテンプレートの構成要素は以下
8.
便利に使える場面と使い方 • 末尾の数字だけが変わるようなフィールドやプ ロパティを効率的に定義したい • ジェネリックで受け取る型の数だけが違うよう な共通実装が多いメソッドを効率的に定義した い 以降で具体例を掲示
9.
便利に使える場面 ~困りごと~ 20個の文字列型の設定項目があるクラスを定義 することを考える class Sample { ///
<summary> /// 設定項目1 /// </summary> string SettingItem1 { get; set; } /// <summary> /// 設定項目2 /// </summary> string SettingItem2 { get; set; } // SettingItem3~20も同様に定義 } ■困る点 ・単純に20個定義する のが面倒 ・プロパティ名やコメ ントを変えると20個す べてに反映が必要
10.
便利に使える場面 ~テンプレートを使うと~ 制御ロジックを使って簡潔に書ける! 下で使う変数を定義 for文内のテキストを 20回分生成 この部分がfor文内の変数count の値に置き換わる
11.
便利に使える場面 ~使い方①~ T4テンプレート用の.ttファイルを追加
12.
便利に使える場面 ~使い方②~ テンプレート作成 保存 テンプレートから テキスト作成
13.
まとめ 以下のような場面ではデザイン時T4テキストテ ンプレートが便利 • 末尾の数字だけが変わるようなフィールドやプロパ ティを効率的に定義したい • ジェネリックで受け取る型の数だけが違うような共通 実装が多いメソッドを効率的に定義したい Visual
Studioで面倒なテキストを作る場合には デザイン時T4テキストテンプレートを使えない か確認するとよいかも!
Download