在ASP+ 中我们如何使用 Class 而不是组件

/*
豆腐制作 都是精品
http://www.asp888.net 豆腐技术站
如果您转贴 本文 请 保留版权信息
*/
asp+ 中我们有办法使用 预编译(pre-release)的代码 而不是 已经编译好的 二进制代码(build-in) 的组件
下面我们来看看一个例子

你可能会用到类似下面的代码:

1@ Assembly src="test.cs" 
2``` // Compile C# class   

@ Assembly src="test.vb"

 1在 代码的最上方 我们使用这样的 代码告诉编译器 把 文件中包含的 Class 编译到asp+ 的页面中 
 2
 3test.cs: 
 4
 5public class MyClass { 
 6
 7public string SaySomething() {   
 8return "豆腐制作 都是精品";   
 9}   
10}   
11test.vb:   
12public class test   
13readonly Property SaySomething() as string   
14get   
15SaySomething="豆腐制作 都是精品"   
16end get   
17end Property   
18end class 
19
20test.aspx: 

@ Assembly Src="test.vb"

``` 作者:豆腐()
Published At
Categories with Web编程
Tagged with
comments powered by Disqus