半点优化网 http://www.bdxc.net/
当前位置首页 > 网站技术问题> 正文

.net(C#)的几个小问题,有过开发经验的应该不成问题

2022-09-22 02:20:19 暂无评论 14 网站技术问题 C#   问题   不成

1、说是代码已经编译,是什么意思,不是很明白?


这是在你编写的代码,编译后生成文件,就是已编译的了。只有已编译的文件才可以使用C#里面。


2、如果现在我有一个小的应用已经完成,三层结构也搭建好,如何发布呢,我看过很多的成品项目,发布出来的东西怎么都不一样呢,最好告诉我详细的步骤。


发布就是网站项目。1点击解决方案右键。有网站发布,在选择你要发布的文件夹里就可以了的。


3、if((int)q[i]>=0x4E00 && (int)q[i]<=0x9FA5)
判断汉字的使用,多个汉字时加点处理就好了的,把汉字才成数组一个一个的比较就可以了


这个是方法:


///
///格式化字符串长度,超出部分显示省略号,区分汉字跟字母。汉字2个字节,字母数字一个字节
///
string temp=string.Empty;
if(System.Text.Encoding.Default.GetByteCount(str)<=n)//如果长度比需要的长度n小,返回原字符串
{
return str;
}
else
{
int t=0;
char[] q=str.ToCharArray();
for(int i=0;i<q.Length&&t<n;i++)
{
if((int)q[i]>=0x4E00 && (int)q[i]<=0x9FA5)//是否汉字
{
temp+=q[i];
t+=2;
}
else
{
temp+=q[i];
t++;
}
}
return (temp+...);
}
}


猜你喜欢

随机文章


    Warning: require(): open_basedir restriction in effect. File(/www/wwwroot/bdxc.net/e/class/connect.php) is not within the allowed path(s): (/www/wwwroot/www.bdxc.net/:/tmp/) in /www/wwwroot/www.bdxc.net/1.php on line 4

    Warning: require(/www/wwwroot/bdxc.net/e/class/connect.php): failed to open stream: Operation not permitted in /www/wwwroot/www.bdxc.net/1.php on line 4

    Fatal error: require(): Failed opening required '/www/wwwroot/bdxc.net/e/class/connect.php' (include_path='.:/www/server/php/56/lib/php') in /www/wwwroot/www.bdxc.net/1.php on line 4