随笔分类 -  C#

摘要:I often hear the question, “Should I design a base type or an interface?” The answer isn’talways clear-cut. Here are some guidelines that might help you:n IS-A vs. CAN-DO relationship A type can inherit only one implementation. If thederived type can’t claim an IS-A relationship with the base type, 阅读全文

posted @ 2011-05-30 14:20 nealgaga 阅读(262) 评论(0) 推荐(0) |

摘要:fixed 语句设置指向托管变量的指针并在 statement 执行期间“钉住”该变量。如果没有 fixed 语句,则指向可移动托管变量的指针的作用很小,因为垃圾回收可能不可预知地重定位变量。C# 编译器只允许在 fixed 语句中分配指向托管变量的指针。[代码]可以用数组或字符串的地址初始化指针:[代码]要初始化不同类型的指针,只需嵌套 fixed 语句:[代码] 阅读全文

posted @ 2011-02-17 10:34 nealgaga 阅读(1926) 评论(0) 推荐(1) |

博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3