public IEnumerable <ParameterBuffer> ParameterBuffer_int()
        {
            var list = new List <ParameterBuffer>(1);

            list.Add(ParameterBuffer.Create(Int32Value));
            return(list);
        }
        public IEnumerable <ParameterBuffer> ParameterBuffer_string()
        {
            var list = new List <ParameterBuffer>(1);

            list.Add(ParameterBuffer.Create(StringValue));
            return(list);
        }
Exemplo n.º 3
0
        public static ParameterBuffer Create <T>(T value)
        {
            var typeCode = Type.GetTypeCode(typeof(T));

            var parameterBuffer = new ParameterBuffer(typeCode);

            switch (typeCode)
            {
            case TypeCode.Boolean:
                parameterBuffer._value = new Storage {
                    _boolean = Convert.ToBoolean(value)
                };
                return(parameterBuffer);

            case TypeCode.Char:
                parameterBuffer._value = new Storage {
                    _char = Convert.ToChar(value)
                };
                return(parameterBuffer);

            case TypeCode.SByte:
                parameterBuffer._value = new Storage {
                    _sbyte = Convert.ToSByte(value)
                };
                return(parameterBuffer);

            case TypeCode.Byte:
                parameterBuffer._value = new Storage {
                    _byte = Convert.ToByte(value)
                };
                return(parameterBuffer);

            case TypeCode.Int16:
                parameterBuffer._value = new Storage {
                    _int16 = Convert.ToInt16(value)
                };
                return(parameterBuffer);

            case TypeCode.UInt16:
                parameterBuffer._value = new Storage {
                    _uint16 = Convert.ToUInt16(value)
                };
                return(parameterBuffer);

            case TypeCode.Int32:
                parameterBuffer._value = new Storage {
                    _int32 = Convert.ToInt32(value)
                };
                return(parameterBuffer);

            case TypeCode.UInt32:
                parameterBuffer._value = new Storage {
                    _uint32 = Convert.ToUInt32(value)
                };
                return(parameterBuffer);

            case TypeCode.Int64:
                parameterBuffer._value = new Storage {
                    _int64 = Convert.ToInt64(value)
                };
                return(parameterBuffer);

            case TypeCode.UInt64:
                parameterBuffer._value = new Storage {
                    _uint64 = Convert.ToUInt64(value)
                };
                return(parameterBuffer);

            case TypeCode.Single:
                parameterBuffer._value = new Storage {
                    _single = Convert.ToSingle(value)
                };
                return(parameterBuffer);

            case TypeCode.Double:
                parameterBuffer._value = new Storage {
                    _double = Convert.ToDouble(value)
                };
                return(parameterBuffer);

            case TypeCode.Decimal:
                parameterBuffer._value = new Storage {
                    _decimal = Convert.ToDecimal(value)
                };
                return(parameterBuffer);

            case TypeCode.String:
            //parameterBuffer._value = new Storage { _string = Convert.ToString(value) };
            //return parameterBuffer;

            case TypeCode.Object:
            case TypeCode.DBNull:
            case TypeCode.Empty:
            default:
                parameterBuffer._object = value;
                return(parameterBuffer);
            }
        }