예제 #1
0
        // получение свойства
        public bool TryGetMember(string name, out object result, out string error)
        {
            result = null;
            error  = null;
            try
            {
                if (IsDynamic)
                {
                    result = DynamicInvoker.GetValue(Object, name);
                    return(true);
                }

                if (IsEnum)
                {
                    result = Enum.Parse(Type, name);
                    return(true);
                }

                var property = InformationOnTheTypes.FindProperty(Type, name);
                if (property == null)
                {
                    if (!FindInterfacePropertyAsObject(name, out property))
                    {
                        error = "Не найдено Свойство " + name;
                        return(false);
                    }
                }

                result = property.GetValue(Object);

                return(true);
            }
            catch (Exception e)
            {
                error = GetExceptionString("получения свойства", name, e);
            }
            result = null;
            return(false);
        }