In C #, you can specify a cast by placing the type you want to apply in brackets in front of the reference variable you want to distinguish ( (type)instance ).
So, to pass an object ( dq ) to an IUIBuildingBlock type, you can use the following code:
((IUIBuildingBlock)dq).QuestionText = reader("QuestionText");
(Note that this will throw an exception if the throw is made for an object that does not implement IUIBuildingBlock , but will be CType , so I assume this is not a problem.)
Cody gray
source share