Whether you're still learning C# or you already have some experience, it's sometimes hard to know what you don't know. This course is designed to short-circuit your C# learning and provides a whole host of useful information about the sometimes under-used or unknown features of both the C# language and the .Net framework. It's suitable for those who are brand new to C# as well as experienced developers looking to "round off" their C# skills and "fill in the gaps".
Part I Hi, I'm Jason Roberts from Pluralsight. Welcome to this course on C# Tips and Traps. In this course, we'll be covering a smorgasbord of useful and sometimes unknown or underused features of the C# language and the. NET Framework. We'll also look at some common mistakes or traps and how to avoid them. In part one of this course, we'll look at how to customize the display of values in the debugger, how to control whether members are displayed in the debugger, how to use the null-coalescing operator, the danger of making virtual message calls from inside constructors. We'll look at the caller information attributes and how they can simplify our code. We'll take a look at both partial types and partial methods. We'll have a look at how we can perform Runtime conversions where we don't know the type in advance. And we'll look at how we can expose our internal types and members to other friend assemblies.
Part II Hi, welcome back to Part 2 of C# Tips and Traps. In this module, we'll look at how to simplify null and empty string checking code. We'll look at a simple gotcha when using DateTime. MinValue to represent null dates. We'll learn about conditional preprocessor directives and how to emit our own compiler errors and warnings. We'll learn how to test for the validity of a Unicode character. We'll see how we can change the current thread's culture at Runtime to facilitate testing of culture-sensitive code. We'll take a look at creating random numbers and what to do if we need to create random numbers for security applications. We'll learn about tuples and how we can use them to reduce the amount of classes we may need to write. We'll learn how we can force the checking of reference equality as opposed to value equality. We'll take a look at what happens if our objects' hash codes change after they've been added to a dictionary. And we'll look at how to create and use combinable enums. So let's get stuck in.
Part III Hi, welcome to Part III of C# Tips and Traps. In this module, we'll look at conditional formatting for positive, negative, and 0 numbers. We'll look at how we can mark code as obsolete to tell callers that it should be used and may be removed in future versions. We'll learn how we can avoid the reevaluation of LINQ queries and how we can launch arbitrary programs and capture their output. We'll look at some of the useful static methods of the Array class and we'll see how we can copy, clone, and resize arrays. We'll learn how we can simplify the initialization of rectangular and jagged multidimensional arrays and how we can preserve our stacktrace information when we throw exceptions from inside our catch block.
Part IV Hi. Welcome back to Part IV of C# Tips and Traps. In this module, we're going to look at parsing numeric types using the NumberStyles enumeration, how we can prevent the ambiguous parsing of DateTimes, and how we can avoid DateTime misparsing using culture- independent strings. We'll look at parsing DateTimes with the DateTimeStyles enumeration and how to convert some of the base types to arrays of bytes. We'll also learn when to use the As operator or when to stick with casting when converting between types. We'll see how we can exit loops early and how we can short circuit the current iteration and start on the next one. Finally, we'll look at what we need to consider when we're working with optional parameters in public API methods.
Part V Hi. Welcome back to Part V of C# Tips and Traps. In this module, we'll be looking at how to replace temporary collections by using the Yield statement, how to create aliases for types, and how to resolve the situation where two different types have been defined with the same name and the same namespace in external assemblies. We'll learn how we can more efficiently store arrays of Boolean values and how we can represent arbitrarily large integer values. We'll also learn how we can create and use custom format providers to format our data when using composite format strings.
Part VI Hi. Welcome to Part VI of C# Tips and Traps. In this module, we'll learn about how to conditionally execute methods based on compilation symbols. We'll learn how to use the conditional operator and how to make working with paths easier. We'll look at how we can format and align values into columns and we'll learn how to specify methods that take an arbitrary number of arguments. We'll also look at how we can simplify constructor overloads by chaining them together and how we can find out information about the current system and platform. Finally, we'll look at how we can implement indexes in our classes.