Exemplo n.º 1
0
        public static TDestination?ConvertTo <TSource, TDestination>(TSource source) where TDestination : struct
        {
            if (typeof(TSource) == typeof(DBNull))
            {
                return(null);
            }

            if (source == null)
            {
                return(null);
            }

            return(XConvert <TSource, TDestination> .Convert(source));
        }
Exemplo n.º 2
0
        private static bool IsSequence <T>(CaseInfo <T>[] cases, out T offset)
        {
            if (cases.Length > 0)
            {
                offset = cases[0].Value;

                for (uint i = 0; i < cases.Length; i++)
                {
                    if (XConvert <long> .Convert(offset) + i != XConvert <long> .Convert(cases[i].Value))
                    {
                        return(false);
                    }
                }

                return(true);
            }

            offset = default;

            return(false);
        }
Exemplo n.º 3
0
 public override TDestination Convert <TDestination>(object value) => XConvert <TDestination> .Convert((TSource)value);
Exemplo n.º 4
0
 public static TDestination Convert <TSource, TDestination>(TSource source)
 {
     return(XConvert <TSource, TDestination> .Convert(source));
 }
Exemplo n.º 5
0
 public override object Convert <TSource>(TSource value) => XConvert <TDestination> .Convert(value);