Learn your way! Get started

C# 2012, Part 2: Attributes, Reflections, and Dynamic

with expert Joe Mayo

Watch trailer

C# 2012, Part 2: Attributes, Reflections, and Dynamic Trailer

Course at a glance

Included in these subscriptions:

  • Dev & IT Pro Video
  • Dev & IT Pro Power Pack
  • Power Pack Plus

Release date Release date 12/10/2012
Level Level Intermediate
Runtime Runtime 0h 42m
Platform Platform Major browsers on Windows Major browsers on Windows Major browsers on Mac OSX Major browsers on Mac OSX Mobile Devices Mobile Devices
Closed captioning Closed captioning Included
Transcript Transcript Included
eBooks / courseware eBooks / courseware Included
Hands-on labs Hands-on labs Included
Sample code Sample code Included
Exams Exams Included

Enterprise Solutions
Enterprise Solutions

Need reporting, custom learning tracks, or SCORM? Learn More

Course description

This course will show you some common attributes that the C# compiler uses. You’ll see examples of other tools that use attributes. You’ll also learn how to create your own custom attribute. This course will teach you how to use Reflection. You’ll learn how to get a reference to Type objects inside of an assembly and how to dive into the contents of a type to inspect its members. You can even find and read your custom attributes. After you know how to use Reflection, the course will show you how to dynamically instantiate an object and invoke one of its methods. You’ll learn how to declare and use a dynamic type. Then you’ll see how to use an ExpandoObject. The course will follow up by explaining how DynamicObject allows you to control the entire experience of how a type works via a derived type and method overloads.


This course assumes that students understand the C# 3.0 syntax and have a basic understanding of the .NET Framework. No specific experience with Visual Studio 2012 is required.

Prepare for certification

This course will help you prepare for:
70-483 Programming in C#

This course will help you earn:
MCSD: Windows Store Apps

Meet the expert

Joe Mayo Joe Mayo is an author, independent consultant, and instructor specializing in Microsoft .NET and Windows 8 technology. He has several years of software development experience and has worked with .NET since July 2000. Joe has written books and contributes to magazines, such as CODE Magazine. He has been an active contributor to the .NET community for years, operating the C# Station Web site, authoring the LINQ to Twitter open source project, and speaking regularly at user groups and code camps. For his community contributions Microsoft has honored Joe with several Most Valuable Professional (MVP) Awards through the years.

Course outline

Attribute, Reflection, Dynamic

Attributes (13:44)
  • Introduction (01:02)
  • Applications Using Attributes (00:33)
  • Demo: Attributes (04:45)
  • Deriving From Attribute (00:49)
  • Demo: Deriving from Attribute (00:31)
  • Named and Positional Parameters (01:02)
  • Demo: Parameters (01:38)
  • Attribute Usage Attribute (01:02)
  • Demo: Usage Attribute (01:18)
  • Summary (00:59)
Reflection (13:33)
  • Introduction (00:57)
  • Getting Type and Type Info (01:50)
  • Demo: Type and Type Info (01:01)
  • Exploring Type Members (00:37)
  • Demo: Type Members (03:28)
  • Dynamic Invocation (00:47)
  • Demo: Dynamic Invocation (02:27)
  • Demo: Binding Flags (01:41)
  • Summary (00:40)
Dynamic (15:07)
  • Introduction (00:44)
  • Using Dynamic Types (01:41)
  • Demo: Dynamic Types (02:44)
  • The Expando Object (00:53)
  • Demo: The Expando Object (03:07)
  • Implementing DynamicObject (01:09)
  • Demo: DynamicObject (00:37)
  • Demo: Public Override (03:03)
  • Summary (01:05)