|
所在平台: Udemy |
课程主页: https://www.udemy.com/course/csharp-nullreferenceexception-demystified/
课程评论:没有评论
C# NullReferenceException 疑难解答课程总结 本课程旨在帮助 C# 开发者摆脱令人头疼的 "Object reference not set to an instance of an object."(对象引用未设置为对象实例)异常。这被称为“十亿美元的错误”,在不同规模和复杂度的代码库中普遍存在,并常常迫使开发者耗费大量时间使用调试器逐行检查代码。 通过本课程(时长约 1 小时 5 分钟),您将学会: * 理解 NullReferenceException 何时会被抛出。 * 使用可空运算符(Nullable Operators)简化空值检查。 * 通过可空引用(Nullable References)识别有问题的代码块。 * 采用 Option 类型作为可空引用的替代方案。 * 安全地使用 LINQ 的 FirstOrDefault 方法。 课程不要求任何专业技能,只需您熟悉声明和初始化对象,以及使用条件语句、循环和集合(如数组和列表)。学完课程后,您将能够编写无 NullReferenceException 的代码。
"Object reference not set to an instance of an object."If you have found that scary exception message, you're not alone.As C# software developers, we all have found it at some point.I've found it dozens of times while working with past employers and clients on codebases of different sizes and complexities.And often when we find it, the only thing we could do is fire up the Visual Studio debugger, go through the code line by line, and inspect all parameters and variables until finding the "object reference not set..." Boring and time-consuming. Arrrggg!That's NullReferenceException in C#.The "Billion-dollar mistake."If you want to get rid of this exception from your code, this is the course for you.Learn principles, features, and strategies to say goodbye to NullReferenceException-in 1 hour and 5 minutes, to be precise.After finishing this course, you will:Understand when NullReferenceException is thrown.Use Nullable Operators to simplify null checks.Work with Nullable References to identify troublesome code blocks.Adopt the Option type as an alternative to Nullable References.Safely use LINQ FirstOrDefault method.No expertise required to write code free from the NullReferenceException.You only need to be comfortable declaring and initializing objects and working with conditionals, loops, and collections such as arrays and lists.See you in the first lesson and let's get rid of this exception once and for all.