Exemple #1
0
        public int FindProperty(string name)
        {
            GetAllProperties();
            var hasProperty = _propertyNames.TryGetIdOfName(name, out var id);

            if (!hasProperty)
            {
                throw RuntimeException.PropNotFoundException(name);
            }

            return(id);
        }
Exemple #2
0
        public int FindProperty(string name)
        {
            int id;
            var hasProperty = _propertyNames.TryGetIdOfName(name, out id);

            if (!hasProperty)
            {
                var propInfo = _reflectedType.GetProperty(name, BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Public);
                if (propInfo == null)
                {
                    throw RuntimeException.PropNotFoundException(name);
                }

                id = _propertyNames.RegisterName(name);
                System.Diagnostics.Debug.Assert(_propertyCache.Count == id);

                _propertyCache.Add(propInfo);
            }

            return(id);
        }