C# Equality and Hashcodes

  Рет қаралды 8,555

Coding Tutorials

Coding Tutorials

Күн бұрын

Пікірлер: 41
@CodingTutorialsAreGo
@CodingTutorialsAreGo 4 жыл бұрын
Any more of these fundamentals you'd like to know? Just ask. Source code at: github.com/JasperKent/Equality-And-Hashcodes Don't forget to subscribe at kzbin.info/door/qWQzlUDdllnLmtgfSgYTCA And if you liked it, click the 👍.
@tanmaymishra92
@tanmaymishra92 3 жыл бұрын
The answer i was looking for - 7:51 , thank you very much
@tore28
@tore28 3 ай бұрын
Sort of like a "stamp" or like a "MD5" hash of a file - it is a unique identifier ignoring that there might be theoretically hash collisions (which MD5 got)
@davidamour4501
@davidamour4501 3 жыл бұрын
I've watched a lot of tutorials over the years and this is one of the best. Very clear, thorough and easy to follow.
@CodingTutorialsAreGo
@CodingTutorialsAreGo 3 жыл бұрын
Many thanks.
@carlscotney3873
@carlscotney3873 3 жыл бұрын
Just encountered this channel in a recommendation and I haven't looked back since. I've been deep in learning C#/Dotnet for about 18 months now and you seem to have explained so simply almost every little 'hmmm?' moment I've had in the optimal level of detail! Great channel. Thank you so much for taking the time to produce this content.
@insigpilot
@insigpilot 2 жыл бұрын
Lessons like this will take my skills to the next level. Thanks mate!
@wowDepressive
@wowDepressive Жыл бұрын
Excellent! thank you very much. Love your thorough and relevant approach. covers a lot of the subject
@88spaces
@88spaces 2 жыл бұрын
I've been looking for a video like this for a while that explains why you need to coordinate Equals and GetHashCode. I'm glad I found yours because it explains it perfectly. Thank you. BTW, Amazon quizzes you about hashes until you're hashed out so this is a good primer for their technical interview.
@AndrewAndZz
@AndrewAndZz Жыл бұрын
Very clear and great-structured explanation of such an important concept in .NET! Thank you a lot indeed, Jasper! 👏
@LuciferTheBloody
@LuciferTheBloody 2 жыл бұрын
Wow this was very informative, clear and easy to understand. Especially good actually seeing you do it in code. Thanks!
@danixadem
@danixadem 2 жыл бұрын
very comprehensive explanation about the topic. Great work
@xavieryang1255
@xavieryang1255 2 жыл бұрын
Thank you very much for the tutorial. You made everything crystal clear!
@peternguyen9382
@peternguyen9382 2 жыл бұрын
i am lucky to found your channel! thanks for hard working.
@muriilouwu
@muriilouwu 6 ай бұрын
such a good explanation about hashcodes, thanks!
@niranjannt637
@niranjannt637 2 жыл бұрын
Awesome explanation!!! Loved it.
@eslammahfouz
@eslammahfouz 2 жыл бұрын
Great explaination, thanks sir.
@tiburciolapanak
@tiburciolapanak 3 жыл бұрын
this is how you would know if someone is really an expert
@paxvostrum4824
@paxvostrum4824 3 жыл бұрын
also when someone looks like a professor and has books about Lenin (lower left corner)
@corso321
@corso321 2 жыл бұрын
Well explained. I'm impressed.
@erthill2269
@erthill2269 2 жыл бұрын
That was very helpful, thank you!
@IBITZEE
@IBITZEE 3 жыл бұрын
very interesting the information you are showing... not so easy to find it so complete in other channels... but please... declare the variables with "var v = new " to unclutter the code you are showing...
@TrotterSoccer
@TrotterSoccer 25 күн бұрын
Interesting shelf, and a picture says a lot: "CSS", "Java", "WPF" - but not on the unreadable top shelf. "Christianity", "Histories", "Jewish Antiquities" on the next one. "Alexander", "War in the East" and more next. Life is not just code. That's nice.
@CodingTutorialsAreGo
@CodingTutorialsAreGo 24 күн бұрын
Top shelf is my own novels.
@TwinbeeUK
@TwinbeeUK 2 жыл бұрын
Excellent tutorial! A shame C# doesn't easily allow you to use long (rather than int) hash codes by default as that's far less likely to have clashes between objects. Btw, at 23:45 you create a string and get different hash codes on successive runs. However at 11:40, the two strings you created always produced the same hash code, even on following runs. What gives? EDIT: Ah, to answer my own question, the version where the string produces a different hash code on different runs is due to it being under .NET Core instead of .NET Framework (the latter always produces the same hash code). They both work a bit differently it would seem!
@CodingTutorialsAreGo
@CodingTutorialsAreGo 2 жыл бұрын
Exactly the answer I would have given :)
@TwinbeeUK
@TwinbeeUK 2 жыл бұрын
@@CodingTutorialsAreGo Doing some research, it appears the reason for Microsoft's change in .NET Core is due to help security (hackers can potentially exploit the code if they know the hashing algorithm with .NET Framework).
@Schnickalodeon
@Schnickalodeon 3 жыл бұрын
I just want to thank you for your content :) you are amazing :)
@CodingTutorialsAreGo
@CodingTutorialsAreGo 3 жыл бұрын
Cheers!
@RiversJ
@RiversJ Жыл бұрын
Eh? If the x and y swapped produces the same hashcode then it could change behaviour if you're using hashsets to check if you already have something added to a list for example without using list.contains.
@CodingTutorialsAreGo
@CodingTutorialsAreGo Жыл бұрын
No, because a matching hash only give a higher probability of equality. Whenever hashes match, it should always be confirmed by an exact equality check. That said, a hashing algorithm that produces different results when the values are swapped would be better. Use HashCode.Combine.
@davidbrookoliver
@davidbrookoliver 2 жыл бұрын
Thanks for that man, helped a lot.
@hugodufort3573
@hugodufort3573 2 жыл бұрын
Thanks, that was very clear!
@theoceandragongaming
@theoceandragongaming Жыл бұрын
What an explanation.
@FatihTurkerFatih
@FatihTurkerFatih 2 жыл бұрын
Wow ! well done sir
@rishabhmehta2416
@rishabhmehta2416 2 жыл бұрын
Thank you so much
@salvatoreamaddio2983
@salvatoreamaddio2983 2 жыл бұрын
My Hero
@finwwwfinwww4669
@finwwwfinwww4669 2 жыл бұрын
You are awesome
@bashirmanafikhi
@bashirmanafikhi 2 жыл бұрын
wow ♥
C# Delegates and Lambdas
19:07
Coding Tutorials
Рет қаралды 4 М.
C# Value Types and Reference Types
32:49
Coding Tutorials
Рет қаралды 5 М.
It’s all not real
00:15
V.A. show / Магика
Рет қаралды 20 МЛН
黑天使只对C罗有感觉#short #angel #clown
00:39
Super Beauty team
Рет қаралды 36 МЛН
We Attempted The Impossible 😱
00:54
Topper Guild
Рет қаралды 56 МЛН
It works #beatbox #tiktok
00:34
BeatboxJCOP
Рет қаралды 41 МЛН
Stackalloc and Spans
30:17
Coding Tutorials
Рет қаралды 12 М.
C# Covariance
17:27
Coding Tutorials
Рет қаралды 8 М.
.NET Boxing (And Unboxing)
15:19
Coding Tutorials
Рет қаралды 1,8 М.
Dependency Injection, The Best Pattern
13:16
CodeAesthetic
Рет қаралды 907 М.
Here Is When HashSet & Dictionary Call GetHashCode and Equals
7:32
Zoran Horvat
Рет қаралды 1,4 М.
3 Ways To Avoid Deadlocks In C# Asynchronous Programming (2024)
13:45
C# Yield Return: What is it and how does it work?
15:09
Brian Lagunas
Рет қаралды 58 М.
.NET Core Garbage Collection
14:54
Coding Tutorials
Рет қаралды 25 М.
C# Source Generators Tutorial
48:58
Raw Coding
Рет қаралды 26 М.
It’s all not real
00:15
V.A. show / Магика
Рет қаралды 20 МЛН