在ASP+ 中我们怎样使用 Class 而不是组件
发布时间:2023-08-01 15:20:15 所属栏目:Asp教程 来源:
导读:在asp+ 中我们如何使用 class 而不是组件
/*
豆腐制作 都是精品
http://www.asp888.net 豆腐技术站
如果您转贴 本文 请 保留版权信息
更多文章 都在 豆腐技术站
*/
asp+
/*
豆腐制作 都是精品
http://www.asp888.net 豆腐技术站
如果您转贴 本文 请 保留版权信息
更多文章 都在 豆腐技术站
*/
asp+
在asp+ 中我们如何使用 class 而不是组件 /* 豆腐制作 都是精品 http://www.asp888.net 豆腐技术站 如果您转贴 本文 请 保留版权信息 更多文章 都在 豆腐技术站 */ asp+ 中我们有办法使用 预编译(pre-release)的代码 而不是 已经编译好的 二进制代码(build-in) 的组件 下面我们来看看一个例子 你可能会用到类似下面的代码: <%@ 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> (编辑:聊城站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐