仓酷云

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 555|回复: 7
打印 上一主题 下一主题

[学习教程] NET网页编程之使用C#完成词频统计

[复制链接]
不帅 该用户已被删除
跳转到指定楼层
楼主
发表于 2015-1-16 14:25:10 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
中间码是基于一个虚拟机器。源代码是最高层的,理论上从源代码开始直接编译成本地码能提供最大优化的。而中间码只能是转译成本地码,效率上难免受到损耗。根据虚拟机器所设定的体系结构的特点,和本地机器的差异的多少。未几说了,间接上源码:

usingSystem;
usingSystem.Drawing;
usingSystem.Collections;
usingSystem.ComponentModel;
usingSystem.Windows.Forms;
usingSystem.Data;
namespaceWindowsApplication1
{
publicclassForm1:System.Windows.Forms.Form
{
privateSystem.Windows.Forms.TextBoxtextBox1;
privateSystem.Windows.Forms.TextBoxtextBox2;
privateSystem.Windows.Forms.Buttonbutton1;

privateSystem.ComponentModel.Containercomponents=null;

publicForm1()
{
InitializeComponent();
}

protectedoverridevoidDispose(booldisposing)
{
if(disposing)
{
if(components!=null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}

privatevoidInitializeComponent()
{
this.textBox1=newSystem.Windows.Forms.TextBox();
this.textBox2=newSystem.Windows.Forms.TextBox();
this.button1=newSystem.Windows.Forms.Button();
this.SuspendLayout();

this.textBox1.Location=newSystem.Drawing.Point(8,32);
this.textBox1.Multiline=true;
this.textBox1.Name="textBox1";
this.textBox1.ScrollBars=System.Windows.Forms.ScrollBars.Both;
this.textBox1.Size=newSystem.Drawing.Size(176,344);
this.textBox1.TabIndex=0;
this.textBox1.Text="";

this.textBox2.Location=newSystem.Drawing.Point(328,32);
this.textBox2.Multiline=true;
this.textBox2.Name="textBox2";
this.textBox2.ScrollBars=System.Windows.Forms.ScrollBars.Both;
this.textBox2.Size=newSystem.Drawing.Size(168,344);
this.textBox2.TabIndex=1;
this.textBox2.Text="";

this.button1.Location=newSystem.Drawing.Point(216,8);
this.button1.Name="button1";
this.button1.TabIndex=2;
this.button1.Text="词频统计";
this.button1.Click+=newSystem.EventHandler(this.button1_Click);

this.AutoScaleBaseSize=newSystem.Drawing.Size(6,14);
this.ClientSize=newSystem.Drawing.Size(512,397);
this.Controls.Add(this.button1);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.textBox1);
this.Name="Form1";
this.Text="Form1";
this.ResumeLayout(false);
}

[STAThread]
staticvoidMain()
{
Application.Run(newForm1());
}

privatevoidbutton1_Click(objectsender,System.EventArgse)
{
strings=textBox1.Text;
char[]c={,,,.,?,,:,;,!};
string[]ss=s.Split(c);
Hashtableha=newHashtable();

foreach(stringsssinss)
{
if(ha.Contains(sss))
{
ha[sss]=(int)ha[sss]+1;
}
else
{
ha.Add(sss,1);
}
}

foreach(DictionaryEntrydeinha)
{
textBox2.AppendText(de.Key+":"+de.Value+"
");
}

}
}
}
归根到底,Java跨平台可以,但是要重新编写代码,否则还分什么J2EE/J2SE/J2ME呢!
乐观 该用户已被删除
沙发
发表于 2015-1-18 14:19:45 | 只看该作者
众所周知,Windows以易用而出名,也因此占据不少的服务器市场。
分手快乐 该用户已被删除
板凳
发表于 2015-2-2 11:30:57 | 只看该作者
目前在微软的.net战略中新推出的ASP.net借鉴了Java技术的优点,使用CSharp(C#)语言作为ASP.net的推荐语言,同时改进了以前ASP的安全性差等缺点。但是,使用ASP/ASP.net仍有一定的局限性,因为从某种角度来说它们只能在微软的WindowsNT/2000/XP+IIS的服务器平台上良好运行(虽然像ChilliSoft提供了在UNIX/Linux上运行ASP的解决方案.
小女巫 该用户已被删除
地板
发表于 2015-2-7 19:13:01 | 只看该作者
碰到复杂点的问题都不知道能不能解决,现在有点实力的公司都选择自已在开源的基础上做开发。但没听说过有人在IIS上做改进的,windows、sqlserver集群方面的应用也很少见。
山那边是海 该用户已被删除
5#
发表于 2015-2-23 09:07:16 | 只看该作者
网页从开始简单的hmtl到复杂的服务语言,走过了10多个年头,各种技术层出不穷,单个的主流技术也在不断翻新的版本,现在分析下各种语言的区别、优势、劣势、开发注意事项!
6#
发表于 2015-3-7 07:35:46 | 只看该作者
提供基于组件、事件驱动的可编程网络表单,大大简化了编程。还可以用ASP.NET建立网络服务。
柔情似水 该用户已被删除
7#
发表于 2015-3-14 16:53:37 | 只看该作者
可以看作是VC和Java的混合体吧,尽管MS自己讲C#内核中更多的象VC,但实际上我还是认为它和Java更象一些吧。首先它是面向对象的编程语言,而不是一种脚本,所以它具有面向对象编程语言的一切特性。
老尸 该用户已被删除
8#
发表于 2015-3-21 13:21:33 | 只看该作者
弱类型造成潜在的出错可能:尽管弱数据类型的编程语言使用起来回方便一些,但相对于它所造成的出错几率是远远得不偿失的。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|仓酷云 鄂ICP备14007578号-2

GMT+8, 2024-9-29 16:21

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表