'fidelity' of accessor keywords 是什么意思?

What does 'fidelity' of accessor keywords mean?

我正在阅读 .Net 文档,我遇到了这个术语 "fidelity",

Type safety is also used to help enforce encapsulation by guaranteeing the fidelity of the accessor keywords.

这是什么意思(与访问器关键字有关)?

感叹

文档太多,开发团队没有足够的时间来检查行话的准确性。此概述是一个 混乱 的小错误和令人困惑的 non-standard 行话用法。

有问题的段落是:

Type safety is also used to help enforce encapsulation by guaranteeing the fidelity of the accessor keywords. Accessor keywords are artifacts which control access to members of a given type by other code. These are usually used for various kinds of data within a type that are used to manage its behavior.

哎呀。这里错了很多。 "accessor keyword" 应该是 "accessibility level"。 "Other code" 令人困惑; "other code" 表示代码 other 而不是 what 究竟是什么?可访问性修饰符控制对 无处不在 成员的访问,而不仅仅是 "other code"。为什么我们在谈论 members 然后突然切换到 data? "manage behaviour" 是什么意思?

让我们用标准的 C# 行话重新表述一下。

Static type checking helps enforce encapsulation by ensuring that a program respects the accessibility levels declared by a member of a type. For example, if type Dog has a private member mother, then static type checking helps ensure that attempts to access that member from code outside the Dog class will be prevented.

修复本文档中所有其他疯狂错误留作 reader 的练习。例如,此代码示例有什么问题?

Dog dog = AnimalShelter.AdoptDog(); // Returns a Dog type.
Pet pet = (Pet)dog; // Dog derives from Pet.
pet.ActCute();
Car car = (Car)dog; // Will throw - no relationship between Car and Dog.
object temp = (object)dog; // Legal - a Dog is an object.