C#问答

原创 2002年03月27日 14:03:00

Questions and Answers About C#

 <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

David Chappell - August 20 , 2001

 

[说明:文中部分内容和观点在作者的《understanding .net》一书中,有轻微变化。]

 

C# is one of the most visible aspects of Microsoft's .NET initiative. Developers commonly see the world through the lens of their language, and so C# can be their main aperture into .NET. Misconceptions abound, however. In this article, I'd like to address the confusions I hear most often about this new tool.

 

Which is better: C# or Java? The two languages have an awful lot in common, and so in some ways it's natural to try to choose a winner. The fact that each language is often viewed as the flagship of its campóC# in Microsoft's .NET environment, with Java supported by everybody elseómakes the comparison especially attractive. But it's the wrong question. Not only is there no objective answer, it wouldn't matter if there were. To see why, realize that both languages are in fact embedded in a much larger matrix of technologies. Using C# requires using the .NET Framework, including the Common Language Runtime (CLR) and the .NET Framework class library. Similarly, using Java requires using a Java virtual machine and some set of Java packages. The choice implies an enterprise vendor decision as well: C# means Microsoft (today, at least), whereas Java means IBM or BEA or some other non-Microsoft choice. Deciding which of these paths to take based solely on the language is like buying a car because you like the radio. You can do it, but you'll be happier if you choose based on the whole package.

 

Isn't C# just a copy of Java? In some ways, yes. The semantics of the CLR are quite Java-esque, and so any CLR-based language will have a good deal in common with Java. Creating a language that expresses those semantics in a syntax derived from C++ (for example, C#) is bound to result in something that looks a good deal like Java. Yet there are important features in C# that don't exist in Java. One good example is support for attributes, which allow a developer to easily control significant parts of her code's behavior. In .NET, attributes can be used to control which methods are exposed as SOAP-callable Web services, to set transaction requirements, and more. Still, if Microsoft had been free to make some changes to Java, my guess is that C# wouldn't exist today.

 

Isn't C# the native language of .NET? Every language built on the .NET Framework must use the CLR. The CLR defines core language semantics, and so all of the languages built on it tend to have a great deal in common. The biggest choice a .NET compiler writer has is the syntax his language will use. Microsoft needed to provide a natural path to the .NET Framework for both C++ and Visual Basic developers, and so the company created C# and Visual Basic.NET. Yet the facilities these two languages offer are nearly identicalóC# can do just a little bit moreóand so neither is the "native" .NET language. There is no such thing.

 

But won't most .NET developers eventually choose C# over Visual Basic.NET? No. Because the power of the two languages is so similar, the primary factor for developers migrating to the .NET world will probably be the syntax they prefer. Since many more developers use Visual Basic today than C++, I expect that VB.NET will be the most popular choice. For the vast majority of VB developers who are fond of VB-style syntax, there's no reason to switch to C#. I believe that the dominant language for building Windows applications five years from now will still be Visual Basic.

 

Will we eventually see a .NET Framework-based version of Java as a competitor to C#? Apparently not. Microsoft will never offer a complete Java environment because Sun has essentially required that Java licensees implement all of Javaósomething Microsoft will never do. (Why should it? Does anyone expect Sun to implement C#, VB.NET, and the .NET Framework?) And if a Java aficionado chooses to use a CLR-based Java compiler, such as the one included with Microsoft's JUMP for .NET technology, she's unlikely to be truly happy. Java implies a series of Java libraries and interfaces, such as Swing and Enterprise JavaBeans. The .NET Framework provides its own equivalent technologies, and so most of these won't be available. As a result, a developer using the Java language on the .NET Framework won't feel like she's working in a true Java environment because the familiar libraries won't be there.

 

C# is probably the most important new programming language since the advent of Java, and it will be used by many developers. But it may have gotten more attention than it deserves, if only because focusing on this new language tends to obscure the many other important innovations in the .NET Framework. Take it seriously, but don't think it's the main event in the new world of .NET. 

c#创建类似Siri的语音问答的简单应用

利用.net的语音识别库,很容易就可以制作类似Siri的简单的问答程序。 实现步骤如下: 1.创建一个新项目,并添加对System.Speech的引用。(如下图所示) 2. 在窗体内分别定义...
  • soft2buy
  • soft2buy
  • 2014年12月02日 12:58
  • 3797

四款国内常用问答系统源码:oASK,Tipask,百姓问,齐博知道

近日小编盘点了下站长之家收录的各款国内问答系统,也都下载试用了一番,今日便推荐以下四款较常用的问答系统:oASK问答系统、齐博知道系统、百姓问专业问答系统、Tipask问答系统,各款系统都各有特色,任...
  • zurich1979
  • zurich1979
  • 2014年08月09日 14:08
  • 2711

c#问答

当初学 C# 时是找个人大概问了一下数据类型和分支语句就开始做项目了。这两天又全面的看了一下相关的基础知识(学而时习之嘛),总结了25个问题:1.静态成员和非静态成员的区别?2.const 和 sta...
  • chyan5852
  • chyan5852
  • 2007年12月19日 13:19
  • 204

C#与C++、JAVA的区别

#(读做 "C sharp")是微软公司在去年六月发布的一种新的编程语言,并定于在微软职业开发者论坛(PDC)上登台亮相.C#是微软公司研究员Anders Hejlsberg的最新成果.C#看起来与J...
  • ivanspite
  • ivanspite
  • 2009年09月14日 17:51
  • 969

人机交互智能问答机器人的实现

人机交互智能问答机器人,这句话所包含的信息量和技术过于庞大,这里为大家进行拆分解释,并以图灵机器人平台为例,通俗的介绍其技术实现原理。...
  • pamchen
  • pamchen
  • 2014年08月12日 18:40
  • 13740

聊天机器人与自动问答技术

文章转载自:http://www.itlipeng.cn/?p=574 引言 最近半年,微软的聊天机器人小冰比较火,有些人对这方面的技术产生了兴趣,恰好之前做过自动问答方面的一些简单工作,这次...
  • leoking01
  • leoking01
  • 2016年03月03日 15:29
  • 2017

2016-08-20-java-写了一个问答机器人的程序

引用的数据来源是在聚合数据网站找的数据 key的话。。。。 package socket; import java.io.BufferedReader; import java.io.IOExc...
  • guofengs
  • guofengs
  • 2016年08月20日 10:02
  • 883

直播问答瓶颈及技术方案解读

2018年的第一个风口来的比往年要早一些。在“为人低调的网红小王”王思聪的影响下,发布不到10天的“冲顶大会”从2万直播在线用户量,暴涨到了70万。直播问答成为了现在最受关注的风口。 然而,目前...
  • agora_cloud
  • agora_cloud
  • 2018年01月15日 12:02
  • 222

Csharp基础整理

0. C#的几个概念 CLR(Common Language Runtime)公共语言运行库 CLS(Common Language Specifiction)公共语言规范 CTS(Common La...
  • rocky_03
  • rocky_03
  • 2017年08月21日 00:14
  • 245

【原创】聊天机器人与自动问答技术

聊天机器人属于自动问答(Question Answering)的一个方向,对它的研究很大一部分源自于图灵测试,本文主要探讨一下基本的聊天机器人技术的基本原理和实现机制。...
  • heiyeshuwu
  • heiyeshuwu
  • 2015年01月21日 11:18
  • 13321
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:C#问答
举报原因:
原因补充:

(最多只允许输入30个字)