工作要我学用c sharp开发软件

来源:互联网 发布:淘宝商品二维码生成 编辑:程序博客网 时间:2024/05/17 00:53

最近公司要开发新的软件,需要使用c sharp, 而且还是和别人合作。

所以老大要求开始学习c sharp, 要在合作中学习以及积极参与。

之前一直的c++, vc环境,看c sharp就是怪啊,其实也能看得懂,就是怪。

比如, Systems.Timers.Timer 这个类,CSDN有这样的一段解释

// Normally, the timer is declared at the class level,

// so that it stays in scope as long as it is needed.

// If the timer is declared in a long-running method,

// KeepAlive must be used to prevent the JIT compiler

// from allowing aggressive garbage collection to occur

 // before the method ends. (See end of method.)

 

说的是,为了防止Timer 对象被垃圾回收器给回收,需要用GC.KeepAlive来申明一下。

若是c++, 直接定义一个类成员Timer对象就好了,哪有被回收的道理。

 

看样子有的熬了。