Пример #1
0
        public bool TryGetByAlias <T>(string alias, out Aliased <T> item) where T : class
        {
            IAliased i;

            if (aliases.TryGetValue(alias, out i))
            {
                item = i as Aliased <T>;
                return(item != null);
            }
            item = null;
            return(false);
        }
Пример #2
0
        public Aliased <T> SetAlias <T>(string alias, T item)
        {
            if (item == null)
            {
                throw new ArgumentNullException(nameof(item));
            }
            if (String.IsNullOrEmpty(alias))
            {
                throw new ArgumentNullException(nameof(alias));
            }
            var aliased = new Aliased <T>(alias, item);

            aliases[alias] = aliased;
            return(aliased);
        }