什么是计划"的意义;私人保护" C#访问修饰符?
由于罗斯林 CodePlex上的文档的一部分,有一个名为的语言功能实现状态,计划语言功能为C#和VB。
As part of the Roslyn documentation on CodePlex, there's a page called Language feature implementation status, with planned language features for C# and VB.
一个特点我找不到ŧ总结我的头周围是私人保护
访问修饰符:
One feature I couldn't wrap my head around was private protected
access modifier:
private protected string GetId() { … }
还有的C#语言设计说明的,这也解释了许多新的功能,但不是这一个。
There is also a page of C# Language Design Notes, which explains many new features, but not this one.
埃里克利珀中的评论:
您的错误是在修饰符越来越多的限制的思考。其实修饰符总是下降的限制。请记住,事情是私有默认情况下;只有通过添加改性剂才能让他们少受限制。
Your error is in thinking of the modifiers as increasing restrictions. The modifiers in fact always decrease restrictions. Remember, things are "private" by default; only by adding modifiers do you make them less restricted.
什么是的意思私人保护
?什么时候我可能会使用它?
What is the meaning of private protected
? When might I use it?
据的专业C#2008 由De比尔Evjen和Jay格林1699页:
According to "Professional C# 2008" by De Bill Evjen and Jay Glynn, page 1699:
私人保护 - 结果仅在当前装配中派生类型
private protected - "only derived types within the current assembly"
C ++ / CLI有类似的功能 - 定义和消费类和结构(C ++ / CLI)>会员可见:
C++/CLI has a similar feature - Define and Consume Classes and Structs (C++/CLI) > Member visibility:
私人保护
- 或 - 保护私有
- 会员被保护组件内,但私人组装外
private protected
-or-protected private
- Member is protected inside the assembly but private outside the assembly.