WEBVTT

1
00:00:00.080 --> 00:00:02.759
<v Speaker 1>Welcome to the dep dive. We're jumping straight into C

2
00:00:02.960 --> 00:00:04.759
<v Speaker 1>Sharp twelve and dot Net eight today.

3
00:00:04.960 --> 00:00:06.679
<v Speaker 2>Yeah, a real powerhouse duo.

4
00:00:06.679 --> 00:00:10.679
<v Speaker 1>Definitely for building modern apps that well run pretty much anywhere.

5
00:00:10.880 --> 00:00:14.000
<v Speaker 1>Our mission here is to kind of extract the essentials

6
00:00:14.039 --> 00:00:16.079
<v Speaker 1>you need to navigate this stuff exactly.

7
00:00:16.399 --> 00:00:19.120
<v Speaker 2>We're drawing from a pretty comprehensive resource on C Shark

8
00:00:19.120 --> 00:00:20.000
<v Speaker 2>twelve and dot eight.

9
00:00:20.160 --> 00:00:23.600
<v Speaker 1>Consider this your shortcut right setting up your dev playground,

10
00:00:23.679 --> 00:00:25.399
<v Speaker 1>getting the Sea Shark basics.

11
00:00:25.039 --> 00:00:29.800
<v Speaker 2>And exploring those core programming ideas all within this latest

12
00:00:29.800 --> 00:00:30.559
<v Speaker 2>dot net evolution.

13
00:00:30.760 --> 00:00:34.079
<v Speaker 1>Okay, let's unpack it. First things first, getting set up,

14
00:00:34.320 --> 00:00:35.719
<v Speaker 1>choosing your environment right.

15
00:00:36.000 --> 00:00:39.399
<v Speaker 2>The big two are Visual Studio twenty twenty two and Visual.

16
00:00:39.119 --> 00:00:42.880
<v Speaker 1>Studio Code Yeah vs. Twenty twenty two, hugely popular with

17
00:00:42.920 --> 00:00:46.039
<v Speaker 1>pro dot net devs, especially if you're mainly on Windows.

18
00:00:46.079 --> 00:00:48.200
<v Speaker 2>It's that full ide experience right out of the.

19
00:00:48.119 --> 00:00:50.479
<v Speaker 1>Box exactly guides you through set up you know, Sea

20
00:00:50.520 --> 00:00:54.119
<v Speaker 1>Shark settings, choosing your theme, which is surprisingly important.

21
00:00:54.280 --> 00:00:55.960
<v Speaker 2>Oh yeah, staring at it all day, you want it

22
00:00:56.000 --> 00:00:56.960
<v Speaker 2>to look right. Uh.

23
00:00:57.240 --> 00:01:00.640
<v Speaker 1>True, It's packed with features, so if you're deep Windows

24
00:01:00.840 --> 00:01:03.280
<v Speaker 1>want that all in one feel. Vs. Twenty twenty two

25
00:01:03.359 --> 00:01:04.480
<v Speaker 1>is probably your best.

26
00:01:04.280 --> 00:01:07.200
<v Speaker 2>Bet, but then you've got Visual Studio Code the contrast. Yeah,

27
00:01:07.239 --> 00:01:12.760
<v Speaker 2>it's big selling point is flexibility runs everywhere Windows, Mac, Linux, Yeah,

28
00:01:13.439 --> 00:01:17.239
<v Speaker 2>even arm chips like Apple Silicon or Raspberry Pie.

29
00:01:17.280 --> 00:01:19.760
<v Speaker 1>Super lightweight design too, right, And for.

30
00:01:19.760 --> 00:01:23.000
<v Speaker 2>Dot network in vs code, the c Shark DevKit extension

31
00:01:23.239 --> 00:01:24.799
<v Speaker 2>is well essential.

32
00:01:24.959 --> 00:01:27.159
<v Speaker 1>Ah yeah, tell us about that.

33
00:01:27.280 --> 00:01:30.480
<v Speaker 2>It brings in the features you need for like managing

34
00:01:30.519 --> 00:01:34.159
<v Speaker 2>solutions with multiple projects. Really turns vs code into a

35
00:01:34.200 --> 00:01:35.400
<v Speaker 2>proper dot net environment.

36
00:01:35.519 --> 00:01:38.400
<v Speaker 1>So if you valued that cross platform agility and maybe

37
00:01:38.480 --> 00:01:40.159
<v Speaker 1>work across different ocs.

38
00:01:39.879 --> 00:01:41.879
<v Speaker 2>Or you just prefer a more modular, bill it yourself

39
00:01:41.959 --> 00:01:42.280
<v Speaker 2>kind of.

40
00:01:42.359 --> 00:01:46.040
<v Speaker 1>Editor, vs code with the DevKit is a strong contender totally.

41
00:01:46.480 --> 00:01:48.959
<v Speaker 2>They even have that insider's version if you like living

42
00:01:49.040 --> 00:01:50.519
<v Speaker 2>on the edge getting new features early.

43
00:01:50.680 --> 00:01:53.920
<v Speaker 1>Okay, So organizing projects this idea of a solution.

44
00:01:53.760 --> 00:01:56.319
<v Speaker 2>Yeah, that's key in both Visual Studio and vs code

45
00:01:56.319 --> 00:01:56.959
<v Speaker 2>with the DevKit.

46
00:01:57.120 --> 00:01:59.680
<v Speaker 1>Think of it like a binder, right, holding all your

47
00:01:59.680 --> 00:02:01.239
<v Speaker 1>related projects together.

48
00:02:01.120 --> 00:02:04.760
<v Speaker 2>Exactly your website code, maybe a class library, a console app.

49
00:02:05.319 --> 00:02:07.879
<v Speaker 2>The solution file groups them. Let's the tools manage them

50
00:02:07.879 --> 00:02:08.560
<v Speaker 2>as one unit.

51
00:02:08.719 --> 00:02:11.879
<v Speaker 1>Our source mentions a chapter one solution holding a Hello

52
00:02:11.960 --> 00:02:13.159
<v Speaker 1>CS project.

53
00:02:12.879 --> 00:02:16.360
<v Speaker 2>Classic example, and that ties into the dot Net SDK,

54
00:02:16.639 --> 00:02:17.639
<v Speaker 2>the Software.

55
00:02:17.280 --> 00:02:20.680
<v Speaker 1>Development kit, which gives you the command line interface the CLI.

56
00:02:20.719 --> 00:02:24.000
<v Speaker 2>Right fundamental for creating and managing projects. No matter which

57
00:02:24.159 --> 00:02:24.919
<v Speaker 2>editor you use.

58
00:02:25.120 --> 00:02:26.639
<v Speaker 1>You can use the CLI to spin up a new

59
00:02:26.639 --> 00:02:28.159
<v Speaker 1>console app, for instance, yep.

60
00:02:28.000 --> 00:02:31.000
<v Speaker 2>And it generates those basic files, the dot c Proja

61
00:02:31.080 --> 00:02:32.800
<v Speaker 2>project file program.

62
00:02:32.400 --> 00:02:34.879
<v Speaker 1>Dot cs and those bin and obj folders you see

63
00:02:34.919 --> 00:02:35.919
<v Speaker 1>pop up, and.

64
00:02:35.879 --> 00:02:39.159
<v Speaker 2>The c sharp DevKit in vs code just picks up

65
00:02:39.159 --> 00:02:40.840
<v Speaker 2>those solution files and knows what to do.

66
00:02:40.919 --> 00:02:43.319
<v Speaker 1>So the CLI is kind of the bedrock. Interacting with

67
00:02:43.360 --> 00:02:44.039
<v Speaker 1>the core.

68
00:02:44.000 --> 00:02:48.360
<v Speaker 2>Tools absolutely and understanding solutions is vital as your apps

69
00:02:48.360 --> 00:02:50.960
<v Speaker 2>get bigger, more complex, maybe split into different parts.

70
00:02:51.039 --> 00:02:54.520
<v Speaker 1>Okay, let's actually build something super basic, a console app.

71
00:02:54.639 --> 00:02:55.639
<v Speaker 2>Walk is through it right.

72
00:02:55.759 --> 00:02:58.879
<v Speaker 1>You typically use a template, right, the c shark console

73
00:02:58.960 --> 00:03:00.280
<v Speaker 1>app template yep.

74
00:03:00.360 --> 00:03:01.479
<v Speaker 2>Give it a project name.

75
00:03:01.400 --> 00:03:05.520
<v Speaker 1>Like hellocs, choose where to save it maybe CR twelve, dot.

76
00:03:05.520 --> 00:03:08.199
<v Speaker 2>Net eight, and name the solution like chapter one.

77
00:03:08.439 --> 00:03:13.319
<v Speaker 1>And there's that interesting option mentioned about disabling native aot publish.

78
00:03:13.400 --> 00:03:16.599
<v Speaker 2>Yah ahead of time compilation piles straight to machine code.

79
00:03:16.479 --> 00:03:19.919
<v Speaker 1>Faster startup, smaller size in some cases, but we'll park

80
00:03:19.960 --> 00:03:21.400
<v Speaker 1>that for now. It's covered later right.

81
00:03:21.479 --> 00:03:23.199
<v Speaker 2>So once you create the project.

82
00:03:22.840 --> 00:03:26.000
<v Speaker 1>You get this program dot cs file and it's usually

83
00:03:26.080 --> 00:03:28.039
<v Speaker 1>super simple at first.

84
00:03:27.919 --> 00:03:30.199
<v Speaker 2>Often just a comment and maybe one line of code

85
00:03:30.400 --> 00:03:31.759
<v Speaker 2>like console right line.

86
00:03:32.000 --> 00:03:35.000
<v Speaker 1>It's deliberately minimal, a clean slate.

87
00:03:34.919 --> 00:03:38.280
<v Speaker 2>And a good place to start poking around, like finding

88
00:03:38.360 --> 00:03:41.280
<v Speaker 2>out the name space of that default program class.

89
00:03:41.319 --> 00:03:44.280
<v Speaker 1>Oh right, the source had that snippet type of program

90
00:03:44.280 --> 00:03:45.599
<v Speaker 1>dot namespace.

91
00:03:45.240 --> 00:03:50.759
<v Speaker 2>String nameycal type of program dot namespace none, console right

92
00:03:50.840 --> 00:03:52.759
<v Speaker 2>line namespace dot e something like that.

93
00:03:52.840 --> 00:03:54.520
<v Speaker 1>Just a handy way to see how your code's.

94
00:03:54.280 --> 00:03:56.960
<v Speaker 2>Organized, definitely, and you can take that further, get environment

95
00:03:57.000 --> 00:03:59.919
<v Speaker 2>info like the current director jarn director yeah, or the OS.

96
00:03:59.759 --> 00:04:03.680
<v Speaker 1>Version environment do OS version version string in that name space.

97
00:04:03.719 --> 00:04:07.039
<v Speaker 2>Again, just useful for seeing where your code is actually running.

98
00:04:07.639 --> 00:04:08.800
<v Speaker 2>Good for debugging, like.

99
00:04:08.759 --> 00:04:10.400
<v Speaker 1>A quick health check of the environment.

100
00:04:10.560 --> 00:04:15.560
<v Speaker 2>Exactly what OSM I on? Where are my files? Useful stuff.

101
00:04:15.840 --> 00:04:19.680
<v Speaker 1>One last dev environment tip. They mentioned inline hints or

102
00:04:19.680 --> 00:04:20.399
<v Speaker 1>inlay hints.

103
00:04:20.480 --> 00:04:23.199
<v Speaker 2>Oh, those are great little reminders right in the code.

104
00:04:23.360 --> 00:04:26.040
<v Speaker 1>Yeah, they show the parameter names when you're calling a method, so.

105
00:04:25.959 --> 00:04:28.399
<v Speaker 2>You don't have to keep jumping back to the definition exactly.

106
00:04:28.519 --> 00:04:30.319
<v Speaker 1>Saves a lot of cognitive load. You can turn them

107
00:04:30.319 --> 00:04:32.639
<v Speaker 1>on in VS twenty twenty two's options.

108
00:04:32.240 --> 00:04:37.639
<v Speaker 2>Tools, Options text Editor, c shap advanced inline hints somewhere

109
00:04:37.680 --> 00:04:38.160
<v Speaker 2>in there.

110
00:04:38.000 --> 00:04:40.759
<v Speaker 1>And in VS code you just search settings for inline hints.

111
00:04:40.879 --> 00:04:43.519
<v Speaker 2>Small feature, big impact on readability.

112
00:04:43.519 --> 00:04:49.399
<v Speaker 1>Sometimes totally agree. Okay, moving on C sharp fundamentals, grammar, vocabulary,

113
00:04:50.000 --> 00:04:50.879
<v Speaker 1>the building blocks.

114
00:04:51.079 --> 00:04:53.279
<v Speaker 2>Right, So the C shark compiler is called Roslin.

115
00:04:53.439 --> 00:04:56.519
<v Speaker 1>Think of Roslyn as the translator takes your C sharp.

116
00:04:56.360 --> 00:04:59.959
<v Speaker 2>And turns it into intermediate language.

117
00:05:00.600 --> 00:05:03.560
<v Speaker 1>Which gets stored in assemblies of those DLL or ex

118
00:05:03.720 --> 00:05:05.439
<v Speaker 1>files YEP package code.

119
00:05:05.839 --> 00:05:08.800
<v Speaker 2>Then the dot Net run times Virtual Machine core CLR

120
00:05:08.920 --> 00:05:11.519
<v Speaker 2>that's the engine kinda it uses it just in time,

121
00:05:11.639 --> 00:05:13.959
<v Speaker 2>or JIT compiler.

122
00:05:13.680 --> 00:05:15.839
<v Speaker 1>Which translates that IL into.

123
00:05:15.879 --> 00:05:19.439
<v Speaker 2>Native CPU instructions. The stuff your actual process or understands

124
00:05:19.560 --> 00:05:20.439
<v Speaker 2>happens at runtime.

125
00:05:20.639 --> 00:05:23.839
<v Speaker 1>So C sharp to IL with Roslin, then IL to

126
00:05:23.920 --> 00:05:26.279
<v Speaker 1>native code with the JIT and core CLR.

127
00:05:26.399 --> 00:05:28.800
<v Speaker 2>You got it. It's a neat separation. Let's see sharp

128
00:05:28.879 --> 00:05:32.360
<v Speaker 2>evolve kind of independently from the runtime details helps with

129
00:05:32.399 --> 00:05:34.000
<v Speaker 2>cross platform two makes sense.

130
00:05:34.480 --> 00:05:38.959
<v Speaker 1>Now, C sharp grammar, we're talking statements.

131
00:05:38.519 --> 00:05:44.279
<v Speaker 2>Blocks, code inside curly braces and comments crucial for explaining things.

132
00:05:44.399 --> 00:05:47.360
<v Speaker 2>But the advice is, yeah, the implicitly or globally imported.

133
00:05:47.639 --> 00:05:51.639
<v Speaker 2>Saves you typing using system or using system dot collections

134
00:05:51.839 --> 00:05:53.199
<v Speaker 2>generic all the time.

135
00:05:53.240 --> 00:05:54.519
<v Speaker 1>Where does that info live?

136
00:05:54.639 --> 00:05:56.680
<v Speaker 2>It's generated in that of data bug Net eight point

137
00:05:56.720 --> 00:05:59.439
<v Speaker 2>zero folder, usually in a dot global usings dot g

138
00:05:59.519 --> 00:06:00.959
<v Speaker 2>dot c s file. We're similar.

139
00:06:01.079 --> 00:06:04.560
<v Speaker 1>So for basic console app Microsoft dot net SDK, you

140
00:06:04.600 --> 00:06:07.839
<v Speaker 1>get systemsystem, dot io, system dot.

141
00:06:07.639 --> 00:06:10.600
<v Speaker 2>Link common stuff, and if it's a web project Microsoft

142
00:06:10.639 --> 00:06:14.079
<v Speaker 2>dot net sdk web you get more like asthmiccore stuff

143
00:06:14.319 --> 00:06:15.639
<v Speaker 2>net dot HGDP Jason.

144
00:06:16.120 --> 00:06:19.079
<v Speaker 1>It's just about reducing boilerplate, making common types easy to.

145
00:06:19.040 --> 00:06:21.560
<v Speaker 2>Access precisely, less clutter, focus on your.

146
00:06:21.480 --> 00:06:24.480
<v Speaker 1>Logic, and finally literals simple concepts.

147
00:06:24.560 --> 00:06:26.879
<v Speaker 2>Yeah, just the way you write fixed values directly in

148
00:06:26.920 --> 00:06:28.120
<v Speaker 2>your code, like the number.

149
00:06:27.920 --> 00:06:30.959
<v Speaker 1>One, two, three, or the text hello or true.

150
00:06:30.720 --> 00:06:33.759
<v Speaker 2>False, exactly the raw value itself written in the source.

151
00:06:33.839 --> 00:06:36.199
<v Speaker 1>All right, let's talk about scoring different kinds of data,

152
00:06:36.360 --> 00:06:37.240
<v Speaker 1>starting with texts.

153
00:06:37.279 --> 00:06:40.399
<v Speaker 2>Okay, so the basic unit is char for a single character.

154
00:06:40.480 --> 00:06:42.040
<v Speaker 1>But there's a catch with unicode.

155
00:06:42.199 --> 00:06:46.199
<v Speaker 2>Uh huh. Some characters, especially emojis, are less common. Symbols

156
00:06:46.519 --> 00:06:49.600
<v Speaker 2>might actually need two char values called surrogate.

157
00:06:49.199 --> 00:06:53.480
<v Speaker 1>Pairs, so one visual character doesn't always equal one char variable.

158
00:06:53.439 --> 00:06:55.720
<v Speaker 2>Exactly something to be aware of if you're doing low

159
00:06:55.800 --> 00:06:59.240
<v Speaker 2>level text manipulation. Got to handle Unicode properly.

160
00:06:59.439 --> 00:06:59.920
<v Speaker 1>Good point.

161
00:07:00.079 --> 00:07:03.240
<v Speaker 2>What about numbers, lots of options. For whole numbers, you've

162
00:07:03.279 --> 00:07:07.480
<v Speaker 2>got integers, int is common handles positive and negative, int

163
00:07:07.600 --> 00:07:08.800
<v Speaker 2>is unsigned only.

164
00:07:08.560 --> 00:07:11.839
<v Speaker 1>Positive, and for numbers with decimal points.

165
00:07:11.519 --> 00:07:14.720
<v Speaker 2>Floating point types float, you need an F suffix like

166
00:07:14.759 --> 00:07:17.439
<v Speaker 2>three point one forty f and double, which is the

167
00:07:17.439 --> 00:07:19.519
<v Speaker 2>default if you just right say three point one.

168
00:07:19.560 --> 00:07:22.079
<v Speaker 1>Four, and then there's decimal for high precision.

169
00:07:21.800 --> 00:07:25.319
<v Speaker 2>Right crucial for financial stuff yeh, where tiny rounding errors

170
00:07:25.360 --> 00:07:28.480
<v Speaker 2>are bad news. Use an M suffix like twelve point

171
00:07:28.560 --> 00:07:29.160
<v Speaker 2>nine to nine ter.

172
00:07:29.519 --> 00:07:32.360
<v Speaker 1>So the difference is memory, use range of values and

173
00:07:32.399 --> 00:07:33.639
<v Speaker 1>that precision.

174
00:07:33.199 --> 00:07:36.759
<v Speaker 2>Aspect spot on integers for whole numbers, floats doubles for

175
00:07:36.800 --> 00:07:39.839
<v Speaker 2>general fractional numbers, decimal for exact decimal.

176
00:07:39.519 --> 00:07:41.759
<v Speaker 1>Representation, and we can check their size yep.

177
00:07:41.959 --> 00:07:44.399
<v Speaker 2>Using the size operator tells you how many.

178
00:07:44.199 --> 00:07:46.319
<v Speaker 1>Bites they take up, and find their limit.

179
00:07:46.160 --> 00:07:48.519
<v Speaker 2>Mind value and max value properties on the types themselves,

180
00:07:48.560 --> 00:07:51.079
<v Speaker 2>like into dot minvalue, double dot max value.

181
00:07:51.160 --> 00:07:53.959
<v Speaker 1>The source had that classic point one plus point two.

182
00:07:53.959 --> 00:07:57.439
<v Speaker 2>Example, right, yeah, showing how double might give you point

183
00:07:57.439 --> 00:08:00.360
<v Speaker 2>three zero zero zero zero zero zero zero zero zero

184
00:08:00.519 --> 00:08:03.959
<v Speaker 2>zero four. Well, decimal gives you exactly point three. It's

185
00:08:04.000 --> 00:08:05.680
<v Speaker 2>because of how they store the numbers internally.

186
00:08:05.759 --> 00:08:09.040
<v Speaker 1>Fascinating. That precision difference is huge sometimes.

187
00:08:08.560 --> 00:08:11.120
<v Speaker 2>It really can be. Understanding the tradeoffs is important.

188
00:08:11.120 --> 00:08:14.439
<v Speaker 1>What about those huge integer types in one two eight.

189
00:08:14.480 --> 00:08:16.399
<v Speaker 2>H yeah, system dot in one two eight and U

190
00:08:16.639 --> 00:08:19.759
<v Speaker 2>twenty two eight added in dot net seven massive sixteen

191
00:08:19.800 --> 00:08:20.879
<v Speaker 2>byte integers.

192
00:08:20.560 --> 00:08:22.319
<v Speaker 1>But using size klanumum is.

193
00:08:22.279 --> 00:08:26.360
<v Speaker 2>Tricky, requires unsafe code and a compiler flag. Definitely an

194
00:08:26.399 --> 00:08:30.680
<v Speaker 2>advanced feature for specialized needs like really big numbers and calculations.

195
00:08:30.800 --> 00:08:33.519
<v Speaker 1>Got it back to basics. String for text.

196
00:08:33.279 --> 00:08:37.399
<v Speaker 2>YEP sequences of characters pretty straightforward, has a length property.

197
00:08:37.080 --> 00:08:39.399
<v Speaker 1>And they're immutable. Right. You can't change a string once

198
00:08:39.399 --> 00:08:40.000
<v Speaker 1>it's created.

199
00:08:40.080 --> 00:08:43.360
<v Speaker 2>Correct. Operations that look like they modify a string actually

200
00:08:43.600 --> 00:08:46.639
<v Speaker 2>create a new string. Important for performance if you're doing

201
00:08:46.720 --> 00:08:47.720
<v Speaker 2>tons of manipulation.

202
00:08:48.000 --> 00:08:50.240
<v Speaker 1>Okay, now var the keyword var?

203
00:08:50.399 --> 00:08:52.120
<v Speaker 2>Oh yeah, tech difference superhandy.

204
00:08:52.159 --> 00:08:53.960
<v Speaker 1>What's the compiler figure out the type exactly?

205
00:08:54.039 --> 00:08:56.679
<v Speaker 2>Instead of string message hi, you can just write var

206
00:08:56.759 --> 00:08:58.159
<v Speaker 2>message hi and.

207
00:08:58.080 --> 00:09:00.799
<v Speaker 1>The editor usually shows you what type it an YEP.

208
00:09:00.799 --> 00:09:02.840
<v Speaker 2>Hover over var and it'll tell you a string.

209
00:09:03.039 --> 00:09:05.159
<v Speaker 1>Makes code shorter, but maybe less explicit.

210
00:09:05.240 --> 00:09:08.639
<v Speaker 2>Sometimes it's a balance. Great for complex tykes where spelling

211
00:09:08.639 --> 00:09:12.240
<v Speaker 2>it out is noisy, but sometimes being explicit makes things clearer.

212
00:09:12.720 --> 00:09:16.000
<v Speaker 1>Use it wisely, right, Okay, back to console apps.

213
00:09:15.720 --> 00:09:18.759
<v Speaker 2>For a sec text based run from the command line.

214
00:09:18.879 --> 00:09:22.080
<v Speaker 1>Good for scripts, simple tools, learning.

215
00:09:22.080 --> 00:09:25.840
<v Speaker 2>And importantly they can take arguments from the command line.

216
00:09:25.919 --> 00:09:28.519
<v Speaker 1>We'll get to that first. Making the output look nice.

217
00:09:28.720 --> 00:09:30.720
<v Speaker 1>String formatting several ways to do it.

218
00:09:30.960 --> 00:09:33.840
<v Speaker 2>The classic placeholders console right line.

219
00:09:33.799 --> 00:09:37.000
<v Speaker 1>Name, name, age aw that style yep.

220
00:09:37.159 --> 00:09:39.840
<v Speaker 2>Or you can use named arguments for clarity, especially with

221
00:09:39.919 --> 00:09:41.960
<v Speaker 2>multiple parameters of the same type.

222
00:09:41.799 --> 00:09:45.759
<v Speaker 1>Like console dot right line arg one first R one

223
00:09:46.000 --> 00:09:46.799
<v Speaker 1>second right.

224
00:09:47.360 --> 00:09:49.720
<v Speaker 2>The source also mentioned boxing warnings.

225
00:09:50.120 --> 00:09:53.240
<v Speaker 1>Yeah said it's more unity thing less critical for general

226
00:09:53.360 --> 00:09:54.559
<v Speaker 1>dot net apps covered here.

227
00:09:54.679 --> 00:09:55.879
<v Speaker 2>Okay, big one though.

228
00:09:56.039 --> 00:09:56.440
<v Speaker 1>Yeah.

229
00:09:56.480 --> 00:09:58.159
<v Speaker 2>Culture's impact on formatting.

230
00:09:58.279 --> 00:10:03.000
<v Speaker 1>Oh yeah, numbers, dates, currency, They look different depending on

231
00:10:03.039 --> 00:10:04.320
<v Speaker 1>region settings.

232
00:10:04.320 --> 00:10:07.600
<v Speaker 2>Five versus doc A, comma versus dot for one thousand separators.

233
00:10:07.840 --> 00:10:08.840
<v Speaker 1>But you can control it.

234
00:10:09.000 --> 00:10:14.080
<v Speaker 2>Yeah, definitely specify a culture like culture info invariant culture

235
00:10:14.159 --> 00:10:17.039
<v Speaker 2>for consistent machine readable formats, or.

236
00:10:17.120 --> 00:10:21.080
<v Speaker 1>Use custom format strings like zero for zero, placeholder hashtag

237
00:10:21.080 --> 00:10:22.240
<v Speaker 1>for digit exactly.

238
00:10:22.639 --> 00:10:25.600
<v Speaker 2>Table two point eight in the source has details lots

239
00:10:25.639 --> 00:10:26.440
<v Speaker 2>of control.

240
00:10:26.080 --> 00:10:29.240
<v Speaker 1>There, and the easiest way often is string interpolation. The

241
00:10:29.279 --> 00:10:31.080
<v Speaker 1>dollar sign syntax.

242
00:10:30.759 --> 00:10:34.720
<v Speaker 2>Variable yep usually much cleaner. Console right line.

243
00:10:34.720 --> 00:10:40.000
<v Speaker 1>H reads nicely okay, nullable reference types nrts. Big change

244
00:10:40.000 --> 00:10:41.639
<v Speaker 1>in modern C sharp.

245
00:10:41.480 --> 00:10:44.799
<v Speaker 2>Huge designed to tackle those dreaded noull reference exception errors.

246
00:10:45.120 --> 00:10:47.519
<v Speaker 1>By adding a question mark spring right.

247
00:10:47.919 --> 00:10:50.799
<v Speaker 2>It tells a compiler this variable might be null, and.

248
00:10:50.720 --> 00:10:52.679
<v Speaker 1>The compiler then warns you if you try to use

249
00:10:52.679 --> 00:10:54.240
<v Speaker 1>it without checking exactly.

250
00:10:54.720 --> 00:10:57.840
<v Speaker 2>It performs static analysis to find potential null issues before

251
00:10:57.879 --> 00:11:00.399
<v Speaker 2>you run. The code makes things much safer.

252
00:11:00.039 --> 00:11:01.679
<v Speaker 1>But you still have to handle the null case right.

253
00:11:01.720 --> 00:11:03.600
<v Speaker 1>The knot is a warning system precisely.

254
00:11:04.240 --> 00:11:06.639
<v Speaker 2>It forces you to think about nulls, but you still

255
00:11:06.720 --> 00:11:10.679
<v Speaker 2>need if my string null checks or similar patterns. It

256
00:11:10.679 --> 00:11:13.960
<v Speaker 2>doesn't magically fixed nulls. It makes them explicit. Got it?

257
00:11:14.039 --> 00:11:16.039
<v Speaker 1>Okay? Command line arguments? How do we get those?

258
00:11:16.240 --> 00:11:19.639
<v Speaker 2>When you run your app like dot Net, run first arg, second.

259
00:11:19.480 --> 00:11:21.600
<v Speaker 1>Arc Those first arg second arg pieces.

260
00:11:21.679 --> 00:11:24.200
<v Speaker 2>They get passed into your main method as an array

261
00:11:24.200 --> 00:11:26.919
<v Speaker 2>of strings, usually called arcs string arcs.

262
00:11:26.960 --> 00:11:29.399
<v Speaker 1>So urg zero would be first RG, ARGs one would

263
00:11:29.399 --> 00:11:30.240
<v Speaker 1>be second arc yep.

264
00:11:30.320 --> 00:11:32.039
<v Speaker 2>You can move through the arg's array and use those

265
00:11:32.120 --> 00:11:34.919
<v Speaker 2>values to change how your app behaves. Super useful for

266
00:11:34.960 --> 00:11:36.519
<v Speaker 2>making tools flexible makes.

267
00:11:36.320 --> 00:11:41.519
<v Speaker 1>Sense, and that platform specific example, setting cursor size.

268
00:11:41.320 --> 00:11:44.240
<v Speaker 2>Right works on Windows throws an exception on MCLINICX A.

269
00:11:44.200 --> 00:11:47.080
<v Speaker 1>Good reminder that even with cross platform dot net, the

270
00:11:47.240 --> 00:11:49.639
<v Speaker 1>underlying OS still matters.

271
00:11:49.320 --> 00:11:53.240
<v Speaker 2>Sometimes absolutely, and the solution often a tricatch block.

272
00:11:53.440 --> 00:11:55.840
<v Speaker 1>Try to set the cursor size, catch the exception if

273
00:11:55.879 --> 00:11:57.840
<v Speaker 1>it fails on Linux or Mac exactly.

274
00:11:58.240 --> 00:12:01.879
<v Speaker 2>Graceful handling of platform difference. We'll dig more into trycatch soon.

275
00:12:02.039 --> 00:12:06.679
<v Speaker 1>Perfect segue. Let's move into core programming concepts, starting with operators.

276
00:12:06.720 --> 00:12:10.799
<v Speaker 2>Basic math, your bread butter plus AA for AD, subtract

277
00:12:10.919 --> 00:12:15.600
<v Speaker 2>multiplied divide and per modulo the remainder after division ten

278
00:12:15.639 --> 00:12:16.639
<v Speaker 2>percent three is one?

279
00:12:16.799 --> 00:12:20.480
<v Speaker 1>Got it? Logical operators and for a ing for R

280
00:12:20.679 --> 00:12:22.600
<v Speaker 1>and they have that short circuiting behavior.

281
00:12:22.720 --> 00:12:25.919
<v Speaker 2>Yeah, that's important. With Andy in if the left side

282
00:12:25.919 --> 00:12:27.919
<v Speaker 2>is false, it doesn't even look at the right.

283
00:12:27.799 --> 00:12:30.679
<v Speaker 1>Side because the whole thing must be false anyway, right And.

284
00:12:30.639 --> 00:12:32.720
<v Speaker 2>With Andy and if the left side is true, it

285
00:12:32.759 --> 00:12:35.000
<v Speaker 2>skips the right side because the whole thing must be true.

286
00:12:35.080 --> 00:12:38.120
<v Speaker 1>Good for performance avoids unnecessary.

287
00:12:37.519 --> 00:12:42.639
<v Speaker 2>Work usually, but be careful if the right side expression

288
00:12:42.679 --> 00:12:45.080
<v Speaker 2>has side effects you rely on happening.

289
00:12:45.600 --> 00:12:48.000
<v Speaker 1>Like calling a function that's supposed to always log something

290
00:12:48.200 --> 00:12:49.639
<v Speaker 1>it might get skipped exactly.

291
00:12:50.120 --> 00:12:53.320
<v Speaker 2>Can lead to subtle bugs, something to be aware of, okay.

292
00:12:53.679 --> 00:12:55.399
<v Speaker 1>Making decisions.

293
00:12:55.440 --> 00:12:58.879
<v Speaker 2>Switch statements a way to handle multiple choices based on

294
00:12:58.919 --> 00:13:02.120
<v Speaker 2>a single value, cleaner than lots of if l's ifs.

295
00:13:02.159 --> 00:13:05.559
<v Speaker 1>Sometimes you have case labels for specific values, a default

296
00:13:05.559 --> 00:13:08.240
<v Speaker 1>case for everything else, and C shark allows go to

297
00:13:08.279 --> 00:13:10.639
<v Speaker 1>within a switch jump to other cases.

298
00:13:10.720 --> 00:13:14.159
<v Speaker 2>It does. Yeah, use with caution, though can make code

299
00:13:14.200 --> 00:13:16.440
<v Speaker 2>harder to follow if overused.

300
00:13:16.080 --> 00:13:18.759
<v Speaker 1>Right and then There are switch expressions in newer C

301
00:13:18.960 --> 00:13:19.639
<v Speaker 1>sharp versions.

302
00:13:19.679 --> 00:13:23.200
<v Speaker 2>Yeah, C sharp eight onwards. More concise, often more powerful,

303
00:13:23.320 --> 00:13:24.799
<v Speaker 2>especially with pattern matching.

304
00:13:25.000 --> 00:13:29.399
<v Speaker 1>That example with animals was cool checking the type and properties.

305
00:13:28.799 --> 00:13:31.840
<v Speaker 2>Cat four legged cat when four leggd cat legs equals.

306
00:13:31.480 --> 00:13:33.559
<v Speaker 1>Four that kind of thing, or just matching the type

307
00:13:33.639 --> 00:13:37.879
<v Speaker 1>cat cat or property pattern spider spider when Spider's poisonous.

308
00:13:37.440 --> 00:13:41.360
<v Speaker 2>Handling null using the discard as a default, very expressive,

309
00:13:42.080 --> 00:13:44.559
<v Speaker 2>often leads to cleaner code for complex conditions.

310
00:13:44.799 --> 00:13:47.000
<v Speaker 1>Definitely looks more functional, more declarative.

311
00:13:47.039 --> 00:13:50.720
<v Speaker 2>It leans that way, Yeah, okay. Storing collections a raise

312
00:13:51.200 --> 00:13:55.919
<v Speaker 2>the basic fix size collection string names, new string three.

313
00:13:55.879 --> 00:13:59.440
<v Speaker 1>Create space for three strings, access them with indices starting

314
00:13:59.480 --> 00:14:00.639
<v Speaker 1>at zero always.

315
00:14:00.440 --> 00:14:04.320
<v Speaker 2>Zero based name zero, names one, names two.

316
00:14:04.360 --> 00:14:06.600
<v Speaker 1>And loop through them with a four loop and the

317
00:14:06.679 --> 00:14:08.000
<v Speaker 1>link property.

318
00:14:08.120 --> 00:14:12.320
<v Speaker 2>I names length iplus plus new names standard stuff.

319
00:14:12.360 --> 00:14:15.759
<v Speaker 1>What about those inline arrays and c share twelve ah

320
00:14:16.159 --> 00:14:16.399
<v Speaker 1>more of.

321
00:14:16.399 --> 00:14:19.399
<v Speaker 2>An advanced behind the scenes performance thing for the runtime team.

322
00:14:19.440 --> 00:14:22.799
<v Speaker 1>Mostly so not something you typically declare yourself in application code.

323
00:14:23.080 --> 00:14:26.559
<v Speaker 2>Probably not directly no, but you might benefit from libraries

324
00:14:26.639 --> 00:14:28.600
<v Speaker 2>using them under the hood. There's a link if you

325
00:14:28.600 --> 00:14:30.039
<v Speaker 2>want the deep dive on those.

326
00:14:30.360 --> 00:14:32.399
<v Speaker 1>Gotcha and formatting output again.

327
00:14:32.559 --> 00:14:35.759
<v Speaker 2>Aligning column yeah, index alignment yeah, like zero zero twelve

328
00:14:35.840 --> 00:14:38.720
<v Speaker 2>pads with spaces to align right in a twelve.

329
00:14:38.559 --> 00:14:41.679
<v Speaker 1>Character call, and showing binary index ed format string.

330
00:14:41.639 --> 00:14:44.159
<v Speaker 2>Like zero three four point b three two shows a

331
00:14:44.240 --> 00:14:49.039
<v Speaker 2>number is thirty two bits. Binary representation potentially padded useful

332
00:14:49.039 --> 00:14:50.039
<v Speaker 2>for low level inspection.

333
00:14:50.360 --> 00:14:54.759
<v Speaker 1>Okay, getting data in parsing strings to numbers.

334
00:14:54.320 --> 00:14:58.080
<v Speaker 2>Or dates, big parse, daytime dot parse common methods, but they.

335
00:14:58.000 --> 00:15:00.480
<v Speaker 1>Can fail throw exceptions at the string. Isn't it right?

336
00:15:00.559 --> 00:15:04.759
<v Speaker 2>Yep, format exception. That's why culture matters too, cultureinfo dot

337
00:15:04.759 --> 00:15:08.440
<v Speaker 2>invariant culture to avoid nasty surprises with different date or

338
00:15:08.519 --> 00:15:09.879
<v Speaker 2>number formats.

339
00:15:09.559 --> 00:15:11.720
<v Speaker 1>So the safer way is tripars.

340
00:15:12.080 --> 00:15:15.679
<v Speaker 2>Generally yes. In trpars input string out in a result,

341
00:15:16.080 --> 00:15:17.120
<v Speaker 2>it returns true or.

342
00:15:17.080 --> 00:15:19.799
<v Speaker 1>False, true if it worked, and the result variable gets.

343
00:15:19.639 --> 00:15:22.159
<v Speaker 2>The value false if it failed, and result gets a

344
00:15:22.159 --> 00:15:25.039
<v Speaker 2>default value like zero for end no exception thrown.

345
00:15:25.480 --> 00:15:28.799
<v Speaker 1>Much cleaner for handling potentially bad user input avoids the

346
00:15:28.840 --> 00:15:31.360
<v Speaker 1>overhead of exceptions for expected failures.

347
00:15:30.960 --> 00:15:33.559
<v Speaker 2>Exactly use pars when you're sure the input is valid.

348
00:15:33.720 --> 00:15:35.000
<v Speaker 2>Trypars when it might not be.

349
00:15:35.240 --> 00:15:38.679
<v Speaker 1>And if parse does thrown exception or something else goes wrong.

350
00:15:39.039 --> 00:15:40.720
<v Speaker 1>That's where tricatch finally comes in.

351
00:15:40.879 --> 00:15:43.120
<v Speaker 2>Right wrap the risky code in try.

352
00:15:43.000 --> 00:15:46.559
<v Speaker 1>Handle specific errors in catch format exception x or.

353
00:15:46.519 --> 00:15:49.799
<v Speaker 2>More general errors in catch. Oh, I say, and use

354
00:15:49.840 --> 00:15:51.960
<v Speaker 2>finally for cleanup. Code that always.

355
00:15:51.720 --> 00:15:55.399
<v Speaker 1>Runs, always runs, whether an exception happen or not, whether

356
00:15:55.399 --> 00:15:58.879
<v Speaker 1>it's caught or not. Good for releasing resources like closing files.

357
00:15:59.559 --> 00:16:00.919
<v Speaker 1>Essential for robust code.

358
00:16:01.000 --> 00:16:03.639
<v Speaker 2>Okay, integer overflow numbers getting too.

359
00:16:03.600 --> 00:16:07.840
<v Speaker 1>Big Yeah by default se sharp injurer math is unchecked.

360
00:16:08.480 --> 00:16:12.000
<v Speaker 1>If indemac's value plus one happens, it wraps around silently

361
00:16:12.080 --> 00:16:14.120
<v Speaker 1>to int men value.

362
00:16:13.879 --> 00:16:15.799
<v Speaker 2>Which can cause very weird bugs.

363
00:16:15.879 --> 00:16:18.440
<v Speaker 1>Totally, so you can use the checked keyword.

364
00:16:18.120 --> 00:16:21.480
<v Speaker 2>Either as a block yeah result large number one plus

365
00:16:21.600 --> 00:16:22.240
<v Speaker 2>large numb.

366
00:16:22.039 --> 00:16:24.120
<v Speaker 1>Two, or as compiler option for the whole project.

367
00:16:24.279 --> 00:16:27.559
<v Speaker 2>And if overflow happens inside a checked context.

368
00:16:27.080 --> 00:16:30.200
<v Speaker 1>It throws an overflow exception instead of wrapping silently makes

369
00:16:30.240 --> 00:16:31.080
<v Speaker 1>the error obvious.

370
00:16:31.360 --> 00:16:34.960
<v Speaker 2>There's a slight performance cost, but often worth it for correctness.

371
00:16:34.960 --> 00:16:38.759
<v Speaker 1>Definitely something to consider, especially with financial or critical calculations.

372
00:16:39.080 --> 00:16:43.120
<v Speaker 1>All right, getting near the end functions or methods in

373
00:16:43.200 --> 00:16:47.080
<v Speaker 1>C sharp reusable blocks of code key for organization. The

374
00:16:47.120 --> 00:16:50.200
<v Speaker 1>example was time stable took a required number.

375
00:16:50.080 --> 00:16:53.399
<v Speaker 2>And an optional sized parameter with a default value void.

376
00:16:53.480 --> 00:16:55.720
<v Speaker 2>Time stable INNT number in size.

377
00:16:55.559 --> 00:16:57.639
<v Speaker 1>Is twelve, meaning you can call it with just the

378
00:16:57.720 --> 00:17:00.399
<v Speaker 1>number time stable five and size default.

379
00:17:00.120 --> 00:17:03.720
<v Speaker 2>To twelve, or provide both time stable five twenty.

380
00:17:03.440 --> 00:17:07.440
<v Speaker 1>And using named arguments makes calls clearer. Time stable number

381
00:17:07.680 --> 00:17:09.440
<v Speaker 1>five size twenty.

382
00:17:09.359 --> 00:17:13.079
<v Speaker 2>Especially useful when there are multiple optional parameters or parameters

383
00:17:13.079 --> 00:17:16.839
<v Speaker 2>of the same type. Improves readability quick terminology.

384
00:17:16.920 --> 00:17:19.160
<v Speaker 1>Check parameter versus argument.

385
00:17:19.119 --> 00:17:21.720
<v Speaker 2>Parameter is the variable in the function definition in number

386
00:17:21.720 --> 00:17:24.720
<v Speaker 2>in size. Argument is the actual value passed in when

387
00:17:24.759 --> 00:17:26.119
<v Speaker 2>you call the function five twenty.

388
00:17:26.200 --> 00:17:28.079
<v Speaker 1>Got it and functions can return values too.

389
00:17:28.240 --> 00:17:32.119
<v Speaker 2>Of course, the calculator tax example took an amount and reagencode.

390
00:17:31.880 --> 00:17:34.000
<v Speaker 1>Used to switch expression based on the region.

391
00:17:33.799 --> 00:17:37.960
<v Speaker 2>And return the calculated decimal tax value return calculated tax.

392
00:17:38.079 --> 00:17:40.519
<v Speaker 1>Perfect for encapsulating a calculation.

393
00:17:40.079 --> 00:17:42.640
<v Speaker 2>Or rule absolutely and documenting these functions.

394
00:17:42.920 --> 00:17:48.599
<v Speaker 1>XML comments Yeah, those triple slash comments summary summary editors.

395
00:17:48.319 --> 00:17:50.200
<v Speaker 2>Pick those up and show them as tooltips when you're

396
00:17:50.240 --> 00:17:51.200
<v Speaker 2>calling the function.

397
00:17:51.279 --> 00:17:56.359
<v Speaker 1>Explains what it does, parameters, return value. Huge help for maintainability,

398
00:17:56.640 --> 00:17:57.880
<v Speaker 1>good practice definitely.

399
00:17:58.640 --> 00:18:02.920
<v Speaker 2>Lastly, that decline larrative versus imperative style comparison.

400
00:18:02.480 --> 00:18:04.359
<v Speaker 1>Using the Fibonacci sequence.

401
00:18:04.119 --> 00:18:08.279
<v Speaker 2>Fib functional usercursion and a switch expression describing what fibonacci is.

402
00:18:08.240 --> 00:18:11.319
<v Speaker 1>While fib imperative used a loop describing how to calculate

403
00:18:11.319 --> 00:18:12.240
<v Speaker 1>it step by step.

404
00:18:12.319 --> 00:18:14.200
<v Speaker 2>Just shows there are different ways to think about and

405
00:18:14.240 --> 00:18:17.079
<v Speaker 2>solve problems in code. Neither is always better, depends on

406
00:18:17.119 --> 00:18:17.559
<v Speaker 2>the context.

407
00:18:17.640 --> 00:18:19.759
<v Speaker 1>A good illustration of different paradigms yep.

408
00:18:20.119 --> 00:18:25.319
<v Speaker 2>Functional style often emphasizes immutability in expressions. Imperative focuses on

409
00:18:25.400 --> 00:18:28.079
<v Speaker 2>mutable state and step by step instructions. Wow.

410
00:18:28.160 --> 00:18:30.680
<v Speaker 1>Okay, that was quite the journey through the fundamentals.

411
00:18:30.720 --> 00:18:33.079
<v Speaker 2>We covered a lot. Setting up the environment vs versus

412
00:18:33.200 --> 00:18:34.039
<v Speaker 2>vs code.

413
00:18:33.880 --> 00:18:42.759
<v Speaker 1>See shirt grammar, Roslin, il jit, data types like char, int, decimal, string, Nobel.

414
00:18:42.480 --> 00:18:46.960
<v Speaker 2>Types, operators, switch statements and expressions, arrays, parsing, exception handling

415
00:18:47.000 --> 00:18:48.319
<v Speaker 2>with trycatch.

416
00:18:48.079 --> 00:18:54.599
<v Speaker 1>Checked overflow, basic functions, parameters versus arguments, returning values, XML comments,

417
00:18:55.119 --> 00:18:57.400
<v Speaker 1>and even a peak at programming styles.

418
00:18:57.720 --> 00:19:00.559
<v Speaker 2>Phew. Yeah, these really are the core building blocks you

419
00:19:00.599 --> 00:19:03.400
<v Speaker 2>need for getting started with c SHAR twelve and dot

420
00:19:03.440 --> 00:19:03.839
<v Speaker 2>net eight.

421
00:19:04.200 --> 00:19:06.960
<v Speaker 1>Having a solid grasp of this stuff is just crucial

422
00:19:07.039 --> 00:19:09.200
<v Speaker 1>for building anything substantial and reliable.

423
00:19:09.240 --> 00:19:11.559
<v Speaker 2>Couldn't agree more. It's the foundation for everything else.

424
00:19:11.960 --> 00:19:16.519
<v Speaker 1>So as you the listener, continue exploring this, maybe something

425
00:19:16.599 --> 00:19:18.079
<v Speaker 1>specific caught your ear.

426
00:19:18.079 --> 00:19:21.480
<v Speaker 2>Perhaps nullable reference types, or you want to know more

427
00:19:21.519 --> 00:19:26.279
<v Speaker 2>about collection types beyond arrays like lists or dictionaries, or maybe.

428
00:19:26.039 --> 00:19:28.680
<v Speaker 1>The details of the Roslin compiler or the subtleties of

429
00:19:28.759 --> 00:19:29.759
<v Speaker 1>decimal versus double.

430
00:19:29.839 --> 00:19:33.559
<v Speaker 2>Yeah, the point is mastering these fundamentals really opens the

431
00:19:33.599 --> 00:19:36.839
<v Speaker 2>door to the more advanced, powerful features of dot net, so.

432
00:19:36.880 --> 00:19:40.000
<v Speaker 1>We definitely encourage you dive deeper. Check out the links,

433
00:19:40.079 --> 00:19:43.920
<v Speaker 1>explore the official documentation. This platform is incredibly rich and

434
00:19:44.039 --> 00:19:46.240
<v Speaker 1>constantly evolving. There's always more to learn.
