Home > Uncategorized > casting a OleDbSchemaGuid to a System.GUID

casting a OleDbSchemaGuid to a System.GUID

A nice trick I just discovered whilst writing the OleDbWebService (see network.programming-in.net for details) was that I wanted a function that would encapsulate the GetOleDbSchemaTable function, to which one of the parameters is a OleDbSchemaGuid enumeration. Even though the enumeration’s underlying type is a System.GUID, you can’t make a explicit cast. However – you can cast it to an object and back to a GUID thus !

System.Guid schemaType = (System.Guid)((object)schemaAspect);

Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a comment