.NET 6 SDK Advanced Exploration: Attributes
1h 29mAdvanced2022-05-18
Authors

Walt Ritscher
Programmer, UI Designer, Staff Instructor at LinkedIn Learning
Course details
Attributes add metadata to your programs and allow you to annotate given types, assemblies, modules, and methods. They’re especially handy if you’re an advanced .NET developer, as they lend your code base more declarative power with the additional services of .NET tools and code libraries. In this course, senior LinkedIn Learning instructor Walt Ritscher shows you how to use predefined, standard .NET attributes as well as how to create custom attributes on your own.
Learn about the features of attributes, how they function, and why they’re such a vital part of .NET programs. Get quick tips and user tricks on annotating your code like a seasoned pro, from testing for object quality to marking your testing methods. Along the way, Walt teaches you how to create custom attributes that meet the specific needs of your projects, such as attributes for the JSON serializer, PropertyGrid and the category attribute, the BindProperty attribute, and more.
Learn about the features of attributes, how they function, and why they’re such a vital part of .NET programs. Get quick tips and user tricks on annotating your code like a seasoned pro, from testing for object quality to marking your testing methods. Along the way, Walt teaches you how to create custom attributes that meet the specific needs of your projects, such as attributes for the JSON serializer, PropertyGrid and the category attribute, the BindProperty attribute, and more.
Skills covered
.NETSoftware Development ToolsMicrosoftSoftware DevelopmentOne-Off
Concepts
0. Introduction
- 01 - Use declarative approach to code with .NET attributes
- 02 - What you should know
- 03 - My programming setup and configuration
- 04 - How to access the sample code on GitHub
1. Overview
- 05 - Metadata and .NET assemblies
- 06 - Metadata consumers
- 07 - What is an attribute
- 08 - Examine the .NET attribute classes
- 09 - Reading metadata and code with reflection
2. Use an Attribute
- 10 - Use the Obsolete attribute
- 11 - See the attribute metadata in the .NET assembly
- 12 - Attribute constructors and properties
- 13 - Apply multiple attributes
3. Create a Custom JSON Serializer Attribute
- 14 - Examine the JSON serializer project
- 15 - Create the attribute
- 16 - Use the attribute in another project
- 17 - Write reflection code to discover the attribute
- 18 - Create a parameterized attribute
- 19 - Find parameters with reflection
4. Create a Custom Unit Test Framework
- 20 - Examine the zUnit projects
- 21 - Explore the unit test attributes
- 22 - Use the unit test attributes
- 23 - Load attributes
- 24 - Show the attribute metadata
- 25 - Run the unit tests
- 26 - Create an Assert class
5. Examples of .NET Attributes
- 27 - Bit field enums and the flags attribute
- 28 - PropertyGrid and the Category attribute
- 29 - The BindProperty attribute in ASP.NET Razor Pages
- 30 - Logging and the CallerMemberName attribute
Conclusion
- 31 - Next steps