Пример #1
0
        public static TablePrimitive FromString(string type)
        {
            TablePrimitive primitive = Integer;

            if (Integer.TypeString == type)
            {
                primitive = Integer;
            }
            else if (Float.TypeString == type)
            {
                primitive = Float;
            }
            else if (String.TypeString == type)
            {
                primitive = String;
            }
            else if (Identity.TypeString == type)
            {
                primitive = Identity;
            }
            else if (Date.TypeString == type)
            {
                primitive = Date;
            }
            else
            {
                throw new InvalidOperationException("Unexpected Type");
            }

            return(primitive);
        }
Пример #2
0
        public static TablePrimitive FromType(Type type)
        {
            TablePrimitive primitive = null;

            if (typeof(byte[]) == type)
            {
                primitive = Integer;
            }
            else if (typeof(DownloadedNodes) == type) //nodes
            {
                primitive = String;
            }
            else if (Integer.Type == type)
            {
                primitive = Integer;
            }
            else if (Float.Type == type)
            {
                primitive = Float;
            }
            else if (String.Type == type)
            {
                primitive = String;
            }
            else if (Date.Type == type)
            {
                primitive = Date;
            }

            return(primitive);
        }