On Dynamic Objects and DynamicObject

As you know if you read my blog, C# 4.0 introduced some language features that help you consume dynamic objects. Although it’s not part of the language, most of the writing about dynamic in C# that I have seen, including my own, also contains some point about how you create dynamic objects. And they usually…

0

Errata: dynamic conversions and overload resolution

When you stand up and tell the world how your software is supposed to behave a full year or more before you’re done working on it, a funny thing can sometimes happen. You can change your mind. And therefore be wrong by the time the software ships. And so it is with dynamic. Shortly after…

8

MSDN Channel 9 Video on Dynamic

About a month ago, Sam Ng and I sat down with Charlie Calvert and his video camera to record an interview-style video about dynamic. Have a look! https://channel9.msdn.com/posts/CharlieCalvert/CSharp-4-Dynamic-with-Chris-Burrows-and-Sam-Ng/ If you view it, I hope you find it helpful and informative. Also, I clearly need to take some kind of instruction on what to do with…

0

Dynamic type parameter constraints in C# 4

What we know already So we talked about how you can define a class that has a base class that involves dynamic, such as // This is OK! class Derived : Base<dynamic> { } although you cannot use dynamic alone as a base class. And we talked about how you cannot define a class that…

12

Dynamic base classes in C# 4

Ok, where were we? We have this new type called dynamic, and it’s used to tell the compiler to defer binding until runtime. We can construct other types with it as usual, and therefore use dynamic[], IEnumerable<dynamic>, List<dynamic>, and so on. But last time, in answer to the entirely reasonable question, “where can I use…

3

C# “dynamic,” Part VII

It has been a while since I posted anything here, and I have the same excuse everyone else does. Work, holidays, and generally being pretty busy. But enough of that, it’s February (!!!) and that means we’re getting closer to shipping C# 4.0 and dynamic and making all of this a much less abstract exercise…

4

C# "dynamic," Part VI

[Update March 31, 2010: MUCH OF THIS HAS CHANGED SINCE PRE-RELEASE VERSION OF DYNAMIC. SEE THIS POST] We left off last time with this piece of codepublic class C { public static void M(int i) { } public static void M(string s) { } } … dynamic d = GetSomeD(); C.M(d); …together with some question…

3

C# "dynamic," Part V

[Update March 31, 2010: MUCH OF THIS HAS CHANGED SINCE PRE-RELEASE VERSION OF DYNAMIC. SEE THIS POST] Let’s look at this:dynamic d = null; object o = d; // not an implicit conversion Last time, I said that the conversion on the second line is not an implicit conversion. If you know C# already, that…

3

C# "dynamic," Part IV

Today, let’s geek out about the language design regarding the dynamic type. Type in the language vs. Type in the runtime One thing that lots of people already know is that when you say “dynamic” in code, you can think of it as “System.Object” in your assembly, because that’s how the compiler emits it.dynamic d…

5

Channel 9 Video on C# 4

I’m a little backlogged at work right now, and I’ll get back to some dynamic posts as soon as I can. In the meantime, Eric, Sam, Mads, and I talked with Channel 9 last week, and the video has just been posted. I look forward to watching it myself! Here’s hoping I haven’t said anything…

0