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

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: