Quantcast
Channel: Fabulous adventures in coding » C# 4.0
Browsing all 12 articles
Browse latest View live

A method group of one

I'm implementing the semantic analysis of dynamic expressions in Roslyn this week, so I'm fielding a lot of questions within the team on the design of the dynamic feature of C# 4. A question I get...

View Article



Dynamic contagion, part one

This is part one of a two-part series on dynamic contagion. Part two is here. Suppose you're an epidemiologist modeling the potential spread of a highly infectious disease. The straightforward way to...

View Article

Dynamic contagion, part two

This is part two of a two-part series on dynamic contagion. Part one is here. Last time I discussed how the dynamic type tends to spread through a program like a virus: if an expression of dynamic type...

View Article

A contravariance conundrum

Suppose we have my usual hierarchy of types, Animal, Giraffe, etc, with the obvious type relationships. An IEqualityComparer<T> is contravariant in its type parameter; if we have a device which...

View Article

Optional argument corner cases, part one

In C# 4.0 we added "optional arguments"; that is, you can state in the declaration of a method's parameter that if certain arguments are omitted, then constants can be substituted for them: void M(int...

View Article


Optional argument corner cases, part two

Last time we saw that the declared optional arguments of an interface method need not be optional arguments of an implementing class method. That seems potentially confusing; why not require that an...

View Article

Optional argument corner cases, part three

A lot of people seem to think that this: void M(string x, bool y = false) { ... whatever ... } is actually a syntactic sugar for the way you used to have to write this in C#, which is: void M(string x)...

View Article

Optional argument corner cases, part four

Last time we discussed how some people think that an optional argument generates a bunch of overloads that call each other. People also sometimes incorrectly think that void M(string format, bool b =...

View Article


Image may be NSFW.
Clik here to view.

Closing over the loop variable considered harmful, part two

(This is part two of a two-part series on the loop-variable-closure problem. Part one is here.) UPDATE: We are taking the breaking change. In C# 5, the loop variable of a foreach will be logically...

View Article


Reflection and default parameters

We have two posts today on the Coverity Development Testing Blog's continuing series Ask The Bug Guys. First, my colleague Jon explores a tricky difference between the 1989 and 1999 C standards...

View Article

What is "duck typing"?

Seriously, what is it? It's not a rhetorical question. I realized this morning that I am totally confused about this. First off, let me say what I thought "duck typing" was. I thought it was a form of...

View Article

Image may be NSFW.
Clik here to view.

What is late binding?

“Late binding” is one of those computer-sciency terms that, like “strong typing“, or “duck typing” means different things to different people. I thought I might describe what the term means to me....

View Article
Browsing all 12 articles
Browse latest View live




Latest Images