示例#1
0
        public IEnumerable <object> GetOutputs()
        {
            return(OutputMappings
                   .Select <PositionInOc5State, object>(mapping =>
            {
                var indexInInputs = InputMappings.IndexOf(mapping);
                var indexInOc5StateList = mapping.IndexInOc5StateList;

                switch (mapping.Type)
                {
                case PredefinedObjects.Types._boolean:
                    return Bools[indexInOc5StateList];

                case PredefinedObjects.Types._integer:
                    return Ints[indexInOc5StateList];

                case PredefinedObjects.Types._string:
                    return Strings[indexInOc5StateList];

                case PredefinedObjects.Types._float:
                    return Floats[indexInOc5StateList];

                case PredefinedObjects.Types._double:
                    return Doubles[indexInOc5StateList];

                default:
                    throw new ArgumentException($"No predefined type with index {mapping.Type}!");
                }
            }
                                                        ));
        }
示例#2
0
        /// <summary>
        ///     Serves as a hash function for a particular type.
        /// </summary>
        /// <returns>
        ///     A hash code for the current <see cref="T:System.Object" />.
        /// </returns>
        public override int GetHashCode()
        {
            unchecked
            {
                // ReSharper disable NonReadonlyFieldInGetHashCode
                int hashCode = Name?.GetHashCode() ?? 0;

                hashCode = (hashCode * 397) ^ (Path?.GetHashCode() ?? 0);
                hashCode = (hashCode * 397) ^ (Source?.GetHashCode() ?? 0);

                if (OutputMappings != null)
                {
                    hashCode = OutputMappings.Aggregate(hashCode, (a, b) => a * 397 ^ (b?.GetHashCode() ?? 0));
                }
                hashCode = (hashCode * 397) ^ (QueryString?.GetHashCode() ?? 0);
                if (Headers != null)
                {
                    hashCode = Headers.Aggregate(hashCode, (current, nameValue) => (current * 397) ^ (nameValue != null ? nameValue.GetHashCode() : 0));
                }
                hashCode = (hashCode * 397) ^ (PostData?.GetHashCode() ?? 0);
                hashCode = (hashCode * 397) ^ Method.GetHashCode();
                return(hashCode);
                // ReSharper restore NonReadonlyFieldInGetHashCode
            }
        }