欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

asp.net(c#)利用构造器链的代码

程序员文章站 2022-05-22 14:33:09
复制代码 代码如下:using system; using system.data; using system.configuration; using system.co...
复制代码 代码如下:

using system;
using system.data;
using system.configuration;
using system.collections;
using system.web;
using system.web.security;
using system.web.ui;
using system.web.ui.webcontrols;
using system.web.ui.webcontrols.webparts;
using system.web.ui.htmlcontrols;

public partial class default4 : system.web.ui.page
{
protected void page_load(object sender, eventargs e)
{
webinfo info = new webinfo();
string infoout = string.format("站点:{0}<br>域名:{1}",info.webname,info.weburl);
response.write(infoout);
}

public class webinfo
{

public webinfo():this("搜索吧","http://www.sosuo8.com/")
{
}

public webinfo(string weburl):this("搜索吧",weburl)
{
}

public webinfo(string webname, string weburl)
{
_webname = webname;
_weburl = weburl;
}

private string _webname;
private string _weburl;

public string webname
{
get
{
return _webname;
}
set
{
_webname = value;
}
}
public string weburl
{
get
{
return _weburl;
}
set
{
_weburl = value;
}
}


}
}