app_code里我建立了一个限制字数的类stringLimitLength.cs
但在页面的aspx.cs中应用这个类时this.MetaDescription = stringLimitLength.limitLength(data.Single().newsContent, 100); stringLimitLength提示上下文不存在,using命名空间,就提示app_code不存在,不知道如何解释,望高手赐教……
但在页面的aspx.cs中应用这个类时this.MetaDescription = stringLimitLength.limitLength(data.Single().newsContent, 100); stringLimitLength提示上下文不存在,using命名空间,就提示app_code不存在,不知道如何解释,望高手赐教……
{
public static string limitLength(string s, int sLength)
{
if (s.Length <= sLength)
{
return s;
}
else
{
string resultString = s.Substring(0, sLength);
return resultString + "…";
}
}
}