Lesson 18: Overloading Operators

This lesson shows you how to overload C# operators. Our objectives are as follows: Understand what operator overloading is Determine when it is appropriate to overload an operator Learn how to overload an operator Familiarize yourself with rules for operator overloading About Operator Overloading In Lesson 2, you learned what operators were available in C#, … Continue reading “Lesson 18: Overloading Operators”

Lesson 16: Using Attributes

This lesson explains how to use C# attributes. Our objectives are as follows: Understand what attributes are and why they’re used Apply various attributes with multiple or no parameters Use assembly, type member, and type level attributes Why Attributes? Attributes are elements that allow you to add declarative information to your programs. This declarative information … Continue reading “Lesson 16: Using Attributes”

Lesson 15: Introduction to Exception Handling

This lesson teaches how to handle exceptions in your C# programs. Our objectives are as follows: Learn what an exception is Implement a routine with a try/catch block Release resources in a finally block Exceptions Exceptions are unforeseen errors that happen in your programs. Most of the time, you can, and should, detect and handle … Continue reading “Lesson 15: Introduction to Exception Handling”

Lesson 14: Introduction to Delegates and Events

This lesson introduces delegates and events. Our objectives are as follows: Understand What a Delegate Is Understand What an Event Is Implement Delegates Fire Events Delegates During previous lessons, you learned how to implement reference types using language constructs such as classes and interfaces. These reference types allowed you to create instances of objects and … Continue reading “Lesson 14: Introduction to Delegates and Events”