编译错误
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。 编译器错误消息: CS0122: “DAL.FormatString”不可访问,因为它受保护级别限制源错误: 行 20: BLL.NewsLogic B_news = new BLL.NewsLogic();
行 21: BLL.BigClassLogic B_bc = new BLL.BigClassLogic();
行 22: DAL.FormatString FString = new DAL.FormatString();
行 23:
行 24: protected void Page_Load(object sender, EventArgs e)using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using DAL;public partial class web_Default2 : System.Web.UI.Page
{
/// <summary>
/// 实例化接口层NewsLogic类的对象
/// </summary>
BLL.NewsLogic B_news = new BLL.NewsLogic();
BLL.BigClassLogic B_bc = new BLL.BigClassLogic();
DAL.FormatString FString = new DAL.FormatString(); protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
DataBindRepeater1();
DataBindRepeaterBigClass();
this.Title = "新闻系统----本系统采用ASP.NET 3.5+SQL Server 2005技术架构!";
Session.Clear(); }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;namespace DAL
{
/// <summary>
/// 字符串处理类
/// </summary>
public class FormatString
{
#region 字符串截取函数
/// <summary>
/// 截取字符串方法
/// </summary>
/// <param name="inputString">要截取的原字符串</param>
/// <param name="len">要截取的长度</param>
/// <returns>截取后的字符串</returns> public string CutString(string str1, int length)
{
int s = str1.Length;
if (length <= s)
{
str1 = str1.Substring(0, length) + "…";
}
return str1;
}
#endregion
}
}
我的疑问:为什么我把FormatString定义为public类了,还是会报错呢?
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。 编译器错误消息: CS0122: “DAL.FormatString”不可访问,因为它受保护级别限制源错误: 行 20: BLL.NewsLogic B_news = new BLL.NewsLogic();
行 21: BLL.BigClassLogic B_bc = new BLL.BigClassLogic();
行 22: DAL.FormatString FString = new DAL.FormatString();
行 23:
行 24: protected void Page_Load(object sender, EventArgs e)using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using DAL;public partial class web_Default2 : System.Web.UI.Page
{
/// <summary>
/// 实例化接口层NewsLogic类的对象
/// </summary>
BLL.NewsLogic B_news = new BLL.NewsLogic();
BLL.BigClassLogic B_bc = new BLL.BigClassLogic();
DAL.FormatString FString = new DAL.FormatString(); protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
DataBindRepeater1();
DataBindRepeaterBigClass();
this.Title = "新闻系统----本系统采用ASP.NET 3.5+SQL Server 2005技术架构!";
Session.Clear(); }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;namespace DAL
{
/// <summary>
/// 字符串处理类
/// </summary>
public class FormatString
{
#region 字符串截取函数
/// <summary>
/// 截取字符串方法
/// </summary>
/// <param name="inputString">要截取的原字符串</param>
/// <param name="len">要截取的长度</param>
/// <returns>截取后的字符串</returns> public string CutString(string str1, int length)
{
int s = str1.Length;
if (length <= s)
{
str1 = str1.Substring(0, length) + "…";
}
return str1;
}
#endregion
}
}
我的疑问:为什么我把FormatString定义为public类了,还是会报错呢?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货