David Morton

David is a Senior Consultant for Catapult Systems and blogs about all things C#, F#, .NET and programming.  He is a C# MVP, and is the owner of the Wiki over at http://wiki.codinglight.com/.
RSS Feed
Aug11

Houston F# Users Group - August 27th 7:00 PM

The Houston F# Users Group for August will be taking place August 27th at 7:00 PM in the Catapult Systems Training Room. We'll be having an interactive, hands-on session where we'll actually get to code some F#. All levels of knowledge are welcome, and there will be food! Catapult Systems Houston 10370 Richmond Avenue Suite 1250 Houston, TX 77042 View Larger Map We're the building o...
Posted by David Morton on Tuesday, 11 Aug 2009 01:19.
0 Comments | Categories:

 
Aug4

What is Code Quality Anyways?

Since I was young, my father has encouraged me to become a writer, so a few years ago, I entertained the idea, and bought a book by Stephen King called "On Writing". From it, I learned several aspects of good writing. One of the most memorable was to avoid adverbs ending in -ly. The reason they should be avoided is because your verbs, nouns and adjectives should describe your intentions...
Posted by David Morton on Tuesday, 4 Aug 2009 05:50.
0 Comments | Categories:

 
Aug3

The Wiki is Live

I've finally done it. For a while now I've been looking for a way to organize my thoughts efficiently and effectively, while actually retaining the things I'm learning. The wiki is designed to help with that, and I've been working on it for a couple of weeks now. Generally I get my information from one of a few sources (in no particular order):1. Daily life. I learn quite a bit just by programmin...
Posted by David Morton on Monday, 3 Aug 2009 08:05.
0 Comments | Categories:

 
Aug1

New Name and Style (and Some Comments on Simplicity)

Note: This post was originally posted on my blog site at http://blog.codinglight.com/.  I've included it here for completion's sake, but, of course, the Catapult site is not running on Blogger, nor have I had any issues with the templates on the Catapult blog site.  Nevertheless, there is some information here regarding simplicity while programming, and I've included this post because I feel that...
Posted by David Morton on Saturday, 1 Aug 2009 12:30.
0 Comments | Categories:

 
Jul29

Assembly Resolution with AppDomain.AssemblyResolve

Plugin frameworks often rely on runtime assembly resolution, and sometimes the assemblies to be resolved don't lie within the directory structure of the executable, nor are they located in the GAC. In these cases, you can use the AppDomain.AssemblyResolve event to resolve assemblies at runtime. The key with the AssemblyResolve method is that it must be put into place before attempting to instanti...
Posted by David Morton on Wednesday, 29 Jul 2009 03:10.
0 Comments | Categories:

 
Jul28

On Method Overloading Best Practices

C# allows method overloading. An overload is defined as a method that has the same name as another method, and differs only in the number and/or type of parameters it receives. (Technically, .NET allows creation of overloads based only on the return type but this construct is not allowed in C#).The .NET Framework uses method overloading with several of it's methods. For example, the Activator.Cre...
Posted by David Morton on Tuesday, 28 Jul 2009 01:35.
0 Comments | Categories:

 
Jul27

Automatically Find the Namespace of a Class and Add a Using Statement in Visual Studio

This is an all-too-common question on the forums for me not to address it here. This post concerns a very basic C# concept. Sometimes, when adding a code snippet, it's possible you might get an error that says something to the effect of "The name "xxx" does not exist in the current context". At compile time, a namespace reference must be found in order to resolve classes that ...
Posted by David Morton on Monday, 27 Jul 2009 02:15.
0 Comments | Categories:

 
Jul15

IOException While Trying to Delete a Folder?!

Make sure you don't step on your own toes. The following code illustrates...using System;using System.IO;internal class Program{ private static void Main(string[] args) { string directory = @"C:\atemporaryfolder\"; Directory.CreateDirectory(directory); Environment.CurrentDirectory = directory; Directory.Delete(directory); }}Who's using the folder? Yo...
Posted by David Morton on Wednesday, 15 Jul 2009 09:55.
0 Comments | Categories:

 
Jul14

C# 3.0 Syntax of the Day

Can't believe I missed this one...var items = new string[] { "David", "Jennifer" };versus:var items = new[] { "David", "Jennifer" };Yep, that's right! "new[]" is okay. The compiler will infer the type of the array based on the type of the items within the squigglies....
Posted by David Morton on Tuesday, 14 Jul 2009 04:20.
0 Comments | Categories:

 
Jul13

Truncation and Rounding in Conversion

Just found this. Feels angry:decimal d = 1.7M;Console.WriteLine((long)d);Console.WriteLine(Convert.ToInt64(d));Yields:12Ouch. Remember, kids, casting syntax truncates, while using the Convert class rounds....
Posted by David Morton on Monday, 13 Jul 2009 11:35.
0 Comments | Categories: