摘要: -> 运算符将指针取消引用与成员访问组合在一起。 x->y 其中 x 为 T* 类型的指针,y 为 T 的成员 等效于 (*x).y 只能在标记为不安全的代码中使用 -> 运算符。不能重载 -> 运算符。 // compile with: /unsafestruct Point{ public int x, y;}class MainClass12{ unsaf... 阅读全文
posted @ 2014-07-26 10:50 enif 阅读(282) 评论(0) 推荐(0) 编辑
摘要: ?? 运算符称为 null 合并运算符,用于定义可以为 null 值的类型和引用类型的默认值。 如果此运算符的左操作数不为 null,则此运算符将返回左操作数;否则返回右操作数。 class NullCoalesce{ static int? GetNullableInt() { return null; } static string GetSt... 阅读全文
posted @ 2014-07-26 10:40 enif 阅读(355) 评论(0) 推荐(0) 编辑
豫ICP备2021034901号