Събитие
Създаване на интелигентни приложения
17.03, 21 ч. - 21.03, 10 ч.
Присъединете се към поредицата срещи, за да изградите мащабируеми AI решения, базирани на реални случаи на употреба с колеги разработчици и експерти.
Регистрирайте се сегаТози браузър вече не се поддържа.
Надстройте до Microsoft Edge, за да се възползвате от най-новите функции, актуализации на защитата и техническа поддръжка.
Specifies that a property can be written but not read.
Declaration Context. You can use WriteOnly
only at module level. This means the declaration context for a WriteOnly
property must be a class, structure, or module, and cannot be a source file, namespace, or procedure.
You can declare a property as WriteOnly
, but not a variable.
Sometimes you want the consuming code to be able to set a value but not discover what it is. For example, sensitive data, such as a social registration number or a password, needs to be protected from access by any component that did not set it. In these cases, you can use a WriteOnly
property to set the value.
Важно
When you define and use a WriteOnly
property, consider the following additional protective measures:
Overriding. If the property is a member of a class, allow it to default to NotOverridable, and do not declare it Overridable
or MustOverride
. This prevents a derived class from making undesired access through an override.
Access Level. If you hold the property's sensitive data in one or more variables, declare them Private so that no other code can access them.
Encryption. Store all sensitive data in encrypted form rather than in plain text. If malicious code somehow gains access to that area of memory, it is more difficult to make use of the data. Encryption is also useful if it is necessary to serialize the sensitive data.
Resetting. When the class, structure, or module defining the property is being terminated, reset the sensitive data to default values or to other meaningless values. This gives extra protection when that area of memory is freed for general access.
Persistence. Do not persist any sensitive data, for example on disk, if you can avoid it. Also, do not write any sensitive data to the Clipboard.
The WriteOnly
modifier can be used in this context:
Обратна връзка за .NET
.NET е проект с отворен код. Изберете връзка, за да предоставите обратна връзка:
Събитие
Създаване на интелигентни приложения
17.03, 21 ч. - 21.03, 10 ч.
Присъединете се към поредицата срещи, за да изградите мащабируеми AI решения, базирани на реални случаи на употреба с колеги разработчици и експерти.
Регистрирайте се сега