C#
文章平均质量分 80
lyrebing
这个作者很懒,什么都没留下…
展开
-
Using the StringBuilder Class
Strings are so heavily used in all programming languages that we do not think about them very much. We use them simply and hope to do the right thing. Normally all goes well but sometimes we need more原创 2011-07-06 15:00:11 · 553 阅读 · 0 评论 -
C# Delegate (一)
[转序:这是一篇古老的文章。但毫无疑问,Lippman对delegate的阐述是精辟的。]如果你想拿C# 与其它“C家族”的语言做比较,C#正有个不同寻常的特性,其在C++ 或者Java 里没有真正意义上的对应之物。--------------------------------------------------------------------------------C# 是一个原创 2014-05-15 11:10:11 · 714 阅读 · 0 评论 -
C++、C#中 abstract 与 virtual关键字的区别联系
C++: C++中,由virtual实现多态。除多态外,virtual有两个特殊用法:1、虚基类(Virtual base class) 为解决多重继承时的二义性提出来的。使用方法:class B :virtual public Aclass C :virtual public Aclass D: public B, public转载 2014-04-16 15:06:13 · 3149 阅读 · 0 评论 -
浅谈C#内存回收与Finalize, Dispose, Close方法(一)
一. net的对象使用一般分为三种情况﹕1.创建对象2.使用对象3.释放对象原创 2014-04-16 12:52:20 · 2173 阅读 · 0 评论 -
c# 中的Equals()和==有什么区别?
对于值类型、引用类型来说比较过程样using System;using System.Collections.Generic;using System.Text;namespace ConsoleApplication1{ class Person { private string name; public string Name转载 2014-04-11 14:08:44 · 765 阅读 · 0 评论 -
浅谈C#内存回收与Finalize, Dispose, Close方法(二)
hauj.NET Framework 提供Object.Finalize方法,它允许对象在垃圾回收器回收该对象使用的内存时适当清理其非托管资源。 默认情况下,Finalize 方法不执行任何操作。 如果您要让垃圾回收器在回收对象的内存之前对对象执行清理操作,您必须在类中重写Finalize 方法。若要在 C# 中实现 Finalize 方法,您必须间接使用析构函数语法。也就是C#的 ~Cl原创 2014-04-16 14:26:30 · 1915 阅读 · 0 评论 -
.Net 反射
两个现实中的例子:1、B超:大家体检的时候大概都做过B超吧,B超可以透过肚皮探测到你内脏的生理情况。这是如何做到的呢?B超是B型超声波,它可以透过肚皮通过向你体内发射B型超声波,当超声波遇到内脏壁的时候就会产生一定的“回音”反射,然后把“回音”进行处理就可以显示出内脏的情况了(我不是医生也不是声学专家,不知说得是否准确^_^)。2、地球内部结构:地球的内部结构大体可以分为三层:地壳、地幔和转载 2014-10-09 10:46:00 · 543 阅读 · 0 评论 -
C# Operator Overloading
All unary and binary operators have pre-defined implementations, that are automatically available in any expressions. In addition to this pre-defined implementations, user defined implementations can转载 2011-02-22 11:28:00 · 3117 阅读 · 2 评论 -
C#使用Monitor类、Lock、Mutex和Semaphore进行多线程同步
在多线程中,为了使数据保持一致性必须要对数据或是访问数据的函数加锁,在数据库中这是很常见的,但是在程序中由于大部分都是单线程的程序,所以没有加锁的必要,但是在多线程中,为了保持数据的同步,一定要加锁,好在Framework中已经为我们提供了三个加锁的机制,分别是Monitor类、Lock关键字和Mutex类。 其中Lock关键词用法比较简单,Monitor类和Lock的用法差不多。这两个都是锁原创 2014-06-27 18:03:19 · 1797 阅读 · 0 评论 -
C++转向C#的疑惑:难道C#中没有拷贝构造函数?
不可否认,C++在过去十年乃至现在一直都是windows平台上的主流开发语言,而来势凶猛的.NET势必开辟一个崭新的局面,从目前的种种迹象来看,.NET是大势所趋,而C#作为.NET平台上的第一开发语言自然备受关注,于是有很多程序员纷纷转向C#,这其中当然不乏C++程序员。情况往往是这样,从一种语言过渡到另一种语言,哪怕是比较相似的语言,程序员也经常无意识地陷入原开发语言的思维定势,这样的结果通常转载 2011-02-25 11:29:00 · 760 阅读 · 0 评论 -
Validate User Input
For most programs, displaying data is only half of the battle. The other big challenge is analyzing, accepting, and rejecting data entered by the user. In an ideal world, where all users always enter原创 2011-07-11 15:23:24 · 1075 阅读 · 0 评论 -
强调记载:Static Constructors (C# Programming Guide)
A static constructor is used to initialize any static data, or to perform a particular action that needs performed once only. It is called automatically before the first instance is created or any s原创 2012-06-29 13:39:25 · 713 阅读 · 0 评论 -
C# Delegate (二)
关于c#中的delegate,经过《用好C#Delegate》介绍,应该牢固建立起以下的概念:一个delegate type 的声明在本质上是创建了一个新的subtype instance,该subtype 派生自.NETlibrary framework 的abstractbase classes Delegate 或MulticastDelegate,它们提供一组pub原创 2015-11-26 17:53:01 · 282 阅读 · 0 评论