O'Reilly logo

C# 5.0 Unleashed by Bart De Smet

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Dynamic Typing

Starting with .NET 4.0, C# supports dynamic typing. Variables typed as dynamic are used in a late-bound fashion, meaning that operations applied to them are resolved at runtime rather than at compile time. This is useful when dealing with an object that cannot be typed statically in a comfortable manner. Samples include Extensible Markup Language (XML) documents without an XML Schema Definition (XSD) schema or objects from dynamic languages such as Python, Ruby, or JavaScript.

Other than the built-in types discussed so far, no direct mapping exists between the C# reserved word dynamic and an underlying BCL type. Instead, dynamic is a special alias for System.Object, but with some additional metadata sprinkled on top of it to tell ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required