コード例 #1
0
ファイル: MemberInfoPath.cs プロジェクト: zhanggvi/FlaxEngine
            /// <summary>
            /// Gets the value. Handles arrays.
            /// </summary>
            /// <param name="instance">The instance.</param>
            /// <returns>The result value.</returns>
            public object GetValue(object instance)
            {
                object value;

                // Special case for collections
                if (Index != null)
                {
                    if (instance is System.Collections.IList asList)
                    {
                        // Get value at index
                        value = asList[(int)Index];
                    }
                    else if (instance is System.Collections.IDictionary asDictionary)
                    {
                        // Get value at key
                        value = asDictionary[Index];
                    }
                    else
                    {
                        throw new NotSupportedException();
                    }
                }
                else
                {
                    // Get value
                    value = Member.GetValue(instance);
                }

                return(value);
            }
コード例 #2
0
            public bool GetValue(object instance)
            {
                var value = (bool)Source.GetValue(instance);

                if (Invert)
                {
                    value = !value;
                }
                return(value);
            }