Tuesday, August 31, 2004

Differences between Java & C#

  • The Main() method is capitalized.
  • The Java concept of packages is replaced with the C# namespace.
  • C# supports attributes for including extra information for the compiler.
  • Boxing and unboxing convert between value and reference types.
  • There is no class path.
  • C# supports properties.
  • C# uses ref and out to pass types by reference instead of by value.
  • Delegates provide type-safe function pointers.
  • C# methods are non-virtual by default.
  • The C# switch statement supports with string data type.
  • C# supports enumerated types.
  • C# provides the struct for light-weight classes.
  • C# supports pointers, in unsafe code only.

  • Main() 方法的首字母是大写的.
  • Java中的packages概念替换成了C#中的namespace.
  • C# 支持属性,这样可以为编译器提供一些额外的信息.
  • 值类型和引用类型转化的时候会存在装箱和拆箱.
  • 没有Classpath一说了.
  • C# 支持属性.
  • C# 使用ref out 在传值的地方来传一个引用类型.
  • Delegates 提供了类型安全的函数指针.
  • C# 的方法默认是非虚的.
  • C# 的switch 语句支持用string 类型的数据.
  • C# 支持枚举类型.
  • C# 通过struct 来提供轻量级的类.
  • C# 在非安全代码的情况下支持指针.
  • No comments:

    Post a Comment