我在vb.net中编写了一个简单的aspx代码,但收到以下错误
描述:编译资源期间发生错误 需要为此请求提供服务。请查看以下具体内容 错误详细信息并适当修改源代码。
编译器错误消息:BC30002:键入' HashSet'没有定义。
请注意,System.Collections.Generic包含在aspx文件中但仍然出现错误。 HashSet 是System.Collection.Generic的一部分,我已导入它,但不知道我收到此错误的原因
您知道如何解决此问题吗?
<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="System.Collections.Generic" %>
<script language="VB" runat="server">
'Relative file path to XML data
Dim strXmlFilePath as String = Server.MapPath("quiz.xml")
Dim xDoc as XmlDocument = New XmlDocument()
Dim intTotalQuestion As UShort
Dim intQuestionNo As UShort = 0
Dim intScore As UShort = 0
Dim arrAnswerHistory As New ArrayList()
Dim builder As New StringBuilder
Dim builderS1 As New StringBuilder
Dim intTotalQuestionToDisplay As UShort
Dim result As New List(Of UShort)()
Public Sub randomFunc()
Dim rand As New Random()
Dim loopValue As UShort = intTotalQuestionToDisplay - 1
Dim check As New HashSet(Of UShort)()
For i As UShort = 0 To loopValue
Dim curValue As Integer = rand.[Next](1, intTotalQuestionToDisplay)
While check.Contains(curValue)
curValue = rand.[Next](1, intTotalQuestionToDisplay)
End While
result.Add(curValue)
check.Add(curValue)
Next