C# 7 Attributes: Power and Flexibility for Your Code
C# attributes are a powerful way to add declarative “metadata” to your C# code. This course will teach you what the benefits of attributes are, how to leverage prebuilt attributes, and how to create and use your own custom attributes.
What you'll learn
C# attributes are a powerful way to add declarative “metadata” to your C# code that can be used by visual designers at design time, control code compilation at build time, customize the experience during debugging, and control program execution at run time. In this course, C# 7 Attributes: Power and Flexibility for Your Code, you'll learn how to leverage the power of attributes in your C# applications. First, you'll learn about some of the problems attributes can help you solve. Next, you'll understand how you can benefit from some of the useful prebuilt attributes and how to provide values for attributes constructors and properties. Finally, you'll explore how to go one step further and define and use your own custom attributes to give your solutions extra power and flexibility. When you’re finished with this course, you’ll have an appreciation for the power and flexibility C# attributes provide and how you can use them to expand your C# applications.
Table of contents
- Introduction 2m
- Understanding Attribute Constructors and Properties 3m
- Controlling the Debugging Experience 7m
- Marking Code as Deprecated 3m
- Conditionally Compiling Code 4m
- Setting Assembly Level Metadata 4m
- Exposing Internal Code to Other Assemblies 4m
- Applying Attributes to Return Values 3m
- Specifying Data Validation 1m
- Indicating That a Class Can Be Serialized 1m
- Summary 1m
- Introduction 2m
- Defining Where a Custom Attribute Can Be Applied 1m
- Allowing a Custom Attribute to Be Used Multiple Times 1m
- Controlling Attribute Inheritance 1m
- Creating a Custom Display Attribute 4m
- Accessing Attributes at Runtime with Reflection 4m
- Applying a Custom Attribute 2m
- Adding a Class Level Custom Attribute 3m
- Adding a Multiple Use Custom Attribute 3m
- Summary, Resources and Further Learning 2m