-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathday7.html
More file actions
195 lines (195 loc) · 6.41 KB
/
day7.html
File metadata and controls
195 lines (195 loc) · 6.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<!DOCTYPE HTML>
<html lang="de">
<head>
<title>Programming C#</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=1274, user-scalable=no">
<link rel="stylesheet" href="themes/styles/style.css">
</head>
<body class="list">
<header class="caption">
<h1>Programming C#</h1>
</header>
<div class="slide cover" id="Cover"><div>
<section>
<header>
<h2>Programming C#</h2>
<h3>Day 7: IEnumerable, Libraries and NuGet, work on the projects</h3>
</header>
<img src="pictures/cover.jpg" alt="">
</section>
</div></div>
<div class="slide" id="overview"><div>
<section>
<header>
<h2>Content</h2>
</header>
<ul>
<li>The IEnumerable interface</li>
<li>creating Enumerators with <code>yield</code></li>
<li>What are libraries?</li>
<li>Creating (CLR) libraries with C#</li>
<li>Package managers</li>
<li>The NuGet package manager</li>
<li>Overall project structure</li>
<!--<li>Using Git or TFS for source control</li>-->
</ul>
</section>
</div></div>
<div class="slide" id="IEnumerable"><div>
<section>
<header>
<h2>The IEnumerable interface</h2>
</header>
<ul>
<li><code>IEnumerable</code> allows us to iterate through classes</li>
<li>Our own implementation enables use of <code>foreach</code> for user-defined classes</li>
<li>opens way to LINQ requests</li>
<li>an enumerator is used to go through the elements<li>
<li>think about using a specialized version with <code>IEnumerable<T></code></li>
</ul>
</section>
</div></div>
<div class="slide" id="yield"><div>
<section>
<header>
<h2>The <code>yield</code> statement</h2>
</header>
<ul>
<li>Writing a whole Enumerator class to iterate through a user defined class can be lengthy</li>
<li>In many cases only the method <code>GetEnumerator</code> is needed.</li>
<li>Here <code>yield</code> can simplify our life as it creates an Enumerator.
</ul>
</section>
</div></div>
<div class="slide" id="example-yield"><div>
<section>
<header>
<h2 class="example">→ Example - Enumerators and yield</h2>
</header>
<a href="https://github.com/CSharpLecture/Samples/blob/master/day7/EnumeratorAndYieldExample.cs" title="Download source" class="example-download">EnumeratorAndYieldExample</a>
</section>
</div></div>
<div class="slide" id="libraries"><div>
<section>
<header>
<h2>What are libraries?</h2>
</header>
<ul>
<li>A library is a compiled binary</li>
<li>The only difference to an executable is that no Main() is defined</li>
<li>A library consists of types and functionality</li>
<li>Using 3rd party libraries boosts our productivity</li>
<li>There are great libraries written in C# or</li>
<li>Libraries that just wrap native libraries</li>
<li>We already use libraries if we use the .NET-Framework</li>
</ul>
</section>
</div></div>
<div class="slide" id="csharp-library"><div>
<section>
<header>
<h2>Creating a library with C#</h2>
</header>
<ul>
<li>In Visual Studio: Start, New Project, C#, Class Library</li>
<li>Libraries are the most efficient way to re-use projects</li>
<li>Libraries are to the OS as what classes are to C#</li>
<li>They improve reusability and encapsulation</li>
<li>MSIL libraries also contain meta-data for reflection</li>
</ul>
</section>
</div></div>
<div class="slide" id="clr-assembly"><div>
<section>
<header>
<h2>A CLR assembly</h2>
</header>
<img src="pictures/assembly.png" class="middle r" />
</section>
</div></div>
<div class="slide" id="package-managers"><div>
<section>
<header>
<h2>Package managers</h2>
</header>
<ul>
<li>Using external libraries is quite easy</li>
<li>The hard part is maintenance and dependencies</li>
<li>We have to keep them up-to-date and we might need other libraries</li>
<li>This can get quite cruel, since where to get is not always trivial</li>
<li>A package manager offers a solution to those problems</li>
<li>Usually there is a database with libraries</li>
<li>Adding a library will result in a check for the dependencies and installation of the required libraries</li>
</ul>
</section>
</div></div>
<div class="slide" id="nuget"><div>
<section>
<header>
<h2>NuGet</h2>
</header>
<ul>
<li>NuGet is an open-source package manager for the Visual Studio</li>
<li>It is so popular, that it has been integrated into the Visual Studio 2012</li>
<li>Every external library is now on NuGet</li>
<li>Easy to publish on the public NuGet feed or create own private feeds</li>
<li>Big advantage: Project bound and easy updating</li>
<li>Another advantage: Powershell integrated</li>
</ul>
</section>
</div></div>
<div class="slide" id="nuget-flow"><div>
<section>
<header>
<h2>NuGet flow</h2>
</header>
<img src="pictures/nuget.png" class="middle r" />
</section>
</div></div>
<div class="slide" id="project-structure"><div>
<section>
<header>
<h2>Overall project structure</h2>
</header>
<ul>
<li>Add external resources to your project(s)</li>
<li>Use NuGet for external libraries</li>
<li>Create own libraries if you want to re-use (non-UI) functionality</li>
<li>Use resource files for data, like images, sounds, texts, ...</li>
<li>Big advantage: They can be localized (German, English, ...)</li>
<li>Use DRY: Don't Repeat Yourself</li>
</ul>
</section>
</div></div>
<div class="slide" id="presentations"><div>
<section>
<header>
<h2>All available presentations</h2>
</header>
<div class="left">
<b>Week 1</b>
<ul>
<li><a href="day1.html">Presentation of Monday</a></li>
<li><a href="day2.html">Presentation of Tuesday</a></li>
<li><a href="day3.html">Presentation of Wednesday</a></li>
<li><a href="day4.html">Presentation of Thursday</a></li>
<li><a href="day5.html">Presentation of Friday</a></li>
</ul>
</div>
<div class="right">
<b>Week 2</b>
<ul>
<li><a href="day6.html">Presentation of Monday</a></li>
<li><a href="day7.html">Presentation of Tuesday</a></li>
<li><a href="day8.html">Presentation of Wednesday</a></li>
<li><a href="day9.html">Presentation of Thursday</a></li>
</ul>
</div>
</section>
</div></div>
<div class="progress"><div></div></div>
<script src="scripts/script.js"></script>
<!-- Copyright © 2013 Florian Rappl, www.florian-rappl.de -->
</body>
</html>