ActionResult 是一个抽象(abstract)类,ViewResult 只是ActionResult 的一个实现(implementation)。如果你确认你返回的是一个视图(view),你可以直接返回类型为ViewResult。ActionResult 有很多的派生类,如果你很确定你要返...
分类:
Web程序 时间:
2014-10-29 23:39:13
阅读次数:
216
AsyncTask和Handler对比 1 ) AsyncTask实现的原理,和适用的优缺点 AsyncTask,是android提供的轻量级的异步类,可以直接继承AsyncTask,在类中实现异步操作,并提供接口反馈当前异步执行的程度(可以通过接口实现UI进...
分类:
移动开发 时间:
2014-10-29 22:25:15
阅读次数:
287
解决共享资源竞争
一个不正确的访问资源示例
考虑下面的例子,其中一个任务产生偶数,而其他任务消费这些数字。这里,消费者任务的唯一工作就是检查偶数的有效性。
我们先定义一个偶数生成器的抽象父类。
public abstract class IntGenerator {
private volatile boolean canceled = false;...
分类:
其他好文 时间:
2014-10-29 21:48:09
阅读次数:
252
常见的页面间的传值有session,cookie,application,server.transfer(),queryString,今天主要记录一下server.transfer()的用法。从A页面Transfer到B页面时,就可以在B页面通过Context.Handler获得A页面的一个类的实例...
分类:
Web程序 时间:
2014-10-29 21:11:19
阅读次数:
141
(1) OOP and Design Patterns(1.1) Please explain difference among class, interface and abstract class. When you would use it rather than other?FeatureI...
分类:
其他好文 时间:
2014-10-29 19:16:24
阅读次数:
160
Android系统中的视图组件并不是线程安全的,如果要更新视图,必须在主线程中更新,不可以在子线程中执行更新的操作。所以可以依靠消息机制来进行更新。 先声明一个handler来处理消息 private Handler handler = new Handler() { @Over...
分类:
其他好文 时间:
2014-10-29 18:51:44
阅读次数:
184
转自:http://www.cnblogs.com/ArmyShen/archive/2012/09/02/2667953.htmlabstract修饰符可以和类、方法、属性、索引器及事件一起使用,在类声明中使用abstract修饰符以表明这个类只能是其他类的基类。抽象类的特性(1)抽象类不能被实例...
??
The choice of whether to design your functionality as an interface or an abstract class can sometimes be a difficult one. An
abstract class is a class that cannot be instantiated, but must be inh...
AsyncTask和Handler对比1 ) AsyncTask实现的原理,和适用的优缺点AsyncTask,是android提供的轻量级的异步类,可以直接继承AsyncTask,在类中实现异步操作,并提供接口反馈当前异步执行的程度(可以通过接口实现UI进度更新),最后反馈执行的结果给UI主线程.使...
分类:
移动开发 时间:
2014-10-29 16:49:49
阅读次数:
225
??
Abstract classes are closely related to interfaces. They are classes that cannot be instantiated, and are frequently either partially implemented, or not at all implemented. One key difference bet...