コード例 #1
0
        /// <summary>
        /// Reads a value from the property that this property metadata represents, using the given
        /// object instance as the context.
        /// </summary>
        public object Read(object context) {
            try {
                if (MemberInfo is PropertyInfo) {
                    return ((PropertyInfo)MemberInfo).GetValue(context, new object[] { });
                }

                else {
                    return ((FieldInfo)MemberInfo).GetValue(context);
                }
            }
            catch (Exception e) {
                Debug.LogWarning("Caught exception when reading property " + Name + " with " +
                                    " context=" + context + "; returning default value for " +
                                    StorageType.CSharpName());
                Debug.LogException(e);

                return DefaultValue;
            }
        }