Archive for the ‘ .Net ’ Category

Resharper and Generics (or not)

I am finding quite a few issues with Resharper the more I lean on it.  Despite the issue of having to use Process Explorer to close my VS session when a bug occurs, there are other features that seem to be missing.  One thats been bugging me for some time is the inability for Resharper to help resolve a type if I declare a variable and specify it as a closed-type generic, when in fact the class isnt generic at all.  My scenario goes like this:

  1. I add a few assembly dependencies  to my project.
  2. I then think I have remembered a class I am wanting to use and declare it, such as FooBar<double>.
  3. Resharper turns FooBar red, which implies the class name isnt known.
  4. Problem is FooBar does exist in one of the assemblies that was added, but its not a generic.  Resharper reports: Cannot resolve symbol: FooBar.

To solve this I have to do Ctrl-N and look up the classname either in the browser (since I added assembly dependencies and not project dependencies, which would give me code-access), and then work out its not a generic.  While it doesnt take long to realise my error, I still expect resharper to offer to declare my variable as FooBar without the generic as one of its options that it provides to fix the problem.  As a productivity tool, this little feature would be very helpful.

Looking at Arrays and Lists

Most of this ramble relates to .Net 2.0/C#.

To build or enhance a high performance managed application has a set of constraints, three of which are data structure choice, algorithm choice and the garbage collection envelope. An interesting discussion arises when talking about Array vs List<T>, but this can be quickly addressed by understanding the mechanics of both and where they differ. I use List<T> as the comparator simply because this is the common replacement of choice by most C# programmers I have come across.

Continue reading

Cool Debugging Blog

This guy has some cool things to say with debugging in Visual Studio:

http://blogs.msdn.com/jimgries/default.aspx