Dynamic Type Loading

Here is a very simple sample of dynamic type loading:

==== LoadLibrary.cs ==== 

using System;
using System.Reflection;

namespace LoadLibrary
{
    class Program
    {
        static void Main(string[] args)
        {
            Assembly ass = Assembly.LoadFile(AppDomain.CurrentDomain.BaseDirectory
                + @”.SimpleLib.dll”);
            Type type = ass.GetType(“SimpleLib.SimpleClass”);
            object newInstance = Activator.CreateInstance(type);
            Console.WriteLine(newInstance);
            Console.ReadLine();
        }
    }
}

=== SimpleClass.cs ===

namespace SimpleLib
{
    public class SimpleClass
    {
        public override string ToString()
        {
            return “I am a simple class”;
        }
    }
}

 

Build simple class into SimpleLib.dll

Build LoadLibrary into LoadLibrary.exe

Put SimpleLib.dll into the same directory as LoadLibrary.

 

Simple DataGridView Sample

This is almost all you need: 

            string connStr = “Data Source=(local);Initial Catalog=Northwind; Integrated Security=SSPI;”);
            SqlConnection conn = new SqlConnection(connStr);
            SqlCommand cmd = conn.CreateCommand();
            cmd.CommandText = “SELECT * FROM Products”;
            DataSet dataset = new DataSet();
            SqlDataAdapter dataadapter = new SqlDataAdapter(cmd);
            dataadapter.Fill(dataset,”FOO”);
            dataGridView.DataSource = dataset.Tables[“FOO”];
            dataGridView.Columns[0].Visible = false;

NDoc for VS2005

One of the key rights of an open source licence (and therefore a key property of an open source project) is the right to fork. If you think that a project has stagnated or been terminated then you have the right to pick up the pieces and take it in a direction of your own – provided that you have the time, inclination and ability (or can hire someone to do that for you). This is just not available in the closed source world.

NDoc2 died due to lack of resources (and due to the vapourware that is Sandcastle). However NDoc2005 lives on. This is only a beta version. However beta in the open source world means a lot more than beta in the closed source world – especially for a development tool.

This seems to work just fine as is. It creates MSDN style documentation from C# 2.0 source. I had it working without reading the manual in about five mins. This is in comparison to Sandcastle (the microsoft equivalent) where I have yet to generate a single file. This may get my project sufficient documentation to last until Sandcastle catches up (in a year or so).

Sandcastle – Microsofts answer to NDoc

Sandcastle is now available as a CTP.

This is Microsofts answer to NDoc. They have been so sucessful in announcing this product that they have killed off NDoc.

Now if you got a product that was used to generate documentation you would expect it to be accompanied with at least the minimal amount of documentation. In this case not a sausage.

The normal practice for this is to eat your own dogfood and use it’s own codebase as an example.