Welcome

Welcome to C# Station!  This is a community site for people interested in applying .NET using the C# programming language.  We've been around since July 4th 2000 and have continued to grow over the years.  Items of interest include Articles, Books, Links, Documentation,  and Tutorials. More...

Joe Mayo, site owner, is an author and President of Mayo Software Consulting, Inc. For more information about his custom .NET software development services, visit Mayo Software Consulting, Inc. Joe's books include ASP.NET 2.0 MVP Hacks, C# Unleashed, and C#Builder Kick Start at Amazon.com.

Check out Joe's newest books: C# 3.0 Unleashed: With the .NET Framework 3.5 (Unleashed) and LINQ Programming.

C# Tutorial - Lesson 22: Topics on C# Type
On July 4th 2008, Independence Day in the USA, C# Station will be 8 years old - so I celebrate with a new lesson for the C# Tutorial.
 
One of the skills that can help developers gain more competence in C# software development is a clear understanding of the C# type system. Really, it's the .NET/CLR type system, but it surfaces to you through the programming language. I've added Lesson 22: Topics on C# Type to the C# Tutorial which discusses strong typing, type conversion, and reference and value types. Just like the rest of the C# Tutorial, it doesn't go into a comprehensive discussion about every nook and cranny about types. What it does try to do is give you an understanding of the importance of the type system and show you a few of the issues you need to know about in everyday coding.
 
Fri, 04 Jul 2008 01:02:51 GMT
5 Things the Boss Should Know About Microsoft LINQ
John Paul Meuller wrote a nice high-level article on LINQ for CIO magazine, "5 Things the Boss Should Know about Microsoft LINQ". Some guy posted a negative comment to the article, for whatever reason I can't understand. I use LINQ every day, even on existing projects that were built without LINQ for database access.  There are probably some things that would make LINQ better, but I can't find any negatives to it.
Tue, 01 Jul 2008 03:54:20 GMT
C# 3.0 Unleashed Rough Cuts
 
Note: You'll might need a subscription to Safari to read it, but (at the time of this posting) you can sign up for a free 10-day trial. You might want to look at the Rough Cuts page to see what options are available there also.
Fri, 27 Jun 2008 02:32:27 GMT
CoDe Magazine Subversion Article
Rick Strahl wrote an excellent article on getting started with Subversion. I've used SVN and ToriseSVN on a few different projects and they are nice tools. Check out the article, Setting Up and Running Subversion and Tortise SVN with Visual Studio and .NET.  BTW, I highly recommend CoDe Magazine.
Thu, 19 Jun 2008 22:59:34 GMT
Enabling DTC for TransactionScope in Vista
If you're using TransactionManager for a distributed transaction, you'll need to enable DTC to get it to work.  In earlier times, all you you needed to do was start the DTC service and everything was good. However, with security increasing with each OS service pack and version, you have to do a little more to turn the DTC on and get it to work. After having to configure this on Vista a few times, I realized that other people will continue to cross this bump in the road as I have.  First, here's a Blog entry from Bil Lin that explains how to configure component services:
 
 
While that is a good explanation, it isn't the whole story because it doesn't just work after you configure component services.  Here are a few more tips to get you going:
 
1. If you've never used the command prompt, you might be confused on how to run dcomcnfg.  Starting the component service manager, dcomcnfg, means that you must open the Command Prompt by selecting All Programs, Accessories, Command Prompt, and then just typing dcomcnfg.
2. You need to allow DTC through your firewall - so open Control Panel, Windows Firewall, Allow a program through the firewall, and there's a box for Distributed Transaction Coordinator you can check to enable it.
3. DCOM must be configured on the Server to allow remote connections and you must enable DTC on the server.
4. Once you've configured the DTC, it will tell you that it has restarted the service, you run your code again, and receive the same error. I've found that the DTC still doesn't work until after I've rebooted my computer.
Mon, 16 Jun 2008 01:16:38 GMT
LINQ Debugger Visualizer
Scott Guthrie's LINQ to SQL Visualizer is a VS2008 Debugger Visualizer for LINQ to SQL queries. Part of a must-have tools list:
 
Tue, 03 Jun 2008 21:10:40 GMT
Vista SP1 Doesn't Install - Fixed
After some time, I finally got Vista SP1 installed. I know, you never knew it was an issue for me, mostly because I never said so. The painful saga began when my laptop screen blanked out for some reason. Anyway, it gave me a good excuse to upgrade, meaning that I had to move anything meaningful from the old laptop to the new one. It was also a good excuse to load Vista on my laptop, which is when the fun began. Because I have my own MSDN subscription, I ordered the new laptop without upgrading the OS, meaning that it shipped with WinXP (or was it Vista Home). Anyway, my first task was to upgrade to Vista Ultimate. Instead of re-paving, I let Vista do an upgrade, which was my first mistake. That left me with a machine of unknown reliability because I didn't do the original install myself and left a bunch of OEM gunk in place.  My next mistake was dumping everthing there was from Windows Update onto my system. Hey, it's coming from Microsoft Right?!!  This has rarely ever been a problem, but I have experienced an occasional glitch from 3rd party drivers. In this case, I don't know what possessed me, but I installed all of the languages too. Later research revealed that this could have been part of my problems too. Needless to say, by the time Vista SP1 rolled around, it wouldn't install. I must have tried more times than I can count.  Anyway, I was having problems with some other software that should have been fixed by Vista SP1. So, all of the sudden, inability to install Vista SP1 became more than a passing annoyance.  Searching the Web, using every search engine, I found a varied array of solutions and dead-ends. Uninstalled language packs, which gave me errors too and I'm not totally sure they uninstalled correctly. Microsoft even has a KB article http://support.microsoft.com/kb/947366, which didn't work either. I'm sure that KB was helpful for someone...
 
By this time, I definitely wasn't in the mood to re-pave. I do most of my work on my laptop these days and this would have put me even further behind on everthing than I already was (I'm sure you've been there). So, I did a re-install on Vista, looking for a repair option. I'm sure the repair option is somewhere, but I found the upgrade option. So, I went for it. Besides, I do regular backups and use source control and I imagined that a re-pave wasn't too far down the line. Well the upgrade worked without trashing everything I have. The upgrade resets everything, so you have to reinstall ASP.NET (remember aspnet_regiis -i?), but really, I just reinstalled VS2008. This led me to my recent blog post where LINQ and WPF were acting up. Other things, like ASP.NET State Server, need to be reset to Automatic and started.
 
Subsequently, my research led me to believe that I should take a minimalistic approach to Windows Update (to start off with at least). So I only updated with critical patches, and then optional OS upgrades.  I didn't touch any of the language upgrades this time, which I don't really need anyway and I suspect they were part of the problem. Today Vista SP1 installed via Windows Update without incident.  Too bad I can't remember the burning issue that caused me to think I needed it in the first place...
Wed, 28 May 2008 03:47:19 GMT
Child nodes not allowed
Working with Vista Ultimate and VS2008 and ran into errors titled "Child nodes not allowed" and "Required file 'alink.dll with IAlink3' could not be found". Yes, I have a Web Application and a WPF application in the same solution. It got this way because I re-installed Vista, trying to fix a problem that I'm still working on. Apparently, it wiped out some settings that VS2008 relies on to build .NET 3.5 apps. The solution is detailed pretty well here:
 
 
Essentially, go to \WCU\dotNetFramework\dotNetMSP\x86 on your VS2008 installation disk and run:
 
NetFX2.0-KB110806-v6000-x86.msu
 
and
 
NetFX3.0-KB929300-v6000-x86.msu
 
Replace x86 with x64 if you're running 64-bit.
Mon, 26 May 2008 03:36:51 GMT
.NET is Growing
The .NET Framework has more than doubled its size since v1.0. Brad Abrams posted size metrics in his blog post - Number of Types in the .NET Framework.
Tue, 18 Mar 2008 22:03:38 GMT