2011年4月7日
摘要: publicsealedclassEventHandlerList:IDisposable{//FieldsprivateListEntryhead;privateComponentparent;//MethodspublicEventHandlerList();internalEventHandlerList(Componentparent){this.parent=parent;}publicvoidAddHandlers(EventHandlerListlistToAddFrom){for(ListEntryentry=listToAddFrom.head;entry!=null;en. 阅读全文
posted @ 2011-04-07 17:57 kasafuma 阅读(346) 评论(0) 推荐(0) 编辑
摘要: explicit 和 implicit 属于转换运算符,如用这两者可以让我们自定义的类型支持相互交换explicti 表示显式转换,如从 A -> B 必须进行强制类型转换(B = (B)A)implicit 表示隐式转换,如从 B -> A 只需直接赋值(A = B)隐式转换可以让我们的代码看上去更漂亮、更简洁易懂,所以最好多使用 implicit 运算符。[StructLayout(LayoutKind.Sequential)]publicstructTypedValue{privateSystem.Type_type;privateobject_val;publicTyped 阅读全文
posted @ 2011-04-07 16:56 kasafuma 阅读(461) 评论(1) 推荐(1) 编辑