Latest / CyberSecurity Summary / C# 12 and .NET 8 – Modern Cross-Platform Development Fundamentals: Start building websites and services with ASP.NET Core 8, Blazor
Transcript
- 0:00Speaker 1: Welcome to the dep dive. We're jumping straight into C
- 0:02Speaker 1: Sharp twelve and dot Net eight today.
- 0:04Speaker 2: Yeah, a real powerhouse duo.
- 0:06Speaker 1: Definitely for building modern apps that well run pretty much anywhere.
- 0:10Speaker 1: Our mission here is to kind of extract the essentials
- 0:14Speaker 1: you need to navigate this stuff exactly.
- 0:16Speaker 2: We're drawing from a pretty comprehensive resource on C Shark
- 0:19Speaker 2: twelve and dot eight.
- 0:20Speaker 1: Consider this your shortcut right setting up your dev playground,
- 0:23Speaker 1: getting the Sea Shark basics.
- 0:25Speaker 2: And exploring those core programming ideas all within this latest
- 0:29Speaker 2: dot net evolution.
- 0:30Speaker 1: Okay, let's unpack it. First things first, getting set up,
- 0:34Speaker 1: choosing your environment right.
- 0:36Speaker 2: The big two are Visual Studio twenty twenty two and Visual.
- 0:39Speaker 1: Studio Code Yeah vs. Twenty twenty two, hugely popular with
- 0:42Speaker 1: pro dot net devs, especially if you're mainly on Windows.
- 0:46Speaker 2: It's that full ide experience right out of the.
- 0:48Speaker 1: Box exactly guides you through set up you know, Sea
- 0:50Speaker 1: Shark settings, choosing your theme, which is surprisingly important.
- 0:54Speaker 2: Oh yeah, staring at it all day, you want it
- 0:56Speaker 2: to look right. Uh.
- 0:57Speaker 1: True, It's packed with features, so if you're deep Windows
- 1:00Speaker 1: want that all in one feel. Vs. Twenty twenty two
- 1:03Speaker 1: is probably your best.
- 1:04Speaker 2: Bet, but then you've got Visual Studio Code the contrast. Yeah,
- 1:07Speaker 2: it's big selling point is flexibility runs everywhere Windows, Mac, Linux, Yeah,
- 1:13Speaker 2: even arm chips like Apple Silicon or Raspberry Pie.
- 1:17Speaker 1: Super lightweight design too, right, And for.
- 1:19Speaker 2: Dot network in vs code, the c Shark DevKit extension
- 1:23Speaker 2: is well essential.
- 1:24Speaker 1: Ah yeah, tell us about that.
- 1:27Speaker 2: It brings in the features you need for like managing
- 1:30Speaker 2: solutions with multiple projects. Really turns vs code into a
- 1:34Speaker 2: proper dot net environment.
- 1:35Speaker 1: So if you valued that cross platform agility and maybe
- 1:38Speaker 1: work across different ocs.
- 1:39Speaker 2: Or you just prefer a more modular, bill it yourself
- 1:41Speaker 2: kind of.
- 1:42Speaker 1: Editor, vs code with the DevKit is a strong contender totally.
- 1:46Speaker 2: They even have that insider's version if you like living
- 1:49Speaker 2: on the edge getting new features early.
- 1:50Speaker 1: Okay, So organizing projects this idea of a solution.
- 1:53Speaker 2: Yeah, that's key in both Visual Studio and vs code
- 1:56Speaker 2: with the DevKit.
- 1:57Speaker 1: Think of it like a binder, right, holding all your
- 1:59Speaker 1: related projects together.
- 2:01Speaker 2: Exactly your website code, maybe a class library, a console app.
- 2:05Speaker 2: The solution file groups them. Let's the tools manage them
- 2:07Speaker 2: as one unit.
- 2:08Speaker 1: Our source mentions a chapter one solution holding a Hello
- 2:11Speaker 1: CS project.
- 2:12Speaker 2: Classic example, and that ties into the dot Net SDK,
- 2:16Speaker 2: the Software.
- 2:17Speaker 1: Development kit, which gives you the command line interface the CLI.
- 2:20Speaker 2: Right fundamental for creating and managing projects. No matter which
- 2:24Speaker 2: editor you use.
- 2:25Speaker 1: You can use the CLI to spin up a new
- 2:26Speaker 1: console app, for instance, yep.
- 2:28Speaker 2: And it generates those basic files, the dot c Proja
- 2:31Speaker 2: project file program.
- 2:32Speaker 1: Dot cs and those bin and obj folders you see
- 2:34Speaker 1: pop up, and.
- 2:35Speaker 2: The c sharp DevKit in vs code just picks up
- 2:39Speaker 2: those solution files and knows what to do.
- 2:40Speaker 1: So the CLI is kind of the bedrock. Interacting with
- 2:43Speaker 1: the core.
- 2:44Speaker 2: Tools absolutely and understanding solutions is vital as your apps
- 2:48Speaker 2: get bigger, more complex, maybe split into different parts.
- 2:51Speaker 1: Okay, let's actually build something super basic, a console app.
- 2:54Speaker 2: Walk is through it right.
- 2:55Speaker 1: You typically use a template, right, the c shark console
- 2:58Speaker 1: app template yep.
- 3:00Speaker 2: Give it a project name.
- 3:01Speaker 1: Like hellocs, choose where to save it maybe CR twelve, dot.
- 3:05Speaker 2: Net eight, and name the solution like chapter one.
- 3:08Speaker 1: And there's that interesting option mentioned about disabling native aot publish.
- 3:13Speaker 2: Yah ahead of time compilation piles straight to machine code.
- 3:16Speaker 1: Faster startup, smaller size in some cases, but we'll park
- 3:19Speaker 1: that for now. It's covered later right.
- 3:21Speaker 2: So once you create the project.
- 3:22Speaker 1: You get this program dot cs file and it's usually
- 3:26Speaker 1: super simple at first.
- 3:27Speaker 2: Often just a comment and maybe one line of code
- 3:30Speaker 2: like console right line.
- 3:32Speaker 1: It's deliberately minimal, a clean slate.
- 3:34Speaker 2: And a good place to start poking around, like finding
- 3:38Speaker 2: out the name space of that default program class.
- 3:41Speaker 1: Oh right, the source had that snippet type of program
- 3:44Speaker 1: dot namespace.
- 3:45Speaker 2: String nameycal type of program dot namespace none, console right
- 3:50Speaker 2: line namespace dot e something like that.
- 3:52Speaker 1: Just a handy way to see how your code's.
- 3:54Speaker 2: Organized, definitely, and you can take that further, get environment
- 3:57Speaker 2: info like the current director jarn director yeah, or the OS.
- 3:59Speaker 1: Version environment do OS version version string in that name space.
- 4:03Speaker 2: Again, just useful for seeing where your code is actually running.
- 4:07Speaker 2: Good for debugging, like.
- 4:08Speaker 1: A quick health check of the environment.
- 4:10Speaker 2: Exactly what OSM I on? Where are my files? Useful stuff.
- 4:15Speaker 1: One last dev environment tip. They mentioned inline hints or
- 4:19Speaker 1: inlay hints.
- 4:20Speaker 2: Oh, those are great little reminders right in the code.
- 4:23Speaker 1: Yeah, they show the parameter names when you're calling a method, so.
- 4:25Speaker 2: You don't have to keep jumping back to the definition exactly.
- 4:28Speaker 1: Saves a lot of cognitive load. You can turn them
- 4:30Speaker 1: on in VS twenty twenty two's options.
- 4:32Speaker 2: Tools, Options text Editor, c shap advanced inline hints somewhere
- 4:37Speaker 2: in there.
- 4:38Speaker 1: And in VS code you just search settings for inline hints.
- 4:40Speaker 2: Small feature, big impact on readability.
- 4:43Speaker 1: Sometimes totally agree. Okay, moving on C sharp fundamentals, grammar, vocabulary,
- 4:50Speaker 1: the building blocks.
- 4:51Speaker 2: Right, So the C shark compiler is called Roslin.
- 4:53Speaker 1: Think of Roslyn as the translator takes your C sharp.
- 4:56Speaker 2: And turns it into intermediate language.
- 5:00Speaker 1: Which gets stored in assemblies of those DLL or ex
- 5:03Speaker 1: files YEP package code.
- 5:05Speaker 2: Then the dot Net run times Virtual Machine core CLR
- 5:08Speaker 2: that's the engine kinda it uses it just in time,
- 5:11Speaker 2: or JIT compiler.
- 5:13Speaker 1: Which translates that IL into.
- 5:15Speaker 2: Native CPU instructions. The stuff your actual process or understands
- 5:19Speaker 2: happens at runtime.
- 5:20Speaker 1: So C sharp to IL with Roslin, then IL to
- 5:23Speaker 1: native code with the JIT and core CLR.
- 5:26Speaker 2: You got it. It's a neat separation. Let's see sharp
- 5:28Speaker 2: evolve kind of independently from the runtime details helps with
- 5:32Speaker 2: cross platform two makes sense.
- 5:34Speaker 1: Now, C sharp grammar, we're talking statements.
- 5:38Speaker 2: Blocks, code inside curly braces and comments crucial for explaining things.
- 5:44Speaker 2: But the advice is, yeah, the implicitly or globally imported.
- 5:47Speaker 2: Saves you typing using system or using system dot collections
- 5:51Speaker 2: generic all the time.
- 5:53Speaker 1: Where does that info live?
- 5:54Speaker 2: It's generated in that of data bug Net eight point
- 5:56Speaker 2: zero folder, usually in a dot global usings dot g
- 5:59Speaker 2: dot c s file. We're similar.
- 6:01Speaker 1: So for basic console app Microsoft dot net SDK, you
- 6:04Speaker 1: get systemsystem, dot io, system dot.
- 6:07Speaker 2: Link common stuff, and if it's a web project Microsoft
- 6:10Speaker 2: dot net sdk web you get more like asthmiccore stuff
- 6:14Speaker 2: net dot HGDP Jason.
- 6:16Speaker 1: It's just about reducing boilerplate, making common types easy to.
- 6:19Speaker 2: Access precisely, less clutter, focus on your.
- 6:21Speaker 1: Logic, and finally literals simple concepts.
- 6:24Speaker 2: Yeah, just the way you write fixed values directly in
- 6:26Speaker 2: your code, like the number.
- 6:27Speaker 1: One, two, three, or the text hello or true.
- 6:30Speaker 2: False, exactly the raw value itself written in the source.
- 6:33Speaker 1: All right, let's talk about scoring different kinds of data,
- 6:36Speaker 1: starting with texts.
- 6:37Speaker 2: Okay, so the basic unit is char for a single character.
- 6:40Speaker 1: But there's a catch with unicode.
- 6:42Speaker 2: Uh huh. Some characters, especially emojis, are less common. Symbols
- 6:46Speaker 2: might actually need two char values called surrogate.
- 6:49Speaker 1: Pairs, so one visual character doesn't always equal one char variable.
- 6:53Speaker 2: Exactly something to be aware of if you're doing low
- 6:55Speaker 2: level text manipulation. Got to handle Unicode properly.
- 6:59Speaker 1: Good point.
- 7:00Speaker 2: What about numbers, lots of options. For whole numbers, you've
- 7:03Speaker 2: got integers, int is common handles positive and negative, int
- 7:07Speaker 2: is unsigned only.
- 7:08Speaker 1: Positive, and for numbers with decimal points.
- 7:11Speaker 2: Floating point types float, you need an F suffix like
- 7:14Speaker 2: three point one forty f and double, which is the
- 7:17Speaker 2: default if you just right say three point one.
- 7:19Speaker 1: Four, and then there's decimal for high precision.
- 7:21Speaker 2: Right crucial for financial stuff yeh, where tiny rounding errors
- 7:25Speaker 2: are bad news. Use an M suffix like twelve point
- 7:28Speaker 2: nine to nine ter.
- 7:29Speaker 1: So the difference is memory, use range of values and
- 7:32Speaker 1: that precision.
- 7:33Speaker 2: Aspect spot on integers for whole numbers, floats doubles for
- 7:36Speaker 2: general fractional numbers, decimal for exact decimal.
- 7:39Speaker 1: Representation, and we can check their size yep.
- 7:41Speaker 2: Using the size operator tells you how many.
- 7:44Speaker 1: Bites they take up, and find their limit.
- 7:46Speaker 2: Mind value and max value properties on the types themselves,
- 7:48Speaker 2: like into dot minvalue, double dot max value.
- 7:51Speaker 1: The source had that classic point one plus point two.
- 7:53Speaker 2: Example, right, yeah, showing how double might give you point
- 7:57Speaker 2: three zero zero zero zero zero zero zero zero zero
- 8:00Speaker 2: zero four. Well, decimal gives you exactly point three. It's
- 8:04Speaker 2: because of how they store the numbers internally.
- 8:05Speaker 1: Fascinating. That precision difference is huge sometimes.
- 8:08Speaker 2: It really can be. Understanding the tradeoffs is important.
- 8:11Speaker 1: What about those huge integer types in one two eight.
- 8:14Speaker 2: H yeah, system dot in one two eight and U
- 8:16Speaker 2: twenty two eight added in dot net seven massive sixteen
- 8:19Speaker 2: byte integers.
- 8:20Speaker 1: But using size klanumum is.
- 8:22Speaker 2: Tricky, requires unsafe code and a compiler flag. Definitely an
- 8:26Speaker 2: advanced feature for specialized needs like really big numbers and calculations.
- 8:30Speaker 1: Got it back to basics. String for text.
- 8:33Speaker 2: YEP sequences of characters pretty straightforward, has a length property.
- 8:37Speaker 1: And they're immutable. Right. You can't change a string once
- 8:39Speaker 1: it's created.
- 8:40Speaker 2: Correct. Operations that look like they modify a string actually
- 8:43Speaker 2: create a new string. Important for performance if you're doing
- 8:46Speaker 2: tons of manipulation.
- 8:48Speaker 1: Okay, now var the keyword var?
- 8:50Speaker 2: Oh yeah, tech difference superhandy.
- 8:52Speaker 1: What's the compiler figure out the type exactly?
- 8:54Speaker 2: Instead of string message hi, you can just write var
- 8:56Speaker 2: message hi and.
- 8:58Speaker 1: The editor usually shows you what type it an YEP.
- 9:00Speaker 2: Hover over var and it'll tell you a string.
- 9:03Speaker 1: Makes code shorter, but maybe less explicit.
- 9:05Speaker 2: Sometimes it's a balance. Great for complex tykes where spelling
- 9:08Speaker 2: it out is noisy, but sometimes being explicit makes things clearer.
- 9:12Speaker 1: Use it wisely, right, Okay, back to console apps.
- 9:15Speaker 2: For a sec text based run from the command line.
- 9:18Speaker 1: Good for scripts, simple tools, learning.
- 9:22Speaker 2: And importantly they can take arguments from the command line.
- 9:25Speaker 1: We'll get to that first. Making the output look nice.
- 9:28Speaker 1: String formatting several ways to do it.
- 9:30Speaker 2: The classic placeholders console right line.
- 9:33Speaker 1: Name, name, age aw that style yep.
- 9:37Speaker 2: Or you can use named arguments for clarity, especially with
- 9:39Speaker 2: multiple parameters of the same type.
- 9:41Speaker 1: Like console dot right line arg one first R one
- 9:46Speaker 1: second right.
- 9:47Speaker 2: The source also mentioned boxing warnings.
- 9:50Speaker 1: Yeah said it's more unity thing less critical for general
- 9:53Speaker 1: dot net apps covered here.
- 9:54Speaker 2: Okay, big one though.
- 9:56Speaker 1: Yeah.
- 9:56Speaker 2: Culture's impact on formatting.
- 9:58Speaker 1: Oh yeah, numbers, dates, currency, They look different depending on
- 10:03Speaker 1: region settings.
- 10:04Speaker 2: Five versus doc A, comma versus dot for one thousand separators.
- 10:07Speaker 1: But you can control it.
- 10:09Speaker 2: Yeah, definitely specify a culture like culture info invariant culture
- 10:14Speaker 2: for consistent machine readable formats, or.
- 10:17Speaker 1: Use custom format strings like zero for zero, placeholder hashtag
- 10:21Speaker 1: for digit exactly.
- 10:22Speaker 2: Table two point eight in the source has details lots
- 10:25Speaker 2: of control.
- 10:26Speaker 1: There, and the easiest way often is string interpolation. The
- 10:29Speaker 1: dollar sign syntax.
- 10:30Speaker 2: Variable yep usually much cleaner. Console right line.
- 10:34Speaker 1: H reads nicely okay, nullable reference types nrts. Big change
- 10:40Speaker 1: in modern C sharp.
- 10:41Speaker 2: Huge designed to tackle those dreaded noull reference exception errors.
- 10:45Speaker 1: By adding a question mark spring right.
- 10:47Speaker 2: It tells a compiler this variable might be null, and.
- 10:50Speaker 1: The compiler then warns you if you try to use
- 10:52Speaker 1: it without checking exactly.
- 10:54Speaker 2: It performs static analysis to find potential null issues before
- 10:57Speaker 2: you run. The code makes things much safer.
- 11:00Speaker 1: But you still have to handle the null case right.
- 11:01Speaker 1: The knot is a warning system precisely.
- 11:04Speaker 2: It forces you to think about nulls, but you still
- 11:06Speaker 2: need if my string null checks or similar patterns. It
- 11:10Speaker 2: doesn't magically fixed nulls. It makes them explicit. Got it?
- 11:14Speaker 1: Okay? Command line arguments? How do we get those?
- 11:16Speaker 2: When you run your app like dot Net, run first arg, second.
- 11:19Speaker 1: Arc Those first arg second arg pieces.
- 11:21Speaker 2: They get passed into your main method as an array
- 11:24Speaker 2: of strings, usually called arcs string arcs.
- 11:26Speaker 1: So urg zero would be first RG, ARGs one would
- 11:29Speaker 1: be second arc yep.
- 11:30Speaker 2: You can move through the arg's array and use those
- 11:32Speaker 2: values to change how your app behaves. Super useful for
- 11:34Speaker 2: making tools flexible makes.
- 11:36Speaker 1: Sense, and that platform specific example, setting cursor size.
- 11:41Speaker 2: Right works on Windows throws an exception on MCLINICX A.
- 11:44Speaker 1: Good reminder that even with cross platform dot net, the
- 11:47Speaker 1: underlying OS still matters.
- 11:49Speaker 2: Sometimes absolutely, and the solution often a tricatch block.
- 11:53Speaker 1: Try to set the cursor size, catch the exception if
- 11:55Speaker 1: it fails on Linux or Mac exactly.
- 11:58Speaker 2: Graceful handling of platform difference. We'll dig more into trycatch soon.
- 12:02Speaker 1: Perfect segue. Let's move into core programming concepts, starting with operators.
- 12:06Speaker 2: Basic math, your bread butter plus AA for AD, subtract
- 12:10Speaker 2: multiplied divide and per modulo the remainder after division ten
- 12:15Speaker 2: percent three is one?
- 12:16Speaker 1: Got it? Logical operators and for a ing for R
- 12:20Speaker 1: and they have that short circuiting behavior.
- 12:22Speaker 2: Yeah, that's important. With Andy in if the left side
- 12:25Speaker 2: is false, it doesn't even look at the right.
- 12:27Speaker 1: Side because the whole thing must be false anyway, right And.
- 12:30Speaker 2: With Andy and if the left side is true, it
- 12:32Speaker 2: skips the right side because the whole thing must be true.
- 12:35Speaker 1: Good for performance avoids unnecessary.
- 12:37Speaker 2: Work usually, but be careful if the right side expression
- 12:42Speaker 2: has side effects you rely on happening.
- 12:45Speaker 1: Like calling a function that's supposed to always log something
- 12:48Speaker 1: it might get skipped exactly.
- 12:50Speaker 2: Can lead to subtle bugs, something to be aware of, okay.
- 12:53Speaker 1: Making decisions.
- 12:55Speaker 2: Switch statements a way to handle multiple choices based on
- 12:58Speaker 2: a single value, cleaner than lots of if l's ifs.
- 13:02Speaker 1: Sometimes you have case labels for specific values, a default
- 13:05Speaker 1: case for everything else, and C shark allows go to
- 13:08Speaker 1: within a switch jump to other cases.
- 13:10Speaker 2: It does. Yeah, use with caution, though can make code
- 13:14Speaker 2: harder to follow if overused.
- 13:16Speaker 1: Right and then There are switch expressions in newer C
- 13:18Speaker 1: sharp versions.
- 13:19Speaker 2: Yeah, C sharp eight onwards. More concise, often more powerful,
- 13:23Speaker 2: especially with pattern matching.
- 13:25Speaker 1: That example with animals was cool checking the type and properties.
- 13:28Speaker 2: Cat four legged cat when four leggd cat legs equals.
- 13:31Speaker 1: Four that kind of thing, or just matching the type
- 13:33Speaker 1: cat cat or property pattern spider spider when Spider's poisonous.
- 13:37Speaker 2: Handling null using the discard as a default, very expressive,
- 13:42Speaker 2: often leads to cleaner code for complex conditions.
- 13:44Speaker 1: Definitely looks more functional, more declarative.
- 13:47Speaker 2: It leans that way, Yeah, okay. Storing collections a raise
- 13:51Speaker 2: the basic fix size collection string names, new string three.
- 13:55Speaker 1: Create space for three strings, access them with indices starting
- 13:59Speaker 1: at zero always.
- 14:00Speaker 2: Zero based name zero, names one, names two.
- 14:04Speaker 1: And loop through them with a four loop and the
- 14:06Speaker 1: link property.
- 14:08Speaker 2: I names length iplus plus new names standard stuff.
- 14:12Speaker 1: What about those inline arrays and c share twelve ah
- 14:16Speaker 1: more of.
- 14:16Speaker 2: An advanced behind the scenes performance thing for the runtime team.
- 14:19Speaker 1: Mostly so not something you typically declare yourself in application code.
- 14:23Speaker 2: Probably not directly no, but you might benefit from libraries
- 14:26Speaker 2: using them under the hood. There's a link if you
- 14:28Speaker 2: want the deep dive on those.
- 14:30Speaker 1: Gotcha and formatting output again.
- 14:32Speaker 2: Aligning column yeah, index alignment yeah, like zero zero twelve
- 14:35Speaker 2: pads with spaces to align right in a twelve.
- 14:38Speaker 1: Character call, and showing binary index ed format string.
- 14:41Speaker 2: Like zero three four point b three two shows a
- 14:44Speaker 2: number is thirty two bits. Binary representation potentially padded useful
- 14:49Speaker 2: for low level inspection.
- 14:50Speaker 1: Okay, getting data in parsing strings to numbers.
- 14:54Speaker 2: Or dates, big parse, daytime dot parse common methods, but they.
- 14:58Speaker 1: Can fail throw exceptions at the string. Isn't it right?
- 15:00Speaker 2: Yep, format exception. That's why culture matters too, cultureinfo dot
- 15:04Speaker 2: invariant culture to avoid nasty surprises with different date or
- 15:08Speaker 2: number formats.
- 15:09Speaker 1: So the safer way is tripars.
- 15:12Speaker 2: Generally yes. In trpars input string out in a result,
- 15:16Speaker 2: it returns true or.
- 15:17Speaker 1: False, true if it worked, and the result variable gets.
- 15:19Speaker 2: The value false if it failed, and result gets a
- 15:22Speaker 2: default value like zero for end no exception thrown.
- 15:25Speaker 1: Much cleaner for handling potentially bad user input avoids the
- 15:28Speaker 1: overhead of exceptions for expected failures.
- 15:30Speaker 2: Exactly use pars when you're sure the input is valid.
- 15:33Speaker 2: Trypars when it might not be.
- 15:35Speaker 1: And if parse does thrown exception or something else goes wrong.
- 15:39Speaker 1: That's where tricatch finally comes in.
- 15:40Speaker 2: Right wrap the risky code in try.
- 15:43Speaker 1: Handle specific errors in catch format exception x or.
- 15:46Speaker 2: More general errors in catch. Oh, I say, and use
- 15:49Speaker 2: finally for cleanup. Code that always.
- 15:51Speaker 1: Runs, always runs, whether an exception happen or not, whether
- 15:55Speaker 1: it's caught or not. Good for releasing resources like closing files.
- 15:59Speaker 1: Essential for robust code.
- 16:01Speaker 2: Okay, integer overflow numbers getting too.
- 16:03Speaker 1: Big Yeah by default se sharp injurer math is unchecked.
- 16:08Speaker 1: If indemac's value plus one happens, it wraps around silently
- 16:12Speaker 1: to int men value.
- 16:13Speaker 2: Which can cause very weird bugs.
- 16:15Speaker 1: Totally, so you can use the checked keyword.
- 16:18Speaker 2: Either as a block yeah result large number one plus
- 16:21Speaker 2: large numb.
- 16:22Speaker 1: Two, or as compiler option for the whole project.
- 16:24Speaker 2: And if overflow happens inside a checked context.
- 16:27Speaker 1: It throws an overflow exception instead of wrapping silently makes
- 16:30Speaker 1: the error obvious.
- 16:31Speaker 2: There's a slight performance cost, but often worth it for correctness.
- 16:34Speaker 1: Definitely something to consider, especially with financial or critical calculations.
- 16:39Speaker 1: All right, getting near the end functions or methods in
- 16:43Speaker 1: C sharp reusable blocks of code key for organization. The
- 16:47Speaker 1: example was time stable took a required number.
- 16:50Speaker 2: And an optional sized parameter with a default value void.
- 16:53Speaker 2: Time stable INNT number in size.
- 16:55Speaker 1: Is twelve, meaning you can call it with just the
- 16:57Speaker 1: number time stable five and size default.
- 17:00Speaker 2: To twelve, or provide both time stable five twenty.
- 17:03Speaker 1: And using named arguments makes calls clearer. Time stable number
- 17:07Speaker 1: five size twenty.
- 17:09Speaker 2: Especially useful when there are multiple optional parameters or parameters
- 17:13Speaker 2: of the same type. Improves readability quick terminology.
- 17:16Speaker 1: Check parameter versus argument.
- 17:19Speaker 2: Parameter is the variable in the function definition in number
- 17:21Speaker 2: in size. Argument is the actual value passed in when
- 17:24Speaker 2: you call the function five twenty.
- 17:26Speaker 1: Got it and functions can return values too.
- 17:28Speaker 2: Of course, the calculator tax example took an amount and reagencode.
- 17:31Speaker 1: Used to switch expression based on the region.
- 17:33Speaker 2: And return the calculated decimal tax value return calculated tax.
- 17:38Speaker 1: Perfect for encapsulating a calculation.
- 17:40Speaker 2: Or rule absolutely and documenting these functions.
- 17:42Speaker 1: XML comments Yeah, those triple slash comments summary summary editors.
- 17:48Speaker 2: Pick those up and show them as tooltips when you're
- 17:50Speaker 2: calling the function.
- 17:51Speaker 1: Explains what it does, parameters, return value. Huge help for maintainability,
- 17:56Speaker 1: good practice definitely.
- 17:58Speaker 2: Lastly, that decline larrative versus imperative style comparison.
- 18:02Speaker 1: Using the Fibonacci sequence.
- 18:04Speaker 2: Fib functional usercursion and a switch expression describing what fibonacci is.
- 18:08Speaker 1: While fib imperative used a loop describing how to calculate
- 18:11Speaker 1: it step by step.
- 18:12Speaker 2: Just shows there are different ways to think about and
- 18:14Speaker 2: solve problems in code. Neither is always better, depends on
- 18:17Speaker 2: the context.
- 18:17Speaker 1: A good illustration of different paradigms yep.
- 18:20Speaker 2: Functional style often emphasizes immutability in expressions. Imperative focuses on
- 18:25Speaker 2: mutable state and step by step instructions. Wow.
- 18:28Speaker 1: Okay, that was quite the journey through the fundamentals.
- 18:30Speaker 2: We covered a lot. Setting up the environment vs versus
- 18:33Speaker 2: vs code.
- 18:33Speaker 1: See shirt grammar, Roslin, il jit, data types like char, int, decimal, string, Nobel.
- 18:42Speaker 2: Types, operators, switch statements and expressions, arrays, parsing, exception handling
- 18:47Speaker 2: with trycatch.
- 18:48Speaker 1: Checked overflow, basic functions, parameters versus arguments, returning values, XML comments,
- 18:55Speaker 1: and even a peak at programming styles.
- 18:57Speaker 2: Phew. Yeah, these really are the core building blocks you
- 19:00Speaker 2: need for getting started with c SHAR twelve and dot
- 19:03Speaker 2: net eight.
- 19:04Speaker 1: Having a solid grasp of this stuff is just crucial
- 19:07Speaker 1: for building anything substantial and reliable.
- 19:09Speaker 2: Couldn't agree more. It's the foundation for everything else.
- 19:11Speaker 1: So as you the listener, continue exploring this, maybe something
- 19:16Speaker 1: specific caught your ear.
- 19:18Speaker 2: Perhaps nullable reference types, or you want to know more
- 19:21Speaker 2: about collection types beyond arrays like lists or dictionaries, or maybe.
- 19:26Speaker 1: The details of the Roslin compiler or the subtleties of
- 19:28Speaker 1: decimal versus double.
- 19:29Speaker 2: Yeah, the point is mastering these fundamentals really opens the
- 19:33Speaker 2: door to the more advanced, powerful features of dot net, so.
- 19:36Speaker 1: We definitely encourage you dive deeper. Check out the links,
- 19:40Speaker 1: explore the official documentation. This platform is incredibly rich and
- 19:44Speaker 1: constantly evolving. There's always more to learn.