C++ Programmer's Cookbook



{C++ 基础} {C++ 高级} {C#界面,C++核心算法} {设计模式} {C#基础}

  C++博客 :: 首页 :: 联系 :: 聚合  :: 管理
  452 Posts :: 4 Stories :: 562 Comments :: 0 Trackbacks

2005年11月18日 #

     摘要: 归纳起来,泛型比非泛型具有下面两个优点:

1、 更加安全

在非泛型编程中,虽然所有的东西都可以作为Object传递,但是在传递的过程中免不了要进行类型转换。而类型转换在运行时是不安全的。使用泛型编程将可以减少不必要的类型转换,从而提高安全性。

2、 效率更高

在非泛型编程中,将简单类型作为Object传递时会引起Boxing和Unboxing操作,这两个过程都是具有很大开销的。使用泛型编程就不必进行Boxing和Unboxing操作了。



.NET泛型具有很好的二进制重用性。这一点得益于.NET将泛型内建在CLR之中。C++泛型和评估中Java泛型所依靠的是它们各自的编译器所提供的特性,编译器在编译泛型代码时将确切的类型展开,这就难免会出现代码膨胀的问题。而.NET的泛型代码是在运行时由JIT即时编译的,这样CLR就可以为不同类型重用大部分的即时编译代码了。  阅读全文
posted @ 2005-11-18 13:51 梦在天涯 阅读(956) | 评论 (0)编辑 收藏

posted @ 2005-11-18 13:37 梦在天涯 阅读(120) | 评论 (0)编辑 收藏

posted @ 2005-11-18 13:36 梦在天涯 阅读(778) | 评论 (1)编辑 收藏

     摘要: Namespaces/Identifiers   阅读全文
posted @ 2005-11-18 12:49 梦在天涯 阅读(88) | 评论 (0)编辑 收藏

     摘要: In this article, we will analyze COM components and their application in C#. These components became popular among developers after Microsoft released Active Server Pages. However, the whole scenario changed when Microsoft released its Windows 2000 operating system and subsequent COM+ technology. In this article, we will examine the fundamentals of this exiting technology followed by its application in C#.

  阅读全文
posted @ 2005-11-18 12:30 梦在天涯 阅读(135) | 评论 (0)编辑 收藏

     摘要: Exception Handling in C#  阅读全文
posted @ 2005-11-18 12:03 梦在天涯 阅读(137) | 评论 (0)编辑 收藏