| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 720 人关注过本帖
标题:[求助]列驱动器目录错误??
只看楼主 加入收藏
35maoe
Rank: 1
等 级:新手上路
帖 子:341
专家分:0
注 册:2006-8-28
结帖率:100%
收藏
 问题点数:0 回复次数:1 
[求助]列驱动器目录错误??
以下是代码,红色的错误,鼠标放上去显示:"class System.IO.Directory 公开应用于创建 移动和枚举通过目录和子目录和静态方法,无法继承此类."

浏览器显示错误是:"编译器错误信息: CS0723: 无法声明静态类型“System.IO.Directory”的变量"

protected void Page_Load(object sender, EventArgs e)
{
string strDir2List = Request.QueryString.Get("dir");
Directory thisOne = null;
try
{
thisOne = new Directory(Dir2List);
//Reading the directory properties
Response.Write("<p>Creation:" + thisOne.CreationTime.ToString() + "</p>");
Directory[] subDirectories = thisOne.GetDirectories();
Response.Write("<ul>");
for (int i = 0; i < subDirectories.Length; i++)
{
Response.Write("<li><a href=\'listdir.aspx?dir=Server.UrlEncode(subDirectories[i].FullName)''\'>" + subDirectories[i].Name + "</a>");
}
Response.Write("<ul>");
File[] theFiles = thisOne.GetFiles();
Response.Write("ul");
for (int i = 0; i < theFiles.Length; i++)
{
Response.Write("<li><a href=\'showfile.aspx?file=Server.UrlEncode(theFile[i].FullName)''\'>" + theFiles[i].Name + "</a>");
}
Response.Write("/ul");
}
catch (Exception e)
{
Response.Write("Access not possible.error:<i>" + e.ToString + "</i>");
Response.End();
}
}
搜索更多相关主题的帖子: 目录 浏览器 鼠标 驱动器 
2006-11-11 10:33
35maoe
Rank: 1
等 级:新手上路
帖 子:341
专家分:0
注 册:2006-8-28
收藏
得分:0 

编译错误
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。

编译器错误信息: CS0721: “System.IO.Directory”: 静态类型不能用作参数

源错误:

行 18:
行 19: }
行 20: protected void RecursiveDump(Directory theDir, int nLevel)
行 21: {
行 22: Directory[] subDirectories = theDir.GetDirectories();



也是Directory 这个错误,教程上是这样写的,怎么回事呀??


2006-11-13 11:22
快速回复:[求助]列驱动器目录错误??
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.025691 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved