/
smwwiki
/
OneScript_fork
Обзор
Документация
Войти
/
smwwiki
/
OneScript_fork
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
src/OneScript.Core/Contexts/ContextPropertyAttribute.cs
47 строк
1 KB
Andrey Ovsiankin
Рефакторинг неймспейсов
30 авг 2021, 16:41
30 авг 2021, 16:41
225528b
Код
Авторство
О чём код?
/*---------------------------------------------------------- This Source Code Form is subject to the terms of the Mozilla Public License, v.2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. ----------------------------------------------------------*/ using System; using OneScript.Commons; namespace OneScript.Contexts { [AttributeUsage(AttributeTargets.Property)] public class ContextPropertyAttribute : Attribute { private readonly string _name; private readonly string _alias; public ContextPropertyAttribute(string name, string alias = "") { if (!Utils.IsValidIdentifier(name)) throw new ArgumentException("Name must be a valid identifier"); if (!string.IsNullOrEmpty(alias) && !Utils.IsValidIdentifier(alias)) throw new ArgumentException("Alias must be a valid identifier"); _name = name; _alias = alias; CanRead = true; CanWrite = true; } public bool CanRead { get; set; } public bool CanWrite { get; set; } public string GetName() { return _name; } public string GetAlias() { return _alias; } } }