你可能会用到类似下面的代码:
<%@ Assembly src="test.cs" %> // Compile C# class
<%@ Assembly src="test.vb" %> // Compile VB class
在 代码的最上方 我们使用这样的 代码告诉编译器 把 文件中包含的 Class 编译到asp+ 的页面中
test.cs:
public class MyClass {
public string SaySomething() {
return "豆腐制作 都是精品";
}
}
test.vb:
public class test
readonly Property SaySomething() as string
get
SaySomething="豆腐制作 都是精品"
end get
end Property
end class
test.aspx:
<%@ Assembly Src="test.vb" %>
<html>
<script language="VB" runat=server>
Sub Page_Load(Sender as Object, E as EventArgs)
Dim Temp as New test
lblMsg.Text = temp.SaySomething()
End Sub
</script>
<body>
<asp:label id="lblMsg" runat=server/>
</body>
</html>
作者:豆腐()
零七网部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与零七网进行文章共享合作。