July 16, 2007

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.

 

Posted by chriseyre2000 at 21:59:22 | Permanent Link | Comments (0) |

March 07, 2007

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;

Posted by chriseyre2000 at 22:13:18 | Permanent Link | Comments (0) |

March 03, 2007

Got Dot Net is going away

Microsoft is phasing out the Got Dot Net project.

This site will last until July 2007. 

Most of the projects are moving to www.codeplex.com

This will break a lot of sample code based upon GotDotNet.

Posted by chriseyre2000 at 18:46:22 | Permanent Link | Comments (0) |

January 20, 2007

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).

Posted by chriseyre2000 at 09:14:43 | Permanent Link | Comments (0) |

January 13, 2007

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.

Posted by chriseyre2000 at 17:27:11 | Permanent Link | Comments (0) |

November 25, 2005

VB CSharp Translator

This is VB/C# Translation utility.

It could be very useful for "correcting" samples.
Posted by chriseyre2000 at 09:39:17 | Permanent Link | Comments (0) |