访问者关键字的“保真度”是什么意思? [英] What does 'fidelity' of accessor keywords mean?

查看:196
本文介绍了访问者关键字的“保真度”是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读.Net Docs,遇到了保真度这个词,

I'm reading through .Net Docs and i came across this term "fidelity",


类型安全性也可以用来帮助通过保证
的保真度来强制封装。

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

这是什么意思(相对于accessor关键字)?

What does it mean (in relation to accessor keywords)?

推荐答案

叹息。

文档太多了,没有开发团队有足够的时间用术语来检查它的准确性。此概述是一些小错误和令人困惑的非标准术语用法的

There is simply too much documentation and not enough time for the development team to review it for accuracy in jargon. This overview is a mess of small errors and confusing, non-standard jargon usages.

相关段落为:


类型安全性还通过保证accessor关键字的保真度来帮助强制执行封装。访问者关键字是控制其他代码对给定类型的成员的访问的构件。这些通常用于类型内用于管理其行为的各种数据。

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.

>。这里太错了。 访问者关键字应为可访问性级别。 其他代码令人困惑; 其他代码是指与其他完全不同的代码。可访问性修饰符控制对成员无处不在的访问,而不仅仅是在其他代码中。为什么我们要谈论成员,然后突然切换到数据? 管理行为是什么意思?

Yuck. So much wrong here. "accessor keyword" should be "accessibility level". "Other code" is confusing; "other code" means code which is other than what exactly? Accessibility modifiers control access to members everywhere, not just in "other code". Why are we talking about members and then suddenly switching to data? What does "manage behaviour" mean?

让我们用标准的C#行话来改写。

Let's rephrase using standard C# jargon.


静态类型检查通过确保程序遵守类型成员声明的可访问性级别来帮助实施封装。例如,如果类型 Dog 具有私有成员 mother ,则静态类型检查有助于确保尝试访问该成员不会阻止 Dog 类之外的代码。

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.

修复所有其余问题本文档中的一些疯狂错误留给读者练习。例如,此代码示例出了什么问题?

Fixing all the rest of the crazy mistakes in this document is left as an exercise to the reader. For example, what's wrong with this code sample?

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.

这篇关于访问者关键字的“保真度”是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆