October 2008 Entries
I’m downloading .NET 4.0 and Visual Studio 2010. Currently it looks like this: It looks like I will have to wait till tomorrow to play with partial local types, dynamic objects, and whatever Anders is announcing right in this very moment. Good night.
Code created in more recent versions of C# has a lot of generated types, even if you don’t use code generation explicitly. Interators (the yield keyword), and anonymous delegates both use generated types underneath. Also those neat anonymous types introduced in C# 3.0 are nothing more than a compiler magic. All this may clutter your NDepend window of choice, when looking at your projects. You can however get rid of generated stuff, pretty easily, with this simple CQL query: // <Name>Types not generated by the compiler</Name>
SELECT TYPES FROM ASSEMBLIES "YourAssembly"
WHERE...
I was entertaining the idea of contextual components that would act differently depending on who called them. System.Diagnostics.StackTrace is the class that allows you to traverse the call stack, and see who called your method. There’s one catch though – it is painfully slow. And by painfully, I mean this: Those two methods are by no means comparable in regard of what they’re doing. They are mere examples of simple tasks: one involving Reflection, and one involving StackTrace. The fact that the difference in performance is nearly two orders of magnitude, should make you think twice...
Last minor version of NDepend introduced cool, interactive Dependency Graph, that was really a huge step forward as compared to static .png we got earlier. You can now load set of assemblies, and immediately see dependencies between them, without running your_picture_viewer_here. You also can drill down the dependency tree and see dependencies between namespaces within an assembly, classes within namespace, methods within class… One thing (ok, there are more, but we’ll get to that in a minute), that I missed, was the ability to remove an element from the graph. You could do this using CQL, but this just...