ToBinary() public static method

public static ToBinary ( Field value ) : Field
value Field
return Field
        private void ConversionFunctions()
        {
            Register(config => config.Named("cast")
                     .WithDynamicParameter("value")
                     .WithStringParameter("destType")
                     .WhenExecute(Cast.Execute)
                     .ReturnsType(Cast.ReturnType));

            Register(config => config.Named("tonumber")
                     .WithDynamicParameter("value")
                     .WhenExecute(context => Simple(context, args => SystemFunctions.ToNumber(args[0])))
                     .ReturnsNumeric());

            Register(config => config.Named("tostring")
                     .WithDynamicParameter("value")
                     .WhenExecute(context => Simple(context, args => SystemFunctions.ToString(args[0])))
                     .ReturnsString());

            Register(config => config.Named("tobinary")
                     .WithDynamicParameter("value")
                     .WhenExecute(context => Simple(context, args => SystemFunctions.ToBinary(args[0])))
                     .ReturnsType(PrimitiveTypes.Binary()));

            // Date Conversions
            Register(config => config.Named("todate")
                     .WithStringParameter("value")
                     .WhenExecute(context => Simple(context, objects => SystemFunctions.ToDate(objects[0])))
                     .ReturnsType(PrimitiveTypes.Date()));

            Register(config => config.Named("todatetime")
                     .WithStringParameter("value")
                     .WhenExecute(context => Simple(context, args => SystemFunctions.ToDateTime(args[0])))
                     .ReturnsType(PrimitiveTypes.DateTime()));

            Register(config => config.Named("totimestamp")
                     .WithParameter(p => p.Named("value").OfStringType())
                     .WithParameter(p => p.Named("ts").OfStringType())
                     .WhenExecute(context => {
                if (context.ArgumentCount == 1)
                {
                    return(Simple(context, args => SystemFunctions.ToTimeStamp(args[0])));
                }
                if (context.ArgumentCount == 2)
                {
                    return(Simple(context, args => SystemFunctions.ToTimeStamp(args[0], args[1])));
                }

                throw new InvalidOperationException("Invalid number of arguments for TOTIMESTAMP function");
            })
                     .ReturnsType(PrimitiveTypes.TimeStamp()));
        }
        private void AddConversionFunctions()
        {
            Register(config => config.Named("cast")
                     .WithDynamicParameter("value")
                     .WithStringParameter("destType")
                     .WhenExecute(Cast.Execute)
                     .ReturnsType(Cast.ReturnType));

            Register(config => config.Named("tonumber")
                     .WithDynamicParameter("value")
                     .WhenExecute(context => Simple(context, args => SystemFunctions.ToNumber(args[0])))
                     .ReturnsNumeric());

            Register(config => config.Named("tostring")
                     .WithDynamicParameter("value")
                     .WhenExecute(context => Simple(context, args => SystemFunctions.ToString(args[0])))
                     .ReturnsString());

            Register(config => config.Named("tobinary")
                     .WithDynamicParameter("value")
                     .WhenExecute(context => Simple(context, args => SystemFunctions.ToBinary(args[0])))
                     .ReturnsType(PrimitiveTypes.Binary()));

            // Date Conversions
            Register(config => config.Named("todate")
                     .WithStringParameter("value")
                     .WhenExecute(context => Simple(context, objects => SystemFunctions.ToDate(objects[0])))
                     .ReturnsType(PrimitiveTypes.Date()));

            Register(config => config.Named("todatetime")
                     .WithStringParameter("value")
                     .WhenExecute(context => Simple(context, args => SystemFunctions.ToDateTime(args[0])))
                     .ReturnsType(PrimitiveTypes.DateTime()));

            Register(config => config.Named("totimestamp")
                     .WithParameter(p => p.Named("value").OfStringType())
                     .WhenExecute(context => Simple(context, args => SystemFunctions.ToTimeStamp(args[0])))
                     .ReturnsType(PrimitiveTypes.TimeStamp()));
        }