How many methods does this interface have?
How many methods are defined in this interface?
public interface IFoo
{
void Bar<T>(T arg);
}
Read more…
How many methods are defined in this interface?
public interface IFoo
{
void Bar<T>(T arg);
}
The Maybe Monad is extremely simple. It represents a value that might be there, but might not, and also provides a neat way of working with such values.
This Haskell-related page makes it pretty clear:
The Maybe monad embodies the strategy of combining a chain of computations that may each return
Nothingby ending the chain early if any step producesNothingas output. It is useful when a computation entails a sequence of steps that depend on one another, and in which some steps may fail to return a value.
Change Nothing to null and we’re talking in C#. Furthermore, it advises:
Read more…
When the dynamic typing proposal for C# came out, my feedback was basically that you can already do it in the language today:
The justification for adding dynamic is that it gets rid of a lot of ugly reflection. But delegates and indexers mean that the language already has almost enough expressiveness to hide those details entirely.
Now the proposal is getting a lot firmer and there’s a CTP available, more people are voicing their concerns. I remain pretty unconvinced of the value of it. One good point made by several people now is that it ought to be possible to use an interface to describe the set of operations that an object must support. The object wouldn’t have to genuinely implement the interface – the IDE would just use the interface’s members to offer up auto-completion in the usual way. The compiler would then simply generate dynamic calls, so the interface would be irrelevant at runtime.