vb.net 代码
While reader.Read
Dim dq As UserControl = LoadControl(ResolveUrl(ConfigurationSettings.AppSettings("buildingBlockPath") & reader("ControlSrc")))
CType(dq, IUIBuildingBlock).QuestionText = reader("QuestionText")
dq.ID = String.Concat("dq", reader("DynamicQuestionID")) dynamicControls.Controls.Add(dq)
dynamicControls.Controls.Add(New LiteralControl("<br /><br />"))
End While其中IUIBuildingBlock是同一命名空间下的一个接口(昨天问过接口怎么写的:))
Public Interface IUIBuildingBlock
ReadOnly Property DataType() As DQDataTypes
Property QuestionText() As String
Property Answer() As Object
End Interface这里关键是那个CType()函数在c#中怎样用不知道了
While reader.Read
Dim dq As UserControl = LoadControl(ResolveUrl(ConfigurationSettings.AppSettings("buildingBlockPath") & reader("ControlSrc")))
CType(dq, IUIBuildingBlock).QuestionText = reader("QuestionText")
dq.ID = String.Concat("dq", reader("DynamicQuestionID")) dynamicControls.Controls.Add(dq)
dynamicControls.Controls.Add(New LiteralControl("<br /><br />"))
End While其中IUIBuildingBlock是同一命名空间下的一个接口(昨天问过接口怎么写的:))
Public Interface IUIBuildingBlock
ReadOnly Property DataType() As DQDataTypes
Property QuestionText() As String
Property Answer() As Object
End Interface这里关键是那个CType()函数在c#中怎样用不知道了
还能问你一下
If Not dq Is Nothing Then
换成c#表示是:
if(dq!="")
这样的么?马上给分:)