I have always wondered what this was about in a class where a public non-static method calls a private method. Here is the example.
public void CreateLocalResourceProvider(IContract contract)
{
…
result = CreateDBProvider(String.Empty, contract);
…
}
private static IDBProvider CreateDBProvider(string a, IContract contract)
{
…
}
After running enabling CodeAnalysis on my solution, I received a warning that the private method was not static or that I needed to use the “this/me” keyword if appropriate.
Here is the help for this rule:
So now I understand why to use a static private method. The things you learn from code
analysis.
Technorati Tags:
development,
C#,
tips
I didn’t even know this existed. I was watching a fellow developer debugging some code. When he got the exception in a messagebox, he opened up notepad and pasted the result in. I usually struggle with trying to select the text in the box and doing a CTRL+C. It so happens that you don’t have to do any selecting of text, just CTRL+C when the dialog box is up. This may sound trivial to some, but it was another good tip for me.
Technorati Tags:
Tips,
Windows
Updated:
Thanks to a comment from Steve, you can just right-click on the tab of an open file and select open containing folder. One of those hidden features. So digging in a little further I found that you can map it to a keyboard shortcut File.OpenContainingFolder.
I was trying to figure out how to get to an existing directory in explorer for a file from the solution explorer via a shortcut key. Here is how I did it.

I created a new external tool and set up the following properties.
Then I added it to a global shortcut key.

That is it. Pretty simple huh.
Technorati Tags: Visual Studio, Explorer, Tips
I just posted an article on the challenges adding feeds with enclosures to Outlook. After a little more digging, I realized that you can send the feeds to other data files. This will help in the mailbox size limit you may have for exchange.
Goto Tools – Account Settings
Select the feed that you want to change locations for and click the change folder button.
Create a new folder in your offline storage. Hey if you don’t have one, you can create a new data file at this time.
Your done. Well almost. It doesn’t move your existing content over. You will have to manually do it yourself.
Technorati Tags:
Outlook,
RSS
Yesterday, I added the feed for the ASP.Net podcast series to my Common Feed List. That was definitely the wrong thing to do. Thankfully, I didn’t subscribe to Hanselminutes that way yet. Initially, everything looked ok. Then I checked the automatically download enclosures box for the feed.
- In order to get the enclosures I had to reset all messages in the feed to unread. That was cool.
- I maxed out my mailbox limit. Oh oh… It turns out that the enclosures are just like attachments in a mail item. I haven’t figured out yet how to set my RSS feed to go to a different pst file that is not attached to the exchange server and mail limits.
- I wanted to save all of the attachments to a folder. Had to write a VBA macro to do it.
End result, don’t do the automatic feed enclosure download. I might go back to RSS Bandit as my default reader. Just my thoughts.
Here is another post to add to an offline storage. I did a little more research. Maybe I will stick with Outlook as my RSS reader.
I thought no big deal. I will just add it to my references and go on. So I went to my add references dialog box and it wasn’t there.
I knew that I installed the latest and greatest for the 3.0 framework bits, but for sanity sake I will check in the GAC folder. Sure enough, there it is.
With the add reference dialog I can’t just browse to the GAC folder and try to add the reference at that level. So after some research, I found the assembly in the following location
C:\WINDOWS\Microsoft.NET\Framework\v3.0\Windows Communication Foundation
I added the reference to it from there and set copy local to false. Then I renamed the file and it still compiled. I just wanted to make sure that it was at least looking into the GAT as a reference. After some research, I found out that the add reference dialog box is path based and not related to the GAC. Go figure.
http://msdn2.microsoft.com/en-us/library/ftcwa60a(VS.80).aspx
http://blogs.msdn.com/astebner/archive/2005/11/28/497693.aspx
http://support.microsoft.com/Default.aspx?kbid=306149
MSTest Command-Line options
I have been trying to use Visual Studio for all of my unit testing, to evaluate how it compares to NUnit. I have not had very favorable results so far. One of the areas, that I have struggled in is the ability to see Trace information within the results as I run the tests. As I have found out, there are a lot of command line switches that can be used, one of them in particular is /detail. Notice traceinfo? This is great news, except for one thing. How do you tell Visual Studio to place that switch by default when running tests through the IDE. I have ended up running the tests through the command line at this point, until someone smarter than me can tell me how to set that switch for the IDE.
As a side note, but related, I ran across a great post from Jay Flowers in regards to MSTest and CI. It just goes to show how much Lutz Roeder’s Reflector can help improve your productivity.
Technorati Tags:
Testing,
TDD,
MSTest
Introduction
Project Definition: Build an e-commerce site that can be viewed in multiple languages.
Development Team: 3 Developers, 1 CM, 1 QA, 1 BA, and a customer
There are so many factors that come into play when getting started on a new development project. I think that starting with a good project structure is key. It should be flexible enough to allow for expansion of the system, but rigid enough to have some recognizable structure that any new developer or business entity can recognize. Take some time to plan out your initial solution structure, it will be with you for the life of the project. I prefer to keep the project as modular and decoupled as possible to allow for rapid change. We will approach the development in an Agile fashion.
Getting Started
Building the initial file structure looks like a good place to start. I prefer to start with a blank solution in Visual Studio. This allows me to have a clean endpoint for the development of the rest of structure. Create a root folder for the “System”. I truly like to put the root namespace of the system as the folder name, but that is just my preference.
Inside of the solution folder, I initially add a src folder to hold initial projects within the solution. I do this because there may be other artifacts that I choose to add to the solution that have no relevance to the source code.
Inside of the source folder, I add a new project that is relevant to the solution. Here is a view how it looks in the Visual Studio Explorer Window compared to Windows Explorer. Notice that the project in Windows explorer is in its own directory.
Continue to add as many projects under the src folder that you need. Again, notice that the folders are namespaced for the projects. I have had solutions that contained over 100 projects and this was a great way to help organize it for a couple of reasons. At the solution folder level, several solutions can be created with subsets of projects. Also, project references became a lot easier to use and maintain. Developers could bring down the source code into different folder names because projects were referenced with relative paths.
Project Structures
I have taken the following approach with structuring the tree for projects. I like to have 3 folders underneath each project:
- src – Place all source for the project underneath this folder. One of the cons to this is how Visual Studio creates namespaces based upon folder names (Project Namespace + folder name). I don’t like this approach and manage my namespaces according to the functionality.
- libs – These are any 3rd party or in house libraries that may be reference in the project. This way a project is self contained.
- tools – I primarily use this with test libraries, putting a copy of NUnit in the project. This can also house special items used in builds, deployment or any other use you may have.
At the end, here is a default project with the three folders
Thoughts?