/
aprogrammer
/
dotnet-docs
Обзор
Документация
Войти
/
aprogrammer
/
dotnet-docs
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
docs/csharp/language-reference/attributes/snippets/NewPropertyOrFieldAttribute.cs
21 строка
580 B
Bill Wagner
first draft of nameof updates (#29549)
15 июн 2022, 00:43
Не верифицирован
15 июн 2022, 00:43
86ba43a
Код
Авторство
О чём код?
using System; namespace AttributeExamples; // <SnippetDefinePropertyAttribute> [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] class NewPropertyOrFieldAttribute : Attribute { } // </SnippetDefinePropertyAttribute> // <SnippetUsePropertyAttribute> class MyClass { // Attribute attached to property: [NewPropertyOrField] public string Name { get; set; } = string.Empty; // Attribute attached to backing field: [field: NewPropertyOrField] public string Description { get; set; } = string.Empty; } // </SnippetUsePropertyAttribute>