I am a fairly advanced C#/C++ Software Engineer and I really enjoy your teaching style. You teach like you are speaking to a beginner and you are very professional, flexible and articulate. Plus I do not feel like I am being talked down to like some of the other you tube channels. Thanks again for a great video!
@IAmTimCorey2 жыл бұрын
You're very welcome!
@efexzium2 жыл бұрын
That’s the best way of teaching. That’s how I love to do it.
@stefano_schmidt2 жыл бұрын
is there any chance to get a job and code with vsCode instead of Visual Studio? I'm a self-student, learning C#, and I don't really like using Ide. Cause of that, I'm gonna change the language I learning. (I know it sounds quite silly). What environment do you use?
@poloska94712 жыл бұрын
@@stefano_schmidt do you and however you want to approach programming that is how you will ultimately approach it, but imo - I advise against this mentality because if/when you do get a job, your employer may very well require you to use a certain set of technologies that you have no say in (including frameworks, languages, 3rd party services, and IDEs and SDKs, and potentially even operating systems). Some companies are relaxed on this while others are not, and etc… although it is a “to each his own” sort of thing, I highly recommend being as technology-agnostic as possible when learning and becoming a developer, and by that I mean you should be able to get down with whatever technology or tech-related task there is to accomplish an outcome… remember, software development is about problem solving, not about coding… code is merely the facilitation of the problem’s solution, not the fundamental activity for which you are necessarily employed. There is a famous saying in Russia about this “for a bad dancer, even his balls get in the way”.
@tosinakinyemi39482 жыл бұрын
To be honest at first I was like why should I watch 1 hour video on NULL but at last I am glad I did, cos it was insightful and it bring clarity to the subject. Thank you Tim.
@IAmTimCorey2 жыл бұрын
I am glad it was so helpful.
@ivetaivanova16009 ай бұрын
Everything anyone would want to know about null in C# 6+ at one place, thank you so much for the great content :)
@IAmTimCorey9 ай бұрын
You are welcome.
@mrsajjad302 жыл бұрын
After watching this video, for me "What are nullables?" CHAPTER has been CLOSED. Thank you Mr. Tim Corey.👍
@IAmTimCorey2 жыл бұрын
Excellent!
@cisip2 жыл бұрын
This is awesome Tim! Big help for my migration to .Net6. I’ve been seeing a lot of null-related warnings and this answers a lot (if not all) of my questions. Thank you very much!!
@IAmTimCorey2 жыл бұрын
I am glad it was so helpful.
@stef25282 жыл бұрын
Learned from you something new though beeing a 30 years professional just coming back to C# after a while. Your stye is awesome. Thank you!
@IAmTimCorey2 жыл бұрын
You are welcome.
@alex.rusnak Жыл бұрын
Good tutorial on nullable things in C#! Will recommend to my team migrating big project to .NET 6.
@IAmTimCorey Жыл бұрын
Thank you!
@KnowlegeStream2 жыл бұрын
Thanks for your valuable video . i was recently started working on .Net 6 C# i came across these warning which were new to me. i did search and use only ? and ! operators. now i can do more and with confidence after this. Thanks once again.
@IAmTimCorey2 жыл бұрын
You are welcome. I’m glad it was so helpful.
@lucazl2 жыл бұрын
Me: Is confused on a subject Tim: Uploads a tutorial on that subject
@IAmTimCorey2 жыл бұрын
I am glad it was so helpful.
@Terminator0909092 жыл бұрын
Didn't know I can watch a video about nothing for an hour xD! Was wondering what they did with the IDE because all these null warnings were driving me crazy, thanks for a very well explanation and making better coders of us all!
@IAmTimCorey2 жыл бұрын
I am glad it was so helpful.
@pqners2 жыл бұрын
Great video! Refactored a lot of my actual project with ??= and the null forgiving operator. Can't wait for the next sale on your website I will buy a lot of courses.
@IAmTimCorey2 жыл бұрын
I am glad it was so helpful.
@sebastianweise47902 жыл бұрын
Im slowly getting into c# in the next months and years(all im good at right now is PS). I will probably dig through alot of your videos, thank you alot for the effort and time you put into this!! It is indeed great times when it comes to soaking up knowledge and learning when there is a will! Thanks again, you rock!
@IAmTimCorey2 жыл бұрын
You are welcome.
@fanpeter-z3c2 жыл бұрын
thanks man , this is really an all-in-one tutorial that I have been looking for!
@IAmTimCorey2 жыл бұрын
You are welcome.
@iancarr39232 жыл бұрын
Thanks!
@IAmTimCorey2 жыл бұрын
Thank you!
@maryambibi9687 Жыл бұрын
Hi please make a tutorial full on c# basics in depth . I like your way of teaching style.
@MukundanMA2 жыл бұрын
Love your videos as they are very comprehensive and very nicely explained. Thanks a lot.
@IAmTimCorey2 жыл бұрын
You are welcome.
@Terminator0909092 жыл бұрын
Thanks
@IAmTimCorey2 жыл бұрын
Thank you!
@micro27432 жыл бұрын
Great Video, as Always! It is targeted at beginners, so for me it was a bit long and I skipped a lot. A shorter viodeo, just on the feaatures that are not in previous versions would have been better for me. I know you primarly target beginners, so this goes into a lot of detail they may actually need to knw. Agaain... Great Video... keep up the good work!
@IAmTimCorey2 жыл бұрын
Thanks!
@metalnotis2 жыл бұрын
Thank you Tim! Your videos are great and really helpful. I'm learning a lot from them. I'm not a software engineer nor do I work as such. I'm actually a sales rep. I wish you had posted this before last weekend. I started migrating one of my .net framework apps to net 6 on Saturday, and a lot of these warnings started to poppingup here and there. Actualy, everywhere. I've started changing some of my classes to get rid of these warnings, but still have a long way to go. So, a little bit late, but this video comes at the right time to help me out. Again, thank you very much Tim.
@IAmTimCorey2 жыл бұрын
I am glad it will be helpful.
@Pierre1O2 жыл бұрын
Know all this stuff but ??= was a surprise, thanks for the thorough handling.
@IAmTimCorey2 жыл бұрын
You are welcome.
@vssang4035 Жыл бұрын
Great video Tim! I wish this (detailed explanation on Nulls) was included in your complete C# Masterclass. I find it frustrating bc I have to go through the Masterclass and then find YT videos to get more info on a topic (I know your classes teach in layers and not all at once). Maybe add links in your paid videos (in each chapter) which point to your free YT videos? Reagardless keep up the good work!
@IAmTimCorey Жыл бұрын
I hear you, but the C# Mastercourse isn't about providing every single topic in full depth. In fact, there are a lot of places that you should go deeper. The purpose of the C# Mastercourse is to get you from knowing nothing (or wherever you are starting) to having a firm foundation in C# that you can both get a job with and also build upon to grow as a developer. There will always be more topics to learn.
@АлександрБорисов-п7ъ2 жыл бұрын
Special thanks for explaining about conditional operator! Never used it before and couldn't find answer with uncomplicated requests like "What means ? in .NET/C#?" just like you said😵
@IAmTimCorey2 жыл бұрын
You are welcome.
@UmanPC2 жыл бұрын
Another great one. Tnx, Tim
@IAmTimCorey2 жыл бұрын
You are welcome.
@swordblaster2596 Жыл бұрын
That null forgiving operator is more trouble than it's worth IMHO, I'll never use it. However, having recently started a new project in net 7, the extra null warnings and suggestions are massively improving my code and making me think about the design in ways I wasn't doing before. The resulting code is clearly better and more resilient, huge improvement from MS in that area.
@IAmTimCorey Жыл бұрын
I'm glad you are getting value out of it.
@caseyspaulding2 жыл бұрын
Thank you for making this video!
@IAmTimCorey2 жыл бұрын
You are welcome.
@emmanuelcyubahiro44152 жыл бұрын
Thanks for the video Tim - You are the best!
@IAmTimCorey2 жыл бұрын
You are welcome.
@KouroushMetal2 жыл бұрын
Perfect demonstration Tim. Thank You!
@IAmTimCorey2 жыл бұрын
You are welcome.
@coding_refactor2 жыл бұрын
Thanks I was confused about the nullable option and the operators
@IAmTimCorey2 жыл бұрын
You are welcome.
@00wiking2 жыл бұрын
Very good episode with lot of useful staff. Thanks a lot sir :)
@IAmTimCorey2 жыл бұрын
You are welcome.
@AxL28AxL2 жыл бұрын
how to create global field here to use by other methods and also how to create DI in a console app for the new Net Core?
@dasfahrer81872 жыл бұрын
Excellent explanations. Would love to see a follow-up to this covering "default" values.
@IAmTimCorey2 жыл бұрын
Thanks for the suggestion. Please add it to the list on the suggestion site so others can vote on it as well: suggestions.iamtimcorey.com/
@Toughmenchannel Жыл бұрын
Thanks for making this video.
@IAmTimCorey Жыл бұрын
You are welcome.
@phileakins14072 жыл бұрын
Thanks Tim - Just what I needed!
@IAmTimCorey2 жыл бұрын
You are welcome.
@bovineox1111 Жыл бұрын
Thanks for this video. Only 22 minutes in, hoping to get some claity on how to work with this because I am not a massive fan of doing null checks everywhere. For he most part I'd rather expect it to not be null and fine, throw me an exception if it happens to be and I'll gladly catch that and see what went on. The only good reason to do a null check is if under normal circumstances something could be null AND you can continue, which is likely what you'd want to do. I really don't want to be checking for null and throwing an exception of any kind...
@IAmTimCorey Жыл бұрын
The issue they are working to address is that unexpected null values can cause major problems in applications. In most cases, it is better to catch the issue and address it rather than just letting it crash the application. At the very least, you can log the issue before letting it crash.
@BenjaminKHelfman26 күн бұрын
At the end of this video, you give an example of getting a value from a database and make the comment that the value from the database would not be null. Could it be though? From my limited understanding, some fields in a database can be null depending on the design. Correct? If so, could I use this to check for that condition?
@IAmTimCorey23 күн бұрын
I believe in that specific case, the database column was marked as not null. But yes, you are correct that database values can be null if the design allows it to be. In that case, you would need to check for the null condition before using the property.
@refactorear2 жыл бұрын
Cool recap! 34:50 I mostly use it to set default values, especially in the builder pattern so your constructor never gets a null reference. So, if my builder has ConnectingWith(IClient client) but I don't specify it in the Build method I assign the client attribute as _client ??= new DefaultClient() or similar. 50:20 And about Nullable maybe you could have mentioned that Nullable is equal to type? for primitive types without having to dive into T. We have some very old code that uses Nullable and which will hopefully be updated eventually. Personally I dislike the ! operator, it's kind of contradictory saying "This variable could be null but here it will never be". I also kind of dislike the fact that by the time you leave the constructor every attribute must be initialized, it asks me to initialize every attribute in a builder at the constructor even if the end user (or I) will override them before using them in the Build() method. Thankfully they removed the !! operator from the NET 7 / C# 11 specs too.
@IAmTimCorey2 жыл бұрын
I'm glad you enjoyed it.
@mateuszspychaa38412 жыл бұрын
Hi Tim! Thanks for the video - I have a question about one detail. Is there any guideline for using "var" vs "new()", e.g.: PersonModel user = new(); vs var user = new PersonModel(); I'm sure it's opinion-based, and there's no real right or wrong here, but is there any way we could organize it in our heads? The fact that they're so close in purpose (conciseness) makes it hard to choose... Also, in conext of the video, what do you think about ArgumentNullException.ThrowIfNull(user);?
@IAmTimCorey2 жыл бұрын
As you said, this is an opinion but I prefer PersonModel user = new() as opposed to using var. The reason why is because code is meant to be read by humans. Seeing what the type is in front is what we are used to in most cases. It also easily communicates what we are making. That's just my thoughts, though. As for the ThrowIfNull, that's a good call in some circumstances. Just make sure you can't handle the error directly instead.
@mateuszspychaa38412 жыл бұрын
@@IAmTimCorey Thank you for the great remarks!
@niklu40382 жыл бұрын
Thank you for the explanation!
@IAmTimCorey2 жыл бұрын
You are welcome.
@jesusdelarua59952 жыл бұрын
Great video. Loved it.
@IAmTimCorey2 жыл бұрын
Thank you!
@abhishekbevinal74952 жыл бұрын
Thanks a lot tim, Really helpful...
@IAmTimCorey2 жыл бұрын
You are welcome!
@richardpearce24042 жыл бұрын
Awesome content, thank you
@IAmTimCorey2 жыл бұрын
You are welcome.
@josuemercally2 жыл бұрын
Thank you so much!!!
@IAmTimCorey2 жыл бұрын
You are welcome.
@shashankshetye197 Жыл бұрын
As per reference type logic, string ab = "ABV"; string cv = ab; ab = "NEW ab"; Console.WriteLine(ab); Console.WriteLine(cv); Expected O/P: NEW ab NEW ab Actual O/P: NEW ab ABV
@daliangilbert2 жыл бұрын
Thanks Tim! In ef core I often use: public DbSet Customers { get; set; } = null!; to avoid green underline, but may somebody have some other clue?
@IAmTimCorey2 жыл бұрын
That's not the right solution. Here you are setting the value of the property to null and then telling the compiler it is not actually null. If the DbSet can be null, make it nullable: DbSet? Customers { get; set; }
@lowkey1222 жыл бұрын
A solution I found that works for me is: public DbSet Authors => Set(); Not sure what the source was but it works quite well
@rafarvid2 жыл бұрын
Great info😊😊😊
@IAmTimCorey2 жыл бұрын
Thanks!
@brandonh51422 жыл бұрын
What about assigning default to the non-nullable reference types? For example, public string Name {get; set;} = default!; Would this still be considered a non-nullable reference type?
@IAmTimCorey2 жыл бұрын
The default value is still null for a string. So setting it to default would be null. Using the null-forgiving operator would just be lying to the compiler.
@pierreplourde2 жыл бұрын
Great lesson, thank you!
@IAmTimCorey2 жыл бұрын
You are welcome.
@eddiev92542 жыл бұрын
Great video Tim! The challenge I run into is that when working on a front-end client, I sometimes get null values from a back-end API, including for a boolean property. On the back-end they use a NoSQL which is fine with null values for any property. But on the front end I have checkboxes on the UI which require either a true or false. I'm going to give coalesing a try.
@IAmTimCorey2 жыл бұрын
Yep, that sounds like the right solution. Although, it would be good to clean up your front-end where those values are generated so that it properly gives you all of the required values.
@eddiev92542 жыл бұрын
@ghost mall thanks Ghost. Yup I've been using a view model to handle the nulls for the bool items coming from the API and converting them to false. But I'm going to try the suggestion you provided.
@eddiev92542 жыл бұрын
@@IAmTimCorey Thanks Tim. The initial values come from a third party, then to our back-end. They allow for null values, where we cannot. I really liked the 'coalesing' portion of the video, since it seems much more streamlined than the view model method I've been using.
@florent9555 Жыл бұрын
A reference type is expected to be null but now we have to tell that the compiler? Why should I tell that the compiler, I know that null is to be expected out of a reference type and I write my code around that? Sounds very strange to me, maybe I am confusing myself here.
@IAmTimCorey Жыл бұрын
It is about expectations (assumptions) in your code. By marking an object as nullable, you are saying "I'm ok with this being null sometimes". The compiler will then make sure that you have the appropriate null checks everywhere that you use that object. If you forget a place, the compiler will warn you about it. If you don't mark it as nullable, the compiler will assume that you are expecting it to be not null everywhere. It will then check to be sure that the object always has a value. If there is a place where it might not have a value, it will warn you. Null reference errors are a big problem in applications. This system allows you to more easily check for those issues at design time.
@florent9555 Жыл бұрын
@@IAmTimCorey Thanks for the clarification :)
@ΠΑΝΑΓΙΩΤΗΣΜΗΤΡΟΠΑΝΟΣ2 жыл бұрын
Hello tim! I have a question about the elvis operator ?. (null conditional operator) and null forgiving operator !. Are the following statements the same? Console.WriteLine(person?.Name); Console.WriteLine(person!.Name);
@IAmTimCorey2 жыл бұрын
No. The first one says "if person is not null, get the Name property on it, but if person is null, don't do anything." (so it will print a blank line) The second one says "I'm sure the person object is not null so don't warn me that it might be null." (if it is null, it will throw an exception)
@ivandrofly2 жыл бұрын
Can you explain the nullable generic list
@IAmTimCorey2 жыл бұрын
Thanks for the suggestion. Please add it to the list on the suggestion site so others can vote on it as well: suggestions.iamtimcorey.com/
@isen12 жыл бұрын
very good , liked it . ... As allways!
@IAmTimCorey2 жыл бұрын
Thank you!
@akangtoshi50852 жыл бұрын
Hello Tim can you please please make a video on signalR?
@IAmTimCorey2 жыл бұрын
I already did. Here is part 1: kzbin.info/www/bejne/iJK7qZKcaMd8iLc and here is part 2: kzbin.info/www/bejne/Y3vdiJpjgNyobck
@rodrigo64592 жыл бұрын
The "In-line If statement is called Ternary operator".. and yes.. dealing with nulls when you have LOTS of Models to work with dababases.. it CAN get very painfull!.. i've seen this issue dealed like: public int Id { get; set; } public string FirstName { get; set; } = null!; public string LastName { get; set; } = null!;
@IAmTimCorey2 жыл бұрын
I'm not a huge fan of lying to the compiler, but I definitely get it. I would rather see the nullable disabled for that model.
@rodrigo64592 жыл бұрын
@@IAmTimCorey indeed! Thanks to this video I changed all those = null!; to just a #nullable disabled for those entities. 👍
@JuliLukiKon Жыл бұрын
string[] explanations = {"first", "second", "third"}; string? me = explanations.Perfection(every, single, one);
@IAmTimCorey Жыл бұрын
Thank you!
@angmak7321 Жыл бұрын
One day when i make it i buy you the best steak in town.
@IAmTimCorey Жыл бұрын
I am glad it was helpful.
@RandalGJunior2 жыл бұрын
I use a ??= as a lazy loader for properties. private int? _i; public int i {get { return _i ??= doSomeCalc();}}
@IAmTimCorey2 жыл бұрын
Ah, that's a good option.
@mohammedalbosifi39752 жыл бұрын
Thank you... Pleas i want 1or 2 vedios about identity server 4
@IAmTimCorey2 жыл бұрын
Thanks for the suggestion. Please add it to the list on the suggestion site so others can vote on it as well: suggestions.iamtimcorey.com/
@Ultimate_Luki2 жыл бұрын
I dont like the forgiving operator. The entire point of these changes is to make you aware of null values and this operator just says: ignore the warnings.
@IAmTimCorey2 жыл бұрын
The compiler doesn’t always know best. That’s what it is for.
@Aaron.Aguilar2 жыл бұрын
Before the video: ??, ?, null!;
@Aaron.Aguilar2 жыл бұрын
after the video things i know now (s is not null), ??= nice