September 2004 Entries

Heath is blogging

 

Heath Stewart, a good friend and former coworker is now blogging. Check out his blog on MSDN.

.NET Security

 

Kieth Brown has recently released the book “The .NET Developer's Guide to Windows Security”. Keith initially had this book available online as he wrote it, I'm looking forward to having a copy in hand soon.

Comments are back up

 

Javier Lozano came through on this one, there is a problem with the WebUIValidation.js file within a .NET Framework 1.1 install. Read up on the details here:

http://www.lozanotek.com/archive/2004/09/27/147.aspx

Nice use of generics

 

Eric Gunnerson recently talked about a nice use of generics that I thought I would share. To create a COM object in .NET you can do the following:

Type t = Type.GetTypeFromCLSID(guid);
IGraphBuilder graphBuilder = (IGraphBuilder) Activator.CreateInstance(t);

so a nice helper function using generics looks like this:

private T CreateComObject(Guid guid) where T: class|
{
Type comType = Type.GetTypeFromCLSID(guid);
object o = Activator.CreateInstance(comType);
if(o == null)
return null;
else
return (T) o;
}

and now you can do something like this:

IGraphBuilder graphBuilder = CreateComObject<IGraphBuilder>(CLSID_FilterGraph);

Just wanted to document this for future use.