C# for beginners - 14. Structs

  Рет қаралды 47,813

Nicholas Dingle

Nicholas Dingle

Күн бұрын

Пікірлер: 70
@hamishanderson5916
@hamishanderson5916 Жыл бұрын
Great, simple video. One thing that definitely needs to be understood is that structure are of a value type which means when you have one struct equal = struct, it is copying the actual values, not making a reference to the struct. This is the key difference between struts and classes .
@buddyroach
@buddyroach 3 жыл бұрын
this video is awesome. easy to follow and understand, high quality, great voice, charming accent, and i love the way your keyboard sounds muffled. real soothing and helps ease the mind as i watch and learn. this is perfect.
@henrychen540
@henrychen540 4 жыл бұрын
Literally the first minute answered my question "what the hell are structs?" They're your diy value types and classes are your diy reference types. AWESOMEEEEE
@AsakuraAvan
@AsakuraAvan 3 жыл бұрын
@Lincoln Wells doesn't fucking work you twat
@Spectrum16
@Spectrum16 3 жыл бұрын
@@AsakuraAvan They're bots
@shanejackson2588
@shanejackson2588 3 жыл бұрын
Sorry to be so offtopic but does anyone know of a method to log back into an instagram account?? I was dumb lost my account password. I would love any tips you can give me
@piercejake2033
@piercejake2033 3 жыл бұрын
@Shane Jackson instablaster :)
@shanejackson2588
@shanejackson2588 3 жыл бұрын
@Pierce Jake thanks for your reply. I found the site thru google and I'm trying it out now. Looks like it's gonna take a while so I will get back to you later when my account password hopefully is recovered.
@Emiya_familia
@Emiya_familia 5 жыл бұрын
After spending some time reading my lesson chapter from C# step by step, i like to look up video for better understanding. I spend an hour looking for a better understanding of struct and your video were easy to understand and helpful. keep up the good work.
@horizon6309
@horizon6309 Жыл бұрын
Thank you for making this video. Very beautiful, simple and straightforward explanation and example.
@Geri3d
@Geri3d 7 жыл бұрын
I Like your fast typing and correcting errors so fast, it dont get boring to the end and its not my language! thumbs Up
@StevenWong1995
@StevenWong1995 6 жыл бұрын
this is the simple yet informative video that explains things in programming. great work! thanks!
@sabebarker
@sabebarker 3 жыл бұрын
Exceptionally clear tutorial. Thanks heaps!
@JoelMatthews-b8n
@JoelMatthews-b8n 9 ай бұрын
Brilliant video, thank you!
@legendaryswordsman2279
@legendaryswordsman2279 2 жыл бұрын
Great tutorial, straight to the point with no bullshit, you've earned a like from me
@falcon3205
@falcon3205 7 жыл бұрын
Thank christ, someone who speaks Australian ;)
@aussieraver7182
@aussieraver7182 4 жыл бұрын
agreed
@toystoryscarymovie-forkids3323
@toystoryscarymovie-forkids3323 Жыл бұрын
best video so far on youtube on structs. ive subscribed to your channel will take further lessons on other topics from you. you are truly gifted in simplifying knowledge
@kylekeenan3485
@kylekeenan3485 2 жыл бұрын
Did I miss why you would use a struct instead of a class to represent something such as the car? What if your car would also need methods such as accelerate()?
@NITHISHKUMAR-jt9lw
@NITHISHKUMAR-jt9lw 11 ай бұрын
Hey! The video was really simple and easy to understand.
@toystoryscarymovie-forkids3323
@toystoryscarymovie-forkids3323 Жыл бұрын
from your explanations Structs are like classes without the constructor , method and without the creation of objects.
@manofmesopotamia7602
@manofmesopotamia7602 6 жыл бұрын
i really like the video, i think struct are useful if we imagine that we are trying to make a table for employees, name, salary, attendance, something like that, instead of repeating the title of the table, we make it in a struct
@rursus8354
@rursus8354 7 ай бұрын
_"struct"_ is rather than a shortened form of "structure" a notion inherited from C++, when distinguishing it from classes, and in C++ originally from C, where it is a dialectal synonym of "record", and means: _"aggregation of stuff"._ In C++ it means: _"d*rn*d class where every attribute is by default public"._ C# is naturally much smarter, and defines as _"class for value type objects"_ in contradistinction to _"class for reference type objects"._
@srijantamang4687
@srijantamang4687 2 жыл бұрын
Thanks man this really helped me in my Software Design Class. Great Video 👍
@TebogoMotlhale
@TebogoMotlhale 4 жыл бұрын
i wouldNT say you use a struct to create a "Custom" data type, i would rather say a "Compound" data type or "Composite" data type. the same thing appears to be the case about Classes to me, they always strike me as some kind of Composite/Compound data types, rather than a feature that truly allows us to create our OWN genuine custom data types. your examples and explanations going forward are amazing though , beautiful 👌👌👌👌
@digitalconsciousness
@digitalconsciousness 3 жыл бұрын
It seems that the purpose of structs might overlap some with class inheritance or class extensions, the first of which you just make a parent class inherit, the second of which is simply an abstract static class. So is there any need to use structs within either of those two options or would you just abandoned structs and just use the inheritance or extensions instead? I am hoping someone smarter than me will respond. Thanks!
@s34nTravels
@s34nTravels Жыл бұрын
- Struts are value type objects, not reference (unlike classes), so its very important to only use struts for simple data types. It will have a large memory footprint. - Can structs contain reference types? Yes, it is possible, and yes, it is usually a bad practice. If you look at the .NET framework itself, you'll see virtually all structs contain primitive value types alone. - Struct members cannot be abstract, sealed, virtual, or protected. I.e. no polymorphism (i.e. method overriding) - It's good practice to mark struts as readonly
@renijr
@renijr 6 жыл бұрын
37/5000 It was to the point, optimal explanation. tks
@AymenAbdessamad
@AymenAbdessamad Жыл бұрын
a quick question pleaase ; can we create an instance from that structure using Employee emp1 = new Employee{ name = ""; age = 444; } or not
@aussieraver7182
@aussieraver7182 2 жыл бұрын
Thanks for the tutorial. Whats the difference between creating a custom class object and a struct of a Car then? EDIT: It seems that classes use memory on the heap while structs use memory on the stack.
@s34nTravels
@s34nTravels Жыл бұрын
- Struts are value type objects, not reference (unlike classes), so its very important to only use struts for simple data types. It will have a large memory footprint. - Can structs contain reference types? Yes, it is possible, and yes, it is usually a bad practice. If you look at the .NET framework itself, you'll see virtually all structs contain primitive value types alone. - Struct members cannot be abstract, sealed, virtual, or protected. I.e. no polymorphism (i.e. method overriding) - It's good practice to mark struts as readonly
@aussieraver7182
@aussieraver7182 Жыл бұрын
@@s34nTravels Cheers for the explanation, it solidified my knowledge of it and more! I don't think I've ever had to use a struct in my role.
@s34nvideos
@s34nvideos Жыл бұрын
@@aussieraver7182 I understand. I rarely see them myself. If you want to 'contain' a few value types, they are kinda useful, but personally I mostly use them when mocking up sample stuff.
@EpicGamer63637
@EpicGamer63637 Жыл бұрын
Amazing explanation :)
@-Pedry
@-Pedry 11 ай бұрын
feel like structs are glorified classes (- the methods/functions) xd is there a performance difference?
@adsfadfadfish
@adsfadfadfish 3 жыл бұрын
Wow, great explanation!
@nandorbacso4625
@nandorbacso4625 5 жыл бұрын
Thanks mate, the very least thing I can make is to like + comment + subscribe for this amazing explanation ;)
@iknowtoomuch
@iknowtoomuch Жыл бұрын
THANK YOU!
@RavenFelman
@RavenFelman Жыл бұрын
What if i want to print all the properties that are inside a Struct?
@themaskedcondom2971
@themaskedcondom2971 2 жыл бұрын
I keep getting this error: A 'struct' with field initializers must include an explicitly declared constructor.
@LyraBones
@LyraBones 4 жыл бұрын
How can you collect values from multiple variables in different scopes to be in one struct?
@kandasamyrajan
@kandasamyrajan 5 жыл бұрын
Thanks for the excellent explanation.
@nkululekosibeko4657
@nkululekosibeko4657 Жыл бұрын
Thank you so much
@markharwood6794
@markharwood6794 8 ай бұрын
NEVER use a float to represent a money value - Use decimal or int/100 also works
@jonathanallanhermawan1737
@jonathanallanhermawan1737 3 ай бұрын
Thank you mann
@fruit.8302
@fruit.8302 4 жыл бұрын
Australian coder? Rarest kind out there!
@tomsawyer1799
@tomsawyer1799 5 жыл бұрын
So if we started creating some employees the person has to go into the code, create a new object for a new employee and recompile? 🤔
@henrychen540
@henrychen540 4 жыл бұрын
Right but that info isn't exactly protected well, since it can be changed since it is a reference type. A new employee should have its own constant and immutable name, function, and id for example. That is where structs are incredibly useful.
@WirtyDord
@WirtyDord 5 жыл бұрын
Anyone familiar with Unity, is this basically the same as a Scriptable Object? I've been learning about those recently and it sounds exactly the same to me. I understand that a Scriptable Object would get it's own script rather than be embedded in another script, but is that the only difference?
@CustardCream33
@CustardCream33 4 жыл бұрын
I'm sure you've found out the answer by now, but for anyone new wondering the same thing: Structs and ScriptableObjects are not the same. ScriptableObjects inherit from UnityEngine.Object and so are subclasses. This means they are used with references. This makes it more work to create a new copy of them. Structs on the other hand, are easy to create copies of, as seen in this video. Hope this helps anyone.
@nmana9759
@nmana9759 3 жыл бұрын
what's the difference between struct type and the normal set get method ? I see no difference in them
@chainjail924
@chainjail924 2 жыл бұрын
YEAH THATS WHAT I THOUGHT
@riskemer3621
@riskemer3621 4 жыл бұрын
thanks for the help
@Popart-xh2fd
@Popart-xh2fd 3 жыл бұрын
Struct = Structures right?
@LIONSKI420
@LIONSKI420 5 жыл бұрын
WHAT A KEYBOARD IS IT
@bedouinangel
@bedouinangel 4 жыл бұрын
short informative video
@bbdesign5400
@bbdesign5400 6 жыл бұрын
Thanks!
@JRW-FSDev
@JRW-FSDev Жыл бұрын
Not explaining the difference between a struct and a class seems like a big missing from this explanation.
@longjohn7992
@longjohn7992 3 жыл бұрын
Soo.... A Class but without methods?
@ivandagiant
@ivandagiant 3 жыл бұрын
Yeah that’s what is confusing me. These seem like classes to me
@GamingBeast3
@GamingBeast3 7 жыл бұрын
Can you explain me this line of code please it's in vb.net Regex.Replace("ThisIsACamelCaseString", "([a-z](?=[A-Z])|[A-Z](?=[A-Z][a-z]))", "$1 ")
@NicholasDingle
@NicholasDingle 7 жыл бұрын
Regular Expressions are the sort of thing that I constantly have to relearn because I forgot it all. There are heaps of resources for learning regex on the web.
@GamingBeast3
@GamingBeast3 7 жыл бұрын
Nicholas Dingle okay thanks
@muhammadarifkhan951
@muhammadarifkhan951 7 жыл бұрын
sir im muhammad ARIF FROM PAKISTAN IM STUDENT C# PROGRAMMING LANGUAGES I WANTS ITS PLZ HELP ME
@takkjjxap
@takkjjxap Жыл бұрын
I hate youtube too much ads
@Dusthorn
@Dusthorn 2 жыл бұрын
Float for price 🤦‍♀️
@JohnK68
@JohnK68 Жыл бұрын
Banging on a keyboard NOT COOL!!!
C# for beginners - 15. Arrays (Part 1/2)
16:31
Nicholas Dingle
Рет қаралды 4,7 М.
This dad wins Halloween! 🎃💀
01:00
Justin Flom
Рет қаралды 40 МЛН
Elza love to eat chiken🍗⚡ #dog #pets
00:17
ElzaDog
Рет қаралды 13 МЛН
Most Useful Constructs Across Programming Languages
8:33
Kantan Coding
Рет қаралды 56 М.
9.11 Structs - Learning C#
5:54
ParametricCamp
Рет қаралды 1,4 М.
C# Enums for beginners
8:34
tutorialsEU - C#
Рет қаралды 9 М.
C# Value vs Reference Types Explained
6:40
Mark Inman
Рет қаралды 4 М.
CLASSES vs STRUCTS in C++
8:32
The Cherno
Рет қаралды 473 М.
Naming Things in Code
7:25
CodeAesthetic
Рет қаралды 2,2 МЛН
Getters & Setters | C# | Tutorial 28
12:09
Giraffe Academy
Рет қаралды 194 М.
C structs 🏠
4:12
Bro Code
Рет қаралды 210 М.