KickStart – C# Custom Configuration

This post will provide an example and explanation of how to create custom configuration for C# applications. I will discuss ConfigurationSections, ConfigurationElements, ConfigurationElementCollection. Also I will discuss how to nest these items together. My plan is to take very small steps; implementing each part of the configuration individually.

By the end of the post we will be able to navigate a custom configuration similar to the following config file:

Assumption

  • Good understanding of C#
  • Good understanding Visual Studio – I’m will be using VS 2012
  • .NET 3.5 and higher
  • Basic understanding of configuration files

The application we are going to create is quite contrived. The school settings that we will store in the config file would usually be stored in a database, but I want to provide a domain that most people understand.

Our Domain

A School has
A Name
A Address
Zero or More Courses
A Course has
A Title
An Optional Instructor
Zero or More Students
A Student has
A StudentId

We are going to create a Windows Console application. All it’s going to do is display values from the config file. When we are completed with the application it will display something similar to this:

Continue reading “KickStart – C# Custom Configuration”

Windows & Visual Studio Memory Limits

Tomorrow I will be receiving a new computer.  It has an Intel i7 920 processor and 6 gigs of a ram.  I plan on using Beta of Windows 7 64 bit, so I can take advantage of the full 6 gigs of memory.  A 32 bit operating system can only access 4 gigs.

This new computer will be an improvement that is far better then my current laptop.  My laptop has a Pentium 4 that runs at 3 GHz.  Running Visual Studio and other app on the laptop brings it to its knees.

So, tonight I was wondering how much memory I should have installed on my new computer to run Visual Studio.  Of course it’s a little late for this question, since I have already purchased the PC and it’s arriving tomorrow. But the new computer does have 3 ram slots available and the motherboard maxes out at 12 gigs. So I should have no problems upgrading

But back to the question of how much memory should I have installed for Visual Studio.  If you are like me, while programming I usually have many applications running in the background.  These application could be resource hogs live SQL Server, Photoshop, or may IE windows or tabs open.  So I Googled “Memory needed for Visual Studio .net”. 

The first link was “Hacking Visual Studio to Use More Than 2Gigabytes of Memory”.  http://stevenharman.net/blog/archive/2008/04/29/hacking-visual-studio-to-use-more-than-2gigabytes-of-memory.aspx This triggered a memory from the last company I worked at.  At this company our solution files contained many projects and those projects could be quite large.  Many times while compiling I would get the error “Not enough storage is available to complete this operation.” After reading the previous article, I learned that Visual Studio has a 2 GB limit, which was probably the reason for the storage error.   The article also mentioned that the Visual Studio is defaulted to 2 GB of maximum memory, but it can be increased.  Of course, on a 32 bit OS the maximum memory limit is somewhere less then 4 GB.  I’m not going into the details of why its less then 4 GB, but you can read this great article to learn more about it.

“Dude, Where’s My 4 Gigabytes of RAM?
http://www.codinghorror.com/blog/archives/000811.html

I never came up with the amount of memory I need, but these articles listed above provided a lot of information and background on the hows and whys of getting the best performance out of my computer.

As usual, I blogged about this so that I have a reference to the information later, but I hope this give you some insight into 32 bit OS’s and Visual Studio.